fix(installer): generate working OpenCode command pointers - #2692
fix(installer): generate working OpenCode command pointers#2692blade035 wants to merge 2 commits into
Conversation
OpenCode resolves `@` references in command bodies as file paths
relative to the project worktree root — there is no `@skills/<id>`
skill-reference namespace. The previous default pointer template
(`@skills/{canonicalId}`) produced dead references: invoking
`/<canonicalId>` left the model with literal `@skills/...` text to
reverse-engineer instead of the skill content, and the pointer files
shadowed OpenCode's native skill→command auto-registration.
Pointers now reference the installed skill file directly via
`@{target_dir}/{canonicalId}/SKILL.md` so `/<canonicalId>`
deterministically expands the full SKILL.md content.
Greptile SummaryThe PR replaces OpenCode’s unsupported skill namespace references with project-relative paths to installed
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| tools/installer/ide/_config-driven.js | Updates the default command-pointer body to reference the installed skill file through the project-relative target directory. |
| tools/installer/ide/platform-codes.yaml | Explicitly configures OpenCode to generate command pointers targeting each installed SKILL.md file. |
| test/test-installation-components.js | Verifies the generated OpenCode pointer uses the installed file path and excludes the obsolete namespace syntax. |
Reviews (2): Last reviewed commit: "test(installer): guard against legacy @s..." | Re-trigger Greptile
📝 WalkthroughWalkthroughOpenCode command pointers now reference each installed skill’s ChangesOpenCode skill pointer updates
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/test-installation-components.js (1)
359-362: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMake the regression assertion reject the legacy namespace.
The current
includescheck proves that the new path is present. It does not prove that@skills/bmad-masteris absent. Add a negative assertion or match the complete generated body.Proposed assertion
assert( commandContent.includes('@.agents/skills/bmad-master/SKILL.md'), 'Command pointer body references the installed skill via @<target_dir>/<canonicalId>/SKILL.md', ); + assert( + !commandContent.includes('`@skills/bmad-master`'), + 'Command pointer does not use the legacy `@skills/`<canonicalId> namespace', + );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/test-installation-components.js` around lines 359 - 362, Update the assertion in the command-content test to verify that the legacy `@skills/bmad-master` namespace is absent, either by adding a negative assertion alongside the existing path check or by matching the complete generated body. Preserve validation that the installed skill is referenced through @.agents/skills/bmad-master/SKILL.md.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/test-installation-components.js`:
- Around line 359-362: Update the assertion in the command-content test to
verify that the legacy `@skills/bmad-master` namespace is absent, either by adding
a negative assertion alongside the existing path check or by matching the
complete generated body. Preserve validation that the installed skill is
referenced through @.agents/skills/bmad-master/SKILL.md.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 97d9debd-6001-492a-9090-be310ef026a4
📒 Files selected for processing (3)
test/test-installation-components.jstools/installer/ide/_config-driven.jstools/installer/ide/platform-codes.yaml
sanmaxdev
left a comment
There was a problem hiding this comment.
Verified the command pointer resolves directly to the installed SKILL.md and the regression guard excludes the legacy namespace. npm ci && npm run quality passed on ddf9f4926c6388dbebf121bee1dac34d8ffeefbc.
Summary
Fixes opencode integration: the command pointers generated by the installer reference skills using
@skills/<id>syntax, which opencode does not support. opencode resolves@references as file paths relative to the project root (packages/opencode/src/config/markdown.tsFILE_REGEX,packages/opencode/src/session/prompt.tsresolvePromptParts) — there is no@skills/namespace. As a result, no skill content is ever injected into the prompt; the LLM must rediscover the skill by agentic file exploration (non-deterministic, and a no-op for non-agentic editors).This PR changes the installer's default command-pointer body template to emit a real relative path (
@{target_dir}/{canonicalId}/SKILL.md), which opencode resolves correctly.Related issues:
workflow.mdin the skill folder #1956 ([BUG] opencode does not load any skills involving aworkflow.mdin the skill folder) — likely the same root cause: skill content never reaches the prompt.What changed
tools/installer/ide/_config-driven.jsDEFAULT_COMMANDS_BODY_TEMPLATE:@skills/{canonicalId}→@{target_dir}/{canonicalId}/SKILL.md{target_dir}was already supported byexpandBodyTemplate(lines 96–97); only the default template and comments were wrong.@skills/<id>"matches OpenCode's native syntax".tools/installer/ide/platform-codes.yamlcommands_body_template: "@{target_dir}/{canonicalId}/SKILL.md"+ explanatory comment.test/test-installation-components.js(Suite 8)@.agents/skills/bmad-master/SKILL.md.Verification
All green:
node test/test-installation-components.js— all suites pass (incl. updated Suite 8)npm run lint,npx prettier --check,npm run format:checknpm test(test:refs / test:install / test:urls / test:channels / test:renderer / test:retrospective / test:sprint-planning / test:skills / lint / lint:md / format:check)End-to-end repro with the generated pointer (opencode CLI 1.18.14):
@.agents/skills/bmad-master/SKILL.md(was@skills/bmad-master).opencode run --command bmad-master→ skill markerPR_MARKER_LOADED_9f2cseen in the session: content is injected.pointer-target.mdproduced its markerFROM_POINTER_bbbin the session.@skills/bmad-masterbody injected nothing — the model had to agenticallyRead _bmad/_config/skill-manifest.csvand the SKILL.md itself to "discover" the skill.UnknownError: Unexpected server error), while a plainhello.mdcommand worked — the failure is specific to skill-backed commands.Migration note (existing installs)
commands_body_templateonly takes effect on a fresh or re-run install; pointer files that already exist are not rewritten (existing content is respected, and the generator's reserved-guard skips files it doesn't own). Existing opencode installs with old@skills/<id>pointers must delete the stale files incommands_target_dir(remove-command-pointers/ manual deletion) and re-run the installer.