Skip to content

fix(opencode): add trailing newline to CLI help output - #29898

Closed
fcharras wants to merge 2 commits into
anomalyco:devfrom
fcharras:fix/cli-help-trailing-newline
Closed

fix(opencode): add trailing newline to CLI help output#29898
fcharras wants to merge 2 commits into
anomalyco:devfrom
fcharras:fix/cli-help-trailing-newline

Conversation

@fcharras

Copy link
Copy Markdown

Issue for this PR

Closes#28606#26114#24804#22115

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The CLI help output (opencode --help and opencode <command> --help) is written to stderr without a trailing newline. This meant the shell prompt appears directly appended to the last line of the help text, and any tooling consuming the output have no terminating newline.

In show() in packages/opencode/src/index.ts, both write paths now trimEnd() the help text and append a single EOL. This guarantees exactly one trailing newline regardless of whether yargs already produced trailing whitespace, in both the logo branch and the default branch.

I updated the help-text snapshots to reflect the new trailing newline.

How did you verify your code works?

Ran the CLI help commands locally and confirmed the output ends with a single newline. Re-ran the help snapshot test suite, which now passes with the regenerated snapshots.

Screenshots / recordings

N/A — CLI text output change, covered by snapshot tests.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found potential duplicates! There are several related PRs addressing the same help output newline issue:

  1. PR fix: add trailing newline to help output #26374 - fix: add trailing newline to help output
    fix: add trailing newline to help output #26374

  2. PR fix(cli): add newline to help output #28622 - fix(cli): add newline to help output
    fix(cli): add newline to help output #28622

  3. PR fix(opencode): ensure help output ends with newline #28643 - fix(opencode): ensure help output ends with newline
    fix(opencode): ensure help output ends with newline #28643

These PRs all address the same issue of adding a trailing newline to CLI help output. The current PR (#29898) appears to be another attempt to fix the same problem, likely because the previous PRs may have been closed or incomplete. You may want to check the status of these older PRs and consolidate efforts if they're still open.

@github-actions

Copy link
Copy Markdown
Contributor

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:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

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.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI --help lacks trailing newline

1 participant

@fcharras