Skip to content

docs(cli): document the --completions flag - #57622

Open
oke3 wants to merge 1 commit into
anomalyco:devfrom
oke3:docs-cli-completion
Open

oke3 wants to merge 1 commit into
anomalyco:devfrom
oke3:docs-cli-completion

Conversation

@oke3

@oke3 oke3 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

No issue.

Type of change

  • Documentation

What does this PR do?

Documents the --completions global flag, which the CLI reference did not mention. It prints a completion script for bash, zsh, fish or sh, and the install line for each shell is taken from the script the binary prints.

How did you verify your code works?

Ran the 2.1.1 binary for each shell and built the docs site.

Screenshots / recordings

Not a UI change.

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:

@opencode-agent opencode-agent Bot 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.

This describes the v1 CLI (the 1.19.3 binary the author ran), not v2, which is what dev and this docs page cover. I ran the v2 CLI from source at the PR's head commit to check.

  • opencode completion is not a v2 command. It fails with ENOENT: chdir ... -> 'completion' because v2 reads the word as a directory argument. Completions come from the global flag --completions <bash|zsh|fish|sh>. The script printed by opencode --completions bash says to install it with opencode --completions bash >> ~/.bashrc. zsh, fish and sh are supported too, not only bash.
  • opencode providers does not exist in v2. auth has no aliases in packages/cli/src/commands/commands.ts, and opencode providers fails the same way. Please drop that sentence.

The public API is unchanged (docs only). If you rework the section around --completions, it may fit better under Global Flags than as a command.

Related: #56019

Comment thread packages/web/src/content/docs/cli.mdx Outdated
### auth

Command to manage credentials and login for providers.
Command to manage credentials and login for providers. Also available as `opencode providers`.

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.

This doesn't hold for v2: auth has no aliases in packages/cli/src/commands/commands.ts, and opencode providers runs as opencode <directory> (it fails with ENOENT: chdir ... -> 'providers'). The alias is from v1 (1.19.3). Please remove this sentence.

Comment thread packages/web/src/content/docs/cli.mdx Outdated

---

### completion

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.

v2 has no completion subcommand: opencode completion is taken as a directory and fails. Completions come from the global flag --completions <bash|zsh|fish|sh>, e.g. opencode --completions bash >> ~/.bashrc, which is also the install line printed in the script's header. Please document the flag (with the zsh/fish/sh options) instead, perhaps under Global Flags.

The v2 CLI prints a shell completion script with the --completions global
flag (bash, zsh, fish, sh) and the CLI reference did not mention it. The
install line for each shell is taken from the script the binary prints.
@oke3

oke3 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

The page I originally edited is the v1 reference, not v2 — that is worth separating, because the two doc trees ship from the same repo:

  • packages/web/src/content/docs/cli.mdx → opencode.ai/docs — that page documents opencode agent, opencode attach, opencode db and opencode web, which are v1 commands. The released 1.19.3 binary has all four; the v2 CLI has none of them.
  • services/www/src/docs/content/cli/ → opencode.ai/v2/docs — the v2 reference.

So opencode completion and the providers alias are real in v1, but you are right that neither exists in v2, and the v2 reference is where completion needs documenting. I have reworked the PR accordingly:

  • --completions is now documented in services/www/src/docs/content/cli/commands.mdx, with the install line for each of bash, zsh and fish taken from the script the binary prints.
  • The providers sentence is dropped.

If the v1 page should also carry a completion section, I can open that separately — the v1 command prints the bash script and ignores the shell argument, so it is a smaller note than the v2 flag.

@oke3 oke3 changed the title docs(cli): document the completion command docs(cli): document the --completions flag Oct 21, 2026
@oke3
oke3 force-pushed the docs-cli-completion branch from 6177ff7 to b684549 Compare October 21, 2026 14:48

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant