token-goat 2.9.29 → 2.9.31

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.
Files changed (197) hide show
  1. package/README.md +53 -42
  2. package/SECURITY.md +37 -11
  3. package/THIRD_PARTY_NOTICES.md +41 -4
  4. package/dist/native/linux-arm64/tg-hook +0 -0
  5. package/dist/native/linux-x64/tg-hook +0 -0
  6. package/dist/native/win32-arm64/tg-hook.exe +0 -0
  7. package/dist/native/win32-x64/tg-hook.exe +0 -0
  8. package/dist/ort-wasm-simd-threaded.mjs +59 -0
  9. package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-25TRAWET.mjs} +23 -6
  10. package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
  11. package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-2M7E4PF7.mjs} +43 -14
  12. package/dist/token-goat-chunk-2UPZGKKY.mjs +188 -0
  13. package/dist/token-goat-chunk-2WLPWKHV.mjs +135 -0
  14. package/dist/token-goat-chunk-2XBMMDBD.mjs +126 -0
  15. package/dist/token-goat-chunk-32ZOY4N5.mjs +23 -0
  16. package/dist/token-goat-chunk-3EZRNKTK.mjs +188 -0
  17. package/dist/token-goat-chunk-4ADZHI7J.mjs +63 -0
  18. package/dist/token-goat-chunk-4GBVPH3D.mjs +242 -0
  19. package/dist/{token-goat-chunk-2WOUYWLM.mjs → token-goat-chunk-4GILLLWY.mjs} +34 -7
  20. package/dist/token-goat-chunk-4NAPX7BA.mjs +90 -0
  21. package/dist/{token-goat-chunk-NMBWLRHW.mjs → token-goat-chunk-4SC7UJYV.mjs} +9981 -11563
  22. package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
  23. package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-4ZBFWLXF.mjs} +310 -441
  24. package/dist/token-goat-chunk-57BIAXJL.mjs +286 -0
  25. package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
  26. package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
  27. package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
  28. package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
  29. package/dist/token-goat-chunk-646E6U44.mjs +398 -0
  30. package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
  31. package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-6DG6HWP3.mjs} +13 -3
  32. package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
  33. package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
  34. package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-76FGDLRO.mjs} +574 -340
  35. package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7EZTZOMC.mjs} +780 -767
  36. package/dist/token-goat-chunk-7MAOA6X4.mjs +3647 -0
  37. package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
  38. package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
  39. package/dist/token-goat-chunk-AUNGYYQX.mjs +184 -0
  40. package/dist/token-goat-chunk-AUQYRMMH.mjs +2985 -0
  41. package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
  42. package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-BA4HI6BW.mjs} +1910 -165
  43. package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-BFCWY73P.mjs} +58 -20
  44. package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
  45. package/dist/token-goat-chunk-BWGFUZZE.mjs +25 -0
  46. package/dist/token-goat-chunk-C75NA7PL.mjs +322 -0
  47. package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
  48. package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
  49. package/dist/token-goat-chunk-CIMQ2BB3.mjs +233 -0
  50. package/dist/{token-goat-chunk-DNSPXQXQ.mjs → token-goat-chunk-CJLS3CDL.mjs} +70 -18
  51. package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-CO3UYX6G.mjs} +7 -1
  52. package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
  53. package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
  54. package/dist/token-goat-chunk-CVCEVUGK.mjs +315 -0
  55. package/dist/token-goat-chunk-CXHOFN7R.mjs +371 -0
  56. package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
  57. package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-DGS2LVNA.mjs} +70 -160
  58. package/dist/{token-goat-chunk-L7H3U27L.mjs → token-goat-chunk-DOWRSMWO.mjs} +1 -1
  59. package/dist/token-goat-chunk-E45INMY3.mjs +71 -0
  60. package/dist/token-goat-chunk-EC5F37F4.mjs +244 -0
  61. package/dist/{token-goat-chunk-XTQAOTSO.mjs → token-goat-chunk-EDBDRVH5.mjs} +4 -1
  62. package/dist/token-goat-chunk-EELTBKDM.mjs +613 -0
  63. package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
  64. package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
  65. package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-F4HYL64R.mjs} +12 -2
  66. package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
  67. package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
  68. package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
  69. package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
  70. package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
  71. package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-GL3ETKSC.mjs} +276 -19
  72. package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-GVB2MUST.mjs} +265 -1567
  73. package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
  74. package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
  75. package/dist/token-goat-chunk-HLPW63A7.mjs +48 -0
  76. package/dist/token-goat-chunk-HU4TORC5.mjs +1377 -0
  77. package/dist/token-goat-chunk-I7VKZZAW.mjs +35 -0
  78. package/dist/token-goat-chunk-IA6XSPE3.mjs +218 -0
  79. package/dist/token-goat-chunk-IAGXMHIK.mjs +863 -0
  80. package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-IK2DRMFX.mjs} +129 -74
  81. package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-INNPTRUX.mjs} +2954 -2783
  82. package/dist/token-goat-chunk-JJ5BX4F4.mjs +129 -0
  83. package/dist/token-goat-chunk-JVFSHVFJ.mjs +129 -0
  84. package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
  85. package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
  86. package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
  87. package/dist/token-goat-chunk-LCNQ2CNN.mjs +497 -0
  88. package/dist/token-goat-chunk-M3LFJDPU.mjs +58 -0
  89. package/dist/token-goat-chunk-M52KPT3C.mjs +87 -0
  90. package/dist/token-goat-chunk-MBEG42H7.mjs +150 -0
  91. package/dist/{token-goat-chunk-EVC4TOLE.mjs → token-goat-chunk-METECDOH.mjs} +3 -12
  92. package/dist/{token-goat-chunk-2AWQ2R5X.mjs → token-goat-chunk-MHX7XCC3.mjs} +3 -2
  93. package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
  94. package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
  95. package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-N5MMR2IW.mjs} +30 -8
  96. package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
  97. package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-NISNMD7T.mjs} +2545 -2953
  98. package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
  99. package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
  100. package/dist/token-goat-chunk-NSNSPPBG.mjs +69 -0
  101. package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
  102. package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
  103. package/dist/token-goat-chunk-ODBT2USM.mjs +800 -0
  104. package/dist/token-goat-chunk-OS5EM5PP.mjs +107 -0
  105. package/dist/token-goat-chunk-OUKDTVNU.mjs +1178 -0
  106. package/dist/token-goat-chunk-OXFMP75N.mjs +566 -0
  107. package/dist/{token-goat-chunk-ASLWOQ3I.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -1
  108. package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-P6HQSWQ3.mjs} +55 -47
  109. package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
  110. package/dist/token-goat-chunk-PFWIMH2E.mjs +261 -0
  111. package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
  112. package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
  113. package/dist/token-goat-chunk-PX5PQWTY.mjs +462 -0
  114. package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
  115. package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
  116. package/dist/token-goat-chunk-QH7YVYOY.mjs +3957 -0
  117. package/dist/token-goat-chunk-QLMUHEPB.mjs +43 -0
  118. package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-QQOJIHL3.mjs} +50 -14
  119. package/dist/token-goat-chunk-QQTWJY2O.mjs +85 -0
  120. package/dist/token-goat-chunk-QYHO5CPH.mjs +93 -0
  121. package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
  122. package/dist/token-goat-chunk-RSLPOBKQ.mjs +339 -0
  123. package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
  124. package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
  125. package/dist/{token-goat-chunk-PGTH2U4C.mjs → token-goat-chunk-SOAFZNNZ.mjs} +164 -40
  126. package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-SRTHT7KV.mjs} +33 -15
  127. package/dist/token-goat-chunk-T5P5ACNQ.mjs +212 -0
  128. package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
  129. package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
  130. package/dist/token-goat-chunk-TM6MC754.mjs +40 -0
  131. package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
  132. package/dist/token-goat-chunk-U2KSB4SG.mjs +56 -0
  133. package/dist/token-goat-chunk-U4WHMG6Y.mjs +898 -0
  134. package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
  135. package/dist/token-goat-chunk-UGJHGR5A.mjs +52 -0
  136. package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-UOUDVA5U.mjs} +76 -16
  137. package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-URRJ33GR.mjs} +22 -4
  138. package/dist/token-goat-chunk-UZOROKIS.mjs +165 -0
  139. package/dist/token-goat-chunk-VIHGGGEI.mjs +4234 -0
  140. package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
  141. package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
  142. package/dist/token-goat-chunk-VWZA2H4P.mjs +368 -0
  143. package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-VXEXMJDL.mjs} +2964 -3153
  144. package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
  145. package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-WDH44VAU.mjs} +19 -22
  146. package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
  147. package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
  148. package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-XLRBNZCC.mjs} +40 -21
  149. package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-XRKUX6CM.mjs} +4 -0
  150. package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
  151. package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
  152. package/dist/token-goat-chunk-Y2ZTQOCL.mjs +35 -0
  153. package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-YB4VMGK2.mjs} +15 -4
  154. package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
  155. package/dist/{token-goat-chunk-PKRWMHVP.mjs → token-goat-chunk-YHVDKQBR.mjs} +389 -221
  156. package/dist/token-goat-chunk-YJB5XLWI.mjs +26 -0
  157. package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-YKB6AQG3.mjs} +53 -31
  158. package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
  159. package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
  160. package/dist/{token-goat-chunk-HUYUHODZ.mjs → token-goat-chunk-YY6AVUFL.mjs} +13246 -12247
  161. package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
  162. package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
  163. package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
  164. package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
  165. package/dist/token-goat-hook-client.cjs +87 -23
  166. package/dist/token-goat-hook-client.mjs +3 -3
  167. package/dist/token-goat-hook.mjs +76 -31
  168. package/dist/token-goat.core.mjs +6 -6
  169. package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
  170. package/docs/cli.md +113 -60
  171. package/docs/install.md +63 -20
  172. package/docs/security.md +10 -8
  173. package/package.json +18 -7
  174. package/scripts/verify-native-dist.mjs +386 -0
  175. package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
  176. package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
  177. package/dist/token-goat-chunk-BGYOZ6DO.mjs +0 -24
  178. package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
  179. package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
  180. package/dist/token-goat-chunk-D4ETHJD6.mjs +0 -246
  181. package/dist/token-goat-chunk-DNRPXHYH.mjs +0 -1062
  182. package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
  183. package/dist/token-goat-chunk-FTP4U4QA.mjs +0 -64
  184. package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
  185. package/dist/token-goat-chunk-GLXRTTLE.mjs +0 -36
  186. package/dist/token-goat-chunk-H5J3C56Q.mjs +0 -1511
  187. package/dist/token-goat-chunk-IVWI2OCK.mjs +0 -368
  188. package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
  189. package/dist/token-goat-chunk-LZNBQTDK.mjs +0 -26
  190. package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
  191. package/dist/token-goat-chunk-RTMVLHWX.mjs +0 -7113
  192. package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
  193. package/dist/token-goat-chunk-VZQEWRVH.mjs +0 -312
  194. package/dist/token-goat-chunk-XYWPOSCN.mjs +0 -807
  195. package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
  196. package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
  197. package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
