token-pilot 0.19.0 → 0.19.2
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 +607 -575
- package/README.md +1 -1
- package/dist/ast-index/binary-manager.d.ts +3 -3
- package/dist/ast-index/binary-manager.js +74 -11
- package/dist/ast-index/client.d.ts +5 -1
- package/dist/ast-index/client.js +9 -2
- package/dist/handlers/session-snapshot.d.ts +1 -0
- package/dist/handlers/session-snapshot.js +6 -0
- package/dist/hooks/installer.d.ts +7 -1
- package/dist/hooks/installer.js +63 -33
- package/dist/index.js +38 -21
- package/dist/server/tool-definitions.d.ts +27 -0
- package/dist/server/tool-definitions.js +2 -1
- package/package.json +87 -87
package/CHANGELOG.md
CHANGED
|
@@ -1,575 +1,607 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to Token Pilot will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [0.19.
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- **
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- **
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
- **
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- **
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- **
|
|
109
|
-
- **
|
|
110
|
-
- **
|
|
111
|
-
- **
|
|
112
|
-
- **
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
- **
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
- **
|
|
131
|
-
- **
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
- **
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
- **
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
- **`
|
|
152
|
-
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
- **`
|
|
162
|
-
-
|
|
163
|
-
- **
|
|
164
|
-
|
|
165
|
-
### Changed
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
- **`
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
- **`
|
|
174
|
-
- **`
|
|
175
|
-
- **`
|
|
176
|
-
- **`
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
- **`
|
|
184
|
-
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
- **
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
###
|
|
198
|
-
- **
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
-
|
|
219
|
-
- **
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
- **
|
|
224
|
-
- **MCP instructions** — added "COMBINE BOTH" section
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
- **
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
- **
|
|
236
|
-
- **
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
- **
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
- **
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
- **
|
|
263
|
-
- **
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
- **
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
- **
|
|
273
|
-
- **
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
- **
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
- **
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
- **read_for_edit** —
|
|
295
|
-
- **
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
- **
|
|
305
|
-
- **
|
|
306
|
-
-
|
|
307
|
-
|
|
308
|
-
## [0.6.
|
|
309
|
-
|
|
310
|
-
###
|
|
311
|
-
- **
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
- **
|
|
324
|
-
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
- **
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
- **
|
|
344
|
-
|
|
345
|
-
## [0.
|
|
346
|
-
|
|
347
|
-
###
|
|
348
|
-
- **`
|
|
349
|
-
- **`
|
|
350
|
-
- **`session_analytics
|
|
351
|
-
|
|
352
|
-
## [0.
|
|
353
|
-
|
|
354
|
-
###
|
|
355
|
-
-
|
|
356
|
-
- **`
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
- **
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
- **`
|
|
366
|
-
- **`
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
###
|
|
380
|
-
-
|
|
381
|
-
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
-
|
|
388
|
-
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
- **
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
-
|
|
398
|
-
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
-
|
|
404
|
-
|
|
405
|
-
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
- **
|
|
413
|
-
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
- **
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
-
|
|
424
|
-
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
- **
|
|
430
|
-
- **
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
###
|
|
435
|
-
-
|
|
436
|
-
-
|
|
437
|
-
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
- **
|
|
444
|
-
- **
|
|
445
|
-
- **
|
|
446
|
-
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
- **
|
|
453
|
-
- **
|
|
454
|
-
- **
|
|
455
|
-
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
-
|
|
461
|
-
-
|
|
462
|
-
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
###
|
|
467
|
-
-
|
|
468
|
-
-
|
|
469
|
-
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
- **
|
|
484
|
-
- **
|
|
485
|
-
- **
|
|
486
|
-
- **
|
|
487
|
-
- **
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
###
|
|
492
|
-
-
|
|
493
|
-
- `
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
-
|
|
506
|
-
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
- ast-index
|
|
525
|
-
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
- `
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
-
|
|
539
|
-
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Token Pilot will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.19.2] - 2026-04-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **npm-first binary install** — `install-ast-index` now tries `npm install -g @ast-index/cli` before falling back to GitHub download. Works on all platforms including Windows (no more "ZIP extraction not supported" error).
|
|
12
|
+
- **npm binary discovery** — `findBinary` now checks the npm global prefix (`npm config get prefix`) as a 3rd resolution strategy: config → system PATH → npm global → managed install.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- **Hook installer uses absolute paths** — hooks now write `<node> <script> hook-read` instead of bare `token-pilot hook-read`. Fixes `token-pilot: not found` in `/bin/sh` environments (nvm, npx, non-login shells).
|
|
16
|
+
- **Skip auto-install when running as plugin** — when `CLAUDE_PLUGIN_ROOT` is set, the MCP server no longer writes duplicate hooks into `.claude/settings.json`.
|
|
17
|
+
- **Auto-upgrade broken hooks** — old hooks with bare `token-pilot` commands are automatically replaced with absolute-path versions on next server start.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- **`BinaryStatus.source`** now includes `'npm'` as a value (shown in `doctor` and `session_analytics`).
|
|
21
|
+
- **`search()` supports `--type` filter** — filter results by symbol type (`class`, `function`, `interface`, etc.). Leverages ast-index ≥3.30.0.
|
|
22
|
+
- **`hierarchy()` supports `--in-file` / `--module` filters** — scope class hierarchy queries by filename or module path. Leverages ast-index ≥3.30.0.
|
|
23
|
+
- **498 tests** (was 492).
|
|
24
|
+
|
|
25
|
+
## [0.19.1] - 2026-04-15
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- **`decisions` field in `session_snapshot`** — stores key decisions with reasoning (e.g., "removed sysfee step — caused double counting"). Prevents the model from revisiting rejected approaches after context compaction.
|
|
29
|
+
|
|
30
|
+
## [0.19.0] - 2026-04-15
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- **`session_snapshot` tool** — capture current session state (goal, confirmed facts, files, blockers, next step) as a compact markdown block (<200 tokens). Call before context compaction or when switching direction in long sessions.
|
|
34
|
+
- **`max_tokens` parameter** on `smart_read` and `smart_read_many` — token budget per read. Output auto-downgrades through three levels: full content → structural outline → compact (symbol names + line ranges only). Enables context-constrained sessions.
|
|
35
|
+
- **Session compaction advisory** — policy engine now tracks total tool calls and tokens returned. Advises calling `session_snapshot()` when thresholds are reached (default: every 15 calls or after 8,000 tokens). Configurable via `compactionCallThreshold` and `compactionTokenThreshold`.
|
|
36
|
+
- **"Why This Approach Works"** section in README explaining the 3-level optimization strategy.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- **21 tools** (was 20) — added `session_snapshot`.
|
|
40
|
+
- **MCP instructions** updated with `session_snapshot` workflow and `max_tokens` guidance.
|
|
41
|
+
- Benchmark numbers updated: 55 files, 102K raw → 9K outline tokens (91% savings).
|
|
42
|
+
|
|
43
|
+
## [0.18.1] - 2026-04-13
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- **Hook installer uses absolute paths** — hooks now write `<node> <script> hook-read` instead of bare `token-pilot hook-read`. Fixes `token-pilot: not found` errors in `/bin/sh` environments (nvm, npx, non-login shells).
|
|
47
|
+
- **Skip auto-install when running as plugin** — when `CLAUDE_PLUGIN_ROOT` is set, the MCP server no longer writes duplicate hooks into `.claude/settings.json` (the plugin system handles this via `hooks.json`).
|
|
48
|
+
- **Auto-upgrade broken hooks** — old hooks with bare `token-pilot` commands are automatically replaced with absolute-path versions on next server start.
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
- **495 tests** (was 492).
|
|
52
|
+
|
|
53
|
+
## [0.18.0] - 2026-04-05
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
- **`read_section` tool** — read a specific section from Markdown, YAML, JSON, or CSV files. Markdown: by heading name. YAML/JSON: by top-level key. CSV: by row range (`rows:1-50`). Much cheaper than reading the whole file.
|
|
57
|
+
- **`read_for_edit` section parameter** — prepare edit context for non-code file sections. Works with all 4 formats.
|
|
58
|
+
- **Markdown outline with line ranges** — `smart_read` on `.md` files now shows `[L5-20]` ranges and hints for `read_section`.
|
|
59
|
+
- **YAML/JSON section ranges** — `smart_read` on `.yaml`/`.json` shows top-level key ranges.
|
|
60
|
+
- **CSV smart_read** — shows columns, row count, sample rows, and hints for row-range reading.
|
|
61
|
+
- **4 section parsers** — `markdown-sections.ts`, `yaml-sections.ts`, `json-sections.ts`, `csv-sections.ts`.
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
- **20 tools** (was 19) — added `read_section`.
|
|
65
|
+
- **492 tests** (was 441).
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
- `npm audit` — resolved brace-expansion, path-to-regexp, picomatch vulnerabilities.
|
|
69
|
+
|
|
70
|
+
## [0.17.0] - 2026-04-02
|
|
71
|
+
|
|
72
|
+
### Added
|
|
73
|
+
- **`smart_read` scope parameter** — `scope="nav"` returns names + line ranges only (2-3x smaller), `scope="exports"` shows only public API. Default `scope="full"` unchanged.
|
|
74
|
+
- **`smart_read` auto-delta** — when a file changed since last load (within 120s), shows ADDED/REMOVED/UNCHANGED symbols instead of full re-read. Config: `smartRead.autoDelta.enabled`.
|
|
75
|
+
- **`read_symbol` include_edit_context** — optional `include_edit_context=true` appends raw code block (max 60 lines) to save a separate `read_for_edit` call. Large symbols fall back to `read_for_edit`.
|
|
76
|
+
- **`find_usages` mode=list** — compact `file:line` output for initial discovery, 5-10x smaller than full mode.
|
|
77
|
+
- **`smart_read_many` per-file dedup** — skips files already in context and unchanged, returns compact reminder instead.
|
|
78
|
+
- **Actionable hints** — `read_for_edit` suggests `read_diff` after editing. Config: `display.actionableHints`.
|
|
79
|
+
- **`symbol-display-constants.ts`** — shared display constants for symbol rendering.
|
|
80
|
+
|
|
81
|
+
### Changed
|
|
82
|
+
- **441 tests** (was 427) — new tests for scope, list mode, include_edit_context, dedup.
|
|
83
|
+
- **MCP instructions** updated with scope/mode/include_edit_context guidance.
|
|
84
|
+
- **find_usages context rendering** — sequential instead of concurrent to prevent shared cache race condition.
|
|
85
|
+
|
|
86
|
+
## [0.16.1] - 2026-03-21
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
- **Hook interception tracking** — PreToolUse hook now records denied Read calls (file path, line count, estimated tokens) to `.token-pilot/hook-denied.jsonl`. Session analytics shows how many tokens the hook saved by intercepting unbounded reads on large code files.
|
|
90
|
+
- **`session_analytics` hook savings** — compact report adds "Hook: intercepted N reads, saved ~X tokens" line. Verbose mode shows per-file breakdown of intercepted reads.
|
|
91
|
+
|
|
92
|
+
## [0.16.0] - 2026-03-21
|
|
93
|
+
|
|
94
|
+
### Added
|
|
95
|
+
- **`read_symbols` tool** — batch read multiple symbols from one file in a single call (max 10). File is read once, AST resolved once. Saves N-1 round-trips vs calling `read_symbol` N times.
|
|
96
|
+
- **`read_for_edit` batch mode** — new `symbols` array parameter reads multiple symbol edit contexts in one call. Each symbol returns raw code ready for Edit tool's `old_string`.
|
|
97
|
+
- **`find_usages` context_lines** — new `context_lines` parameter (0-10) shows surrounding source code for each match. Eliminates follow-up `read_symbol` calls after finding usages.
|
|
98
|
+
- **`smart_diff` affected symbols summary** — consolidated "AFFECTED SYMBOLS" section at the top of diff output, grouped by MODIFIED/ADDED/REMOVED. See all changed functions/classes at a glance.
|
|
99
|
+
|
|
100
|
+
### Changed
|
|
101
|
+
- **19 tools** (was 18) — added `read_symbols`.
|
|
102
|
+
- **MCP instructions** — added batch read_symbols to decision rules and refactor workflow.
|
|
103
|
+
- **427 tests** (unchanged — all pass with new features).
|
|
104
|
+
|
|
105
|
+
## [0.15.0] - 2026-03-19
|
|
106
|
+
|
|
107
|
+
### Added
|
|
108
|
+
- **Regex fallback parser (TS/JS)** — `smart_read` now works for TypeScript/JavaScript files even without ast-index binary. Parses classes, functions, interfaces, types, enums, and class methods via regex. Zero dependencies, 130 lines. Covers ~80% of new users who fail to download ast-index.
|
|
109
|
+
- **Regex fallback parser (Python)** — `smart_read` now works for Python files without ast-index. Parses classes, functions, async functions, decorators (`@dataclass`, `@app.route`), module constants (`UPPER_CASE`), methods with visibility detection (`_private`, `__dunder__`). 150 lines.
|
|
110
|
+
- **Benchmark script** — `scripts/benchmark.ts` measures real token savings on public repos (express, fastify, flask). 92% average savings across 97 files ≥50 lines. Run: `npx tsx scripts/benchmark.ts`.
|
|
111
|
+
- **Guide skill** — `/guide` command shows a quick-reference table of all Token Pilot tools with usage examples and recommended workflow.
|
|
112
|
+
- **`hooks.denyThreshold` config** — hook deny threshold is now configurable in `.token-pilot.json` (default: 300, was hardcoded 500). Intercepts ~2x more native Read calls.
|
|
113
|
+
|
|
114
|
+
### Changed
|
|
115
|
+
- **Compact session analytics** — `session_analytics` report reduced from ~30 lines to ~5 lines. Shows calls, tokens saved, top 5 tools, top 3 files, cache hit rate on a single screen. Verbose mode (`verbose=true`) restores full breakdown.
|
|
116
|
+
- **`server.ts` refactor** — extracted tool definitions to `server/tool-definitions.ts` and token estimate helpers to `server/token-estimates.ts` (−500 lines from server.ts).
|
|
117
|
+
- **`find_usages` output** — results grouped by file with compact rendering. Single match per file on one line, multiple matches indented under file header.
|
|
118
|
+
- **Stale references** — all `grep_search` hints updated to `Grep` (code-audit, find-unused, find-usages).
|
|
119
|
+
- **README** — benchmark table with real data from 4 public repos. Updated savings claims from 80% to 90% (backed by benchmark).
|
|
120
|
+
- **427 tests** (was 393).
|
|
121
|
+
|
|
122
|
+
### Fixed
|
|
123
|
+
- **`npx token-pilot` CLI** — symlink path resolution in `isDirectRun` check. All CLI commands now work correctly via npx.
|
|
124
|
+
- **Regex fallback was dead code** — parsers existed but weren't wired into `client.ts` `outline()` method. Now properly called as fallback when ast-index unavailable.
|
|
125
|
+
|
|
126
|
+
## [0.14.1] - 2026-03-14
|
|
127
|
+
|
|
128
|
+
### Fixed
|
|
129
|
+
- **CI: Node.js 24 runtime** — opted into `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24` for GitHub Actions, resolving deprecation warnings for `actions/checkout@v4` and `actions/setup-node@v4`.
|
|
130
|
+
- **CI: test matrix** — updated from Node 18+22 to Node 20+22 (Node 18 is EOL).
|
|
131
|
+
- **Test: git commit in CI** — `read-for-edit` tests now pass `-c user.name` / `-c user.email` to `git commit`, fixing failures in environments without global git config.
|
|
132
|
+
|
|
133
|
+
## [0.14.0] - 2026-03-14
|
|
134
|
+
|
|
135
|
+
### Added
|
|
136
|
+
- **R&D Track 0: Instrumentation** — per-call decision trace capturing file size, context state, estimated vs actual cost, and cheaper alternative suggestions. Integrated into all 18 tool handlers via `recordWithTrace()`.
|
|
137
|
+
- **R&D Track 1: Budget Planner** — advisory layer suggesting cheaper tool alternatives (e.g. `smart_read` → `read_diff` when file already in context, → `read_symbol` when symbol known). Analytics-only, no blocking.
|
|
138
|
+
- **R&D Track 2: Intent Router** — classifies tool calls into 7 intents (edit/debug/explore/review/analyze/search/read). Per-intent breakdown in session analytics.
|
|
139
|
+
- **R&D Track 3: Edit Prep Mode** — `read_for_edit` with `include_callers`, `include_tests`, `include_changes` enrichment options.
|
|
140
|
+
- **R&D Track 4: Session Cache** — tool-result-level caching with file/AST/git invalidation.
|
|
141
|
+
- **R&D Track 5: Confidence-Based Escalation** — confidence metadata (high/medium/low) appended to `smart_read`, `read_symbol`, `read_for_edit`, `find_usages` responses. Shows known unknowns and suggested next steps.
|
|
142
|
+
- **R&D Track 6: Working Set / Dedup** — compact reminders for already-loaded files and symbols.
|
|
143
|
+
- **R&D Track 7: Related Files Ranking** — scored ranking with 6 signals (test +5, import +4, importer +3, same-dir +2, recently-changed +2, multi-ref +1). HIGH VALUE / MEDIUM / LOW buckets.
|
|
144
|
+
- **R&D Track 8: Architecture Fingerprint** — caches architecture in `.token-pilot-fingerprint.json` (24h TTL). Amortizes `project_overview` cost across sessions.
|
|
145
|
+
- **R&D Track 9: Verified Savings Dashboard** — savings breakdown by category (compression/cache/dedup), session cache hit rate, dedup stats.
|
|
146
|
+
- **R&D Track 10: Team Policy Mode** — configurable policies: `preferCheapReads`, `maxFullFileReads`, `warnOnLargeReads`, `requireReadForEditBeforeEdit`.
|
|
147
|
+
- **7 new core modules** — `confidence.ts`, `intent-classifier.ts`, `budget-planner.ts`, `decision-trace.ts`, `session-cache.ts`, `architecture-fingerprint.ts`, `policy-engine.ts`.
|
|
148
|
+
- **35 new tests** — confidence (11), architecture-fingerprint (11), policy-engine (13). Total: 393 tests.
|
|
149
|
+
|
|
150
|
+
### Changed
|
|
151
|
+
- **`session_analytics`** — per-intent breakdown, decision insights, savings by category.
|
|
152
|
+
- **`project_overview`** — saves/loads architecture fingerprint for cross-session caching.
|
|
153
|
+
- **Config** — added `policies` section to `TokenPilotConfig`.
|
|
154
|
+
|
|
155
|
+
## [0.13.0] - 2026-03-14
|
|
156
|
+
|
|
157
|
+
### Added
|
|
158
|
+
- **Version check for all components** — on startup, checks token-pilot (npm), ast-index (GitHub releases), and context-mode (npm) in parallel. Non-blocking, fire-and-forget. Shows update notifications in stderr.
|
|
159
|
+
- **`autoUpdate` config flag** — `updates.autoUpdate: true` in `.token-pilot.json` auto-downloads new ast-index binary on startup. Default: `false` (notify only). token-pilot and context-mode only notify (separate processes).
|
|
160
|
+
- **`checkBinaryUpdate()`** — compares installed ast-index version vs latest GitHub release.
|
|
161
|
+
- **`isNewerVersion()` utility** — semver comparison: strip `v` prefix, compare segments. Handles different lengths (`1.0` vs `1.0.1`).
|
|
162
|
+
- **Common Lisp extensions** — `.lisp`, `.lsp`, `.cl`, `.asd` added to `CODE_EXTENSIONS` for ast-index v3.28+ compatibility.
|
|
163
|
+
- **9 new tests** — `isNewerVersion()` covering major/minor/patch, same version, older, `v` prefix, different segment lengths, large numbers, real-world versions. Total: 217 tests.
|
|
164
|
+
|
|
165
|
+
### Changed
|
|
166
|
+
- **`doctor` command** — now shows 3 sections: token-pilot (installed/latest), ast-index (installed/latest/auto-update status), context-mode (detected/latest npm). Previously only showed ast-index binary status.
|
|
167
|
+
- **`install-ast-index` command** — now also updates existing binary if newer version available on GitHub.
|
|
168
|
+
- **`printHelp()`** — fixed tool count: 18 (was incorrectly showing 12 since v0.8.0).
|
|
169
|
+
- **Startup update check** — replaced single `checkLatestVersion()` with `checkAllUpdates()` covering all 3 components via `Promise.allSettled`.
|
|
170
|
+
|
|
171
|
+
### Fixed
|
|
172
|
+
- **`test_summary` PHPUnit parser** — now counts both `Failures:` and `Errors:` (was only counting failures).
|
|
173
|
+
- **`test_summary` cargo parser** — correctly identifies failure name-list section (no `----` markers) vs detail section.
|
|
174
|
+
- **`test_summary` token estimation** — uses shared `estimateTokens()` instead of local duplicate.
|
|
175
|
+
- **`smart_log` category detection** — `documentation` now matches docs pattern, `tests` (plural) matches test pattern, `optimize`/`optimization` match perf pattern.
|
|
176
|
+
- **`explore_area` path boundary** — `startsWith(path + '/')` prevents `src/auth` matching `src/authorize/`.
|
|
177
|
+
- **Validation consistency** — `validateSmartLogArgs` and `validateTestSummaryArgs` now use `optionalString`/`optionalNumber` helpers, reject empty strings, check integers.
|
|
178
|
+
|
|
179
|
+
## [0.11.0] - 2026-03-14
|
|
180
|
+
|
|
181
|
+
### Added
|
|
182
|
+
- **`smart_log` tool** — structured git log with commit category detection (feat/fix/refactor/docs/test/chore/style/perf). Shows author breakdown, file stats (+/-), per-commit file list. Filters by path and ref. Raw git log → compact summary.
|
|
183
|
+
- **`test_summary` tool** — runs test command and returns structured summary: total/passed/failed/skipped + failure details. Parsers for vitest, jest, pytest, phpunit, go test, cargo test, rspec, mocha + generic fallback. 200 lines of raw output → 10-15 lines.
|
|
184
|
+
- **38 new tests** — smart_log parser (5), categorizer (4), test_summary parsers (17), runner detection (8), validation (4). Total: 208 tests (was 170).
|
|
185
|
+
|
|
186
|
+
### Changed
|
|
187
|
+
- **18 tools** (was 16) — added `smart_log`, `test_summary`
|
|
188
|
+
- **MCP instructions** — added smart_log and test_summary to workflow guidance
|
|
189
|
+
|
|
190
|
+
## [0.10.0] - 2026-03-14
|
|
191
|
+
|
|
192
|
+
### Added
|
|
193
|
+
- **`smart_diff` tool** — structural git diff with AST symbol mapping. Shows which functions/classes were modified/added/removed instead of raw patch output. Supports scopes: `unstaged`, `staged`, `commit` (ref required), `branch` (ref required). Small diffs (<=30 lines) include actual hunks, large diffs show summary. Returns `rawTokens` for precise savings analytics.
|
|
194
|
+
- **`explore_area` tool** — one-call directory exploration combining outline + imports + tests + git changes. Replaces 3-5 separate tool calls when starting work on an area. Sections: `outline` (recursive depth 2), `imports` (external deps + who imports this area), `tests` (matching test/spec files), `changes` (recent git log). All sections run in parallel via `Promise.allSettled`.
|
|
195
|
+
- **26 new tests** — smart_diff parser (10), symbol mapping (5), validation (11). Total: 170 tests (was 144).
|
|
196
|
+
|
|
197
|
+
### Changed
|
|
198
|
+
- **16 tools** (was 14) — added `smart_diff`, `explore_area`
|
|
199
|
+
- **MCP instructions** — updated workflow: `project_overview → explore_area → smart_read → read_symbol → read_for_edit → edit → smart_diff`
|
|
200
|
+
- **`outlineDir` and `CODE_EXTENSIONS` exported** from outline.ts for reuse by explore_area
|
|
201
|
+
|
|
202
|
+
## [0.9.0] - 2026-03-08
|
|
203
|
+
|
|
204
|
+
### Added
|
|
205
|
+
- **`module_info` tool** — analyze module dependencies, dependents, public API, and unused deps. Uses ast-index v3.27.0 module commands (`modules`, `module-deps`, `module-dependents`, `module-api`, `unused-deps`). Includes degradation check when ast-index is unavailable.
|
|
206
|
+
- **`project_overview` dual-detection** — shows BOTH ast-index type detection AND config-file detection (package.json, composer.json, Cargo.toml, pyproject.toml, go.mod) with CONFIDENCE scoring (high/medium/low/unknown). Detects frameworks, quality tools (PHPStan, ESLint, Vitest, Jest, Biome, etc.), CI pipelines (GitHub Actions, GitLab CI, Jenkins), and Docker.
|
|
207
|
+
- **`project_overview` `include` parameter** — filter sections: `["stack"]` for quick type check, `["quality","ci"]` for tooling overview. Default: all sections.
|
|
208
|
+
- **`find_usages` post-filters** — `scope` (path prefix), `kind` (definitions/imports/usages), `lang` (14 languages by extension), `limit` (per category, 1-500). All filters optional, backward compatible.
|
|
209
|
+
- **`outline` recursive mode** — `recursive=true` with `max_depth` (default 2, max 5) recurses into subdirectories. At max depth shows file counts only.
|
|
210
|
+
- **`src/core/project-detector.ts`** — extracted config-based detection logic into reusable module. Framework detection maps for PHP (7), JS (10), Python (5). Quality tools scanner (13 tools). CI pipeline detector (6 platforms).
|
|
211
|
+
- **ast-index client: 5 module methods** — `modules()`, `moduleDeps()`, `moduleDependents()`, `unusedDeps()`, `moduleApi()` with JSON-first + text fallback parsing.
|
|
212
|
+
- **ast-index types: 4 module interfaces** — `AstIndexModuleEntry`, `AstIndexModuleDep`, `AstIndexUnusedDep`, `AstIndexModuleApi`.
|
|
213
|
+
|
|
214
|
+
### Fixed
|
|
215
|
+
- **`module_info` token savings** — `tokensWouldBe` was equal to `tokensReturned` (0% savings). Now estimates manual analysis cost correctly.
|
|
216
|
+
- **`outline` recursive overflow** — added `MAX_OUTLINE_LINES=500` guard to prevent runaway output on large projects with `recursive=true`.
|
|
217
|
+
- **`project_overview` "frontend" label** — removed hardcoded "frontend" suffix for secondary stacks (Node.js is not always frontend).
|
|
218
|
+
- **Ruff detection** — no longer double-reads `pyproject.toml`. Checks `ruff.toml`/`.ruff.toml` first, falls back to `pyproject.toml [tool.ruff]` only if needed.
|
|
219
|
+
- **44 new tests** — validators (23) + project-detector (21). Total: 144 tests (was 100).
|
|
220
|
+
|
|
221
|
+
### Changed
|
|
222
|
+
- **14 tools** (was 13) — added `module_info`
|
|
223
|
+
- **Tool descriptions** — updated with `(v1.1: ...)` version hints for enhanced tools
|
|
224
|
+
- **MCP instructions** — added module_info to "COMBINE BOTH" workflow section
|
|
225
|
+
- **Version sync** — package.json, plugin.json, marketplace.json all at 0.9.0
|
|
226
|
+
|
|
227
|
+
## [0.8.3] - 2026-03-08
|
|
228
|
+
|
|
229
|
+
### Fixed
|
|
230
|
+
- **code_audit pattern search — root cause fix** — `ast-index agrep` does not support `--limit` flag. Token Pilot was passing `--limit 50` which caused the command to fail silently, returning 0 results across v0.8.0–v0.8.2. Removed the flag; results are now limited via `.slice()` after parsing.
|
|
231
|
+
|
|
232
|
+
## [0.8.2] - 2026-03-08
|
|
233
|
+
|
|
234
|
+
### Fixed
|
|
235
|
+
- **code_audit pattern search** — inject `node_modules/.bin` into PATH so `ast-index agrep` can find `sg` (ast-grep) when it's installed as optional dependency but not in system PATH.
|
|
236
|
+
- **code_audit annotations** — strip `@` prefix from annotation names (`@Injectable` → `Injectable`). ast-index expects names without `@`.
|
|
237
|
+
|
|
238
|
+
## [0.8.1] - 2026-03-08
|
|
239
|
+
|
|
240
|
+
### Added
|
|
241
|
+
- **ast-grep auto-install** — `@ast-grep/cli` added as optional dependency. `code_audit(check="pattern")` now works out-of-the-box without manual `brew install ast-grep`.
|
|
242
|
+
- **MCP instructions: security audit guidance** — instructions now recommend Grep for security patterns (password, token, secret, credential) and `find_unused` for dead code detection.
|
|
243
|
+
|
|
244
|
+
### Changed
|
|
245
|
+
- **ast-index stats → JSON parsing** — `--format json` for reliable file count extraction instead of regex on text output.
|
|
246
|
+
|
|
247
|
+
## [0.8.0] - 2026-03-07
|
|
248
|
+
|
|
249
|
+
### Added
|
|
250
|
+
- **`code_audit` tool** — find code quality issues in one call: TODO/FIXME comments (`check="todo"`), deprecated symbols (`check="deprecated"`), structural code patterns via ast-grep (`check="pattern"`), decorator search (`check="annotations"`), or combined audit (`check="all"`).
|
|
251
|
+
- **Incremental index update on file changes** — file watcher now triggers `ast-index update` (debounced 2s) after edits. Keeps index fresh for find_usages, find_unused, code_audit.
|
|
252
|
+
- **ast-index client methods** — `agrep()`, `todo()`, `deprecated()`, `annotations()`, `incrementalUpdate()`.
|
|
253
|
+
|
|
254
|
+
### Fixed
|
|
255
|
+
- **smart_read on directories** — now returns helpful message instead of EISDIR crash.
|
|
256
|
+
- **MCP instructions** — added "COMBINE BOTH" section for audit tasks (Token Pilot + Grep).
|
|
257
|
+
|
|
258
|
+
## [0.7.6] - 2026-03-07
|
|
259
|
+
|
|
260
|
+
### Added
|
|
261
|
+
- **`npx token-pilot init`** — one command creates `.mcp.json` with both token-pilot and context-mode configured. Idempotent — safely updates existing configs without overwriting.
|
|
262
|
+
- **MCP Server Instructions** — protocol-level `instructions` field tells AI agents WHEN to use Token Pilot tools instead of built-in defaults. Works universally on all MCP clients.
|
|
263
|
+
- **Improved tool descriptions** — each tool explicitly states what built-in tool it replaces (e.g. "Use INSTEAD OF Read/cat").
|
|
264
|
+
|
|
265
|
+
### Fixed
|
|
266
|
+
- **3 high severity vulnerabilities** — updated hono and express-rate-limit.
|
|
267
|
+
- **npm package size** — excluded source maps from package. 505 kB → 286 kB (−43%).
|
|
268
|
+
- **Accurate thresholds** — README and instructions now correctly state smallFileThreshold=200 (was 80).
|
|
269
|
+
- **read_diff documentation** — clarified that smart_read must be called BEFORE editing to create baseline snapshot.
|
|
270
|
+
|
|
271
|
+
### Changed
|
|
272
|
+
- **README** — honest metrics (60-80%), Quick Start with `init` command, MCP instructions section, Codex/Antigravity support.
|
|
273
|
+
- **npm keywords** — added `codex`, `cline`, `model-context-protocol`, `token-savings`.
|
|
274
|
+
|
|
275
|
+
## [0.7.4] - 2026-03-07
|
|
276
|
+
|
|
277
|
+
### Added
|
|
278
|
+
- **MCP Server Instructions** — protocol-level `instructions` field tells AI agents WHEN to use Token Pilot tools instead of built-in Read/cat/Grep. Works universally on Claude Code, Cursor, Codex, Antigravity, and any MCP-compatible client. Includes rules for when NOT to use Token Pilot (regex search, raw content copy-paste).
|
|
279
|
+
- **Improved tool descriptions** — each tool now explicitly states what built-in tool it replaces (e.g. "Use INSTEAD OF Read/cat", "Use INSTEAD OF Grep/ripgrep"). Agents can make informed decisions from description alone, without needing project-level rules files.
|
|
280
|
+
|
|
281
|
+
## [0.7.3] - 2026-03-07
|
|
282
|
+
|
|
283
|
+
### Fixed
|
|
284
|
+
- **read_diff diagnostic** — when cache miss occurs, now shows resolved absolute path and all cached file paths. This reveals path mismatches between smart_read and read_diff calls (e.g. different relative paths resolving to different absolute paths).
|
|
285
|
+
|
|
286
|
+
## [0.7.2] - 2026-03-07
|
|
287
|
+
|
|
288
|
+
### Fixed
|
|
289
|
+
- **read_diff on small files** — `smart_read` small-file pass-through (≤150 lines) returned content without caching in fileCache. `read_diff` always showed "No previous read" for small files because the baseline was never stored. Now all files are cached regardless of size.
|
|
290
|
+
|
|
291
|
+
## [0.7.1] - 2026-03-07
|
|
292
|
+
|
|
293
|
+
### Fixed
|
|
294
|
+
- **read_diff after read_for_edit** — `read_for_edit` now caches the full file content, so `read_diff` can use it as baseline after edits. Previously returned "No previous read" because read_for_edit didn't populate the file cache.
|
|
295
|
+
- **outline on intermediate directories** — directories with only subdirectories (no direct code files) now show subdirectory listing with recursive code file counts instead of "No code files found". Enables progressive drill-down: `outline("module/") → outline("module/infrastructure/")`.
|
|
296
|
+
|
|
297
|
+
## [0.7.0] - 2026-03-07
|
|
298
|
+
|
|
299
|
+
### Fixed
|
|
300
|
+
- **Project root detection** — complete rewrite of how token-pilot discovers the working project:
|
|
301
|
+
1. **MCP roots** (new, primary) — uses MCP protocol `listRoots()` to get workspace root from Claude Code. Works for all tools including `find_usages`, `find_unused`, `project_overview` (no file path needed).
|
|
302
|
+
2. **INIT_CWD/PWD env vars** (new) — when started via `npx`, npm sets `INIT_CWD` to the invoking directory. Catches cases where `process.cwd()` is `/` but the real project root is available in env.
|
|
303
|
+
3. **Git detect from file path** (improved) — now triggers from any tool call args (`path`, `paths`, `file`, `module`), not just `smart_read`.
|
|
304
|
+
- **ast-index tools always disabled** — `find_usages`, `find_unused`, `project_overview` never triggered auto-detect because they have no `path` argument. Now all tools trigger detection via MCP roots.
|
|
305
|
+
- **Error messages** — changed "project root is too broad" to actionable "call smart_read() on any project file first" when MCP roots unavailable.
|
|
306
|
+
- **`isDangerousRoot`** — moved to shared `core/validation.ts` (was duplicated in `index.ts`).
|
|
307
|
+
|
|
308
|
+
## [0.6.5] - 2026-03-07
|
|
309
|
+
|
|
310
|
+
### Fixed
|
|
311
|
+
- **AST index rebuild race condition** — concurrent tool calls no longer trigger multiple simultaneous rebuilds. `ensureIndex()` now deduplicates via shared promise. If rebuild fails due to lock file (another process running), falls back to existing index if available instead of throwing.
|
|
312
|
+
- **Rebuild timeout** — increased from 60s to 120s for large projects where indexing takes longer.
|
|
313
|
+
|
|
314
|
+
## [0.6.4] - 2026-03-07
|
|
315
|
+
|
|
316
|
+
### Fixed
|
|
317
|
+
- **CRITICAL: Hook installer** — malformed `settings.json` no longer silently destroyed. Distinguishes ENOENT (create fresh) from JSON parse error (abort with message). Uninstall also reports specific errors.
|
|
318
|
+
- **CRITICAL: Server startup** — `startServer()` now has `.catch()` handler. Unhandled promise rejections no longer crash the process silently.
|
|
319
|
+
- **Non-code handler** — removed `.xml` and `.csv` from `isNonCodeStructured` (no handler existed for them, fell through to null).
|
|
320
|
+
- **Symbol resolver** — removed dangerous basename-only fallback in `pathMatches` (`index.ts` no longer matches any `index.ts`). Fixed hardcoded `endLine = start_line + 10` → uses `end_line` from ast-index or 50-line fallback.
|
|
321
|
+
- **Config loader** — added prototype pollution guard (`__proto__`, `constructor`, `prototype` keys skipped in deepMerge). Parse errors now logged instead of silently swallowed.
|
|
322
|
+
- **File cache** — size tracking now uses `Buffer.byteLength()` instead of `string.length` (chars ≠ bytes for non-ASCII). Removed dead `isSmallFile()` method.
|
|
323
|
+
- **Validation** — `optionalNumber` now rejects `NaN` and `Infinity`.
|
|
324
|
+
- **Token estimation** — `smart_read_many` now uses `estimateTokens()` instead of `length/4`.
|
|
325
|
+
- **Analytics** — `project_overview` calls now tracked in session analytics.
|
|
326
|
+
- **read_for_edit** — raised `MAX_EDIT_LINES` from 20 to 60 (20 was too aggressive, truncated most functions).
|
|
327
|
+
- **related_files** — raised symbol search limit from 5 to 10 for reverse import detection.
|
|
328
|
+
|
|
329
|
+
### Removed
|
|
330
|
+
- Dead config options `cache.ttlMinutes` and `context.autoForgetMinutes` (declared but never used).
|
|
331
|
+
|
|
332
|
+
## [0.6.3] - 2026-03-03
|
|
333
|
+
|
|
334
|
+
### Changed
|
|
335
|
+
- **Hook deny threshold** — raised from 200 to 500 lines. Files ≤500 lines pass through Read without denial roundtrip. Eliminates token overhead on medium files where hook denial costs more than outline saves.
|
|
336
|
+
- **Adaptive fallback** — lowered from 90% to 70%. If outline ≥70% of raw file size, returns raw content. More aggressive at avoiding outlines that barely save tokens.
|
|
337
|
+
- **Tool descriptions** — trimmed marketing language, percentages, and cross-references. ~250 fewer tokens in tool list per session.
|
|
338
|
+
- **Outline cap** — top-level symbols capped at 40, class members at 30. Prevents outline explosion on files with 100+ methods.
|
|
339
|
+
|
|
340
|
+
## [0.6.2] - 2026-03-02
|
|
341
|
+
|
|
342
|
+
### Removed
|
|
343
|
+
- **Dead handler files** — deleted `changed-symbols.ts` (removed in v0.5.0) and `find-callers.ts` (removed in v0.4.0). Were never registered in server but lingered as dead code.
|
|
344
|
+
|
|
345
|
+
## [0.6.1] - 2026-03-02
|
|
346
|
+
|
|
347
|
+
### Changed
|
|
348
|
+
- **`smallFileThreshold`** — raised from 80 to 200 lines. Benchmark showed medium files (100-300 lines) had negative savings (-25%) because AST outline was larger than the raw file. Files ≤200 lines now pass through as raw content.
|
|
349
|
+
- **`smart_read` adaptive fallback** — after generating outline, compares token count vs raw file. If outline ≥ 90% of raw size, returns raw content instead. Eliminates negative savings on any file size, regardless of language or threshold.
|
|
350
|
+
- **`session_analytics` honest metrics** — replaced all hardcoded multipliers (`*5`, `*3`) with real full-file token counts from file cache. `tokensWouldBe` now reflects actual file size, not fabricated numbers. Non-file tools (related_files, outline, find_usages) report 1:1 (no savings claim).
|
|
351
|
+
|
|
352
|
+
## [0.6.0] - 2026-03-02
|
|
353
|
+
|
|
354
|
+
### Changed
|
|
355
|
+
- **Read hook** — upgraded from advisory (`decision: "suggest"`) to blocking (`permissionDecision: "deny"`) for unbounded Read calls on large code files (>200 lines). Bounded Read (with offset/limit) is still allowed. Uses official `hookSpecificOutput` format per Claude Code docs.
|
|
356
|
+
- **`read_for_edit` output** — already includes exact `Read(path, offset, limit)` command that passes through the hook, giving AI a clear path: `read_for_edit` → bounded `Read` → `Edit`.
|
|
357
|
+
|
|
358
|
+
### Added
|
|
359
|
+
- **Edit hook** — new PreToolUse hook matching Edit tool. Adds `additionalContext` suggesting `read_for_edit` for minimal code context. Doesn't block Edit — just provides a hint.
|
|
360
|
+
- **Hook installer** — now installs and manages both Read and Edit hooks. Uninstall removes all Token Pilot hooks.
|
|
361
|
+
|
|
362
|
+
## [0.5.3] - 2026-03-02
|
|
363
|
+
|
|
364
|
+
### Changed
|
|
365
|
+
- **`find_unused`** — completely rewritten with universal approach. Removed 60+ hardcoded framework-specific names. Now uses ast-index data: constructors filtered by name (`constructor`/`__init__`), Python dunder methods by `__*__` pattern, decorated symbols detected via `outline()` and shown separately with their decorators. No framework-specific knowledge.
|
|
366
|
+
- **`formatFrameworkInfo`** (smart_read display) — removed hardcoded TypeORM (`Column`, `PrimaryGeneratedColumn`) and class-validator (`IsEmail`, `MinLength`) parsing. Now only detects standard HTTP verbs (GET/POST/PUT/DELETE/PATCH) which are protocol-level, not framework-specific. All other decorators shown as-is (`@DecoratorName`).
|
|
367
|
+
- **`outline`** — route detection now universal. Instead of hardcoding `@Controller`, detects any class decorator with a path argument as route prefix. HTTP verb detection uses same universal pattern. Non-HTTP decorators shown as-is.
|
|
368
|
+
|
|
369
|
+
## [0.5.2] - 2026-03-02
|
|
370
|
+
|
|
371
|
+
### Fixed
|
|
372
|
+
- **`project_overview`** — HINT no longer references deleted `search_code()`, now suggests `find_usages()` and `outline()`
|
|
373
|
+
- **`related_files` imported_by** — now searches both `imports` AND `usages` from refs (not just imports), with increased limit (30). Cross-language filtering preserves same-family matches while removing false positives.
|
|
374
|
+
- **`find_unused`** — excludes framework-implicit symbols (replaced by universal approach in 0.5.3)
|
|
375
|
+
- **README** — updated handler file list (removed deleted handlers, added new ones)
|
|
376
|
+
|
|
377
|
+
## [0.5.1] - 2026-03-02
|
|
378
|
+
|
|
379
|
+
### Fixed
|
|
380
|
+
- **`read_for_edit` symbol mode** — large symbols (>20 lines) now return only the first 20 lines instead of the entire method. Prevents returning 300+ lines when only a signature is needed for editing.
|
|
381
|
+
- **`related_files` imported_by** — filter cross-language false positives. A TypeScript file no longer shows Python/Go/Rust files as importers. Refs are filtered by language family (JS/TS, Python, Go, JVM, etc.).
|
|
382
|
+
- **`session_analytics`** — honest savings metric for `read_for_edit`. Reduced multiplier from 30x to 3x (realistic comparison vs `Read` with offset/limit, not vs full file).
|
|
383
|
+
|
|
384
|
+
## [0.5.0] - 2026-03-02
|
|
385
|
+
|
|
386
|
+
### Added
|
|
387
|
+
- **`read_for_edit`** — killer feature for edit workflow. Returns RAW code (no line numbers) around a symbol or line, ready to copy as `old_string` for Edit. 97% fewer tokens than reading full file before editing.
|
|
388
|
+
- **`related_files`** — import graph for any file: what it imports, what imports it, test files. Saves 3-5 Read calls per task.
|
|
389
|
+
- **`outline`** — compact overview of all code files in a directory. One call instead of 5-6 smart_read calls. Framework-aware: shows HTTP routes for NestJS controllers.
|
|
390
|
+
- **`read_symbol` show parameter** — `show: "full"|"head"|"tail"|"outline"` controls truncation. Default: auto (full ≤300 lines, outline >300).
|
|
391
|
+
- **Framework-aware decorators** — smart_read/outline parse NestJS (`@Controller`+`@Get` → HTTP routes), TypeORM (`@Column` → types), class-validator (`@IsEmail` → constraints).
|
|
392
|
+
|
|
393
|
+
### Removed
|
|
394
|
+
- **`search_code`** — worse than Grep in practice, find_usages + Grep cover all use cases
|
|
395
|
+
- **`export_ast_index`** — never used in real work, infrastructure tool only
|
|
396
|
+
- **`context_status`** — debugging tool, not user-facing
|
|
397
|
+
- **`forget`** — manual context management = poor design, should be automatic
|
|
398
|
+
- **`changed_symbols`** — git diff + smart_read covers this use case
|
|
399
|
+
|
|
400
|
+
### Changed
|
|
401
|
+
- **12 focused tools** instead of 14 — removed 5 low-value, added 3 high-impact
|
|
402
|
+
- Edit-heavy sessions: 5-10% → 40-50% token savings (via read_for_edit)
|
|
403
|
+
- Average sessions: 20-25% → 45-55% token savings
|
|
404
|
+
|
|
405
|
+
## [0.4.1] - 2026-03-02
|
|
406
|
+
|
|
407
|
+
### Added
|
|
408
|
+
- **Auto-install PreToolUse hook**: hook installs automatically on server start (Claude Code), no manual `install-hook` needed
|
|
409
|
+
- **AI instructions template**: README includes ready-to-copy block for `.cursorrules` / `CLAUDE.md`
|
|
410
|
+
|
|
411
|
+
### Changed
|
|
412
|
+
- **Tool descriptions rewritten** — explicit "ALWAYS use instead of Read/cat", "use instead of Grep" for AI prioritization
|
|
413
|
+
- README updated: PreToolUse hook section, MCP Tools table with "Instead of" column
|
|
414
|
+
|
|
415
|
+
## [0.4.0] - 2026-03-02
|
|
416
|
+
|
|
417
|
+
### Added
|
|
418
|
+
- **Python class method parser**: smart_read/read_symbol shows all methods inside Python classes with visibility, decorators, async detection
|
|
419
|
+
- **PHP class method parser**: same for PHP classes with public/private/protected, static
|
|
420
|
+
- **Version display**: `project_overview` and `session_analytics` show `TOKEN PILOT v{version}`
|
|
421
|
+
|
|
422
|
+
### Changed
|
|
423
|
+
- **Removed find_callers** — did not save tokens vs grep, ast-index limitation with `this.method()` calls
|
|
424
|
+
- **Removed find_implementations** — did not save tokens vs grep, ast-index limitation with decorators
|
|
425
|
+
- **Removed class_hierarchy** — did not save tokens vs grep, poor results from ast-index
|
|
426
|
+
- **14 focused tools** instead of 17 — only tools that actually save tokens or provide unique value
|
|
427
|
+
|
|
428
|
+
### Fixed
|
|
429
|
+
- **Mega-symbol truncation**: symbols >300 lines show head (50) + tail (30) + method outline instead of 71KB overflow
|
|
430
|
+
- **Recursive findFlat**: unqualified method names (`run`, `_build_summary`) found inside class children
|
|
431
|
+
|
|
432
|
+
## [0.3.2] - 2026-03-01
|
|
433
|
+
|
|
434
|
+
### Fixed
|
|
435
|
+
- **Python class methods**: smart_read now shows all methods inside Python classes (ast-index only returns class-level, token-pilot parses `def` methods with visibility, decorators, async detection)
|
|
436
|
+
- **read_symbol Python**: `Orchestrator.run`, `Orchestrator._build_summary` — qualified and unqualified method access works (was returning entire 829-line class)
|
|
437
|
+
- **Mega-symbol truncation**: symbols >300 lines show head (50) + tail (30) + method outline instead of 71KB overflow
|
|
438
|
+
- **findFlat recursive**: unqualified method names (`run`, `_build_summary`) now found inside class children
|
|
439
|
+
|
|
440
|
+
## [0.3.1] - 2026-03-01
|
|
441
|
+
|
|
442
|
+
### Fixed
|
|
443
|
+
- **find_usages**: combine `refs` + `search` with exact word boundary filtering — 0% result loss vs grep (was 40% loss with refs-only)
|
|
444
|
+
- **read_symbol**: fix `Class.method` qualified names for flat outlines (ast-index lists methods as siblings, not children)
|
|
445
|
+
- **read_symbol**: filter ast-index leaf name fallback by requested file (was returning symbols from wrong files)
|
|
446
|
+
- **YAML smart_read**: 3-level nested parser with scalar values, array counts (was only showing top-level keys)
|
|
447
|
+
- Removed all "Use Grep as fallback" hints — token-pilot gives complete results on its own
|
|
448
|
+
|
|
449
|
+
## [0.3.0] - 2026-03-01
|
|
450
|
+
|
|
451
|
+
### Added
|
|
452
|
+
- **find_callers** tool — find all callers of a function, with optional call hierarchy tree (depth parameter)
|
|
453
|
+
- **changed_symbols** tool — show symbol-level git changes (added/modified/removed) vs a base branch
|
|
454
|
+
- **find_unused** tool — detect potentially unused/dead symbols in the project
|
|
455
|
+
- 8 new ast-index client methods: `refs`, `map`, `conventions`, `callers`, `callTree`, `changed`, `unusedSymbols`, `fileImports`
|
|
456
|
+
- Incremental index updates via `ast-index update` (fast) instead of full rebuild
|
|
457
|
+
|
|
458
|
+
### Fixed
|
|
459
|
+
- **find_usages**: rewritten to use `ast-index refs` — returns definitions + imports + usages in one call (was losing ~66% of results)
|
|
460
|
+
- **project_overview**: rewritten to use `ast-index map` + `conventions` — shows architecture, frameworks, naming patterns, directory map with symbol kinds
|
|
461
|
+
- **search_code**: deduplication of results (removes duplicate file:line entries)
|
|
462
|
+
- **read_symbol**: structure-first lookup for `Class.method` qualified names with ast-index leaf fallback
|
|
463
|
+
- **export_ast_index**: `all_indexed=true` option exports all files from ast-index, not just cached ones
|
|
464
|
+
- **YAML smart_read**: expand one level of nesting (shows nested keys under top-level sections)
|
|
465
|
+
|
|
466
|
+
### Changed
|
|
467
|
+
- Total MCP tools: 14 → 17
|
|
468
|
+
- ast-index commands used: 8 → 16
|
|
469
|
+
- Index updates are now incremental by default (falls back to full rebuild only when needed)
|
|
470
|
+
|
|
471
|
+
## [0.2.4] - 2026-03-01
|
|
472
|
+
|
|
473
|
+
### Fixed
|
|
474
|
+
- **search_code**: filter out garbage entries with empty file paths or `:undefined` lines
|
|
475
|
+
- **read_symbol**: support `Class.method` and `Class::method` qualified names (structure-first lookup, ast-index leaf fallback)
|
|
476
|
+
- **export_ast_index**: `all_indexed=true` option exports all files from ast-index, not just cached ones
|
|
477
|
+
- **YAML smart_read**: expand one level of nesting (shows service names, nested keys under top-level sections)
|
|
478
|
+
- Improved empty-cache message in export_ast_index with hint about `all_indexed`
|
|
479
|
+
|
|
480
|
+
## [0.2.3] - 2026-03-01
|
|
481
|
+
|
|
482
|
+
### Fixed
|
|
483
|
+
- **ensureIndex**: plain rebuild first (indexes full monorepo), fallback to `--sub-projects` only if <5 files
|
|
484
|
+
- **smart_read**: non-code files (YAML, JSON, Markdown, TOML) use structural summary instead of raw content dump
|
|
485
|
+
- **smart_read**: unsupported files return truncated 60-line preview instead of full raw content
|
|
486
|
+
- **class_hierarchy**: proper parser for ast-index text output (Parents/Children sections)
|
|
487
|
+
- **project_overview**: uses directory name when package.json has no `name` field
|
|
488
|
+
|
|
489
|
+
## [0.2.2] - 2026-03-01
|
|
490
|
+
|
|
491
|
+
### Fixed
|
|
492
|
+
- Published 0.2.1 contained stale Haiku files in dist/ (tsc doesn't clean old outputs)
|
|
493
|
+
- Added `prebuild` script (`rm -rf dist`) to prevent stale artifacts
|
|
494
|
+
- Added `chmod +x` in prepublishOnly to ensure bin is executable
|
|
495
|
+
|
|
496
|
+
## [0.2.1] - 2026-03-01
|
|
497
|
+
|
|
498
|
+
### Fixed
|
|
499
|
+
- **RC3**: `search_code` now merges all ast-index result types (content_matches + symbols + files + references) — previously only used content_matches which was often empty
|
|
500
|
+
- **RC4**: `class_hierarchy` and `implementations` parse text format as fallback when JSON parse fails
|
|
501
|
+
- **RC6**: `read_symbol` auto-fetches outline from ast-index if no cached structure — no longer requires prior smart_read
|
|
502
|
+
- `ensureIndex` uses `--sub-projects` flag for monorepo indexing
|
|
503
|
+
|
|
504
|
+
### Removed
|
|
505
|
+
- Reverted Haiku v0.2.1 — removed broken PersistentFileCache, DiffEngine, RealTokenEstimator, ContextWindowTracker, smart-read-xml, context-markup
|
|
506
|
+
- Removed 3 heavy native dependencies: `better-sqlite3`, `js-tiktoken`, `diff`
|
|
507
|
+
|
|
508
|
+
### Added
|
|
509
|
+
- `start.sh` — bootstrap script for Claude Code plugin system
|
|
510
|
+
|
|
511
|
+
## [0.2.0] - 2026-03-01
|
|
512
|
+
|
|
513
|
+
### Fixed
|
|
514
|
+
- **P0**: ast-index errors no longer silently swallowed — all search/usages/implementations/hierarchy/outline/symbol log errors to stderr
|
|
515
|
+
- **P0**: `exec()` now captures and logs ast-index subprocess stderr
|
|
516
|
+
- **P0**: `projectRoot` detected via `git rev-parse --show-toplevel` instead of `process.cwd()` (fixes wrong index root)
|
|
517
|
+
- **P1**: `forget(all=true)` now clears both ContextRegistry and FileCache (fixes stale export_ast_index/read_diff after forget)
|
|
518
|
+
- **P1**: `forget(path=X)` also invalidates FileCache for that path
|
|
519
|
+
- **P2**: `read_symbol` supports PHP `::` separator (e.g. `RefundProcessor::refund`)
|
|
520
|
+
- **P2**: `findInStructure` recursion fixed — supports 3+ level nesting (Namespace::Class::method)
|
|
521
|
+
- `ensureIndex()`: verify index has content after `stats` — force rebuild if 0 files indexed
|
|
522
|
+
|
|
523
|
+
### Changed
|
|
524
|
+
- `project_overview`: now shows directory listing + ast-index stats (files, symbols, references) instead of stub
|
|
525
|
+
- `project_overview`: added PHP (`composer.json`) detection
|
|
526
|
+
|
|
527
|
+
## [0.1.6] - 2026-03-01 (unpublished)
|
|
528
|
+
|
|
529
|
+
### Fixed
|
|
530
|
+
- `ensureIndex()`: verify index has content after `stats` — force rebuild if 0 files indexed (fixes empty search results on first run)
|
|
531
|
+
|
|
532
|
+
## [0.1.5] - 2026-03-01
|
|
533
|
+
|
|
534
|
+
### Fixed
|
|
535
|
+
- PreToolUse hook: read file path from stdin (Claude Code hook format) instead of `$FILE_PATH` env var
|
|
536
|
+
- Hook now auto-suggests `smart_read` for large code files when Claude tries to use `Read`
|
|
537
|
+
- `session_analytics`: now tracks all tools (read_symbol, read_range, read_diff, smart_read_many, search_code, find_usages, find_implementations, class_hierarchy) — previously only tracked smart_read
|
|
538
|
+
- Empty search/usages/implementations results now show diagnostic hints (ast-index status, fallback suggestions)
|
|
539
|
+
- `ensureIndex()` now logs build progress and errors to stderr
|
|
540
|
+
|
|
541
|
+
## [0.1.4] - 2026-03-01
|
|
542
|
+
|
|
543
|
+
### Fixed
|
|
544
|
+
- Lazy file watcher: watch only loaded files instead of entire project root (fixes crash on Docker volumes, home dir, WSL)
|
|
545
|
+
|
|
546
|
+
## [0.1.3] - 2026-03-01
|
|
547
|
+
|
|
548
|
+
### Fixed
|
|
549
|
+
- Chokidar file watcher error handler (partial fix, superseded by 0.1.4)
|
|
550
|
+
|
|
551
|
+
## [0.1.2] - 2026-03-01
|
|
552
|
+
|
|
553
|
+
### Fixed
|
|
554
|
+
- ast-index integration: `outline` now parses text output (JSON format not supported in v3.24.0)
|
|
555
|
+
- ast-index `symbol` response: handle array format, normalize field names (`line`→`start_line`, `path`→`file`)
|
|
556
|
+
- ast-index `search` response: handle `{content_matches: [...]}` wrapper
|
|
557
|
+
- ast-index `usages` response: map `context`→`text`, `path`→`file`
|
|
558
|
+
- Server version now read dynamically from package.json
|
|
559
|
+
|
|
560
|
+
### Added
|
|
561
|
+
- `token-pilot doctor` — diagnostics command (checks ast-index, Node.js, config, updates)
|
|
562
|
+
- `token-pilot --version` — print current version
|
|
563
|
+
- Update check on server startup (non-blocking, logs to stderr)
|
|
564
|
+
- `/mcp add` installation method documented for Claude Code chat
|
|
565
|
+
- Troubleshooting section in README
|
|
566
|
+
|
|
567
|
+
## [0.1.1] - 2026-03-01
|
|
568
|
+
|
|
569
|
+
### Added
|
|
570
|
+
- `npx -y token-pilot` — zero-install for any MCP client (Cursor, Cline, Continue, etc.)
|
|
571
|
+
- Claude Code plugin marketplace support (`.claude-plugin/marketplace.json`)
|
|
572
|
+
- `start.sh` bootstrap script — auto `npm install` + `npm run build` on first run
|
|
573
|
+
- `npm publish` ready (`files` field, `prepublishOnly` script)
|
|
574
|
+
- Universal install instructions in README for Claude Code, Cursor, Cline
|
|
575
|
+
|
|
576
|
+
### Changed
|
|
577
|
+
- `.mcp.json` now uses `start.sh` for reliable bootstrap
|
|
578
|
+
- README reorganized: npx as primary install, from-source as fallback
|
|
579
|
+
|
|
580
|
+
## [0.1.0] - 2026-03-01
|
|
581
|
+
|
|
582
|
+
### Added
|
|
583
|
+
|
|
584
|
+
- **Core Reading Tools**: `smart_read`, `read_symbol`, `read_range`, `read_diff`, `smart_read_many`
|
|
585
|
+
- AST-based structural overviews saving 80-95% tokens
|
|
586
|
+
- Small file pass-through (< 80 lines returned in full)
|
|
587
|
+
- O(n) diff algorithm for re-reads
|
|
588
|
+
- Advisory context registry with compact reminders
|
|
589
|
+
- **Search & Navigation**: `search_code`, `find_usages`, `find_implementations`, `class_hierarchy`, `project_overview`
|
|
590
|
+
- Powered by ast-index (tree-sitter + SQLite FTS5)
|
|
591
|
+
- Cross-file symbol resolution
|
|
592
|
+
- **Context Management**: `session_analytics`, `context_status`, `forget`
|
|
593
|
+
- Token savings tracking per tool and per file
|
|
594
|
+
- Advisory (non-blocking) context tracking
|
|
595
|
+
- **Integration**: `export_ast_index`
|
|
596
|
+
- context-mode detection and complementary architecture
|
|
597
|
+
- AST data export for BM25 cross-indexing
|
|
598
|
+
- **Infrastructure**
|
|
599
|
+
- Git HEAD watcher with selective cache invalidation on branch switch
|
|
600
|
+
- File watcher (chokidar) for automatic cache invalidation
|
|
601
|
+
- LRU file cache with configurable size limit
|
|
602
|
+
- Input validation for all tools (path traversal protection)
|
|
603
|
+
- Auto-download of ast-index binary from GitHub releases
|
|
604
|
+
- PreToolUse hook installer for Claude Code
|
|
605
|
+
- Claude Code plugin format (.claude-plugin/)
|
|
606
|
+
- Non-code structural summaries (JSON, YAML, Markdown, TOML)
|
|
607
|
+
- Configurable via `.token-pilot.json`
|