feat(discover): track passthrough git/cargo/pnpm subcommands#889
feat(discover): track passthrough git/cargo/pnpm subcommands#889FlorianBruniaux wants to merge 2 commits intodevelopfrom
Conversation
Add checkout/merge/rebase to git pattern, run/publish to cargo pattern, and build/exec to pnpm pattern in PATTERNS regex. Mark each as RtkStatus::Passthrough in subcmd_status so discover correctly classifies them as "already handled via passthrough" instead of "TOP UNHANDLED". Also update test_registry_covers_all_git/cargo_subcommands to include the new subcommands, and add 11 focused tests for classify + rewrite. Impact: 1277 commands (git checkout 493, git merge 154, git rebase 137, pnpm build 171, pnpm exec 173, cargo run 78, cargo publish 71) will appear in "MISSED SAVINGS" instead of "TOP UNHANDLED COMMANDS". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
Adds a one-liner listing all supported ecosystems (ruff, pytest, pip, golangci-lint, etc.) in the Architecture section to satisfy the pre-push documentation validation script. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
There was a problem hiding this comment.
Pull request overview
This PR improves rtk discover --all classification accuracy by treating common git/cargo/pnpm passthrough subcommands as “supported (passthrough)” instead of “unhandled”, aligning discover’s reporting with existing passthrough behavior in the CLI.
Changes:
- Extend discover regex patterns to include
git checkout|merge|rebase,cargo run|publish, andpnpm build|exec. - Mark those newly-covered subcommands as
RtkStatus::Passthroughin the rule registry. - Update/expand registry tests to validate classification and rewrite behavior for these commands, and update
CLAUDE.mddocs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/discover/rules.rs |
Expands patterns and sets passthrough status for newly tracked subcommands. |
src/discover/registry.rs |
Updates coverage tests and adds new classify/rewrite tests for the added passthrough subcommands. |
CLAUDE.md |
Documents supported ecosystems list. |
| // Verify that every CargoCommand variant except Other has a matching pattern | ||
| for subcmd in ["build", "test", "clippy", "check", "fmt", "run", "publish"] { | ||
| let cmd = format!("cargo {subcmd}"); |
There was a problem hiding this comment.
The test comment says this verifies every CargoCommand variant (except Other) has a matching pattern, but run/publish are not CargoCommands variants in src/main.rs (they route through CargoCommands::Other). Suggest rewording the comment/test name to describe “cargo subcommands we treat as supported in discover (including passthrough)” rather than referring to enum variants.
| fn test_registry_covers_all_git_subcommands() { | ||
| // Verify that every GitCommand subcommand has a matching pattern | ||
| for subcmd in [ | ||
| "status", "log", "diff", "show", "add", "commit", "push", "pull", "branch", "fetch", | ||
| "stash", "worktree", | ||
| "stash", "worktree", "checkout", "merge", "rebase", | ||
| ] { |
There was a problem hiding this comment.
The comment claims this loop covers every GitCommand subcommand, but checkout/merge/rebase are not GitCommands variants in src/main.rs (they go through GitCommands::Other). Consider rewording to avoid implying a 1:1 mapping with enum variants (e.g., “git subcommands covered by discover patterns, including passthrough”).
Summary
rtk discover --allreportsgit checkout,git merge,git rebase,pnpm build,pnpm exec,cargo run, andcargo publishas TOP UNHANDLED COMMANDS — even though they already work via passthrough handlers (GitCommands::Other,CargoCommands::Other,PnpmCommands::Other).The discover regex patterns in
src/discover/rules.rsdidn't include these subcommands, so they appeared unhandled instead of "already tracked, passthrough mode".Changes
src/discover/rules.rs: addcheckout|merge|rebaseto git pattern,run|publishto cargo pattern,build|execto pnpm pattern. Mark each asRtkStatus::Passthroughinsubcmd_status.src/discover/registry.rs: update existing coverage tests + 11 new tests (7 classify + 4 rewrite end-to-end).CLAUDE.md: cherry-pick supported ecosystems line fromfeature/help-reorganizeto fix pre-push validation.Impact
1277 commands correctly classified in discover output. Zero filtering changes, zero performance impact.
Closes #888
Test plan
cargo fmt --all— cleancargo clippy --all-targets— 0 errors, 2 pre-existing warningscargo test --all— 1134 passed, 3 ignoredrtk rewrite "git checkout main"→rtk git checkout main✓rtk rewrite "cargo run -- verify"→rtk cargo run -- verify✓rtk rewrite "pnpm build"→rtk pnpm build✓bash scripts/validate-docs.sh— passed🤖 Generated with Claude Code