tokentrace 0.14.1 → 0.15.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 CHANGED
@@ -4,6 +4,43 @@ All notable changes to TokenTrace are documented here.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [0.15.0] - 2026-05-22
8
+
9
+ ### Changed
10
+
11
+ - Bumped minimum Node.js to 20.0.0 (Node 18 LTS reached end of life on 2025-04-30). This is a breaking change for users still on Node 18.
12
+ - Upgraded `better-sqlite3` from 11 to 12 (latest major).
13
+ - Upgraded `lucide-react` from 0.468 to 1.16 (first stable major release).
14
+ - Upgraded `open` from 10 to 11 (now requires Node 20+, aligns with engines bump).
15
+ - Bumped minor/patch versions for `tsx`, `postcss`, `autoprefixer`, `@types/react`, `@types/node`.
16
+
17
+ ### Fixed
18
+
19
+ - `sqlite-history` adapter now uses SQLite identifier quoting (`""`) instead of `JSON.stringify()` when interpolating user table names into raw queries. Previously, a table name containing a quote could have caused a SQL parse error during read-only ingestion.
20
+ - Made `eslint-plugin-react-hooks` an explicit devDependency so lint setup no longer relies on accidental dependency hoisting from `eslint-config-next`.
21
+ - Raised global Vitest `testTimeout`/`hookTimeout` to 30s and bumped per-test/spawn timeouts in CLI subprocess tests (`mcp-server`, `serve-command`, `statusline-cli`) so they are no longer flaky under macOS process-spawn latency.
22
+
23
+ ### Documentation
24
+
25
+ - Added a Troubleshooting section to the README covering the `prebuild-install` deprecation warning from `better-sqlite3`, native build errors, and `EBADENGINE` warnings.
26
+
27
+ ## [0.14.2] - 2026-05-21
28
+
29
+ ### Added
30
+
31
+ - Added `get_agent_guide` to the MCP server with registry install snippets, recommended agent workflows, copy-paste `AGENTS.md` guidance, and local-first guardrails.
32
+ - Added `tokentrace mcp selftest --json` to verify MCP initialization, tool listing, agent guide output, and scan-confirmation refusal without scanning files.
33
+ - Added `docs/agent-adoption.md` with MCP setup instructions and evidence-backed recipes for coding agents.
34
+
35
+ ### Changed
36
+
37
+ - MCP tool responses now include an agent-oriented envelope with summary, confidence, next actions, warnings, evidence hints, human-confirmation state, and the underlying data payload.
38
+ - Package inspection and CLI smoke checks now verify the MCP agent guide, self-test, and adoption documentation.
39
+
40
+ ### Fixed
41
+
42
+ - Data-backed CLI command help now prints before touching local runtime state, so `tokentrace scan --help`, `doctor --help`, `evidence --help`, `repair --help`, and related commands stay safe on broken or fresh local databases.
43
+
7
44
  ## [0.14.1] - 2026-05-20
8
45
 
9
46
  ### Fixed
package/README.md CHANGED
@@ -105,6 +105,7 @@ or npm package contents before invoking commands:
105
105
 
106
106
  - [TOKENTRACE_AGENT.md](TOKENTRACE_AGENT.md)
107
107
  - [llms.txt](llms.txt)
108
+ - [docs/agent-adoption.md](docs/agent-adoption.md)
108
109
  - [docs/agent-discovery.schema.json](docs/agent-discovery.schema.json)
109
110
 
110
111
  MCP-capable clients can start the local stdio server after installing or using
@@ -114,6 +115,16 @@ the npm package:
114
115
  tokentrace mcp
