fix(opencode): show CLI failure message before help#31228
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
This PR appears to be addressing the same issue—showing error messages in the CLI I recommend checking PR #29393 to see if it's still active or if the current PR #31228 is an improved version of that work. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #29390
Type of change
What does this PR do?
When yargs reports an invalid CLI argument, the top-level
.fail()handler showed the full help text but did not print the failure message. That madeopencode --unkown-flaglook the same asopencode --help.This change prints the yargs failure message with the existing CLI error formatter before rendering help. It keeps the existing help behavior while making invalid arguments visible to the user. A subprocess regression test covers the invalid-argument path and checks that the error appears before the help command list.
How did you verify your code works?
bun test test/cli/fail-help.test.tsfrompackages/opencodebun typecheckfrompackages/opencodenpm run lintfallback at repo root: 3537 warnings, 0 errorsbun turbo typecheckpassedScreenshots / recordings
Not applicable. This is CLI stderr output.
Checklist