summaryrefslogtreecommitdiff
path: root/.opencode/plugins
diff options
context:
space:
mode:
authorGoldJohnKing <GoldJohnKing@live.cn>2026-08-18 21:27:47 +0800
committerGoldJohnKing <GoldJohnKing@live.cn>2026-08-18 21:27:47 +0800
commitca8cb53f46eb42e1c11c6fa221855165bebbdce8 (patch)
tree86fd60b151881cf3f56df294901bf41932b7249f /.opencode/plugins
parent6e31f3f7dba400468354e31de8e74d6e9729f70c (diff)
fix(opencode): skip V2 setup when V1 invokes it with a V1-shaped ctx
opencode 1.18.18 also calls default.setup, but with a ctx that lacks the skill/session domains, so the defensive try/catch logged a TypeError into every V1 session transcript even though V1 is fully served by the SuperpowersPlugin named export. Detect the V1 shape and return quietly.
Diffstat (limited to '.opencode/plugins')
-rw-r--r--.opencode/plugins/superpowers.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/.opencode/plugins/superpowers.js b/.opencode/plugins/superpowers.js
index e547e87..223e727 100644
--- a/.opencode/plugins/superpowers.js
+++ b/.opencode/plugins/superpowers.js
@@ -155,6 +155,13 @@ export const SuperpowersPlugin = async ({ client, directory }) => {
* equivalent of V1's experimental.chat.messages.transform.
*/
async function setup(ctx) {
+ // V1 (observed on opencode 1.18.18) also invokes default.setup, but with a
+ // V1-shaped ctx that lacks the skill/session domains. Detect it and return
+ // quietly — V1 is served entirely by the SuperpowersPlugin named export.
+ if (!ctx || !ctx.skill || typeof ctx.skill.transform !== 'function' || !ctx.session || typeof ctx.session.hook !== 'function') {
+ return;
+ }
+
// 1. Register skills (one transform; one draft.add per skill)
try {
const skills = [];