115
116
  ```
116
117
 
118
+ Registry name: `io.github.abhiyoheswaran1/tokentrace`.
119
+
120
+ First MCP call for agents: `get_agent_guide`.
121
+
122
+ Self-test the local MCP entrypoint without scanning files:
123
+
124
+ ```bash
125
+ tokentrace mcp selftest --json
126
+ ```
127
+
117
128
  The MCP server exposes the same local-first surfaces as tools: capabilities,
118
129
  status, Scan Health, evidence, repair queue, reports, and an explicit scan tool.
119
130
  It does not scan files on startup, and its scan tool requires
@@ -233,8 +244,6 @@ The CLI sets `TOKENTRACE_DB` and `DATABASE_URL` automatically. You can override
233
244
  TOKENTRACE_HOME=/custom/path tokentrace
234
245
  ```
235
246
 
236
- If `npm install -g tokentrace` prints a `prebuild-install` deprecation warning, it is from the native SQLite dependency chain used by `better-sqlite3`. The install should continue normally, and TokenTrace still runs locally.
237
-
238
247
  ## Where TokenTrace Looks
239
248
 
240
249
  Default discovery checks these locations when present:
@@ -467,6 +476,28 @@ The ingestion system is intentionally pluggable:
467
476
 
468
477
  Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for local setup, parser guidelines, pricing update notes, and the release policy.
469
478
 
479
+ ## Troubleshooting
480
+
481
+ ### `prebuild-install` deprecation warning during install
482
+
483
+ ```
484
+ npm warn deprecated prebuild-install@7.1.3: No longer maintained...
485
+ ```
486
+
487
+ This is a transitive dependency of `better-sqlite3` (the native SQLite driver TokenTrace uses to store local data). The warning is harmless — the install completes normally and TokenTrace runs as expected. It will go away once `better-sqlite3` upstream migrates to a different prebuilt binary loader; there is nothing to fix on the TokenTrace side.
488
+
489
+ ### Native build errors on `better-sqlite3`
490
+
491
+ If the prebuilt binary cannot be downloaded (offline machine, restrictive proxy, unsupported Node ABI), `better-sqlite3` will try to compile from source and may fail. Workarounds:
492
+
493
+ - Ensure Node.js is a supported LTS (TokenTrace requires `>= 20.0.0`; Node 20 or 22 LTS is recommended).
494
+ - Install build tools: Xcode Command Line Tools on macOS, `build-essential` and `python3` on Linux, or the "Desktop development with C++" workload on Windows.
495
+ - Retry the install with network access to `github.com` so the prebuilt binary can be fetched.
496
+
497
+ ### `EBADENGINE` warnings
498
+
499
+ These appear when your local Node version is older than the `engines` field of a transitive dependency. They are warnings, not errors. Upgrading to the latest Node LTS resolves them.
500
+
470
501
  ## Known Limitations
471
502
 
472
503
  - Claude Code and Codex CLI log formats are inferred defensively and may need refinement with real sample logs.
@@ -25,6 +25,21 @@ MCP-capable clients can use the local stdio server:
25
25
  tokentrace mcp
26
26
  ```
27
27
 
28
+ MCP registry name:
29
+
30
+ ```text
31
+ io.github.abhiyoheswaran1/tokentrace
32
+ ```
33
+
34
+ Agents should call `get_agent_guide` first. It returns the recommended workflow,
35
+ install snippets, copy-paste `AGENTS.md` guidance, and local-first guardrails.
36
+
37
+ Verify the MCP entrypoint without scanning files:
38
+
39
+ ```bash
40
+ tokentrace mcp selftest --json
41
+ ```
42
+
28
43
  The MCP server does not scan on startup. Its `run_scan` tool requires
29
44
  `confirmLocalScan=true` before reading local usage files or writing the local
30
45
  database.
@@ -53,19 +68,25 @@ curl http://127.0.0.1:3030/api/roadmap
53
68
  tokentrace agent --json
54
69
  ```
55
70
 
56
- 2. Refresh local data when the human expects current usage:
71
+ 2. In MCP clients, ask for the operating loop:
72
+
73
+ ```text
74
+ get_agent_guide
75
+ ```
76
+
77
+ 3. Refresh local data when the human expects current usage:
57
78
 
58
79
  ```bash
59
80
  tokentrace scan --json
60
81
  ```
