CLI entry point and command-line interface for the oh-my-opencode-slim plugin. Provides installation, configuration, and diagnostic commands for setting up and managing the OpenCode plugin.
The CLI follows a command pattern with two primary commands:
install: Sets up the plugin with OpenCode (adds plugin to config, configures background subagents, installs companion, writes configuration)doctor: Diagnoses plugin configuration issues and validates setup1. CLI invoked (bunx oh-my-opencode-slim install/doctor)
2. index.ts parses arguments and routes to command handler
3. Command handler executes workflow
- install: Runs multi-step installation process
- doctor: Runs diagnostic checks
1. Parse install arguments (preset, companion mode, background subagents, etc.)
2. Check OpenCode installation
3. Add plugin to OpenCode configuration (opencode.json/opencode.jsonc)
4. Add TUI version badge (tui.json/tui.jsonc)
5. Warm OpenCode plugin cache (for package manager installations)
6. Disable OpenCode default agents (explore, general)
7. Enable LSP integration by default
8. Configure background subagents (shell integration)
9. Install desktop companion (optional)
10. Write oh-my-opencode-slim configuration (oh-my-opencode-slim.json)
11. Install custom skills (if requested)
1. Determine config directory:
- OPENCODE_CONFIG_DIR environment variable (highest priority)
- XDG_CONFIG_HOME/opencode
- ~/.config/opencode (default)
2. Resolve file paths:
- opencode.json → opencode.jsonc → fallback to opencode.json
- oh-my-opencode-slim.json → oh-my-opencode-slim.jsonc → fallback
- tui.json → tui.jsonc → fallback
1. Generate configuration presets for supported providers:
- openai (default)
- opencode-go
- kimi
- copilot
- zai-plan
2. Map agents to models with variants:
- orchestrator → high-capacity model
- oracle → high variant
- librarian/explorer → low variant
- designer → medium variant
- fixer → low variant
3. Apply skill permissions based on agent role
4. Generate final configuration with schema URL
1. Detect shell type (bash/zsh/fish)
2. Determine target file:
- bash/zsh: ~/.bashrc or ~/.zshrc
- fish: ~/.config/fish/conf.d/opencode-background-subagents.fish
3. Write environment variable export:
- export OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true
4. Persist across shell sessions
| File | Purpose | Written By |
|---|---|---|
| opencode.json/opencode.jsonc | OpenCode main config | config-io.ts |
| tui.json/tui.jsonc | OpenCode TUI config | config-io.ts |
| oh-my-opencode-slim.json | Plugin-specific config | providers.ts |
install CommandSets up oh-my-opencode-slim plugin with OpenCode.
Usage:
bunx oh-my-opencode-slim install [OPTIONS]
Options:
--skills=yes|no: Install bundled skills (default: yes)--companion=ask|yes|no: Install desktop companion (default: ask)--preset=<name>: Select configuration preset (default: openai)--background-subagents=ask|yes|no: Configure background subagents (default: ask)--background-subagents-target=<path>: Specify shell startup file--no-tui: Non-interactive mode--dry-run: Simulate installation--reset: Force overwrite existing configuration-h, --help: Show helpAvailable presets: openai, opencode-go, kimi, copilot, zai-plan
doctor CommandDiagnoses plugin configuration and environment.
Usage:
bunx oh-my-opencode-slim doctor [OPTIONS]
Options:
--json: Print diagnostics as JSON-h, --help: Show helpChecks: