Update AGENTS.md

This commit is contained in:
YeonGyu-Kim
2025-12-14 17:18:09 +09:00
parent 00b938d20d
commit 3dea568007

111
AGENTS.md
View File

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