fix(plugin): export only default from entry module (OpenCode 1.18.4) - #8
Merged
Conversation
OpenCode 1.18.4's loader invokes EVERY function-valued export of a plugin entry module as a plugin factory (iterates Object.values(entryModule) and calls each with PluginInput). index.ts also exported scrubSecrets and callMorphApply, which OpenCode invoked as bogus factories. They return a string / result object rather than throwing, so this produced no load error — but it silently registered garbage plugins alongside the real one. Fix (matches the toolbox plugin fixes): entry module exports exactly one thing — default. All implementation + named test exports move to impl.ts via git mv (no logic change); index.ts becomes a thin shim importing impl.ts and re-exporting default. Repoint src/execute.ts + index.test.ts imports to impl.js; add impl.ts to package.json files. 137/137 tests pass; typecheck clean; entry verified to export exactly [default].
JRedeker
force-pushed
the
fix/plugin-entry-export
branch
from
July 23, 2026 03:19
1cad4cb to
9ab7fc9
Compare
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.
Matches the toolbox/vision plugin-loader fixes. OpenCode 1.18.4 invokes every function-valued export of a plugin entry module as a plugin factory.
index.tsalso exportedscrubSecrets/callMorphApply, which OpenCode invoked as bogus factories — non-throwing (returned string/object) so no load error, but it registered garbage plugins.Fix: entry exports exactly
default. All impl + named test exports move toimpl.ts(git mv, no logic change);index.tsis a thin shim. Repointedsrc/execute.ts+index.test.ts+ packagefiles.137/137 pass; typecheck clean; entry verified
[default].