[PR #10654] feat(opencode): support plugins on opencodePlugins export #13518

Open
opened 2026-02-16 18:18:22 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10654

State: open
Merged: No


What does this PR do?

Resolves #10583. Currently npm-based plugins effectively must be opencode plugins and little else, as opencode will attempt to load the main module & execute factory functions producing plugins.

This pr checks first for an opencodePlugins export on the main module, and loads plugins from there if found.

How did you verify your code works?

Tested with @superbfowle/bash-history-mcp-test, which is based off of https://github.com/rektide/bash-history-mcp/tree/opencode-support-next / nitsanavni/bash-history-mcp#2 , attempting to add opencode support to bash-history-mcp.

My first pass at trying to do this was quite gnarly, and only worked because index.ts didn't export anything. https://github.com/nitsanavni/bash-history-mcp/pull/1/files#diff-dcdc3e0b3362edb8fec2a51d3fa51f8fb8af8f70247e06d9887fa934834c9122R78-R95

The second PR requires no messing around, was much cleaner to write.

Notes

I spent some time trying to add support loading from non-main files, as mentioned in #10583. But trying to get support for package.json#exports was not going well and I gave up. This PR only adds support for opencodePlugins exports on the main module, which is at least something.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10654 **State:** open **Merged:** No --- ### What does this PR do? Resolves #10583. Currently npm-based plugins effectively *must* be opencode plugins and little else, as opencode will attempt to load the main module & execute factory functions producing plugins. This pr checks first for an `opencodePlugins` export on the main module, and loads plugins from there if found. ### How did you verify your code works? Tested with `@superbfowle/bash-history-mcp-test`, which is based off of https://github.com/rektide/bash-history-mcp/tree/opencode-support-next / nitsanavni/bash-history-mcp#2 , attempting to add `opencode` support to `bash-history-mcp`. My first pass at trying to do this was quite gnarly, and only worked because `index.ts` didn't export anything. https://github.com/nitsanavni/bash-history-mcp/pull/1/files#diff-dcdc3e0b3362edb8fec2a51d3fa51f8fb8af8f70247e06d9887fa934834c9122R78-R95 The second PR requires no messing around, was much cleaner to write. ### Notes I spent some time trying to add support loading from non-main files, as mentioned in #10583. But trying to get support for `package.json#exports` was not going well and I gave up. This PR only adds support for `opencodePlugins` exports on the main module, which is at least something.
yindo added the pull-request label 2026-02-16 18:18:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13518