Skip to content

fix(plugin): export only default from entry module (OpenCode 1.18.4) - #8

Merged
JRedeker merged 1 commit into
trunkfrom
fix/plugin-entry-export
Jul 23, 2026
Merged

fix(plugin): export only default from entry module (OpenCode 1.18.4)#8
JRedeker merged 1 commit into
trunkfrom
fix/plugin-entry-export

Conversation

@JRedeker

Copy link
Copy Markdown
Owner

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.ts also exported scrubSecrets/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 to impl.ts (git mv, no logic change); index.ts is a thin shim. Repointed src/execute.ts + index.test.ts + package files.

137/137 pass; typecheck clean; entry verified [default].

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
JRedeker force-pushed the fix/plugin-entry-export branch from 1cad4cb to 9ab7fc9 Compare July 23, 2026 03:19
@JRedeker
JRedeker merged commit 9bc03e0 into trunk Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant