diff options
| -rw-r--r-- | .opencode/plugins/superpowers.js | 4 | ||||
| -rw-r--r-- | docs/README.opencode.md | 4 | ||||
| -rw-r--r-- | tests/opencode/test-bootstrap-caching.mjs | 22 |
3 files changed, 26 insertions, 4 deletions
diff --git a/.opencode/plugins/superpowers.js b/.opencode/plugins/superpowers.js index 9eff811..8d508db 100644 --- a/.opencode/plugins/superpowers.js +++ b/.opencode/plugins/superpowers.js @@ -78,7 +78,7 @@ export const V1_MAPPING = `**Tool Mapping for OpenCode:** When skills request actions, substitute OpenCode equivalents: - Create or update todos → \`todowrite\` - \`Subagent (general-purpose):\` → \`task\` with \`subagent_type: "general"\` -- Invoke a skill → OpenCode's native \`skill\` tool +- Invoke a skill → OpenCode's native \`skill\` tool. Skill ids are bare names, so drop the \`superpowers:\` prefix skills use when they name each other (\`superpowers:brainstorming\` → \`skill\` with \`name: "brainstorming"\`) - Read files → \`read\` - Create, edit, or delete files → \`apply_patch\` - Run shell commands → \`bash\` @@ -96,7 +96,7 @@ export const V2_MAPPING = `**Tool Mapping for OpenCode:** When skills request actions, substitute OpenCode equivalents: - Create or update todos → OpenCode v2 has no todo tool; track the plan in a markdown file (or the harness's plan facility) instead - \`Subagent (general-purpose):\` → \`subagent\` with \`agent: "general"\` (give it \`description\` and \`prompt\`, optionally \`background\`; pass \`sessionID\` to continue a previous subagent) -- Invoke a skill → OpenCode's native \`skill\` tool +- Invoke a skill → OpenCode's native \`skill\` tool. Skill ids are bare names, so drop the \`superpowers:\` prefix skills use when they name each other (\`superpowers:brainstorming\` → \`skill\` with \`id: "brainstorming"\`) - Read files → \`read\` - Create, edit, or delete files → use \`patch\` with \`patchText\` when available; otherwise use \`write\` to create or overwrite files, \`edit\` for targeted changes, and \`shell\` for deletion - Run shell commands → \`shell\` (\`command\`, \`workdir\`, \`timeout\`, \`background\`) diff --git a/docs/README.opencode.md b/docs/README.opencode.md index 3ffdd81..f907374 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -148,7 +148,7 @@ Skills speak in actions rather than naming any one runtime's tools. The bootstra - "Create a todo" / "mark complete in todo list" → `todowrite` - `Subagent (general-purpose):` template → OpenCode's `task` tool with `subagent_type: "general"` (or `"explore"` for codebase exploration) -- "Invoke a skill" → OpenCode's native `skill` tool +- "Invoke a skill" → OpenCode's native `skill` tool with the bare skill name (`superpowers:brainstorming` → `name: "brainstorming"`) - "Read a file" → `read` - "Create a file" / "edit a file" / "delete a file" → `apply_patch` - "Run a shell command" → `bash` @@ -159,7 +159,7 @@ Skills speak in actions rather than naming any one runtime's tools. The bootstra - "Create a todo" → V2 has no todo tool of any kind; the mapping tells the model to track the plan in a markdown file (or the harness's plan facility) instead - `Subagent (general-purpose):` template → OpenCode's `subagent` tool with `agent: "general"` (or `"explore"`); pass `sessionID` to continue a previous subagent -- "Invoke a skill" → OpenCode's native `skill` tool +- "Invoke a skill" → OpenCode's native `skill` tool with the bare skill id (`superpowers:brainstorming` → `id: "brainstorming"`) - "Read a file" → `read` - "Create, edit, or delete files" → use `patch` with `patchText` when available; otherwise use `write` to create or overwrite files, `edit` for targeted changes, and `shell` for deletion - "Run a shell command" → `shell` (`command`, `workdir`, `timeout`, `background`) diff --git a/tests/opencode/test-bootstrap-caching.mjs b/tests/opencode/test-bootstrap-caching.mjs index 386b7b1..39e4daa 100644 --- a/tests/opencode/test-bootstrap-caching.mjs +++ b/tests/opencode/test-bootstrap-caching.mjs @@ -76,6 +76,9 @@ const failures = scenario === 'present' if (scenario === 'present') { failures.push(...assertV2Bootstrap(result)); + // #2583: both flavors register bare skill ids and look them up exactly. + failures.push(...assertTeachesBareSkillIds('V1', bootstrapText(firstOutput), 'name')); + failures.push(...assertTeachesBareSkillIds('V2', v2Result.text, 'id')); } failures.push(...mappingFailures); @@ -202,6 +205,25 @@ function assertMappingConstants(mod) { return failures; } +// #2583: skills reference each other as `superpowers:<name>` (the Claude Code +// plugin namespace), but OpenCode V1 and V2 register bare ids (`brainstorming`) +// and their `skill` tools do an exact lookup, so a namespaced call fails with +// "Unable to load skill". When the injected bootstrap contains namespaced +// references, its tool mapping must tell the model to drop the prefix, using +// the flavor's `skill` parameter (V1 `name`, V2 `id`). +function assertTeachesBareSkillIds(flavor, text, param) { + const failures = []; + const refs = [...new Set(text.match(/superpowers:[a-z0-9-]+/g) || [])]; + if (refs.length === 0) return failures; + if (!text.includes('drop the `superpowers:` prefix')) { + failures.push(`expected ${flavor} bootstrap to tell the model to drop the superpowers: prefix (bootstrap references ${refs.join(', ')})`); + } + if (!text.includes(`\`superpowers:brainstorming\` → \`skill\` with \`${param}: "brainstorming"\``)) { + failures.push(`expected ${flavor} bootstrap to show superpowers:brainstorming loading as \`skill\` with \`${param}: "brainstorming"\``); + } + return failures; +} + // Drive setup() with a mock V2 ctx and fire the captured "context" hook on a // top-level (parentID-less) session. Returns the injected-part count and the // injected bootstrap text ('' when nothing was injected). |
