Fix plugin loading: move @opencode-ai/plugin to dependencies#48
Merged
Helweg merged 3 commits intoHelweg:mainfrom Apr 8, 2026
Merged
Fix plugin loading: move @opencode-ai/plugin to dependencies#48Helweg merged 3 commits intoHelweg:mainfrom
Helweg merged 3 commits intoHelweg:mainfrom
Conversation
- Moved @opencode-ai/plugin from devDependencies to dependencies This was causing 'Cannot find module @opencode-ai/plugin' errors when the plugin was installed via npm/bun without devDependencies - The export format remains 'export default plugin' as originally intended by the package author
Owner
|
If this is really needed because OpenCode doesn’t resolve peer deps reliably for npm plugins, I’m okay with it. I’d just prefer we pin @opencode-ai/plugin more tightly (exact or ~ rather than ^) and leave a quick note about why we’re doing this. |
…ading - Changed @opencode-ai/plugin from devDependencies to dependencies - Pinned version to ~1.3.13 (patch updates only) - Added inline comment explaining why: opencode downloads npm plugins without devDependencies, causing module resolution failures - Kept peerDependency for documentation purposes
Owner
|
The tighter pin looks good, but I think there’s one follow-up issue here: package.json can’t contain // comments, so the inline notes make the manifest invalid JSON. I’d move that explanation to the PR description/README/changelog and then regenerate package-lock.json as well so it matches the new ~1.3.13 range. |
- Comments are not valid in JSON, causing manifest to be invalid - Regenerated package-lock.json to match ~1.3.13 version range
Contributor
Author
|
doh comments in JSON! fixed |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a plugin loading issue when installed via npm by moving
@opencode-ai/pluginfromdevDependenciestodependencies.The Problem
When the plugin is installed from npm,
devDependenciesare not included. This caused the plugin to fail with:ERROR: Cannot find module '@opencode-ai/plugin'
Root Cause
The plugin expects
@opencode-ai/pluginto be available at runtime (as a peer dependency provided by opencode). However, opencode's module resolution for npm plugins doesn't properly resolve peer dependencies from the global config directory.This Fix
Moving
@opencode-ai/plugintodependenciesensures it's bundled with the plugin package, making module resolution work reliably.-- Version pinned to
~1.3.13to prevent breaking changes while allowing patch updates--
@opencode-ai/pluginkept in peerDependencies for documentation purposesTrade-offs:
@opencode-ai/pluginacross plugin installationsAlternative Approaches
A more elegant solution might be for opencode to:
@opencode-ai/pluginas a global peer dependency~/.config/opencode/node_modules/However, that requires changes to opencode core. This PR is a pragmatic fix that works with the current architecture.
Testing
After this fix, the plugin loads successfully and all tools are registered:
codebase_search- Search code by meaningcodebase_peek- Find code locations by meaningindex_codebase- Index codebase for searchindex_status- Check index statusindex_health_check- Check index healthindex_metrics- Get index metricsindex_logs- Get indexer logsfind_similar- Find similar codecall_graph- Query function callers/calleesimplementation_lookup- Find symbol definitions