[PR #3638] fix: ensure flags & docs match #10717

Closed
opened 2026-02-16 18:15:27 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3638

State: closed
Merged: Yes


Perfect! Let me create a summary of what we've accomplished:

Summary

I have successfully analyzed the OpenCode CLI command structure and updated both the source code and documentation to address the issues raised in the GitHub issue:

Changes Made:

  1. Updated source code (packages/opencode/src/index.ts):

    • Added .alias("help", "h") to make -h an alias for --help
  2. Updated source code (packages/opencode/src/cli/cmd/tui.ts and packages/opencode/src/cli/cmd/serve.ts):

    • Removed alias: ["h"] from the --hostname option to free up -h for help
  3. Updated documentation (packages/web/src/content/docs/cli.mdx):

    • Global flags section: Removed -h as alias for --help (now it's the actual alias)
    • Global flags section: Removed -p as alias for --prompt (it's only available in TUI command)
    • Run command flags: Added missing flags:
      • --file with alias -f for "File(s) to attach to message"
      • --format for "Format: default (formatted) or json (raw JSON events)"
      • --title for "Title for the session (uses truncated prompt if no value provided)"
    • Serve command flags: Removed -h alias for --hostname to match source code changes

Result:

Now when users run opencode -h, it will show the help instead of requiring --help. This addresses the core issue raised about -h being a more intuitive alias for help than --hostname.

The documentation now accurately reflects the actual flag usage in the CLI, fixing the contradictions mentioned in the issue comments.

Closes #3616

New%20session%20-%202025-10-31T21%3A11%3A59.973Z
opencode session  |  github run

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3638 **State:** closed **Merged:** Yes --- Perfect! Let me create a summary of what we've accomplished: ## Summary I have successfully analyzed the OpenCode CLI command structure and updated both the source code and documentation to address the issues raised in the GitHub issue: ### ✅ Changes Made: 1. **Updated source code** (`packages/opencode/src/index.ts`): - Added `.alias("help", "h")` to make `-h` an alias for `--help` 2. **Updated source code** (`packages/opencode/src/cli/cmd/tui.ts` and `packages/opencode/src/cli/cmd/serve.ts`): - Removed `alias: ["h"]` from the `--hostname` option to free up `-h` for help 3. **Updated documentation** (`packages/web/src/content/docs/cli.mdx`): - **Global flags section**: Removed `-h` as alias for `--help` (now it's the actual alias) - **Global flags section**: Removed `-p` as alias for `--prompt` (it's only available in TUI command) - **Run command flags**: Added missing flags: - `--file` with alias `-f` for "File(s) to attach to message" - `--format` for "Format: default (formatted) or json (raw JSON events)" - `--title` for "Title for the session (uses truncated prompt if no value provided)" - **Serve command flags**: Removed `-h` alias for `--hostname` to match source code changes ### ✅ Result: Now when users run `opencode -h`, it will show the help instead of requiring `--help`. This addresses the core issue raised about `-h` being a more intuitive alias for help than `--hostname`. The documentation now accurately reflects the actual flag usage in the CLI, fixing the contradictions mentioned in the issue comments. Closes #3616 <a href="https://opencode.ai/s/a8cvv3wQ"><img width="200" alt="New%20session%20-%202025-10-31T21%3A11%3A59.973Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTEwLTMxVDIxOjExOjU5Ljk3M1o=.png?model=opencode/glm-4.6&version=1.0.2&id=a8cvv3wQ" /></a> [opencode session](https://opencode.ai/s/a8cvv3wQ)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/18985325567)
yindo added the pull-request label 2026-02-16 18:15:27 -05:00
yindo closed this issue 2026-02-16 18:15:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10717