feat: passthrough fallback when Clap parse fails + review fixes#200
Conversation
|
Tested locally — solid approach, needs rebase + 2 fixes before merge. Testing results:
Must fix:
Nice to have (non-blocking):
This will fix #204, #228, #229 and any future unknown-flag issues globally. Great work! |
0c07be2 to
8142173
Compare
@pszymkowiak Rebased and implemented requested changes. |
…tk-ai#217, rtk-ai#196, rtk-ai#248, rtk-ai#211, rtk-ai#200, rtk-ai#192, rtk-ai#268) Wave 1 (critical bugs): - fix(registry): fi/done moved to IGNORED_EXACT — find no longer shadowed (rtk-ai#246) - fix(playwright): f64 duration, specs[] structure, --reporter=json after subcmd (rtk-ai#193) - fix(gh): should_passthrough_gh_view for --json/--jq/--template/--web in view_pr/issue/run (rtk-ai#217+196) Wave 2 (reliability): - fix(git): is_blob_show_arg — blob show passthrough without trailing-newline trim (rtk-ai#248) - fix(find): parse_find_args with native -name/-type/-maxdepth/-iname support (rtk-ai#211) - fix(main): graceful Clap fallback + parse_failures SQLite table + rtk gain --failures (rtk-ai#200) Wave 3 (UX): - feat(git): global options -C/-c/--git-dir/--work-tree/--no-pager/--no-optional-locks/--bare/--literal-pathspecs (rtk-ai#192) - feat(proxy): streaming output via spawn()+threads instead of buffered output() (rtk-ai#268) Tests: 1091 → 1117 (+26), 0 regressions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Please rebase on master before we can merge — there are conflicts in |
When RTK cannot parse a command (e.g. `rtk git -C /path status`), instead of exiting with error code 2, it now falls back to running the raw command directly. This keeps developer workflows unbroken. - Replace Cli::parse() with try_parse() + run_fallback() - Add parse_failures SQLite table for failure analytics - Add `rtk gain --failures` / `-F` to view failure log - Fallback preserves stdin/stdout/stderr via Stdio::inherit() - --help and --version still work normally Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When Clap fails to parse a meta-command like `rtk gain --badtypo`, show the Clap error directly instead of trying to execute `gain` as a binary from $PATH. Adds RTK_META_COMMANDS constant listing gain, discover, learn, init, config, proxy, hook-audit, cc-economics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TimedExecution::start() was called after the command finished, so all fallback commands showed ~0ms in rtk gain --history. Now the timer captures actual command runtime. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The parse_failures table was never cleaned up because only record() called cleanup_old(). Now parse failures also trigger 90-day retention cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Clap errors may contain terminal color codes. Strip them with utils::strip_ansi() before storing in the parse_failures table to avoid garbled output and wasted space. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- cargo test check now matches RTK's filtered output format ("passed")
in addition to raw "test result:" and "FAILURES"
- Fix undefined `skip` calls to use existing `skip_test` function
with proper (name, reason) arguments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c9816a5 to
a888f02
Compare
Upstream v0.23.0 release bumped Cargo.toml version and added mypy_cmd module. Update docs to match for CI validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pszymkowiak Done. |
|
Hi, this PR has conflicts with master in |
|
Tested locally — all good.
All review items addressed (must-fix and nice-to-have). LGTM, ready to merge. |
Summary
git -C /path status), RTK executes the raw command instead of erroring outgain,discover,learn,init,config,proxy,hook-audit,cc-economics) from falling through to raw$PATHexecution — bad flags likertk gain --badtyposhow the Clap error directlyrtk gain --history(was showing ~0ms)record_parse_failure()(parse_failures table was never cleaned up)cargo testassertion now matches RTK's filtered output, fix undefinedskip→skip_testcallsTest plan
cargo test)bash scripts/test-all.sh)rtk gain --badtyposhows Clap error (not "command not found")rtk git -C /path statusfalls back to rawgit -C /path statusrtk --helpandrtk --versionstill work normallyFixes #204, #228, #229
🤖 Generated with Claude Code