|
1 | 1 | # CommandCode Bridge |
2 | 2 |
|
3 | | -Single-account proxy bridge for Command Code CLI (`cmd` from `commandcode.ai`). TUI dashboard with progress bars + OpenAI-compatible HTTP proxy. |
| 3 | +Single-account proxy bridge for Command Code CLI (`cmd` from `commandcode.ai`). |
| 4 | +TUI dashboard with progress bars + OpenAI-compatible and Anthropic-compatible HTTP proxy. |
4 | 5 |
|
5 | 6 | ## Auth |
6 | 7 |
|
7 | | -Command Code auth is stored at `~/.commandcode/auth.json`. The bridge reads the API key from this file. Run `cmd login` to authenticate first. You can also press `[l]` in the bridge TUI for login instructions. |
| 8 | +Command Code auth is stored at `~/.commandcode/auth.json`. The bridge reads the |
| 9 | +API key from this file. Run `cmd login` to authenticate first. You can also |
| 10 | +press `[l]` in the bridge TUI for login instructions. |
8 | 11 |
|
9 | 12 | ## Architecture |
10 | 13 |
|
11 | 14 | ### Stack |
12 | 15 | - Language: Dart 3.10+ |
13 | 16 | - TUI: `nocterm` v0.8.0 (ProgressBar for visualizations) |
14 | 17 | - Server: `dart:io` `HttpServer` |
15 | | -- HTTP client: `package:http` |
| 18 | +- HTTP client: `dart:io` `HttpClient` |
16 | 19 | - Compile: `dart compile exe` -> single binary |
17 | 20 | - Distribution: npm tarball with Node.js launcher wrapper |
18 | 21 |
|
19 | 22 | ### File Structure |
20 | 23 | ``` |
21 | 24 | commandcode-bridge/ |
22 | 25 | ├── bin/ |
23 | | -│ ├── commandcode_bridge.dart # Entry point |
24 | | -│ └── commandcode-bridge.js # npm wrapper: OS detection + binary spawn |
| 26 | +│ ├── commandcode_bridge.dart # Entry point |
| 27 | +│ └── commandcode-bridge.js # npm wrapper: OS detection + binary spawn |
25 | 28 | ├── lib/ |
26 | | -│ ├── commandcode_bridge.dart # Barrel |
| 29 | +│ ├── commandcode_bridge.dart # Barrel |
27 | 30 | │ └── src/ |
28 | | -│ ├── main.dart # CLI wiring (run, run --server, help) |
| 31 | +│ ├── main.dart # CLI wiring (run, run --server, help) |
29 | 32 | │ ├── models/ |
30 | | -│ │ ├── account.dart # Account + config store (port persist) |
31 | | -│ │ └── models_db.dart # 44 models with goAccessible field |
| 33 | +│ │ ├── account.dart # Account + config store (port persist) |
| 34 | +│ │ └── models_db.dart # 44 models with goAccessible field |
32 | 35 | │ ├── services/ |
33 | | -│ │ ├── api_client.dart # HTTP client for api.commandcode.ai |
34 | | -│ │ └── log_store.dart # JSONL activity log (2000 entries) |
| 36 | +│ │ ├── api_client.dart # HTTP client for api.commandcode.ai |
| 37 | +│ │ └── log_store.dart # JSONL activity log (2000 entries) |
35 | 38 | │ ├── server/ |
36 | | -│ │ └── proxy.dart # OpenAI-compatible proxy |
| 39 | +│ │ ├── server_controller.dart # HTTP server + routing |
| 40 | +│ │ ├── openai_handler.dart # OpenAI-compatible proxy |
| 41 | +│ │ └── anthropic_handler.dart # Anthropic-compatible proxy |
37 | 42 | │ └── tui/ |
38 | | -│ └── app.dart # Nocterm TUI (9 panels + log + bars) |
| 43 | +│ └── app.dart # Nocterm TUI (9 panels + log + bars) |
| 44 | +├── docs/ |
| 45 | +│ ├── INSTALL.md # Install options, platform support |
| 46 | +│ ├── API-REFERENCE.md # Proxy endpoints, client configs |
| 47 | +│ ├── TUI.md # TUI pages, key bindings, plan access |
| 48 | +│ └── ARCHITECTURE.md # File structure, proxy flow, protocol translation |
39 | 49 | ├── scripts/ |
40 | | -│ └── stage-npm-package.mjs # CI packaging helper: assembles release tarball |
| 50 | +│ └── stage-npm-package.mjs # CI packaging helper: assembles release tarball |
41 | 51 | ├── .github/ |
42 | 52 | │ ├── ISSUE_TEMPLATE/ |
43 | | -│ │ └── bug-report.md # Bug report template |
| 53 | +│ │ └── bug-report.md # Bug report template |
44 | 54 | │ └── workflows/ |
45 | | -│ ├── test.yml # Dart analyze + test + smoke |
46 | | -│ ├── release.yml # Matrix build + tarball + GitHub release |
47 | | -│ └── post-release.yml # Install simulation from real asset |
| 55 | +│ ├── test.yml # Dart analyze + test + smoke |
| 56 | +│ ├── release.yml # Matrix build + tarball + GitHub release |
| 57 | +│ └── post-release.yml # Install simulation from real asset |
48 | 58 | ├── test/ |
49 | 59 | ├── AGENTS.md |
50 | 60 | ├── CHANGELOG.md |
@@ -147,31 +157,52 @@ npm v11 has a bug installing global git deps: the install appears to succeed (`a |
147 | 157 |
|
148 | 158 | | Path | Method | Description | |
149 | 159 | |------|--------|-------------| |
150 | | -| `/v1/chat/completions` | POST | OpenAI-compatible chat (stream + non-stream) | |
| 160 | +| `/v1/chat/completions` | POST | OpenAI-compatible chat completions | |
| 161 | +| `/v1/messages` | POST | Anthropic-compatible Messages API | |
| 162 | +| `/messages` | POST | Anthropic-compatible Messages API (alt path) | |
151 | 163 | | `/v1/models` | GET | List 44 available models | |
152 | 164 | | `/v1/health` | GET | Health check | |
153 | 165 | | `/v1/token` | GET | Get access token | |
154 | 166 | | `/v1/info` | GET | Bridge info + config | |
155 | 167 |
|
156 | 168 | ## OpenCode Configuration |
157 | 169 |
|
| 170 | +### OpenAI Compatible |
| 171 | + |
158 | 172 | ```jsonc |
159 | | -"CommandCode": { |
| 173 | +"Khip01 - Command Code": { |
160 | 174 | "name": "Command Code", |
161 | 175 | "options": { |
162 | 176 | "baseURL": "http://127.0.0.1:17077/v1", |
163 | 177 | "apiKey": "anything" |
164 | 178 | }, |
165 | 179 | "models": { |
166 | | - "deepseek/deepseek-v4-flash": { |
167 | | - "name": "DeepSeek V4 Flash", |
| 180 | + "deepseek/deepseek-v4-pro": { |
| 181 | + "name": "DeepSeek V4 Pro", |
| 182 | + "tool_call": true, |
| 183 | + "reasoning": true, |
| 184 | + "limit": { "context": 1048576, "input": 1048576, "output": 8192 } |
| 185 | + } |
| 186 | + } |
| 187 | +} |
| 188 | +``` |
| 189 | + |
| 190 | +### Anthropic Compatible |
| 191 | + |
| 192 | +```jsonc |
| 193 | +"Khip01 - Command Code Anthropic": { |
| 194 | + "npm": "@ai-sdk/anthropic", |
| 195 | + "name": "Command Code Anthropic", |
| 196 | + "options": { |
| 197 | + "baseURL": "http://127.0.0.1:17077/v1", |
| 198 | + "apiKey": "anything" |
| 199 | + }, |
| 200 | + "models": { |
| 201 | + "deepseek/deepseek-v4-pro": { |
| 202 | + "name": "DeepSeek V4 Pro", |
168 | 203 | "tool_call": true, |
169 | 204 | "reasoning": true, |
170 | | - "limit": { |
171 | | - "context": 1000000, |
172 | | - "input": 1000000, |
173 | | - "output": 8000 |
174 | | - } |
| 205 | + "limit": { "context": 1048576, "input": 1048576, "output": 8192 } |
175 | 206 | } |
176 | 207 | } |
177 | 208 | } |
|
0 commit comments