Skip to content

feat: port to V2 plugin API with plugin-compat layer - #79

Open
rafaelsnv wants to merge 1 commit into
supabase-community:mainfrom
rafaelsnv:main
Open

rafaelsnv wants to merge 1 commit into
supabase-community:mainfrom
rafaelsnv:main

Conversation

@rafaelsnv

@rafaelsnv rafaelsnv commented Sep 29, 2026 •

Copy link
Copy Markdown

Ports the Supabase plugin to V2 Plugin.define() API. Introduces src/shared/plugin-compat.ts as a compatibility layer so existing V1-shaped modules (@opencode-ai/plugin) continue to work alongside V2.

@jumski

jumski commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

hey @rafaelsnv! thanks for taking on the V2 migration!

The build/source checks pass, but a packed-plugin test using @opencode/cli-linux-x64@2.0.16 fails during loading. The host selects the V1 server entrypoint instead of the new V2 definition.

The review also found auth issues: tools bypass the active host connection, and refresh can return another account’s local tokens. Those need fixes before merging, alongside the V1 schema regression and cross-Location OAuth cleanup.

We updated the canary to accept the V2 package, but its test harness still fails before plugin loading. That harness failure is separate from the plugin findings.

Are you up for addressing these in this PR? Also, which OpenCode version and install method did you use for testing?

@jumski

jumski commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

hey @rafaelsnv! quick update - OpenCode V2 is now released, so i tested your PR through the real npm install path against 2.0.27.

i published a snapshot from PR head 94edb4c, with only the package version changed:

opencode-supabase@0.5.1-pr79.20261013t065504z.sha.g94edb4cc8d4c

Lint, typecheck, all 199 tests, and packaging pass. Installation succeeds too, but two fresh TUI runs load the V1 src/server/index.ts entrypoint and fail with:

Plugin must export a default definition with an id and an effect or setup function.

The ./v2 export also points to src/index.v2.ts, while the implementation lives in src/index.ts. Beyond packaging, the existing /supabase TUI still needs a V2 port, alongside the auth and cleanup fixes from my earlier comment.

With V2 out, ill pick up the remaining migration on a separate maintainer branch, build on your work, and preserve attribution to you. Thanks for getting this started! If you have newer changes or testing notes, please share them so i dont duplicate your work.

jumski added a commit that referenced this pull request Oct 29, 2026
OpenCode 2 rejects the legacy-only server export and uses a different
TUI and credential lifecycle. Expose both host hooks at the existing
entrypoints and port /supabase to native V2 integration APIs.

Resolve tools through the active host connection and refresh the supplied
account instead of borrowing V1 project-local tokens. Scope OAuth cleanup
to its attempt and Location; preserve V1 storage and real Zod schemas.

Add required V2 packed-TUI CI coverage and document reconnect on upgrade.
Lint, typecheck, 213 tests and package checks pass. The same tarball passes
/supabase render checks twice on V1 1.17.14 and V2 2.0.27.
Real-account browser authorization remains unchecked.

Builds on Rafael Santos (@rafaelsnv) and the initial migration in PR #79:
#79

Refs #79
@jumski

jumski commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

hey @rafaelsnv! opencode-supabase@0.6.0 is now released with OpenCode V2 support. i built on your initial migration in #87, and we tested the plugin on Linux and Windows.

Thanks a ton for getting this started! Your contribution is credited in the migration commit and the release changelog.

https://github.com/supabase-community/opencode-supabase/releases/tag/v0.6.0

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.

2 participants