tokentrace 0.9.0 → 0.10.0
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 +30 -0
- package/CONTRIBUTING.md +18 -0
- package/README.md +52 -1
- 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/guide/page.tsx +596 -0
- package/app/page.tsx +68 -22
- package/bin/tokentrace.js +22 -0
- package/components/charts/trend-chart.tsx +116 -19
- package/components/charts/trend-section.tsx +77 -0
- package/components/period-filter.tsx +5 -4
- package/components/sidebar.tsx +2 -0
- package/dist/runtime/agent.mjs +390 -0
- package/dist/runtime/digest.mjs +55 -7
- package/dist/runtime/doctor.mjs +55 -7
- package/dist/runtime/insights.mjs +55 -7
- package/dist/runtime/report.mjs +55 -7
- package/dist/runtime/review.mjs +55 -7
- package/dist/runtime/roadmap.mjs +196 -0
- package/dist/runtime/status.mjs +17 -15
- package/docs/agent-discovery.schema.json +222 -0
- package/docs/assets/claude-statusline.svg +2 -2
- package/llms.txt +42 -0
- package/package.json +6 -1
- 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/smoke-cli.mjs +15 -0
- package/scripts/smoke-packed-install.mjs +74 -2
- 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/date-range.ts +5 -4
- package/src/lib/first-run-status.ts +71 -5
- package/src/lib/roadmap-status.ts +185 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to TokenTrace are documented here.
|
|
4
4
|
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
## [0.10.0] - 2026-05-18
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- In-app Guide page covering first scan setup, Claude Code status-line installation, status-line label meanings, page workflows, privacy, and troubleshooting.
|
|
12
|
+
- `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.
|
|
13
|
+
- Local dashboard discovery endpoints at `/api/agent` and `/api/capabilities` returning the same manifest.
|
|
14
|
+
- `tokentrace roadmap --json` and `/api/roadmap` for machine-readable 0.10.0 implementation status, evidence paths, verification gates, and release status.
|
|
15
|
+
- Package-level agent discovery references: `TOKENTRACE_AGENT.md`, `llms.txt`, and `docs/agent-discovery.schema.json`.
|
|
16
|
+
- Repo-level agent instructions for Codex and Claude Code requiring Superpowers, ProjScan, changelog discipline, and explicit maintainer approval before releases.
|
|
17
|
+
- 0.10.0 Guided Operator roadmap for in-app guidance, status-line clarity, trend continuity, release-safe agent workflow, and verification gates.
|
|
18
|
+
- 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.
|
|
19
|
+
- Guide release-readiness and empty-state sections covering roadmap gates, release status, no data, missing logs, unknown pricing, parser warnings, and sandbox smoke skips.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Guide now shows live local setup status for latest scan, imported records, unknown costs, and priced model coverage.
|
|
24
|
+
- Agent discovery follow-up commands are now structured as command arrays instead of shell strings.
|
|
25
|
+
- 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.
|
|
26
|
+
- Package inspection and packed-install smoke now enforce the agent discovery docs, schema, executable CLI bin, and 0.10.0 release-status contract.
|
|
27
|
+
- Overview metric cards now show inline trust annotations explaining processed, non-cache, cached, cost, and session counts near the numbers.
|
|
28
|
+
- 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.
|
|
29
|
+
- Usage Pulse now suppresses extreme percentage labels when the previous comparison baseline is too small to be useful.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- Token and cost trend charts now include explicit zero-value calendar days between imported usage days instead of visually skipping idle periods.
|
|
34
|
+
|
|
5
35
|
## [0.9.0] - 2026-05-13
|
|
6
36
|
|
|
7
37
|
### 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
|
@@ -34,6 +34,11 @@ tokentrace # Start local dashboard
|
|
|
34
34
|
tokentrace serve # Start local dashboard
|
|
35
35
|
tokentrace serve --port 3210 --no-open
|
|
36
36
|
# Start on a fixed port without opening a browser
|
|
37
|
+
tokentrace agent --json # Print machine-readable agent discovery manifest
|
|
38
|
+
tokentrace capabilities --json
|
|
39
|
+
# Alias for agent discovery manifest
|
|
40
|
+
tokentrace roadmap --json
|
|
41
|
+
# Print 0.10.0 release implementation status
|
|
37
42
|
tokentrace scan # Scan local AI CLI usage logs
|
|
38
43
|
tokentrace doctor --json
|
|
39
44
|
# Inspect scan health and repair recommendations
|
|
@@ -72,6 +77,48 @@ tokentrace --help # Print help
|
|
|
72
77
|
tokentrace --version # Print version
|
|
73
78
|
```
|
|
74
79
|
|
|
80
|
+
## For Coding Agents
|
|
81
|
+
|
|
82
|
+
Agents should start with the read-only discovery manifest:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
tokentrace agent --json
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The alias below returns the same manifest:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
tokentrace capabilities --json
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The manifest describes TokenTrace's local-first privacy model, safe JSON commands,
|
|
95
|
+
common workflows, Claude Code status-line setup, Codex sidecar fallback, and
|
|
96
|
+
guardrails such as never running `tokentrace reset` without explicit human
|
|
97
|
+
approval. The discovery command does not scan files, initialize the database, or
|
|
98
|
+
start the dashboard.
|
|
99
|
+
|
|
100
|
+
Package-level agent references are included for agents that inspect repository
|
|
101
|
+
or npm package contents before invoking commands:
|
|
102
|
+
|
|
103
|
+
- [TOKENTRACE_AGENT.md](TOKENTRACE_AGENT.md)
|
|
104
|
+
- [llms.txt](llms.txt)
|
|
105
|
+
- [docs/agent-discovery.schema.json](docs/agent-discovery.schema.json)
|
|
106
|
+
|
|
107
|
+
When the local dashboard is already running, agents can fetch the same manifest
|
|
108
|
+
over localhost:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
curl http://127.0.0.1:3030/api/agent
|
|
112
|
+
curl http://127.0.0.1:3030/api/capabilities
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The 0.10.0 release status is also machine-readable:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
tokentrace roadmap --json
|
|
119
|
+
curl http://127.0.0.1:3030/api/roadmap
|
|
120
|
+
```
|
|
121
|
+
|
|
75
122
|
## Run From Source
|
|
76
123
|
|
|
77
124
|
```bash
|
|
@@ -98,6 +145,10 @@ npm run verify # Run Vitest, TypeScript, and ESLint checks
|
|
|
98
145
|
npm run package:test # Verify, build, and dry-run the npm package
|
|
99
146
|
npm run package:inspect
|
|
100
147
|
# Check package transparency guardrails
|
|
148
|
+
npm run smoke:packed
|
|
149
|
+
# Inspect packed tarball and smoke test packed CLI
|
|
150
|
+
tokentrace roadmap --json
|
|
151
|
+
# Inspect 0.10.0 evidence gates and release status
|
|
101
152
|
```
|
|
102
153
|
|
|
103
154
|
Release work uses internal milestone commits until the next public minor
|
|
@@ -202,7 +253,7 @@ tokentrace statusline claude
|
|
|
202
253
|
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
254
|
|
|
204
255
|
```text
|
|
205
|
-
TokenTrace | Opus |
|
|
256
|
+
TokenTrace | Opus | ctx 7% | cost $0.1235 | processed 3.3K tokens | cache 2.0K | priced
|
|
206
257
|
```
|
|
207
258
|
|
|
208
259
|
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.
|
|
@@ -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
|
+
}
|