- Root: Add Prometheus/Metis/Momus agents, MCP architecture, 82 test files - agents/: Document 7-section delegation and wisdom notepad - auth/: Multi-account load balancing (10 accounts), endpoint fallback - features/: Update background-agent 825 lines, builtin-skills 1230 lines - hooks/: 22+ hooks with event timing details - tools/: sisyphus-task 583 lines, LSP client 632 lines - cli/: config-manager 725 lines, 17+ doctor checks - shared/: Cross-cutting utilities with usage patterns
2.4 KiB
2.4 KiB
CLI KNOWLEDGE BASE
OVERVIEW
CLI for oh-my-opencode: interactive installer, health diagnostics (doctor), runtime launcher. Entry: bunx oh-my-opencode.
STRUCTURE
cli/
├── index.ts # Commander.js entry, subcommand routing (184 lines)
├── install.ts # Interactive TUI installer (436 lines)
├── config-manager.ts # JSONC parsing, env detection (725 lines)
├── types.ts # CLI-specific types
├── commands/ # CLI subcommands (auth.ts)
├── doctor/ # Health check system
│ ├── index.ts # Doctor command entry
│ ├── runner.ts # Health check orchestration
│ ├── constants.ts # Check categories
│ ├── types.ts # Check result interfaces
│ └── checks/ # 10+ check modules (17+ individual checks)
├── get-local-version/ # Version detection
└── run/ # OpenCode session launcher
├── completion.ts # Completion logic
└── events.ts # Event handling
CLI COMMANDS
| Command | Purpose |
|---|---|
install |
Interactive setup wizard with subscription detection |
doctor |
Environment health checks (LSP, Auth, Config, Deps) |
run |
Launch OpenCode session with event handling |
auth |
Manage authentication providers |
DOCTOR CHECKS
17+ checks in doctor/checks/:
version.ts: OpenCode >= 1.0.150config.ts: Plugin registration & JSONC validitydependencies.ts: bun, node, git, gh-cliauth.ts: Anthropic, OpenAI, Google (Antigravity)lsp.ts,mcp.ts: Tool connectivity checks
CONFIG-MANAGER
- JSONC: Supports comments and trailing commas via
parseJsonc - Multi-source: Merges User (
~/.config/opencode/) + Project (.opencode/) - Validation: Strict Zod schema with error aggregation for
doctor - Env: Detects
OPENCODE_CONFIG_DIRfor profile isolation
HOW TO ADD CHECK
- Create
src/cli/doctor/checks/my-check.tsreturningDoctorCheck - Export from
checks/index.tsand add togetAllCheckDefinitions() - Use
CheckContextfor shared utilities (LSP, Auth)
ANTI-PATTERNS
- Blocking prompts in non-TTY (check
process.stdout.isTTY) - Direct
JSON.parse(breaks JSONC compatibility) - Silent failures (always return
warnorfailindoctor) - Environment-specific hardcoding (use
ConfigManager)