Skip to content

feat(discover): track passthrough git/cargo/pnpm subcommands#889

Open
FlorianBruniaux wants to merge 2 commits intodevelopfrom
fix/discover-passthrough-coverage
Open

feat(discover): track passthrough git/cargo/pnpm subcommands#889
FlorianBruniaux wants to merge 2 commits intodevelopfrom
fix/discover-passthrough-coverage

Conversation

@FlorianBruniaux
Copy link
Copy Markdown
Collaborator

Summary

rtk discover --all reports git checkout, git merge, git rebase, pnpm build, pnpm exec, cargo run, and cargo publish as 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.rs didn't include these subcommands, so they appeared unhandled instead of "already tracked, passthrough mode".

Changes

  • src/discover/rules.rs: add checkout|merge|rebase to git pattern, run|publish to cargo pattern, build|exec to pnpm pattern. Mark each as RtkStatus::Passthrough in subcmd_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 from feature/help-reorganize to fix pre-push validation.

Impact

1277 commands correctly classified in discover output. Zero filtering changes, zero performance impact.

Subcommands Occurrences
git checkout / merge / rebase 784
pnpm build / exec 344
cargo run / publish 149

Closes #888

Test plan

  • cargo fmt --all — clean
  • cargo clippy --all-targets — 0 errors, 2 pre-existing warnings
  • cargo test --all — 1134 passed, 3 ignored
  • rtk 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

FlorianBruniaux and others added 2 commits March 28, 2026 01:06
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>
Copilot AI review requested due to automatic review settings March 28, 2026 00:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and pnpm build|exec.
  • Mark those newly-covered subcommands as RtkStatus::Passthrough in the rule registry.
  • Update/expand registry tests to validate classification and rewrite behavior for these commands, and update CLAUDE.md docs.

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.

Comment on lines +893 to 895
// 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}");
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 904 to 909
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",
] {
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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”).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants