Skip to content

Fix discovery for plugin-bundled OpenCode skills#2688

Open
walioo wants to merge 1 commit intocode-yeongyu:devfrom
walioo:codex/plugin-bundled-skills
Open

Fix discovery for plugin-bundled OpenCode skills#2688
walioo wants to merge 1 commit intocode-yeongyu:devfrom
walioo:codex/plugin-bundled-skills

Conversation

@walioo
Copy link
Copy Markdown

@walioo walioo commented Mar 19, 2026

Title: Fix discovery for plugin-bundled OpenCode skills

Summary:
OMO's custom skill loader currently discovers filesystem-backed OpenCode skills under config skill dirs, but misses skills bundled inside OpenCode plugins that are injected at runtime, such as superpowers/systematic-debugging.

Problem:

  • superpowers follows the official OpenCode installation flow by registering an OpenCode plugin and exposing its skills from the package skills/ directory.
  • OpenCode can use those skills, but OMO's skill tool only scans physical OpenCode skill directories and does not discover plugin-bundled skills from package roots.
  • Result: users see false negatives like Skill or command "systematic-debugging" not found even though superpowers/systematic-debugging is installed and available.

What this changes:

  • Extend OMO skill discovery to inspect OpenCode package roots under:
    • the OpenCode config node_modules
    • the OpenCode cache node_modules
  • Treat a package as a plugin-bundled skill provider when it has:
    • .opencode/plugins/*
    • skills/
  • Load those bundled skills with a package-based name prefix such as superpowers/...
  • Keep the existing deduplication and priority behavior intact

Regression coverage:

  • Adds a test that creates a fake plugin package in the OpenCode cache and verifies that discoverSkills({ includeClaudeCodePaths: false }) finds superpowers/systematic-debugging

Why this is safe:

  • Discovery remains read-only
  • Packages are only considered when they look like actual OpenCode plugins
  • Namespacing uses the package basename, matching how users expect to reference plugin-bundled skills

Validation:

  • bun test src/features/opencode-skill-loader/loader.test.ts
  • Verified locally against superpowers that all namespaced skills load through OMO after discovery is fixed

Summary by cubic

Fixes OpenCode plugin skill discovery so OMO finds skills bundled in plugins (e.g., superpowers/systematic-debugging, @obra/superpowers/systematic-debugging) and stops “skill not found” errors. OMO now scans plugin package roots in config/cache node_modules and loads their skills/ with a namespaced prefix that preserves npm scopes.

  • Bug Fixes
    • Scan OpenCode config and cache node_modules for plugin packages.
    • Detect plugins via .opencode/plugins/* JS/TS entries; load from skills/.
    • Prefix skill names with the package (including npm scope) to avoid collisions.
    • Integrate bundled skills into discoverSkills, discoverAllSkills, and loadOpencodeGlobalSkills with existing priority unchanged.
    • Add tests for cache discovery and scoped packages.

Written for commit 8e87ea6. Summary will update on new commits.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 19, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Confidence score: 3/5

  • There is a concrete compatibility risk in src/features/opencode-skill-loader/loader.ts: using basename() for skill names can strip scoped package prefixes (for example, @org/plugin becoming plugin).
  • Because this is a high-confidence, user-impacting behavior change (severity 7/10, confidence 9/10), the merge risk is moderate rather than low.
  • Pay close attention to src/features/opencode-skill-loader/loader.ts - scoped plugin names may be incorrectly normalized and break OpenCode naming compatibility.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/features/opencode-skill-loader/loader.ts">

<violation number="1" location="src/features/opencode-skill-loader/loader.ts:162">
P1: Custom agent: **Opencode Compatibility**

Using `basename()` to namespace skills drops the `@scope` directory for scoped packages (e.g., `@org/plugin` becomes `plugin`), violating OpenCode's plugin naming compatibility.

OpenCode relies on the full package name (including scope) to identify plugins. It recently patched a similar bug (Issue #17716) where stripping paths caused its internal loader to silently drop unrelated scoped plugins due to name collisions. By using `basename()` here, if a user installs multiple scoped plugins with the same base name (e.g., `@org1/cli` and `@org2/cli`), both will be prefixed as `cli/...` and `deduplicateSkillsByName()` will silently drop one of them.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@walioo
Copy link
Copy Markdown
Author

walioo commented Mar 19, 2026

I have read the CLA Document and I hereby sign the CLA

@walioo
Copy link
Copy Markdown
Author

walioo commented Mar 19, 2026

Addressed the scoped package compatibility issue in 8f6dd60 by preserving the full npm package name (for example @org/plugin) when prefixing plugin-bundled skills, and added regression coverage for scoped packages.

@walioo
Copy link
Copy Markdown
Author

walioo commented Mar 19, 2026

recheck

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

Auto-approved: The PR safely extends skill discovery to plugin-bundled packages using read-only operations, namespacing to avoid collisions, and comprehensive test coverage.

github-actions bot added a commit that referenced this pull request Mar 19, 2026
@walioo walioo force-pushed the codex/plugin-bundled-skills branch from 34371ab to b1b0407 Compare March 19, 2026 02:36
@walioo walioo force-pushed the codex/plugin-bundled-skills branch from b1b0407 to 8e87ea6 Compare March 19, 2026 02:37
magicJie pushed a commit to magicJie/oh-my-opencode that referenced this pull request Mar 19, 2026
@code-yeongyu code-yeongyu added the triage:bug-fix PR: Bug fix label Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:bug-fix PR: Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants