OpenCode 2.0.4: official npm/git plugin specs fail with PluginModule.LoadError — named export not accepted
Summary
On OpenCode 2.0.4 (macOS, arm64) the official install spec from README (superpowers@git+https://github.com/obra/superpowers.git in the plugin config array) fails to load at every startup. The plugin entrypoint ships only a v1 named export (export const SuperpowersPlugin), while OpenCode 2.x requires a default export object with { id, setup }.
Environment
- OpenCode 2.0.4, macOS (arm64)
- Superpowers 6.3.0
- graphifyy 0.9.61 not relevant here; reproduces with a clean config
Repro
~/.config/opencode/opencode.json:
{ "plugin": ["superpowers@git+https://github.com/obra/superpowers.git"] }
Every OpenCode start logs:
msg="loading plugin" id=superpowers@git+https://github.com/obra/superpowers.git entrypoint=file:///Users/me/.cache/opencode/npm/git-superpowers-.../node_modules
message="failed to load plugin"
cause="PluginModule.LoadError: Plugin must export a default definition with an id and an effect or setup function."
opencode plugin list shows a - - superpowers@... placeholder row. The bootstrap never injects, skills never register. Trying the tag-raw URL spec (superpowers@https://github.com/obra/superpowers/raw/refs/tags/v6.3.0/.opencode/plugins/superpowers.js) additionally fails with NpmInstallFailedError ... TAR_BAD_ARCHIVE — that URL is a raw JS file, not a tarball.
Workaround (works)
Install the package into the OpenCode config dir and load it through a small v2 adapter with an absolute path (the 2.0.4 resolver does not see node_modules relative to a plugin file):
cd ~/.config/opencode && npm install superpowers@git+https://github.com/obra/superpowers.git
~/.config/opencode/plugins/superpowers.js:
import { SuperpowersPlugin } from "/Users/me/.config/opencode/node_modules/superpowers/.opencode/plugins/superpowers.js";
export default {
id: "superpowers",
setup: async (ctx) => {
return (await SuperpowersPlugin({ ...ctx, directory: ctx?.directory ?? process.cwd() })) ?? {};
},
};
With that, opencode plugin list shows superpowers local and the v1 hooks register without errors. What I could not verify yet: whether every v1 hook the plugin registers (the session bootstrap injection via message transform, skills dir registration through config) is actually invoked by the 2.0.4 runtime — registration is clean, but I have no direct proof the bootstrap lands in the system prompt. Related known issues: #2197 (non-interactive opencode run does not inject), #2160 (bootstrap leaks into task subagents).
Suggested fix
Ship a dual v1+v2 entrypoint from the same package per the official migration guide (v1 named export kept for older hosts, plus export default { id, setup }), and update the README OpenCode section to the v2 plugins config key. That would also fix the TAR_BAD_ARCHIVE path by letting users pin a version tag of a real npm/git package instead of a raw-file URL.
Happy to test a preview build on 2.0.4/macOS.
Source: obra/superpowers