Skip to content

refactor: use skill.paths registration instead of copying skill file#23

Merged
JosXa merged 2 commits intomainfrom
opencode-agent/issue-21
Feb 1, 2026
Merged

refactor: use skill.paths registration instead of copying skill file#23
JosXa merged 2 commits intomainfrom
opencode-agent/issue-21

Conversation

@JosXa
Copy link
Copy Markdown
Owner

@JosXa JosXa commented Jan 31, 2026

Summary

  • Adopts the new OpenCode skill registration system from PR #9640
  • Registers skill folder path via skills.paths in the config hook instead of copying SKILL.md to ~/.config/opencode/skill/snippets/
  • Removes the installSkill config option and installSkillToGlobal function (no longer needed)

Changes

  • index.ts: Register skill path via config hook, remove file copy logic
  • src/config.ts: Remove installSkill config option
  • schema/config.schema.json: Remove installSkill property
  • skill/snippets/SKILL.md: Remove installSkill from config documentation
  • src/config.test.ts & src/config.integration.test.ts: Update tests

Closes #21

Comment thread index.ts Outdated
// Register /snippet command and skill path
config: async (opencodeConfig) => {
// Register skill folder path for automatic discovery
// (requires OpenCode PR #9640 for skills.paths support)
Copy link
Copy Markdown
Owner Author

@JosXa JosXa Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Redundant comment, we won't merge beforehand

Comment thread index.ts
};
cfg.skills ??= {};
cfg.skills.paths ??= [];
cfg.skills.paths.push(SKILL_DIR);
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work when our code is bundled/minified?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JosXa
Copy link
Copy Markdown
Owner Author

JosXa commented Jan 31, 2026

@opencode-agent pls check the comments

@JosXa
Copy link
Copy Markdown
Owner Author

JosXa commented Jan 31, 2026

Addressed the review comments:

  1. Redundant comment removed - Deleted the // (requires OpenCode PR #9640 for skills.paths support) comment since we won't merge beforehand.

  2. Bundling concern - Clarified that this uses standard tsc compilation, not bundling. The path resolution works correctly because:

    • dist/index.js uses join(__dirname, "..") to get package root
    • skill/ folder is at package root (via package.json files array)
    • This is the same pattern the old installSkillToGlobal used

All 179 tests pass. Ready for review.

@JosXa
Copy link
Copy Markdown
Owner Author

JosXa commented Feb 1, 2026

Hey opencode, please rebase

JosXa added 2 commits February 1, 2026 16:42
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
@JosXa JosXa force-pushed the opencode-agent/issue-21 branch from da8b60c to 419ba2b Compare February 1, 2026 15:43
@JosXa
Copy link
Copy Markdown
Owner Author

JosXa commented Feb 1, 2026

Done! Successfully rebased onto main and force-pushed.

Changes during rebase:

  • Resolved conflicts by keeping the experimental.skillRendering config option (added in main) while still removing installSkill
  • Fixed a syntax error that occurred during the merge resolution
  • Applied biome formatting (line ending normalization)

All tests pass (201 tests ✅)

@JosXa JosXa merged commit 9eaa2c4 into main Feb 1, 2026
3 checks passed
@JosXa JosXa deleted the opencode-agent/issue-21 branch February 1, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use new skill registration system

1 participant