feat(bar): support --port for ccs bar with sticky port persistence

ccs bar always forced the dashboard onto port 3000 (first free of a
hardcoded candidate list), which collides with other local dev servers, and
bar.json was rewritten to 3000 on every launch.

- `ccs bar [launch] --port N` runs the server on exactly N: reuses a live
  server already on N, moves a running server from another port (SIGTERM via
  server.pid, wait for exit), errors clearly when N is busy or the value is
  invalid.
- The chosen port is persisted into launch.json args, so the Swift app
  self-starts the server on the same port.
- Without --port, launch and serve now try the port recorded in bar.json
  first (sticky), so the server keeps coming back on the port the user last
  chose instead of reverting to 3000.
- Bare flags (`ccs bar --port N`) route to the launch subcommand; --port is
  documented in `ccs bar --help`.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
poomscandClaude Fable 5 committed 2026-08-08 14:09:58 +07:00
1 parent 7fb56d62e1
commit 34608ce291
9 files changed
+358 -54

No files matched your search

+7 -7
View File
@@ -1,9 +1,9 @@
{
"scope": "src/**/*.{ts,tsx,js,jsx,mjs,cjs}",
"syncFs": {
"totalOccurrences": 2427,
"totalOccurrences": 2429,
"filesAffected": 258,
"hotpathOccurrences": 1142,
"hotpathOccurrences": 1144,
"hotpathFilesAffected": 152,
"topHotpathFiles": [
{
@@ -579,8 +579,8 @@
},
"loggerCoverage": {
"filesWithCreateLogger": 65,
"totalSourceFiles": 759,
"coverageRatio": 0.0856,
"totalSourceFiles": 760,
"coverageRatio": 0.0855,
"subdomainsWithZeroCreateLogger": [
"api",
"bin",
@@ -606,7 +606,7 @@
},
{
"subdomain": "commands",
"count": 108,
"count": 109,
"withLogger": 2
},
{
@@ -652,8 +652,8 @@
]
},
"hotpathConsoleErrors": {
"totalOccurrences": 571,
"exemptOccurrences": 305,
"totalOccurrences": 576,
"exemptOccurrences": 310,
"hotpathOccurrences": 266,
"filesAffected": 82,
"topFiles": [
+4 -4
View File
@@ -6,9 +6,9 @@ Scope: `src/**/*.{ts,tsx,js,jsx,mjs,cjs}`
| Metric | Value |
|---|---:|
| Sync fs occurrences (all) | 2427 |
| Sync fs occurrences (all) | 2429 |
| Sync fs files affected (all) | 258 |
| Sync fs occurrences (runtime hotpaths) | 1142 |
| Sync fs occurrences (runtime hotpaths) | 1144 |
| Sync fs files affected (runtime hotpaths) | 152 |
| Legacy shim markers | 458 |
| Legacy shim files affected | 173 |
@@ -58,9 +58,9 @@ Scope: `src/**/*.{ts,tsx,js,jsx,mjs,cjs}`
|---|---:|
| typed-error adoption (typed/total throws) | 17.7% (80/452) |
| typed-error adoption (P4 locked subdomains) | 93.3% (28/30), target 40% |
| hotpath console.error/warn occurrences | 266 (571 total, 305 CLI-UX exempt) |
| hotpath console.error/warn occurrences | 266 (576 total, 310 CLI-UX exempt) |
| hotpath console.error/warn files | 82 |
| files with createLogger | 65/759 |
| files with createLogger | 65/760 |
| subdomains with zero createLogger | 15 (api, bin, channels, cliproxy, cliproxy/accounts, cliproxy/ai-providers, cliproxy/binary, cliproxy/config, cliproxy/management, cliproxy/sync, cliproxy/types, config, dispatcher, shared, types) |
| files > 400 LOC | 91 |
| files > 600 LOC | 42 |