fix(opencode): print CLI parser errors#29418
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate PRs found:
Why they're related: All three PRs (#29418, #29400, #29393) address the same issue (#29390) of displaying CLI parser error messages. PR #29418 (current) and the other two are likely duplicate efforts to fix the invalid CLI arguments error display problem. You may want to check if one of these has already been merged or if they should be consolidated. |
|
Checked the duplicate candidates.
So the implementation scope is intentionally small, but the difference is that this PR keeps the behavior covered at the CLI boundary that regressed. |
Issue for this PR
Closes #29390
Type of change
What does this PR do?
Prints the yargs parser error message before showing top-level help for invalid CLI arguments.
Before this change,
opencode --unkown-flagexited non-zero but produced the same visible output asopencode --help, so users could not tell what was wrong. The fail handler already receives the parser message; this writes it to stderr before rendering help.How did you verify your code works?
PATH="$HOME/.bun/bin:$PATH" bun test test/cli/invalid-args.test.tsPATH="$HOME/.bun/bin:$PATH" bun test test/cli/invalid-args.test.ts test/cli/help/help-snapshots.test.ts test/cli/smokes/read-only.test.tsPATH="$HOME/.bun/bin:$PATH" bun typecheckgit diff --checkI also ran
.husky/pre-push; it failed in the unrelated@opencode-ai/console-supportpackage because local dependencies/types such as@solidjs/meta,@solidjs/router,solid-js,vite, and generated@opencode-ai/console-core/...modules were missing. Theopencodepackage checks above passed.Screenshots / recordings
N/A - CLI stderr behavior only.
Checklist