@brainervirus/opencode-commandcode 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/_version.txt +1 -0
- package/index.ts +32 -0
- package/manifest.json +34 -0
- package/models.json +1225 -0
- package/package.json +89 -0
- package/plugin.ts +197 -0
- package/src/auth.ts +43 -0
- package/src/catalog-break.ts +40 -0
- package/src/catalog-release-notes.ts +171 -0
- package/src/catalog.ts +764 -0
- package/src/convert.ts +242 -0
- package/src/costs-docs.ts +179 -0
- package/src/costs-models-dev.ts +121 -0
- package/src/manifest.ts +147 -0
- package/src/model.ts +168 -0
- package/src/publish-policy.ts +32 -0
- package/src/startup.ts +43 -0
- package/src/stream.ts +237 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- GitHub flow: PR-gated `main`, CI matrix (`check (test|typecheck|pack)`), semantic-release on merge, catalog updates as PRs.
|
|
13
|
+
- Release notes open with a catalog summary table and collapsed lists of fallback / unpriced models.
|
|
14
|
+
- `manifest.json` describing the bundled catalog (status, cost sources, command-code version).
|
|
15
|
+
- First publish of `@brainervirus/commandcode-go-opencode-provider`.
|
|
16
|
+
- Last-good catalog cache and silent `startup.json` diagnostics under the plugin state dir.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Load the Command Code model catalog when CLI cost extraction fails (`command-code@1.38.x`).
|
|
21
|
+
- Stop plugin `console.log` / `console.warn` from leaking into the OpenCode loading UI.
|
|
22
|
+
- Default to bundled `models.json` (no local `command-code` install). Opt-in local scrape via `commandCodePackagePath` or `COMMANDCODE_PACKAGE_PATH`.
|
|
23
|
+
- Refresh bundled catalog from `command-code@1.38.1` and fill missing costs from official docs.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Brent Weatherall
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @brainervirus/opencode-commandcode
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@brainervirus/opencode-commandcode)
|
|
4
|
+
[](https://github.com/BrainerVirus/opencode-commandcode/actions)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
[Command Code](https://commandcode.ai) API provider for [opencode](https://opencode.ai). Use Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, GLM, MiniMax, Step, and other models through a single API key.
|
|
8
|
+
|
|
9
|
+
This package keeps a **bundled** model catalog current via CI. You do **not** need a local `command-code` CLI. Catalog patches publish automatically after a green PR merges to `main`.
|
|
10
|
+
|
|
11
|
+
Previously published as `@brainervirus/commandcode-go-opencode-provider`. Use this name instead.
|
|
12
|
+
|
|
13
|
+
## Credits
|
|
14
|
+
|
|
15
|
+
This package is based on **[FanFan4204/opencode-commandcode-provider](https://github.com/FanFan4204/opencode-commandcode-provider)**. That work started from **[brent-weatherall/opencode-commandcode-provider](https://github.com/brent-weatherall/opencode-commandcode-provider)** by **[Brent Weatherall](https://github.com/brent-weatherall)**. Thank you both — FanFan for the OpenCode provider this repo continues, and Brent for the original plugin, catalog extraction, and Command Code wiring. The license remains MIT; copyright stays with Brent Weatherall.
|
|
16
|
+
|
|
17
|
+
### What this package adds
|
|
18
|
+
|
|
19
|
+
- Bundled `models.json` is the default runtime catalog (no local CLI scrape).
|
|
20
|
+
- CLI cost extraction can fail (as on `command-code@1.38.x`) without dropping models.
|
|
21
|
+
- Official docs fill missing costs; remaining paid gaps use [models.dev](https://models.dev) as a reference. Command Code free SKUs stay `$0`.
|
|
22
|
+
- Reasoning effort **variants** on models that declare `reasoningEfforts`.
|
|
23
|
+
- Quiet OpenCode startup (diagnostics go to `startup.json`, not stdout).
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### 1. Install the plugin
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"plugin": ["@brainervirus/opencode-commandcode@latest"]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Pin a version instead of `@latest` if you do not want automatic catalog patches.
|
|
36
|
+
|
|
37
|
+
`file://` checkouts are **not** updated by npm; `git pull` after CI commits, or switch to the npm plugin line.
|
|
38
|
+
|
|
39
|
+
### 2. Provider transport (Command Code Provider API)
|
|
40
|
+
|
|
41
|
+
This plugin supplies model metadata. Point OpenCode at Command Code's documented Provider API:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"plugin": ["@brainervirus/opencode-commandcode@latest"],
|
|
46
|
+
"provider": {
|
|
47
|
+
"commandcode": {
|
|
48
|
+
"npm": "@ai-sdk/openai-compatible",
|
|
49
|
+
"name": "Command Code GOAT",
|
|
50
|
+
"env": ["COMMANDCODE_API_KEY"],
|
|
51
|
+
"options": {
|
|
52
|
+
"baseURL": "https://api.commandcode.ai/provider/v1"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Connect
|
|
60
|
+
|
|
61
|
+
Run `/connect` in opencode, search for **Command Code**, and enter your API key, or set `COMMANDCODE_API_KEY`.
|
|
62
|
+
|
|
63
|
+
### 4. Select a model
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
/models
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Optional local CLI override
|
|
70
|
+
|
|
71
|
+
Maintainers only. OpenCode will scrape a local `command-code` install when `COMMANDCODE_PACKAGE_PATH` or `commandCodePackagePath` in `~/.config/opencode/opencode-commandcode.json` is set.
|
|
72
|
+
|
|
73
|
+
## Development
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/BrainerVirus/opencode-commandcode.git
|
|
77
|
+
cd opencode-commandcode
|
|
78
|
+
bun install
|
|
79
|
+
bun run check # oxlint + oxfmt + bun test + tsc (same stack as workit)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
bun run sync -- --remote # refresh models.json + manifest.json from command-code@latest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
CI (`.github/workflows/catalog-sync.yml`) opens a PR every 6 hours when Command Code ships a new catalog. Merge after **check (test)**, **check (typecheck)**, **check (lint)**, **check (format)**, and **check (pack)** are green. `.github/workflows/release.yml` then runs **semantic-release** (npm publish + GitHub Release + tag). Do not push to `main`.
|
|
87
|
+
|
|
88
|
+
The GitHub Actions secret name is `NPMJS` (same as workit). It is mapped to both `NPM_TOKEN` and `NODE_AUTH_TOKEN`. Use an npm **Automation** token (bypasses 2FA). A login token from `~/.npmrc` fails CI with `EOTP`. Catalog PRs get a real CI run when `RELEASE_SYNC_TOKEN` (or `CATALOG_PUSH_TOKEN`) is a PAT; `GITHUB_TOKEN` can open the PR but GitHub will not start workflows from that event.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT — see [LICENSE](LICENSE). Original copyright [Brent Weatherall](https://github.com/brent-weatherall).
|
package/_version.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.38.1
|
package/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { resolveApiKey } from "./src/auth.js";
|
|
2
|
+
import { CommandCodeLanguageModel } from "./src/model.js";
|
|
3
|
+
|
|
4
|
+
export interface CommandCodeProviderOptions {
|
|
5
|
+
name?: string;
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
baseURL?: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
authPaths?: string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function createCommandCode(options: CommandCodeProviderOptions = {}) {
|
|
13
|
+
const apiKey = resolveApiKey({ apiKey: options.apiKey, authPaths: options.authPaths });
|
|
14
|
+
if (!apiKey) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
"Command Code API key not found. Set COMMANDCODE_API_KEY env var, create ~/.commandcode/auth.json, or pass apiKey option.",
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
languageModel(modelId: string): CommandCodeLanguageModel {
|
|
22
|
+
return new CommandCodeLanguageModel(modelId, {
|
|
23
|
+
apiKey,
|
|
24
|
+
baseURL: typeof options.baseURL === "string" ? options.baseURL : undefined,
|
|
25
|
+
headers:
|
|
26
|
+
typeof options.headers === "object" && options.headers !== null
|
|
27
|
+
? (options.headers as Record<string, string>)
|
|
28
|
+
: undefined,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
package/manifest.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"generatedAt": "2026-08-28T19:50:57.386Z",
|
|
4
|
+
"pluginVersion": "0.5.0",
|
|
5
|
+
"commandCodeVersion": "1.38.1",
|
|
6
|
+
"commandCodeTarball": "https://registry.npmjs.org/command-code/-/command-code-1.38.1.tgz",
|
|
7
|
+
"modelCount": 65,
|
|
8
|
+
"reasoningModelCount": 54,
|
|
9
|
+
"extraction": {
|
|
10
|
+
"modelCatalog": "ok",
|
|
11
|
+
"costCatalog": "docs",
|
|
12
|
+
"costCatalogError": null
|
|
13
|
+
},
|
|
14
|
+
"costSources": {
|
|
15
|
+
"cli": 0,
|
|
16
|
+
"officialDocs": 60,
|
|
17
|
+
"thirdParty": 0,
|
|
18
|
+
"free": 5,
|
|
19
|
+
"fallback": 0,
|
|
20
|
+
"unmatched": 0
|
|
21
|
+
},
|
|
22
|
+
"review": {
|
|
23
|
+
"thirdParty": [],
|
|
24
|
+
"free": [
|
|
25
|
+
"inclusionai/ling-3.0-flash-free",
|
|
26
|
+
"minimax/minimax-m2.7-free",
|
|
27
|
+
"MiniMaxAI/MiniMax-M3-Free",
|
|
28
|
+
"minimax/minimax-m3-free",
|
|
29
|
+
"tencent/Hy3"
|
|
30
|
+
],
|
|
31
|
+
"unmatched": []
|
|
32
|
+
},
|
|
33
|
+
"status": "healthy"
|
|
34
|
+
}
|