2026-02-17 11:17:01 +09:00
|
|
|
# src/ — Plugin Source
|
2026-02-08 17:09:12 +09:00
|
|
|
|
2026-04-11 22:32:23 +09:00
|
|
|
**Generated:** 2026-04-11
|
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-03-06 17:59:05 +09:00
|
|
|
Entry point `index.ts` orchestrates 5-step initialization: loadConfig → createManagers → createTools → createHooks → createPluginInterface.
|
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 |
|
|
|
|
|
|------|---------|
|
2026-04-18 02:17:25 +09:00
|
|
|
| `index.ts` | Plugin entry, default-exports `pluginModule: PluginModule` with `{ id, server }` |
|
2026-03-06 17:59:05 +09:00
|
|
|
| `plugin-config.ts` | JSONC parse, multi-level merge, Zod v4 validation |
|
2026-02-17 11:17:01 +09:00
|
|
|
| `create-managers.ts` | TmuxSessionManager, BackgroundManager, SkillMcpManager, ConfigHandler |
|
2026-03-06 17:59:05 +09:00
|
|
|
| `create-tools.ts` | SkillContext + AvailableCategories + ToolRegistry (26 tools) |
|
2026-04-05 14:04:21 +09:00
|
|
|
| `create-hooks.ts` | 3-tier: Core(43) + Continuation(7) + Skill(2) = 52 hooks |
|
|
|
|
|
| `plugin-interface.ts` | 10 OpenCode hook handlers: config, tool, chat.message, chat.params, chat.headers, event, tool.execute.before, tool.execute.after, experimental.chat.messages.transform, experimental.session.compacting |
|
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()
|
2026-04-05 14:04:21 +09:00
|
|
|
├─→ createCoreHooks() # 43 hooks
|
|
|
|
|
│ ├─ createSessionHooks() # 24: contextWindowMonitor, thinkMode, ralphLoop, modelFallback, runtimeFallback, noSisyphusGpt, noHephaestusNonGpt, anthropicEffort, intentGate, legacyPluginToast...
|
|
|
|
|
│ ├─ createToolGuardHooks() # 14: commentChecker, rulesInjector, writeExistingFileGuard, jsonErrorRecovery, hashlineReadEnhancer, bashFileReadGuard, readImageResizer, todoDescriptionOverride, webfetchRedirectGuard...
|
|
|
|
|
│ └─ createTransformHooks() # 5: claudeCodeHooks, keywordDetector, contextInjector, thinkingBlockValidator, toolPairValidator
|
2026-03-19 11:55:30 +09:00
|
|
|
├─→ createContinuationHooks() # 7: todoContinuationEnforcer, atlas, stopContinuationGuard, compactionContextInjector...
|
2026-02-17 11:17:01 +09:00
|
|
|
└─→ createSkillHooks() # 2: categorySkillReminder, autoSlashCommand
|
|
|
|
|
```
|