Skip to content

docs(cli): document the opencode service commands - #57909

Open
oke3 wants to merge 2 commits into
anomalyco:devfrom
oke3:docs-service-commands
Open

oke3 wants to merge 2 commits into
anomalyco:devfrom
oke3:docs-service-commands

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?

The CLI reference has no opencode service section, even though service is one of the commands the v2 CLI defines and the background server it manages is what every local client connects to.

This adds the section: start, restart, status, stop, get, set and unset, with the wording the CLI itself uses. It is the same content the v2 reference carries, brought over so this page matches the CLI it documents.

How did you verify your code works?

Checked the subcommands and their descriptions against packages/cli/src/commands/commands.ts on this branch and against opencode service --help, 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

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

Looks good. I compared each subcommand and example with the service spec in packages/cli/src/commands/commands.ts and with packages/cli/src/services/service-config.ts. The keys and argument forms (hostname, cors, set env <name> <value>) are correct, and the descriptions match the CLI wording. This is a docs-only change, so there was nothing to run.

Public API: unchanged (documentation only).

One fix worth making: the cors example's caption says it adds an origin, but set cors replaces the whole list (see the inline comment).

Comment thread packages/web/src/content/docs/cli.mdx Outdated
opencode service set hostname 0.0.0.0
```

Allow an extra CORS origin.

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.

opencode service set cors doesn't add an origin. It replaces the saved list with the comma-separated value (service-config.ts writes value.split(",") as-is). Someone who already has origins configured and follows this example would lose them. Could you reword it, e.g. "Set the allowed CORS origins (comma-separated; replaces the current list)." The same wording is in services/www/src/docs/content/cli/commands.mdx, if you want to fix it there too.

oke3 added 2 commits October 21, 2026 23:46
The page had no section for the background server the CLI starts for your
account, even though service is one of the commands the v2 CLI defines.
Each subcommand is documented with the CLI's own wording.
set cors replaces the whole list rather than adding an origin, and the value
is a comma-separated list of HTTP(S) origins.
@oke3
oke3 force-pushed the docs-service-commands branch from ca480df to 169c8f8 Compare October 21, 2026 20:50
@oke3

oke3 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Good catch — fixed in 169c8f8.

set cors writes the whole list (write({ ...existing, cors }) in packages/cli/src/services/service-config.ts), and the value is split on commas and validated per origin, so the caption now says it replaces the list and that the value is a comma-separated list of HTTP(S) origins without paths or trailing slashes. The example shows two origins.

The docs site builds rc=0 with the change, and the corrected text is in the built output.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant