You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Hackathon] fix(cli): help <typo> silently exits 0 inside command groups (root correctly exits 5) #418
testsprite <group> help <typo> and testsprite <group> <typo> --help exit 0 and print the group's help, silently swallowing the misspelled subcommand — while the same shapes at root level correctly fail with exit 5 (error: unknown command '<name>'). The typo'd name is never reported.
Repro (no credentials needed):
$ testsprite help badcmd ->exit 5, error: unknown command'badcmd' [correct]
$ testsprite testhelp badsub ->exit 0, prints `testsprite test`help [wrong]
$ testsprite test badsub --help ->exit 0, prints `testsprite test`help [wrong]
$ testsprite helptest badsub ->exit 0 [wrong]
$ testsprite project env help badsub ->exit 0 [wrong]
Every command group behaves this way (test, project, project env, agent, ci, schedule, testlist, tunnel, auth, test code, test plan, schedule run). A script or agent that asks for a subcommand's help cannot tell — via exit code — whether that subcommand actually exists, and with --output json it gets a text help dump instead of the JSON VALIDATION_ERROR envelope.
Root cause: unknownRootCommandMaskedByHelp in src/index.ts runs inside an addHelpText('beforeAll') hook that bails unless context.command === program, so the unknown-command check only ever fires for root help. For group help, Commander's own "show parent help" fallback wins and throws commander.help -> exit 0.
Details / implementation notes
Fix generalizes the mask check into unknownCommandMaskedByHelp: walk the argument path down the command tree (skipping the argument of value-taking options like --output json), and report the first token that fails to resolve to a real subcommand whenever a help path is being rendered or a later --help/-h would mask the error. Covers help bad, <g> bad --help, <g> help bad, help <g> bad, and arbitrarily nested groups. Verified: valid help targets (test help run, test run --help, help test, project help env) still exit 0, and --output json emits the proper VALIDATION_ERROR envelope.
A PR with the fix + regression tests will follow referencing this issue.
Confirmations
I have searched existing issues and this is not a duplicate.
I have provided my Discord identity above for reward coordination.
Thanks for the interest, @Lexiie! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it accepted once it is). Feel free to check back, or ping us on Discord if it's been quiet.
Thanks — the inconsistency is real (the unknown-command guard only runs at the root). We're in the middle of rewriting the CLI's command surface, and help/typo handling will be redone as part of that, so we won't take a point fix on the current command tree. Closing this and #541; appreciate the PR.
Activity
fix(cli): report unknown subcommands masked by help inside command gr…
Lexiie commentedon Oct 19, 2026
/assign
testsprite-hob commentedon Oct 19, 2026
Thanks for the interest, @Lexiie! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it
acceptedonce it is). Feel free to check back, or ping us on Discord if it's been quiet.fyZhang66 commentedon Oct 20, 2026
Thanks — the inconsistency is real (the unknown-command guard only runs at the root). We're in the middle of rewriting the CLI's command surface, and help/typo handling will be redone as part of that, so we won't take a point fix on the current command tree. Closing this and #541; appreciate the PR.