Repository navigation
fix(opencode2): support stable 2.0.x without ctx.catalog - #24
Conversation
Stable OpenCode 2.0 omits the unified catalog domain that the beta plugin required, so setup crashed on ctx.catalog.transform. Detect catalog when present (beta path unchanged) and otherwise sync discovered models into providers.cursor in OPENCODE_CONFIG_DIR so auth, aisdk hooks, and the model picker work on 2.0.5/2.0.6. Classic OC1 plugin entrypoints untouched.
Restore oakimov/cursor-opencode-provider repository/bugs/homepage so the contribution PR does not retarget package metadata to the fork.
oakimov
left a comment
There was a problem hiding this comment.
Thanks for the clear issue + fix direction — detecting ctx.catalog and keeping the beta transform path is the right shape. Requesting changes before merge: stable support must not regress safety or thin out functionality relative to the beta catalog path.
Required for merge
-
No config destruction / silent decline in config handling
- On parse failure, do not fall back to
{}and rewrite the file (that can wipe a user’sopencode.json(c)down to onlyproviders.cursor). - Do not strip JSONC comments / reformat the whole document as a side effect of model sync.
- Fail closed (skip write) or surgically update only the Cursor provider block with a real JSONC-preserving approach.
- On parse failure, do not fall back to
-
No functionality decline vs beta catalog models
- Stable
providers.cursorentries must carry the same model metadata asapplyCursorModels/applyModelEntry(at leastvariants,cost, limits/modalities, settings/wire id) — not a reduced picker-only subset. - Prefer sharing one translation helper so beta and stable cannot drift.
- Stable
-
Drop the
0.6.8→0.6.9bump from this PR (release/version is maintainer-owned). -
README: remove “fork compat” framing; document upstream OC2 stable vs beta dual-path clearly.
Also missing / strengthen
- Tests for:
hasCatalogDomain; parse-failure does not write; idempotent sync; parity assertions that synced models match catalog-shaped fields (variants/cost). - Confirm default config dir /
OPENCODE_CONFIG_DIRbehavior matches how stable OC2 is actually run (docs mentionopencode2layouts). - Keep classic OC1 + beta catalog behavior byte-for-byte unchanged (no accidental optional-domain fallthrough that skips registration when catalog is present).
Happy to re-review once stable is a true fallback with equal model surface and non-destructive config updates.
Surgical jsonc-parser upsert preserves comments/unrelated keys and fails closed on parse errors. Shared model translator keeps full Cursor metadata parity; drop 0.6.9 bump; document stable vs beta dual-path in README.
|
Hey, thanks for the review — really helpful. I pushed 6cb48c5 with the follow-up fixes.
The focused PR suite is green: 77 tests passed. Build, typecheck, and diff checks also pass. The remaining five full-suite failures reproduce on the original base commit and are unrelated request-context/MCP tests. The branch is pushed and ready for re-review. Happy to adjust anything else you find. |
Document plugin directories, dedicated OPENCODE_CONFIG_DIR, and released:0 picker sorting; include id/providerID on catalog model info for stable/beta parity.
Follow-up polish (
|
Skip foreign providers.cursor identities, resolve config via OPENCODE_CONFIG_DIR then the host path bridge, retry after parse failures, and write configs atomically.
Lead the install docs with 2.0.5+ providers.cursor sync; keep ctx.catalog as a dev/next host surface instead of calling the product beta.
Follow-up (
|
Summary
2.0.5/2.0.6) wherectx.catalogis absent (ctx.catalog.transformundefined).ctx.catalog.transformis present.providers.cursorin$OPENCODE_CONFIG_DIR/opencode.json(c)so auth, AI SDK hooks, and the model picker work.plugin/plugin/v2) unchanged.Fixes #23
Test plan
ctx.catalog): catalog transform path still used; no regressionnpm test—test/config-catalog.test.tspasses"plugin": ["cursor-opencode-provider"]