@@ -3,35 +3,61 @@ const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  MCP_DISABLE_NOTE,
5
5
  buildCopilotWasteReport,
6
+ buildWasteReport,
6
7
  findProjectSession,
7
8
  isCopilotTranscript,
9
+ noSessionTranscriptMessage,
8
10
  unusedMcpServers
9
- } from "./token-goat-chunk-C5YPNZKQ.mjs";
11
+ } from "./token-goat-chunk-EELTBKDM.mjs";
12
+ import "./token-goat-chunk-ODBT2USM.mjs";
13
+ import "./token-goat-chunk-DGS2LVNA.mjs";
14
+ import "./token-goat-chunk-INNPTRUX.mjs";
15
+ import "./token-goat-chunk-CIMQ2BB3.mjs";
16
+ import "./token-goat-chunk-WDH44VAU.mjs";
17
+ import "./token-goat-chunk-BPGCUMR7.mjs";
18
+ import "./token-goat-chunk-KQBLRPBN.mjs";
19
+ import "./token-goat-chunk-4ZBFWLXF.mjs";
20
+ import "./token-goat-chunk-C75NA7PL.mjs";
10
21
  import {
11
- buildWasteReport
12
- } from "./token-goat-chunk-44BM7DDQ.mjs";
13
- import "./token-goat-chunk-EUSDXRXU.mjs";
14
- import "./token-goat-chunk-ONXH6NZ5.mjs";
15
- import "./token-goat-chunk-O6I2XU4P.mjs";
16
- import "./token-goat-chunk-D4ETHJD6.mjs";
17
- import "./token-goat-chunk-52NSDWYY.mjs";
18
- import "./token-goat-chunk-2WOUYWLM.mjs";
19
- import "./token-goat-chunk-CIQ2FTY3.mjs";
20
- import "./token-goat-chunk-435UQTKD.mjs";
21
- import "./token-goat-chunk-7CPMDFGB.mjs";
22
+ writeCommandFailure
23
+ } from "./token-goat-chunk-CBIQ7WTD.mjs";
24
+ import "./token-goat-chunk-P6VGNTQT.mjs";
25
+ import "./token-goat-chunk-76FGDLRO.mjs";
26
+ import "./token-goat-chunk-GL3ETKSC.mjs";
27
+ import "./token-goat-chunk-EVMZJ27Z.mjs";
28
+ import "./token-goat-chunk-IK2DRMFX.mjs";
29
+ import "./token-goat-chunk-4NAPX7BA.mjs";
30
+ import "./token-goat-chunk-U4WHMG6Y.mjs";
31
+ import "./token-goat-chunk-GVB2MUST.mjs";
32
+ import "./token-goat-chunk-XB5KKOCG.mjs";
33
+ import "./token-goat-chunk-OUKDTVNU.mjs";
34
+ import "./token-goat-chunk-4GILLLWY.mjs";
35
+ import "./token-goat-chunk-BFCWY73P.mjs";
36
+ import "./token-goat-chunk-KGEFFSHD.mjs";
37
+ import "./token-goat-chunk-XX6O25RN.mjs";
38
+ import "./token-goat-chunk-HAVAOB3S.mjs";
39
+ import "./token-goat-chunk-F6PAUIEK.mjs";
40
+ import "./token-goat-chunk-65N4RHP4.mjs";
41
+ import "./token-goat-chunk-X2SUP3EI.mjs";
42
+ import "./token-goat-chunk-T5P5ACNQ.mjs";
43
+ import "./token-goat-chunk-7EZTZOMC.mjs";
44
+ import "./token-goat-chunk-QYHO5CPH.mjs";
22
45
  import {
23
46
  resolveProjectRoot
24
- } from "./token-goat-chunk-TGOXNAHW.mjs";
25
- import "./token-goat-chunk-XB5KKOCG.mjs";
47
+ } from "./token-goat-chunk-4GBVPH3D.mjs";
26
48
  import "./token-goat-chunk-YZAAZU2S.mjs";
