Skip to content

Commit d22ac34

Browse files
committed
chore: bump to 1.2.0 and sync release docs
Chore: version - Bump package.json, pubspec.yaml, version.dart to 1.2.0 Chore: docs - README: cost-sync feature, 7 info pages, new tgz filename - docs/TUI.md: page 7, key bindings, cost sync section - docs/ARCHITECTURE.md: cost_sync and pricing_db services, cost sync flow - docs/INSTALL.md and API-REFERENCE.md: cost-sync usage See CHANGELOG.md for full details.
1 parent b9af9ce commit d22ac34

8 files changed

Lines changed: 78 additions & 10 deletions

File tree

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ APIs for use with OpenCode, Zed, Cursor, or any compatible client.
1313

1414
- **OpenAI Compatible**`/v1/chat/completions` endpoint, streaming + non-streaming
1515
- **Anthropic Compatible**`/v1/messages` endpoint with full SSE streaming
16-
- **TUI Dashboard**6 info pages with progress bars and real-time log
16+
- **TUI Dashboard**7 info pages with progress bars and real-time log
1717
- **Plan-Aware** — Models sorted by plan access level
18+
- **Cost Sync** — Sync Command Code model pricing to CLI agent configs (OpenCode, Aider, Goose)
1819
- **Port Config** — Change port via TUI with availability scan, persisted across restarts
1920
- **Cross-platform** — Linux (primary), macOS/Windows (experimental)
2021

2122
## Quick Install
2223

2324
```
24-
npm install -g ./commandcode-bridge-v1.1.1.tgz
25+
npm install -g ./commandcode-bridge-v1.2.0.tgz
2526
commandcode-bridge run
2627
```
2728

@@ -31,13 +32,19 @@ Update when a new release is available:
3132
commandcode-bridge update
3233
```
3334

35+
Sync model pricing to your CLI agents (OpenCode, Aider, Goose):
36+
37+
```
38+
commandcode-bridge cost-sync
39+
```
40+
3441
Requirements: Node.js 18+, a Command Code account.
3542

3643
## Documentation
3744

3845
- [Installation](docs/INSTALL.md) — install options, prerequisites, platform support
3946
- [API Reference](docs/API-REFERENCE.md) — proxy endpoints, client configs (OpenCode, Zed, Cursor)
40-
- [TUI](docs/TUI.md) — pages, key bindings, plan access, port config
47+
- [TUI](docs/TUI.md) — pages, key bindings, plan access, port config, cost sync
4148
- [Architecture](docs/ARCHITECTURE.md) — file structure, proxy flow, protocol translation
4249
- [Changelog](CHANGELOG.md) — release history
4350

docs/API-REFERENCE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,16 @@ The API key must be entered through **Agent Settings** (`agent: open settings` -
100100
After saving, open Agent Settings, find the provider, enter any API key
101101
(the bridge uses your saved Command Code auth, the value does not matter),
102102
and the model will appear in the model dropdown.
103+
104+
## Cost Tracking
105+
106+
To make your CLI agent report real Command Code costs, run:
107+
108+
```bash
109+
commandcode-bridge cost-sync
110+
```
111+
112+
or press `[c]` on the Cost Sync page in the TUI. This writes per-model cost
113+
fields (input, output, cache_read per 1M tokens) into your agent configs.
114+
The pricing table is validated against the live bridge `/v1/models` endpoint
115+
before syncing.

docs/ARCHITECTURE.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,23 @@ commandcode-bridge/
1919
├── lib/
2020
│ ├── commandcode_bridge.dart # Barrel export
2121
│ └── src/
22-
│ ├── main.dart # CLI wiring (TUI / server modes)
22+
│ ├── main.dart # CLI wiring (TUI / server / cost-sync modes)
2323
│ ├── models/
2424
│ │ ├── account.dart # Account + config store (port persist)
2525
│ │ ├── models_db.dart # 44 models with plan access metadata
2626
│ │ └── version.dart # Bridge version constant
2727
│ ├── services/
2828
│ │ ├── api_client.dart # HTTP client for api.commandcode.ai
29+
│ │ ├── cost_sync.dart # Cost sync: detect agents, update configs
2930
│ │ ├── log_store.dart # JSONL activity log (2000 entries max)
31+
│ │ ├── pricing_db.dart # Hardcoded pricing table (44 models)
3032
│ │ └── updater.dart # Self-update: API cache + download .tgz + npm install -g
3133
│ ├── server/
3234
│ │ ├── server_controller.dart # HTTP server, routing, shared endpoints
3335
│ │ ├── openai_handler.dart # OpenAI-compatible proxy
3436
│ │ └── anthropic_handler.dart # Anthropic-compatible proxy
3537
│ └── tui/
36-
│ └── app.dart # Nocterm TUI (9 panels + log sidebar)
38+
│ └── app.dart # Nocterm TUI (10 panels + log sidebar)
3739
├── scripts/
3840
│ └── stage-npm-package.mjs # CI packaging helper
3941
├── docs/
@@ -61,6 +63,21 @@ Client <- OpenAI SSE / Anthropic SSE
6163
Client -> POST /v1/messages -> Same flow, Anthropic format
6264
```
6365

