Skip to content

Commit c2bf05f

Browse files
committed
docs: add CHANGELOG, bug-report template, agent sync rules, improved release body
Feat: CHANGELOG.md - Document all features, fixes, and infrastructure changes since the beginning - Covers TUI, proxy, distribution, CI, and fixes Feat: .github/ISSUE_TEMPLATE/bug-report.md - Structured bug report form with environment, logs, and reproduction fields Docs: AGENTS.md - Add Agent Maintenance Rules section - Rules: sync CHANGELOG on every change, sync versioning on release tags, keep AGENTS.md in sync with project state - Add Distribution section (npm tarball, release workflow, tag strategy) - Add CLI Contract section (run, run --server, help) - Update file structure to reflect new files - Update Build & Run for both developer and end-user paths Chore: release.yml - Add link to CHANGELOG.md in release body - Add warning about npm v11 git dep bug
1 parent a6d7fcc commit c2bf05f

4 files changed

Lines changed: 229 additions & 4 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Bug Report
3+
about: Report a problem to help us improve
4+
title: ""
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of what the bug is.
12+
13+
## Steps to Reproduce
14+
15+
1. Run `commandcode-bridge run --server` (or relevant command)
16+
2. ...
17+
3. See error
18+
19+
## Expected Behavior
20+
21+
What you expected to happen.
22+
23+
## Actual Behavior
24+
25+
What actually happened. Include error messages, stack traces, or screenshots if applicable.
26+
27+
## Environment
28+
29+
- **OS**: (e.g. Linux, macOS, Windows)
30+
- **Install method**: npm tarball / build from source
31+
- **Version**: (output of `commandcode-bridge help` first line, or git commit SHA)
32+
- **Node.js version**: (if using npm install)
33+
- **Dart SDK version**: (if building from source)
34+
35+
## Logs
36+
37+
Attach or paste relevant logs from `~/.config/commandcode-bridge/logs.jsonl`:
38+
39+
```
40+
(paste logs here)
41+
```
42+
43+
## Additional Context
44+
45+
Add any other context about the problem here.

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ jobs:
105105
name: ${{ github.ref_name }}
106106
files: commandcode-bridge-*.tgz
107107
body: |
108+
## What's in ${{ github.ref_name }}
109+
110+
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for full details.
111+
108112
## Installation
109113
110114
```bash
@@ -116,6 +120,10 @@ jobs:
116120
commandcode-bridge run --server # Headless server mode
117121
```
118122
123+
### Why not `npm install -g Khip01/commandcode-bridge#${{ github.ref_name }}`?
124+
125+
npm v11 has a bug installing global git deps: the install appears to succeed but the `commandcode-bridge` binary is missing. Always install from a local tarball. See [Git-Based NPM Install/Distribution Workflow](https://opencode.ai) for the full story.
126+
119127
## Requirements
120128
121129
- Node.js 18+ (for the npm launcher)

AGENTS.md

Lines changed: 116 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ Command Code auth is stored at `~/.commandcode/auth.json`. The bridge reads the
1414
- Server: `dart:io` `HttpServer`
1515
- HTTP client: `package:http`
1616
- Compile: `dart compile exe` -> single binary
17+
- Distribution: npm tarball with Node.js launcher wrapper
1718

1819
### File Structure
1920
```
2021
commandcode-bridge/
21-
├── bin/commandcode_bridge.dart # Entry point
22+
├── bin/
23+
│ ├── commandcode_bridge.dart # Entry point
24+
│ └── commandcode-bridge.js # npm wrapper: OS detection + binary spawn
2225
├── lib/
2326
│ ├── commandcode_bridge.dart # Barrel
2427
│ └── src/
25-
│ ├── main.dart # CLI wiring
28+
│ ├── main.dart # CLI wiring (run, run --server, help)
2629
│ ├── models/
2730
│ │ ├── account.dart # Account + config store (port persist)
2831
│ │ └── models_db.dart # 44 models with goAccessible field
@@ -33,15 +36,95 @@ commandcode-bridge/
3336
│ │ └── proxy.dart # OpenAI-compatible proxy
3437
│ └── tui/
3538
│ └── app.dart # Nocterm TUI (9 panels + log + bars)
39+
├── scripts/
40+
│ └── stage-npm-package.mjs # CI packaging helper: assembles release tarball
41+
├── .github/
42+
│ ├── ISSUE_TEMPLATE/
43+
│ │ └── bug-report.md # Bug report template
44+
│ └── 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
3648
├── test/
3749
├── AGENTS.md
50+
├── CHANGELOG.md
3851
├── README.md
52+
├── package.json
3953
├── build / run # Linux/macOS scripts
40-
├── build.bat / run.bat # Windows scripts
54+
├── build.bat / run.bat # Windows batch scripts
4155
├── LICENSE
4256
└── pubspec.yaml
4357
```
4458

59+
### CLI Contract
60+
61+
```bash
62+
commandcode-bridge run Start the bridge in TUI mode
63+
commandcode-bridge run --server Start the bridge in headless server mode
64+
commandcode-bridge help Show this help screen
65+
commandcode-bridge (no args) Show this help screen
66+
commandcode-bridge <invalid> Show help screen, exit 1
67+
```
68+
69+
The npm wrapper (`bin/commandcode-bridge.js`) detects `process.platform`, maps to the correct native binary (`app-linux`, `app-mac`, `app-win.exe`), and spawns it with `stdio: 'inherit'`. All args are forwarded. Once launched, Node.js goes idle and the Dart binary takes full control.
70+
71+
## Distribution
72+
73+
### End-user install
74+
75+
Users install from a `.tgz` asset attached to a GitHub Release:
76+
77+
```bash
78+
npm install -g ./commandcode-bridge-vX.Y.Z.tgz
79+
commandcode-bridge run
80+
```
81+
82+
Requirements: Node.js 18+ (for the npm launcher), a Command Code account.
83+
84+
No Dart SDK needed for end-users.
85+
86+
### Release workflow
87+
88+
Triggered by pushing a tag matching `v*` or `[0-9]*`:
89+
90+
1. **Build matrix** (3 OS):
91+
- ubuntu-latest -> `app-linux`
92+
- macos-latest -> `app-mac`
93+
- windows-latest -> `app-win.exe`
94+
- Each: `dart compile exe` + upload artifact
95+
2. **Package job** (ubuntu-latest, stable releases only):
96+
- Download 3 binary artifacts
97+
- Run `scripts/stage-npm-package.mjs` which assembles the npm package folder
98+
- Run `npm pack` to produce `commandcode-bridge-vX.Y.Z.tgz`
99+
- Upload tarball artifact
100+
3. **Release job** (stable releases only):
101+
- Create GitHub Release with the tarball asset
102+
103+
Stable releases exclude tags with `-rc`, `-beta`, `-alpha`. Prerelease tags produce binaries but skip packaging and release jobs.
104+
105+
### Post-release validation
106+
107+
Triggered by `release: published` or manual dispatch:
108+
109+
1. Download the real published tarball from GitHub Releases
110+
2. Install to isolated npm prefix
111+
3. Verify `commandcode-bridge` command exists
112+
4. Smoke test headless mode (`commandcode-bridge run --server`)
113+
5. Uninstall
114+
115+
### Tag strategy
116+
117+
| Pattern | Type | Release behavior |
118+
|---------|------|------------------|
119+
| `v1.0.0` | Stable | Full build + package + GitHub Release |
120+
| `v1.0.1-rc1` | Prerelease | Build binaries only, no packaging or release |
121+
| `v1.0.1-beta1` | Prerelease | Build binaries only, no packaging or release |
122+
| `v1.0.1-alpha1` | Prerelease | Build binaries only, no packaging or release |
123+
124+
### Why npm tarball instead of `npm install -g <git-url>`?
125+
126+
npm v11 has a bug installing global git deps: the install appears to succeed (`added 1 package`) but the binary is missing. Always install from a local tarball. This pattern matches the approach used by `opencode-rich-presence`.
127+
45128
## Platform Support
46129

47130
| Platform | Status | Clipboard | Build |
@@ -173,14 +256,43 @@ Visualization uses `ProgressBar` from nocterm with color-coded fill:
173256

174257
## Build & Run
175258

259+
### Developer (from source)
260+
176261
```bash
177262
# Linux / macOS
178-
./build # Compile single binary
263+
./build # dart pub get + dart compile exe
179264
./run # TUI mode (proxy auto-starts at 17077)
180265
./run server # Headless server mode
266+
./run help # Show help
181267

182268
# Windows
183269
build.bat # Compile
184270
run.bat # Run TUI
185271
run.bat server # Headless server mode
186272
```
273+
274+
### End-user (from npm tarball)
275+
276+
```bash
277+
npm install -g ./commandcode-bridge-vX.Y.Z.tgz
278+
commandcode-bridge run # TUI mode
279+
commandcode-bridge run --server # Headless server mode
280+
commandcode-bridge help # Show help
281+
```
282+
283+
## Changelog
284+
285+
This project maintains a `CHANGELOG.md` file. Release bodies include a short summary with a link to the changelog for full details.
286+
287+
## Agent Maintenance Rules
288+
289+
When making changes to this project, the AI agent must:
290+
291+
1. **Sync CHANGELOG.md for every functional change.** Any feature, fix, or infrastructure change that affects end-users or developers must be recorded in CHANGELOG.md before the commit. This includes TUI changes, proxy fixes, infrastructure workflows, distribution changes, and documentation updates.
292+
293+
2. **Sync versioning in release body when creating a release tag.** Before pushing a tag (stable, rc, beta, or alpha), verify that:
294+
- The CHANGELOG.md has an entry for the new version
295+
- The `package.json` version reflects the tag version (for stable releases)
296+
- The release body in the workflow (`.github/workflows/release.yml`) generates accurate notes with the correct tag reference
297+
298+
3. **Keep AGENTS.md in sync with the actual project state.** When adding new files, changing the CLI contract, or altering the build/distribution process, update the relevant sections in AGENTS.md in the same commit.

CHANGELOG.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## v1.0.0 (2026-07-27)
6+
7+
Initial stable release of CommandCode Bridge, a single-account proxy bridge for Command Code CLI with TUI dashboard.
8+
9+
### Features
10+
11+
- TUI dashboard with 6 info pages (account, plan, usage, rate limits, models, proxy config)
12+
- Progress bars for credit usage, billing period, success rate, token ratios, rate limits
13+
- Plan-aware model sorting (Go = opensource first, Pro+ = premium first)
14+
- OpenAI-compatible HTTP proxy (`/v1/chat/completions`, `/v1/models`, `/v1/health`, `/v1/token`, `/v1/info`)
15+
- Real-time log sidebar with fullscreen mode
16+
- Port configuration panel with availability scan (persisted across restarts)
17+
- Clipboard integration for endpoint URL and model codenames
18+
- Color-coded notification system (success, info, warning, error)
19+
- Cross-platform support: Linux (primary), macOS (experimental), Windows (experimental)
20+
21+
### Proxy
22+
23+
- Full OpenAI-compatible chat completions (streaming + non-streaming)
24+
- Mapping of system, tool, and assistant messages to Command Code wire format
25+
- Tool-call round-trip support (assistant tool calls -> tool results)
26+
- Completion token translation (`max_tokens` / `max_completion_tokens`)
27+
- Correct UTF-8 multi-byte character handling in streaming responses
28+
- `finish_reason` override to `"tool_calls"` when tool calls present
29+
30+
### TUI
31+
32+
- Auto-refresh active page with background refresh
33+
- Header displaying last-used model, updateable in real-time
34+
- Relative time display on billing period and reset countdowns
35+
- Log panel toggle (`Ctrl+L`) with half-screen width
36+
- 44 models with plan-coded access display (green accessible, grey blocked)
37+
- Scrollable model list with Enter-to-copy
38+
39+
### Distribution
40+
41+
- npm tarball packaging with native Dart binary
42+
- Cross-platform binary compilation (Linux, macOS, Windows)
43+
- Zero overhead Node.js launcher (`commandcode-bridge` command)
44+
- No Dart SDK required for end-users
45+
- GitHub Actions CI/CD: test, release, and post-release validation workflows
46+
47+
### Fixes
48+
49+
- Signal handling: SIGINT/SIGTERM properly captured in headless server mode
50+
- UTF-8 chunk boundary decoding: no more `FormatException` on multi-byte sequences
51+
- Non-streaming chunk-boundary leftover handling
52+
- Tool-call preservation across subsequent tool-result turns
53+
- Log ordering: newest entries displayed at top
54+
55+
### Infrastructure
56+
57+
- GitHub Actions matrix build across 3 platforms
58+
- Automated tarball packaging via `npm pack`
59+
- Post-release user simulation (install, smoke test, uninstall)
60+
- Bug report issue template

0 commit comments

Comments
 (0)