Repository navigation
fix(cli): add help [cmd], suggest the closest command or flag, and quiet the nags - #6621
Conversation
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 1 nit
This approval covers this diff at aeb5991 only. As a stacked PR it gets no CI run, so I ran the agent-mode suite and the touched unit tests locally at the top of the stack. I also checked by hand: help rendr and cloud rendr exit 2 with the suggestion and usage on stderr. Full CI runs once this is retargeted to main. The blocker on #6616/#6617 (isUnattended()) also affects this PR's skills-notice gating, but the fix belongs there.
— Genesis
6e43f2d to
975d2c9
Compare
aeb5991 to
b741bd5
Compare
975d2c9 to
49624ea
Compare
The base branch was changed.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
…iet the nags
`hyperframes help` printed "Unknown command help" with raw ANSI codes and no
suggestion. It is now an alias: `help [cmd...]` is `[cmd...] --help`.
An unknown command (at the root or inside a group like `cloud`) prints
"Unknown command: rendr", "Did you mean 'hyperframes render'?" and the group's
usage, all on stderr, and exits 2. An unknown flag suggests the flag it most
likely means ("Did you mean --output?"). Usage text printed for a usage error
now goes to stderr instead of stdout, and citty's colors are stripped from
help whenever this CLI's own colors are off.
No update, skills or app-history notice is appended to a usage error. The
skills notice shows at most once a day per project (timestamps in
~/.hyperframes/skills-notice.json) and, in an unattended run, only when a core
skill is missing.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ommand citty looks for an alias on every registered command before it reports an unknown name, which loads all of them. From a source checkout without the studio packages built, that meant `hyperframes rendr` failed in preview's build check with exit 1 instead of suggesting `render`. The name is now checked against the registry first. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… itself `hyperframes help cloud rendr` printed cloud's help and exited 0, while `hyperframes cloud rendr` exits 2 with a suggestion. Both now exit 2 with the suggestion. A group that also takes positional arguments (timeline takes a project directory) still shows its help for a word it does not know. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
b741bd5 to
75e80e4
Compare
Edit accuracy: accurate 271 (base branch 271), smooth 145 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
There was a problem hiding this comment.
Verdict: APPROVE — 0 resolved, 0 open, 0 new · b741bd5 → 75e80e4. Rebase only: the patch matches b741bd5 apart from a one-line hunk offset in cli.ts (main added an import). CI on this head passed every required job; the run shows cancelled only because edit-accuracy shard 1/5 was cancelled, and its retry and the gate passed.
— Genesis
What
Third of four stacked PRs (base: #6617). Fixes the two P1 findings about help and nags:
hyperframes helpprintedUnknown command helpwith raw ANSI codes, no suggestion, and could be followed by update/skills nags.help [cmd...]is now an alias for[cmd...] --help.cloud, printsUnknown command: rendr,Did you mean 'hyperframes render'?and that group's usage, all on stderr, and exits 2. An unknown flag suggests the flag it most likely means (Did you mean --output?). Usage printed for a usage error now goes to stderr, not stdout.--jsonand without a TTY. It now shows at most once a day per project, and in an unattended run only when a core skill is missing.--helpwhenever this CLI's colors are off (they leaked into piped output inside an agent unlessCIwas set).Why
An agent that types
hyperframes helpor a near miss should get the answer, or the right command name, not a colored error. A notice an agent sees on every call is noise it has to filter out of every result.Related work
Stack: #6616 → #6617 → this PR → JSON envelope.
How
cli.tsrewriteshelp ...to... --helpbefore anything reads argv, sohelpis reserved and behaves exactly like--help.utils/didYouMean.ts:closestMatch()(prefix match first, then edit distance with a small threshold). Used for commands and for long flags.commandUsageResolution.tsnow also returns the command path and the first word that is not a subcommand of a group, which is what the suggestion and the group usage need.help.tsshowUsagetakes the print function, so the same renderer writes help to stdout and usage-error output to stderr.finalizeCliskips the notices when the result is a usage error.skillsUpdateCheck.ts: one small JSON file,skills-notice.jsonin the CLI config folder (.hyperframesin the home folder), maps project directory to the last time the notice was shown; entries older than a day are dropped on write. Unattended, outdated-only skills are not mentioned.Behavior change for a person at a terminal:
helpworks, and the skills notice shows once a day per project instead of on every run.Test plan
didYouMean.test.ts,commandUsageResolution.test.ts,skillsUpdateCheck.test.ts(once a day per project; unattended outdated-only is silent; missing still shows),reject-unknown-flags.test.tshelp,help render,help cloud render; unknown commands at the root, in a group and viahelp; the--outsuggestion; help withoutCIinside an agent has no ANSItypecheck,oxlint,oxfmt --check,fallow audit, comment ratchet passhelp, suggestions and the skills notice indocs/packages/cli.mdxManual runs of the built CLI,
CLAUDECODE=1, stdin from/dev/null:🤖 Generated with Claude Code