docs/reference/cli.md
Complete reference for the published oh-my-opencode CLI. During the rename transition, OpenCode plugin registration now prefers oh-my-openagent inside opencode.json.
# Display help
bunx oh-my-opencode
# Or with npx
npx oh-my-opencode
| Command | Description |
|---|---|
install | Interactive setup wizard |
doctor | Environment diagnostics and health checks |
run | OpenCode session runner with task completion enforcement |
get-local-version | Display local version information and update check |
refresh-model-capabilities | Refresh the cached models.dev-based model capabilities |
version | Show version information |
mcp oauth | MCP OAuth authentication management |
Interactive installation tool for initial Oh My OpenCode setup. Provides a TUI based on @clack/prompts.
bunx oh-my-opencode install
oh-my-openagent in OpenCode settings, or upgrades a legacy oh-my-opencode entry during the compatibility windowoh-my-opencode.json in the active OpenCode config directoryopencode auth login steps for the providers you selected, unless --skip-auth is set| Option | Description |
|---|---|
--no-tui | Run in non-interactive mode without TUI |
--claude <no|yes|max20> | Claude subscription mode |
--openai <no|yes> | OpenAI / ChatGPT subscription |
--gemini <no|yes> | Gemini integration |
--copilot <no|yes> | GitHub Copilot subscription |
--opencode-zen <no|yes> | OpenCode Zen access |
--zai-coding-plan <no|yes> | Z.ai Coding Plan subscription |
--kimi-for-coding <no|yes> | Kimi for Coding subscription |
--opencode-go <no|yes> | OpenCode Go subscription |
--vercel-ai-gateway <no|yes> | Vercel AI Gateway: no, yes (default: no) |
--skip-auth | Skip authentication setup hints |
Anonymous telemetry uses PostHog with a hashed installation identifier. Disable it with OMO_SEND_ANONYMOUS_TELEMETRY=0 or OMO_DISABLE_POSTHOG=1. See Privacy Policy.
Diagnoses your environment to ensure Oh My OpenCode is functioning correctly. The current checks are grouped into system, config, tools, and models.
The doctor command detects common issues including:
opencode.json (warns when oh-my-opencode is still used instead of oh-my-openagent)bunx oh-my-opencode doctor
| Category | Check Items |
|---|---|
| System | OpenCode binary, version (>= 1.0.150), plugin registration, legacy package name warning |
| Config | Configuration file validity, JSONC parsing, Zod schema validation |
| Tools | AST-Grep, LSP servers, GitHub CLI, MCP servers |
| Models | Model capabilities cache, model resolution, agent/category overrides, availability |
| Option | Description |
|---|---|
--status | Show compact system dashboard |
--verbose | Show detailed diagnostic information |
--json | Output results in JSON format |
oh-my-opencode doctor
┌──────────────────────────────────────────────────┐
│ Oh-My-OpenAgent Doctor │
└──────────────────────────────────────────────────┘
System
✓ OpenCode version: 1.0.155 (>= 1.0.150)
✓ Plugin registered in opencode.json
Config
✓ oh-my-opencode.jsonc is valid
✓ Model resolution: all agents have valid fallback chains
⚠ categories.visual-engineering: using default model
Tools
✓ AST-Grep available
✓ LSP servers configured
Models
✓ 11 agents, 8 categories, 0 overrides
⚠ Some configured models rely on compatibility fallback
Summary: 10 passed, 1 warning, 0 failed
Run opencode with todo/background task completion enforcement. Unlike 'opencode run', this command waits until all todos are completed or cancelled, and all child sessions (background tasks) are idle.
bunx oh-my-opencode run <message>
| Option | Description |
|---|---|
-a, --agent <name> | Agent to use (default: from CLI/env/config, fallback: Sisyphus) |
-m, --model <provider/model> | Model override (e.g., anthropic/claude-sonnet-4) |
-d, --directory <path> | Working directory |
-p, --port <port> | Server port (attaches if port already in use) |
--attach <url> | Attach to existing opencode server URL |
--on-complete <command> | Shell command to run after completion |
--json | Output structured JSON result to stdout |
--no-timestamp | Disable timestamp prefix in run output |
--verbose | Show full event stream (default: messages/tools only) |
--session-id <id> | Resume existing session instead of creating new one |
Show current installed version and check for updates.
bunx oh-my-opencode get-local-version
| Option | Description |
|---|---|
-d, --directory | Working directory to check config from |
--json | Output in JSON format for scripting |
Shows:
Show version information.
bunx oh-my-opencode version
--on-complete runs through your current shell when possible: sh on Unix shells, pwsh for PowerShell on non-Windows, powershell.exe for PowerShell on Windows, and cmd.exe as the Windows fallback.
Manages OAuth 2.1 authentication for remote MCP servers.
# Login to an OAuth-protected MCP server
bunx oh-my-opencode mcp oauth login <server-name> --server-url https://api.example.com
# Login with explicit client ID and scopes
bunx oh-my-opencode mcp oauth login my-api --server-url https://api.example.com --client-id my-client --scopes read write
# Remove stored OAuth tokens
bunx oh-my-opencode mcp oauth logout <server-name> --server-url https://api.example.com
# Check OAuth token status
bunx oh-my-opencode mcp oauth status [server-name]
| Option | Description |
|---|---|
--server-url <url> | MCP server URL (required for login) |
--client-id <id> | OAuth client ID (optional if server supports Dynamic Client Registration) |
--scopes <scopes> | OAuth scopes as separate variadic arguments (for example: --scopes read write) |
Tokens are stored in ~/.config/opencode/mcp-oauth.json with 0600 permissions (owner read/write only). Key format: {serverHost}/{resource}.
The runtime loads user config as the base config, then merges project config on top:
.opencode/oh-my-openagent.jsonc, .opencode/oh-my-openagent.json, .opencode/oh-my-opencode.jsonc, or .opencode/oh-my-opencode.json~/.config/opencode/oh-my-openagent.jsonc, ~/.config/opencode/oh-my-openagent.json, ~/.config/opencode/oh-my-opencode.jsonc, or ~/.config/opencode/oh-my-opencode.jsonNaming Note: The published package and binary are still oh-my-opencode. Inside opencode.json, the compatibility layer now prefers the plugin entry oh-my-openagent. Plugin config loading recognizes both oh-my-openagent.* and legacy oh-my-opencode.* basenames. If both basenames exist in the same directory, the legacy oh-my-opencode.* file currently wins.
Both .jsonc and .json extensions are supported. JSONC (JSON with Comments) is preferred as it allows:
// and /* */ styles)If both .jsonc and .json exist in the same directory, the .jsonc file takes precedence.
Configuration files support JSONC (JSON with Comments) format. You can use comments and trailing commas.
{
// Agent configuration
"sisyphus_agent": {
"disabled": false,
"planner_enabled": true,
},
/* Category customization */
"categories": {
"visual-engineering": {
"model": "google/gemini-3.1-pro",
},
},
}
# Update OpenCode
npm install -g opencode@latest
# or
bun install -g opencode@latest
# Reinstall plugin
bunx oh-my-opencode install
# Diagnose with detailed information
bunx oh-my-opencode doctor --verbose
# Show compact system dashboard
bunx oh-my-opencode doctor --status
# JSON output for scripting
bunx oh-my-opencode doctor --json
The doctor warns if it finds the legacy plugin entry oh-my-opencode in opencode.json. Update the plugin array to the canonical oh-my-openagent entry:
# Replace the legacy plugin entry in user config
jq '.plugin = (.plugin // [] | map(if . == "oh-my-opencode" then "oh-my-openagent" else . end))' \
~/.config/opencode/opencode.json > /tmp/opencode.json && mv /tmp/opencode.json ~/.config/opencode/opencode.json
Refreshes the cached model capabilities snapshot from models.dev. This updates the local cache used by capability resolution and compatibility diagnostics.
bunx oh-my-opencode refresh-model-capabilities
| Option | Description |
|---|---|
-d, --directory | Working directory to read oh-my-opencode config from |
--source-url <url> | Override the models.dev source URL |
--json | Output refresh summary as JSON |
Configure automatic refresh behavior in your plugin config:
{
"model_capabilities": {
"enabled": true,
"auto_refresh_on_start": true,
"refresh_timeout_ms": 5000,
"source_url": "https://models.dev/api.json"
}
}
Use JSON output for CI or scripted diagnostics.
# Run doctor in CI environment
bunx oh-my-opencode doctor --json
# Save results to file
bunx oh-my-opencode doctor --json > doctor-report.json
src/cli/
├── cli-program.ts # Commander.js-based main entry
├── install.ts # @clack/prompts-based TUI installer
├── config-manager/ # JSONC parsing, multi-source config management
│ └── *.ts
├── doctor/ # Health check system
│ ├── index.ts # Doctor command entry
│ └── checks/ # 17+ individual check modules
├── run/ # Session runner
│ └── *.ts
└── mcp-oauth/ # OAuth management commands
└── *.ts
Create src/cli/doctor/checks/my-check.ts:
import type { DoctorCheck } from "../types";
export const myCheck: DoctorCheck = {
name: "my-check",
category: "environment",
check: async () => {
// Check logic
const isOk = await someValidation();
return {
status: isOk ? "pass" : "fail",
message: isOk ? "Everything looks good" : "Something is wrong",
};
},
};
Register in src/cli/doctor/checks/index.ts:
export { myCheck } from "./my-check";