Skip to content
Merged
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
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# @brainervirus/commandcode-go-opencode-provider
# @brainervirus/opencode-commandcode

[![npm version](https://img.shields.io/npm/v/@brainervirus/commandcode-go-opencode-provider)](https://www.npmjs.com/package/@brainervirus/commandcode-go-opencode-provider)
[![CI](https://img.shields.io/github/actions/workflow/status/BrainerVirus/opencode-commandcode-provider/ci.yml?branch=main&label=CI)](https://github.com/BrainerVirus/opencode-commandcode-provider/actions)
[![npm version](https://img.shields.io/npm/v/@brainervirus/opencode-commandcode)](https://www.npmjs.com/package/@brainervirus/opencode-commandcode)
[![CI](https://img.shields.io/github/actions/workflow/status/BrainerVirus/opencode-commandcode/ci.yml?branch=main&label=CI)](https://github.com/BrainerVirus/opencode-commandcode/actions)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

[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.

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`.

Previously published as `@brainervirus/commandcode-go-opencode-provider`. Use this name instead.

## Credits

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.
Expand All @@ -26,7 +28,7 @@ This package is based on **[FanFan4204/opencode-commandcode-provider](https://gi

```json
{
"plugin": ["@brainervirus/commandcode-go-opencode-provider@latest"]
"plugin": ["@brainervirus/opencode-commandcode@latest"]
}
```

Expand All @@ -40,7 +42,7 @@ This plugin supplies model metadata. Point OpenCode at Command Code's documented

```json
{
"plugin": ["@brainervirus/commandcode-go-opencode-provider@latest"],
"plugin": ["@brainervirus/opencode-commandcode@latest"],
"provider": {
"commandcode": {
"npm": "@ai-sdk/openai-compatible",
Expand All @@ -66,13 +68,13 @@ Run `/connect` in opencode, search for **Command Code**, and enter your API key,

## Optional local CLI override

Maintainers only. OpenCode will scrape a local `command-code` install when `COMMANDCODE_PACKAGE_PATH` or `commandCodePackagePath` in `~/.config/opencode/commandcode-go-opencode-provider.json` is set.
Maintainers only. OpenCode will scrape a local `command-code` install when `COMMANDCODE_PACKAGE_PATH` or `commandCodePackagePath` in `~/.config/opencode/opencode-commandcode.json` is set.

## Development

```bash
git clone https://github.com/BrainerVirus/opencode-commandcode-provider.git
cd opencode-commandcode-provider
git clone https://github.com/BrainerVirus/opencode-commandcode.git
cd opencode-commandcode
bun install
bun run check # oxlint + oxfmt + bun test + tsc (same stack as workit)
```
Expand Down
2 changes: 1 addition & 1 deletion opencode.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://opencode.ai/config.json",
"model": "commandcode/deepseek-v4-flash",
"small_model": "commandcode/deepseek-v4-flash",
"plugin": ["@brainervirus/commandcode-go-opencode-provider/server"],
"plugin": ["@brainervirus/opencode-commandcode/server"],
"provider": {
"commandcode": {
"npm": "@ai-sdk/openai-compatible",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@brainervirus/commandcode-go-opencode-provider",
"name": "@brainervirus/opencode-commandcode",
"version": "0.5.0",
"description": "Command Code API provider for opencode — use Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, GLM, MiniMax, and Step models via Command Code",
"keywords": [
Expand All @@ -18,15 +18,15 @@
"opencode-provider",
"qwen"
],
"homepage": "https://github.com/BrainerVirus/opencode-commandcode-provider#readme",
"homepage": "https://github.com/BrainerVirus/opencode-commandcode#readme",
"bugs": {
"url": "https://github.com/BrainerVirus/opencode-commandcode-provider/issues"
"url": "https://github.com/BrainerVirus/opencode-commandcode/issues"
},
"license": "MIT",
"author": "Brent Weatherall",
"repository": {
"type": "git",
"url": "git+https://github.com/BrainerVirus/opencode-commandcode-provider.git"
"url": "git+https://github.com/BrainerVirus/opencode-commandcode.git"
},
"files": [
"index.ts",
Expand Down
13 changes: 6 additions & 7 deletions plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ interface PluginFileConfig {
}

function loadPluginConfig(): PluginFileConfig {
const configPath = join(
homedir(),
".config",
"opencode",
"commandcode-go-opencode-provider.json",
);
if (!existsSync(configPath)) return {};
const dir = join(homedir(), ".config", "opencode");
const configPath = [
join(dir, "opencode-commandcode.json"),
join(dir, "commandcode-go-opencode-provider.json"),
].find((p) => existsSync(p));
if (!configPath) return {};
try {
return JSON.parse(readFileSync(configPath, "utf-8"));
} catch {
Expand Down
2 changes: 1 addition & 1 deletion src/costs-models-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export async function fetchModelsDevJson(): Promise<string> {
headers: {
// ponytail: models.dev returns 403 without a browser-like UA; upgrade if they add a real API token
"User-Agent":
"Mozilla/5.0 (compatible; commandcode-go-opencode-provider/0.5; +https://github.com/BrainerVirus/opencode-commandcode-provider)",
"Mozilla/5.0 (compatible; opencode-commandcode/0.5; +https://github.com/BrainerVirus/opencode-commandcode)",
Accept: "application/json",
},
});
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/catalog-break.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ describe("renderCatalogBreakBody", () => {
const body = renderCatalogBreakBody({
commandCodeVersion: "1.39.0",
error: "Could not evaluate model catalog",
workflowUrl: "https://github.com/BrainerVirus/opencode-commandcode-provider/actions/runs/1",
workflowUrl: "https://github.com/BrainerVirus/opencode-commandcode/actions/runs/1",
bundledCommandCodeVersion: "1.38.1",
});
expect(body).toContain("command-code@1.39.0");
expect(body).toContain("Could not evaluate model catalog");
expect(body).toContain(
"https://github.com/BrainerVirus/opencode-commandcode-provider/actions/runs/1",
);
expect(body).toContain("https://github.com/BrainerVirus/opencode-commandcode/actions/runs/1");
expect(body).toContain("1.38.1");
expect(body).toContain("src/catalog.ts");
});
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/release-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const json = <T>(rel: string) => JSON.parse(read(rel)) as T;
const NPMJS = "${{ secrets.NPMJS }}";

describe("package.json publish identity", () => {
test("is the scoped public package on BrainerVirus/opencode-commandcode-provider", () => {
test("is the scoped public package on BrainerVirus/opencode-commandcode", () => {
const pkg = json<{
name: string;
publishConfig?: { access?: string };
Expand All @@ -19,11 +19,11 @@ describe("package.json publish identity", () => {
files?: string[];
scripts?: Record<string, string>;
}>("package.json");
expect(pkg.name).toBe("@brainervirus/commandcode-go-opencode-provider");
expect(pkg.name).toBe("@brainervirus/opencode-commandcode");
expect(pkg.publishConfig?.access).toBe("public");
expect(pkg.repository?.url).toContain("BrainerVirus/opencode-commandcode-provider");
expect(pkg.bugs?.url).toContain("BrainerVirus/opencode-commandcode-provider");
expect(pkg.homepage).toContain("BrainerVirus/opencode-commandcode-provider");
expect(pkg.repository?.url).toContain("BrainerVirus/opencode-commandcode");
expect(pkg.bugs?.url).toContain("BrainerVirus/opencode-commandcode");
expect(pkg.homepage).toContain("BrainerVirus/opencode-commandcode");
expect(pkg.files).toContain("manifest.json");
expect(pkg.scripts?.["verify:release-candidate"]).toContain("verify-release-candidate.ts");
expect(pkg.scripts?.lint).toContain("oxlint --deny-warnings");
Expand Down