|
1 | 1 | # PROJECT KNOWLEDGE BASE |
2 | 2 |
|
3 | | -**Generated:** 2025-12-05T01:16:20+09:00 |
4 | | -**Commit:** 6c9a2ee |
| 3 | +**Generated:** 2025-12-14T17:16:30+09:00 |
| 4 | +**Commit:** 7f27fbc |
5 | 5 | **Branch:** master |
6 | 6 |
|
7 | 7 | ## OVERVIEW |
8 | 8 |
|
9 | | -OpenCode plugin distribution implementing Claude Code/AmpCode features. Provides multi-model agent orchestration, LSP tools, AST-Grep search, and safe-grep utilities. |
| 9 | +OpenCode plugin implementing Claude Code/AmpCode features. Multi-model agent orchestration (GPT-5.2, Claude, Gemini, Grok), LSP tools (11), AST-Grep search, MCP integrations (context7, websearch_exa, grep_app). "oh-my-zsh" for OpenCode. |
10 | 10 |
|
11 | 11 | ## STRUCTURE |
12 | 12 |
|
13 | 13 | ``` |
14 | 14 | oh-my-opencode/ |
15 | 15 | ├── src/ |
16 | | -│ ├── agents/ # AI agent definitions (oracle, librarian, explore, etc.) |
17 | | -│ ├── hooks/ # Plugin lifecycle hooks |
18 | | -│ ├── tools/ # LSP, AST-Grep, Safe-Grep tool implementations |
19 | | -│ │ ├── lsp/ # 11 LSP tools (hover, definition, references, etc.) |
20 | | -│ │ ├── ast-grep/ # AST-aware code search |
21 | | -│ │ └── safe-grep/ # Safe grep with limits |
22 | | -│ └── features/ # Terminal features |
23 | | -├── dist/ # Build output (bun + tsc declarations) |
24 | | -└── test-rule.yml # AST-Grep test rules |
| 16 | +│ ├── agents/ # AI agents (OmO, oracle, librarian, explore, frontend, document-writer, multimodal-looker) |
| 17 | +│ ├── hooks/ # 19 lifecycle hooks (comment-checker, rules-injector, keyword-detector, etc.) |
| 18 | +│ ├── tools/ # LSP (11), AST-Grep, Grep, background-task, glob, look-at, skill, slashcommand |
| 19 | +│ ├── mcp/ # MCP servers (context7, websearch_exa, grep_app) |
| 20 | +│ ├── features/ # Terminal features, Claude Code loaders (agent, command, skill, mcp, session-state) |
| 21 | +│ ├── config/ # Zod schema, TypeScript types |
| 22 | +│ ├── auth/ # Google Antigravity OAuth |
| 23 | +│ ├── shared/ # Utilities (deep-merge, pattern-matcher, logger, etc.) |
| 24 | +│ └── index.ts # Main plugin entry (OhMyOpenCodePlugin) |
| 25 | +├── script/ # build-schema.ts, publish.ts |
| 26 | +├── assets/ # JSON schema |
| 27 | +└── dist/ # Build output (ESM + .d.ts) |
25 | 28 | ``` |
26 | 29 |
|
27 | 30 | ## WHERE TO LOOK |
28 | 31 |
|
29 | 32 | | Task | Location | Notes | |
30 | 33 | |------|----------|-------| |
31 | | -| Add new agent | `src/agents/` | Export from index.ts | |
32 | | -| Add new hook | `src/hooks/` | Export from index.ts | |
33 | | -| Add new tool | `src/tools/` | Follow lsp/ pattern: index, types, tools, utils | |
34 | | -| Modify LSP behavior | `src/tools/lsp/` | client.ts for connection logic | |
35 | | -| AST-Grep patterns | `src/tools/ast-grep/` | napi.ts for @ast-grep/napi | |
36 | | -| Terminal features | `src/features/terminal/` | title.ts | |
37 | | -| Google Antigravity auth | `src/auth/antigravity/` | OAuth plugin for Google models | |
| 34 | +| Add new agent | `src/agents/` | Create .ts file, add to builtinAgents in index.ts, update types.ts | |
| 35 | +| Add new hook | `src/hooks/` | Create dir with createXXXHook(), export from index.ts | |
| 36 | +| Add new tool | `src/tools/` | Dir with index/types/constants/tools.ts, add to builtinTools | |
| 37 | +| Add MCP server | `src/mcp/` | Create config, add to index.ts | |
| 38 | +| Modify LSP behavior | `src/tools/lsp/` | client.ts for connection, tools.ts for handlers | |
| 39 | +| AST-Grep patterns | `src/tools/ast-grep/` | napi.ts for @ast-grep/napi binding | |
| 40 | +| Google OAuth | `src/auth/antigravity/` | OAuth plugin for Google models | |
| 41 | +| Config schema | `src/config/schema.ts` | Zod schema, run `bun run build:schema` after changes | |
| 42 | +| Claude Code compat | `src/features/claude-code-*-loader/` | Command, skill, agent, mcp loaders | |
38 | 43 |
|
39 | 44 | ## CONVENTIONS |
40 | 45 |
|
41 | | -- **Package manager**: Bun only (not npm/yarn) |
42 | | -- **Build**: Dual output - `bun build` + `tsc --emitDeclarationOnly` |
| 46 | +- **Package manager**: Bun only (`bun run`, `bun build`, `bunx`) |
43 | 47 | - **Types**: bun-types (not @types/node) |
| 48 | +- **Build**: Dual output - `bun build` (ESM) + `tsc --emitDeclarationOnly` |
44 | 49 | - **Exports**: Barrel pattern - `export * from "./module"` in index.ts |
45 | | -- **Module structure**: index.ts, types.ts, constants.ts, utils.ts, tools.ts per tool |
| 50 | +- **Directory naming**: kebab-case (`ast-grep/`, `claude-code-hooks/`) |
| 51 | +- **Tool structure**: Each tool has index.ts, types.ts, constants.ts, tools.ts, utils.ts |
| 52 | +- **Hook pattern**: `createXXXHook(input: PluginInput)` returning event handlers |
46 | 53 |
|
47 | 54 | ## ANTI-PATTERNS (THIS PROJECT) |
48 | 55 |
|
49 | | -- **Bash file operations**: Never use mkdir/touch/rm/cp/mv for file creation |
50 | 56 | - **npm/yarn**: Use bun exclusively |
51 | | -- **@types/node**: Use bun-types instead |
| 57 | +- **@types/node**: Use bun-types |
| 58 | +- **Bash file operations**: Never use mkdir/touch/rm/cp/mv for file creation in code |
52 | 59 | - **Generic AI aesthetics**: No Space Grotesk, avoid typical AI-generated UI patterns |
| 60 | +- **Direct bun publish**: Use GitHub Actions workflow_dispatch only (OIDC provenance) |
| 61 | +- **Local version bump**: Version managed by CI workflow, never modify locally |
53 | 62 | - **Rush completion**: Never mark tasks complete without verification |
54 | 63 | - **Interrupting work**: Complete tasks fully before stopping |
55 | 64 |
|
56 | 65 | ## UNIQUE STYLES |
57 | 66 |
|
58 | | -- **Directory naming**: kebab-case (`ast-grep/`, `safe-grep/`) |
59 | | -- **Tool organization**: Each tool has cli.ts, constants.ts, index.ts, napi.ts/tools.ts, types.ts, utils.ts |
60 | 67 | - **Platform handling**: Union type `"darwin" | "linux" | "win32" | "unsupported"` |
61 | | -- **Error handling**: Consistent try/catch with async/await |
62 | 68 | - **Optional props**: Extensive use of `?` for optional interface properties |
63 | 69 | - **Flexible objects**: `Record<string, unknown>` for dynamic configs |
| 70 | +- **Error handling**: Consistent try/catch with async/await in all tools |
| 71 | +- **Agent tools restriction**: Use `tools: { include: [...] }` or `tools: { exclude: [...] }` |
| 72 | +- **Temperature**: Most agents use `0.1` for consistency |
| 73 | +- **Hook naming**: `createXXXHook` function naming convention |
64 | 74 |
|
65 | 75 | ## AGENT MODELS |
66 | 76 |
|
67 | 77 | | Agent | Model | Purpose | |
68 | 78 | |-------|-------|---------| |
69 | | -| oracle | GPT-5.2 | Code review, strategic planning | |
70 | | -| librarian | Claude Haiku | Documentation, example lookup | |
71 | | -| explore | Grok | File/codebase exploration | |
72 | | -| frontend-ui-ux-engineer | Gemini | UI generation | |
73 | | -| document-writer | Gemini | Documentation writing | |
| 79 | +| OmO | anthropic/claude-opus-4-5 | Primary orchestrator, team leader | |
| 80 | +| oracle | openai/gpt-5.2 | Strategic advisor, code review, architecture | |
| 81 | +| librarian | opencode/big-pickle | Multi-repo analysis, docs lookup, GitHub examples | |
| 82 | +| explore | opencode/grok-code | Fast codebase exploration, file patterns | |
| 83 | +| frontend-ui-ux-engineer | google/gemini-3-pro-preview | UI generation, design-focused | |
| 84 | +| document-writer | google/gemini-3-pro-preview | Technical documentation | |
| 85 | +| multimodal-looker | google/gemini-2.5-flash | PDF/image/diagram analysis | |
74 | 86 |
|
75 | 87 | ## COMMANDS |
76 | 88 |
|
77 | 89 | ```bash |
78 | 90 | # Type check |
79 | 91 | bun run typecheck |
80 | 92 |
|
81 | | -# Build |
| 93 | +# Build (ESM + declarations + schema) |
82 | 94 | bun run build |
83 | 95 |
|
84 | 96 | # Clean + Build |
85 | 97 | bun run rebuild |
| 98 | + |
| 99 | +# Build schema only |
| 100 | +bun run build:schema |
86 | 101 | ``` |
87 | 102 |
|
88 | 103 | ## DEPLOYMENT |
89 | 104 |
|
90 | | -**배포는 GitHub Actions workflow_dispatch로만 진행** |
| 105 | +**GitHub Actions workflow_dispatch only** |
91 | 106 |
|
92 | | -1. package.json 버전은 수정하지 않음 (워크플로우에서 자동 bump) |
93 | | -2. 변경사항 커밋 & 푸시 |
94 | | -3. GitHub Actions에서 `publish` 워크플로우 수동 실행 |
95 | | - - `bump`: major | minor | patch 선택 |
96 | | - - `version`: (선택) 특정 버전 지정 가능 |
| 107 | +1. package.json version NOT modified locally (auto-bumped by workflow) |
| 108 | +2. Commit & push changes |
| 109 | +3. Trigger `publish` workflow manually: |
| 110 | + - `bump`: major | minor | patch |
| 111 | + - `version`: (optional) specific version override |
97 | 112 |
|
98 | 113 | ```bash |
99 | | -# 워크플로우 실행 (CLI) |
| 114 | +# Trigger via CLI |
100 | 115 | gh workflow run publish -f bump=patch |
101 | 116 |
|
102 | | -# 워크플로우 상태 확인 |
| 117 | +# Check status |
103 | 118 | gh run list --workflow=publish |
104 | 119 | ``` |
105 | 120 |
|
106 | | -**주의사항**: |
107 | | -- `bun publish` 직접 실행 금지 (OIDC provenance 문제) |
108 | | -- 로컬에서 버전 bump 하지 말 것 |
| 121 | +**Critical**: |
| 122 | +- Never run `bun publish` directly (OIDC provenance issue) |
| 123 | +- Never bump version locally |
109 | 124 |
|
110 | 125 | ## NOTES |
111 | 126 |
|
112 | 127 | - **No tests**: Test framework not configured |
113 | | -- **CI/CD**: GitHub Actions publish workflow 사용 |
114 | | -- **Version requirement**: OpenCode >= 1.0.132 (earlier versions have config bugs) |
115 | | -- **Multi-language docs**: README.md, README.en.md, README.ko.md |
| 128 | +- **OpenCode version**: Requires >= 1.0.132 (earlier versions have config bugs) |
| 129 | +- **Multi-language docs**: README.md (EN), README.ko.md (KO) |
| 130 | +- **Config locations**: `~/.config/opencode/oh-my-opencode.json` (user) or `.opencode/oh-my-opencode.json` (project) |
| 131 | +- **Schema autocomplete**: Add `$schema` field in config for IDE support |
| 132 | +- **Trusted dependencies**: @ast-grep/cli, @ast-grep/napi, @code-yeongyu/comment-checker |
0 commit comments