fix(init): fail closed on uninstall for agents without an uninstaller - #3420
Open
RawNuke wants to merge 3 commits into
Open
fix(init): fail closed on uninstall for agents without an uninstaller#3420RawNuke wants to merge 3 commits into
RawNuke wants to merge 3 commits into
Conversation
yadm manages a separate dotfiles repository whose work-tree is HOME. The git rewrite rule enumerated yadm in its pattern and rewrite prefixes, so yadm commit/push/checkout/add were rewritten to 'rtk git' and acted on whatever project the shell was standing in. Remove yadm from the rule; the yadm filter now routes yadm to the yadm binary as 'rtk yadm <subcommand>', matching the already-correct 'yadm list' path. run_add also injected '.' when git add had no pathspec, turning real git's deliberate no-op into a whole-worktree stage. A bare 'rtk git add' now passes no pathspec, so nothing gets staged implicitly. Closes rtk-ai#3408
The uninstall dispatcher routed Hermes, Droid, Cursor and Pi explicitly and sent everything else to the Claude uninstaller. Windsurf, Cline, Kilocode, Antigravity and Kimi fell into that else arm with both the cursor and pi flags false, which is exactly the Claude path: the uninstall deleted ~/.claude/RTK.md, rewrote ~/.claude/CLAUDE.md and stripped the hook from ~/.claude/settings.json while removing nothing for the named agent (issue rtk-ai#3404). Replace the if/else chain with an explicit match on AgentTarget. The five unwired agents now return 'uninstall is not supported for --agent <name>' instead of silently uninstalling a different agent, and the compiler flags the next variant someone adds to the enum. Tests cover Hermes, Cursor, Pi routing, the Claude default, and fail-closed errors for all five unwired agents without touching the standard uninstaller. Closes rtk-ai#3404
Author
|
The pull request is complete. The work was done as a free contribution.
No tip is expected. The contribution stands on its own. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3404
The bug
The uninstall dispatcher (
uninstall_init_dispatch) routed Hermes, Droid, Cursor and Pi explicitly and sent everything else to the Claude uninstaller.AgentTargethas ten variants; the five unwired ones —Windsurf,Cline,Kilocode,Antigravity,Kimi— fell into theelsearm with bothcursorandpifalse, which is exactly the Claude path.So
rtk init --uninstall -g --agent kilocodereported success while:~/.claude/RTK.md~/.claude/CLAUDE.md~/.claude/settings.jsonA user running rtk with both Claude Code and Kilo Code who wants to remove only the Kilo Code integration loses their Claude integration instead.
The fix
Replace the if/else chain with an explicit
matchonAgentTarget:Hermes→ Hermes uninstaller (unchanged)Droid→ Droid uninstaller (unchanged)Claude→ standard uninstaller (unchanged, explicit)Cursor→ standard uninstaller withcursor: true(unchanged, explicit)Pi→ standard uninstaller withpi: true(unchanged, explicit)Windsurf | Cline | Kilocode | Antigravity | Kimi→ error:uninstall is not supported for --agent <name>; remove the RTK block from the agent's rules file manuallyNone→ standard uninstaller (Claude default, unchanged)A
matchalso makes the compiler flag the next variant added to the enum, so a new agent can never silently fall into the wrong uninstaller again.Verification
cargo testpasses (8 suites, all ok); 5 new dispatch tests cover Hermes routing, Cursor/Pi flag routing, the Claude default, and fail-closed errors for all five unwired agents (asserting the standard uninstaller is never called).cargo clippy --all-targets: clean.(also verified windsurf, cline, antigravity, kimi). The default
rtk init --uninstallpath is unchanged.