Skip to content

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

Closed
spacelatte wants to merge 1 commit into
anomalyco:devfrom
spacelatte:fix/help-newline-final
Closed

fix(opencode): add trailing newline to help output#30547
spacelatte wants to merge 1 commit into
anomalyco:devfrom
spacelatte:fix/help-newline-final

Conversation

@spacelatte

@spacelattespacelatte commented Jun 3, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#28606 & #26114

Type of change

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

What does this PR do?

The --help output does not end with a newline. When used Zsh, this was not an issue as the shell prompt detects this and adds the newline automatically. But when used in a simple Bash shell, the subsequent prompt appears at the end of the last line.

How did you verify your code works?

  • bun install && bun run dev -- --help -> validated prompt appears on a newline
  • bun install && bun run dev -- --unknown-param -> validated prompt appears on a newline

Also fixes that the error message itself appears on a newline too, eg:

## BEFORE
--fork fork the session when continuing (use with --continue or --session) [boolean]
--prompt prompt to use [string]
--agent agent to use [string]error: script "dev" exited with code 1
user@localhost:~/work/github.com/anomalyco/opencode$
## AFTER
--fork fork the session when continuing (use with --continue or --session) [boolean]
--prompt prompt to use [string]
--agent agent to use [string]
error: script "dev" exited with code 1
user@localhost:~/work/github.com/anomalyco/opencode$

Screenshots / recordings

N/A, see excerpts below;

Before

user@localhost:~/work/github.com/anomalyco/opencode$ opencode --help
▄
█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
Commands:
opencode completion generate shell completion script
opencode acp start ACP (Agent Client Protocol) server
opencode mcp manage MCP (Model Context Protocol) servers
opencode [project] start opencode tui [default]
opencode attach <url> attach to a running opencode server
opencode run [message..] run opencode with a message
opencode debug debugging and troubleshooting tools
opencode providers manage AI providers and credentials [aliases: auth]
opencode agent manage agents
opencode upgrade [target] upgrade opencode to the latest or a specific version
opencode uninstall uninstall opencode and remove all related files
opencode serve starts a headless opencode server
opencode web start opencode server and open web interface
opencode models [provider] list all available models
opencode stats show token usage and cost statistics
opencode export [sessionID] export session data as JSON
opencode import <file> import session data from JSON file or URL
opencode github manage GitHub agent
opencode pr <number> fetch and checkout a GitHub PR branch, then run opencode
opencode session manage sessions
opencode plugin <module> install plugin and update config [aliases: plug]
opencode db database tools
Positionals:
project path to start opencode in [string]
Options:
-h, --help show help [boolean]
-v, --version show version number [boolean]
--print-logs print logs to stderr [boolean]
--log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
--pure run without external plugins [boolean]
--port port to listen on [number] [default: 0]
--hostname hostname to listen on [string] [default: "127.0.0.1"]
--mdns enable mDNS service discovery (defaults hostname to 0.0.0.0)
[boolean] [default: false]
--mdns-domain custom domain name for mDNS service (default: opencode.local)
[string] [default: "opencode.local"]
--cors additional domains to allow for CORS [array] [default: []]
-m, --model model to use in the format of provider/model [string]
-c, --continue continue the last session [boolean]
-s, --session session id to continue [string]
--fork fork the session when continuing (use with --continue or --session) [boolean]
--prompt prompt to use [string]
--agent agent to use [string]user@localhost:~/work/github.com/anomalyco/opencode$

After

user@localhost:~/work/github.com/anomalyco/opencode$ opencode --help
▄
█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
Commands:
opencode completion generate shell completion script
opencode acp start ACP (Agent Client Protocol) server
opencode mcp manage MCP (Model Context Protocol) servers
opencode [project] start opencode tui [default]
opencode attach <url> attach to a running opencode server
opencode run [message..] run opencode with a message
opencode debug debugging and troubleshooting tools
opencode providers manage AI providers and credentials [aliases: auth]
opencode agent manage agents
opencode upgrade [target] upgrade opencode to the latest or a specific version
opencode uninstall uninstall opencode and remove all related files
opencode serve starts a headless opencode server
opencode web start opencode server and open web interface
opencode models [provider] list all available models
opencode stats show token usage and cost statistics
opencode export [sessionID] export session data as JSON
opencode import <file> import session data from JSON file or URL
opencode github manage GitHub agent
opencode pr <number> fetch and checkout a GitHub PR branch, then run opencode
opencode session manage sessions
opencode plugin <module> install plugin and update config [aliases: plug]
opencode db database tools
Positionals:
project path to start opencode in [string]
Options:
-h, --help show help [boolean]
-v, --version show version number [boolean]
--print-logs print logs to stderr [boolean]
--log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
--pure run without external plugins [boolean]
--port port to listen on [number] [default: 0]
--hostname hostname to listen on [string] [default: "127.0.0.1"]
--mdns enable mDNS service discovery (defaults hostname to 0.0.0.0)
[boolean] [default: false]
--mdns-domain custom domain name for mDNS service (default: opencode.local)
[string] [default: "opencode.local"]
--cors additional domains to allow for CORS [array] [default: []]
-m, --model model to use in the format of provider/model [string]
-c, --continue continue the last session [boolean]
-s, --session session id to continue [string]
--fork fork the session when continuing (use with --continue or --session) [boolean]
--prompt prompt to use [string]
--agent agent to use [string]
user@localhost:~/work/github.com/anomalyco/opencode$

Checklist

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

@github-actionsgithub-actionsBot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jun 3, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

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

Potential duplicate PRs found:

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

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

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

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

These PRs all address the exact same issue: adding a trailing newline to the help output to ensure the shell prompt appears on a new line. You should check the status of these existing PRs (merged, closed, or still open) before proceeding with PR #30547.

@github-actionsgithub-actionsBot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jun 3, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@spacelatte
spacelatteforce-pushed the fix/help-newline-final branch from 59bf1cb to 520a9f2CompareJune 3, 2026 10:24
@spacelatte
spacelatte marked this pull request as ready for review June 3, 2026 10:25
CopilotAI review requested due to automatic review settings June 3, 2026 10:25

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adjusts CLI stderr output formatting to always end messages with a newline.

Changes:

  • Append EOL to non-opencode output written to stderr.
  • Append EOL to normal opencode output written to stderr.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/opencode/src/index.ts
@spacelatte

Copy link
Copy Markdown
Author

C'mon guys. These are fairly simple fixes that can be merged. Others can be closed as duplicates. Just annoying that prompt gets stuck at some other column than 0, unnecessary wrapping occurs.

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

Potential duplicate PRs found:

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

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

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

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

These PRs all address the exact same issue: adding a trailing newline to the help output to ensure the shell prompt appears on a new line. You should check the status of these existing PRs (merged, closed, or still open) before proceeding with PR #30547.

@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.

@spacelatte
spacelatte deleted the fix/help-newline-final branch July 13, 2026 13:54
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

2 participants

@spacelatte