Repository navigation
fix(opencode): ship @opencode-ai/plugin as a runtime dependency - #3561
gaurav0107 wants to merge 2 commits into
Conversation
The compiled OpenCode tools import `tool` from `@opencode-ai/plugin/tool` at module top level, and the hooks plugin imports those tools statically. The package was only a devDependency, so production installs (OpenCode's npm plugin cache, `npm install --omit=dev`) could not resolve it and the whole plugin failed to load. Move it to `dependencies` and add a build-opencode regression test that fails when the built bundle imports a package not declared as a runtime dependency. Fixes affaan-m#3543
ECC Tools / Security EvidenceCommit: Security evidence gate passed (success) No security-sensitive scanner-evidence gap detected. Mode: enforce Scanned 3 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 3 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 3 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 3 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. |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⛔ Files ignored due to path filters: 1
⚙️ Run configuration
⛔ Files ignored due to path filters: 1
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
[Medium impact] Safe to merge based on the reviewed changes. No blocking findings remain.
|
ECC Tools / Security EvidenceCommit: Security evidence gate passed (success) No security-sensitive scanner-evidence gap detected. Mode: enforce Scanned 3 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 3 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 3 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 3 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. |
|
Thank you for catching the OpenCode runtime import failure and proposing the direct-Zod alternative we used. We carried your contribution into #3654 with attribution and the related follow-up fixes. That integration merged as e494799, and the resulting main passed CI, CodeQL, and Supply-Chain Watch. I’m closing this source PR as delivered. We appreciate your work and hope you’ll keep contributing. |
What Changed
@opencode-ai/plugin(1.18.34, same exact pin) fromdevDependenciestodependenciesin the rootpackage.json, which is the manifest published asecc-universal.package-lock.json: the root entry moves, and"dev": trueis dropped from@opencode-ai/pluginand its transitive deps. Nothing else changes.yarn.lockneeds no change because the workspace entry already lists dev and runtime deps together (yarn install --mode=update-lockfileleaves it untouched).tests/scripts/build-opencode.test.js: walks the built.opencode/dist/**/*.js, collects every bare (non-builtin, non-relative) import, and asserts each package is declared independenciesorpeerDependencies.Why This Change
Fixes #3543 (the bug report is in the issue's attached markdown file).
.opencode/dist/tools/*.jsimporttoolfrom@opencode-ai/plugin/toolat module top level, and.opencode/dist/plugins/ecc-hooks.jsimports those tools statically. OpenCode installs npm plugins without dev dependencies. So on any production install the first import throws and the whole plugin fails to load:The existing tests didn't catch this because they symlink the repo's
node_modules(which includes dev deps) into their fixtures.Trade-off to weigh:
@opencode-ai/pluginpulls in@opencode-ai/sdk,zodandeffect. In my measurement, a production install of the packed tarball grew from about 54 MB to about 115 MB ofnode_modules. If that is too heavy for users who don't run OpenCode, two alternatives:peerDependency. npm 7+ and Bun still install those by default, but the dependency weight is the same.tool()helper at runtime and depend only onzod.I kept the change to the fix the issue suggests, but I'm happy to switch to either.
Testing Done
npm pack, then in an empty host projectnpm install --omit=dev <tarball>andawait import("ecc-universal").main:ERR_MODULE_NOT_FOUND: Cannot find package '@opencode-ai/plugin'(same error as the issue).typeof default === "function").node tests/run-all.js). The new build-opencode case fails onmainwithundeclared runtime imports: @opencode-ai/pluginand passes with this change. All 10 cases intests/scripts/build-opencode.test.jspass.import type { PluginInput }) are erased at compile time, so the check scans compiled output, not TS sources. Node builtins andnode:specifiers are excluded, and scoped packages are reduced to@scope/name.Also ran:
validate-agents,validate-hooks,validate-commands,validate-skills,validate-install-manifests,validate-rules,catalog.js --text,command-registry:check,check-unicode-safety,validate-no-personal-paths,npm run lint, andscan-supply-chain-iocs. All pass.Type of Change
fix:Bug fixfeat:New featurerefactor:Code refactoringdocs:Documentationtest:Testschore:Maintenance/toolingci:CI/CD changesSecurity & Quality Checklist
If you changed dependencies or
package.json(bin/files/ deps)yarn install --mode=update-lockfile.yarn.lockis unchanged, because the workspace entry lists runtime and dev deps together.Documentation
🤖 Opened with Superhuman, an open-source contribution agent.