Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions FORK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Fork: @brainervirus/opencode-commandcode (catalog fix)

Local fork carrying the Command Code catalog fix for opencode.

## What broke upstream

`command-code@1.94.0` changed the minified bundle shape: the provider enum is now
defined as an inline IIFE object `X_=(Q_={ANTHROPIC:"anthropic",...}).VERCEL_AI_GATEWAY`
instead of the previously recognized `Wt={...}` / `Bi={...}` forms. Because of that,
`bun run sync -- --remote` failed with `Could not evaluate model catalog: Q_ is not defined`,
the CI sync has not published updates since Dec 2 (issues #333-#339), and the plugin
stayed on the `command-code@1.93.4` catalog (105 models from 2026-11-26).

## The patch

`src/catalog.ts`:
1. **`extractEnumBindings()`** - new extractor: collects inline `X_=(Q_={...}).K`
bindings before the catalog and joins the object into the eval context
(`Q_`, `Q_Context`, and the outer `X_`). The real-world form is a single
paren `=\(Inner={...})`, not `\(Outer=(Inner={...}))`.
2. **`buildEvalContext()`** - enum bindings are applied BEFORE
`extractStringBindings()` so string aliases resolve on top of them.
3. **`API_ONLY_MODELS`** - 5 SKUs the live provider API serves but the CLI 1.94.0
bundle does not list (`recursive/flint-v1.1:free`, `minimax/minimax-m4`,
`thinkingmachines/inkling-2-small`, `reflection/beam-contributor:free`,
`subquadratic/subq-savant-1.4`). Merged into the catalog before the
availability filter.
4. Regenerated artifacts: `models.json` - 111 models from `command-code@1.94.0`,
costs from the official Command Code docs + models.dev; retired
`recursive/flint-v1.0:free` and `stepfun/Step-5-Preview` are gone.

Checks: `bun test tests/unit/` -> 268 pass (6 fail - pre-existing, confirmed on a
clean HEAD worktree: `bun` not on the tests' PATH, POSIX paths in `pluginStateDir`,
`verify:release-candidate` is environment-dependent); `typecheck` / `lint` /
`format:check` are green; `bun run build` produces `dist/plugin.js` (231 KB).

## OpenCode configuration (V2, `~/.config/opencode/opencode.jsonc`)

```jsonc
{
"plugins": [
"file:///W:/Repositories/opencode-commandcode",
"-@brainervirus/opencode-commandcode"
]
}
```

The second entry disables the npm version (`-ID`) so its provider (105 models)
does not overwrite the local one. To refresh the local catalog:

```sh
cd W:\Repositories\opencode-commandcode
bun run sync -- --remote
bun run build
opencode reload
```

## Notes

- A PR with `extractEnumBindings` + `API_ONLY_MODELS` would close the upstream
catalog-break issues.
- `*:free` and paid SKUs have distinct ids - do not merge them.
- When `command-code` moves past 1.94.0 the bundle shape may change again:
rerun `bun run sync -- --remote` and extend `extractEnumBindings` /
`extractStringBindings` for any new "X is not defined" shape.
2 changes: 1 addition & 1 deletion _version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.93.6
1.94.0
18 changes: 10 additions & 8 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
{
"schemaVersion": 1,
"generatedAt": "2026-12-01T18:02:14.723Z",
"generatedAt": "2026-12-04T08:57:37.182Z",
"pluginVersion": "0.12.53",
"commandCodeVersion": "1.93.6",
"commandCodeTarball": "https://registry.npmjs.org/command-code/-/command-code-1.93.6.tgz",
"modelCount": 105,
"reasoningModelCount": 94,
"commandCodeVersion": "1.94.0",
"commandCodeTarball": "https://registry.npmjs.org/command-code/-/command-code-1.94.0.tgz",
"modelCount": 111,
"reasoningModelCount": 100,
"extraction": {
"modelCatalog": "ok",
"costCatalog": "docs",
"costCatalogError": null
},
"costSources": {
"cli": 0,
"officialDocs": 105,
"officialDocs": 110,
"thirdParty": 0,
"free": 0,
"free": 1,
"fallback": 0,
"unmatched": 0
},
"review": {
"thirdParty": [],
"free": [],
"free": [
"reflection/beam-contributor:free"
],
"unmatched": []
},
"status": "healthy"
Expand Down
Loading