docs(agents): refresh AGENTS.md hierarchy via /init-deep

Updated root + 14 core subdirectory AGENTS.md files to reflect current
state (commit 2892ca4a on dev). Added 4 new AGENTS.md files for gap
directories: hooks/comment-checker (AI slop blocker), features/claude-
code-plugin-loader (CC compat layer), features/claude-code-mcp-loader
(tier 2 MCP loader), cli/doctor (health diagnostics with 25 check files).
This commit is contained in:
YeonGyu-Kim
2026-04-18 01:21:20 +09:00
parent 2892ca4adf
commit 5759a9c503
19 changed files with 316 additions and 16 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# src/features/ — 19 Feature Modules
**Generated:** 2026-04-11
**Generated:** 2026-04-18
## OVERVIEW
@@ -0,0 +1,78 @@
# src/features/claude-code-mcp-loader/ — Tier 2 MCP Loader (.mcp.json)
**Generated:** 2026-04-18
## OVERVIEW
11 files. Loads `.mcp.json` files from project/user scopes and expands `${VAR}` env vars. Feeds Tier 2 of the 3-tier MCP system into `mcp-config-handler.ts` during Phase 5 of config loading.
## WHY IT EXISTS
Claude Code ecosystem ships MCPs via `.mcp.json` files with `${VAR}` env var placeholders. OmO consumes these unchanged so existing Claude Code MCP configs work.
## LOAD PIPELINE
```
loadMcpConfigs(ctx)
→ scope-filter.ts: discover .mcp.json at project + user scopes
→ loader.ts: parse JSON
→ env-expander.ts: replace ${VAR} with process.env[VAR]
→ transformer.ts: map Claude Code format → OpenCode McpLocal / McpRemote shape
→ return LoadedMcpServer[]
```
## MCP FORMAT
```jsonc
// .mcp.json
{
"mcpServers": {
"my-stdio": {
"type": "stdio",
"command": "node",
"args": ["server.js"],
"env": {
"API_KEY": "${MY_API_KEY}"
}
},
"my-http": {
"type": "http", // "sse" legacy → mapped to http
"url": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer ${MY_TOKEN}"
}
}
}
}
```
## KEY FILES
| File | Purpose |
|------|---------|
| `index.ts` | Barrel: `loadMcpConfigs`, types |
| `loader.ts` | `loadMcpConfigs()` main entry |
| `types.ts` | `ClaudeCodeMcpServer`, `LoadedMcpServer`, `McpScope` |
| `env-expander.ts` | `expandEnvVarsInObject()` — recursive `${VAR}` substitution |
| `transformer.ts` | Claude Code format → OpenCode `Mcp` shape |
| `scope-filter.ts` | Project vs user scope precedence |
## THREE-TIER MCP CONTEXT
| Tier | Loader | Scope |
|------|--------|-------|
| 1. Built-in | `src/mcp/` `createBuiltinMcps()` | Global, 3 remote HTTP MCPs |
| 2. **Claude Code** | **This module** | **From `.mcp.json`, project + user** |
| 3. Skill-embedded | `src/features/skill-mcp-manager/` | Per-session, from SKILL.md YAML |
## SECURITY
- **Env var allowlist**: `mcp_env_allowlist` config restricts which env vars can be expanded
- **No shell execution**: `${VAR}` is string replacement only, not shell `$()`
- **Secrets redaction**: `env-cleaner.ts` (in skill-mcp-manager) filters known secret patterns from logs
## RELATED
- Phase 5 integration: `src/plugin-handlers/mcp-config-handler.ts`
- Skill-embedded MCPs (Tier 3): `src/features/skill-mcp-manager/`
- Built-in MCPs (Tier 1): `src/mcp/`
@@ -0,0 +1,78 @@
# src/features/claude-code-plugin-loader/ — Unified Claude Code Plugin Loader
**Generated:** 2026-04-18
## OVERVIEW
16 files. Full Claude Code plugin compatibility layer. Discovers and loads ALL plugin components (commands, agents, skills, hooks, MCP servers, LSP servers) from `.opencode/plugins/` and `~/.claude/plugins/`.
## WHY IT EXISTS
Claude Code plugins ship commands/agents/skills as separate files with `plugin.json` manifest. OmO uses this loader to ingest them into its own registry so existing Claude Code plugins work unchanged under OmO.
## LOAD PIPELINE
```
loadAllPluginComponents(ctx)
→ discoverPlugins() # scan .opencode/plugins + ~/.claude/plugins
→ readPluginManifest(plugin.json) # parse name/version/commands/agents/skills/hooks/mcpServers
→ loadPluginCommands()
→ loadPluginAgents()
→ loadPluginSkills()
→ loadPluginHooks() # register hook handlers
→ loadPluginMcpServers() # feed into mcp-config-handler (tier 2)
→ loadPluginLspServers()
→ return LoadedPluginBundle
```
Called from `src/plugin-handlers/plugin-components-loader.ts` during Phase 2 of config handler (10s timeout with error isolation — one broken plugin does not sink the plugin load).
## KEY FILES
| File | Purpose |
|------|---------|
| `index.ts` | Barrel: `loadAllPluginComponents`, `PluginManifest`, `ClaudeSettings` types |
| `plugin-discovery.ts` | Find plugin directories across scopes |
| `plugin-manifest-parser.ts` | Parse `plugin.json` with Zod validation |
| `command-loader.ts` | Load commands from `commands/` or `COMMANDS.md` |
| `agent-loader.ts` | Load agents from `agents/` or `AGENTS.md` frontmatter |
| `skill-loader.ts` | Load skills from `skills/` or `SKILL.md` |
| `hook-loader.ts` | Load hooks config from `hooks/` or manifest |
| `mcp-loader.ts` | Extract MCP server configs |
| `lsp-loader.ts` | Extract LSP server configs |
| `settings-loader.ts` | Parse Claude Code `settings.json` |
## PLUGIN MANIFEST (plugin.json)
```jsonc
{
"name": "my-plugin",
"version": "1.0.0",
"description": "...",
"commands": ["./commands"], // or string[] of paths
"agents": ["./agents"],
"skills": ["./skills"],
"hooks": "./hooks/config.json",
"mcpServers": "./.mcp.json",
"lspServers": "./lsp"
}
```
## SCOPES
| Scope | Path | Priority |
|-------|------|----------|
| `project` | `.opencode/plugins/` | Highest |
| `local` | `~/.opencode/plugins/` | Medium |
| `user` | `~/.claude/plugins/` | Medium |
| `managed` | Built-in | Lowest |
## ERROR ISOLATION
Each plugin loads in isolation — if one fails (bad manifest, missing file, syntax error), others still load. Errors surface as warnings in `bunx oh-my-opencode doctor`.
## RELATED
- Phase 2 loader: `src/plugin-handlers/plugin-components-loader.ts`
- Tier 2 MCP integration: `src/features/claude-code-mcp-loader/`
- Claude Code compat hooks: `src/hooks/claude-code-hooks/`