Sfoglia il codice sorgente

docs: add comprehensive CLI command documentation for agent, mcp, session, stats, and web commands

Jay V 3 mesi fa
parent
commit
4b061653f2
1 ha cambiato i file con 224 aggiunte e 0 eliminazioni
  1. 224 0
      packages/web/src/content/docs/cli.mdx

+ 224 - 0
packages/web/src/content/docs/cli.mdx

@@ -69,6 +69,16 @@ This command will guide you through creating a new agent with a custom system pr
 
 ---
 
+#### list
+
+List all available agents.
+
+```bash
+opencode agent list
+```
+
+---
+
 ### auth
 
 Command to manage credentials and login for providers.
@@ -156,6 +166,88 @@ opencode github run
 
 ---
 
+### mcp
+
+Manage Model Context Protocol servers.
+
+```bash
+opencode mcp [command]
+```
+
+---
+
+#### add
+
+Add an MCP server to your configuration.
+
+```bash
+opencode mcp add
+```
+
+This command will guide you through adding either a local or remote MCP server.
+
+---
+
+#### list
+
+List all configured MCP servers and their connection status.
+
+```bash
+opencode mcp list
+```
+
+Or use the short version.
+
+```bash
+opencode mcp ls
+```
+
+---
+
+#### auth
+
+Authenticate with an OAuth-enabled MCP server.
+
+```bash
+opencode mcp auth [name]
+```
+
+If you don't provide a server name, you'll be prompted to select from available OAuth-capable servers.
+
+You can also list OAuth-capable servers and their authentication status.
+
+```bash
+opencode mcp auth list
+```
+
+Or use the short version.
+
+```bash
+opencode mcp auth ls
+```
+
+---
+
+#### logout
+
+Remove OAuth credentials for an MCP server.
+
+```bash
+opencode mcp logout [name]
+```
+
+---
+
+#### debug
+
+Debug OAuth connection issues for an MCP server.
+
+```bash
+opencode mcp debug <name>
+```
+
+---
+
 ### models
 
 List all available models from configured providers.
@@ -250,6 +342,138 @@ This starts an HTTP server that provides API access to opencode functionality wi
 
 ---
 
+### session
+
+Manage OpenCode sessions.
+
+```bash
+opencode session [command]
+```
+
+---
+
+#### list
+
+List all OpenCode sessions.
+
+```bash
+opencode session list
+```
+
+##### Flags
+
+| Flag          | Short | Description                          |
+| ------------- | ----- | ------------------------------------ |
+| `--max-count` | `-n`  | Limit to N most recent sessions      |
+| `--format`    |       | Output format: table or json (table) |
+
+---
+
+### stats
+
+Show token usage and cost statistics for your OpenCode sessions.
+
+```bash
+opencode stats
+```
+
+#### Flags
+
+| Flag        | Description                                                     |
+| ----------- | --------------------------------------------------------------- |
+| `--days`    | Show stats for the last N days (all time)                       |
+| `--tools`   | Number of tools to show (all)                                   |
+| `--project` | Filter by project (all projects, empty string: current project) |
+
+---
+
+### export
+
+Export session data as JSON.
+
+```bash
+opencode export [sessionID]
+```
+
+If you don't provide a session ID, you'll be prompted to select from available sessions.
+
+---
+
+### import
+
+Import session data from a JSON file or OpenCode share URL.
+
+```bash
+opencode import <file>
+```
+
+You can import from a local file or an OpenCode share URL.
+
+```bash
+opencode import session.json
+opencode import https://opncd.ai/s/abc123
+```
+
+---
+
+### web
+
+Start a headless OpenCode server with a web interface.
+
+```bash
+opencode web
+```
+
+This starts an HTTP server and opens a web browser to access OpenCode through a web interface.
+
+#### Flags
+
+| Flag         | Short | Description           |
+| ------------ | ----- | --------------------- |
+| `--port`     | `-p`  | Port to listen on     |
+| `--hostname` |       | Hostname to listen on |
+
+---
+
+### acp
+
+Start an ACP (Agent Client Protocol) server.
+
+```bash
+opencode acp
+```
+
+This command starts an ACP server that communicates via stdin/stdout using nd-JSON.
+
+#### Flags
+
+| Flag         | Description           |
+| ------------ | --------------------- |
+| `--cwd`      | Working directory     |
+| `--port`     | Port to listen on     |
+| `--hostname` | Hostname to listen on |
+
+---
+
+### uninstall
+
+Uninstall OpenCode and remove all related files.
+
+```bash
+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                   |
+
+---
+
 ### upgrade
 
 Updates opencode to the latest version or a specific version.