2026-02-17 11:17:01 +09:00
|
|
|
# src/ — Plugin Source
|
2026-02-08 17:09:12 +09:00
|
|
|
|
2026-02-17 11:17:01 +09:00
|
|
|
**Generated:** 2026-02-17
|
2026-02-10 14:53:39 +09:00
|
|
|
|
2026-02-17 11:17:01 +09:00
|
|
|
## OVERVIEW
|
2026-02-10 14:53:39 +09:00
|
|
|
|
2026-02-17 11:17:01 +09:00
|
|
|
Root source directory. Entry point `index.ts` orchestrates 4-step initialization: config → managers → tools → hooks → plugin interface.
|
2026-02-10 14:53:39 +09:00
|
|
|
|
2026-02-17 11:17:01 +09:00
|
|
|
## KEY FILES
|
2026-02-10 14:53:39 +09:00
|
|
|
|
2026-02-17 11:17:01 +09:00
|
|
|
| File | Purpose |
|
|
|
|
|
|------|---------|
|
|
|
|
|
| `index.ts` | Plugin entry, exports `OhMyOpenCodePlugin` |
|
|
|
|
|
| `plugin-config.ts` | JSONC parse, multi-level merge (project → user → defaults), Zod validation |
|
|
|
|
|
| `create-managers.ts` | TmuxSessionManager, BackgroundManager, SkillMcpManager, ConfigHandler |
|
|
|
|
|
| `create-tools.ts` | SkillContext + AvailableCategories + ToolRegistry |
|
|
|
|
|
| `create-hooks.ts` | 3-tier hook composition: Core(33) + Continuation(7) + Skill(2) |
|
|
|
|
|
| `plugin-interface.ts` | Assembles 7 OpenCode hook handlers into PluginInterface |
|
2026-02-10 14:53:39 +09:00
|
|
|
|
2026-02-17 11:17:01 +09:00
|
|
|
## CONFIG LOADING
|
2026-02-10 14:53:39 +09:00
|
|
|
|
2026-02-17 11:17:01 +09:00
|
|
|
```
|
|
|
|
|
loadPluginConfig(directory, ctx)
|
|
|
|
|
1. User: ~/.config/opencode/oh-my-opencode.jsonc
|
|
|
|
|
2. Project: .opencode/oh-my-opencode.jsonc
|
|
|
|
|
3. mergeConfigs(user, project) → deepMerge for agents/categories, Set union for disabled_*
|
|
|
|
|
4. Zod safeParse → defaults for omitted fields
|
|
|
|
|
5. migrateConfigFile() → legacy key transformation
|
|
|
|
|
```
|
2026-02-10 14:53:39 +09:00
|
|
|
|
2026-02-17 11:17:01 +09:00
|
|
|
## HOOK COMPOSITION
|
2026-02-08 17:09:12 +09:00
|
|
|
|
|
|
|
|
```
|
2026-02-17 11:17:01 +09:00
|
|
|
createHooks()
|
|
|
|
|
├─→ createCoreHooks() # 33 hooks
|
|
|
|
|
│ ├─ createSessionHooks() # 20: contextWindowMonitor, thinkMode, ralphLoop, sessionRecovery...
|
|
|
|
|
│ ├─ createToolGuardHooks() # 9: commentChecker, rulesInjector, writeExistingFileGuard...
|
|
|
|
|
│ └─ createTransformHooks() # 4: claudeCodeHooks, keywordDetector, contextInjector, thinkingBlockValidator
|
|
|
|
|
├─→ createContinuationHooks() # 7: todoContinuationEnforcer, atlas, stopContinuationGuard...
|
|
|
|
|
└─→ createSkillHooks() # 2: categorySkillReminder, autoSlashCommand
|
|
|
|
|
```
|