ccgauge 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +33 -33
- package/.next/standalone/.next/app-path-routes-manifest.json +9 -9
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page.js +2 -2
- package/.next/standalone/.next/server/app/api/projects/route.js +1 -1
- package/.next/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/route.js +1 -1
- package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/usage/route.js +1 -1
- package/.next/standalone/.next/server/app/api/usage/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/models/page.js +2 -2
- package/.next/standalone/.next/server/app/models/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page.js +2 -2
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/[id]/page.js +2 -2
- package/.next/standalone/.next/server/app/projects/[id]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/sessions/[id]/page.js +2 -2
- package/.next/standalone/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/sessions/page.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page.js +1 -1
- package/.next/standalone/.next/server/app/usage/page.js +3 -3
- package/.next/standalone/.next/server/app/usage/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +9 -9
- package/.next/standalone/.next/server/chunks/287.js +1 -0
- package/.next/standalone/.next/server/chunks/567.js +2 -2
- package/.next/standalone/.next/server/chunks/730.js +1 -0
- package/.next/standalone/.next/server/functions-config-manifest.json +2 -2
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/node_modules/next/node_modules/postcss/package.json +0 -0
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/public/codex-logo.png +0 -0
- package/CHANGELOG.md +223 -0
- package/README.md +6 -2
- package/README.zh-CN.md +6 -2
- package/bin/cli.mjs +394 -91
- package/dist/mcp/server.mjs +16 -16
- package/dist/report/index.mjs +183 -28
- package/package.json +22 -24
- package/.next/standalone/.next/server/chunks/971.js +0 -1
- /package/.next/standalone/.next/static/{ir1LZCnQKkiNUVXLprtzh → kdpS1dOlXPsnKYuNBuMt9}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{ir1LZCnQKkiNUVXLprtzh → kdpS1dOlXPsnKYuNBuMt9}/_ssgManifest.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,227 @@ All notable changes to **ccgauge** are documented here.
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
6
6
|
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.5] — 2026-05-19
|
|
9
|
+
|
|
10
|
+
CLI ergonomics overhaul + a brand-new `turns` / `conversations`
|
|
11
|
+
metric exposed in MCP and CLI report. Plus one P1 fix that resurrected
|
|
12
|
+
`ccgauge mcp` (silently exiting since 1.0.3's in-process refactor).
|
|
13
|
+
|
|
14
|
+
### Highlights
|
|
15
|
+
|
|
16
|
+
- **`turns` / "Conversations" metric** added to MCP responses and CLI
|
|
17
|
+
report. A turn is one user prompt — the same unit the dashboard's
|
|
18
|
+
usage table rows, and `usage trend → Conversations` toggle, already
|
|
19
|
+
count. A single turn typically fans out to 10–20× more `requests`
|
|
20
|
+
via tool loops, reasoning steps, and sub-agents, so `turns` is the
|
|
21
|
+
better signal for "how often did I actually talk to the model".
|
|
22
|
+
All three surfaces now share `lib/turns.ts → summarizeTurns()`.
|
|
23
|
+
- **15+ CLI fixes + UX polish** — `ccgauge -r 7d` now produces a
|
|
24
|
+
helpful root error instead of `start: unknown option`; bare
|
|
25
|
+
`ccgauge` is the documented shortcut for `ccgauge start` again;
|
|
26
|
+
`ccgauge status` returns systemd-style exit 3 when not running;
|
|
27
|
+
`ccgauge stop` no longer kills unrelated processes after a reboot
|
|
28
|
+
(PID identity is verified); `ccgauge logs -f` no longer
|
|
29
|
+
duplicates lines under heavy write rates; foreground server starts
|
|
30
|
+
via `spawn` (matches background path); and a dozen smaller things.
|
|
31
|
+
- **New `ccgauge doctor` command** — one-screen diagnostic dumping
|
|
32
|
+
version, environment, build artifacts, background-service state,
|
|
33
|
+
and per-provider scan stats. The recommended first step for any
|
|
34
|
+
bug report.
|
|
35
|
+
- **P1 fix: `ccgauge mcp` now stays alive.** 1.0.3 refactored the
|
|
36
|
+
subcommand to run in-process via `await import()`, but a stray
|
|
37
|
+
`process.exit(0)` after `runStdioServer()` killed the process right
|
|
38
|
+
after the JSON-RPC transport opened, before any LLM client could
|
|
39
|
+
finish `initialize`. The smoke test now drives `node bin/cli.mjs
|
|
40
|
+
mcp` directly so this CLI-wrapper layer can never regress silently
|
|
41
|
+
again.
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- **`ccgauge doctor`** — single-shot diagnostic command. Prints
|
|
46
|
+
ccgauge version + node / platform, ccgauge-relevant env vars
|
|
47
|
+
(`CCGAUGE_*`, `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, `NO_COLOR`,
|
|
48
|
+
`FORCE_COLOR`), build-artifact presence, background-service state,
|
|
49
|
+
and the indexer probe from `ccgauge mcp --check`. Plain text so
|
|
50
|
+
it pastes into a GitHub issue cleanly.
|
|
51
|
+
- **MCP `turns` field** in every analytical tool's response shape:
|
|
52
|
+
- `usage_summary` — `totals.turns`, `bySource.{claude,codex}.turns`.
|
|
53
|
+
- `usage_by_time` — `buckets[i].totals.turns` and per-source
|
|
54
|
+
breakdown; turns attribute to the bucket of their **earliest**
|
|
55
|
+
record (same convention as the dashboard's overview chart).
|
|
56
|
+
- `usage_by_model` — `models[i].turns` (turn is counted under
|
|
57
|
+
the model of its first record; sums across models equal the
|
|
58
|
+
scope's `totals.turns`).
|
|
59
|
+
- `usage_by_project` — `projects[i].turns` (by turn's first cwd).
|
|
60
|
+
- `usage_by_session` — `sessions[i].turns` (one session can hold
|
|
61
|
+
many turns; CLI users / LLMs comparing "long session vs many
|
|
62
|
+
short sessions" finally have the right number).
|
|
63
|
+
- `daily_summary`, `weekly_summary`, `recent_activity` — same
|
|
64
|
+
fields flow through their nested totals / per_day / sessions.
|
|
65
|
+
- `cost_estimator` is unchanged (pure pricing, no turn concept).
|
|
66
|
+
- **CLI report `Convos` field** in `ccgauge report` output:
|
|
67
|
+
- **Tokens section** gets a new `Convos / Requests` line, so the
|
|
68
|
+
two activity counts read side-by-side.
|
|
69
|
+
- **Top-N breakdown table** (model / project / session) gets a
|
|
70
|
+
new `Convos` column between the dimension label and `Reqs`.
|
|
71
|
+
- JSON output (`--json`) carries `totals.turns`, `trend[i].turns`,
|
|
72
|
+
`breakdown[i].turns`.
|
|
73
|
+
- **`lib/turns.ts → summarizeTurns()`** helper — given a (filtered)
|
|
74
|
+
record slice plus the full user / parent context, returns one
|
|
75
|
+
`TurnSummary` per distinct turn root with its `firstTimestamp`,
|
|
76
|
+
`firstModel`, `cwd`, `sessionId`, `source`. The single source of
|
|
77
|
+
truth shared by dashboard / MCP / CLI report.
|
|
78
|
+
- **`SessionSummary.projectLabel`** — worktree-aware display label
|
|
79
|
+
(`"ai-self-web (playwright)"` instead of bare `"playwright"`),
|
|
80
|
+
matching the usage table. Drives the `/sessions` page, the
|
|
81
|
+
session-detail header, and CLI report's session breakdown.
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- **`ccgauge` (no subcommand)** is the documented shortcut for
|
|
86
|
+
`ccgauge start` again. A regression in 1.0.4's `normalizeArgv`
|
|
87
|
+
refactor made bare `ccgauge` print root help and exit 1.
|
|
88
|
+
- **`ccgauge status` exit code** is now systemd-style 3 when no
|
|
89
|
+
background service is running, so shell scripts can `if ccgauge
|
|
90
|
+
status; then …`. **`--json` mode** intentionally still exits 0
|
|
91
|
+
(the consumer is a script that should read `payload.running`),
|
|
92
|
+
so `ccgauge status --json | jq` under `set -e` keeps working.
|
|
93
|
+
- **`ccgauge mcp` runs in-process via `await import()` + the bundle
|
|
94
|
+
exports `runStdioServer` / `printCheck`.** Saves ~80–150 ms vs
|
|
95
|
+
the old spawn-a-child design and removes a brittle signal-
|
|
96
|
+
forwarding shim. (1.0.3 introduced this; 1.0.5 fixes the
|
|
97
|
+
`process.exit(0)` regression that broke it for real users.)
|
|
98
|
+
- **`ccgauge mcp --check`** — verifies the bundle, boots the
|
|
99
|
+
indexer, prints one line per provider with scanned dirs + record
|
|
100
|
+
counts, and exits. Lets users debug "Claude Desktop doesn't see
|
|
101
|
+
ccgauge tools" without spinning up an MCP client.
|
|
102
|
+
- **`--color` / `--no-color` / `FORCE_COLOR` / `NO_COLOR`** all
|
|
103
|
+
resolve through a single `shouldUseColor()` helper now, with the
|
|
104
|
+
documented precedence (`--no-color` highest, then env vars, then
|
|
105
|
+
`isTTY`). Previously the report's color flag was hard-AND'd with
|
|
106
|
+
`isTTY`, so `FORCE_COLOR=1 ccgauge report | tee log` lost colour.
|
|
107
|
+
- **`ccgauge start` foreground** uses `spawn` instead of `fork`.
|
|
108
|
+
Next.js standalone doesn't use IPC; `fork` was opening an unused
|
|
109
|
+
channel and the parent's `process.exit(0)` was racing the child's
|
|
110
|
+
teardown on Ctrl+C. Now matches the background path's `spawn` +
|
|
111
|
+
exit-code forwarding.
|
|
112
|
+
- **`--quiet`** silences Next.js's stderr too. Previously only stdout
|
|
113
|
+
was ignored, so warnings still leaked. (Background mode is
|
|
114
|
+
unaffected — it has always logged to a file.)
|
|
115
|
+
- **`ccgauge restart --dir ""`** clears the inherited override
|
|
116
|
+
instead of silently re-reading the previous run's `dataDir` from
|
|
117
|
+
`state.json`. Uses commander's `getOptionValueSource('dir') ===
|
|
118
|
+
'cli'` instead of `!opts.dir` truthy check.
|
|
119
|
+
- **Background-start failure messages** now include the last 5
|
|
120
|
+
lines of `~/.ccgauge/ccgauge.log`, so users don't have to discover
|
|
121
|
+
`ccgauge logs` to learn that EADDRINUSE / their override path
|
|
122
|
+
doesn't exist / etc. caused the silent timeout.
|
|
123
|
+
- **"Build artifact not found"** errors from `start` / `report` /
|
|
124
|
+
`mcp` are unified into one `missingArtifactError(...)` helper.
|
|
125
|
+
Includes `node --version` / `ccgauge --version` / `platform` so
|
|
126
|
+
bug reports don't lose those.
|
|
127
|
+
- **`[ccgauge] error:`** prefix is now consistent on stderr
|
|
128
|
+
diagnostics (was a mix of `[ccgauge]`, `[ccgauge-mcp]`, and bare
|
|
129
|
+
prose). stdout user-facing messages stay unprefixed.
|
|
130
|
+
- **`/sessions` project column** uses `projectLabel` (worktree-aware)
|
|
131
|
+
so rows for `…/.claude/worktrees/playwright` read
|
|
132
|
+
`ai-self-web (playwright)` — matching the usage table.
|
|
133
|
+
- **CLI report's session breakdown** (`--by session`) `sub` text
|
|
134
|
+
also uses `projectLabel`, for the same reason.
|
|
135
|
+
- **README / README.zh-CN** Commands table gains `ccgauge doctor`;
|
|
136
|
+
Troubleshooting gains a "anything unexpected → ccgauge doctor"
|
|
137
|
+
lead; MCP troubleshooting points at `ccgauge mcp --check`.
|
|
138
|
+
|
|
139
|
+
### Fixed
|
|
140
|
+
|
|
141
|
+
- **`ccgauge mcp` exited immediately after the JSON-RPC handshake**
|
|
142
|
+
(P1 regression from 1.0.3): the in-process CLI wrapper called
|
|
143
|
+
`process.exit(0)` after `await runStdioServer()`, but
|
|
144
|
+
`runStdioServer` returns as soon as `server.connect(transport)`
|
|
145
|
+
finishes the handshake — the long-running stdin readline is what
|
|
146
|
+
holds the process alive. Removed the exit; documented with a
|
|
147
|
+
`CRITICAL:` comment so it can't come back. Smoke test now runs
|
|
148
|
+
through `node bin/cli.mjs mcp` so the CLI wrapper is on the
|
|
149
|
+
covered path.
|
|
150
|
+
- **`ccgauge -r 7d -s codex` reported `start: unknown option '-r'`**
|
|
151
|
+
instead of "did you mean `report`?". `normalizeArgv` now only
|
|
152
|
+
injects `start` when every flag belongs to `start`'s own option
|
|
153
|
+
set; otherwise it leaves argv alone and lets commander surface
|
|
154
|
+
its own root-level error (which lists subcommands).
|
|
155
|
+
- **`ccgauge logs -f` duplicated lines under heavy write rates.**
|
|
156
|
+
The follow loop used `stat().size` as the read cursor but didn't
|
|
157
|
+
cap the `createReadStream`'s upper bound, so a chunk written
|
|
158
|
+
between `stat` and the read could appear in both ticks. Now
|
|
159
|
+
pins `end: s.size - 1`.
|
|
160
|
+
- **`ccgauge stop` could kill unrelated processes after a reboot.**
|
|
161
|
+
`process.kill(pid, 0)` only checks PID liveness, and PID space
|
|
162
|
+
recycles aggressively across boots. `state.json` now records a
|
|
163
|
+
`bootId` (~ system uptime) and a `cmdMarker` (`"next-server"`),
|
|
164
|
+
and `isProcessRunning` verifies both — falling back to the bare
|
|
165
|
+
kill(0) on Windows where `ps` isn't available.
|
|
166
|
+
- **`test-mcp-server.mjs` flake** caused by top-N truncation: a
|
|
167
|
+
tool that's in claude-only top-10 can land #11 in the merged
|
|
168
|
+
all top-10 once codex contributes more competitors. The
|
|
169
|
+
per-tool count comparison now skips tools that didn't survive
|
|
170
|
+
the merged truncation (the broader "source filter is a no-op"
|
|
171
|
+
check below catches the real bug it was originally meant to).
|
|
172
|
+
- **`/usage` project filter listed worktree leaves** as if they
|
|
173
|
+
were independent projects (`affectionate-sammet-00dc35`,
|
|
174
|
+
`agitated-diffie-5c15fe`, …), out of sync with `/projects`
|
|
175
|
+
which already collapses worktrees under their canonical repo
|
|
176
|
+
root. The dropdown now lists canonical cwds only; the
|
|
177
|
+
`projects` URL param semantics changed from exact-cwd to
|
|
178
|
+
canonical-cwd matching, and the aggregator's `projects` filter
|
|
179
|
+
is bypassed in favour of a canonical-aware pre-filter so a
|
|
180
|
+
single record under `…/.claude/worktrees/X` still counts when
|
|
181
|
+
the user picks its main repo.
|
|
182
|
+
|
|
183
|
+
### Performance
|
|
184
|
+
|
|
185
|
+
- **Aggregator hot loop** — `withinRange` predicate used to call
|
|
186
|
+
`Date#toISOString()` + `Array.includes()` once per record. Each
|
|
187
|
+
entry-point function now hoists those into a `prepareOpts` step:
|
|
188
|
+
ISO strings computed once, `models` / `projects` materialized as
|
|
189
|
+
`Set` for O(1) membership. Measurable on the MCP `weekly_summary`
|
|
190
|
+
/ `usage_by_*` paths over year-scale histories; invisible for the
|
|
191
|
+
single-pass dashboard aggregators.
|
|
192
|
+
- **MCP indexer's 30 s polling fallback** is now **off by default**.
|
|
193
|
+
fs.watch's `recursive: true` handles changes reliably on modern
|
|
194
|
+
macOS / Linux / Windows; the polling fallback was originally
|
|
195
|
+
there for flaky network mounts and FUSE setups. The web
|
|
196
|
+
dashboard's indexer **keeps polling ON** (user expects fresh
|
|
197
|
+
data when they alt-tab back). Override either default with
|
|
198
|
+
`CCGAUGE_POLL_FALLBACK={0,1}`.
|
|
199
|
+
- **`get-port` / `open` are lazy-imported** — only loaded by `start`
|
|
200
|
+
/ `restart` / `open`. Short-lived commands like `mcp`, `status`,
|
|
201
|
+
`logs`, `report`, `--version` shave ~20–30 ms cold-start each.
|
|
202
|
+
Matters most for `ccgauge mcp`, which LLM clients spawn per
|
|
203
|
+
conversation.
|
|
204
|
+
|
|
205
|
+
### Internal
|
|
206
|
+
|
|
207
|
+
- **`summarizeTurns()`** in `lib/turns.ts` is the single source of
|
|
208
|
+
truth for turn-level metadata; dashboard, MCP, and CLI report all
|
|
209
|
+
consume it. Same parent-chain walk + synthetic-user skip as
|
|
210
|
+
`buildTurnIndex` (which it builds on top of).
|
|
211
|
+
- **`TurnsContext`** in `lib/mcp/formatters.ts` packages
|
|
212
|
+
`{ users, parentMap }` so per-source aggregator helpers can
|
|
213
|
+
re-derive turn boundaries without re-plumbing args through every
|
|
214
|
+
call site.
|
|
215
|
+
- **`SessionSummary` carries `projectLabel`** (worktree-aware) in
|
|
216
|
+
addition to `projectName` (plain basename). Populated once by
|
|
217
|
+
`aggregateBySession` via `resolveProjectLabel` (per-cwd cache).
|
|
218
|
+
- **`bootId()` helper** in `bin/cli.mjs` (`Date.now() - os.uptime()
|
|
219
|
+
* 1000`, rounded) — a coarse system-boot timestamp used to tell
|
|
220
|
+
pre-reboot PIDs from post-reboot ones.
|
|
221
|
+
- **`shouldUseColor()` + `ansiPalette()`** in `bin/cli.mjs` — used
|
|
222
|
+
by `printReady` so the startup banner respects `NO_COLOR` and
|
|
223
|
+
doesn't leave `^[[1m...` mojibake when piped to `tee` / CI.
|
|
224
|
+
- **Smoke test runs through the CLI wrapper.** `scripts/test-mcp-
|
|
225
|
+
server.mjs` now spawns `node bin/cli.mjs mcp` instead of `node
|
|
226
|
+
dist/mcp/server.mjs`, so any regression in the CLI wrapper
|
|
227
|
+
(signal handling, lifecycle, exit-code shaping) is caught here.
|
|
228
|
+
|
|
8
229
|
## [1.0.4] — 2026-05-18
|
|
9
230
|
|
|
10
231
|
Correctness fixes + much stronger test coverage, plus a brand refresh
|
|
@@ -742,6 +963,8 @@ of HTML to the browser.
|
|
|
742
963
|
- Initial public release as `ccgauge`: local Next.js dashboard for
|
|
743
964
|
Claude Code token usage, cost, and 5-hour block tracking.
|
|
744
965
|
|
|
966
|
+
[1.0.5]: https://github.com/chengzuopeng/ccgauge/compare/v1.0.4...v1.0.5
|
|
967
|
+
[1.0.4]: https://github.com/chengzuopeng/ccgauge/compare/v1.0.3...v1.0.4
|
|
745
968
|
[1.0.3]: https://github.com/chengzuopeng/ccgauge/compare/v1.0.2...v1.0.3
|
|
746
969
|
[1.0.2]: https://github.com/chengzuopeng/ccgauge/compare/v1.0.1...v1.0.2
|
|
747
970
|
[1.0.1]: https://github.com/chengzuopeng/ccgauge/compare/v1.0.0...v1.0.1
|
package/README.md
CHANGED
|
@@ -138,11 +138,12 @@ Background mode persists state under `~/.ccgauge/`:
|
|
|
138
138
|
| `ccgauge start --background` | Start a detached background service. |
|
|
139
139
|
| `ccgauge stop [--force]` | Stop the background service. |
|
|
140
140
|
| `ccgauge restart [options]` | Stop and re-start with new options. |
|
|
141
|
-
| `ccgauge status [--json]` | Inspect the background service. |
|
|
141
|
+
| `ccgauge status [--json]` | Inspect the background service. Plain-text mode exits **3** (systemd "not running") when nothing is up so shell can `if ccgauge status; then …`; `--json` always exits 0 — read `payload.running` instead. |
|
|
142
142
|
| `ccgauge open` | Open the running dashboard in your browser. |
|
|
143
143
|
| `ccgauge logs [-f] [-n <lines>]` | Print background-service log file (the server's stdout). |
|
|
144
144
|
| `ccgauge report [options]` | Print a formatted **usage report** to stdout (one-shot, no server). |
|
|
145
145
|
| `ccgauge mcp` | Start the MCP server on stdio so LLMs can query usage. |
|
|
146
|
+
| `ccgauge doctor` | One-screen diagnostic: version, env, build artifacts, state, indexer + per-provider scan. Paste into bug reports. |
|
|
146
147
|
|
|
147
148
|
### Report
|
|
148
149
|
|
|
@@ -384,7 +385,7 @@ debug "why did it answer X".
|
|
|
384
385
|
|
|
385
386
|
| Symptom | Try |
|
|
386
387
|
| --- | --- |
|
|
387
|
-
| Client doesn't see ccgauge tools | Restart the client after editing the config;
|
|
388
|
+
| Client doesn't see ccgauge tools | Restart the client after editing the config; run `ccgauge mcp --check` (or `ccgauge doctor`) to verify the bundle, indexer, and detected providers without an MCP client |
|
|
388
389
|
| First call is slow | First call after a cold start indexes all JSONL files (~1–3 s for 100 files); subsequent calls are O(1) |
|
|
389
390
|
| "no providers detected" in the resource | The MCP process can't see `~/.claude/projects` / `~/.codex/sessions`; pass `CLAUDE_CONFIG_DIR` / `CCGAUGE_CODEX_DIR` via `env` in the MCP config |
|
|
390
391
|
| Want to see what the server is logging | Watch the client's MCP log; ccgauge writes to **stderr** (stdout is reserved for JSON-RPC) |
|
|
@@ -475,8 +476,11 @@ pnpm publish --access public # runs `pnpm build` first via prepublishOnly
|
|
|
475
476
|
|
|
476
477
|
## Troubleshooting
|
|
477
478
|
|
|
479
|
+
> **First stop for any "why doesn't this work" question:** run `ccgauge doctor`. It prints version, env vars, build artifacts, background-service state, and the indexer's per-provider scan in one screen — perfect for pasting into a bug report.
|
|
480
|
+
|
|
478
481
|
| Symptom | Try |
|
|
479
482
|
| --- | --- |
|
|
483
|
+
| Anything unexpected | `ccgauge doctor` — one-screen diagnostic for everything below |
|
|
480
484
|
| Port keeps drifting | `ccgauge --strict-port --port 3737` |
|
|
481
485
|
| Stale background service | `ccgauge status`, then `ccgauge stop --force` |
|
|
482
486
|
| Background didn't start | `ccgauge logs` reads `~/.ccgauge/ccgauge.log` |
|
package/README.zh-CN.md
CHANGED
|
@@ -138,11 +138,12 @@ ccgauge stop
|
|
|
138
138
|
| `ccgauge start --background` | 启动后台服务。 |
|
|
139
139
|
| `ccgauge stop [--force]` | 停止后台服务。 |
|
|
140
140
|
| `ccgauge restart [options]` | 停止再用新参数启动。 |
|
|
141
|
-
| `ccgauge status [--json]` |
|
|
141
|
+
| `ccgauge status [--json]` | 查看后台状态。纯文本模式后台未运行时退出码 **3**(systemd 约定),shell 可用 `if ccgauge status; then …`;`--json` 始终退 0,请改读 `payload.running`。 |
|
|
142
142
|
| `ccgauge open` | 在浏览器打开正在运行的看板。 |
|
|
143
143
|
| `ccgauge logs [-f] [-n <lines>]` | 查看后台服务的日志(server stdout)。 |
|
|
144
144
|
| `ccgauge report [options]` | 命令行**用量报告**,直接打到终端(一次性,不起服务)。 |
|
|
145
145
|
| `ccgauge mcp` | 起 MCP 服务(stdio),让 LLM 查你的用量。 |
|
|
146
|
+
| `ccgauge doctor` | 一屏诊断:版本、env、构建产物、后台状态、indexer + 每个 provider 的扫描计数。报 issue 时直接粘。 |
|
|
146
147
|
|
|
147
148
|
### 命令行报告(report)
|
|
148
149
|
|
|
@@ -378,7 +379,7 @@ LLM 大概率会调的工具——方便你"为什么会这样回答"反查。
|
|
|
378
379
|
|
|
379
380
|
| 现象 | 建议 |
|
|
380
381
|
| --- | --- |
|
|
381
|
-
| 客户端看不到 ccgauge 工具 |
|
|
382
|
+
| 客户端看不到 ccgauge 工具 | 改完配置重启客户端;不连 MCP 客户端就能验证 bundle / indexer / providers 的话直接跑 `ccgauge mcp --check`(或 `ccgauge doctor`)|
|
|
382
383
|
| 第一次调用比较慢 | 冷启动后第一次会全量索引(100 文件 ~1–3s);之后都是 O(1) |
|
|
383
384
|
| Resource 显示 "no providers detected" | MCP 进程看不到 `~/.claude/projects` / `~/.codex/sessions`;通过 MCP 配置的 `env` 传 `CLAUDE_CONFIG_DIR` / `CCGAUGE_CODEX_DIR` |
|
|
384
385
|
| 想看 server 在打什么日志 | 看客户端的 MCP 日志;ccgauge 把日志写到 **stderr**(stdout 被 JSON-RPC 占用)|
|
|
@@ -468,8 +469,11 @@ pnpm publish --access public # 会自动先跑 pnpm build(prepublishOnly)
|
|
|
468
469
|
|
|
469
470
|
## 排障
|
|
470
471
|
|
|
472
|
+
> **任何"为啥不工作"的问题先跑一下:** `ccgauge doctor`。一屏列出版本、env、构建产物、后台状态、indexer 扫描计数,报 issue 直接粘过去就行。
|
|
473
|
+
|
|
471
474
|
| 现象 | 建议命令 |
|
|
472
475
|
| --- | --- |
|
|
476
|
+
| 任何异常想先一屏看清 | `ccgauge doctor` — 下面所有项都在它的诊断里 |
|
|
473
477
|
| 端口被自动换掉 | `ccgauge --strict-port --port 3737` |
|
|
474
478
|
| 后台服务状态不对 | 先 `ccgauge status`,PID 仍存活但不响应再 `ccgauge stop --force` |
|
|
475
479
|
| 后台启动失败 | `ccgauge logs` 查看 `~/.ccgauge/ccgauge.log` |
|