feat(discover): expand subcommand coverage and strip verbose flags#549
feat(discover): expand subcommand coverage and strip verbose flags#549bz00qa wants to merge 2 commits intortk-ai:developfrom
Conversation
|
real results from "rtk discover --all" report before vs. after: |
…ip verbose flags Improve the discover registry's command parsing robustness: - Fix ENV_PREFIX regex to handle quoted values with spaces (e.g., PATH="/c/Program Files/nodejs:$PATH") - Add PURE_ASSIGNMENT detection to ignore bare variable assignments - Strip leading operators (&&, ||, ;) from classify_command input - Add strip_verbose_flags() to remove -v/--verbose/--debug from rewritten commands (with denylist for grep -v) - Expand git pattern to 51 subcommands with -C flag support - Expand cargo pattern to 13 subcommands (tree, doc, bench, clean, update, publish, add, remove) - Expand pnpm pattern with --filter/-F/-r support and 21 subcommands - Expand npm pattern to 25 subcommands (test, install, ci, build, etc.) - Expand go pattern to 14 subcommands (mod, tool, run, fmt, generate, etc.) - Add subcmd_status Passthrough entries for non-filtered subcommands - Expand IGNORED_PREFIXES with Windows commands, Python scripts, version checks, Unix utilities - Expand IGNORED_EXACT with env, printenv, whoami, hostname, date, id, uname - Add 40+ new tests covering all changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: bz00qa <bz00qa.hub@gmail.com>
8d052c2 to
1b88f0b
Compare
Signed-off-by: bZ00qa <167500396+bz00qa@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
|
Hey We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes No logic changes — only file moves and import path updates. What you need to doRebase your branch on git fetch origin && git rebase origin/developGit detects renames automatically. If you get import conflicts, update the paths: use crate::git; // now: use crate::cmds::git::git;
use crate::tracking; // now: use crate::core::tracking;
use crate::config; // now: use crate::core::config;
use crate::init; // now: use crate::hooks::init;
use crate::gain; // now: use crate::analytics::gain;Need help rebasing? Tag @aeppling |
Summary
PATH="/c/Program Files/nodejs:$PATH" npm run build)FOO=barthat aren't commands&&,||,;) inclassify_commandto handle shell parsing artifacts-v,--verbose,--debug) from rewritten commands to reduce token-heavy output, with a denylist for commands where-vmeans something else (e.g.,grep -v= invert match)-Cflag support (git -C /dir status)--filter/-F/-rflag support and 21 subcommandssubcmd_status: Passthroughentries for non-filtered subcommands across all expanded commandsenv,printenv,whoami,hostname,date,id,unameMotivation
The discover registry and hook rewrite system are critical for RTK adoption — they determine which commands get rewritten and which get ignored. The current patterns miss many common subcommands (e.g.,
git checkout,npm install,go mod tidy,pnpm --filter), causing false negatives inrtk discoverreports and missed rewrite opportunities in hooks.The ENV_PREFIX regex also breaks on quoted values with spaces (common on Windows with
PATH="/c/Program Files/..."patterns), and bare variable assignments likePATH=...(without a following command) were incorrectly classified as unsupported commands.Test plan
cargo test discover::registry::tests)cargo fmt --all && cargo clippy --all-targetsclean (no new warnings)rtk discoveroutput with expanded patterns🤖 Generated with Claude Code