Confusing that opencode -h doesn't show the help #2386

Closed
opened 2026-02-16 17:35:25 -05:00 by yindo · 7 comments
Owner

Originally created by @jdanbrown on GitHub (Oct 31, 2025).

Originally assigned to: @rekram1-node on GitHub.

Question

It's very idiomatic for both -h and --help to show the help for a cli tool, so I always try opencode -h and get confused when it opens the chat UI instead of showing help.

I see in the help that -h is an alias for --hostname — I'd guess that users trying to use -h for help is a much more common use case than users wanted to use -h for hostname? Certainly for new users, which I'd argue is an important segment to smooth out UX for.

Wdyt about changing -h to be an alias for --help instead of --hostname?

$ opencode --version
0.15.28

$ opencode --help

█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
▀▀▀▀ █▀▀▀ ▀▀▀ ▀  ▀ ▀▀▀ ▀▀▀▀ ▀▀▀  ▀▀▀

Commands:
  opencode acp                 Start ACP (Agent Client Protocol) server
  opencode [project]           start opencode tui                      [default]
  opencode attach <server>     attach to a running opencode server
  opencode run [message..]     run opencode with a message
  opencode auth                manage credentials
  opencode agent               manage agents
  opencode upgrade [target]    upgrade opencode to the latest or a specific
                               version
  opencode serve               starts a headless opencode server
  opencode models              list all available models
  opencode export [sessionID]  export session data as JSON
  opencode github              manage GitHub agent

Positionals:
  project  path to start opencode in                                    [string]

Options:
      --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"]
  -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]
  -p, --prompt      prompt to use                                       [string]
      --agent       agent to use                                        [string]
      --port        port to listen on                      [number] [default: 0]
  -h, --hostname    hostname to listen on        [string] [default: "127.0.0.1"]
Originally created by @jdanbrown on GitHub (Oct 31, 2025). Originally assigned to: @rekram1-node on GitHub. ### Question It's very idiomatic for both `-h` and `--help` to show the help for a cli tool, so I always try `opencode -h` and get confused when it opens the chat UI instead of showing help. I see in the help that `-h` is an alias for `--hostname` — I'd guess that users trying to use `-h` for help is a much more common use case than users wanted to use `-h` for hostname? Certainly for new users, which I'd argue is an important segment to smooth out UX for. Wdyt about changing `-h` to be an alias for `--help` instead of `--hostname`? ```sh $ opencode --version 0.15.28 $ opencode --help █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀ █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀ ▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ Commands: opencode acp Start ACP (Agent Client Protocol) server opencode [project] start opencode tui [default] opencode attach <server> attach to a running opencode server opencode run [message..] run opencode with a message opencode auth manage credentials opencode agent manage agents opencode upgrade [target] upgrade opencode to the latest or a specific version opencode serve starts a headless opencode server opencode models list all available models opencode export [sessionID] export session data as JSON opencode github manage GitHub agent Positionals: project path to start opencode in [string] Options: --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"] -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] -p, --prompt prompt to use [string] --agent agent to use [string] --port port to listen on [number] [default: 0] -h, --hostname hostname to listen on [string] [default: "127.0.0.1"] ```
yindo closed this issue 2026-02-16 17:35:25 -05:00
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

kinda funny that it contradicts the docs: https://opencode.ai/docs/cli/#flags-4

I suppose we should change that

@rekram1-node commented on GitHub (Oct 31, 2025): kinda funny that it contradicts the docs: https://opencode.ai/docs/cli/#flags-4 I suppose we should change that
Author
Owner

@jdanbrown commented on GitHub (Oct 31, 2025):

Oh oops. :)

Also, the serve section in those docs shows -p for --port:

whereas the global section shows -p for --prompt (and -h for --help, as you observed above):

@jdanbrown commented on GitHub (Oct 31, 2025): Oh oops. :) Also, the `serve` section in those docs shows `-p` for `--port`: - https://opencode.ai/docs/cli/#serve <img width="959" height="491" alt="Image" src="https://github.com/user-attachments/assets/5c723fcf-eb3e-4a64-b1c8-b429cb01606d" /> whereas the global section shows `-p` for `--prompt` (and `-h` for `--help`, as you observed above): - https://opencode.ai/docs/cli/#flags-4 <img width="953" height="548" alt="Image" src="https://github.com/user-attachments/assets/cd5f9523-9955-4162-9ae8-8d2f31b42369" />
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

Yeah -p isn't a global flag don't think so we should fix these

@rekram1-node commented on GitHub (Oct 31, 2025): Yeah -p isn't a global flag don't think so we should fix these
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

/oc can you read packages/opencode/src notably src/index.ts and src/cli/cmd/ files.

Figure out which commands have which flags.

Then read packages/web/src/content/docs/cli.mdx, figure out which docs are incorrect. Task the docs subagent to update the flags correctly.

While you are at it, let's make -h an alias for --help instead of hostname

@rekram1-node commented on GitHub (Oct 31, 2025): /oc can you read packages/opencode/src notably src/index.ts and src/cli/cmd/ files. Figure out which commands have which flags. Then read packages/web/src/content/docs/cli.mdx, figure out which docs are incorrect. Task the docs subagent to update the flags correctly. While you are at it, let's make -h an alias for --help instead of hostname
Author
Owner

@opencode-agent[bot] commented on GitHub (Oct 31, 2025):

Created PR #3638

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

@opencode-agent[bot] commented on GitHub (Oct 31, 2025): Created PR #3638 <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)
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

fixed

@rekram1-node commented on GitHub (Oct 31, 2025): fixed
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

btw this will be fixed in our rewrite, we are launching it more officially next week, but rn it is opt-in only since there are a lot of things that still need work. So don't be surprised if u don't see this change land

If you wanna play with the rewrite feel free to read this: https://opencode.ai/docs/1-0/

@rekram1-node commented on GitHub (Oct 31, 2025): btw this will be fixed in our rewrite, we are launching it more officially next week, but rn it is opt-in only since there are a lot of things that still need work. So don't be surprised if u don't see this change land If you wanna play with the rewrite feel free to read this: https://opencode.ai/docs/1-0/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2386