tokentrace 0.9.0 → 0.10.1
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/CHANGELOG.md +55 -0
- package/CONTRIBUTING.md +18 -0
- package/README.md +68 -13
- package/TOKENTRACE_AGENT.md +83 -0
- package/app/api/agent/route.ts +7 -0
- package/app/api/capabilities/route.ts +7 -0
- package/app/api/roadmap/route.ts +13 -0
- package/app/debug/page.tsx +22 -1
- package/app/diagnostics/page.tsx +18 -18
- package/app/discovery/page.tsx +9 -3
- package/app/evidence/page.tsx +165 -5
- package/app/global-error.tsx +2 -2
- package/app/guide/page.tsx +624 -0
- package/app/layout.tsx +1 -1
- package/app/loading.tsx +39 -0
- package/app/models/page.tsx +16 -0
- package/app/optimisation/page.tsx +63 -49
- package/app/page.tsx +645 -504
- package/app/parser-debug/page.tsx +10 -4
- package/app/pricing/page.tsx +2 -2
- package/app/projects/page.tsx +16 -0
- package/app/repair/page.tsx +67 -17
- package/app/sessions/page.tsx +2 -2
- package/app/tools/page.tsx +16 -0
- package/bin/tokentrace.js +22 -0
- package/components/charts/rank-bar-chart.tsx +13 -13
- package/components/charts/trend-chart.tsx +127 -31
- package/components/charts/trend-section.tsx +88 -0
- package/components/charts/use-chart-size.ts +41 -0
- package/components/empty-state.tsx +37 -5
- package/components/period-filter.tsx +25 -26
- package/components/pricing-settings.tsx +8 -8
- package/components/scan-health-summary.tsx +3 -3
- package/components/scan-now-button.tsx +122 -0
- package/components/session-explorer.tsx +18 -2
- package/components/settings-panel.tsx +2 -2
- package/components/sidebar.tsx +86 -29
- package/dist/runtime/agent.mjs +390 -0
- package/dist/runtime/db-seed.mjs +5 -5
- package/dist/runtime/digest.mjs +63 -15
- package/dist/runtime/doctor.mjs +74 -26
- package/dist/runtime/evidence.mjs +1 -1
- package/dist/runtime/insights.mjs +63 -15
- package/dist/runtime/pricing-refresh.mjs +8 -8
- package/dist/runtime/report.mjs +63 -15
- package/dist/runtime/reset.mjs +5 -5
- package/dist/runtime/review.mjs +63 -15
- package/dist/runtime/roadmap.mjs +209 -0
- package/dist/runtime/scan.mjs +2 -2
- package/dist/runtime/status.mjs +17 -15
- package/docs/agent-discovery.schema.json +222 -0
- package/docs/assets/claude-statusline.svg +2 -2
- package/docs/assets/evidence-0.10.0.png +0 -0
- package/docs/assets/overview-0.10.0.png +0 -0
- package/docs/assets/repair-0.10.0.png +0 -0
- package/docs/assets/scan-health-0.10.0.png +0 -0
- package/llms.txt +42 -0
- package/package.json +9 -3
- package/scripts/agent.ts +50 -0
- package/scripts/build-cli-runtime.mjs +2 -0
- package/scripts/package-inspect.mjs +33 -1
- package/scripts/roadmap.ts +49 -0
- package/scripts/seed-screenshot-data.ts +503 -0
- package/scripts/smoke-cli.mjs +15 -0
- package/scripts/smoke-packed-install.mjs +74 -2
- package/src/ingestion/persist.ts +1 -1
- package/src/lib/agent-discovery-api.ts +11 -0
- package/src/lib/agent-discovery.ts +417 -0
- package/src/lib/analytics.ts +70 -6
- package/src/lib/claude-statusline.ts +17 -15
- package/src/lib/cost.ts +1 -1
- package/src/lib/date-range.ts +5 -4
- package/src/lib/doctor.ts +9 -9
- package/src/lib/evidence-trail.ts +1 -1
- package/src/lib/first-run-status.ts +78 -12
- package/src/lib/pricing-manifest.ts +4 -4
- package/src/lib/pricing-refresh.ts +3 -3
- package/src/lib/project-signals.ts +1 -1
- package/src/lib/recommendations.ts +4 -4
- package/src/lib/review-queue.ts +1 -1
- package/src/lib/roadmap-status.ts +202 -0
- package/src/lib/scan-health.ts +2 -2
- package/src/lib/support-matrix.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to TokenTrace are documented here.
|
|
4
4
|
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
No unreleased changes yet.
|
|
8
|
+
|
|
9
|
+
## [0.10.1] - 2026-05-18
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Guide now uses a manual-style layout with section navigation, compact setup status, workflow rows, command tables, and tighter troubleshooting copy.
|
|
14
|
+
- Sidebar Guide access now lives in a Help area above the version footer so it reads as documentation instead of a product feature.
|
|
15
|
+
- Guide section navigation now sticks while scrolling on desktop widths, and the standalone sidebar Guide link no longer shows redundant Help chrome.
|
|
16
|
+
- Guide Scan now controls now run the local scan directly with inline feedback instead of linking to Settings.
|
|
17
|
+
- Overview now groups processed, fresh, and cached token metrics into one Token Accounting card with direct evidence pivots.
|
|
18
|
+
- Evidence pages now include metric tabs and drill-down actions for source files, sessions, parser confidence, and model-rate or repair follow-up.
|
|
19
|
+
- User-facing model price configuration is now labeled Model Rates so it is not mistaken for TokenTrace product pricing.
|
|
20
|
+
- Overview Usage Pulse now labels current, previous, and change values explicitly inside each metric block.
|
|
21
|
+
- Overview now groups cost and sessions into one split card with a shared help tooltip, compact pane labels, and aligned trust notes/actions.
|
|
22
|
+
- Overview trend charts now default all-time views to the latest 30 days, while keeping 60-day, 90-day, and All history options available.
|
|
23
|
+
- Overview now compacts below-chart diagnostics into Review Status and Top repair items strips, with the full unknown-cost table moved to the Repair page.
|
|
24
|
+
- Evidence, repair, parser, and model-rate links now use consistent action labels: View evidence, Open repair, Set model rate, and Review parser.
|
|
25
|
+
- Sidebar navigation now shows the active page, first-run empty states point to the next useful action, direct scans return richer result feedback, and repair/evidence pages guide users through the next drill-down.
|
|
26
|
+
- Page names now stay aligned around Parsers, Discovery, Insights, Scan Health, Model Rates, and privacy-oriented Raw Data copy.
|
|
27
|
+
- User-facing diagnostic copy now uses Scan Health consistently instead of older mixed diagnostic wording.
|
|
28
|
+
- Product metadata, README, Guide, and agent discovery now point to the TokenTrace product website while creator attribution points to Abhi Yoheswaran's homepage.
|
|
29
|
+
- Period filters use a mobile-friendly preset scroller with custom dates on a compact second row, and trend controls now say Display window with a showing-latest badge.
|
|
30
|
+
- README screenshots were refreshed from a guarded public-safe screenshot database seeded by `npm run screenshots:seed`.
|
|
31
|
+
|
|
32
|
+
## [0.10.0] - 2026-05-18
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- In-app Guide page covering first scan setup, Claude Code status-line installation, status-line label meanings, page workflows, privacy, and troubleshooting.
|
|
37
|
+
- `tokentrace agent --json` and `tokentrace capabilities --json` for a read-only machine-readable discovery manifest that coding agents can use before scanning or opening the dashboard.
|
|
38
|
+
- Local dashboard discovery endpoints at `/api/agent` and `/api/capabilities` returning the same manifest.
|
|
39
|
+
- `tokentrace roadmap --json` and `/api/roadmap` for machine-readable 0.10.0 implementation status, evidence paths, verification gates, and release status.
|
|
40
|
+
- Package-level agent discovery references: `TOKENTRACE_AGENT.md`, `llms.txt`, and `docs/agent-discovery.schema.json`.
|
|
41
|
+
- Repo-level agent instructions for Codex and Claude Code requiring Superpowers, ProjScan, changelog discipline, and explicit maintainer approval before releases.
|
|
42
|
+
- 0.10.0 Guided Operator roadmap for in-app guidance, status-line clarity, trend continuity, release-safe agent workflow, and verification gates.
|
|
43
|
+
- First-run guided setup in Overview and Guide so new users can move from scan roots to first useful evidence without a separate tutorial mode.
|
|
44
|
+
- Guide release-readiness and empty-state sections covering roadmap gates, release status, no data, missing logs, unknown pricing, parser warnings, and sandbox smoke skips.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- Guide now shows live local setup status for latest scan, imported records, unknown costs, and priced model coverage.
|
|
49
|
+
- Agent discovery follow-up commands are now structured as command arrays instead of shell strings.
|
|
50
|
+
- Claude Code status-line output now leads with live context and cost, then labels transcript totals as processed and cache usage to avoid confusing cumulative processed tokens with current context size.
|
|
51
|
+
- Package inspection and packed-install smoke now enforce the agent discovery docs, schema, executable CLI bin, and 0.10.0 release-status contract.
|
|
52
|
+
- Overview metric cards now show inline trust annotations explaining processed, non-cache, cached, cost, and session counts near the numbers.
|
|
53
|
+
- Overview Period defaults to All time again, while token and cost trend charts share one control bar that defaults chart history to the latest 60 days with 30-day, 90-day, and All options.
|
|
54
|
+
- Usage Pulse now suppresses extreme percentage labels when the previous comparison baseline is too small to be useful.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- Token and cost trend charts now include explicit zero-value calendar days between imported usage days instead of visually skipping idle periods.
|
|
59
|
+
|
|
5
60
|
## [0.9.0] - 2026-05-13
|
|
6
61
|
|
|
7
62
|
### Added
|
package/CONTRIBUTING.md
CHANGED
|
@@ -22,12 +22,30 @@ npm run dev
|
|
|
22
22
|
|
|
23
23
|
Open `http://localhost:3000`.
|
|
24
24
|
|
|
25
|
+
## Agentic Coding Workflow
|
|
26
|
+
|
|
27
|
+
TokenTrace coding work uses the Superpowers methodology from
|
|
28
|
+
<https://github.com/obra/superpowers>: clarify intent, plan, use TDD for
|
|
29
|
+
behavior changes, review, and verify before completion claims.
|
|
30
|
+
|
|
31
|
+
ProjScan is a required code-intelligence and quality tool. Use the npm package
|
|
32
|
+
from <https://www.npmjs.com/package/projscan> through the local script:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run projscan:doctor
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Run ProjScan after substantial changes and before release readiness claims. It
|
|
39
|
+
does not replace tests, typecheck, lint, build, package inspection, or smoke
|
|
40
|
+
checks.
|
|
41
|
+
|
|
25
42
|
Useful checks:
|
|
26
43
|
|
|
27
44
|
```bash
|
|
28
45
|
npm run verify
|
|
29
46
|
npm run build
|
|
30
47
|
npm run scan
|
|
48
|
+
npm run projscan:doctor
|
|
31
49
|
```
|
|
32
50
|
|
|
33
51
|
## Parser Contributions
|
package/README.md
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
# TokenTrace CLI
|
|
6
6
|
|
|
7
|
-
Local-first
|
|
7
|
+
Local-first AI CLI usage analytics. TokenTrace scans local CLI logs, normalizes token usage, estimates missing counts, and shows cost, model, project, and session analytics in a browser dashboard.
|
|
8
8
|
|
|
9
9
|
TokenTrace is designed for local development machines first, with macOS-oriented defaults. It does not require a cloud account and does not send telemetry or logs anywhere.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
[Website](https://www.abhiyoheswaran.com/apps/tokentrace) · [Source](https://github.com/abhiyoheswaran1/tokentrace)
|
|
12
|
+
|
|
13
|
+

|
|
12
14
|
|
|
13
15
|
## Start In Seconds
|
|
14
16
|
|
|
@@ -34,6 +36,11 @@ tokentrace # Start local dashboard
|
|
|
34
36
|
tokentrace serve # Start local dashboard
|
|
35
37
|
tokentrace serve --port 3210 --no-open
|
|
36
38
|
# Start on a fixed port without opening a browser
|
|
39
|
+
tokentrace agent --json # Print machine-readable agent discovery manifest
|
|
40
|
+
tokentrace capabilities --json
|
|
41
|
+
# Alias for agent discovery manifest
|
|
42
|
+
tokentrace roadmap --json
|
|
43
|
+
# Print Guided Operator release implementation status
|
|
37
44
|
tokentrace scan # Scan local AI CLI usage logs
|
|
38
45
|
tokentrace doctor --json
|
|
39
46
|
# Inspect scan health and repair recommendations
|
|
@@ -72,6 +79,48 @@ tokentrace --help # Print help
|
|
|
72
79
|
tokentrace --version # Print version
|
|
73
80
|
```
|
|
74
81
|
|
|
82
|
+
## For Coding Agents
|
|
83
|
+
|
|
84
|
+
Agents should start with the read-only discovery manifest:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
tokentrace agent --json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The alias below returns the same manifest:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
tokentrace capabilities --json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The manifest describes TokenTrace's local-first privacy model, safe JSON commands,
|
|
97
|
+
common workflows, Claude Code status-line setup, Codex sidecar fallback, and
|
|
98
|
+
guardrails such as never running `tokentrace reset` without explicit human
|
|
99
|
+
approval. The discovery command does not scan files, initialize the database, or
|
|
100
|
+
start the dashboard.
|
|
101
|
+
|
|
102
|
+
Package-level agent references are included for agents that inspect repository
|
|
103
|
+
or npm package contents before invoking commands:
|
|
104
|
+
|
|
105
|
+
- [TOKENTRACE_AGENT.md](TOKENTRACE_AGENT.md)
|
|
106
|
+
- [llms.txt](llms.txt)
|
|
107
|
+
- [docs/agent-discovery.schema.json](docs/agent-discovery.schema.json)
|
|
108
|
+
|
|
109
|
+
When the local dashboard is already running, agents can fetch the same manifest
|
|
110
|
+
over localhost:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
curl http://127.0.0.1:3030/api/agent
|
|
114
|
+
curl http://127.0.0.1:3030/api/capabilities
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The Guided Operator release status is also machine-readable:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
tokentrace roadmap --json
|
|
121
|
+
curl http://127.0.0.1:3030/api/roadmap
|
|
122
|
+
```
|
|
123
|
+
|
|
75
124
|
## Run From Source
|
|
76
125
|
|
|
77
126
|
```bash
|
|
@@ -92,12 +141,18 @@ npm run start # Serve the production build
|
|
|
92
141
|
npm run scan # Scan default and configured folders
|
|
93
142
|
npm run db:migrate # Create/update local SQLite tables
|
|
94
143
|
npm run db:seed # Seed editable provider/model prices
|
|
144
|
+
npm run screenshots:seed
|
|
145
|
+
# Seed a guarded public-safe screenshot database
|
|
95
146
|
npm run reset # Clear imported data and scan history
|
|
96
147
|
npm test # Run parser and cost tests
|
|
97
148
|
npm run verify # Run Vitest, TypeScript, and ESLint checks
|
|
98
149
|
npm run package:test # Verify, build, and dry-run the npm package
|
|
99
150
|
npm run package:inspect
|
|
100
151
|
# Check package transparency guardrails
|
|
152
|
+
npm run smoke:packed
|
|
153
|
+
# Inspect packed tarball and smoke test packed CLI
|
|
154
|
+
tokentrace roadmap --json
|
|
155
|
+
# Inspect evidence gates and release status
|
|
101
156
|
```
|
|
102
157
|
|
|
103
158
|
Release work uses internal milestone commits until the next public minor
|
|
@@ -139,7 +194,7 @@ Default discovery checks these locations when present:
|
|
|
139
194
|
- TokenTrace wrapper logs in the local app-data directory
|
|
140
195
|
- Any custom folders configured in Settings
|
|
141
196
|
|
|
142
|
-
Use **Settings** in the dashboard to add custom folders, toggle raw message storage, and trigger scans. Use **
|
|
197
|
+
Use **Settings** in the dashboard to add custom folders, toggle raw message storage, and trigger scans. Use **Scan Health**, **Discovery**, **Parsers**, and **Raw Data** to inspect discovered files, parser decisions, warnings, failures, extracted metadata, and confidence levels.
|
|
143
198
|
|
|
144
199
|
Settings also supports optional local monthly usage guardrails. Set a cost
|
|
145
200
|
limit, token limit, or both, and Overview will show month-to-date progress from
|
|
@@ -202,7 +257,7 @@ tokentrace statusline claude
|
|
|
202
257
|
Claude Code sends session JSON to the command on stdin. TokenTrace reads the transcript path, model, context usage, and session cost, then prints one compact local line:
|
|
203
258
|
|
|
204
259
|
```text
|
|
205
|
-
TokenTrace | Opus |
|
|
260
|
+
TokenTrace | Opus | ctx 7% | cost $0.1235 | processed 3.3K tokens | cache 2.0K | priced
|
|
206
261
|
```
|
|
207
262
|
|
|
208
263
|
Do not set the Claude Code `statusLine.command` to plain `tokentrace`. Plain `tokentrace` starts the dashboard, while `tokentrace statusline claude` prints exactly one status-line response.
|
|
@@ -229,15 +284,15 @@ Codex CLI status-line integration is intentionally deferred until its status-lin
|
|
|
229
284
|
|
|
230
285
|
## Screenshots
|
|
231
286
|
|
|
232
|
-
|
|
287
|
+
Dashboard views:
|
|
233
288
|
|
|
234
|
-

|
|
235
290
|
|
|
236
|
-

|
|
237
292
|
|
|
238
|
-

|
|
239
294
|
|
|
240
|
-

|
|
241
296
|
|
|
242
297
|
CLI startup and help:
|
|
243
298
|
|
|
@@ -275,9 +330,9 @@ Stop the server with `Ctrl+C` in the terminal where `tokentrace` is running.
|
|
|
275
330
|
|
|
276
331
|
See [SECURITY.md](SECURITY.md) for the full security and privacy model.
|
|
277
332
|
|
|
278
|
-
##
|
|
333
|
+
## Model Rates
|
|
279
334
|
|
|
280
|
-
Model prices change. TokenTrace ships with bundled public list prices and can refresh them from a public TokenTrace
|
|
335
|
+
Model prices change. TokenTrace ships with bundled public list prices and can refresh them from a public TokenTrace model-rate manifest. Manual edits made in **Model Rates** are preserved by future refreshes.
|
|
281
336
|
|
|
282
337
|
The bundled catalog includes common OpenAI, Anthropic, Google Gemini, xAI, DeepSeek, Mistral, and Cohere models, checked on May 8, 2026.
|
|
283
338
|
|
|
@@ -291,7 +346,7 @@ Seed sources:
|
|
|
291
346
|
- [Mistral model docs](https://docs.mistral.ai/models)
|
|
292
347
|
- [Cohere pricing](https://cohere.com/pricing)
|
|
293
348
|
|
|
294
|
-
Review and update
|
|
349
|
+
Review and update rates in **Model Rates** before treating cost estimates as financial truth, especially if you use batch processing, priority/flex modes, data residency, long-context surcharges, subscriptions, or provider-specific discounts.
|
|
295
350
|
|
|
296
351
|
Refresh from the dashboard or from the CLI:
|
|
297
352
|
|
|
@@ -360,7 +415,7 @@ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for local setu
|
|
|
360
415
|
|
|
361
416
|
## License
|
|
362
417
|
|
|
363
|
-
Open source by [Abhi Yoheswaran](https://
|
|
418
|
+
Open source by [Abhi Yoheswaran](https://www.abhiyoheswaran.com). Released under the MIT License. See `LICENSE`.
|
|
364
419
|
|
|
365
420
|
## Next Improvements
|
|
366
421
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# TokenTrace Agent Guide
|
|
2
|
+
|
|
3
|
+
TokenTrace is a local-first CLI and dashboard for AI coding-agent token, cost,
|
|
4
|
+
session, parser, and evidence analytics.
|
|
5
|
+
|
|
6
|
+
## Start Here
|
|
7
|
+
|
|
8
|
+
Use the read-only discovery manifest before running any other TokenTrace command:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
tokentrace agent --json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This alias returns the same manifest:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
tokentrace capabilities --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The manifest follows the schema in `docs/agent-discovery.schema.json`.
|
|
21
|
+
|
|
22
|
+
If the local dashboard is already running, the same manifest is available from:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
curl http://127.0.0.1:3030/api/agent
|
|
26
|
+
curl http://127.0.0.1:3030/api/capabilities
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Roadmap Status
|
|
30
|
+
|
|
31
|
+
Inspect the current 0.10.0 implementation pipeline and release blockers:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
tokentrace roadmap --json
|
|
35
|
+
curl http://127.0.0.1:3030/api/roadmap
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Safe Automation Loop
|
|
39
|
+
|
|
40
|
+
1. Discover capabilities:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
tokentrace agent --json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
2. Refresh local data when the human expects current usage:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
tokentrace scan --json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
3. Check trust before making claims:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
tokentrace doctor --json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
4. Explain totals with evidence:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
tokentrace evidence --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Guardrails
|
|
65
|
+
|
|
66
|
+
- Do not run `tokentrace reset` unless the human explicitly asks to clear imported local data.
|
|
67
|
+
- Do not call processed tokens current context size. Use `ctx` for live context-window pressure.
|
|
68
|
+
- Treat database paths, source file paths, prompts, and raw transcript settings as local sensitive data.
|
|
69
|
+
- Discovery is read-only: it does not scan files, initialize the dashboard database, start a server, or make a network request.
|
|
70
|
+
|
|
71
|
+
## Integrations
|
|
72
|
+
|
|
73
|
+
Claude Code status line:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
tokentrace statusline setup claude
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Codex fallback while native status-line hooks remain unstable:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
tokentrace watch --session --compact
|
|
83
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { getAppVersion } from "@/src/lib/app-version";
|
|
3
|
+
import { buildRoadmapStatus } from "@/src/lib/roadmap-status";
|
|
4
|
+
|
|
5
|
+
export const dynamic = "force-dynamic";
|
|
6
|
+
|
|
7
|
+
export async function GET() {
|
|
8
|
+
return NextResponse.json(buildRoadmapStatus({ packageVersion: getAppVersion() }), {
|
|
9
|
+
headers: {
|
|
10
|
+
"cache-control": "no-store"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
package/app/debug/page.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Badge } from "@/components/ui/badge";
|
|
2
|
+
import { EmptyState } from "@/components/empty-state";
|
|
3
|
+
import { ScanNowButton } from "@/components/scan-now-button";
|
|
2
4
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
3
5
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
|
4
6
|
import { MonoText, PageHeader } from "@/components/ui/typography";
|
|
@@ -21,9 +23,26 @@ export default function DebugPage() {
|
|
|
21
23
|
<div className="space-y-6">
|
|
22
24
|
<PageHeader
|
|
23
25
|
title="Raw Data"
|
|
24
|
-
description="
|
|
26
|
+
description="Local raw data for scan runs, parser selection, imported records, warnings, and failures."
|
|
25
27
|
/>
|
|
26
28
|
|
|
29
|
+
<div className="rounded-md border bg-card p-3 text-sm leading-6 text-muted-foreground">
|
|
30
|
+
<span className="font-medium text-foreground">Local raw data:</span>{" "}
|
|
31
|
+
Treat file paths and parser metadata as local sensitive data. This page is for debugging imports, not sharing screenshots.
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
{!data.scanRuns.length && !data.scanFiles.length ? (
|
|
35
|
+
<EmptyState
|
|
36
|
+
title="No raw scan data yet"
|
|
37
|
+
description="Run a scan to populate local raw data. If nothing appears after a scan, open Scan Health to review roots and parser status."
|
|
38
|
+
actions={[
|
|
39
|
+
{ label: "Open Scan Health", href: "/diagnostics", variant: "outline" }
|
|
40
|
+
]}
|
|
41
|
+
>
|
|
42
|
+
<ScanNowButton size="sm" />
|
|
43
|
+
</EmptyState>
|
|
44
|
+
) : (
|
|
45
|
+
<>
|
|
27
46
|
<Card>
|
|
28
47
|
<CardHeader>
|
|
29
48
|
<CardTitle>Recent Scan Runs</CardTitle>
|
|
@@ -97,6 +116,8 @@ export default function DebugPage() {
|
|
|
97
116
|
</Table>
|
|
98
117
|
</CardContent>
|
|
99
118
|
</Card>
|
|
119
|
+
</>
|
|
120
|
+
)}
|
|
100
121
|
</div>
|
|
101
122
|
);
|
|
102
123
|
}
|
package/app/diagnostics/page.tsx
CHANGED
|
@@ -43,7 +43,7 @@ function TrustChecklist({
|
|
|
43
43
|
const hasInteractions = data.confidence.interactions > 0;
|
|
44
44
|
const unknownCauses = data.health.costCoverage.unknownCauses;
|
|
45
45
|
const unknownCauseText = [
|
|
46
|
-
unknownCauses.missingPricing > 0 ? `${unknownCauses.missingPricing.toLocaleString()} missing
|
|
46
|
+
unknownCauses.missingPricing > 0 ? `${unknownCauses.missingPricing.toLocaleString()} missing model rate` : null,
|
|
47
47
|
unknownCauses.missingModelName > 0 ? `${unknownCauses.missingModelName.toLocaleString()} missing model` : null,
|
|
48
48
|
unknownCauses.missingTokenCount > 0 ? `${unknownCauses.missingTokenCount.toLocaleString()} missing token count` : null,
|
|
49
49
|
unknownCauses.other > 0 ? `${unknownCauses.other.toLocaleString()} other` : null
|
|
@@ -51,11 +51,11 @@ function TrustChecklist({
|
|
|
51
51
|
|
|
52
52
|
const items: Array<{ label: string; detail: string; status: ChecklistStatus }> = [
|
|
53
53
|
{
|
|
54
|
-
label: "
|
|
54
|
+
label: "Model rates loaded",
|
|
55
55
|
status: data.pricedModelCount > 0 ? "pass" : "warn",
|
|
56
56
|
detail: data.pricedModelCount > 0
|
|
57
|
-
? `${data.pricedModelCount.toLocaleString()}
|
|
58
|
-
: "Seed
|
|
57
|
+
? `${data.pricedModelCount.toLocaleString()} rated models are available.`
|
|
58
|
+
: "Seed model rates before trusting cost totals."
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
label: "CLI roots found",
|
|
@@ -77,10 +77,10 @@ function TrustChecklist({
|
|
|
77
77
|
detail: latest ? `${latest.recordsImported.toLocaleString()} interactions imported in the latest scan.` : "No scan has imported records yet."
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
|
-
label: "Unknown
|
|
80
|
+
label: "Unknown cost",
|
|
81
81
|
status: !hasInteractions ? "pending" : data.health.costCoverage.unknown > 0 ? "warn" : "pass",
|
|
82
82
|
detail: !hasInteractions
|
|
83
|
-
? "
|
|
83
|
+
? "Model-rate coverage appears after records are imported."
|
|
84
84
|
: data.health.costCoverage.unknown > 0
|
|
85
85
|
? `${data.health.costCoverage.unknown.toLocaleString()} interactions need repair: ${unknownCauseText || "cause unavailable"}.`
|
|
86
86
|
: "Imported interactions have usable cost coverage."
|
|
@@ -153,9 +153,9 @@ function DoctorReportPanel({ report }: { report: DoctorReport }) {
|
|
|
153
153
|
return (
|
|
154
154
|
<Card>
|
|
155
155
|
<CardHeader>
|
|
156
|
-
<CardTitle>
|
|
156
|
+
<CardTitle>Scan Health report</CardTitle>
|
|
157
157
|
<CardDescription>
|
|
158
|
-
|
|
158
|
+
The same local Scan Health data returned by `tokentrace doctor --json`.
|
|
159
159
|
</CardDescription>
|
|
160
160
|
</CardHeader>
|
|
161
161
|
<CardContent className="space-y-4">
|
|
@@ -217,7 +217,7 @@ function DoctorReportPanel({ report }: { report: DoctorReport }) {
|
|
|
217
217
|
</div>
|
|
218
218
|
|
|
219
219
|
<div className="space-y-2">
|
|
220
|
-
<div className="text-sm font-semibold">
|
|
220
|
+
<div className="text-sm font-semibold">Recommended fixes</div>
|
|
221
221
|
<div className="grid gap-2 lg:grid-cols-2">
|
|
222
222
|
{report.recommendations.slice(0, 6).map((item) => (
|
|
223
223
|
<Link key={item.id} href={item.href ?? "/diagnostics"} className="border-t p-3 transition-colors hover:bg-muted/40">
|
|
@@ -236,7 +236,7 @@ function DoctorReportPanel({ report }: { report: DoctorReport }) {
|
|
|
236
236
|
|
|
237
237
|
<div className="space-y-3">
|
|
238
238
|
<div>
|
|
239
|
-
<div className="text-sm font-semibold">
|
|
239
|
+
<div className="text-sm font-semibold">Supported file types</div>
|
|
240
240
|
<div className="mt-1 text-xs text-muted-foreground">
|
|
241
241
|
{report.supportMatrix.summary.stable.toLocaleString()} stable,{" "}
|
|
242
242
|
{report.supportMatrix.summary.bestEffort.toLocaleString()} best-effort,{" "}
|
|
@@ -267,7 +267,7 @@ function ParserTrustPanel({ report }: { report: DoctorReport["parserTrust"] }) {
|
|
|
267
267
|
return (
|
|
268
268
|
<Card>
|
|
269
269
|
<CardHeader>
|
|
270
|
-
<CardTitle>
|
|
270
|
+
<CardTitle>File parser review</CardTitle>
|
|
271
271
|
<CardDescription>
|
|
272
272
|
Latest scan files grouped by parser, source family, version, status, and import yield. Ignored files are known support files, not usage transcripts. Unsupported files need parser review before they become usage.
|
|
273
273
|
</CardDescription>
|
|
@@ -342,7 +342,7 @@ function ScanDiffPanel({ report }: { report: DoctorReport["scanDiff"] }) {
|
|
|
342
342
|
return (
|
|
343
343
|
<Card>
|
|
344
344
|
<CardHeader>
|
|
345
|
-
<CardTitle>Scan
|
|
345
|
+
<CardTitle>Scan history comparison</CardTitle>
|
|
346
346
|
<CardDescription>
|
|
347
347
|
Latest scan compared with the previous scan using deterministic scan ordering. Ignored files are known support files, not usage transcripts.
|
|
348
348
|
</CardDescription>
|
|
@@ -472,8 +472,8 @@ export default async function DiagnosticsPage() {
|
|
|
472
472
|
return (
|
|
473
473
|
<div className="space-y-6">
|
|
474
474
|
<PageHeader
|
|
475
|
-
title="Scan
|
|
476
|
-
description="
|
|
475
|
+
title="Scan Health"
|
|
476
|
+
description="Shows whether local usage was imported, which files need review, and whether model-rate coverage is usable."
|
|
477
477
|
/>
|
|
478
478
|
|
|
479
479
|
<TrustChecklist data={data} rootCount={roots.length} />
|
|
@@ -481,7 +481,7 @@ export default async function DiagnosticsPage() {
|
|
|
481
481
|
<Card>
|
|
482
482
|
<CardHeader>
|
|
483
483
|
<CardTitle>Local recommendations</CardTitle>
|
|
484
|
-
<CardDescription>Deterministic next actions from local scan,
|
|
484
|
+
<CardDescription>Deterministic next actions from local scan, model rates, parser, project, and cache data.</CardDescription>
|
|
485
485
|
</CardHeader>
|
|
486
486
|
<CardContent className="grid divide-y overflow-hidden p-0 lg:grid-cols-3 lg:divide-x lg:divide-y-0">
|
|
487
487
|
{analytics.recommendations.slice(0, 3).map((item) => (
|
|
@@ -513,12 +513,12 @@ export default async function DiagnosticsPage() {
|
|
|
513
513
|
{[
|
|
514
514
|
{
|
|
515
515
|
href: "/discovery",
|
|
516
|
-
title: "
|
|
516
|
+
title: "Discovered files",
|
|
517
517
|
description: "Inspect which local files were discovered, skipped, imported, or unsupported."
|
|
518
518
|
},
|
|
519
519
|
{
|
|
520
520
|
href: "/parser-debug",
|
|
521
|
-
title: "Parser
|
|
521
|
+
title: "Parser review",
|
|
522
522
|
description: "Review adapter selection, parser confidence, warnings, errors, and extracted metadata."
|
|
523
523
|
},
|
|
524
524
|
{
|
|
@@ -543,7 +543,7 @@ export default async function DiagnosticsPage() {
|
|
|
543
543
|
|
|
544
544
|
<Card>
|
|
545
545
|
<CardHeader>
|
|
546
|
-
<CardTitle>
|
|
546
|
+
<CardTitle>Local privacy rules</CardTitle>
|
|
547
547
|
<CardDescription>TokenTrace uses direct local filesystem ingestion as the primary architecture.</CardDescription>
|
|
548
548
|
</CardHeader>
|
|
549
549
|
<CardContent className="flex flex-wrap gap-2">
|
package/app/discovery/page.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/com
|
|
|
3
3
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
|
4
4
|
import { DataValue, FieldLabel, MonoText, PageHeader } from "@/components/ui/typography";
|
|
5
5
|
import { EmptyState } from "@/components/empty-state";
|
|
6
|
+
import { ScanNowButton } from "@/components/scan-now-button";
|
|
6
7
|
import { getScanTrustData } from "@/src/lib/analytics";
|
|
7
8
|
import { formatDate } from "@/src/lib/format";
|
|
8
9
|
|
|
@@ -27,7 +28,7 @@ export default function DiscoveryPage() {
|
|
|
27
28
|
return (
|
|
28
29
|
<div className="space-y-6">
|
|
29
30
|
<PageHeader
|
|
30
|
-
title="
|
|
31
|
+
title="Discovery"
|
|
31
32
|
description="Every file shown here was discovered by passive local filesystem scanning."
|
|
32
33
|
/>
|
|
33
34
|
<div className="grid overflow-hidden rounded-md border bg-card sm:grid-cols-2 lg:grid-cols-5">
|
|
@@ -55,8 +56,13 @@ export default function DiscoveryPage() {
|
|
|
55
56
|
{!scanFiles.length ? (
|
|
56
57
|
<EmptyState
|
|
57
58
|
title="No files discovered yet"
|
|
58
|
-
description="Run a scan from Settings to populate
|
|
59
|
-
|
|
59
|
+
description="Run a scan from Settings to populate Discovery. If expected folders are missing, add them in Settings."
|
|
60
|
+
actions={[
|
|
61
|
+
{ label: "Add folder", href: "/settings", variant: "outline" }
|
|
62
|
+
]}
|
|
63
|
+
>
|
|
64
|
+
<ScanNowButton size="sm" />
|
|
65
|
+
</EmptyState>
|
|
60
66
|
) : (
|
|
61
67
|
<Card>
|
|
62
68
|
<CardHeader>
|