From 0d0ec7dc4663cd0319351443fed4d981001724c6 Mon Sep 17 00:00:00 2001
From: OpeOginni <107570612+OpeOginni@users.noreply.github.com>
Date: Sat, 2 May 2026 18:07:22 +0200
Subject: docs: CLI docs for current commands and flags (#25399)
---
packages/web/src/content/docs/cli.mdx | 282 +++++++++++++++++++++++-----------
1 file changed, 196 insertions(+), 86 deletions(-)
(limited to 'packages/web/src/content/docs/cli.mdx')
diff --git a/packages/web/src/content/docs/cli.mdx b/packages/web/src/content/docs/cli.mdx
index 7249f4dc9..8ecb6a6eb 100644
--- a/packages/web/src/content/docs/cli.mdx
+++ b/packages/web/src/content/docs/cli.mdx
@@ -29,16 +29,19 @@ opencode [project]
#### Flags
-| Flag | Short | Description |
-| ------------ | ----- | ----------------------------------------------------------------------- |
-| `--continue` | `-c` | Continue the last session |
-| `--session` | `-s` | Session ID to continue |
-| `--fork` | | Fork the session when continuing (use with `--continue` or `--session`) |
-| `--prompt` | | Prompt to use |
-| `--model` | `-m` | Model to use in the form of provider/model |
-| `--agent` | | Agent to use |
-| `--port` | | Port to listen on |
-| `--hostname` | | Hostname to listen on |
+| Flag | Short | Description |
+| ------------------------------------------- | ----- | ----------------------------------------------------------------------- |
+| {"--continue"} | `-c` | Continue the last session |
+| {"--session"} | `-s` | Session ID to continue |
+| {"--fork"} | | Fork the session when continuing (use with `--continue` or `--session`) |
+| {"--prompt"} | | Prompt to use |
+| {"--model"} | `-m` | Model to use in the form of provider/model |
+| {"--agent"} | | Agent to use |
+| {"--port"} | | Port to listen on |
+| {"--hostname"} | | Hostname to listen on |
+| {"--mdns"} | | Enable mDNS discovery |
+| {"--mdns-domain"} | | Custom mDNS domain name |
+| {"--cors"} | | Additional browser origin(s) to allow CORS |
---
@@ -78,10 +81,14 @@ opencode attach http://10.20.30.40:4096
#### Flags
-| Flag | Short | Description |
-| ----------- | ----- | --------------------------------- |
-| `--dir` | | Working directory to start TUI in |
-| `--session` | `-s` | Session ID to continue |
+| Flag | Short | Description |
+| ---------------------------------------- | ----- | -------------------------------------------------------------------------- |
+| {"--dir"} | | Working directory to start TUI in |
+| {"--continue"} | `-c` | Continue the last session |
+| {"--session"} | `-s` | Session ID to continue |
+| {"--fork"} | | Fork the session when continuing (use with `--continue` or `--session`) |
+| {"--password"} | `-p` | Basic auth password (defaults to `OPENCODE_SERVER_PASSWORD`) |
+| {"--username"} | `-u` | Basic auth username (defaults to `OPENCODE_SERVER_USERNAME` or `opencode`) |
---
@@ -97,13 +104,13 @@ This command will guide you through creating a new agent with a custom system pr
#### Flags
-| Flag | Description |
-| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `--path` | Directory to write the agent file to (defaults to global or `.opencode/agent` based on the prompt) |
-| `--description` | What the agent should do |
-| `--mode` | Agent mode: `all`, `primary`, or `subagent` |
-| `--permissions` | Comma-separated list of permissions to allow (default: all). Available: `bash`, `read`, `edit`, `glob`, `grep`, `webfetch`, `task`, `todowrite`, `websearch`, `lsp`, `skill`. Anything omitted is denied. Alias: `--tools` |
-| `--model`, `-m` | Model to use, in `provider/model` format |
+| Flag | Short | Description |
+| ------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| {"--path"} | | Directory to write the agent file to (defaults to global or `.opencode/agent` based on the prompt) |
+| {"--description"} | | What the agent should do |
+| {"--mode"} | | Agent mode: `all`, `primary`, or `subagent` |
+| {"--permissions"} | | Comma-separated list of permissions to allow (default: all). Available: `bash`, `read`, `edit`, `glob`, `grep`, `webfetch`, `task`, `todowrite`, `websearch`, `lsp`, `skill`. Anything omitted is denied. Alias: `--tools` |
+| {"--model"} | `-m` | Model to use, in `provider/model` format |
Passing all of `--path`, `--description`, `--mode`, and `--permissions` runs the command non-interactively.
@@ -139,6 +146,13 @@ opencode auth login
When OpenCode starts up it loads the providers from the credentials file. And if there are any keys defined in your environments or a `.env` file in your project.
+##### Flags
+
+| Flag | Short | Description |
+| ---------------------------------------- | ----- | ---------------------------------------------------- |
+| {"--provider"} | `-p` | Provider ID or name to log in to |
+| {"--method"} | `-m` | Login method label to use, skipping method selection |
+
---
#### list
@@ -199,10 +213,10 @@ opencode github run
##### Flags
-| Flag | Description |
-| --------- | -------------------------------------- |
-| `--event` | GitHub mock event to run the agent for |
-| `--token` | GitHub personal access token |
+| Flag | Description |
+| ------------------------------------- | -------------------------------------- |
+| {"--event"} | GitHub mock event to run the agent for |
+| {"--token"} | GitHub personal access token |
---
@@ -308,10 +322,10 @@ opencode models anthropic
#### Flags
-| Flag | Description |
-| ----------- | ------------------------------------------------------------ |
-| `--refresh` | Refresh the models cache from models.dev |
-| `--verbose` | Use more verbose model output (includes metadata like costs) |
+| Flag | Description |
+| --------------------------------------- | ------------------------------------------------------------ |
+| {"--refresh"} | Refresh the models cache from models.dev |
+| {"--verbose"} | Use more verbose model output (includes metadata like costs) |
Use the `--refresh` flag to update the cached model list. This is useful when new models have been added to a provider and you want to see them in OpenCode.
@@ -347,21 +361,26 @@ opencode run --attach http://localhost:4096 "Explain async/await in JavaScript"
#### Flags
-| Flag | Short | Description |
-| -------------------------------- | ----- | ----------------------------------------------------------------------- |
-| `--command` | | The command to run, use message for args |
-| `--continue` | `-c` | Continue the last session |
-| `--session` | `-s` | Session ID to continue |
-| `--fork` | | Fork the session when continuing (use with `--continue` or `--session`) |
-| `--share` | | Share the session |
-| `--model` | `-m` | Model to use in the form of provider/model |
-| `--agent` | | Agent to use |
-| `--file` | `-f` | File(s) to attach to message |
-| `--format` | | Format: default (formatted) or json (raw JSON events) |
-| `--title` | | Title for the session (uses truncated prompt if no value provided) |
-| `--attach` | | Attach to a running opencode server (e.g., http://localhost:4096) |
-| `--port` | | Port for the local server (defaults to random port) |
-| `--dangerously-skip-permissions` | | Auto-approve permissions that are not explicitly denied (dangerous!) |
+| Flag | Short | Description |
+| ------------------------------------------------------------ | ----- | -------------------------------------------------------------------------- |
+| {"--command"} | | The command to run, use message for args |
+| {"--continue"} | `-c` | Continue the last session |
+| {"--session"} | `-s` | Session ID to continue |
+| {"--fork"} | | Fork the session when continuing (use with `--continue` or `--session`) |
+| {"--share"} | | Share the session |
+| {"--model"} | `-m` | Model to use in the form of provider/model |
+| {"--agent"} | | Agent to use |
+| {"--file"} | `-f` | File(s) to attach to message |
+| {"--format"} | | Format: default (formatted) or json (raw JSON events) |
+| {"--title"} | | Title for the session (uses truncated prompt if no value provided) |
+| {"--attach"} | | Attach to a running opencode server (e.g., http://localhost:4096) |
+| {"--password"} | `-p` | Basic auth password (defaults to `OPENCODE_SERVER_PASSWORD`) |
+| {"--username"} | `-u` | Basic auth username (defaults to `OPENCODE_SERVER_USERNAME` or `opencode`) |
+| {"--dir"} | | Directory to run in, or path on the remote server when attaching |
+| {"--port"} | | Port for the local server (defaults to random port) |
+| {"--variant"} | | Model variant (provider-specific reasoning effort) |
+| {"--thinking"} | | Show thinking blocks |
+| {"--dangerously-skip-permissions"} | | Auto-approve permissions that are not explicitly denied (dangerous!) |
---
@@ -377,12 +396,13 @@ This starts an HTTP server that provides API access to opencode functionality wi
#### Flags
-| Flag | Description |
-| ------------ | ------------------------------------------ |
-| `--port` | Port to listen on |
-| `--hostname` | Hostname to listen on |
-| `--mdns` | Enable mDNS discovery |
-| `--cors` | Additional browser origin(s) to allow CORS |
+| Flag | Description |
+| ------------------------------------------- | ------------------------------------------ |
+| {"--port"} | Port to listen on |
+| {"--hostname"} | Hostname to listen on |
+| {"--mdns"} | Enable mDNS discovery |
+| {"--mdns-domain"} | Custom mDNS domain name |
+| {"--cors"} | Additional browser origin(s) to allow CORS |
---
@@ -406,10 +426,20 @@ opencode session list
##### Flags
-| Flag | Short | Description |
-| ------------- | ----- | ------------------------------------ |
-| `--max-count` | `-n` | Limit to N most recent sessions |
-| `--format` | | Output format: table or json (table) |
+| Flag | Short | Description |
+| ----------------------------------------- | ----- | ------------------------------------ |
+| {"--max-count"} | `-n` | Limit to N most recent sessions |
+| {"--format"} | | Output format: table or json (table) |
+
+---
+
+#### delete
+
+Delete an OpenCode session.
+
+```bash
+opencode session delete
+```
---
@@ -423,12 +453,12 @@ opencode stats
#### Flags
-| Flag | Description |
-| ----------- | --------------------------------------------------------------------------- |
-| `--days` | Show stats for the last N days (all time) |
-| `--tools` | Number of tools to show (all) |
-| `--models` | Show model usage breakdown (hidden by default). Pass a number to show top N |
-| `--project` | Filter by project (all projects, empty string: current project) |
+| Flag | Description |
+| --------------------------------------- | --------------------------------------------------------------------------- |
+| {"--days"} | Show stats for the last N days (all time) |
+| {"--tools"} | Number of tools to show (all) |
+| {"--models"} | Show model usage breakdown (hidden by default). Pass a number to show top N |
+| {"--project"} | Filter by project (all projects, empty string: current project) |
---
@@ -442,6 +472,12 @@ opencode export [sessionID]
If you don't provide a session ID, you'll be prompted to select from available sessions.
+#### Flags
+
+| Flag | Description |
+| ---------------------------------------- | ------------------------------------- |
+| {"--sanitize"} | Redact sensitive transcript/file data |
+
---
### import
@@ -473,12 +509,13 @@ This starts an HTTP server and opens a web browser to access OpenCode through a
#### Flags
-| Flag | Description |
-| ------------ | ------------------------------------------ |
-| `--port` | Port to listen on |
-| `--hostname` | Hostname to listen on |
-| `--mdns` | Enable mDNS discovery |
-| `--cors` | Additional browser origin(s) to allow CORS |
+| Flag | Description |
+| ------------------------------------------- | ------------------------------------------ |
+| {"--port"} | Port to listen on |
+| {"--hostname"} | Hostname to listen on |
+| {"--mdns"} | Enable mDNS discovery |
+| {"--mdns-domain"} | Custom mDNS domain name |
+| {"--cors"} | Additional browser origin(s) to allow CORS |
---
@@ -494,11 +531,83 @@ This command starts an ACP server that communicates via stdin/stdout using nd-JS
#### Flags
-| Flag | Description |
-| ------------ | --------------------- |
-| `--cwd` | Working directory |
-| `--port` | Port to listen on |
-| `--hostname` | Hostname to listen on |
+| Flag | Description |
+| ------------------------------------------- | ------------------------------------------ |
+| {"--cwd"} | Working directory |
+| {"--port"} | Port to listen on |
+| {"--hostname"} | Hostname to listen on |
+| {"--mdns"} | Enable mDNS discovery |
+| {"--mdns-domain"} | Custom mDNS domain name |
+| {"--cors"} | Additional browser origin(s) to allow CORS |
+
+---
+
+### plugin
+
+Install a plugin and update your config.
+
+```bash
+opencode plugin
+```
+
+Or use the alias.
+
+```bash
+opencode plug
+```
+
+#### Flags
+
+| Flag | Short | Description |
+| -------------------------------------- | ----- | ------------------------------- |
+| {"--global"} | `-g` | Install in global config |
+| {"--force"} | `-f` | Replace existing plugin version |
+
+---
+
+### pr
+
+Fetch and checkout a GitHub PR branch, then run OpenCode.
+
+```bash
+opencode pr
+```
+
+---
+
+### db
+
+Database tools.
+
+```bash
+opencode db [query]
+```
+
+#### Flags
+
+| Flag | Description |
+| -------------------------------------- | ------------------------------ |
+| {"--format"} | Output format: `json` or `tsv` |
+
+---
+
+#### path
+
+Print the database path.
+
+```bash
+opencode db path
+```
+
+---
+
+### debug
+
+Debugging and troubleshooting tools.
+
+```bash
+opencode debug [command]
+```
---
@@ -512,12 +621,12 @@ opencode uninstall
#### Flags
-| Flag | Short | Description |
-| --------------- | ----- | ------------------------------------------- |
-| `--keep-config` | `-c` | Keep configuration files |
-| `--keep-data` | `-d` | Keep session data and snapshots |
-| `--dry-run` | | Show what would be removed without removing |
-| `--force` | `-f` | Skip confirmation prompts |
+| Flag | Short | Description |
+| ------------------------------------------- | ----- | ------------------------------------------- |
+| {"--keep-config"} | `-c` | Keep configuration files |
+| {"--keep-data"} | `-d` | Keep session data and snapshots |
+| {"--dry-run"} | | Show what would be removed without removing |
+| {"--force"} | `-f` | Skip confirmation prompts |
---
@@ -543,9 +652,9 @@ opencode upgrade v0.1.48
#### Flags
-| Flag | Short | Description |
-| ---------- | ----- | ----------------------------------------------------------------- |
-| `--method` | `-m` | The installation method that was used; curl, npm, pnpm, bun, brew |
+| Flag | Short | Description |
+| -------------------------------------- | ----- | ----------------------------------------------------------------- |
+| {"--method"} | `-m` | The installation method that was used; curl, npm, pnpm, bun, brew |
---
@@ -553,12 +662,13 @@ opencode upgrade v0.1.48
The opencode CLI takes the following global flags.
-| Flag | Short | Description |
-| -------------- | ----- | ------------------------------------ |
-| `--help` | `-h` | Display help |
-| `--version` | `-v` | Print version number |
-| `--print-logs` | | Print logs to stderr |
-| `--log-level` | | Log level (DEBUG, INFO, WARN, ERROR) |
+| Flag | Short | Description |
+| ------------------------------------------ | ----- | ------------------------------------ |
+| {"--help"} | `-h` | Display help |
+| {"--version"} | `-v` | Print version number |
+| {"--print-logs"} | | Print logs to stderr |
+| {"--log-level"} | | Log level (DEBUG, INFO, WARN, ERROR) |
+| {"--pure"} | | Run without external plugins |
---
--
cgit v1.2.3