Skip to content

fix(cli): make rtk stats a real alias of gain (#3263) - #3312

Open
NanoRisk6 wants to merge 1 commit into
rtk-ai:developfrom
NanoRisk6:cat/stats-alias-gain-3263
Open

fix(cli): make rtk stats a real alias of gain (#3263)#3312
NanoRisk6 wants to merge 1 commit into
rtk-ai:developfrom
NanoRisk6:cat/stats-alias-gain-3263

Conversation

@NanoRisk6

Copy link
Copy Markdown

What Problem This Solves

rtk stats exited 127 with only [rtk: No such file or directory (os error 2)] and no table. Users expected savings stats (like rtk gain); instead the CLI fell through parse-fallback and tried to spawn a PATH binary named stats. Fixes #3263.

Why This Change Was Made

  1. Add clap visible_alias = "stats" on gain
  2. Add stats to RTK_META_COMMANDS so bad flags never fall through to raw spawn
  3. Regression test: rtk stats --daily parses as Gain { daily: true }

User Impact

rtk stats (and flags like --daily) works as token-savings summary — same as gain. No more opaque 127 when ccusage/npx are unrelated.

Evidence

cargo test --bin rtk stats_alias
# test_stats_alias_routes_to_gain ... ok

`rtk stats` was not a clap subcommand, so parse fallback tried to spawn a
PATH binary named `stats` and died with opaque exit 127. Route stats to
gain (visible alias) and mark it meta so bad flags never fall through.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

rtk stats exits 127 with opaque "No such file or directory (os error 2)" and produces no output

2 participants