Repository navigation
Open
Description
Is your feature request related to a problem? Please describe.
OpenCode V2 has been released, but plugins for OpenCode V1 are not compatible with it. I would like this plugin to add support for OpenCode V2.
Describe the solution you'd like
The plugin should support both OpenCode V2 and OpenCode V1 concurrently for a certain period, ensuring it remains functional in both OpenCode V1 and OpenCode V2 environments (as different developers may migrate at different paces).
Describe alternatives you've considered
- Drop V1 support and ship a V2-only version. Port the plugin to the new V2 plugin API (Plugin.define with id + setup(ctx), the new @opencode/plugin package) and cut a new major release that only works on V2. This is the least maintenance effort long-term, but it forces every team still on V1 to either pin the last V1-compatible version or upgrade OpenCode before they can pick up plugin fixes — painful for orgs that migrate at different paces.
- Maintain two separate packages / release lines. Keep the current package on V1 and publish a V2-compatible fork (e.g. *-v2) on a separate branch or npm tag. Avoids touching the V1 codebase, but doubles the maintenance surface (bug fixes, features, and tests must be applied twice) and splits the user community.
- Single package exposing dual entrypoints (V1 server() + V2 setup()). The V2 migration guide documents a transitional shape where one default export spreads Plugin.define({...}) for V2 and also exposes a server() function for V1; V1 object entrypoints are supported on OpenCode 1.18.29+. This is essentially what I’m proposing in “Describe the solution you’d like”, called out here as the middle-ground alternative.
- Shim / adapter layer that translates V1 hooks to V2 at runtime. Wrap the existing V1 implementation behind an adapter that maps the old tool.execute.before / chat.params / event callbacks onto V2 domain hooks (ctx.tool.hook, ctx.session.hook("context"), ctx.event.subscribe, etc.). Reuses the V1 code, but the V2 context model is grouped by domain and uses a single mutable event object rather than separate input/output, so a faithful auto-translation isn’t possible — the guide explicitly states “this shape does not translate hooks automatically.”
- Keep V1-only for now and advise users not to upgrade to V2. Status quo; lowest effort, but leaves the plugin broken for anyone who adopts V2, which is already GA and receiving active fixes.
Additional context
https://opencode.ai/v2/docs/migrate-v1/
https://opencode.ai/v2/docs/plugins/
Metadata
Metadata
Assignees
Labels
No labels
Activity