61
82
 
62
- 3. Check trust before making claims:
83
+ 4. Check trust before making claims:
63
84
 
64
85
  ```bash
65
86
  tokentrace doctor --json
66
87
  ```
67
88
 
68
- 4. Explain totals with evidence:
89
+ 5. Explain totals with evidence:
69
90
 
70
91
  ```bash
71
92
  tokentrace evidence --json
@@ -148,6 +148,14 @@ const roadmapSteps = [
148
148
  ["Dashboard API", "/api/roadmap", "Fetch the same roadmap status from a running local dashboard."]
149
149
  ];
150
150
 
151
+ const mcpAgentEntries = [
152
+ ["Registry", "io.github.abhiyoheswaran1/tokentrace", "Use this name when an MCP client discovers TokenTrace from the registry."],
153
+ ["Start", "tokentrace mcp", "Start the local stdio MCP server. Startup is read-only and does not scan files."],
154
+ ["First tool", "get_agent_guide", "Return the recommended operating loop, install snippets, and AGENTS.md copy block."],
155
+ ["Self-test", "tokentrace mcp selftest --json", "Verify MCP initialization, tool listing, guide output, and scan refusal."],
156
+ ["Scan rule", "confirmLocalScan=true", "Only pass this to run_scan when the human expects a local filesystem scan."]
157
+ ];
158
+
151
159
  const workflows = [
152
160
  {
153
161
  problem: "No records imported",
@@ -506,6 +514,27 @@ export default function GuidePage() {
506
514
  </p>
507
515
  </div>
508
516
  </div>
517
+ <div className="border-t p-4">
518
+ <div className="flex items-center gap-2">
519
+ <LockKeyhole className="h-4 w-4 text-primary" />
520
+ <h3 className="text-sm font-semibold leading-tight">MCP for agents</h3>
521
+ </div>
522
+ <p className="mt-2 max-w-[72ch] text-sm leading-6 text-muted-foreground">
523
+ MCP clients should connect locally, call <MonoText>get_agent_guide</MonoText> first, and use evidence before reporting
524
+ token, cost, model, or session numbers. The full copy-paste workflow lives in <MonoText>docs/agent-adoption.md</MonoText>.
525
+ </p>
526
+ <div className="mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-5">
527
+ {mcpAgentEntries.map(([label, value, detail]) => (
528
+ <div key={label} className="rounded-md border bg-muted/30 p-3">
529
+ <FieldLabel>{label}</FieldLabel>
530
+ <div className="mt-2 min-h-10 break-words text-sm font-medium leading-5">
531
+ <MonoText>{value}</MonoText>
532
+ </div>
533
+ <p className="mt-2 text-xs leading-5 text-muted-foreground">{detail}</p>
534
+ </div>
535
+ ))}
536
+ </div>
537
+ </div>
509
538
  <div className="border-t p-4">
510
539
  <h3 className="text-sm font-semibold leading-tight">Agent quickstart</h3>
511
540
  <div className="table-scroll mt-3">
@@ -135,11 +135,13 @@ var commands = [
135
135
  startsLongRunningProcess: true,
136
136
  requiresNetwork: false,
137
137
  safeForAutomation: false,
138
- useWhen: "An MCP-capable agent or client wants structured access to TokenTrace status, doctor, evidence, repair, report, and explicit scan tools.",
138
+ useWhen: "An MCP-capable agent or client wants structured access to TokenTrace guidance, status, doctor, evidence, repair, report, and explicit scan tools.",
139
139
  followUps: [
140
+ ["tokentrace", "mcp", "selftest", "--json"],
140
141
  ["tokentrace", "agent", "--json"]
141
142
  ],
142
143
  notes: [
144
+ "Agents should call get_agent_guide first after connecting through MCP.",
143
145
  "The MCP server itself does not scan files on startup.",
144
146
  "The run_scan MCP tool requires confirmLocalScan=true before reading local usage files and writing the local database."
145
147
  ]