Reference¶
Complete CLI reference for OpenCode Initializer.
setup.sh — Bootstrap Orchestrator¶
The main entry point. Sources modules from src/lib/ and dispatches modes.
Modes¶
| Mode | Flag | Description |
|---|---|---|
| Full | (default) | Complete bootstrap — all 8 languages, 24 MCP, 18 plugins, 12 LSP, 23 providers, 6 infra services |
| Health | --health | Diagnostics — 115+ checks across 11 sections |
| Interactive | --interactive | Component-by-component selection |
| Reinit | --reinit | Reinstall tools, keep data |
| New | --new <dir> | Init new project only |
| CI/CD | --ci | Headless mode: OpenCode CLI + essential MCPs |
| Dry Run | --dry-run | Preview mode, no changes |
| Fix Config | --fix-config | Regenerate opencode.json |
| Fix ZSH | --fix-zshrc | Repair .zshrc |
| Update | --update | Update tools only |
| Upgrade | --upgrade | Full system upgrade chain |
Options¶
| Flag | Description |
|---|---|
-k, --api-key <key> | OpenCode Go API key |
--deepseek-key <key> | DeepSeek API key |
--xai-key <key> | xAI Grok API key |
--mimo-key <key> | Xiaomi MiMo API key |
--minimax-key <key> | MiniMax API key |
--github-token <token> | GitHub personal access token |
--gitlab-token <token> | GitLab personal access token |
--google-maps-key <key> | Google Maps API key |
-s, --sudo-pass <pass> | [DEPRECATED] Use SUDO_PASS env or interactive read -s |
-p, --project-dir <dir> | Project directory (default: ~/projects) |
-n, --git-name <name> | Git user name |
-e, --git-email <email> | Git user email |
Examples¶
# Full install
bash setup.sh
# Health check
bash setup.sh --health
# Interactive mode
bash setup.sh --interactive
# CI/CD mode
bash setup.sh --ci
# New project
bash setup.sh --new ~/my-project
# With API keys
bash setup.sh --full --deepseek-key sk-xxxx --github-token ghp_xxxx
dev CLI — Post-Install Management¶
Available after installation at ~/opencode_initializer/dev.sh.
Commands¶
| Command | Description |
|---|---|
dev health | Full diagnostics (115+ checks, 11 sections) |
dev version-check | Compare installed vs latest versions |
dev update | Update all tools + run pending migrations |
dev list | List installed components |
dev install <name> | Install a new component |
dev remove <name> | Remove a component |
dev config | Edit setup config file |
dev autoupdate | Run topgrade full system update |
dev self-update | Git pull + reinstall dev CLI + setup.sh |
Examples¶
# Check everything
dev health
# See what's outdated
dev version-check
# Install Docker if missing
dev install docker
# Remove Java
dev remove java
# Full system update
dev autoupdate
# Update opencode_initializer itself
dev self-update
opencode.json Schema¶
The configuration file for OpenCode AI assistant. Generated by 18-opencode-json.sh.
{
"$schema": "https://opencode.ai/config.json",
"model": "deepseek/deepseek-v4-pro",
"small_model": "deepseek/deepseek-v4-flash",
"provider": {
"deepseek": {},
"opencode": {}
},
"instructions": ["AGENTS.md"],
"mcpServers": {
"github": { "type": "local", "command": ["node", "..."] },
"filesystem": { "type": "local", "command": ["node", "..."] },
"...": "..."
},
"plugins": [
["token-tracker@latest"],
["dcp@latest"],
["swarm@latest"],
"..."
]
}
Provider Configuration¶
Providers are dynamically built based on available API keys (24 total):
| Provider | Environment Variable | MCP Servers |
|---|---|---|
deepseek | (built-in) | — |
opencode | (built-in) | — |
openai | OPENAI_API_KEY | — |
anthropic | ANTHROPIC_API_KEY | — |
google | GOOGLE_API_KEY / GOOGLE_MAPS_KEY | google-maps-mcp |
xai | XAI_API_KEY | — |
minimax | MINIMAX_API_KEY | — |
mimo | MIMO_API_KEY | — |
groq | GROQ_API_KEY | — |
together | TOGETHER_API_KEY | — |
fireworks | FIREWORKS_API_KEY | — |
perplexity | PERPLEXITY_API_KEY | — |
mistral | MISTRAL_API_KEY | — |
cohere | COHERE_API_KEY | — |
github | GITHUB_TOKEN | github-mcp |
gitlab | GITLAB_TOKEN | gitlab-mcp |
Environment Variables¶
| Variable | Purpose | Required |
|---|---|---|
GITHUB_TOKEN | GitHub API access | Optional |
GITLAB_TOKEN | GitLab API access | Optional |
GITVERSE_TOKEN | GitVerse API access | Optional |
GOOGLE_MAPS_KEY | Google Maps API | Optional |
OPENAI_API_KEY | OpenAI API | Optional |
ANTHROPIC_API_KEY | Anthropic API | Optional |
XAI_API_KEY | xAI Grok API | Optional |
MINIMAX_API_KEY | MiniMax API | Optional |
MIMO_API_KEY | MiMo API | Optional |
GROQ_API_KEY | Groq API | Optional |
TOGETHER_API_KEY | Together API | Optional |
FIREWORKS_API_KEY | Fireworks API | Optional |
PERPLEXITY_API_KEY | Perplexity API | Optional |
MISTRAL_API_KEY | Mistral API | Optional |
COHERE_API_KEY | Cohere API | Optional |
All variables are stored in ~/.config/opencode/secrets.env with chmod 600.
File Structure¶
~/.cache/opencode-setup/
├── progress # Completed step tracking
└── setup-*.log # Timestamped install logs
~/.bun/bin/ # Bun binary cache (MCP cold start)
~/.config/opencode-setup/
└── setup.conf # Persistent settings
~/.config/opencode/
└── secrets.env # API keys (chmod 600)
~/opencode_initializer/
├── opencode.json # Generated AI config
├── setup.sh # Bootstrap orchestrator
└── dev.sh # Post-install CLI
Progress Tracking¶
The file ~/.cache/opencode-setup/progress records completed steps. Each module checks this file before running:
step_done "01-system" # Check if already done
step_skip "01-system" # Skip if done
# ... install packages ...
step_mark "01-system" # Mark as done
Re-runs are idempotent — already-installed components are skipped.
Visual Progress¶
During setup, you'll see:
- Step counter:
[3/29] Installing Node.js... - Spinner:
⠋ Installing packages...during long operations - Blurred log:
▌ Installing chromedriver via apt...for verbose output - Colored status:
[✓]green = done,[!]yellow = warning,[✗]red = error
Module Reference¶
| Module | File | Purpose |
|---|---|---|
| Helpers | helpers.sh | _curl(), _retry(), _npm_install(), spinner infrastructure |
| Core | 00-core.sh | OS/PKG/ARCH detection, mirrors, progress tracking |
| System | 01-system.sh | System packages (cross-distro: apt/dnf/pacman/apk/zypper/brew) |
| Docker | 02-docker.sh | Docker Engine |
| Chrome | 03-chrome.sh | Google Chrome + ChromeDriver (WSL2-aware) |
| ZSH | 04-zsh.sh | Zsh + Oh My Zsh + Powerlevel10k + 14 plugins |
| Java | 05-java.sh | Java 25 (Adoptium) + Zig |
| Node | 06-node.sh | Node.js 24 (n) |
| Python | 07-python.sh | Python 3.14 + uv |
| Go | 08-go.sh | Go 1.26 |
| Rust | 09-rust.sh | Rust 1.97.1 (rustup) |
| .NET | 10-dotnet.sh | .NET 10 |
| OpenCode | 11-opencode.sh | OpenCode CLI + Bun |
| MCP/LSP | 12-mcp-lsp.sh | 24 MCP + 18 plugins + 12 LSP + Muninn |
| Providers | 26-providers.sh | 23 LLM providers (20 cloud + 3 local) |
| Infrastructure | 30-infra.sh | PostgreSQL + Qdrant + Redis + Prometheus + Grafana + MemoryLayer |
| Cockpit | 31-cockpit.sh | 7-tab TUI server management daemon |
| Isolated | 32-isolated.sh | Air-gapped LLM mode (Ollama/vLLM/SGLang) |
| Observability | 34-observability.sh | Grafana + Prometheus stack |
| GUI | 35-gui.sh | Web management interface |
| ChromaDB | 13-chromadb.sh | ChromaDB + systemd service |
| Shokunin | 14-shokunin.sh | Shokunin + Superpowers + Caveman skills |
| Security | 15-security.sh | Trivy, Qodana |
| LLM | 16-llm.sh | Ollama, vLLM, SGLang, Open WebUI (GPU-aware, multi-vendor) |
| Project | 17-project.sh | Project structure (AGENTS.md, WAL, docker-compose) |
| JSON | 18-opencode-json.sh | opencode.json generation (Python inline, bun bin paths) |
| Finalize | 19-finalize.sh | Git config, PATH, .zshrc, verification (36 checks) |
| Autoupdate | 20-autoupdate.sh | topgrade + systemd weekly timer + unattended-upgrades |
| RAG | 21-rag.sh | Corporate Knowledge Assistant (ETL + Qdrant + Gemma) |
| mise | 22-mise.sh | mise-en-place universal tool version manager |
| WebUI Service | 22-webui-service.sh | Open WebUI systemd user service |
| just | 23-just.sh | just task runner with default justfile |
| WebSearch | 24-websearch.sh | SearXNG web search + sanitizer proxy |
| Providers | 26-providers.sh | 23 LLM provider registry with session switching |
| Dotfiles | 27-dotfiles.sh | chezmoi dotfiles manager for team config sharing |
| Devbox | 28-devbox.sh | Devbox — Nix-based isolated dev environments |
| Version Check | version-check.sh | Version comparison (8+ tools, npm packages) |
| Pre-Session Check | pre-session-check.sh | Pre-session provider/model validation + MCP status |
See also: - MCP, LSP & Plugins — 24+12+18 component catalogue - Architecture — C4 diagrams and design decisions - User Guide — daily CLI usage - FAQ — troubleshooting and solutions