Repository navigation
fix(init): scope guidance to external commands - #4175
Conversation
📊 Automated PR Analysis
SummaryScopes the 'prefix commands with rtk' guidance to external programs only, explicitly excluding shell builtins/keywords and names that collide with RTK subcommands (test, read, env). Updates the generated full, legacy, and Copilot guidance text to stay consistent and adds a regression test to lock in the new wording. Review Checklist
Linked issues: #3969 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Resolves the two conflicts with develop's `rtk proxy` -> `rtk bypass` rename in docs/guide/getting-started/configuration.md and src/core/config.rs by keeping develop's `bypass` and this branch's `full` wording. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The prefix-rule test checked that each payload scopes the rule and has an exclusion paragraph, but a payload could drop `cd` from its list, or put "the prefix is always safe" back, and every test still passed. One shared assertion now covers the full awareness file, the legacy --claude-md block and the Copilot instructions: the nine builtins in the exclusion list, `env` in the same paragraph, and none of the three old promises in any case or line wrapping. The Cline, Windsurf and Kilo Code READMEs described the payload as the instruction to prefix every shell command; they now describe the scoped rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
KuSh
left a comment
There was a problem hiding this comment.
Round 1 of 3 — APPROVED, follow-ups filed
Claim: the agent guidance tells agents to prefix external programs with rtk and to leave shell builtins unprefixed, in the full awareness file, the legacy --claude-md block and the Copilot instructions.
Scope: accept (round 1, frozen); maintainer PRs: checked against #4269 (KuSh): merges clean, both test sets pass; #4894, #4653, #3875, #4458 and #4402 touch the same files but none of the three payloads, their tests or the RTK.md recognition.
Ran: develop 45e4f89 vs this PR merged onto it × 11 init modes (cline, windsurf -g, kilocode, kimi, codex, copilot, --claude-md, claude at full, antigravity, gemini -g, vibe -g) × fresh install, re-init over a develop install, uninstall of a develop install, second init; 12 builtin names run with the rtk prefix; 8 commands through rtk rewrite; invariants: under the hook | every decision; savings: not applicable (no filter changed).
Pins: 9 decisions, 9 mutated, 4 survived on the PR head (the old "always safe" promise put back in the full or the legacy payload; cd dropped from the full or the Copilot list). The fixup's test kills all 9, plus 5 mutations of its own checks.
Matrix: never — ran this round; pin check: never — ran this round.
CI @380d2130d: all green (15/15, including test on ubuntu, macos, windows msvc and gnu)
Blocks merge (0, frozen at round 1)
None.
Optional — will not hold merge
- "so prefixing from
PATHis safe" (hooks/rtk-awareness-full.md) and "This is safe for programs you would run fromPATH" (RTK_INSTRUCTIONS) are still wrong for programs onPATHthat RTK has its own command for:rtk trust listexits 2 (/usr/bin/trustis p11-kit on Debian/Fedora), andrtk log show --last 1mexits 127 (macOSlog). Stopping the sentence at "run as-is" would avoid the claim. envis placed differently: the full file has it in the list ("or shadowedenv"), while the legacy and Copilot blocks name it in the sentence after the list. Both readings say to leave it unprefixed.[,echoandprintfexit 0 with the prefix (they run the/usr/binprograms), so listing them does no harm.help,.andunsetexit 127 and are not listed.- The "About RTK" paragraph in
rtk-awareness-full.mdwas joined into one 117-character line. That has nothing to do with the claim.
Filed as follow-ups
- #3406: comment added. Existing Cline/Windsurf/Kilo Code installs never get this wording, because re-running
rtk initfinds "rtk" in the rules file and stops. Outside this PR's hunks. - #4958 Docs and this repo's own Copilot instructions still promise the
rtkprefix is always safe (docs/usage/FEATURES.md:55,:1568,.github/copilot-instructions.md:7). Outside this PR's hunks.
Checked and correct — no need to re-verify
- On a fresh install, every mode that writes a payload carries the new rule and the exclusion paragraph, and none carries the old rule. Vibe writes the configured level, which is
defaulthere. - Re-running init over a develop install rewrites the rule for kimi, codex, copilot, --claude-md, claude, antigravity and gemini.
- Uninstalling a develop install with this build leaves the same files that develop's own uninstall leaves, in all 11 modes. Running init a second time is byte-identical in every mode.
- The
src/hooks/init/codex.rshunk disappears in the merge. Develop had already replaced those assertions with frozen payload digests, and the merged file is byte-identical to develop's. - The hook agrees with the new wording:
cd backend && cargo testbecomescd backend && rtk cargo test, and the same holds forexport …,test -f …,source .env && pytestandenv FOO=1 cargo test. The guidance's own chain example is left as it is. rtk cd,rtk export,rtk sourceandrtk evalstill exit 127. The PR changes guidance, not behaviour.- Merged onto develop:
cargo fmt --check,clippy --all-targetsandcargo test --allare clean, with 5475 passed and 0 failed. The same holds with #4269 merged in.
Your questions
None asked. The note in the description about two Git-output tests failing on develop no longer applies: the suite is green on develop 45e4f89.
Next
Fixup 380d213 pushed and code-reviewed. It merges develop (two conflicts with the rtk proxy → rtk bypass rename, resolved by keeping bypass). It pins the builtin list and the dropped "always safe" promise with one test covering all three payloads. It updates the Cline/Windsurf/Kilo Code READMEs, which still described the old rule. Approving.
Rounds: 1/3. Threads: 0 open, 0 resolved this round.
Summary
Test plan
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspecteddevelop; they are unrelated to this change.Fixes #3969