fix: add transformToSkillReferences for skills-only delivery#985
fix: add transformToSkillReferences for skills-only delivery#985furaul wants to merge 3 commits intoFission-AI:mainfrom
Conversation
…-AI#881) When delivery is 'skills', generated SKILL.md files contained raw /opsx:* command references that don't exist in skills-only mode. Add a transformer that maps them to /openspec-* skill references. Closes Fission-AI#881 Closes Fission-AI#879 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdded a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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)
src/core/init.ts (1)
541-546: Optional: extract transformer selection to a shared helper.The same
(opencode|pi) → hyphen | skills → skillRefs | undefinedselection is now duplicated at three call sites (here,update.tsL199-203, and L675-679). Consider lifting it into a tiny helper insrc/utils/command-references.tsso future tool/delivery additions only need to change one place.♻️ Example
// src/utils/command-references.ts export function selectSkillTransformer(toolId: string, delivery: string) { if (toolId === 'opencode' || toolId === 'pi') return transformToHyphenCommands; if (delivery === 'skills') return transformToSkillReferences; return undefined; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/core/init.ts` around lines 541 - 546, Extract the duplicated transformer-selection logic into a single helper (e.g., selectSkillTransformer) that returns transformToHyphenCommands when tool id is "opencode" or "pi", returns transformToSkillReferences when delivery === "skills", and otherwise returns undefined; replace the inline ternary expression in init.ts and the other two call sites (the locations using transformToHyphenCommands / transformToSkillReferences) with calls to selectSkillTransformer to centralize future changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/core/init.ts`:
- Around line 541-546: Extract the duplicated transformer-selection logic into a
single helper (e.g., selectSkillTransformer) that returns
transformToHyphenCommands when tool id is "opencode" or "pi", returns
transformToSkillReferences when delivery === "skills", and otherwise returns
undefined; replace the inline ternary expression in init.ts and the other two
call sites (the locations using transformToHyphenCommands /
transformToSkillReferences) with calls to selectSkillTransformer to centralize
future changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 88677937-d318-4377-b8fb-5c64386359ed
📒 Files selected for processing (5)
src/core/init.tssrc/core/update.tssrc/utils/command-references.tssrc/utils/index.tstest/utils/command-references.test.ts
Summary
Fixes #881 (also closes #879)
When
delivery: 'skills'is configured, generated SKILL.md files contain hardcoded/opsx:*command references (e.g.,/opsx:apply,/opsx:archive) that point to commands that don't exist in skills-only mode. Users should see/openspec-apply-change,/openspec-explore, etc. instead.Changes
transformToSkillReferences()insrc/utils/command-references.ts— maps all 11/opsx:<workflow>patterns to their/openspec-<skill-name>equivalents using an explicit lookup table (inline to avoid circular dependency withprofile-sync-drift.ts)src/core/init.tsandsrc/core/update.ts(3 call sites) — extends the existing transformer ternary so thattransformToSkillReferencesis used whendelivery === 'skills'and the tool is not opencode/piWORKFLOW_TO_SKILL_DIRTransformer selection logic
Test plan
Generated with Claude Code
Summary by CodeRabbit
Release Notes