refactor: use skill.paths registration instead of copying skill file#23
refactor: use skill.paths registration instead of copying skill file#23
Conversation
| // Register /snippet command and skill path | ||
| config: async (opencodeConfig) => { | ||
| // Register skill folder path for automatic discovery | ||
| // (requires OpenCode PR #9640 for skills.paths support) |
There was a problem hiding this comment.
- Redundant comment, we won't merge beforehand
| }; | ||
| cfg.skills ??= {}; | ||
| cfg.skills.paths ??= []; | ||
| cfg.skills.paths.push(SKILL_DIR); |
There was a problem hiding this comment.
Will this work when our code is bundled/minified?
There was a problem hiding this comment.
Yes - this is standard tsc compilation (not bundling). The package structure after build:
dist/index.js <- __dirname points here
dist/src/... <- compiled source
skill/ <- copied as-is (via package.json files)
join(__dirname, "..") from dist/index.js correctly resolves to the package root where skill/ exists. This is the same path resolution pattern the old installSkillToGlobal function used.
If you were ever to bundle this (e.g., with esbuild), you'd need to ensure skill/ is still distributed alongside and the path calculation updated accordingly. But for current tsc output, this works correctly.
|
@opencode-agent pls check the comments |
|
Addressed the review comments:
All 179 tests pass. Ready for review. |
|
Hey opencode, please rebase |
This change leverages OpenCode PR #9640's new skill registration system, which allows plugins to register skill folders via config instead of manually copying SKILL.md files to the global directory. Changes: - Register skill path via config hook (skills.paths) - Remove installSkillToGlobal function and installSkill config option - Update tests and documentation accordingly
da8b60c to
419ba2b
Compare
|
Done! Successfully rebased onto main and force-pushed. Changes during rebase:
All tests pass (201 tests ✅) |
Summary
skills.pathsin the config hook instead of copying SKILL.md to~/.config/opencode/skill/snippets/installSkillconfig option andinstallSkillToGlobalfunction (no longer needed)Changes
installSkillconfig optioninstallSkillpropertyinstallSkillfrom config documentationCloses #21