docs: document OpenCode 2 (V2) usage - #17
Closed
Majidalee1 wants to merge 3 commits into
Closed
Conversation
Introduce src/models.ts so the V1 plugin and the upcoming V2 entrypoint
share one source of truth for loading models.json and converting entries
into their runtime-specific shapes.
- loadModels(): reads models.json once, typed as ModelEntry[]
- toConfigKey(): stable short key derivation (preserves prior behavior)
- toV1ModelConfig(): legacy { config } hook model shape
- toV2ModelDraft()/toV2ModelMap(): OpenCode V2 catalog model drafts
plugin.ts now delegates to the shared module; behavior is unchanged
and covered by tests.
OpenCode 2 loads plugins from a module's default export as
{ id, setup }, and requires provider/model registration through the
catalog transform API. The legacy plugin.ts factory (V1 only) fails to
load in V2 with a SchemaError.
Add a new ./v2 entrypoint that exports { id, setup } and registers the
commandcode provider plus all models from models.json via
ctx.catalog.transform. Users can now opt in with:
plugins: ["commandcode-go-opencode-provider/v2"]
No provider block or hand-written model list is needed.
- v2.ts: V2 plugin default export ({ id, setup })
- package.json: expose ./v2, include v2.ts in files, bump to 0.5.0
- tsconfig.json: include v2.ts
- tests/unit/v2.test.ts: coverage for provider/model registration
Add a V2 section to the README covering install via the ./v2 entrypoint, API-key setup, and model selection. Add a V2 local-development snippet and switch the repo's example opencode.json to the native V2 plugin config.
This was referenced Aug 7, 2026
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documents how to use the Command Code provider with OpenCode 2 and updates the repo's example config to the V2 plugin format.
Changes
README.md:plugins: ["commandcode-go-opencode-provider/v2"], API-key setup (/connectorCOMMANDCODE_API_KEY), and model selection.plugin/providerblock remains the entrypoint for the legacyopencodeCLI.file://path to the./v2entrypoint.opencode.json: switch the example to the native V2 config (plugins+providers).Verification
Documentation and example-config only; no runtime behavior changed.
bun run typecheckandbun test tests/unit/continue to pass.