diff options
| author | Jesse Vincent <jesse@fsck.com> | 2025-11-22 15:47:38 -0800 |
|---|---|---|
| committer | Jesse Vincent <jesse@fsck.com> | 2025-11-22 15:47:38 -0800 |
| commit | c940d84f3d65775c9548356619ae71202307c044 (patch) | |
| tree | 6836390bcf92fc6255956bf24ab2f2ca11793810 /.opencode/plugin | |
| parent | 8e7f90a95496e4e83b8970b1d38af943c7e68748 (diff) | |
fix: use correct event subscription format for opencode
Diffstat (limited to '.opencode/plugin')
| -rw-r--r-- | .opencode/plugin/superpowers.js | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/.opencode/plugin/superpowers.js b/.opencode/plugin/superpowers.js index ec39678..92b2048 100644 --- a/.opencode/plugin/superpowers.js +++ b/.opencode/plugin/superpowers.js @@ -79,16 +79,17 @@ ${content}`; } ], - 'session.created': async () => { - const usingSuperpowersPath = skillsCore.resolveSkillPath('using-superpowers', superpowersSkillsDir, personalSkillsDir); - - let usingSuperpowersContent = ''; - if (usingSuperpowersPath) { - const fullContent = fs.readFileSync(usingSuperpowersPath.skillFile, 'utf8'); - usingSuperpowersContent = skillsCore.stripFrontmatter(fullContent); - } + event: async ({ event }) => { + if (event.type === 'session.created') { + const usingSuperpowersPath = skillsCore.resolveSkillPath('using-superpowers', superpowersSkillsDir, personalSkillsDir); + + let usingSuperpowersContent = ''; + if (usingSuperpowersPath) { + const fullContent = fs.readFileSync(usingSuperpowersPath.skillFile, 'utf8'); + usingSuperpowersContent = skillsCore.stripFrontmatter(fullContent); + } - const toolMapping = ` + const toolMapping = ` **Tool Mapping for OpenCode:** When skills reference tools you don't have, substitute OpenCode equivalents: - \`TodoWrite\` → \`update_plan\` (your planning/task tracking tool) @@ -107,14 +108,14 @@ When skills reference tools you don't have, substitute OpenCode equivalents: - Personal skills override superpowers skills when names match `; - const hasUpdates = skillsCore.checkForUpdates(path.join(homeDir, '.config/opencode/superpowers')); + const hasUpdates = skillsCore.checkForUpdates(path.join(homeDir, '.config/opencode/superpowers')); - const updateNotice = hasUpdates ? - '\n\n**Updates available!** Run `cd ~/.config/opencode/superpowers && git pull` to update superpowers.' : - ''; + const updateNotice = hasUpdates ? + '\n\n**Updates available!** Run `cd ~/.config/opencode/superpowers && git pull` to update superpowers.' : + ''; - return { - context: `<EXTREMELY_IMPORTANT> + return { + context: `<EXTREMELY_IMPORTANT> You have superpowers. **Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, use the 'use_skill' tool:** @@ -123,7 +124,8 @@ ${usingSuperpowersContent} ${toolMapping}${updateNotice} </EXTREMELY_IMPORTANT>` - }; + }; + } } }; }; |
