- Fired 33 parallel explore agents across all major directories
- Analyzed 1164 TS files, 133k LOC, 41 hooks, 26 tools, 11 agents, 18 features
- Regenerated 13 AGENTS.md files with 905 total lines
- Root: plugin architecture, initialization flow, 7 OpenCode hook handlers
- src/: entry point orchestration, hook composition pipeline
- agents/: 11 agent inventory with tool restrictions and factory patterns
- hooks/: 41 hooks organized by 5 tiers, key complex hooks documented
- tools/: 26 tools across 14 directories, delegation categories
- features/: 18 modules mapped by complexity (HIGH/MEDIUM/LOW)
- shared/: 101 utilities in 13 categories, model resolution pipeline
- config/: 22 schema files, Zod v4 validation system
- cli/: 5 commands, doctor checks, model fallback system
- mcp/: 3-tier MCP system architecture
- plugin-handlers/: 6-phase config loading pipeline
- claude-code-hooks/: CC settings.json compatibility layer
- claude-tasks/: task schema + file-based persistence
🤖 Generated with assistance of oh-my-opencode
3.2 KiB
3.2 KiB
src/cli/ — CLI: install, run, doctor, mcp-oauth
Generated: 2026-02-17
OVERVIEW
Commander.js CLI with 5 commands. Entry: index.ts → runCli() in cli-program.ts.
COMMANDS
| Command | Purpose | Key Logic |
|---|---|---|
install |
Interactive/non-interactive setup | Provider selection → config gen → plugin registration |
run <message> |
Non-interactive session launcher | Agent resolution (flag → env → config → Sisyphus) |
doctor |
4-category health checks | System, Config, Tools, Models |
get-local-version |
Version detection | Installed vs npm latest |
mcp-oauth |
OAuth token management | login (PKCE), logout, status |
STRUCTURE
cli/
├── index.ts # Entry point → runCli()
├── cli-program.ts # Commander.js program (5 commands)
├── install.ts # Routes to TUI or CLI installer
├── cli-installer.ts # Non-interactive (console output)
├── tui-installer.ts # Interactive (@clack/prompts)
├── model-fallback.ts # Model config gen by provider availability
├── provider-availability.ts # Provider detection
├── fallback-chain-resolution.ts # Fallback chain logic
├── config-manager/ # 20 config utilities
│ ├── plugin registration, provider config
│ ├── JSONC operations, auth plugins
│ └── npm dist-tags, binary detection
├── doctor/
│ ├── runner.ts # Parallel check execution
│ ├── formatter.ts # Output formatting
│ └── checks/ # 15 check files in 4 categories
│ ├── system.ts # Binary, plugin, version
│ ├── config.ts # JSONC validity, Zod schema
│ ├── tools.ts # AST-Grep, LSP, GH CLI, MCP
│ └── model-resolution.ts # Cache, resolution, overrides (6 sub-files)
├── run/ # Session launcher
│ ├── runner.ts # Main orchestration
│ ├── agent-resolver.ts # Flag → env → config → Sisyphus
│ ├── session-resolver.ts # Create/resume sessions
│ ├── event-handlers.ts # Event processing
│ └── poll-for-completion.ts # Wait for todos/background tasks
└── mcp-oauth/ # OAuth token management
MODEL FALLBACK SYSTEM
Priority: Claude > OpenAI > Gemini > Copilot > OpenCode Zen > Z.ai > Kimi > glm-4.7-free
Agent-specific: librarian→ZAI, explore→Haiku/nano, hephaestus→requires OpenAI/Copilot
DOCTOR CHECKS
| Category | Validates |
|---|---|
| System | Binary found, version >=1.0.150, plugin registered, version match |
| Config | JSONC validity, Zod schema, model override syntax |
| Tools | AST-Grep, comment-checker, LSP servers, GH CLI, MCP servers |
| Models | Cache exists, model resolution, agent/category overrides, availability |
HOW TO ADD A DOCTOR CHECK
- Create
src/cli/doctor/checks/{name}.ts - Export check function matching
DoctorCheckinterface - Register in
checks/index.ts