66+
## Cost Sync
67+
68+
The `cost-sync` CLI command and TUI page 7 keep CLI agent cost tracking in
69+
sync with Command Code pricing.
70+
71+
- `pricing_db.dart` holds a hardcoded pricing table (44 models) matching the
72+
live bridge `/v1/models` API
73+
- `cost_sync.dart` detects installed CLI agents (OpenCode, Aider, Goose),
74+
reads each agent's configured models, and writes per-model cost fields
75+
(input, output, cache_read per 1M tokens)
76+
- Only providers that point at the bridge (localhost base URL) and are named
77+
"Command Code" are considered bridge providers; all are listed
78+
- Pricing is validated against the live `/v1/models` endpoint before syncing
79+
- OpenCode configs (JSONC) are parsed with comment and trailing-comma support
80+
6481
## Protocol Translation
6582

6683
### OpenAI Compatible

docs/INSTALL.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ The update command fetches the latest release tag from GitHub API, downloads the
2222
call is cached locally for 1 hour to avoid rate limits. A restart is required
2323
after updating.
2424

25+
## Syncing Model Pricing
26+
27+
Sync Command Code pricing into your CLI agent configs (OpenCode, Aider, Goose):
28+
29+
```bash
30+
commandcode-bridge cost-sync
31+
```
32+
33+
Or use the TUI Cost Sync page (`[7]` in the dashboard). Pricing is validated
34+
against the live bridge `/v1/models` before anything is written.
35+
2536
## Build from Source
2637

2738
```bash

docs/TUI.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@
1010
| `4` | Rate Limits | `/alpha/billing/credits` | 5-hour and weekly usage bars with exceed warnings |
1111
| `5` | Models | 44 models sorted by plan access | Scrollable list, Enter to copy codename |
1212
| `6` | Proxy Config | Bridge state | Port, API URL, endpoints, uptime |
13+
| `7` | Cost Sync | Local CLI agent configs | Detected agents, provider list, model pricing, sync status |
1314

1415
## Key Bindings
1516

1617
| Key | Context | Action |
1718
|-----|---------|--------|
18-
| `1-6` | Always | Switch info page |
19+
| `1-7` | Always | Switch info page |
1920
| `r` | Always | Refresh all API data |
2021
| `o` | Always | Copy OpenAI endpoint URL to clipboard |
2122
| `a` | Always | Copy Anthropic URL to clipboard |
2223
| `p` | Always | Configure proxy port (with availability scan) |
2324
| `h` | Always | Open help |
2425
| `q` | Always | Quit (with confirmation) |
2526
| `Ctrl+C` | Always | Status bar hint (use [q] to quit) |
26-
| `up/down` | Main | Scroll content / navigate models |
27+
| `up/down` | Main | Scroll content / navigate models / select cost sync agent |
2728
| `PgUp/PgDn` | Main | Scroll 10 lines |
2829
| `Enter` | Models page | Copy selected model codename to clipboard |
30+
| `c` | Cost Sync page | Sync model pricing to selected agent |
2931
| `Ctrl+L` | Always | Toggle log sidebar |
3032
| `f` | Log open | Toggle log fullscreen / sidebar |
3133
| `Shift+C` | Log open | Clear all logs (with Y/N confirmation) |
@@ -77,6 +79,24 @@ Models in page 5 are prioritized by your plan:
7779
- Meta Muse Spark 1.1
7880
- Nvidia Nemotron 3 Ultra
7981

82+
## Cost Sync (Page 7)
83+
84+
Syncs Command Code model pricing into your CLI agent configs so that
85+
agent-side cost tracking shows real per-token rates.
86+
87+
- `[7]` opens the Cost Sync page
88+
- `[c]` syncs pricing for the selected agent (hint shown on the page)
89+
- `[up/down]` selects the agent (OpenCode, Aider, Goose)
90+
- Detected agents are listed with their config paths
91+
- Bridge providers are listed by name and endpoint, for example
92+
`Khip01 - Command Code (Go Plan) [127.0.0.1:17077]`
93+
- All Command Code models with pricing are shown, grouped by Open Source and Premium
94+
- Models in your config appear bright white with "(will be implemented)"
95+
- Models not in your config are greyed out
96+
- Pricing is validated against the live bridge `/v1/models` before syncing
97+
98+
The equivalent CLI command is `commandcode-bridge cost-sync`.
99+
80100
## Authentication
81101

82102
The bridge reads credentials from `~/.commandcode/auth.json` (created by `cmd login`).

lib/src/models/version.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const bridgeVersion = '1.1.1';
1+
const bridgeVersion = '1.2.0';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "commandcode-bridge",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "Command Code single-account proxy bridge with TUI dashboard. OpenAI-compatible endpoint for OpenCode, Cursor, etc.",
55
"type": "module",
66
"bin": {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: commandcode_bridge
22
description: Command Code single-account proxy bridge with OpenAI-compatible endpoint
3-
version: 1.1.1
3+
version: 1.2.0
44

55
environment:
66
sdk: ^3.10.8

0 commit comments

Comments
 (0)