Repository navigation
fix(opencode): declare @opencode-ai/plugin as optional peer dependency - #3816
alakmar344 wants to merge 1 commit into
Conversation
When installing ecc-universal as an OpenCode plugin from npm, loading fails with 'Cannot find package @opencode-ai/plugin' because the plugin imports it at runtime but it was only declared in devDependencies.
ECC Tools / Security EvidenceCommit: Security evidence gate passed (success) No security-sensitive scanner-evidence gap detected. Mode: enforce Scanned 1 changed file(s). No missing scanner-evidence signal was detected. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Risk TaxonomyCommit: PR taxonomy review recommended (neutral) Detected 2 PR taxonomy bucket(s): Install Manifest Integrity, CI/CD Recommendation. Scanned 1 changed file(s). Roadmap taxonomy buckets: Install Manifest IntegrityInstall manifests, plugin metadata, and shipped skills should stay synchronized with user-facing setup guidance. Signals:
Paths:
CI/CD RecommendationCI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work. Signals:
Paths:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Reference Set ReadinessCommit: Reference set readiness gaps detected (neutral) Reference evidence present for 0/7 areas (0%) across 1 changed file(s). This check is based on files changed in this PR. Repository-level readiness is still reported by
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Hosted Promotion ReadinessCommit: Hosted promotion readiness passed (success) No hosted promotion evidence gaps detected across 1 changed file(s); 0 corpus scenarios had matching evidence. This check compares PR file changes against the evaluator/RAG promotion corpus in No evaluator corpus scenarios matched this PR. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Declare the runtime peer dependency package.json |
Adds @opencode-ai/plugin as an optional peer dependency with a version requirement of >=1.0.0. |
Priority:
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
- affaan-m/ECC#3668 — Reports OpenCode plugin load failures involving the missing
@opencode-ai/pluginpackage. - affaan-m/ECC#3745 — Reports the same missing-package error during published OpenCode plugin loading.
Possibly related PRs
- affaan-m/ECC#3654 — Changes OpenCode runtime packaging and addresses the same published-plugin dependency resolution problem.
- affaan-m/ECC#3806 — Adds a runtime packaging check that requires imported packages to be declared as dependencies or peer dependencies.
- affaan-m/ECC#3676 — Changes the published OpenCode entrypoint and plugin loading implementation.
Suggested reviewers: affaan-m, haelyra
Merge Risk: 
Minimal · up to 5518e
-
This change declares the OpenCode plugin package as an optional peer dependency. The compiled bundle has no runtime import of that package, so the declaration is low risk and can be merged.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Out of Scope Changes check
-
Explanation
The reviewed change is limited to
package.jsondependency metadata. The change directly targets the missing runtime dependency reported by#3810. No unrelated source, test, or configuration changes are present in the supplied change summary.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
-
Full details: Linked Issues check
-
Explanation
The change adds
@opencode-ai/pluginas an optional peer dependency, as described for#3810. npm does not automatically install an optional peer dependency when it is absent. Therefore, a consumer installation can still omit@opencode-ai/plugin, and the runtime import failure can remain. The separate default-export defect in#3810is not part of this PR's stated objective.Resolution
Use a regular runtime dependency, a non-optional peer dependency, or bundle the required helper so the published plugin can resolve
@opencode-ai/pluginwithout a separately installed package. Add a packed-tarball smoke test that imports the published OpenCode entrypoint without development dependencies.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
[Medium impact] Safe to merge: isolated production installations passed the compiled plugin and tool checks before and after the metadata change.
|
|
Thank you for investigating the OpenCode tool-loading failure. Keeping the installed plugin usable without development dependencies is the right goal. Current main already addresses this in 87e8d734: the tools use a local runtime wrapper and import the plugin SDK only as a TypeScript type. Our fresh packed-production check executed changed-files successfully with @opencode-ai/plugin physically absent. I am closing this dependency-only alternative because the source fix makes the optional peer unnecessary. Published 2.2.3 can still differ from current main; this does not claim a new package release. Thank you for flagging that distribution gap, and please keep sending focused runtime reproductions like this. |
Summary
Installing
ecc-universalas an OpenCode plugin from npm ("plugins": ["ecc-universal"]) fails during load time because the compiled plugin entrypoint (.opencode/dist/index.jsand tools) imports@opencode-ai/pluginat runtime, but the package only declared it indevDependencies.Because
devDependenciesare omitted in consumer npm installations, the OpenCode plugin loader throws:Solution
Declare
@opencode-ai/plugininpeerDependencieswithpeerDependenciesMetaset tooptional: true:optional: trueensures that non-OpenCode harnesses (Claude Code, Codex, Pi, Cursor) are not burdened or failed if they do not have@opencode-ai/plugin.build:opencode) continue to work seamlessly.Fixes #3810