44
55<p align =" center " >
66 <a href =" https://www.npmjs.com/package/@otto-assistant/opencode-commandcode " ><img src =" https://img.shields.io/npm/v/%40otto-assistant%2Fopencode-commandcode?style=flat-square&color=7dcea0&labelColor=0c1412&label=npm " alt =" npm version " ></a >
7+ <a href =" https://www.npmjs.com/package/@otto-assistant/opencode-commandcode " ><img src =" https://img.shields.io/npm/dm/%40otto-assistant%2Fopencode-commandcode?style=flat-square&color=7dcea0&labelColor=0c1412 " alt =" npm downloads " ></a >
78 <a href =" LICENSE " ><img src =" https://img.shields.io/badge/license-MIT-7dcea0?style=flat-square&labelColor=0c1412 " alt =" MIT license " ></a >
89 <img src =" https://img.shields.io/badge/linux%20·%20macos%20·%20windows-7dcea0?style=flat-square&labelColor=0c1412 " alt =" linux, macos, windows " >
10+ <a href =" https://github.com/otto-assistant/opencode-commandcode/releases " ><img src =" https://img.shields.io/github/v/release/otto-assistant/opencode-commandcode?style=flat-square&color=e8b86d&labelColor=0c1412&label=release " alt =" latest release " ></a >
911</p >
1012
1113<p align =" center " >
1214 <strong >Command Code inside OpenCode</strong > — Go-plan ($1) browser login,<br >
1315 gateway proxy, free Laguna S 2.1, tools/MCP, attachments, compact, usage.
1416</p >
1517
18+ <p align =" center " >
19+ <a href =" #install " >Install</a > ·
20+ <a href =" #authenticate " >Authenticate</a > ·
21+ <a href =" #why-this-plugin " >Why this plugin</a > ·
22+ <a href =" #architecture " >Architecture</a > ·
23+ <a href =" CHANGELOG.md " >Changelog</a >
24+ </p >
25+
1626---
1727
1828Run [ Command Code] ( https://commandcode.ai ) models from OpenCode by proxying the same gateway that ` npm i -g command-code@latest ` uses (` POST /alpha/generate ` ). Default and exclusive live-test target: ** Laguna S 2.1 free** (` poolside/laguna-s-2.1-free ` , 256k context, $0).
@@ -21,15 +31,18 @@ Plugin shape mirrors [@otto-assistant/opencode-claude](https://github.com/otto-a
2131
2232## Install
2333
34+ ` command-code ` is ** not** a built-in OpenCode provider. Install the plugin first, or
35+ ` opencode auth login --provider command-code ` fails with ` Unknown provider "command-code" ` .
36+
2437``` bash
2538# global (recommended)
2639opencode plugin @otto-assistant/opencode-commandcode -g
2740
28- # or project-local
41+ # or project-local (writes .opencode/opencode.json)
2942opencode plugin @otto-assistant/opencode-commandcode
3043```
3144
32- Optional provider naming:
45+ Optional provider naming (also seeded when the plugin loads) :
3346
3447``` jsonc
3548{
@@ -41,7 +54,7 @@ Optional provider naming:
4154}
4255```
4356
44- From source:
57+ Or build from source:
4558
4659``` bash
4760git clone https://github.com/otto-assistant/opencode-commandcode.git
@@ -52,17 +65,21 @@ opencode plugin file://$PWD
5265
5366## Authenticate
5467
55- Uses the ** Command Code Go plan ($1/mo)** — same browser login as ` cmd login ` . No Studio API key.
68+ Requires the plugin to be installed (see above). Uses the ** Command Code Go plan ($1/mo)** — same browser login as ` cmd login ` . No Studio API key.
5669
5770``` bash
71+ # Option A — sync from Command Code CLI (recommended)
5872npm i -g command-code@latest
5973cmd login # browser → Studio CLI auth (Go plan). Laguna S 2.1 is $0 credits.
74+ opencode auth login --provider command-code
75+ # pick "Use existing cmd login session"
6076
77+ # Option B — browser OAuth (Go $1)
6178opencode auth login --provider command-code
62- # pick "Login with Command Code (Go $1)" — or "Use existing cmd login session"
79+ # pick "Login with Command Code (Go $1)"
6380```
6481
65- Then:
82+ Then start OpenCode, pick provider ** command-code ** , and choose Laguna S 2.1 free :
6683
6784``` bash
6885opencode run " Summarise this repository in five bullets." --model command-code/laguna-s-2.1-free
@@ -74,28 +91,32 @@ Laguna S 2.1 free requires an active Go (or higher) account with credits on file
7491
7592| | |
7693| ---| ---|
77- | ** Gateway proxy** | Talks to ` api.commandcode.ai/alpha/generate ` — same transport as the ` cmd ` CLI. |
78- | ** Laguna S 2.1 free** | 256k context, reasoning, $0 while the deal lasts. |
79- | ** Go-plan auth** | Browser OAuth like ` cmd login ` ($1/mo). Syncs ` ~/.commandcode/auth.json ` . No API key. |
94+ | ** Gateway proxy** | Talks to ` api.commandcode.ai/alpha/generate ` — same transport as the ` cmd ` CLI ( ` mode=agent ` ) . |
95+ | ** Laguna S 2.1 free** | 256k context, reasoning, $0 while the deal lasts. Default aliases resolve here. |
96+ | ** Go-plan auth** | Browser OAuth like ` cmd login ` ($1/mo). Syncs ` ~/.commandcode/auth.json ` . No Studio API key. |
8097| ** Agent-grade tools** | OpenCode tool calls park and resume; MCP-prefixed tools are tracked separately. |
8198| ** Attachments** | Images, PDFs, text/binary files from OpenCode. Text-only models get image placeholders (Command Code behavior). |
82- | ** Compact ** | Context-fraction tips + tiered client compact before the 256k window overflows. |
99+ | ** Auto-compact ** | Context-fraction tips + tiered client compact before the 256k window overflows. |
83100| ** Usage** | Per-turn and session totals via SSE ` usage ` + ` GET /v1/usage ` . |
84101
85102## Architecture
86103
87104``` text
88105OpenCode
89106 └─ /v1/chat/completions
90- └─ Bun.serve proxy (port 8797)
107+ └─ Bun.serve proxy (dynamic port, prefer 8797)
91108 └─ POST https://api.commandcode.ai/alpha/generate
92109 └─ poolside/laguna-s-2.1-free (default)
93110```
94111
112+ Model catalog: aliases ` laguna-s-2.1-free ` / ` laguna ` / ` default ` (and siblings) map to
113+ ` poolside/laguna-s-2.1-free ` . Auth credentials are mirrored between OpenCode ` auth.json `
114+ and ` ~/.commandcode/auth.json ` .
115+
95116## Requirements
96117
97118- [ OpenCode] ( https://opencode.ai )
98- - [ Command Code CLI] ( https://www.npmjs.com/package/command-code ) (` npm i -g command-code@latest ` ) and a free account
119+ - [ Command Code CLI] ( https://www.npmjs.com/package/command-code ) (` npm i -g command-code@latest ` ) and a Go-plan account
99120- Bun (plugin runtime) · Node.js ≥ 18 (CLI needs ≥ 22)
100121
101122## Development
@@ -107,13 +128,45 @@ bun run test # mocked gateway — attachments, tools, compact, usage
107128bun run test:live # live Laguna S 2.1 (needs `cmd login` / Go plan session)
108129```
109130
110- Debug: ` OPENCODE_COMMANDCODE_DEBUG=1 ` .
131+ Debug logging : ` OPENCODE_COMMANDCODE_DEBUG=1 ` .
111132
112133Optional knobs:
113134
114- - ` OPENCODE_COMMANDCODE_PROXY_PORT ` — fixed local proxy port (default ` 8797 ` )
135+ - ` OPENCODE_COMMANDCODE_PROXY_PORT ` — pin a fixed local proxy port (otherwise dynamic: prefer ` 8797 ` , then scan upward / ephemeral )
115136- ` OPENCODE_COMMANDCODE_CWD ` — working directory reported to the gateway
116- - ` COMMANDCODE_API_URL ` — override API base (default ` https://api.commandcode.ai ` )
137+ - ` COMMANDCODE_API_URL ` / ` OPENCODE_COMMANDCODE_API_URL ` — override API base (default ` https://api.commandcode.ai ` )
138+
139+ ## Release
140+
141+ Publish via GitHub Actions → ** Actions → Release → Run workflow** :
142+
143+ | Input | Purpose |
144+ | ---| ---|
145+ | ` version ` | Explicit semver (` 0.2.0 ` ). Empty → use bump |
146+ | ` bump ` | ` minor ` (default) / ` patch ` / ` major ` |
147+ | ` dry_run ` | Skip npm publish; create a draft GitHub release |
148+
149+ Requires repo secrets: ` NPM_TOKEN ` , optional ` DISCORD_WEBHOOK_URL ` .
150+
151+ Local pin refresh after a release:
152+
153+ ``` bash
154+ ./scripts/update-plugin.sh
155+ ```
156+
157+ ## FAQ
158+
159+ ** Do I need a Studio API key?**
160+ No. Use Go-plan browser login (or sync from ` cmd login ` ).
161+
162+ ** Is Laguna free?**
163+ Yes — ` poolside/laguna-s-2.1-free ` is the default free model ($0 while the deal lasts).
164+
165+ ** Why isn’t Command Code listed without the plugin?**
166+ OpenCode doesn’t ship Command Code as a built-in provider; this plugin registers it.
167+
168+ ** Where are releases?**
169+ [ GitHub Releases] ( https://github.com/otto-assistant/opencode-commandcode/releases ) · [ npm] ( https://www.npmjs.com/package/@otto-assistant/opencode-commandcode ) · [ Changelog] ( CHANGELOG.md )
117170
118171## License
119172
0 commit comments