2ad8173144
- Update generated timestamp and commit hash metadata
- Normalize agent model names with provider prefixes (anthropic/, opencode/, google/)
- Remove deprecated Google OAuth/Antigravity references
- Update line counts and complexity hotspot entries
- Adjust test count from 82 to 80+ files and assertions from 2559+ to 2500+
🤖 Generated with assistance of oh-my-opencode
2.5 KiB
2.5 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 (146 lines)
├── install.ts # Interactive TUI installer (462 lines)
├── config-manager.ts # JSONC parsing, env detection (730 lines)
├── types.ts # CLI-specific types
├── 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 (14 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 todo/background completion enforcement |
get-local-version |
Detect and return local plugin version & update status |
DOCTOR CHECKS
14 checks in doctor/checks/:
version.ts: OpenCode >= 1.0.150 & plugin update statusconfig.ts: Plugin registration & JSONC validitydependencies.ts: AST-Grep (CLI/NAPI), Comment Checkerauth.ts: Anthropic, OpenAI, Google (Antigravity)lsp.ts,mcp.ts: Tool connectivity checksgh.ts: GitHub CLI availability
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)