27
49
  import "./token-goat-chunk-IVE6U7KV.mjs";
28
- import "./token-goat-chunk-XYWPOSCN.mjs";
29
- import "./token-goat-chunk-TCQANXYC.mjs";
50
+ import {
51
+ countNoun
52
+ } from "./token-goat-chunk-HU4TORC5.mjs";
53
+ import {
54
+ echoedValue
55
+ } from "./token-goat-chunk-GGGG7RWB.mjs";
56
+ import "./token-goat-chunk-AM5V6GSX.mjs";
30
57
  import {
31
58
  displaySafeJson
32
- } from "./token-goat-chunk-NMTKNYGF.mjs";
33
- import "./token-goat-chunk-MELOKFDJ.mjs";
34
- import "./token-goat-chunk-JTKCQMQA.mjs";
59
+ } from "./token-goat-chunk-FNFBKLRD.mjs";
60
+ import "./token-goat-chunk-CO3UYX6G.mjs";
35
61
  import {
36
62
  init_define_import_meta_env
37
63
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -45,11 +71,11 @@ function buildFeedbackCardFromClaude(report) {
45
71
  const fixes = [];
46
72
  if (report.neverTouchedAgain.length > 0) {
47
73
  const files = report.neverTouchedAgain.map((f) => path.basename(f.filePath)).join(", ");
48
- preAudit.push(`Whole-file reads without reuse: ${files} (${report.neverTouchedAgain.length} file(s) read once via Read)`);
74
+ preAudit.push(`Whole-file reads without reuse: ${files} (${countNoun(report.neverTouchedAgain.length, "file")} read once via Read)`);
49
75
  fixes.push('Prefer `token-goat symbol` or `read "file::symbol"` instead of reading whole files.');
50
76
  }
51
77
  if (report.repeatedUncompressedBash.length > 0) {
52
- const cmds = report.repeatedUncompressedBash.map((b) => `"${b.normalized.slice(0, 40)}" (${b.count}x)`).join(", ");
78
+ const cmds = report.repeatedUncompressedBash.map((b) => `${echoedValue(b.normalized.slice(0, 40))} (${b.count}x)`).join(", ");
53
79
  preAudit.push(`Repeated uncompressed terminal commands: ${cmds}`);
54
80
  fixes.push("Use token-goat bash-output cache or compress flags for repetitive terminal invocations.");
55
81
  }
@@ -79,21 +105,21 @@ function buildFeedbackCardFromCopilot(report) {
79
105
  const totalMcpTokens = report.mcpTools.servers.reduce((sum, s) => sum + s.estimatedTokens, 0);
80
106
  const heavy = report.mcpTools.servers.filter((s) => s.estimatedTokens > 1e3);
81
107
  if (heavy.length > 0 || totalMcpTokens > 1500) {
82
- const details = report.mcpTools.servers.map((s) => `${s.serverName} (${s.toolCount} tool(s), ~${s.estimatedTokens.toLocaleString()} tok/turn)`).join(", ");
108
+ const details = report.mcpTools.servers.map((s) => `${s.serverName} (${countNoun(s.toolCount, "tool")}, ~${s.estimatedTokens.toLocaleString()} tok/turn)`).join(", ");
83
109
  const turns = Math.max(1, report.turns);
84
110
  const cumulative = totalMcpTokens * turns;
85
111
  preAudit.push(
86
- `High fixed MCP tool definition overhead: ${details}; total ~${totalMcpTokens.toLocaleString()} tok/turn re-sent across ${turns} turn(s) (~${cumulative.toLocaleString()} cumulative tokens).`
112
+ `High fixed MCP tool definition overhead: ${details}; total ~${totalMcpTokens.toLocaleString()} tok/turn re-sent across ${countNoun(turns, "turn")} (~${cumulative.toLocaleString()} cumulative tokens).`
87
113
  );
88
114
  const unused = unusedMcpServers(report);
89
115
  if (unused === null) {
90
116
  const heavyNames = (heavy.length > 0 ? heavy : report.mcpTools.servers).map((s) => s.serverName).join(", ");
91
117
  fixes.push(
92
- `Disable the MCP server(s) you do not use among ${heavyNames} with 'copilot mcp disable <name>', or exclude individual tools with '--excluded-tools'. This session's log records no tool calls, so it cannot say which went unused.`
118
+ `Disable any MCP server you do not use among ${heavyNames} with 'copilot mcp disable <name>', or exclude individual tools with '--excluded-tools'. This session's log records no tool calls, so it cannot say which went unused.`
93
119
  );
94
120
  } else if (unused.length > 0) {
95
121
  const commands = unused.map((s) => `'copilot mcp disable ${s.serverName}' (~${s.estimatedTokens.toLocaleString()} tok/turn)`).join(", ");
96
- fixes.push(`Disable the MCP server(s) this session never called: ${commands}. ${MCP_DISABLE_NOTE}`);
122
+ fixes.push(`Disable ${unused.length === 1 ? "the MCP server" : "the MCP servers"} this session never called: ${commands}. ${MCP_DISABLE_NOTE}`);
97
123
  }
98
124
  }
99
125
  }
@@ -104,7 +130,7 @@ function buildFeedbackCardFromCopilot(report) {
104
130
  fixes.push("Maintain current token-efficient tooling and MCP server configuration.");
105
131
  }
106
132
  return {
107
- taskSummary: `Copilot CLI session (${report.turns} turn(s) recorded in ${report.sessionId}).`,
133
+ taskSummary: `Copilot CLI session (${countNoun(report.turns, "turn")} recorded in ${report.sessionId}).`,
108
134
  preAuditFindings: preAudit,
109
135
  auditExecutionFindings: [],
110
136
  recommendedFix: fixes
@@ -136,15 +162,8 @@ async function runAuditCommand(opts = {}) {
136
162
  if (opts.transcript !== void 0) {
137
163
  const resolved = path.resolve(opts.transcript);
138
164
  if (!fs.existsSync(resolved)) {
139
- const err = `transcript not found: ${resolved}`;
140
- if (opts.json === true) {
141
- process.stdout.write(`${displaySafeJson({ error: err }, 0)}
142
- `);
143
- } else {
144
- process.stderr.write(`token-goat: ${err}
145
- `);
146
- }
147
- process.exitCode = 1;
165
+ const err = `transcript not found: ${echoedValue(resolved)}`;
166
+ writeCommandFailure(opts.json === true, { error: err }, err);
148
167
  return;
149
168
  }
150
169
  if (isCopilotTranscript(resolved)) {
@@ -170,18 +189,7 @@ async function runAuditCommand(opts = {}) {
170
189
  }
171
190
  const detected = findProjectSession(projectRoot);
172
191
  if (detected === null) {
173
- const err = "no session transcript found for project";
174
- if (opts.json === true) {
175
- process.stdout.write(`${displaySafeJson({ error: err, project: projectRoot }, 0)}
176
- `);
177
- } else {
178
- process.stdout.write(`
179
- # token-goat audit
180
- Project: ${projectRoot}
181
- No session transcript found. Pass --transcript <path> to specify one explicitly.
182
- `);
183
- }
184
- process.exitCode = 1;
192
+ writeCommandFailure(opts.json === true, { error: "no session transcript found for project", project: projectRoot }, noSessionTranscriptMessage(projectRoot));
185
193
  return;
186
194
  }
187
195
  if (detected.kind === "copilot") {
@@ -0,0 +1,71 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ VSCODE_TOOL_NAME_KEY,
5
+ getCwd
6
+ } from "./token-goat-chunk-76FGDLRO.mjs";
7
+ import {
8
+ escapesOntoNetworkThroughLinks,
9
+ foldPathForContainment,
10
+ isInsideRoot
11
+ } from "./token-goat-chunk-AM5V6GSX.mjs";
12
+ import {
13
+ isUncOrDevicePath,
14
+ resolveIndexPath,
15
+ wslMountOfIndexKey
16
+ } from "./token-goat-chunk-FNFBKLRD.mjs";
17
+ import {
18
+ init_define_import_meta_env
19
+ } from "./token-goat-chunk-A37V4PBF.mjs";
20
+
21
+ // src/vscode_path_gate.ts
22
+ init_define_import_meta_env();
23
+ import * as path from "node:path";
24
+ function resolvesToUncPath(target, cwd) {
25
+ try {
26
+ return isUncOrDevicePath(path.resolve(cwd ?? process.cwd(), target));
27
+ } catch {
28
+ return false;
29
+ }
30
+ }
31
+ function vscodePathAllowed(filePath, workspace) {
32
+ if (isUncOrDevicePath(filePath)) return false;
33
+ if (workspace === void 0 || isUncOrDevicePath(workspace)) return false;
34
+ const resolvedRoot = path.resolve(workspace);
35
+ const resolvedTarget = path.resolve(workspace, filePath);
36
+ const root = foldPathForContainment(resolvedRoot.replace(/\\/g, "/"));
37
+ const target = foldPathForContainment(resolvedTarget.replace(/\\/g, "/"));
38
+ if (target !== root && !target.startsWith(root.endsWith("/") ? root : root + "/")) return false;
39
+ return isInsideRoot(resolvedTarget, resolvedRoot);
40
+ }
41
+ function isVscodeEvent(event) {
42
+ return event.raw["_tg_harness"] === "vscode" || event.raw[VSCODE_TOOL_NAME_KEY] !== void 0;
43
+ }
44
+ function preToolPathDeclined(event, target) {
45
+ if (target === void 0) return false;
46
+ const cwd = getCwd(event);
47
+ if (spellingDeclined(event, target, cwd)) return true;
48
+ const mount = secondSpellingAtMount(target, cwd);
49
+ return mount !== null && spellingDeclined(event, mount, cwd);
50
+ }
51
+ function spellingDeclined(event, target, cwd) {
52
+ if (isUncOrDevicePath(target) || resolvesToUncPath(target, cwd)) return true;
53
+ if (isVscodeEvent(event)) return !vscodePathAllowed(target, cwd);
54
+ return escapesOntoNetworkThroughLinks(target, cwd);
55
+ }
56
+ function secondSpellingAtMount(target, cwd) {
57
+ if (process.platform === "win32") return null;
58
+ const base = cwd ?? "/";
59
+ const mount = wslMountOfIndexKey(resolveIndexPath(target, base));
60
+ return mount !== null && mount !== path.resolve(base, target) ? mount : null;
61
+ }
62
+ function commandPathIsTouchable(filePath, event) {
63
+ if (event === void 0) return !escapesOntoNetworkThroughLinks(filePath);
64
+ return !preToolPathDeclined(event, filePath);
65
+ }
66
+
67
+ export {
68
+ vscodePathAllowed,
69
+ preToolPathDeclined,
70
+ commandPathIsTouchable
71
+ };
@@ -0,0 +1,261 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ getTrackedFiles
5
+ } from "./token-goat-chunk-OBOFIHKN.mjs";
6
+ import {
7
+ enqueueDirtyPathsSafe
8
+ } from "./token-goat-chunk-CIMQ2BB3.mjs";
9
+ import {
10
+ indexedPathSpellingIsStale,
11
+ parserFingerprintForLanguage
12
+ } from "./token-goat-chunk-NISNMD7T.mjs";
13
+ import {
14
+ getProjectFileEntries
15
+ } from "./token-goat-chunk-IK2DRMFX.mjs";
16
+ import {
17
+ getDb,
18
+ projectScopeClause
19
+ } from "./token-goat-chunk-GVB2MUST.mjs";
20
+ import {
21
+ fingerprintFile,
22
+ getDisplayRoot,
23
+ statIndexedFile
24
+ } from "./token-goat-chunk-4GBVPH3D.mjs";
25
+ import {
26
+ countNoun
27
+ } from "./token-goat-chunk-HU4TORC5.mjs";
28
+ import {
29
+ foldPath
30
+ } from "./token-goat-chunk-AM5V6GSX.mjs";
31
+ import {
32
+ displaySafeJson,
33
+ normalizePath,
34
+ resolveIndexPath,
35
+ toDisplayPath
36
+ } from "./token-goat-chunk-FNFBKLRD.mjs";
37
+ import {
38
+ globalDbPath
39
+ } from "./token-goat-chunk-CO3UYX6G.mjs";
40
+ import {
41
+ init_define_import_meta_env
42
+ } from "./token-goat-chunk-A37V4PBF.mjs";
43
+
44
+ // src/reconcile.ts
45
+ init_define_import_meta_env();
46
+ import * as fs from "node:fs";
47
+ var DEFAULT_RECONCILE_BUDGET_MS = 1500;
48
+ function readReconcileCursor(dbPath, root) {
49
+ try {
50
+ const row = getDb(dbPath).prepare("SELECT last_scanned_path FROM reconcile_cursor WHERE root = ?").get(root);
51
+ return row?.last_scanned_path ?? null;
52
+ } catch {
53
+ return null;
54
+ }
55
+ }
56
+ function writeReconcileCursor(dbPath, root, lastScannedPath) {
57
+ try {
58
+ getDb(dbPath).prepare(
59
+ "INSERT INTO reconcile_cursor (root, last_scanned_path, updated_at) VALUES (?, ?, ?) ON CONFLICT(root) DO UPDATE SET last_scanned_path = excluded.last_scanned_path, updated_at = excluded.updated_at"
60
+ ).run(root, lastScannedPath, Date.now());
61
+ } catch {
62
+ }
63
+ }
64
+ function clearReconcileCursor(dbPath, root) {
65
+ try {
66
+ getDb(dbPath).prepare("DELETE FROM reconcile_cursor WHERE root = ?").run(root);
67
+ } catch {
68
+ }
69
+ }
70
+ function runReconcile(opts = {}) {
71
+ const raw = reconcileProject(opts);
72
+ const root = getDisplayRoot(opts.cwd ?? process.cwd());
73
+ const display = (paths) => paths.map((p) => toDisplayPath(root, p)).sort();
74
+ const result = {
75
+ ...raw,
76
+ changed: display(raw.changed),
77
+ added: display(raw.added),
78
+ removed: display(raw.removed)
79
+ };
80
+ if (opts.json === true) {
81
+ process.stdout.write(`${displaySafeJson(result)}
82
+ `);
83
+ return 0;
84
+ }
85
+ const unqueued = opts.dryRun === true ? 0 : result.changed.length + result.added.length + result.removed.length - result.enqueued;
86
+ const noneQueued = unqueued > 0 && result.enqueued === 0;
87
+ const lines = [];
88
+ if (isReconcileClean(result)) {
89
+ if (!result.trackedUnavailable) {
90
+ lines.push(`Index matches disk: ${countNoun(result.scanned, "file")} checked in ${result.elapsedMs}ms.`);
91
+ }
92
+ } else {
93
+ const verb = opts.dryRun === true ? "would reindex" : noneQueued ? "not queued" : "queued for reindexing";
94
+ const dropVerb = opts.dryRun === true ? "would drop from the index" : noneQueued ? "not queued" : "queued for removal";
95
+ if (result.changed.length > 0) lines.push(`${countNoun(result.changed.length, "file")} changed since indexing (${verb}):`);
96
+ for (const f of result.changed) lines.push(` ~ ${f}`);
97
+ if (result.added.length > 0) lines.push(`${countNoun(result.added.length, "file")} not in the index (${verb}):`);
98
+ for (const f of result.added) lines.push(` + ${f}`);
99
+ if (result.removed.length > 0) lines.push(`${countNoun(result.removed.length, "file")} indexed but gone from disk (${dropVerb}):`);
100
+ for (const f of result.removed) lines.push(` - ${f}`);
101
+ lines.push(`Checked ${countNoun(result.scanned, "file")} in ${result.elapsedMs}ms.`);
102
+ }
103
+ if (result.mtimeOnly > 0) {
104
+ lines.push(`${countNoun(result.mtimeOnly, "file")} had a newer timestamp but identical content, so ${result.mtimeOnly === 1 ? "it was" : "they were"} left alone.`);
105
+ }
106
+ if (result.parserStale > 0) {
107
+ const reparseVerb = opts.dryRun === true ? "would reparse" : noneQueued ? "not queued" : "queued for reparse";
108
+ lines.push(`${countNoun(result.parserStale, "file")} of the above ${result.parserStale === 1 ? "was" : "were"} unchanged on disk but indexed by an older parser (${reparseVerb}).`);
109
+ }
110
+ if (result.embedStale > 0) {
111
+ const reembedVerb = opts.dryRun === true ? "would re-embed" : noneQueued ? "not queued" : "queued for re-embedding";
112
+ lines.push(`${countNoun(result.embedStale, "file")} of the above ${result.embedStale === 1 ? "was" : "were"} unchanged on disk but held out-of-date embeddings (${reembedVerb}).`);
113
+ }
114
+ if (unqueued > 0) {
115
+ lines.push(`${countNoun(unqueued, "file")} of the above could not be queued for reindexing: the queue takes nothing under the OS temp dir, and nothing at all when it cannot be written. Run token-goat index here to bring the index up to date.`);
116
+ }
117
+ if (result.trackedUnavailable) {
118
+ lines.push("This project has an index but git listed no files in it, so new files could not be found. Indexed files that changed or are gone from disk were still detected. Run token-goat inside the repository, or reindex with --walk if this directory is deliberately not under git.");
119
+ }
120
+ if (result.budgetExhausted) {
121
+ lines.push(`Stopped at the ${result.elapsedMs}ms budget with ${countNoun(result.unscanned, "file")} unchecked, so there may be more drift; deletions were not computed at all, because an unchecked file is indistinguishable from a deleted one. Raise --budget-ms for a complete sweep.`);
122
+ }
123
+ process.stdout.write(`${lines.join("\n")}
124
+ `);
125
+ return 0;
126
+ }
127
+ function isReconcileClean(r) {
128
+ return r.changed.length === 0 && r.added.length === 0 && r.removed.length === 0;
129
+ }
130
+ function reconcileProject(opts = {}) {
131
+ const cwd = opts.cwd ?? process.cwd();
132
+ const budgetMs = opts.budgetMs ?? DEFAULT_RECONCILE_BUDGET_MS;
133
+ const calledAt = Date.now();
134
+ const dbPath = opts.dbPath ?? globalDbPath();
135
+ const tracked = getTrackedFiles(cwd);
136
+ const projectRoot = resolveIndexPath(".", cwd);
137
+ const indexed = getProjectFileEntries(projectRoot, dbPath);
138
+ const chunkScope = projectScopeClause("file_path");
139
+ const chunked = new Set(
140
+ getDb(dbPath).prepare(`SELECT DISTINCT file_path FROM chunks WHERE ${chunkScope.clause}`).pluck().all(...chunkScope.params(projectRoot)).map((p) => foldPath(normalizePath(p)))
141
+ );
142
+ const startedAt = Date.now();
143
+ let scanOrder = tracked;
144
+ const cursorPath = tracked.length > 0 ? readReconcileCursor(dbPath, projectRoot) : null;
145
+ if (cursorPath !== null) {
146
+ const cursorFolded = foldPath(normalizePath(cursorPath));
147
+ const cursorIdx = tracked.findIndex((f) => foldPath(normalizePath(f)) === cursorFolded);
148
+ if (cursorIdx !== -1) {
149
+ scanOrder = [...tracked.slice(cursorIdx + 1), ...tracked.slice(0, cursorIdx + 1)];
150
+ }
151
+ }
152
+ const changed = [];
153
+ const added = [];
154
+ const seenOnDisk = /* @__PURE__ */ new Set();
155
+ let mtimeOnly = 0;
156
+ let parserStale = 0;
157
+ let embedStale = 0;
158
+ let scanned = 0;
159
+ let budgetExhausted = false;
160
+ let lastScanned = null;
161
+ for (const file of scanOrder) {
162
+ if (Date.now() - startedAt >= budgetMs) {
163
+ budgetExhausted = true;
164
+ break;
165
+ }
166
+ scanned++;
167
+ lastScanned = file;
168
+ const normalized = normalizePath(file);
169
+ const folded = foldPath(normalized);
170
+ seenOnDisk.add(folded);
171
+ const entry = indexed.get(folded);
172
+ if (entry === void 0) {
173
+ added.push(file);
174
+ continue;
175
+ }
176
+ if (entry.parserSha !== parserFingerprintForLanguage(entry.language)) {
177
+ changed.push(file);
178
+ parserStale++;
179
+ continue;
180
+ }
181
+ if (entry.embedSha === "" && chunked.has(folded)) {
182
+ changed.push(file);
183
+ embedStale++;
184
+ continue;
185
+ }
186
+ if (normalizePath(entry.filePath).slice(projectRoot.length) !== normalized.slice(projectRoot.length) && indexedPathSpellingIsStale(entry.filePath, file)) {
187
+ changed.push(file);
188
+ continue;
189
+ }
190
+ let mtimeMs;
191
+ try {
192
+ mtimeMs = fs.statSync(file).mtimeMs;
193
+ } catch {
194
+ changed.push(file);
195
+ continue;
196
+ }
197
+ if (entry.mtime !== 0 && mtimeMs / 1e3 === entry.mtime) continue;
198
+ const diskSha = fingerprintFile(file);
199
+ if (diskSha === null) {
200
+ changed.push(file);
201
+ continue;
202
+ }
203
+ if (diskSha === entry.sha) {
204
+ mtimeOnly++;
205
+ continue;
206
+ }
207
+ changed.push(file);
208
+ }
209
+ const trackedUnavailable = tracked.length === 0 && indexed.size > 0;
210
+ const removed = [];
211
+ if (!budgetExhausted) {
212
+ for (const [folded, entry] of indexed) {
213
+ if (seenOnDisk.has(folded)) continue;
214
+ if (Date.now() - startedAt >= budgetMs) {
215
+ budgetExhausted = true;
216
+ removed.length = 0;
217
+ break;
218
+ }
219
+ const st = statIndexedFile(entry.filePath);
220
+ if (st === "gone") {
221
+ removed.push(entry.filePath);
222
+ continue;
223
+ }
224
+ if (st === null || entry.mtime !== 0 && st.mtimeMs / 1e3 === entry.mtime) continue;
225
+ const diskSha = fingerprintFile(entry.filePath);
226
+ if (diskSha === entry.sha) mtimeOnly++;
227
+ else if (diskSha !== null) changed.push(entry.filePath);
228
+ }
229
+ }
230
+ let enqueued = 0;
231
+ if (opts.dryRun !== true) {
232
+ const toEnqueue = [...changed, ...added, ...removed].map((p) => resolveIndexPath(p, cwd));
233
+ enqueued = enqueueDirtyPathsSafe(toEnqueue, { alreadyResolved: true, ...opts.queueDir !== void 0 ? { dir: opts.queueDir } : {} });
234
+ if (budgetExhausted) {
235
+ if (lastScanned !== null) writeReconcileCursor(dbPath, projectRoot, lastScanned);
236
+ } else if (tracked.length > 0) {
237
+ clearReconcileCursor(dbPath, projectRoot);
238
+ }
239
+ }
240
+ return {
241
+ scanned,
242
+ changed,
243
+ added,
244
+ removed,
245
+ mtimeOnly,
246
+ parserStale,
247
+ embedStale,
248
+ budgetExhausted,
249
+ trackedUnavailable,
250
+ unscanned: Math.max(0, tracked.length - scanned),
251
+ enqueued,
252
+ elapsedMs: Date.now() - calledAt
253
+ };
254
+ }
255
+
256
+ export {
257
+ DEFAULT_RECONCILE_BUDGET_MS,
258
+ runReconcile,
259
+ isReconcileClean,
260
+ reconcileProject
261
+ };
@@ -0,0 +1,39 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ getHarnessName
5
+ } from "./token-goat-chunk-QYHO5CPH.mjs";
6
+ import {
7
+ init_define_import_meta_env
8
+ } from "./token-goat-chunk-A37V4PBF.mjs";
9
+
10
+ // src/harness_channels.ts
11
+ init_define_import_meta_env();
12
+ var PROMPT_SUBMIT_CONTEXT_DROPPED = /* @__PURE__ */ new Set([]);
13
+ function dropsPromptSubmitContext() {
14
+ return PROMPT_SUBMIT_CONTEXT_DROPPED.has(getHarnessName());
15
+ }
16
+ var PRE_COMPACT_CONTEXT_DROPPED = /* @__PURE__ */ new Set(["copilot_cli", "codex"]);
17
+ function dropsPreCompactContext() {
18
+ return PRE_COMPACT_CONTEXT_DROPPED.has(getHarnessName());
19
+ }
20
+ var STOP_CONTEXT_DROPPED = /* @__PURE__ */ new Set(["copilot_cli", "vscode"]);
21
+ function dropsStopContext() {
22
+ return STOP_CONTEXT_DROPPED.has(getHarnessName());
23
+ }
24
+ var PRE_COMPACT_RESUMES_ON_PROMPT = /* @__PURE__ */ new Set(["copilot_cli"]);
25
+ function resumesCompactionOnPrompt() {
26
+ return PRE_COMPACT_RESUMES_ON_PROMPT.has(getHarnessName()) && !dropsPromptSubmitContext();
27
+ }
28
+ var SESSION_START_MAY_BE_DEFERRED = /* @__PURE__ */ new Set(["copilot_cli", "vscode"]);
29
+ function sessionStartMayBeDeferred(host) {
30
+ return SESSION_START_MAY_BE_DEFERRED.has(host);
31
+ }
32
+
33
+ export {
34
+ dropsPromptSubmitContext,
35
+ dropsPreCompactContext,
36
+ dropsStopContext,
37
+ resumesCompactionOnPrompt,
38
+ sessionStartMayBeDeferred
39
+ };