@joshuafolkken/kit 1.3041.0 → 1.3092.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1243) hide show
  1. package/.claude/skills/workflow-commands/backlogrun-steps.md +1 -1
  2. package/.claude/skills/workflow-commands/fullrun-steps.md +3 -3
  3. package/.claude/skills/workflow-commands/halfrun.md +3 -2
  4. package/.claude/skills/workflow-commands/kickoff.md +9 -2
  5. package/.claude/skills/workflow-commands/prerequisite.md +2 -0
  6. package/.claude/skills/workflow-commands/progress-watcher.md +10 -8
  7. package/.claude/skills/workflow-commands/retrospective.md +2 -1
  8. package/.claude/skills/workflow-commands/split-assessment.md +4 -0
  9. package/.github/workflows/ci.yml +0 -20
  10. package/.github/workflows/pr-classification.yml +0 -5
  11. package/.github/workflows/publish.yml +0 -1
  12. package/.github/workflows/sonar-qube.yml +0 -5
  13. package/README.md +2 -0
  14. package/SECURITY.md +2 -1
  15. package/dist/.inputs-verified.json +1 -1
  16. package/dist/commands/adopt.js +29 -20
  17. package/dist/commands/auto-ok-judge-cli.js +43 -33
  18. package/dist/commands/auto-ok-main.js +73 -74
  19. package/dist/commands/backlog-budget-main.js +5 -6
  20. package/dist/commands/backlog-drive-cli.js +286 -305
  21. package/dist/commands/backlog-next-main.js +111 -108
  22. package/dist/commands/backlog-offer-main.js +148 -112
  23. package/dist/commands/backlog-plan-cli.js +123 -120
  24. package/dist/commands/backlog-triage-cli.js +131 -128
  25. package/dist/commands/backlogrun-cli.js +273 -264
  26. package/dist/commands/behavior-cli.js +23 -26
  27. package/dist/commands/bytes-command.js +56 -59
  28. package/dist/commands/cases-cli.js +4 -5
  29. package/dist/commands/check-commit-message-main.js +3 -4
  30. package/dist/commands/check-related.js +125 -119
  31. package/dist/commands/chunk-26JL4UU4.js +365 -0
  32. package/dist/commands/chunk-2BIVHPCA.js +85 -0
  33. package/dist/commands/chunk-2CKJODCK.js +245 -0
  34. package/dist/commands/chunk-2E6PSONB.js +46 -0
  35. package/dist/commands/chunk-2GA4775H.js +77 -0
  36. package/dist/commands/chunk-2O64H5UJ.js +462 -0
  37. package/dist/commands/chunk-2OEXY4GM.js +252 -0
  38. package/dist/commands/chunk-2OMIHPPE.js +51 -0
  39. package/dist/commands/chunk-2ONSHOAY.js +46 -0
  40. package/dist/commands/chunk-2Q7MGFYB.js +1208 -0
  41. package/dist/commands/chunk-2SA3W4JF.js +41 -0
  42. package/dist/commands/chunk-2VY7CJ2R.js +212 -0
  43. package/dist/commands/chunk-2WRDAQPJ.js +74 -0
  44. package/dist/commands/chunk-2XLR7R6E.js +541 -0
  45. package/dist/commands/chunk-2XZF3YFY.js +47 -0
  46. package/dist/commands/chunk-33TAOZUE.js +29 -0
  47. package/dist/commands/chunk-374XGAWD.js +158 -0
  48. package/dist/commands/chunk-3CJNQU7P.js +179 -0
  49. package/dist/commands/chunk-3D5T6KMW.js +59 -0
  50. package/dist/commands/chunk-3EW5LTN3.js +114 -0
  51. package/dist/commands/chunk-3F3RNIG2.js +128 -0
  52. package/dist/commands/chunk-3FLTEJZY.js +74 -0
  53. package/dist/commands/chunk-3JWPTRNI.js +60 -0
  54. package/dist/commands/chunk-3MQTOUXT.js +94 -0
  55. package/dist/commands/chunk-3PCUERXE.js +19 -0
  56. package/dist/commands/chunk-3U6A5WON.js +173 -0
  57. package/dist/commands/chunk-3YT3RCSI.js +140 -0
  58. package/dist/commands/chunk-43DU7DYZ.js +540 -0
  59. package/dist/commands/chunk-43H725LG.js +132 -0
  60. package/dist/commands/chunk-46STCE6Q.js +48 -0
  61. package/dist/commands/chunk-46WEC6HZ.js +82 -0
  62. package/dist/commands/chunk-47J4KOZP.js +46 -0
  63. package/dist/commands/chunk-47W7PF4T.js +22 -0
  64. package/dist/commands/chunk-4F4KARQN.js +229 -0
  65. package/dist/commands/chunk-4GUGC4IW.js +338 -0
  66. package/dist/commands/chunk-4HB7NWXP.js +263 -0
  67. package/dist/commands/chunk-4HOTJAO6.js +89 -0
  68. package/dist/commands/chunk-4I5AA4P5.js +237 -0
  69. package/dist/commands/chunk-4IDINPBE.js +525 -0
  70. package/dist/commands/chunk-4K7KLR7L.js +69 -0
  71. package/dist/commands/chunk-4MGTNY2L.js +347 -0
  72. package/dist/commands/chunk-4NSIW3UB.js +104 -0
  73. package/dist/commands/chunk-4YTKV6WV.js +37 -0
  74. package/dist/commands/chunk-5ARNFMQK.js +1263 -0
  75. package/dist/commands/chunk-5AZTSESD.js +114 -0
  76. package/dist/commands/chunk-5FUI2MLY.js +89 -0
  77. package/dist/commands/chunk-5GI5GLC4.js +214 -0
  78. package/dist/commands/chunk-5IHEBIPD.js +333 -0
  79. package/dist/commands/chunk-5KAW5GPF.js +44 -0
  80. package/dist/commands/chunk-5KSJEWXR.js +77 -0
  81. package/dist/commands/chunk-5OF2B4BF.js +35 -0
  82. package/dist/commands/chunk-5PLJ7R3D.js +126 -0
  83. package/dist/commands/chunk-5PPWXOCF.js +64 -0
  84. package/dist/commands/chunk-5VQCL33M.js +46 -0
  85. package/dist/commands/chunk-5Y7FOJLX.js +186 -0
  86. package/dist/commands/chunk-5YTEMF4O.js +110 -0
  87. package/dist/commands/chunk-62NYXZCC.js +241 -0
  88. package/dist/commands/chunk-6KUA7MRG.js +64 -0
  89. package/dist/commands/chunk-6LDEZFYR.js +88 -0
  90. package/dist/commands/chunk-6NXIZMIK.js +122 -0
  91. package/dist/commands/chunk-6O45F6YI.js +86 -0
  92. package/dist/commands/chunk-6OHJBQDE.js +184 -0
  93. package/dist/commands/chunk-6WDCCG3M.js +1249 -0
  94. package/dist/commands/chunk-6ZHXEQAI.js +715 -0
  95. package/dist/commands/chunk-736NECRD.js +16 -0
  96. package/dist/commands/chunk-77LEKVEE.js +32 -0
  97. package/dist/commands/chunk-7CX5VYOL.js +50 -0
  98. package/dist/commands/chunk-7DGHFBU7.js +247 -0
  99. package/dist/commands/chunk-7E43YW53.js +128 -0
  100. package/dist/commands/chunk-7EAYFMDN.js +235 -0
  101. package/dist/commands/chunk-7HP3FQGQ.js +51 -0
  102. package/dist/commands/chunk-7JOOMFDI.js +155 -0
  103. package/dist/commands/chunk-7OEBSPPU.js +321 -0
  104. package/dist/commands/chunk-A3JYZWBS.js +803 -0
  105. package/dist/commands/chunk-A3LCN4KA.js +84 -0
  106. package/dist/commands/chunk-ABLXBG6C.js +98 -0
  107. package/dist/commands/chunk-AN7BFVHU.js +244 -0
  108. package/dist/commands/chunk-AQCVEQSM.js +99 -0
  109. package/dist/commands/chunk-AT46EY7H.js +393 -0
  110. package/dist/commands/chunk-AU563VKH.js +75 -0
  111. package/dist/commands/chunk-AUTD5FV2.js +1077 -0
  112. package/dist/commands/chunk-AV26CMY6.js +304 -0
  113. package/dist/commands/chunk-B2PJEV3S.js +246 -0
  114. package/dist/commands/chunk-B545ENGY.js +214 -0
  115. package/dist/commands/chunk-B5HP6T4L.js +170 -0
  116. package/dist/commands/chunk-B5XYAWNN.js +37 -0
  117. package/dist/commands/chunk-B73IIRMS.js +207 -0
  118. package/dist/commands/chunk-BAEDHPXW.js +160 -0
  119. package/dist/commands/chunk-BDSG6JKH.js +977 -0
  120. package/dist/commands/chunk-BE6F4YK2.js +769 -0
  121. package/dist/commands/chunk-BFKTUD3V.js +33 -0
  122. package/dist/commands/chunk-BLRXHK2V.js +17 -0
  123. package/dist/commands/chunk-BLUAO4QW.js +173 -0
  124. package/dist/commands/chunk-BML6MEUB.js +326 -0
  125. package/dist/commands/chunk-BPDNGJXY.js +63 -0
  126. package/dist/commands/chunk-BQLKWGGC.js +118 -0
  127. package/dist/commands/chunk-BRMJVCP7.js +167 -0
  128. package/dist/commands/chunk-BRWR5YKU.js +268 -0
  129. package/dist/commands/chunk-BUZAYEBD.js +319 -0
  130. package/dist/commands/chunk-BVUL57IX.js +139 -0
  131. package/dist/commands/chunk-CC4BIGCA.js +20 -0
  132. package/dist/commands/chunk-CCHJZEF5.js +4220 -0
  133. package/dist/commands/chunk-CDK7QZWG.js +44 -0
  134. package/dist/commands/chunk-CDYFUCDC.js +72 -0
  135. package/dist/commands/chunk-CEADAQIL.js +170 -0
  136. package/dist/commands/chunk-CNL3SLM6.js +116 -0
  137. package/dist/commands/chunk-CNQ7D2GZ.js +104 -0
  138. package/dist/commands/chunk-CTXJVMHW.js +48 -0
  139. package/dist/commands/chunk-CUWT6UQO.js +13 -0
  140. package/dist/commands/chunk-CVRDJCOE.js +125 -0
  141. package/dist/commands/chunk-D6CF5QGM.js +80 -0
  142. package/dist/commands/chunk-DACNQAXC.js +20 -0
  143. package/dist/commands/chunk-DDOS32JU.js +74 -0
  144. package/dist/commands/chunk-DDZVMXZD.js +481 -0
  145. package/dist/commands/chunk-DF6QD4AF.js +52 -0
  146. package/dist/commands/chunk-DFEXNB44.js +159 -0
  147. package/dist/commands/chunk-DHDKG5HZ.js +151 -0
  148. package/dist/commands/chunk-DHJRFBKO.js +223 -0
  149. package/dist/commands/chunk-DKDWOE3C.js +78 -0
  150. package/dist/commands/chunk-DKO5VTEH.js +65 -0
  151. package/dist/commands/chunk-DLHH3MLS.js +85 -0
  152. package/dist/commands/chunk-DOYNK72G.js +81 -0
  153. package/dist/commands/chunk-DS53UUDH.js +679 -0
  154. package/dist/commands/chunk-DUA4E4ES.js +230 -0
  155. package/dist/commands/chunk-DURHGVRC.js +33 -0
  156. package/dist/commands/chunk-DVCMQMRN.js +191 -0
  157. package/dist/commands/chunk-E3YKMCCJ.js +108 -0
  158. package/dist/commands/chunk-E4F2RTKC.js +272 -0
  159. package/dist/commands/chunk-E4PFCTXN.js +127 -0
  160. package/dist/commands/chunk-EAOTR2WL.js +24 -0
  161. package/dist/commands/chunk-EE4VOZJP.js +167 -0
  162. package/dist/commands/chunk-EHVEWJQ4.js +33 -0
  163. package/dist/commands/chunk-EMFSPPMH.js +98 -0
  164. package/dist/commands/chunk-EN65ZS3S.js +73 -0
  165. package/dist/commands/chunk-ES42XPAD.js +123 -0
  166. package/dist/commands/chunk-ESUY7KTZ.js +137 -0
  167. package/dist/commands/chunk-ET6IRQ3L.js +330 -0
  168. package/dist/commands/chunk-EWCUT7U2.js +1314 -0
  169. package/dist/commands/chunk-EWXXEGXL.js +149 -0
  170. package/dist/commands/chunk-EZYW54OQ.js +7569 -0
  171. package/dist/commands/chunk-F2RDEF2J.js +205 -0
  172. package/dist/commands/chunk-F2U46HAE.js +52 -0
  173. package/dist/commands/chunk-F2VYWU6Z.js +653 -0
  174. package/dist/commands/chunk-F4SGOTUF.js +36 -0
  175. package/dist/commands/chunk-F4YMLVWN.js +183 -0
  176. package/dist/commands/chunk-F5N2QIFD.js +213 -0
  177. package/dist/commands/chunk-F7B4ESZE.js +80 -0
  178. package/dist/commands/chunk-FJM2HWKW.js +299 -0
  179. package/dist/commands/chunk-FJMXUDEY.js +3985 -0
  180. package/dist/commands/chunk-FM7VVAK6.js +426 -0
  181. package/dist/commands/chunk-FQWRM5FC.js +67 -0
  182. package/dist/commands/chunk-FT33ZCSB.js +298 -0
  183. package/dist/commands/chunk-G2DNS74C.js +53 -0
  184. package/dist/commands/chunk-G75GWNNY.js +101 -0
  185. package/dist/commands/chunk-GA2YSPFH.js +32 -0
  186. package/dist/commands/chunk-GAVSK6P6.js +230 -0
  187. package/dist/commands/chunk-GB2BRQVL.js +300 -0
  188. package/dist/commands/chunk-GBMZXFFC.js +44 -0
  189. package/dist/commands/chunk-GDP7QXYE.js +76 -0
  190. package/dist/commands/chunk-GGWXF7RJ.js +70 -0
  191. package/dist/commands/chunk-GHOTKHI4.js +30 -0
  192. package/dist/commands/chunk-GMVN6ZP2.js +48 -0
  193. package/dist/commands/chunk-GNTTGRCX.js +133 -0
  194. package/dist/commands/chunk-GOY5JECO.js +130 -0
  195. package/dist/commands/chunk-GVDRRBHZ.js +507 -0
  196. package/dist/commands/chunk-GWTBIGYC.js +550 -0
  197. package/dist/commands/chunk-GZL6ISVM.js +72 -0
  198. package/dist/commands/chunk-HALHQILI.js +51 -0
  199. package/dist/commands/chunk-HAT7AFBF.js +85 -0
  200. package/dist/commands/chunk-HDVSZ6CZ.js +292 -0
  201. package/dist/commands/chunk-HE3GOMR7.js +88 -0
  202. package/dist/commands/chunk-HEFUC4ZW.js +65 -0
  203. package/dist/commands/chunk-HESWKELD.js +60 -0
  204. package/dist/commands/chunk-HNFBEB4L.js +77 -0
  205. package/dist/commands/chunk-HRN73FQJ.js +77 -0
  206. package/dist/commands/chunk-HYE3MBAN.js +113 -0
  207. package/dist/commands/chunk-IAB6LCJL.js +18 -0
  208. package/dist/commands/chunk-IAGENI2U.js +42 -0
  209. package/dist/commands/chunk-ICPVBHIX.js +48 -0
  210. package/dist/commands/chunk-IEKW3ON6.js +161 -0
  211. package/dist/commands/chunk-IOKOHB7P.js +109 -0
  212. package/dist/commands/chunk-IONGJJYM.js +179 -0
  213. package/dist/commands/chunk-IP23WOWP.js +126 -0
  214. package/dist/commands/chunk-IPS7EBE5.js +140 -0
  215. package/dist/commands/chunk-IXZZSST7.js +459 -0
  216. package/dist/commands/chunk-J4XHEOOW.js +156 -0
  217. package/dist/commands/chunk-JDHLHYJJ.js +208 -0
  218. package/dist/commands/chunk-JEYITIWB.js +423 -0
  219. package/dist/commands/chunk-JGX7JIW4.js +126 -0
  220. package/dist/commands/chunk-JHIGDFBS.js +59 -0
  221. package/dist/commands/chunk-JI2EGXZX.js +53 -0
  222. package/dist/commands/chunk-JNV3VRK2.js +47 -0
  223. package/dist/commands/chunk-JPMAW2VZ.js +91 -0
  224. package/dist/commands/chunk-JQEY6KDP.js +90 -0
  225. package/dist/commands/chunk-JSJDIEGZ.js +88 -0
  226. package/dist/commands/chunk-JT5ICRFF.js +44 -0
  227. package/dist/commands/chunk-JUCJ4Y42.js +77 -0
  228. package/dist/commands/chunk-K3OZBV3L.js +49 -0
  229. package/dist/commands/chunk-K5H3CLZZ.js +430 -0
  230. package/dist/commands/chunk-K6P5PISC.js +114 -0
  231. package/dist/commands/chunk-KD3SEAMV.js +402 -0
  232. package/dist/commands/chunk-KDCHY7XO.js +88 -0
  233. package/dist/commands/chunk-KDGX3JTV.js +51 -0
  234. package/dist/commands/chunk-KGSEWOKI.js +353 -0
  235. package/dist/commands/chunk-KHGDZQRG.js +271 -0
  236. package/dist/commands/chunk-KIS7JFNP.js +217 -0
  237. package/dist/commands/chunk-KKHD3C2P.js +114 -0
  238. package/dist/commands/chunk-KKIIY5I5.js +67 -0
  239. package/dist/commands/chunk-KN46UC77.js +114 -0
  240. package/dist/commands/chunk-KP2BVAS5.js +125 -0
  241. package/dist/commands/chunk-KPAJBJXG.js +63 -0
  242. package/dist/commands/chunk-KPMAJP6D.js +145 -0
  243. package/dist/commands/chunk-KR6WUAJM.js +122 -0
  244. package/dist/commands/chunk-KWLNK2NJ.js +391 -0
  245. package/dist/commands/chunk-L2CLCNXW.js +144 -0
  246. package/dist/commands/chunk-L7MDU6D7.js +155 -0
  247. package/dist/commands/chunk-L7VD4MLF.js +78 -0
  248. package/dist/commands/chunk-LBMAJDGN.js +124 -0
  249. package/dist/commands/chunk-LBVYFW3I.js +38 -0
  250. package/dist/commands/chunk-LE3M42CF.js +350 -0
  251. package/dist/commands/chunk-LIPUSINQ.js +140 -0
  252. package/dist/commands/chunk-LJVZWE3A.js +1885 -0
  253. package/dist/commands/chunk-LKSSQVDA.js +49 -0
  254. package/dist/commands/chunk-LL6G34MF.js +93 -0
  255. package/dist/commands/chunk-LNQOL2CL.js +321 -0
  256. package/dist/commands/chunk-LS7P324N.js +72 -0
  257. package/dist/commands/chunk-LU5EOGFQ.js +50 -0
  258. package/dist/commands/chunk-LX2ENXHZ.js +197 -0
  259. package/dist/commands/chunk-M32UPB2D.js +110 -0
  260. package/dist/commands/chunk-M3UGRNNB.js +103 -0
  261. package/dist/commands/chunk-M4WG74Q7.js +260 -0
  262. package/dist/commands/chunk-M5HA2ZCG.js +105 -0
  263. package/dist/commands/chunk-MDGPJOLK.js +351 -0
  264. package/dist/commands/chunk-MDKRTUE4.js +288 -0
  265. package/dist/commands/chunk-MFZVRWRS.js +34 -0
  266. package/dist/commands/chunk-MHXIJKGP.js +304 -0
  267. package/dist/commands/chunk-MK4CARBI.js +90 -0
  268. package/dist/commands/chunk-MLJDW7YN.js +64 -0
  269. package/dist/commands/chunk-MNLHYAJO.js +80 -0
  270. package/dist/commands/chunk-MOD3FG4V.js +419 -0
  271. package/dist/commands/chunk-MRAEJLXL.js +83 -0
  272. package/dist/commands/chunk-MRW2WYJS.js +68 -0
  273. package/dist/commands/chunk-MXPCEZL5.js +23 -0
  274. package/dist/commands/chunk-N2XH7QBY.js +103 -0
  275. package/dist/commands/chunk-N2ZF6T4E.js +332 -0
  276. package/dist/commands/chunk-N36NZMAL.js +79 -0
  277. package/dist/commands/chunk-N4EMFHQ6.js +114 -0
  278. package/dist/commands/chunk-N4P64UIH.js +211 -0
  279. package/dist/commands/chunk-NABSSY4P.js +204 -0
  280. package/dist/commands/chunk-NDQIJBRQ.js +100 -0
  281. package/dist/commands/chunk-NDR4PCVG.js +29 -0
  282. package/dist/commands/chunk-NEOCCN6D.js +302 -0
  283. package/dist/commands/chunk-NFKWFOFM.js +45 -0
  284. package/dist/commands/chunk-NFUPJBBG.js +516 -0
  285. package/dist/commands/chunk-NHEBKL7X.js +170 -0
  286. package/dist/commands/chunk-NHTEC5U4.js +99 -0
  287. package/dist/commands/chunk-NOSG3RUP.js +84 -0
  288. package/dist/commands/chunk-NOSODWWK.js +1132 -0
  289. package/dist/commands/chunk-NPXXYG6Z.js +580 -0
  290. package/dist/commands/chunk-NR2JDBPV.js +75 -0
  291. package/dist/commands/chunk-NRULNBYI.js +1153 -0
  292. package/dist/commands/chunk-NTGF5N3N.js +110 -0
  293. package/dist/commands/chunk-NTIVNQKF.js +73 -0
  294. package/dist/commands/chunk-NUCFIYZL.js +119 -0
  295. package/dist/commands/chunk-NVMV7BYX.js +88 -0
  296. package/dist/commands/chunk-NYWPTYGL.js +169 -0
  297. package/dist/commands/chunk-NZ45KOLL.js +104 -0
  298. package/dist/commands/chunk-O45BX4EL.js +39 -0
  299. package/dist/commands/chunk-O46T4ANI.js +229 -0
  300. package/dist/commands/chunk-O5JGV7NA.js +245 -0
  301. package/dist/commands/chunk-O7ESC4HL.js +566 -0
  302. package/dist/commands/chunk-OBYLXHCH.js +86 -0
  303. package/dist/commands/chunk-OKN63ZH5.js +109 -0
  304. package/dist/commands/chunk-ON4IKRGS.js +469 -0
  305. package/dist/commands/chunk-OT74RSQO.js +82 -0
  306. package/dist/commands/chunk-OVCVINYW.js +143 -0
  307. package/dist/commands/chunk-OZKLVTYI.js +342 -0
  308. package/dist/commands/chunk-P3LJ2Q4N.js +555 -0
  309. package/dist/commands/chunk-P43GWYR6.js +185 -0
  310. package/dist/commands/chunk-P6ASP2DY.js +132 -0
  311. package/dist/commands/chunk-PBAEJ5PT.js +38 -0
  312. package/dist/commands/chunk-PCZROH3R.js +100 -0
  313. package/dist/commands/chunk-PF3PMT2Q.js +46 -0
  314. package/dist/commands/chunk-PILH72AV.js +170 -0
  315. package/dist/commands/chunk-PJYTUUTH.js +34 -0
  316. package/dist/commands/chunk-PKXTISWR.js +58 -0
  317. package/dist/commands/chunk-PSGLUBSB.js +74 -0
  318. package/dist/commands/chunk-PUQA7F6Y.js +186 -0
  319. package/dist/commands/chunk-PVRDJU2B.js +126 -0
  320. package/dist/commands/chunk-Q3HM2BEH.js +45 -0
  321. package/dist/commands/chunk-Q42NF2TL.js +47 -0
  322. package/dist/commands/chunk-Q4ULMZAS.js +106 -0
  323. package/dist/commands/chunk-QCRUPRQ2.js +207 -0
  324. package/dist/commands/chunk-QFIKPGMC.js +280 -0
  325. package/dist/commands/chunk-QSBYULSS.js +100 -0
  326. package/dist/commands/chunk-QSJCZATC.js +18 -0
  327. package/dist/commands/chunk-QTJPCXEW.js +23 -0
  328. package/dist/commands/chunk-QTQAI2M2.js +179 -0
  329. package/dist/commands/chunk-QTVVFV4Q.js +127 -0
  330. package/dist/commands/chunk-QX2EMUXV.js +102 -0
  331. package/dist/commands/chunk-QXBOECGL.js +272 -0
  332. package/dist/commands/chunk-QXCG3SG4.js +88 -0
  333. package/dist/commands/chunk-QZVMGAWV.js +307 -0
  334. package/dist/commands/chunk-R36VZIKU.js +53 -0
  335. package/dist/commands/chunk-R3F7F3TX.js +94 -0
  336. package/dist/commands/chunk-R5AABJZJ.js +1062 -0
  337. package/dist/commands/chunk-R7PYR4HW.js +389 -0
  338. package/dist/commands/chunk-RDUFVQVJ.js +997 -0
  339. package/dist/commands/chunk-RESNXNDG.js +54 -0
  340. package/dist/commands/chunk-RFIOZTXY.js +305 -0
  341. package/dist/commands/chunk-RFWB2KAV.js +102 -0
  342. package/dist/commands/chunk-RFXON3FK.js +25 -0
  343. package/dist/commands/chunk-RGEB5L37.js +66 -0
  344. package/dist/commands/chunk-RGRLLF2J.js +119 -0
  345. package/dist/commands/chunk-RLRIMYXM.js +178 -0
  346. package/dist/commands/chunk-RNB3DQOZ.js +70 -0
  347. package/dist/commands/chunk-RO4QEZJO.js +172 -0
  348. package/dist/commands/chunk-RS5HBJY6.js +161 -0
  349. package/dist/commands/chunk-RV7EQIE4.js +202 -0
  350. package/dist/commands/chunk-RWPCK3CO.js +41 -0
  351. package/dist/commands/chunk-RWYSVFIA.js +250 -0
  352. package/dist/commands/chunk-RYKK75YT.js +289 -0
  353. package/dist/commands/chunk-S4JE63QE.js +704 -0
  354. package/dist/commands/chunk-S4OZJIXD.js +134 -0
  355. package/dist/commands/chunk-SD4EX75H.js +177 -0
  356. package/dist/commands/chunk-SJITWFNY.js +480 -0
  357. package/dist/commands/chunk-SKGDMAIA.js +33 -0
  358. package/dist/commands/chunk-SNSZ25XZ.js +393 -0
  359. package/dist/commands/chunk-SQZZHK6X.js +119 -0
  360. package/dist/commands/chunk-SRTEE34O.js +93 -0
  361. package/dist/commands/chunk-SYTCTLMD.js +285 -0
  362. package/dist/commands/chunk-T6JUDQMW.js +181 -0
  363. package/dist/commands/chunk-T6OUNP7E.js +426 -0
  364. package/dist/commands/chunk-TEXUEBGE.js +208 -0
  365. package/dist/commands/chunk-TFDVTU6O.js +910 -0
  366. package/dist/commands/chunk-TFYYXETQ.js +472 -0
  367. package/dist/commands/chunk-TMFKVJUW.js +121 -0
  368. package/dist/commands/chunk-TNJU4CXD.js +32 -0
  369. package/dist/commands/chunk-TRHWBUWE.js +61 -0
  370. package/dist/commands/chunk-TROCFVCU.js +45 -0
  371. package/dist/commands/chunk-TTTZZN7F.js +269 -0
  372. package/dist/commands/chunk-TUBBESHU.js +85 -0
  373. package/dist/commands/chunk-TVZIFZZN.js +62 -0
  374. package/dist/commands/chunk-TXRWAL63.js +144 -0
  375. package/dist/commands/chunk-U46YTYJQ.js +92 -0
  376. package/dist/commands/chunk-U5EO4QEV.js +48 -0
  377. package/dist/commands/chunk-UCO333EX.js +47 -0
  378. package/dist/commands/chunk-UIXQ4IYT.js +445 -0
  379. package/dist/commands/chunk-UJGNYPMD.js +716 -0
  380. package/dist/commands/chunk-URZ4RDC4.js +220 -0
  381. package/dist/commands/chunk-UUH3DE77.js +57 -0
  382. package/dist/commands/chunk-UVY5ODCM.js +60 -0
  383. package/dist/commands/chunk-UWMB6EOU.js +45 -0
  384. package/dist/commands/chunk-UX3HCPLX.js +449 -0
  385. package/dist/commands/chunk-UY62WJV6.js +120 -0
  386. package/dist/commands/chunk-V2T5DP3B.js +224 -0
  387. package/dist/commands/chunk-VAHQ4AFM.js +585 -0
  388. package/dist/commands/chunk-VCWNMRH7.js +71 -0
  389. package/dist/commands/chunk-VHLDQ3PH.js +30 -0
  390. package/dist/commands/chunk-VL5I2IOD.js +332 -0
  391. package/dist/commands/chunk-VLN6TSPJ.js +139 -0
  392. package/dist/commands/chunk-VMG3QB6C.js +81 -0
  393. package/dist/commands/chunk-VO25PMGS.js +58 -0
  394. package/dist/commands/chunk-VTLWODJ2.js +133 -0
  395. package/dist/commands/chunk-VXE3V3OC.js +335 -0
  396. package/dist/commands/chunk-VY7ZJMDT.js +469 -0
  397. package/dist/commands/chunk-W3MDLQZF.js +137 -0
  398. package/dist/commands/chunk-W4BR6QNU.js +1241 -0
  399. package/dist/commands/chunk-WCYRNNKF.js +76 -0
  400. package/dist/commands/chunk-WEUUJIWQ.js +84 -0
  401. package/dist/commands/chunk-WNBJK6QE.js +84 -0
  402. package/dist/commands/chunk-WR5PKCQW.js +61 -0
  403. package/dist/commands/chunk-WR73HTRG.js +121 -0
  404. package/dist/commands/chunk-WRNMUQTD.js +95 -0
  405. package/dist/commands/chunk-WROJTXWZ.js +138 -0
  406. package/dist/commands/chunk-WTIPX5NG.js +43 -0
  407. package/dist/commands/chunk-WWLCQREY.js +225 -0
  408. package/dist/commands/chunk-WXLW7S4M.js +71 -0
  409. package/dist/commands/chunk-WXXLJQBO.js +67 -0
  410. package/dist/commands/chunk-X4LYH6Q4.js +56 -0
  411. package/dist/commands/chunk-XAEL24EG.js +66 -0
  412. package/dist/commands/chunk-XCCT6GKA.js +74 -0
  413. package/dist/commands/chunk-XDR2BRDL.js +216 -0
  414. package/dist/commands/chunk-XRQMVAB4.js +85 -0
  415. package/dist/commands/chunk-XSKJAG72.js +91 -0
  416. package/dist/commands/chunk-XTJA34ND.js +492 -0
  417. package/dist/commands/chunk-XUXCFPDK.js +218 -0
  418. package/dist/commands/chunk-XXPDFJRI.js +48 -0
  419. package/dist/commands/chunk-Y6OGDG5I.js +49 -0
  420. package/dist/commands/chunk-YEAE46TS.js +98 -0
  421. package/dist/commands/chunk-YEQFAEVW.js +112 -0
  422. package/dist/commands/chunk-YJZAD4Z5.js +103 -0
  423. package/dist/commands/chunk-YMAEYY5R.js +278 -0
  424. package/dist/commands/chunk-YNCF66RK.js +1052 -0
  425. package/dist/commands/chunk-YOA25SII.js +210 -0
  426. package/dist/commands/chunk-YOZTZMAT.js +38 -0
  427. package/dist/commands/chunk-YSGRHVZG.js +897 -0
  428. package/dist/commands/chunk-YSLGWRQN.js +646 -0
  429. package/dist/commands/chunk-YTXCLGGL.js +168 -0
  430. package/dist/commands/chunk-YVHJN2HS.js +74 -0
  431. package/dist/commands/chunk-YY7XVVSB.js +43 -0
  432. package/dist/commands/chunk-Z5GZV4DV.js +16 -0
  433. package/dist/commands/chunk-Z6QLFPFB.js +907 -0
  434. package/dist/commands/chunk-ZB52ZIEA.js +1629 -0
  435. package/dist/commands/chunk-ZCD4AV2P.js +73 -0
  436. package/dist/commands/chunk-ZCHZU6NX.js +799 -0
  437. package/dist/commands/chunk-ZEH2B3DF.js +239 -0
  438. package/dist/commands/chunk-ZEUKX3RZ.js +245 -0
  439. package/dist/commands/chunk-ZGANVZCA.js +92 -0
  440. package/dist/commands/chunk-ZGBXUY7R.js +198 -0
  441. package/dist/commands/chunk-ZGEUWHFF.js +297 -0
  442. package/dist/commands/chunk-ZHSNQ2F7.js +161 -0
  443. package/dist/commands/chunk-ZIIUBGON.js +773 -0
  444. package/dist/commands/chunk-ZJ5S4VFD.js +258 -0
  445. package/dist/commands/chunk-ZNIIA275.js +59 -0
  446. package/dist/commands/chunk-ZV6BZZJ2.js +271 -0
  447. package/dist/commands/ci-timing-cli.js +22 -3
  448. package/dist/commands/code-symbol-cli.js +21 -7
  449. package/dist/commands/codex-hook-adapter.js +124 -119
  450. package/dist/commands/command-derive.js +9 -11
  451. package/dist/commands/cost-audit-main.js +118 -119
  452. package/dist/commands/cost-main.js +5 -7
  453. package/dist/commands/cspell-cached.js +55 -57
  454. package/dist/commands/defect-origin-main.js +42 -37
  455. package/dist/commands/defect-report-main.js +33 -25
  456. package/dist/commands/diff-summary-cli.js +3 -4
  457. package/dist/commands/disposition-cli.js +117 -118
  458. package/dist/commands/doctor.js +24 -11
  459. package/dist/commands/document-read-cli.js +50 -53
  460. package/dist/commands/document-section-main.js +50 -53
  461. package/dist/commands/dogfood-commit-cli.js +19 -4
  462. package/dist/commands/effect-audit-cli.js +40 -41
  463. package/dist/commands/epic-audit-main.js +88 -86
  464. package/dist/commands/epic-bundle-main.js +122 -119
  465. package/dist/commands/epic-check.js +37 -31
  466. package/dist/commands/epic-main.js +129 -126
  467. package/dist/commands/epic-next-main.js +85 -83
  468. package/dist/commands/eval-run.js +6 -7
  469. package/dist/commands/format-edited-cli.js +71 -46
  470. package/dist/commands/format.js +41 -56
  471. package/dist/commands/fresh-machine-cli.js +24 -7
  472. package/dist/commands/gh-usage-cli.js +22 -22
  473. package/dist/commands/git-followup-workflow.js +158 -158
  474. package/dist/commands/git-gh-checks-failed-main.js +23 -15
  475. package/dist/commands/git-workflow.js +52 -53
  476. package/dist/commands/github-release-cli.js +3 -3
  477. package/dist/commands/hook-ledger-cli.js +93 -94
  478. package/dist/commands/init-main.js +40 -40
  479. package/dist/commands/inputs.json +2042 -2002
  480. package/dist/commands/issue-ack-cli.js +28 -21
  481. package/dist/commands/issue-already-done-cli.js +107 -110
  482. package/dist/commands/issue-body-cli.js +71 -73
  483. package/dist/commands/issue-cite-main.js +35 -28
  484. package/dist/commands/issue-comment-main.js +36 -30
  485. package/dist/commands/issue-consolidate-cli.js +54 -54
  486. package/dist/commands/issue-file-main.js +274 -148
  487. package/dist/commands/issue-fold-existing-cli.js +126 -123
  488. package/dist/commands/issue-fold-main.js +57 -60
  489. package/dist/commands/issue-lint-main.js +59 -61
  490. package/dist/commands/issue-measured-cli.js +108 -110
  491. package/dist/commands/issue-plan-cli.js +156 -155
  492. package/dist/commands/issue-premise-unmet-cli.js +111 -113
  493. package/dist/commands/issue-priority-cli.js +38 -32
  494. package/dist/commands/issue-read-main.js +38 -33
  495. package/dist/commands/issue-release-class-cli.js +37 -31
  496. package/dist/commands/issue-release-main.js +35 -29
  497. package/dist/commands/issue-scout-main.js +123 -120
  498. package/dist/commands/issue-spill-main.js +149 -144
  499. package/dist/commands/issue-state-main.js +36 -31
  500. package/dist/commands/issue-tick-cli.js +37 -31
  501. package/dist/commands/josh-completion.js +21 -24
  502. package/dist/commands/lane-adopt-cli.js +53 -55
  503. package/dist/commands/lane-breakdown-cli.js +193 -172
  504. package/dist/commands/lane-cli.js +199 -180
  505. package/dist/commands/lane-launch-main.js +106 -56
  506. package/dist/commands/lane-limit-cli.js +119 -116
  507. package/dist/commands/lane-measure-cli.js +408 -245
  508. package/dist/commands/lane-pause-cli.js +51 -54
  509. package/dist/commands/lane-plan-cli.js +148 -147
  510. package/dist/commands/lane-resolve-cli.js +48 -50
  511. package/dist/commands/lane-restart-cli.js +185 -168
  512. package/dist/commands/lane-why-cli.js +121 -122
  513. package/dist/commands/lane-withdraw-cli.js +84 -86
  514. package/dist/commands/latest-corepack.js +3 -2
  515. package/dist/commands/latest-if-required-cli.js +12 -15
  516. package/dist/commands/latest-lane-guard-main.js +2 -3
  517. package/dist/commands/latest-scope-main.js +5 -7
  518. package/dist/commands/latest-update.js +3 -2
  519. package/dist/commands/lines-command.js +8 -10
  520. package/dist/commands/lint-parallel-main.js +65 -67
  521. package/dist/commands/lint-related.js +149 -133
  522. package/dist/commands/lint-rule.js +64 -66
  523. package/dist/commands/lockfile-policy.js +29 -32
  524. package/dist/commands/main-merge-main.js +23 -25
  525. package/dist/commands/main-sync-main.js +23 -24
  526. package/dist/commands/managed-config-scope-cli.js +11 -10
  527. package/dist/commands/measure-rerun-cli.js +31 -26
  528. package/dist/commands/metrics-command.js +97 -100
  529. package/dist/commands/observation-record-cli.js +24 -14
  530. package/dist/commands/observations-flush-cli.js +50 -52
  531. package/dist/commands/overrides-check.js +1 -1
  532. package/dist/commands/package-scout-cli.js +70 -73
  533. package/dist/commands/pin-verify-cli.js +21 -2
  534. package/dist/commands/plan-consumers-main.js +3 -4
  535. package/dist/commands/plan-scaffold-cli.js +145 -146
  536. package/dist/commands/pr-classification-main.js +22 -3
  537. package/dist/commands/pre-commit-lint.js +30 -34
  538. package/dist/commands/pre-commit-type-check.js +55 -55
  539. package/dist/commands/pre-push-unit.js +69 -70
  540. package/dist/commands/pretool-guard-cli.js +111 -113
  541. package/dist/commands/prevent-main-commit.js +2 -3
  542. package/dist/commands/project-profile-cli.js +24 -9
  543. package/dist/commands/propagate.js +31 -23
  544. package/dist/commands/prose-stale-cli.js +48 -42
  545. package/dist/commands/publishable-range-check.js +3 -3
  546. package/dist/commands/read-set-cli.js +58 -61
  547. package/dist/commands/refactor-scan-cli.js +8 -9
  548. package/dist/commands/release-cli.js +57 -57
  549. package/dist/commands/release-scope-main.js +41 -36
  550. package/dist/commands/rename-cli.js +64 -36
  551. package/dist/commands/repo-party-cli.js +3 -4
  552. package/dist/commands/report-template-cli.js +4 -5
  553. package/dist/commands/reserved-run.js +17 -20
  554. package/dist/commands/retrospective-cli.js +126 -127
  555. package/dist/commands/review-attest-cli.js +28 -20
  556. package/dist/commands/review-brief-main.js +184 -167
  557. package/dist/commands/review-findings-cli.js +23 -13
  558. package/dist/commands/review-pair-cli.js +180 -156
  559. package/dist/commands/review-record-main.js +171 -147
  560. package/dist/commands/review-round2-cli.js +89 -91
  561. package/dist/commands/review-stops-cli.js +51 -54
  562. package/dist/commands/review-submit-cli.js +184 -167
  563. package/dist/commands/rule-list.js +78 -80
  564. package/dist/commands/rule-value-cli.js +115 -116
  565. package/dist/commands/ruleset-check-cli.js +23 -6
  566. package/dist/commands/run-add-cli.js +115 -75
  567. package/dist/commands/run-board-main.js +172 -169
  568. package/dist/commands/run-carry-cli.js +182 -174
  569. package/dist/commands/run-chain-cli.js +184 -160
  570. package/dist/commands/run-cut-cli.js +206 -168
  571. package/dist/commands/run-ending-cli.js +51 -54
  572. package/dist/commands/run-entry-cli.js +230 -283
  573. package/dist/commands/run-event-cli.js +18 -21
  574. package/dist/commands/run-handoff-cli.js +75 -78
  575. package/dist/commands/run-handoff-lanes-cli.js +48 -51
  576. package/dist/commands/run-hold-main.js +105 -107
  577. package/dist/commands/run-liveness-cli.js +47 -49
  578. package/dist/commands/run-merge-main.js +159 -151
  579. package/dist/commands/run-next-cli.js +128 -129
  580. package/dist/commands/run-park-cli.js +137 -140
  581. package/dist/commands/run-pause-cli.js +190 -186
  582. package/dist/commands/run-pickup-cli.js +49 -52
  583. package/dist/commands/run-prep-main.js +124 -125
  584. package/dist/commands/run-prime-cli.js +175 -147
  585. package/dist/commands/run-progress-main.js +149 -146
  586. package/dist/commands/run-report-cli.js +60 -60
  587. package/dist/commands/run-review-cli.js +229 -214
  588. package/dist/commands/run-ship-cli.js +258 -252
  589. package/dist/commands/run-ship-evidence-cli.js +71 -72
  590. package/dist/commands/run-ship-lap-W66LTXJJ.js +28 -0
  591. package/dist/commands/run-ship-wait-main.js +83 -85
  592. package/dist/commands/run-split-cli.js +176 -172
  593. package/dist/commands/run-stale-main.js +72 -75
  594. package/dist/commands/run-status-cli.js +44 -44
  595. package/dist/commands/run-step-cli.js +213 -211
  596. package/dist/commands/run-tail-cli.js +23 -18
  597. package/dist/commands/run-tidy-main.js +67 -69
  598. package/dist/commands/run-wake-main.js +206 -187
  599. package/dist/commands/run-watcher-guard-cli.js +63 -66
  600. package/dist/commands/security-audit-main.js +21 -24
  601. package/dist/commands/security-audit-provision-main.js +9 -11
  602. package/dist/commands/selfcheck-cli.js +63 -57
  603. package/dist/commands/session-language-main.js +70 -73
  604. package/dist/commands/sonar-hotspots-cli.js +9 -8
  605. package/dist/commands/sonar-new-code-cli.js +3 -4
  606. package/dist/commands/split-assess-cli.js +55 -58
  607. package/dist/commands/split-child-recover-cli.js +38 -39
  608. package/dist/commands/start.js +64 -64
  609. package/dist/commands/stash-pop-main.js +4 -5
  610. package/dist/commands/stash-push-main.js +7 -9
  611. package/dist/commands/stop-guard.js +180 -176
  612. package/dist/commands/sync-main.js +30 -15
  613. package/dist/commands/telegram-test-main.js +29 -22
  614. package/dist/commands/test-declared.js +29 -15
  615. package/dist/commands/test-e2e-guard.js +54 -54
  616. package/dist/commands/test-pinned-main.js +57 -56
  617. package/dist/commands/test-reach-cli.js +40 -32
  618. package/dist/commands/test-red-main.js +12 -14
  619. package/dist/commands/test-related-Z6YY2GFH.js +113 -0
  620. package/dist/commands/test-related-main.js +89 -89
  621. package/dist/commands/test-unit-guard-main.js +37 -37
  622. package/dist/commands/time-cli.js +54 -57
  623. package/dist/commands/time-density-cli.js +26 -29
  624. package/dist/commands/tree-status-cli.js +6 -8
  625. package/dist/commands/type-check-command.js +26 -11
  626. package/dist/commands/ui-routes-cli.js +5 -6
  627. package/dist/commands/ui-shot-cli.js +1 -1
  628. package/dist/commands/uninstall.js +44 -43
  629. package/dist/commands/unused-members-KVKZDTXD.js +329 -0
  630. package/dist/commands/unused-members-cli.js +27 -12
  631. package/dist/commands/upstream-interrupt-main.js +159 -151
  632. package/dist/commands/verification-gate.js +85 -86
  633. package/dist/commands/version-check.js +25 -8
  634. package/dist/hooks/chunk-3SA3FIQC.js +6869 -0
  635. package/dist/hooks/chunk-46PTTMGE.js +1625 -0
  636. package/dist/hooks/chunk-5NIBRHWG.js +77 -0
  637. package/dist/hooks/chunk-76QKN2K3.js +258 -0
  638. package/dist/hooks/chunk-CHEKMGFP.js +321 -0
  639. package/dist/hooks/chunk-DCILEVDR.js +5173 -0
  640. package/dist/hooks/chunk-HVNGIM5W.js +5092 -0
  641. package/dist/hooks/chunk-L6IZZ2IL.js +11219 -0
  642. package/dist/hooks/chunk-UZXMFOVK.js +9170 -0
  643. package/dist/hooks/chunk-WCJ2GWYJ.js +1381 -0
  644. package/dist/hooks/chunk-YRKS5ZKE.js +1915 -0
  645. package/dist/hooks/codex-hook-adapter.js +11 -12
  646. package/dist/hooks/daemon.js +2140 -1387
  647. package/dist/hooks/format-edited.js +6 -6
  648. package/dist/hooks/inputs.json +512 -488
  649. package/dist/hooks/pretool-guard.js +8 -8
  650. package/dist/hooks/run-ship-lap-P5555IG7.js +8 -0
  651. package/dist/hooks/session-lang.js +10 -8
  652. package/dist/hooks/stop-guard.js +962 -669
  653. package/dist/inputs.json +73 -64
  654. package/dist/josh.js +1029 -577
  655. package/dist/registry-migrate.mjs +33938 -0
  656. package/dist/version/index.js +4251 -175
  657. package/package.json +4 -1
  658. package/prompts/collaboration-workflow/principles.md +4 -1
  659. package/prompts/collaboration-workflow/rule-delivery.md +1 -1
  660. package/scripts/agent/codex-launch-identity.ts +70 -0
  661. package/scripts/auto-ok/auto-ok-cli.ts +2 -0
  662. package/scripts/auto-ok/auto-ok-judge-write.ts +2 -0
  663. package/scripts/auto-ok/auto-ok-judge.ts +3 -1
  664. package/scripts/backlog/backlog-arrival.ts +1 -1
  665. package/scripts/backlog/backlog-budget.ts +5 -2
  666. package/scripts/backlog/backlog-defect-priority.ts +1 -1
  667. package/scripts/backlog/backlog-dispatch-bound.ts +17 -0
  668. package/scripts/backlog/backlog-drain-flush.ts +38 -3
  669. package/scripts/backlog/backlog-drive-cli.ts +1 -1
  670. package/scripts/backlog/backlog-drive-hold.ts +28 -5
  671. package/scripts/backlog/backlog-drive-launch.ts +37 -15
  672. package/scripts/backlog/backlog-drive-listing.ts +39 -23
  673. package/scripts/backlog/backlog-drive-retrospective-unit.ts +3 -2
  674. package/scripts/backlog/backlog-drive-split-unit.ts +1 -0
  675. package/scripts/backlog/backlog-hold-codes.ts +7 -0
  676. package/scripts/backlog/backlog-hold-text.ts +14 -1
  677. package/scripts/backlog/backlog-measure-close.ts +6 -0
  678. package/scripts/backlog/backlog-next-shared.ts +20 -2
  679. package/scripts/backlog/backlog-next.ts +24 -3
  680. package/scripts/backlog/backlog-offer-cli.ts +69 -16
  681. package/scripts/build/build-migration.ts +25 -0
  682. package/scripts/build/build.ts +2 -0
  683. package/scripts/epic/epic-classify.ts +6 -1
  684. package/scripts/epic/epic-live.ts +46 -0
  685. package/scripts/followup/followup-failed-tests.ts +71 -10
  686. package/scripts/followup/followup-job-rerun.ts +2 -2
  687. package/scripts/gate/change-scope-action.integration.test.ts +88 -0
  688. package/scripts/gate/change-scope-action.ts +2 -0
  689. package/scripts/gate/check-related-order.ts +6 -7
  690. package/scripts/gate/check-related.ts +18 -8
  691. package/scripts/gate/core-admission.ts +17 -30
  692. package/scripts/gate/core-budget-poll.ts +183 -0
  693. package/scripts/gate/core-budget-timing.ts +1 -1
  694. package/scripts/gate/core-budget.ts +24 -112
  695. package/scripts/gate/core-wait-record.ts +52 -7
  696. package/scripts/gate/machine-capacity.ts +6 -2
  697. package/scripts/gate/metrics-totals.ts +11 -0
  698. package/scripts/gate/path-glob.test.ts +18 -0
  699. package/scripts/gate/toolchain-inputs.consumer.test.ts +36 -0
  700. package/scripts/gh/fix-gh-packages-logic.ts +22 -15
  701. package/scripts/gh/gh-request-tally.ts +4 -0
  702. package/scripts/hooks/bash-revert.ts +79 -31
  703. package/scripts/hooks/format-edited-file.ts +6 -8
  704. package/scripts/hooks/implementation-shell.ts +3 -2
  705. package/scripts/init/distributed-paths.ts +18 -5
  706. package/scripts/init/init-actions.ts +16 -1
  707. package/scripts/init/init-bootstrap.ts +2 -0
  708. package/scripts/init/init-logic.ts +40 -8
  709. package/scripts/init/init.ts +11 -3
  710. package/scripts/issue/defect-rate-cli.ts +19 -13
  711. package/scripts/issue/issue-file-batch.ts +7 -3
  712. package/scripts/issue/issue-file-cli.ts +19 -6
  713. package/scripts/issue/issue-file-main.ts +6 -1
  714. package/scripts/issue/issue-file-pass.ts +17 -0
  715. package/scripts/issue/issue-file.ts +3 -0
  716. package/scripts/issue/issue-not-before.ts +9 -2
  717. package/scripts/issue/issue-observation-gate.ts +141 -0
  718. package/scripts/issue/issue-observation-prime.ts +83 -0
  719. package/scripts/issue/issue-publication-state.ts +61 -0
  720. package/scripts/issue/issue-publication.ts +144 -0
  721. package/scripts/issue/issue-sample-prime.ts +2 -0
  722. package/scripts/issue/issue-search-count.ts +26 -0
  723. package/scripts/issue/issue-search.ts +128 -3
  724. package/scripts/issue/issue-spill-cli.ts +4 -0
  725. package/scripts/issue/upstream-interrupt-cli.ts +21 -5
  726. package/scripts/josh/josh-commands-ai.ts +1 -1
  727. package/scripts/josh/josh-commands-development.ts +1 -1
  728. package/scripts/josh/josh-commands-issue-write.ts +9 -0
  729. package/scripts/josh/josh-commands-run.ts +6 -1
  730. package/scripts/josh/josh-commands-ship.ts +5 -5
  731. package/scripts/josh/josh-run.ts +5 -2
  732. package/scripts/josh/session-language-cli.ts +1 -1
  733. package/scripts/josh/shared-cache.ts +16 -1
  734. package/scripts/lane/lane-await.ts +15 -0
  735. package/scripts/lane/lane-cli.ts +2 -0
  736. package/scripts/lane/lane-dispatch-dependency.ts +102 -0
  737. package/scripts/lane/lane-dispatch-wait-stats.ts +239 -0
  738. package/scripts/lane/lane-dispatch.ts +44 -5
  739. package/scripts/lane/lane-early-push-count.ts +21 -0
  740. package/scripts/lane/lane-install.ts +15 -5
  741. package/scripts/lane/lane-launch-cli.ts +35 -14
  742. package/scripts/lane/lane-ledger-kind.ts +2 -0
  743. package/scripts/lane/lane-ledger-schema-ship.ts +5 -1
  744. package/scripts/lane/lane-ledger-schema.ts +15 -1
  745. package/scripts/lane/lane-ledger-write.ts +4 -1
  746. package/scripts/lane/lane-relaunch.ts +25 -2
  747. package/scripts/lane/lane-state-record.ts +2 -0
  748. package/scripts/lane/lane-state.ts +8 -1
  749. package/scripts/lane/lane-stats-tables.ts +2 -0
  750. package/scripts/lane/openai-lane-supervisor.ts +16 -1
  751. package/scripts/lib/inherited-scope.ts +48 -0
  752. package/scripts/lint/format-steps.ts +93 -0
  753. package/scripts/lint/format.ts +6 -49
  754. package/scripts/lint/lint-related-fix.ts +35 -0
  755. package/scripts/lint/lint-related.ts +22 -35
  756. package/scripts/propagate/propagate-steps.ts +9 -4
  757. package/scripts/registry-migration/migrate-cli.ts +50 -0
  758. package/scripts/registry-migration/migrate-files.ts +154 -0
  759. package/scripts/registry-migration/migrate-lock.ts +147 -0
  760. package/scripts/registry-migration/migrate.ts +235 -0
  761. package/scripts/registry-migration/npm-acquisition.ts +118 -0
  762. package/scripts/review/review-record-cli.ts +27 -13
  763. package/scripts/review/review-record-pinned.ts +15 -6
  764. package/scripts/run/add/run-add-cli.ts +21 -3
  765. package/scripts/run/add/run-add.ts +26 -9
  766. package/scripts/run/board/run-board-header.ts +4 -5
  767. package/scripts/run/board/run-board-layout.ts +2 -2
  768. package/scripts/run/board/run-board-read.ts +7 -1
  769. package/scripts/run/board/run-board-reason.ts +12 -0
  770. package/scripts/run/board/run-board-retry-wait.ts +35 -0
  771. package/scripts/run/board/run-board-roots.ts +25 -2
  772. package/scripts/run/board/run-board-seat.ts +9 -2
  773. package/scripts/run/board/run-board-setup.ts +19 -11
  774. package/scripts/run/board/run-board-status.ts +2 -0
  775. package/scripts/run/board/run-board-tick.ts +7 -1
  776. package/scripts/run/carry/run-carry-reclaim.ts +12 -2
  777. package/scripts/run/carry/run-carry-session.ts +48 -0
  778. package/scripts/run/carry/run-carry.ts +21 -14
  779. package/scripts/run/cut/run-cut-resume.ts +15 -3
  780. package/scripts/run/cut/run-cut.ts +1 -1
  781. package/scripts/run/detached-launch.ts +14 -5
  782. package/scripts/run/early-push-record.ts +6 -2
  783. package/scripts/run/event/run-event-setup.ts +2 -0
  784. package/scripts/run/event/run-event-stream-emit.ts +27 -7
  785. package/scripts/run/hold/run-hold-cli.ts +40 -5
  786. package/scripts/run/merge/run-merge-cut-release.ts +17 -0
  787. package/scripts/run/merge/run-merge-human-review.ts +6 -0
  788. package/scripts/run/merge/run-merge-steps.ts +4 -57
  789. package/scripts/run/merge/run-merge-waits.ts +54 -0
  790. package/scripts/run/prime/run-prime-cli.ts +16 -2
  791. package/scripts/run/review/run-review-cli.ts +5 -7
  792. package/scripts/run/review/run-review-early-push.ts +19 -8
  793. package/scripts/run/review/run-review-join-read.ts +33 -6
  794. package/scripts/run/review/run-review-pinned-remaining.ts +124 -0
  795. package/scripts/run/review/run-review-pinned-steps.ts +7 -1
  796. package/scripts/run/run-halfrun-resume.ts +49 -6
  797. package/scripts/run/run-headless.ts +3 -0
  798. package/scripts/run/run-pr-return.ts +14 -5
  799. package/scripts/run/run-repair-attempt.ts +219 -0
  800. package/scripts/run/ship/run-ship-lap.ts +5 -17
  801. package/scripts/run/ship/run-ship-pre-detach-pinned.ts +4 -13
  802. package/scripts/run/ship/run-ship-scoped.ts +66 -30
  803. package/scripts/run/startup/run-startup-schema.ts +31 -0
  804. package/scripts/run/startup/run-startup-store.ts +130 -0
  805. package/scripts/run/startup/run-startup.ts +119 -0
  806. package/scripts/run/wake/run-wake-codex.ts +144 -0
  807. package/scripts/run/wake/run-wake-driver.ts +32 -7
  808. package/scripts/run/wake/run-wake-handoff.ts +9 -8
  809. package/scripts/run/wake/run-wake-loop.ts +23 -3
  810. package/scripts/run/wake/run-wake-ports.ts +17 -3
  811. package/scripts/run/wake/run-wake-takeover.ts +6 -3
  812. package/scripts/run/wake/run-wake-window.ts +4 -1
  813. package/scripts/run/wake/run-wake.ts +5 -0
  814. package/scripts/sync/sync-ai-files.ts +17 -0
  815. package/scripts/sync/sync-configs.ts +11 -1
  816. package/scripts/sync/sync.ts +5 -1
  817. package/scripts/test/test-related-cap.ts +7 -3
  818. package/scripts/test/test-related-imports.ts +92 -0
  819. package/scripts/test/vitest-failure-summary.ts +7 -0
  820. package/scripts/version/npm-registry.ts +45 -7
  821. package/scripts/version/upgrade-shell-command.ts +34 -2
  822. package/templates/workflows/ci.yml +0 -15
  823. package/templates/workflows/github-release.yml +0 -5
  824. package/dist/commands/chunk-23GH6B3D.js +0 -333
  825. package/dist/commands/chunk-24ZDAWML.js +0 -48
  826. package/dist/commands/chunk-2BB5ZR2F.js +0 -128
  827. package/dist/commands/chunk-2BJJUTZA.js +0 -59
  828. package/dist/commands/chunk-2CXT6MBR.js +0 -51
  829. package/dist/commands/chunk-2DJLAUYB.js +0 -109
  830. package/dist/commands/chunk-2EZTYLO4.js +0 -179
  831. package/dist/commands/chunk-2FJJYCBD.js +0 -149
  832. package/dist/commands/chunk-2PHOLX62.js +0 -43
  833. package/dist/commands/chunk-2QM72JCJ.js +0 -338
  834. package/dist/commands/chunk-2VRITY55.js +0 -41
  835. package/dist/commands/chunk-2XAH3MHV.js +0 -23
  836. package/dist/commands/chunk-34KZDKQJ.js +0 -304
  837. package/dist/commands/chunk-352KLSFX.js +0 -67
  838. package/dist/commands/chunk-36LOGVJ7.js +0 -38
  839. package/dist/commands/chunk-3AEDZZNL.js +0 -223
  840. package/dist/commands/chunk-3B2HEFNO.js +0 -51
  841. package/dist/commands/chunk-3PEXBHRN.js +0 -33
  842. package/dist/commands/chunk-3Z425MM3.js +0 -61
  843. package/dist/commands/chunk-3ZOX4G4U.js +0 -88
  844. package/dist/commands/chunk-452HWOJ7.js +0 -395
  845. package/dist/commands/chunk-475EFIJV.js +0 -178
  846. package/dist/commands/chunk-47UZB54M.js +0 -73
  847. package/dist/commands/chunk-4DN4XVPL.js +0 -716
  848. package/dist/commands/chunk-4DVM57T7.js +0 -86
  849. package/dist/commands/chunk-4EADHJVC.js +0 -247
  850. package/dist/commands/chunk-4HERA2GY.js +0 -95
  851. package/dist/commands/chunk-4JI35CVO.js +0 -70
  852. package/dist/commands/chunk-4L4LNWZ7.js +0 -143
  853. package/dist/commands/chunk-4N32QKJZ.js +0 -170
  854. package/dist/commands/chunk-4NRSFLG7.js +0 -185
  855. package/dist/commands/chunk-4OKRPAUT.js +0 -98
  856. package/dist/commands/chunk-4PUKDAXL.js +0 -42
  857. package/dist/commands/chunk-4Q64PG46.js +0 -478
  858. package/dist/commands/chunk-4UDTQVDD.js +0 -278
  859. package/dist/commands/chunk-4WR2LEZL.js +0 -123
  860. package/dist/commands/chunk-4ZJOC6OK.js +0 -298
  861. package/dist/commands/chunk-4ZQM4I7R.js +0 -533
  862. package/dist/commands/chunk-54X37JEJ.js +0 -170
  863. package/dist/commands/chunk-56KW5EOK.js +0 -85
  864. package/dist/commands/chunk-5CG3XU3O.js +0 -74
  865. package/dist/commands/chunk-5ESZLHDZ.js +0 -514
  866. package/dist/commands/chunk-5FBRMARM.js +0 -578
  867. package/dist/commands/chunk-5RG4S66L.js +0 -47
  868. package/dist/commands/chunk-5UJGACVN.js +0 -137
  869. package/dist/commands/chunk-5Y7B7FDL.js +0 -44
  870. package/dist/commands/chunk-5Z6E5ZUV.js +0 -89
  871. package/dist/commands/chunk-5ZNUH4LV.js +0 -1722
  872. package/dist/commands/chunk-5ZTQX7OS.js +0 -125
  873. package/dist/commands/chunk-66NX6EXR.js +0 -29
  874. package/dist/commands/chunk-66TGK5XL.js +0 -84
  875. package/dist/commands/chunk-6CFHLMKM.js +0 -555
  876. package/dist/commands/chunk-6DDK5XWK.js +0 -74
  877. package/dist/commands/chunk-6GQX752S.js +0 -145
  878. package/dist/commands/chunk-6HRRZANN.js +0 -55
  879. package/dist/commands/chunk-6MAZ55GF.js +0 -1241
  880. package/dist/commands/chunk-6OP63TBT.js +0 -78
  881. package/dist/commands/chunk-6Q3XUCLM.js +0 -204
  882. package/dist/commands/chunk-6RUWU2SB.js +0 -45
  883. package/dist/commands/chunk-6UCWAFQY.js +0 -245
  884. package/dist/commands/chunk-6WKJ3GDA.js +0 -408
  885. package/dist/commands/chunk-6YURRFRU.js +0 -461
  886. package/dist/commands/chunk-6YVURZAJ.js +0 -350
  887. package/dist/commands/chunk-6Z4YZG7P.js +0 -169
  888. package/dist/commands/chunk-77BIN247.js +0 -122
  889. package/dist/commands/chunk-7ABHNNY3.js +0 -529
  890. package/dist/commands/chunk-7C7FOKJK.js +0 -115
  891. package/dist/commands/chunk-7HAGC6SW.js +0 -1062
  892. package/dist/commands/chunk-7KKUFLH5.js +0 -56
  893. package/dist/commands/chunk-7LJQMM2K.js +0 -102
  894. package/dist/commands/chunk-7MJYLUF4.js +0 -99
  895. package/dist/commands/chunk-7NHZCI5Y.js +0 -704
  896. package/dist/commands/chunk-7OQ56DVW.js +0 -239
  897. package/dist/commands/chunk-7VWPGTZO.js +0 -260
  898. package/dist/commands/chunk-7YZXS3AK.js +0 -30
  899. package/dist/commands/chunk-A4HOQKOG.js +0 -85
  900. package/dist/commands/chunk-A6T2N7VC.js +0 -159
  901. package/dist/commands/chunk-AAUDI7WJ.js +0 -250
  902. package/dist/commands/chunk-AC26ZUG5.js +0 -259
  903. package/dist/commands/chunk-ACZ52JPI.js +0 -140
  904. package/dist/commands/chunk-AJ65WNJB.js +0 -230
  905. package/dist/commands/chunk-AK7SEO4Y.js +0 -177
  906. package/dist/commands/chunk-AKK56GNX.js +0 -205
  907. package/dist/commands/chunk-AKQYYHP2.js +0 -461
  908. package/dist/commands/chunk-ALDAS2WG.js +0 -137
  909. package/dist/commands/chunk-ANUTT56I.js +0 -85
  910. package/dist/commands/chunk-AVVMDVGO.js +0 -68
  911. package/dist/commands/chunk-B3M5WSGN.js +0 -72
  912. package/dist/commands/chunk-B7ZNIEDV.js +0 -351
  913. package/dist/commands/chunk-BCUDQWYK.js +0 -77
  914. package/dist/commands/chunk-BF6YX4HE.js +0 -70
  915. package/dist/commands/chunk-BHRS7HAM.js +0 -272
  916. package/dist/commands/chunk-BIKGPT52.js +0 -29
  917. package/dist/commands/chunk-BJA5U4Q7.js +0 -75
  918. package/dist/commands/chunk-BMKWSWWE.js +0 -126
  919. package/dist/commands/chunk-BMTYUJNT.js +0 -59
  920. package/dist/commands/chunk-BRHPRDDV.js +0 -127
  921. package/dist/commands/chunk-BRUBX64M.js +0 -33
  922. package/dist/commands/chunk-BTZJDHQT.js +0 -46
  923. package/dist/commands/chunk-BYFC6MD2.js +0 -72
  924. package/dist/commands/chunk-BYGJ3BCJ.js +0 -803
  925. package/dist/commands/chunk-C2SEDMZ3.js +0 -238
  926. package/dist/commands/chunk-C54QXJD6.js +0 -4208
  927. package/dist/commands/chunk-C6QSVO5K.js +0 -56
  928. package/dist/commands/chunk-CBAKBWSZ.js +0 -332
  929. package/dist/commands/chunk-CFHRNTE5.js +0 -326
  930. package/dist/commands/chunk-CGLLAEKZ.js +0 -110
  931. package/dist/commands/chunk-CHKYPF5O.js +0 -82
  932. package/dist/commands/chunk-CJBW6BWG.js +0 -800
  933. package/dist/commands/chunk-CJKPF5DJ.js +0 -156
  934. package/dist/commands/chunk-CKUKK7JG.js +0 -252
  935. package/dist/commands/chunk-CMHGDCGN.js +0 -263
  936. package/dist/commands/chunk-CNGTHSUS.js +0 -750
  937. package/dist/commands/chunk-CP2J4RV2.js +0 -3987
  938. package/dist/commands/chunk-CQZI7RIK.js +0 -72
  939. package/dist/commands/chunk-CWCKCZS6.js +0 -188
  940. package/dist/commands/chunk-D5HIP4HT.js +0 -289
  941. package/dist/commands/chunk-D6D6WQR6.js +0 -125
  942. package/dist/commands/chunk-D7JRJI44.js +0 -297
  943. package/dist/commands/chunk-D7OAU32Z.js +0 -119
  944. package/dist/commands/chunk-DAAX7XDS.js +0 -1208
  945. package/dist/commands/chunk-DBKTFB5V.js +0 -18
  946. package/dist/commands/chunk-DEZF7QZZ.js +0 -184
  947. package/dist/commands/chunk-DMD74E3F.js +0 -39
  948. package/dist/commands/chunk-DPJVKTO4.js +0 -41
  949. package/dist/commands/chunk-DXJQHJQ4.js +0 -73
  950. package/dist/commands/chunk-DYZOOWVW.js +0 -912
  951. package/dist/commands/chunk-EBI2BAKQ.js +0 -47
  952. package/dist/commands/chunk-EDKOSZ3K.js +0 -88
  953. package/dist/commands/chunk-EFDVE5P5.js +0 -121
  954. package/dist/commands/chunk-EGIHAEMT.js +0 -72
  955. package/dist/commands/chunk-EKLU6QR7.js +0 -507
  956. package/dist/commands/chunk-ELY76WAR.js +0 -65
  957. package/dist/commands/chunk-EM3HAZF6.js +0 -52
  958. package/dist/commands/chunk-EMTZAGT5.js +0 -51
  959. package/dist/commands/chunk-ENKFCOVY.js +0 -472
  960. package/dist/commands/chunk-ERG4QRNG.js +0 -224
  961. package/dist/commands/chunk-EUGNQCYK.js +0 -139
  962. package/dist/commands/chunk-EW4NPUMQ.js +0 -363
  963. package/dist/commands/chunk-EWVR5AEX.js +0 -140
  964. package/dist/commands/chunk-EXDFKKMH.js +0 -113
  965. package/dist/commands/chunk-EXWB34R2.js +0 -238
  966. package/dist/commands/chunk-EYMPBHDN.js +0 -61
  967. package/dist/commands/chunk-EZ7IPKIH.js +0 -20
  968. package/dist/commands/chunk-EZSO25UZ.js +0 -80
  969. package/dist/commands/chunk-F6IQHZYY.js +0 -94
  970. package/dist/commands/chunk-FDS65XOJ.js +0 -212
  971. package/dist/commands/chunk-FFHEGWPK.js +0 -91
  972. package/dist/commands/chunk-FGL6DBZU.js +0 -71
  973. package/dist/commands/chunk-FHFWNNUC.js +0 -144
  974. package/dist/commands/chunk-FIUCHMCF.js +0 -32
  975. package/dist/commands/chunk-FJX7AENO.js +0 -74
  976. package/dist/commands/chunk-FKZ5E4JD.js +0 -97
  977. package/dist/commands/chunk-FMZWRDKH.js +0 -302
  978. package/dist/commands/chunk-FOKCRIAN.js +0 -67
  979. package/dist/commands/chunk-FQGWO2ZH.js +0 -43
  980. package/dist/commands/chunk-FROACLVU.js +0 -525
  981. package/dist/commands/chunk-FURNDIT3.js +0 -34
  982. package/dist/commands/chunk-FVDQNMP6.js +0 -93
  983. package/dist/commands/chunk-FVVZIJUC.js +0 -425
  984. package/dist/commands/chunk-FWU3H4TX.js +0 -17
  985. package/dist/commands/chunk-G3HBYHFA.js +0 -16
  986. package/dist/commands/chunk-G4E4M2P4.js +0 -299
  987. package/dist/commands/chunk-G5KSL2Q2.js +0 -151
  988. package/dist/commands/chunk-G6XC7V6Y.js +0 -58
  989. package/dist/commands/chunk-GCPP5XIG.js +0 -90
  990. package/dist/commands/chunk-GITT5A5A.js +0 -198
  991. package/dist/commands/chunk-GJYMI2CM.js +0 -48
  992. package/dist/commands/chunk-GLC47H7I.js +0 -285
  993. package/dist/commands/chunk-GUR54ELE.js +0 -328
  994. package/dist/commands/chunk-GW4UWR3O.js +0 -126
  995. package/dist/commands/chunk-GY4DMCKS.js +0 -306
  996. package/dist/commands/chunk-H6JQRHDC.js +0 -80
  997. package/dist/commands/chunk-HATKF6VX.js +0 -173
  998. package/dist/commands/chunk-HG2NZQD5.js +0 -135
  999. package/dist/commands/chunk-HH3CVIFU.js +0 -93
  1000. package/dist/commands/chunk-HHMMGDMP.js +0 -469
  1001. package/dist/commands/chunk-HI5WPM6C.js +0 -127
  1002. package/dist/commands/chunk-HQGNXR6I.js +0 -245
  1003. package/dist/commands/chunk-HTIDHEEN.js +0 -108
  1004. package/dist/commands/chunk-HVCQYZVD.js +0 -38
  1005. package/dist/commands/chunk-HWEZRNPL.js +0 -66
  1006. package/dist/commands/chunk-HX3FFIO5.js +0 -74
  1007. package/dist/commands/chunk-HXDTA5VU.js +0 -208
  1008. package/dist/commands/chunk-I2KCGKJI.js +0 -107
  1009. package/dist/commands/chunk-I63RNFFR.js +0 -213
  1010. package/dist/commands/chunk-IAD4WLLI.js +0 -98
  1011. package/dist/commands/chunk-IB5TT73I.js +0 -177
  1012. package/dist/commands/chunk-IBAYXCMU.js +0 -156
  1013. package/dist/commands/chunk-IF3EIFK4.js +0 -7515
  1014. package/dist/commands/chunk-IGDJNXX2.js +0 -49
  1015. package/dist/commands/chunk-ILGPZ47M.js +0 -33
  1016. package/dist/commands/chunk-IYJEBWW5.js +0 -44
  1017. package/dist/commands/chunk-J22PSIXR.js +0 -418
  1018. package/dist/commands/chunk-J66YBAAM.js +0 -161
  1019. package/dist/commands/chunk-J6WKZRV2.js +0 -391
  1020. package/dist/commands/chunk-J7IO3AYH.js +0 -179
  1021. package/dist/commands/chunk-JAKC2BHX.js +0 -88
  1022. package/dist/commands/chunk-JCAQ7B6J.js +0 -124
  1023. package/dist/commands/chunk-JHN6RCE6.js +0 -123
  1024. package/dist/commands/chunk-JIGBNCDR.js +0 -88
  1025. package/dist/commands/chunk-JJHWTFWQ.js +0 -76
  1026. package/dist/commands/chunk-JJRKTWLK.js +0 -64
  1027. package/dist/commands/chunk-JKOGWGQM.js +0 -92
  1028. package/dist/commands/chunk-JM6EVOFN.js +0 -172
  1029. package/dist/commands/chunk-JQXPLMCO.js +0 -81
  1030. package/dist/commands/chunk-JV24VP2O.js +0 -81
  1031. package/dist/commands/chunk-JVKXJ763.js +0 -45
  1032. package/dist/commands/chunk-K275REYP.js +0 -37
  1033. package/dist/commands/chunk-K4G3HOKS.js +0 -105
  1034. package/dist/commands/chunk-K64EIHD2.js +0 -138
  1035. package/dist/commands/chunk-KB3OQWDT.js +0 -71
  1036. package/dist/commands/chunk-KCFOP5RI.js +0 -1310
  1037. package/dist/commands/chunk-KGE4AS2Y.js +0 -134
  1038. package/dist/commands/chunk-KIILCKQR.js +0 -220
  1039. package/dist/commands/chunk-KK2SL42W.js +0 -241
  1040. package/dist/commands/chunk-KKIMVXAP.js +0 -280
  1041. package/dist/commands/chunk-KODXWMBX.js +0 -77
  1042. package/dist/commands/chunk-KPSKWTOS.js +0 -208
  1043. package/dist/commands/chunk-KVHNQHX3.js +0 -100
  1044. package/dist/commands/chunk-KWYQR5MK.js +0 -269
  1045. package/dist/commands/chunk-KXHXMERX.js +0 -214
  1046. package/dist/commands/chunk-KZ5BBBMO.js +0 -271
  1047. package/dist/commands/chunk-KZ7HD37E.js +0 -121
  1048. package/dist/commands/chunk-KZSM5M5P.js +0 -89
  1049. package/dist/commands/chunk-KZZWPUJW.js +0 -25
  1050. package/dist/commands/chunk-L7DAL54N.js +0 -347
  1051. package/dist/commands/chunk-LAR76BFA.js +0 -114
  1052. package/dist/commands/chunk-LB557AHJ.js +0 -192
  1053. package/dist/commands/chunk-LJXKVLYI.js +0 -229
  1054. package/dist/commands/chunk-LOOFYHUM.js +0 -773
  1055. package/dist/commands/chunk-LQXFVZTS.js +0 -13
  1056. package/dist/commands/chunk-LT7QSHR4.js +0 -995
  1057. package/dist/commands/chunk-LUXWDMKI.js +0 -426
  1058. package/dist/commands/chunk-LWAXXZPS.js +0 -118
  1059. package/dist/commands/chunk-LX7TIEMI.js +0 -1612
  1060. package/dist/commands/chunk-LZ5QXE5N.js +0 -244
  1061. package/dist/commands/chunk-M4UV3BEV.js +0 -313
  1062. package/dist/commands/chunk-M6JDU5EK.js +0 -133
  1063. package/dist/commands/chunk-MDLOETXL.js +0 -211
  1064. package/dist/commands/chunk-MFBNNTBM.js +0 -44
  1065. package/dist/commands/chunk-MGF64OHV.js +0 -32
  1066. package/dist/commands/chunk-MI2OS6TL.js +0 -132
  1067. package/dist/commands/chunk-MLW4S35K.js +0 -389
  1068. package/dist/commands/chunk-MN425CU6.js +0 -63
  1069. package/dist/commands/chunk-MPGJ4ONJ.js +0 -634
  1070. package/dist/commands/chunk-MRORPFSO.js +0 -402
  1071. package/dist/commands/chunk-MUGTOJUL.js +0 -319
  1072. package/dist/commands/chunk-MVHPRYHE.js +0 -91
  1073. package/dist/commands/chunk-MWO6FOSZ.js +0 -393
  1074. package/dist/commands/chunk-MXC4IBZ7.js +0 -104
  1075. package/dist/commands/chunk-N7QTMTST.js +0 -210
  1076. package/dist/commands/chunk-NDBX7LSS.js +0 -32
  1077. package/dist/commands/chunk-NEGJ77RV.js +0 -173
  1078. package/dist/commands/chunk-NEGRE5VW.js +0 -101
  1079. package/dist/commands/chunk-NFPD2P3V.js +0 -53
  1080. package/dist/commands/chunk-NHIW7JE6.js +0 -335
  1081. package/dist/commands/chunk-NILSN7A4.js +0 -158
  1082. package/dist/commands/chunk-NOLFSPOB.js +0 -74
  1083. package/dist/commands/chunk-NSAVEXVR.js +0 -353
  1084. package/dist/commands/chunk-NT67QTZO.js +0 -65
  1085. package/dist/commands/chunk-NU7W6QGT.js +0 -155
  1086. package/dist/commands/chunk-NYWGJLBU.js +0 -19
  1087. package/dist/commands/chunk-OAAVY2JK.js +0 -49
  1088. package/dist/commands/chunk-OGS2DK7I.js +0 -47
  1089. package/dist/commands/chunk-OHNP3QL2.js +0 -186
  1090. package/dist/commands/chunk-OIPV3PWW.js +0 -870
  1091. package/dist/commands/chunk-OIX2363L.js +0 -16
  1092. package/dist/commands/chunk-OJ65BZBV.js +0 -646
  1093. package/dist/commands/chunk-OKZWEVR4.js +0 -352
  1094. package/dist/commands/chunk-OL6IF4JC.js +0 -20
  1095. package/dist/commands/chunk-OMPRILFH.js +0 -29
  1096. package/dist/commands/chunk-OOWGH2RG.js +0 -85
  1097. package/dist/commands/chunk-OP2RFVLS.js +0 -102
  1098. package/dist/commands/chunk-ORKVN2LO.js +0 -56
  1099. package/dist/commands/chunk-OSBWXZJ4.js +0 -492
  1100. package/dist/commands/chunk-OT3UMEWK.js +0 -47
  1101. package/dist/commands/chunk-OVWPZDWP.js +0 -64
  1102. package/dist/commands/chunk-OWYK2BEJ.js +0 -1222
  1103. package/dist/commands/chunk-OX3VQLV2.js +0 -488
  1104. package/dist/commands/chunk-OZJP77UM.js +0 -103
  1105. package/dist/commands/chunk-OZZWRJQI.js +0 -246
  1106. package/dist/commands/chunk-P3H3DKTE.js +0 -69
  1107. package/dist/commands/chunk-P4D5RESF.js +0 -88
  1108. package/dist/commands/chunk-P4KIQRSL.js +0 -119
  1109. package/dist/commands/chunk-P5SOYWH2.js +0 -37
  1110. package/dist/commands/chunk-P7FPXAHP.js +0 -29
  1111. package/dist/commands/chunk-PE7B7242.js +0 -84
  1112. package/dist/commands/chunk-PFO7EYAP.js +0 -45
  1113. package/dist/commands/chunk-PHLOTUB7.js +0 -366
  1114. package/dist/commands/chunk-PTNQCCIB.js +0 -41
  1115. package/dist/commands/chunk-PTZEFQUX.js +0 -211
  1116. package/dist/commands/chunk-Q5Q2QYVU.js +0 -112
  1117. package/dist/commands/chunk-Q7EEIOAD.js +0 -120
  1118. package/dist/commands/chunk-QABRNGQV.js +0 -88
  1119. package/dist/commands/chunk-QAHFPCFR.js +0 -50
  1120. package/dist/commands/chunk-QDFVVRQP.js +0 -92
  1121. package/dist/commands/chunk-QGAERR7D.js +0 -99
  1122. package/dist/commands/chunk-QHWJJ6X5.js +0 -53
  1123. package/dist/commands/chunk-QJRVDE7T.js +0 -307
  1124. package/dist/commands/chunk-QMDKDQKW.js +0 -114
  1125. package/dist/commands/chunk-QOSC5RKD.js +0 -18
  1126. package/dist/commands/chunk-QQ4CIYMF.js +0 -132
  1127. package/dist/commands/chunk-QV5FKMOU.js +0 -80
  1128. package/dist/commands/chunk-QWWTC3XR.js +0 -109
  1129. package/dist/commands/chunk-QXQ56E56.js +0 -27
  1130. package/dist/commands/chunk-R54Z2Z3X.js +0 -114
  1131. package/dist/commands/chunk-R6QE5VJG.js +0 -46
  1132. package/dist/commands/chunk-RG53UFNW.js +0 -418
  1133. package/dist/commands/chunk-RGGEQM6G.js +0 -140
  1134. package/dist/commands/chunk-RH6ZWJOA.js +0 -77
  1135. package/dist/commands/chunk-RHKCWJQX.js +0 -62
  1136. package/dist/commands/chunk-RKIAX4DZ.js +0 -191
  1137. package/dist/commands/chunk-RLBFEHHC.js +0 -300
  1138. package/dist/commands/chunk-RN2YDNLF.js +0 -229
  1139. package/dist/commands/chunk-RRAIRS2T.js +0 -54
  1140. package/dist/commands/chunk-RS764ZMU.js +0 -46
  1141. package/dist/commands/chunk-RUIBQMOV.js +0 -38
  1142. package/dist/commands/chunk-RUQY5TS3.js +0 -83
  1143. package/dist/commands/chunk-RVUJ6F5L.js +0 -181
  1144. package/dist/commands/chunk-RW64VHEB.js +0 -130
  1145. package/dist/commands/chunk-RXYMJPJB.js +0 -114
  1146. package/dist/commands/chunk-S4M6UWR2.js +0 -103
  1147. package/dist/commands/chunk-SASX3W2M.js +0 -99
  1148. package/dist/commands/chunk-SFNBUB6D.js +0 -110
  1149. package/dist/commands/chunk-SJ2ZN575.js +0 -90
  1150. package/dist/commands/chunk-SP7DKYGU.js +0 -1263
  1151. package/dist/commands/chunk-SSL6A3Y4.js +0 -165
  1152. package/dist/commands/chunk-SVAKCXZ7.js +0 -44
  1153. package/dist/commands/chunk-SYOXIKB7.js +0 -705
  1154. package/dist/commands/chunk-SZG5HDNP.js +0 -321
  1155. package/dist/commands/chunk-T25S4QHL.js +0 -52
  1156. package/dist/commands/chunk-T4F33UKZ.js +0 -114
  1157. package/dist/commands/chunk-T4UYEHWG.js +0 -50
  1158. package/dist/commands/chunk-TAEGXID2.js +0 -58
  1159. package/dist/commands/chunk-TCBUX52E.js +0 -701
  1160. package/dist/commands/chunk-TEPYEUYG.js +0 -585
  1161. package/dist/commands/chunk-TFLHYC2F.js +0 -141
  1162. package/dist/commands/chunk-TJKM56WJ.js +0 -109
  1163. package/dist/commands/chunk-TLAB552K.js +0 -445
  1164. package/dist/commands/chunk-TP6L4W3W.js +0 -82
  1165. package/dist/commands/chunk-TR7WWYD5.js +0 -60
  1166. package/dist/commands/chunk-TVZXG4Y4.js +0 -197
  1167. package/dist/commands/chunk-TYNH2R66.js +0 -1150
  1168. package/dist/commands/chunk-U3IVVR4W.js +0 -33
  1169. package/dist/commands/chunk-U5P6G3UV.js +0 -77
  1170. package/dist/commands/chunk-U7XU5RG3.js +0 -86
  1171. package/dist/commands/chunk-UKBBWMLE.js +0 -1189
  1172. package/dist/commands/chunk-ULVVGGTY.js +0 -64
  1173. package/dist/commands/chunk-UNMSZGSG.js +0 -269
  1174. package/dist/commands/chunk-URDT2O2K.js +0 -36
  1175. package/dist/commands/chunk-UTHUX7VU.js +0 -88
  1176. package/dist/commands/chunk-V4Z7G4UH.js +0 -73
  1177. package/dist/commands/chunk-V5FD7DVV.js +0 -48
  1178. package/dist/commands/chunk-VCPGFBMN.js +0 -655
  1179. package/dist/commands/chunk-VGPIQNDB.js +0 -24
  1180. package/dist/commands/chunk-VJE3RJAX.js +0 -23
  1181. package/dist/commands/chunk-VK6D5CWA.js +0 -161
  1182. package/dist/commands/chunk-VOF3N4WO.js +0 -114
  1183. package/dist/commands/chunk-VQVPAVQ3.js +0 -45
  1184. package/dist/commands/chunk-VV4TQYGD.js +0 -38
  1185. package/dist/commands/chunk-W3FX7FYN.js +0 -84
  1186. package/dist/commands/chunk-W7DRUOF7.js +0 -122
  1187. package/dist/commands/chunk-WAEN2RTT.js +0 -161
  1188. package/dist/commands/chunk-WCEUMOKK.js +0 -84
  1189. package/dist/commands/chunk-WJ4NEDNI.js +0 -288
  1190. package/dist/commands/chunk-WMMGXJXP.js +0 -92
  1191. package/dist/commands/chunk-WOFLW2LX.js +0 -26
  1192. package/dist/commands/chunk-WTH6NTXU.js +0 -128
  1193. package/dist/commands/chunk-WWVYEHQT.js +0 -272
  1194. package/dist/commands/chunk-X3TNPALI.js +0 -213
  1195. package/dist/commands/chunk-XC6GG5JR.js +0 -78
  1196. package/dist/commands/chunk-XDF25GSU.js +0 -536
  1197. package/dist/commands/chunk-XFPEUYDV.js +0 -67
  1198. package/dist/commands/chunk-XFWI6WHH.js +0 -60
  1199. package/dist/commands/chunk-XGMRAKSL.js +0 -85
  1200. package/dist/commands/chunk-XHGWMD3L.js +0 -104
  1201. package/dist/commands/chunk-XKSUBUIH.js +0 -116
  1202. package/dist/commands/chunk-XPBF5DG3.js +0 -419
  1203. package/dist/commands/chunk-XUMYPESL.js +0 -160
  1204. package/dist/commands/chunk-XXC32PVL.js +0 -541
  1205. package/dist/commands/chunk-XXN2EZBY.js +0 -133
  1206. package/dist/commands/chunk-XXNEY4B3.js +0 -110
  1207. package/dist/commands/chunk-Y27PTXXI.js +0 -258
  1208. package/dist/commands/chunk-Y4EBUI6M.js +0 -237
  1209. package/dist/commands/chunk-YAU3LYNF.js +0 -60
  1210. package/dist/commands/chunk-YDURQICF.js +0 -204
  1211. package/dist/commands/chunk-YGFOGA7C.js +0 -1153
  1212. package/dist/commands/chunk-YHJ2AJMA.js +0 -66
  1213. package/dist/commands/chunk-YIA6FC3K.js +0 -78
  1214. package/dist/commands/chunk-YM77CF4D.js +0 -183
  1215. package/dist/commands/chunk-YNPRJCEO.js +0 -81
  1216. package/dist/commands/chunk-YTBQAD5W.js +0 -170
  1217. package/dist/commands/chunk-YVH2OLDS.js +0 -104
  1218. package/dist/commands/chunk-Z3WGHIVB.js +0 -122
  1219. package/dist/commands/chunk-ZAAHZY2A.js +0 -19
  1220. package/dist/commands/chunk-ZBZ5DDCH.js +0 -1866
  1221. package/dist/commands/chunk-ZLRUHSOP.js +0 -48
  1222. package/dist/commands/chunk-ZNR75OXP.js +0 -444
  1223. package/dist/commands/chunk-ZSOR4ISJ.js +0 -75
  1224. package/dist/commands/chunk-ZVAIIHBE.js +0 -63
  1225. package/dist/commands/chunk-ZYFHYQA7.js +0 -51
  1226. package/dist/commands/chunk-ZZFFSQF4.js +0 -218
  1227. package/dist/commands/chunk-ZZULXNC2.js +0 -47
  1228. package/dist/commands/chunk-ZZXO6TFH.js +0 -232
  1229. package/dist/commands/run-ship-lap-W5T2VHFC.js +0 -30
  1230. package/dist/commands/test-related-ZCNC46MS.js +0 -113
  1231. package/dist/commands/unused-members-STULPRBU.js +0 -331
  1232. package/dist/hooks/chunk-5CUXGQT6.js +0 -8353
  1233. package/dist/hooks/chunk-5R5YFQR5.js +0 -931
  1234. package/dist/hooks/chunk-6RLY27FT.js +0 -232
  1235. package/dist/hooks/chunk-6YGMIODI.js +0 -86
  1236. package/dist/hooks/chunk-AO4TOV4V.js +0 -5026
  1237. package/dist/hooks/chunk-FOW4B7OQ.js +0 -1795
  1238. package/dist/hooks/chunk-G5WSPYJ6.js +0 -5663
  1239. package/dist/hooks/chunk-HHIVWGHX.js +0 -6869
  1240. package/dist/hooks/chunk-IURJANNZ.js +0 -1082
  1241. package/dist/hooks/chunk-OV22V63P.js +0 -10980
  1242. package/dist/hooks/chunk-SXABK6UV.js +0 -321
  1243. package/dist/hooks/run-ship-lap-VCEOUHQI.js +0 -8
@@ -0,0 +1,1263 @@
1
+ import {
2
+ run_handoff_launch
3
+ } from "./chunk-2GA4775H.js";
4
+ import {
5
+ lane_net_read
6
+ } from "./chunk-GBMZXFFC.js";
7
+ import {
8
+ lane_ledger_archive
9
+ } from "./chunk-ESUY7KTZ.js";
10
+ import {
11
+ guard_rephrase
12
+ } from "./chunk-6FWV56B3.js";
13
+ import {
14
+ lane_breakdown
15
+ } from "./chunk-R7PYR4HW.js";
16
+ import {
17
+ git_gh_command
18
+ } from "./chunk-NRULNBYI.js";
19
+ import {
20
+ delivered_rules
21
+ } from "./chunk-FJMXUDEY.js";
22
+ import {
23
+ cost_pricing
24
+ } from "./chunk-5PLJ7R3D.js";
25
+ import {
26
+ lane_stats
27
+ } from "./chunk-2XLR7R6E.js";
28
+ import {
29
+ time_transcript_line
30
+ } from "./chunk-YSLGWRQN.js";
31
+ import {
32
+ cost_blocks,
33
+ time_josh_names,
34
+ time_shell
35
+ } from "./chunk-LHKXJD6L.js";
36
+ import {
37
+ transcript_record
38
+ } from "./chunk-O3NDWYNT.js";
39
+ import {
40
+ figure_format
41
+ } from "./chunk-7EAYFMDN.js";
42
+ import {
43
+ git_gh_exec,
44
+ parse_json
45
+ } from "./chunk-43DU7DYZ.js";
46
+ import {
47
+ cost_transcript,
48
+ cost_usage
49
+ } from "./chunk-DDZVMXZD.js";
50
+ import {
51
+ lane_paths
52
+ } from "./chunk-G75GWNNY.js";
53
+ import {
54
+ cli_flags
55
+ } from "./chunk-2FE3C4PH.js";
56
+ import {
57
+ file_reader
58
+ } from "./chunk-ZNX2LJCQ.js";
59
+ import {
60
+ json_value
61
+ } from "./chunk-HIU2WXB6.js";
62
+
63
+ // tools/cost-audit/cost-audit-cli.ts
64
+ import { z as z2 } from "zod";
65
+
66
+ // tools/retrospective/guard-friction.ts
67
+ function renamed_pairs(reason, former_reasons) {
68
+ const current = time_transcript_line.guard_from_refusal(reason);
69
+ return former_reasons.map((former) => [time_transcript_line.guard_from_refusal(former), current]);
70
+ }
71
+ var RENAMED_GUARDS = new Map(
72
+ delivered_rules.MEASURED_RULES.flatMap(
73
+ (rule) => renamed_pairs(rule.reason, rule.former_reasons ?? [])
74
+ ).filter(([former, current]) => former !== current)
75
+ );
76
+ function guard_name(raw_guard) {
77
+ return RENAMED_GUARDS.get(raw_guard) ?? raw_guard;
78
+ }
79
+ function hit(guard, kind, at_ms) {
80
+ return { guard: guard_name(guard), kind, at_ms };
81
+ }
82
+ function line_hits(line) {
83
+ const refusals = line.blocks.filter((block) => block.refusal_guard !== "").map((block) => hit(block.refusal_guard, "refusal", line.timestamp_ms));
84
+ const stops = line.stop_guard === "" ? [] : [hit(line.stop_guard, "stop", line.timestamp_ms)];
85
+ return [...refusals, ...stops];
86
+ }
87
+ function hits_of(lines) {
88
+ return lines.flatMap((line) => line_hits(line));
89
+ }
90
+ function answer_of(at_ms, records) {
91
+ return records.find((record) => record.at_ms !== void 0 && record.at_ms >= at_ms);
92
+ }
93
+ function share_counts(answers) {
94
+ const counts = /* @__PURE__ */ new Map();
95
+ for (const answer of answers) {
96
+ if (answer !== void 0) counts.set(answer, (counts.get(answer) ?? 0) + 1);
97
+ }
98
+ return counts;
99
+ }
100
+ function share_usd(answer, counts) {
101
+ if (answer === void 0) return 0;
102
+ return cost_pricing.cost_of([answer]) / (counts.get(answer) ?? 1);
103
+ }
104
+ function priced_hits(session) {
105
+ const hits = hits_of(session.lines);
106
+ const answers = hits.map((one) => answer_of(one.at_ms, session.node.records));
107
+ const counts = share_counts(answers);
108
+ return hits.map((one, index) => [one, share_usd(answers[index], counts)]);
109
+ }
110
+ function count_of(kind, wanted) {
111
+ return kind === wanted ? 1 : 0;
112
+ }
113
+ function row_of(rows, guard) {
114
+ return rows.get(guard) ?? { guard, refusals: 0, stops: 0, rephrased: 0, usd: 0 };
115
+ }
116
+ function add_hit(rows, one, usd) {
117
+ const row2 = row_of(rows, one.guard);
118
+ rows.set(one.guard, {
119
+ ...row2,
120
+ refusals: row2.refusals + count_of(one.kind, "refusal"),
121
+ stops: row2.stops + count_of(one.kind, "stop"),
122
+ usd: row2.usd + usd
123
+ });
124
+ }
125
+ function add_rephrase(rows, raw_guard) {
126
+ const guard = guard_name(raw_guard);
127
+ const row2 = row_of(rows, guard);
128
+ rows.set(guard, { ...row2, rephrased: row2.rephrased + 1 });
129
+ }
130
+ function add_session(rows, session) {
131
+ for (const [one, usd] of priced_hits(session)) add_hit(rows, one, usd);
132
+ for (const guard of guard_rephrase.rephrased_guards(session.lines)) add_rephrase(rows, guard);
133
+ }
134
+ function total_hits(row2) {
135
+ return row2.refusals + row2.stops;
136
+ }
137
+ function guard_rows(sessions) {
138
+ const rows = /* @__PURE__ */ new Map();
139
+ for (const session of sessions) add_session(rows, session);
140
+ return [...rows.values()].toSorted((left, right) => total_hits(right) - total_hits(left));
141
+ }
142
+ function sum_of(rows, field) {
143
+ return rows.reduce((total, row2) => total + row2[field], 0);
144
+ }
145
+ function row_line(row2) {
146
+ return ` ${row2.guard}: ${String(row2.refusals)} refused, ${String(row2.rephrased)} rephrased, ${String(row2.stops)} stopped, ${figure_format.format_usd(row2.usd)}`;
147
+ }
148
+ function report_lines(rows) {
149
+ if (rows.length === 0) return ["Guard friction: none"];
150
+ const refusals = String(sum_of(rows, "refusals"));
151
+ const stops = String(sum_of(rows, "stops"));
152
+ const usd = figure_format.format_usd(sum_of(rows, "usd"));
153
+ const head = `Guard friction: ${refusals} refusal(s), ${stops} Stop re-entry(ies), ${usd} in round trips`;
154
+ return [head, ...rows.map((row2) => row_line(row2))];
155
+ }
156
+ var guard_friction = { guard_name, guard_rows, report_lines };
157
+
158
+ // tools/cost-audit/cost-audit-density.ts
159
+ var SUBAGENT_KIND = "subagent";
160
+ var SINGLE_CALL = 1;
161
+ function is_lane_child(session) {
162
+ return session.is_lane && session.kind !== SUBAGENT_KIND;
163
+ }
164
+ function call_counts(session) {
165
+ return session.records.map((record) => session.categories.get(record.request_id)?.length ?? 0).filter((count) => count > 0);
166
+ }
167
+ function density_of(sessions) {
168
+ const counts = sessions.filter((session) => is_lane_child(session)).flatMap((session) => call_counts(session));
169
+ return {
170
+ requests: counts.length,
171
+ calls: counts.reduce((sum, count) => sum + count, 0),
172
+ single: counts.filter((count) => count === SINGLE_CALL).length
173
+ };
174
+ }
175
+ function calls_per_request(density) {
176
+ return density.requests === 0 ? 0 : density.calls / density.requests;
177
+ }
178
+ function single_share(density) {
179
+ return density.requests === 0 ? 0 : density.single / density.requests;
180
+ }
181
+ var cost_audit_density = { calls_per_request, density_of, single_share };
182
+
183
+ // tools/cost-audit/cost-audit-kind.ts
184
+ var RUN_KEYWORDS = ["fullrun", "halfrun", "prrun", "backlogrun", "kickoff"];
185
+ var CONVERSATION = "conversation";
186
+ var REVIEW = "review";
187
+ var REVIEW_MARKER = "/code-review";
188
+ var RESUME_PREFIX = "Resuming";
189
+ var WAKE_MARKER = "Driver handoff";
190
+ var WORD_PATTERN = /^\s*([a-z]+)/u;
191
+ var RULES = [
192
+ { kind: "wake", matches: (prompt) => prompt.includes(WAKE_MARKER) },
193
+ { kind: "handoff", matches: (prompt) => prompt.includes(run_handoff_launch.ORIGIN_MARKER) },
194
+ { kind: REVIEW, matches: (prompt) => prompt.includes(REVIEW_MARKER) },
195
+ { kind: "subagent", matches: (_prompt, is_delegated) => is_delegated },
196
+ { kind: "resume", matches: (prompt) => prompt.trimStart().startsWith(RESUME_PREFIX) }
197
+ ];
198
+ function run_keyword(prompt) {
199
+ const word = WORD_PATTERN.exec(prompt)?.[1] ?? "";
200
+ return RUN_KEYWORDS.find((keyword) => keyword === word);
201
+ }
202
+ function kind_of(prompt, is_delegated) {
203
+ const rule = RULES.find((one) => one.matches(prompt, is_delegated));
204
+ return rule?.kind ?? run_keyword(prompt) ?? CONVERSATION;
205
+ }
206
+ var cost_audit_kind = { CONVERSATION, REVIEW, kind_of };
207
+
208
+ // tools/cost-audit/cost-audit-spend.ts
209
+ function spend_of_model(cost) {
210
+ const price = cost_pricing.resolve_price(cost.model);
211
+ if (price === void 0) return void 0;
212
+ const terms = cost_pricing.estimate_composition(cost.totals, price);
213
+ return {
214
+ model: cost.model,
215
+ input: terms.input_usd,
216
+ cache_read: terms.cache_read_usd,
217
+ cache_write: terms.cache_write_5m_usd + terms.cache_write_1h_usd,
218
+ output: terms.output_usd
219
+ };
220
+ }
221
+ function total_of(spend) {
222
+ return spend.input + spend.cache_read + spend.cache_write + spend.output;
223
+ }
224
+ function spend_of(records) {
225
+ return cost_pricing.cost_by_model(records).map((cost) => spend_of_model(cost)).filter((spend) => spend !== void 0).toSorted((left, right) => total_of(right) - total_of(left));
226
+ }
227
+ var cost_audit_spend = { spend_of, total_of };
228
+
229
+ // tools/cost-audit/cost-audit-usage.ts
230
+ var LONG_OUTPUT_TOKENS = 2e3;
231
+ function record_cache_write(record) {
232
+ const price = cost_pricing.resolve_price(record.model);
233
+ const tokens = {
234
+ tokens_5m: record.totals.cache_write_5m_tokens,
235
+ tokens_1h: record.totals.cache_write_1h_tokens
236
+ };
237
+ if (price === void 0) return { ...tokens, usd_5m: 0, usd_1h: 0 };
238
+ const terms = cost_pricing.estimate_composition(record.totals, price);
239
+ return { ...tokens, usd_5m: terms.cache_write_5m_usd, usd_1h: terms.cache_write_1h_usd };
240
+ }
241
+ function cache_write_of(records) {
242
+ const total = { tokens_5m: 0, tokens_1h: 0, usd_5m: 0, usd_1h: 0 };
243
+ for (const record of records) {
244
+ const write = record_cache_write(record);
245
+ total.tokens_5m += write.tokens_5m;
246
+ total.tokens_1h += write.tokens_1h;
247
+ total.usd_5m += write.usd_5m;
248
+ total.usd_1h += write.usd_1h;
249
+ }
250
+ return total;
251
+ }
252
+ function add_run(runs, agent_type, records) {
253
+ const run2 = runs.get(agent_type) ?? { agent_type, runs: 0, calls: 0, usd: 0 };
254
+ runs.set(agent_type, {
255
+ agent_type,
256
+ runs: run2.runs + 1,
257
+ calls: run2.calls + records.length,
258
+ usd: run2.usd + cost_pricing.cost_of(records)
259
+ });
260
+ }
261
+ function agents_of(sessions) {
262
+ const runs = /* @__PURE__ */ new Map();
263
+ for (const session of sessions) {
264
+ if (session.agent_type !== void 0 && session.records.length > 0) {
265
+ add_run(runs, session.agent_type, session.records);
266
+ }
267
+ }
268
+ return [...runs.values()].toSorted((left, right) => right.usd - left.usd);
269
+ }
270
+ function context_tokens(record) {
271
+ const { input_tokens, cache_read_tokens, cache_write_5m_tokens, cache_write_1h_tokens } = record.totals;
272
+ return input_tokens + cache_read_tokens + cache_write_5m_tokens + cache_write_1h_tokens;
273
+ }
274
+ function first_context_of(sessions, is_inside2) {
275
+ const firsts = sessions.map((session) => session.records[0]).filter((record) => record !== void 0 && is_inside2(record.at_ms));
276
+ const tokens = firsts.map((record) => context_tokens(record));
277
+ return { sessions: tokens.length, p50_tokens: lane_stats.median(tokens) };
278
+ }
279
+ function long_records(records) {
280
+ return records.filter((record) => record.totals.output_tokens > LONG_OUTPUT_TOKENS);
281
+ }
282
+ function long_calls_of(records) {
283
+ return long_records(records).length;
284
+ }
285
+ function long_output_of(records) {
286
+ const long = long_records(records);
287
+ return { calls: long.length, all_calls: records.length, usd: cost_pricing.cost_of(long) };
288
+ }
289
+ function is_subagent(session) {
290
+ return session.agent_type !== void 0;
291
+ }
292
+ function breakdown_of(sessions, is_inside2) {
293
+ const cut = sessions.map((session) => ({
294
+ ...session,
295
+ records: session.records.filter((record) => is_inside2(record.at_ms))
296
+ }));
297
+ const records = cut.flatMap((session) => session.records);
298
+ return {
299
+ cache_write: cache_write_of(records),
300
+ agents: agents_of(cut),
301
+ first_main: first_context_of(
302
+ sessions.filter((session) => !is_subagent(session)),
303
+ is_inside2
304
+ ),
305
+ first_subagent: first_context_of(
306
+ sessions.filter((session) => is_subagent(session)),
307
+ is_inside2
308
+ ),
309
+ long_output: long_output_of(records)
310
+ };
311
+ }
312
+ var cost_audit_usage = { LONG_OUTPUT_TOKENS, breakdown_of, long_calls_of };
313
+
314
+ // tools/cost-audit/cost-audit-phase.ts
315
+ var REVIEW_KIND = cost_audit_kind.REVIEW;
316
+ var PLAN = "plan";
317
+ var UNATTRIBUTED = "unattributed";
318
+ var ROUND_ONE = "review round 1";
319
+ var ROUND_TWO = "review round 2";
320
+ var IMPLEMENT_LEAD = "implement: ";
321
+ var REVIEW_FIX = "review-fix";
322
+ var AGENT_LEAD = "subagent: ";
323
+ var EDIT = "edit";
324
+ var IMPLEMENT_KINDS = [
325
+ ["verification", "check"],
326
+ ["edit", EDIT],
327
+ ["code search", "read"],
328
+ ["doc read", "read"]
329
+ ];
330
+ var NO_TOKENS = { input: 0, cache_read: 0, cache_write: 0, output: 0 };
331
+ function tokens_of(totals) {
332
+ return {
333
+ input: totals.input_tokens,
334
+ cache_read: totals.cache_read_tokens,
335
+ cache_write: totals.cache_write_5m_tokens + totals.cache_write_1h_tokens,
336
+ output: totals.output_tokens
337
+ };
338
+ }
339
+ function summed(left, right) {
340
+ return {
341
+ input: left.input + right.input,
342
+ cache_read: left.cache_read + right.cache_read,
343
+ cache_write: left.cache_write + right.cache_write,
344
+ output: left.output + right.output
345
+ };
346
+ }
347
+ function implement_kind(categories) {
348
+ return IMPLEMENT_KINDS.find(([category]) => categories.includes(category))?.[1] ?? EDIT;
349
+ }
350
+ function is_fix(placed, at_ms) {
351
+ return placed.review_from_ms !== void 0 && at_ms > placed.review_from_ms;
352
+ }
353
+ function implement_phase(placed, at_ms) {
354
+ const categories = placed.session.categories.get(placed.record.request_id) ?? [];
355
+ return `${IMPLEMENT_LEAD}${is_fix(placed, at_ms) ? REVIEW_FIX : implement_kind(categories)}`;
356
+ }
357
+ function between_phase(placed, at_ms) {
358
+ return is_fix(placed, at_ms) ? `${IMPLEMENT_LEAD}${REVIEW_FIX}` : lane_breakdown.BETWEEN_STAGE;
359
+ }
360
+ function review_round(stage) {
361
+ return stage === lane_breakdown.ROUND_TWO_STAGE ? ROUND_TWO : ROUND_ONE;
362
+ }
363
+ function stage_phase(placed, stage, at_ms) {
364
+ if (placed.session.kind === REVIEW_KIND) return review_round(stage);
365
+ if (stage === lane_breakdown.PLAN_STAGE) return PLAN;
366
+ if (stage === lane_breakdown.IMPLEMENT_STAGE) return implement_phase(placed, at_ms);
367
+ return stage === lane_breakdown.BETWEEN_STAGE ? between_phase(placed, at_ms) : stage;
368
+ }
369
+ function phase_of(placed) {
370
+ const { at_ms } = placed.record;
371
+ if (at_ms === void 0 || placed.breakdown === void 0) return UNATTRIBUTED;
372
+ const stage = lane_breakdown.stage_at(placed.breakdown, at_ms);
373
+ return stage === void 0 ? UNATTRIBUTED : stage_phase(placed, stage, at_ms);
374
+ }
375
+ function review_from_ms(sessions, issue) {
376
+ const instants = sessions.filter((session) => session.issue === issue && session.kind === REVIEW_KIND).flatMap((session) => session.records.map((record) => record.at_ms)).filter((at_ms) => at_ms !== void 0);
377
+ return instants.length === 0 ? void 0 : Math.min(...instants);
378
+ }
379
+ function add_record(groups, key, record) {
380
+ groups.set(key, [...groups.get(key) ?? [], record]);
381
+ }
382
+ function tokens_sum(records) {
383
+ let tokens = NO_TOKENS;
384
+ for (const record of records) tokens = summed(tokens, tokens_of(record.totals));
385
+ return tokens;
386
+ }
387
+ function row_of2(key, records) {
388
+ return {
389
+ key,
390
+ tokens: tokens_sum(records),
391
+ usd: cost_pricing.cost_of(records),
392
+ models: cost_audit_spend.spend_of(records),
393
+ long_calls: cost_audit_usage.long_calls_of(records)
394
+ };
395
+ }
396
+ function add_session2(rows, input, session) {
397
+ const { issue } = session;
398
+ if (issue === void 0) return;
399
+ const breakdown = input.breakdowns.get(issue);
400
+ const from_ms = review_from_ms(input.reviews, issue);
401
+ for (const record of session.records) {
402
+ add_record(rows, phase_of({ session, record, breakdown, review_from_ms: from_ms }), record);
403
+ }
404
+ }
405
+ function sorted(groups) {
406
+ return [...groups].map(([key, records]) => row_of2(key, records)).toSorted((left, right) => right.usd - left.usd);
407
+ }
408
+ function rows_of(input) {
409
+ const rows = /* @__PURE__ */ new Map();
410
+ for (const session of input.sessions) add_session2(rows, input, session);
411
+ return sorted(rows);
412
+ }
413
+ function agent_key(session) {
414
+ return session.agent_type === void 0 ? session.kind : `${AGENT_LEAD}${session.agent_type}`;
415
+ }
416
+ function add_unit(rows, session) {
417
+ if (session.issue === void 0 || session.is_lane) return;
418
+ for (const record of session.records) add_record(rows, agent_key(session), record);
419
+ }
420
+ function agent_rows_of(sessions) {
421
+ const rows = /* @__PURE__ */ new Map();
422
+ for (const session of sessions) add_unit(rows, session);
423
+ return sorted(rows);
424
+ }
425
+ var cost_audit_phase = { PLAN, ROUND_ONE, ROUND_TWO, UNATTRIBUTED, agent_rows_of, rows_of };
426
+
427
+ // tools/cost-audit/cost-audit-command.ts
428
+ var KEY_WORD_LIMIT = 3;
429
+ var SUBCOMMAND_PATTERN = /^[a-z][\w:-]*$/u;
430
+ function command_key(command) {
431
+ const segment = time_shell.command_segment(command);
432
+ if (segment === "" || time_shell.runs_josh(segment)) return "";
433
+ const [head = "", ...rest] = time_shell.command_words(segment);
434
+ const stop = rest.findIndex((word) => !SUBCOMMAND_PATTERN.test(word));
435
+ const subcommands = stop === -1 ? rest : rest.slice(0, stop);
436
+ return [head, ...subcommands.slice(0, KEY_WORD_LIMIT - 1)].join(" ");
437
+ }
438
+ var cost_audit_command = { command_key };
439
+
440
+ // tools/cost-audit/cost-audit-result.ts
441
+ var UNKNOWN_EFFORT = "unknown";
442
+ var READ_TOOL = "Read";
443
+ var BASH_TOOL = "Bash";
444
+ var FILE_PATH_KEY = "file_path";
445
+ var ROW_LIMIT = 10;
446
+ function add(totals, key, value) {
447
+ totals.set(key, (totals.get(key) ?? 0) + value);
448
+ }
449
+ function effort_by_request(lines) {
450
+ const priced = lines.filter((line) => line.request_id !== "" && line.effort !== "");
451
+ return new Map(priced.map((line) => [line.request_id, line.effort]));
452
+ }
453
+ function add_efforts(totals, session) {
454
+ const efforts = effort_by_request(session.lines);
455
+ for (const record of session.records) {
456
+ add(totals, efforts.get(record.request_id) ?? UNKNOWN_EFFORT, cost_pricing.cost_of([record]));
457
+ }
458
+ }
459
+ function calls_of(blocks) {
460
+ const calls = blocks.filter((block) => block.type === transcript_record.TOOL_USE_TYPE);
461
+ return new Map(calls.filter((call) => call.id !== "").map((call) => [call.id, call]));
462
+ }
463
+ function results_of(lines, seen) {
464
+ const blocks = lines.flatMap((line) => line.blocks);
465
+ const calls = calls_of(blocks);
466
+ const fresh = blocks.filter((block) => block.result_id !== "" && !seen.has(block.result_id));
467
+ for (const block of fresh) seen.add(block.result_id);
468
+ return fresh.map((block) => ({ call: calls.get(block.result_id), chars: block.result_chars })).filter((result) => result.call !== void 0);
469
+ }
470
+ function josh_of(call) {
471
+ if (call.name !== BASH_TOOL) return "";
472
+ return time_josh_names.josh_command_of(time_shell.bash_command(call.input));
473
+ }
474
+ function command_of(call) {
475
+ if (call.name !== BASH_TOOL) return "";
476
+ return cost_audit_command.command_key(time_shell.bash_command(call.input));
477
+ }
478
+ function read_path(call) {
479
+ if (call.name !== READ_TOOL || !json_value.is_record(call.input)) return "";
480
+ const value = call.input[FILE_PATH_KEY];
481
+ return typeof value === "string" ? value : "";
482
+ }
483
+ function repeats_of(results) {
484
+ const seen = /* @__PURE__ */ new Set();
485
+ const reads = results.map((result) => ({ file: read_path(result.call), chars: result.chars }));
486
+ return reads.filter((read) => {
487
+ const is_repeat = seen.has(read.file);
488
+ seen.add(read.file);
489
+ return read.file !== "" && is_repeat;
490
+ });
491
+ }
492
+ function duplicates_of(repeats) {
493
+ const all = repeats.flat();
494
+ const files = repeats.map((one) => new Set(one.map((read) => read.file)).size);
495
+ return {
496
+ files: files.reduce((sum, count) => sum + count, 0),
497
+ reads: all.length,
498
+ chars: all.reduce((sum, read) => sum + read.chars, 0)
499
+ };
500
+ }
501
+ function chars_rows(results, key_of) {
502
+ const rows = /* @__PURE__ */ new Map();
503
+ for (const { call, chars } of results) {
504
+ const key = key_of(call);
505
+ const row2 = rows.get(key) ?? { key, results: 0, chars: 0 };
506
+ rows.set(key, { key, results: row2.results + 1, chars: row2.chars + chars });
507
+ }
508
+ rows.delete("");
509
+ return [...rows.values()].toSorted((left, right) => right.chars - left.chars);
510
+ }
511
+ function effort_rows(sessions) {
512
+ const totals = /* @__PURE__ */ new Map();
513
+ for (const session of sessions) add_efforts(totals, session);
514
+ return [...totals].map(([effort, usd]) => ({ effort, usd })).toSorted((left, right) => right.usd - left.usd);
515
+ }
516
+ function breakdown_of2(sessions) {
517
+ const seen = /* @__PURE__ */ new Set();
518
+ const per_session = sessions.map((session) => results_of(session.lines, seen));
519
+ const results = per_session.flat();
520
+ const efforts = effort_rows(sessions);
521
+ return {
522
+ total_usd: efforts.reduce((sum, row2) => sum + row2.usd, 0),
523
+ efforts,
524
+ tools: chars_rows(results, (call) => call.name),
525
+ josh: chars_rows(results, (call) => josh_of(call)),
526
+ commands: chars_rows(results, (call) => command_of(call)),
527
+ reads: chars_rows(results, (call) => lane_paths.main_checkout_path(read_path(call))),
528
+ duplicate_reads: duplicates_of(per_session.map((one) => repeats_of(one)))
529
+ };
530
+ }
531
+ function effort_line(row2, total_usd) {
532
+ return ` ${row2.effort}: ${figure_format.format_usd(row2.usd)} (${figure_format.format_share(row2.usd, total_usd)})`;
533
+ }
534
+ function chars_line(row2) {
535
+ const average = figure_format.format_tokens(Math.round(row2.chars / row2.results));
536
+ return ` ${row2.key}: ${figure_format.format_tokens(row2.chars)} chars, ${String(row2.results)} results, ${average} avg`;
537
+ }
538
+ function chars_lines(rows) {
539
+ if (rows.length === 0) return [" none"];
540
+ return rows.slice(0, ROW_LIMIT).map((row2) => chars_line(row2));
541
+ }
542
+ function duplicate_line(duplicates) {
543
+ const counts = `${String(duplicates.reads)} reads of ${String(duplicates.files)} files`;
544
+ return ` repeated Reads of a file the session already read: ${counts}, ${figure_format.format_tokens(duplicates.chars)} chars`;
545
+ }
546
+ function result_lines(breakdown) {
547
+ const efforts = breakdown.efforts.map((row2) => effort_line(row2, breakdown.total_usd));
548
+ const limit = String(ROW_LIMIT);
549
+ return [
550
+ "",
551
+ "Effort and tool results (this period: dollars and result characters)",
552
+ " cost by effort:",
553
+ ...efforts.length === 0 ? [" none"] : efforts,
554
+ ` result characters by tool (top ${limit}):`,
555
+ ...chars_lines(breakdown.tools),
556
+ ` result characters by josh subcommand (top ${limit}):`,
557
+ ...chars_lines(breakdown.josh),
558
+ ` result characters by other Bash command (top ${limit}):`,
559
+ ...chars_lines(breakdown.commands),
560
+ ` result characters by Read file (top ${limit}):`,
561
+ ...chars_lines(breakdown.reads),
562
+ duplicate_line(breakdown.duplicate_reads)
563
+ ];
564
+ }
565
+ var cost_audit_result = { ROW_LIMIT, UNKNOWN_EFFORT, breakdown_of: breakdown_of2, result_lines };
566
+
567
+ // tools/cost-audit/cost-audit-rewrite.ts
568
+ var REWRITE_FLOOR_TOKENS = 15e3;
569
+ var CACHE_TTL_MS = 3e5;
570
+ var READ_BACK_SHARE = 0.5;
571
+ function written(record) {
572
+ return record.totals.cache_write_5m_tokens + record.totals.cache_write_1h_tokens;
573
+ }
574
+ function is_rewrite(record, before) {
575
+ const held = before.totals.cache_read_tokens + written(before);
576
+ return written(record) > REWRITE_FLOOR_TOKENS && record.totals.cache_read_tokens < held * READ_BACK_SHARE;
577
+ }
578
+ function write_cost(record) {
579
+ const { cache_write_5m_tokens, cache_write_1h_tokens } = record.totals;
580
+ const totals = { ...cost_usage.EMPTY_TOTALS, cache_write_5m_tokens, cache_write_1h_tokens };
581
+ return cost_pricing.cost_of([{ model: record.model, totals }]);
582
+ }
583
+ function add_rewrite(rewrites, record, before) {
584
+ const gap_ms = (record.at_ms ?? 0) - (before.at_ms ?? 0);
585
+ const bucket = gap_ms >= CACHE_TTL_MS ? rewrites.after_wait : rewrites.within_ttl;
586
+ bucket.count += 1;
587
+ bucket.usd += write_cost(record);
588
+ }
589
+ function pairs_of(records) {
590
+ const ordered = records.toSorted((left, right) => (left.at_ms ?? 0) - (right.at_ms ?? 0));
591
+ return ordered.slice(1).flatMap((record, index) => {
592
+ const before = ordered[index];
593
+ return before === void 0 ? [] : [[record, before]];
594
+ });
595
+ }
596
+ function add_session3(rewrites, session, is_counted) {
597
+ for (const [record, before] of pairs_of(session.records)) {
598
+ const is_counted_rewrite = is_counted(record.at_ms) && is_rewrite(record, before);
599
+ if (is_counted_rewrite) add_rewrite(rewrites, record, before);
600
+ }
601
+ }
602
+ function rewrites_in(sessions, is_counted) {
603
+ const rewrites = { after_wait: { count: 0, usd: 0 }, within_ttl: { count: 0, usd: 0 } };
604
+ for (const session of sessions) add_session3(rewrites, session, is_counted);
605
+ return rewrites;
606
+ }
607
+ var cost_audit_rewrite = { REWRITE_FLOOR_TOKENS, rewrites_in };
608
+
609
+ // tools/cost-audit/cost-audit-sequence.ts
610
+ var SHORTEST_RUN = 2;
611
+ var LONGEST_RUN = 3;
612
+ var RUN_LENGTHS = [SHORTEST_RUN, LONGEST_RUN];
613
+ var TOP_RUNS = 10;
614
+ var RETRY_REACH = 2;
615
+ var RUN_SEPARATOR = " \u2192 ";
616
+ function token_of(input) {
617
+ const command = time_shell.bash_command(input);
618
+ return time_josh_names.josh_command_of(command) || cost_audit_command.command_key(command);
619
+ }
620
+ function bash_tokens(lines) {
621
+ return lines.flatMap((line) => line.blocks).filter((block) => block.type === "tool_use" && block.name === cost_blocks.BASH_TOOL).map((block) => token_of(block.input)).filter((token) => token !== "");
622
+ }
623
+ function runs_of(tokens, length) {
624
+ return tokens.slice(0, Math.max(tokens.length - length + 1, 0)).map((_, start) => tokens.slice(start, start + length).join(RUN_SEPARATOR));
625
+ }
626
+ function session_runs(lines) {
627
+ const tokens = bash_tokens(lines);
628
+ return RUN_LENGTHS.flatMap((length) => runs_of(tokens, length));
629
+ }
630
+ function count_rows(keys) {
631
+ const counts = /* @__PURE__ */ new Map();
632
+ for (const key of keys) counts.set(key, (counts.get(key) ?? 0) + 1);
633
+ return [...counts].map(([key, count]) => ({ key, count })).toSorted((left, right) => right.count - left.count);
634
+ }
635
+ function on_use(state, block) {
636
+ const token = block.name === cost_blocks.BASH_TOOL ? token_of(block.input) : "";
637
+ const matched = state.pending.filter((pending) => pending.token === token);
638
+ state.tokens.set(block.id, token);
639
+ state.retries.push(...matched.map((pending) => pending.guard));
640
+ state.pending = state.pending.filter((pending) => pending.token !== token && pending.left > 1).map((pending) => ({ ...pending, left: pending.left - 1 }));
641
+ }
642
+ function on_result(state, block) {
643
+ const token = state.tokens.get(block.result_id) ?? "";
644
+ if (token === "" || block.refusal_guard === "") return;
645
+ const guard = guard_friction.guard_name(block.refusal_guard);
646
+ state.pending.push({ guard, token, left: RETRY_REACH });
647
+ }
648
+ function on_block(state, block) {
649
+ if (block.type === "tool_use") on_use(state, block);
650
+ else if (block.result_id !== "") on_result(state, block);
651
+ }
652
+ function session_retries(lines) {
653
+ const state = { tokens: /* @__PURE__ */ new Map(), pending: [], retries: [] };
654
+ const blocks = lines.flatMap((line) => line.blocks);
655
+ for (const block of blocks) on_block(state, block);
656
+ return state.retries;
657
+ }
658
+ function sequences_of(sessions) {
659
+ const runs = sessions.flatMap((session) => session_runs(session.lines));
660
+ return {
661
+ runs: count_rows(runs).slice(0, TOP_RUNS),
662
+ retries: count_rows(sessions.flatMap((session) => session_retries(session.lines)))
663
+ };
664
+ }
665
+ function count_lines(title, rows) {
666
+ const body = rows.length === 0 ? [" none"] : rows.map((row2) => ` ${row2.key}: ${String(row2.count)}`);
667
+ return ["", title, ...body];
668
+ }
669
+ function sequence_lines(sequences) {
670
+ return [
671
+ ...count_lines("Bash command runs (2 and 3 consecutive calls)", sequences.runs),
672
+ ...count_lines(
673
+ `Retries after a refusal (same command within ${String(RETRY_REACH)} calls), by guard`,
674
+ sequences.retries
675
+ )
676
+ ];
677
+ }
678
+ var cost_audit_sequence = { sequences_of, sequence_lines };
679
+
680
+ // tools/cost-audit/cost-audit-tool.ts
681
+ var OTHER = "other";
682
+ var REPLY = "reply";
683
+ var ORCHESTRATION = "orchestration";
684
+ var CATEGORY_NAMES = [
685
+ {
686
+ category: "code search",
687
+ tools: ["Grep", "Glob", "WebSearch"],
688
+ josh: [],
689
+ shell: ["grep", "rg", "find", "ls"]
690
+ },
691
+ {
692
+ category: "doc read",
693
+ tools: ["Read", "WebFetch"],
694
+ josh: ["doc:", "read:"],
695
+ shell: ["cat", "sed", "head", "tail", "wc"]
696
+ },
697
+ { category: "edit", tools: ["Edit", "Write", "MultiEdit", "NotebookEdit"], josh: [], shell: [] },
698
+ {
699
+ category: ORCHESTRATION,
700
+ tools: [
701
+ "Agent",
702
+ "Task",
703
+ "Skill",
704
+ "TodoWrite",
705
+ "ToolSearch",
706
+ "SendMessage",
707
+ "Monitor",
708
+ "TaskStop"
709
+ ],
710
+ josh: [],
711
+ shell: []
712
+ },
713
+ { category: "issue ops", tools: [], josh: ["issue", "epic"], shell: ["gh"] },
714
+ {
715
+ category: "verification",
716
+ tools: [],
717
+ josh: ["gate", "lint", "test", "cspell", "review"],
718
+ shell: ["vitest", "tsc", "eslint"]
719
+ }
720
+ ];
721
+ function category_where(is_match) {
722
+ return CATEGORY_NAMES.find((names) => is_match(names))?.category;
723
+ }
724
+ function josh_category(josh_command) {
725
+ const name = josh_command.slice(time_shell.JOSH_PREFIX.length);
726
+ const found = category_where((names) => names.josh.some((prefix) => name.startsWith(prefix)));
727
+ return found ?? ORCHESTRATION;
728
+ }
729
+ function bash_category(input) {
730
+ const command = time_shell.bash_command(input);
731
+ const josh_command = time_josh_names.josh_command_of(command);
732
+ if (josh_command !== "") return josh_category(josh_command);
733
+ const word = time_shell.leading_word(command);
734
+ return category_where((names) => names.shell.includes(word)) ?? OTHER;
735
+ }
736
+ function category_of(name, input) {
737
+ if (name === cost_blocks.BASH_TOOL) return bash_category(input);
738
+ return category_where((names) => names.tools.includes(name)) ?? OTHER;
739
+ }
740
+ var cost_audit_tool = { OTHER, REPLY, category_of };
741
+
742
+ // tools/cost-audit/cost-audit.ts
743
+ var REGRESSION_THRESHOLD = { ratio: 0.2, floor_usd: 1 };
744
+ var DEFAULT_PERIOD_DAYS = 7;
745
+ var MS_PER_DAY = 864e5;
746
+ var PERIOD_COUNT = 2;
747
+ function windows_of(days, now_ms) {
748
+ const span = days * MS_PER_DAY;
749
+ return [
750
+ { start_ms: now_ms - span, end_ms: now_ms },
751
+ { start_ms: now_ms - span * PERIOD_COUNT, end_ms: now_ms - span }
752
+ ];
753
+ }
754
+ function is_inside(at_ms, window) {
755
+ return at_ms !== void 0 && at_ms >= window.start_ms && at_ms < window.end_ms;
756
+ }
757
+ function add2(totals, key, usd) {
758
+ totals.set(key, (totals.get(key) ?? 0) + usd);
759
+ }
760
+ function add_request(period, session, record) {
761
+ const usd = cost_pricing.cost_of([record]);
762
+ const categories = session.categories.get(record.request_id) ?? [cost_audit_tool.REPLY];
763
+ period.total += usd;
764
+ add2(period.kinds, session.kind, usd);
765
+ for (const category of categories) add2(period.tools, category, usd / categories.length);
766
+ }
767
+ function inside(sessions, window) {
768
+ return sessions.map((session) => ({
769
+ ...session,
770
+ records: session.records.filter((record) => is_inside(record.at_ms, window)),
771
+ lines: session.lines.filter((line) => is_inside(line.timestamp_ms, window))
772
+ }));
773
+ }
774
+ function guard_costs(sessions) {
775
+ const sources = sessions.map((session) => ({ node: session, lines: session.lines }));
776
+ return new Map(guard_friction.guard_rows(sources).map((guard) => [guard.guard, guard.usd]));
777
+ }
778
+ function period_cost(sessions, window) {
779
+ const cut = inside(sessions, window);
780
+ const period = {
781
+ total: 0,
782
+ kinds: /* @__PURE__ */ new Map(),
783
+ tools: /* @__PURE__ */ new Map(),
784
+ guards: guard_costs(cut)
785
+ };
786
+ for (const session of cut) {
787
+ for (const record of session.records) add_request(period, session, record);
788
+ }
789
+ return period;
790
+ }
791
+ function is_regression(current, previous) {
792
+ const limit = previous * (1 + REGRESSION_THRESHOLD.ratio);
793
+ return current >= REGRESSION_THRESHOLD.floor_usd && current > limit;
794
+ }
795
+ function row(key, current, previous) {
796
+ return { key, current, previous, is_regression: is_regression(current, previous) };
797
+ }
798
+ function rows_of2(current, previous) {
799
+ const keys = /* @__PURE__ */ new Set([...current.keys(), ...previous.keys()]);
800
+ return [...keys].map((key) => row(key, current.get(key) ?? 0, previous.get(key) ?? 0)).toSorted((left, right) => right.current - left.current);
801
+ }
802
+ function per_merge(current, previous, merges) {
803
+ if (merges === void 0 || merges.current === 0 || merges.previous === 0) return void 0;
804
+ return row("per merge", current.total / merges.current, previous.total / merges.previous);
805
+ }
806
+ function rewrites_inside(sessions, window) {
807
+ return cost_audit_rewrite.rewrites_in(sessions, (at_ms) => is_inside(at_ms, window));
808
+ }
809
+ function records_by_kind(sessions) {
810
+ const records = /* @__PURE__ */ new Map();
811
+ for (const session of sessions) {
812
+ records.set(session.kind, [...records.get(session.kind) ?? [], ...session.records]);
813
+ }
814
+ return records;
815
+ }
816
+ function kind_rows(current, previous, cut) {
817
+ const records = records_by_kind(cut);
818
+ return rows_of2(current.kinds, previous.kinds).map((kind) => ({
819
+ ...kind,
820
+ models: cost_audit_spend.spend_of(records.get(kind.key) ?? [])
821
+ }));
822
+ }
823
+ function phases_inside(input, window) {
824
+ const breakdowns = input.breakdowns ?? /* @__PURE__ */ new Map();
825
+ return cost_audit_phase.rows_of({
826
+ sessions: inside(input.sessions, window),
827
+ reviews: input.sessions,
828
+ breakdowns
829
+ });
830
+ }
831
+ function lane_density(sessions, current, previous) {
832
+ return {
833
+ current: cost_audit_density.density_of(inside(sessions, current)),
834
+ previous: cost_audit_density.density_of(inside(sessions, previous))
835
+ };
836
+ }
837
+ function current_only(input, window) {
838
+ const cut = inside(input.sessions, window);
839
+ return {
840
+ phases: phases_inside(input, window),
841
+ agents: cost_audit_phase.agent_rows_of(cut),
842
+ usage: cost_audit_usage.breakdown_of(input.sessions, (at_ms) => is_inside(at_ms, window)),
843
+ results: cost_audit_result.breakdown_of(cut),
844
+ sequences: cost_audit_sequence.sequences_of(cut)
845
+ };
846
+ }
847
+ function audit(input) {
848
+ const [current_window, previous_window] = windows_of(input.days, input.now_ms);
849
+ const current = period_cost(input.sessions, current_window);
850
+ const previous = period_cost(input.sessions, previous_window);
851
+ return {
852
+ ...current_only(input, current_window),
853
+ days: input.days,
854
+ lane_density: lane_density(input.sessions, current_window, previous_window),
855
+ total: row("total", current.total, previous.total),
856
+ merges: input.merges,
857
+ per_merge: per_merge(current, previous, input.merges),
858
+ kinds: kind_rows(current, previous, inside(input.sessions, current_window)),
859
+ tools: rows_of2(current.tools, previous.tools),
860
+ guards: rows_of2(current.guards, previous.guards),
861
+ rewrites: {
862
+ current: rewrites_inside(input.sessions, current_window),
863
+ previous: rewrites_inside(input.sessions, previous_window)
864
+ }
865
+ };
866
+ }
867
+ function since_ms(days, now_ms) {
868
+ return windows_of(days, now_ms)[1].start_ms;
869
+ }
870
+ var cost_audit = { DEFAULT_PERIOD_DAYS, MS_PER_DAY, audit, since_ms, windows_of };
871
+
872
+ // tools/cost-audit/cost-audit-format.ts
873
+ var PERCENT = 100;
874
+ var PERCENT_DECIMALS = 1;
875
+ var CALLS_PER_RUN_DECIMALS = 1;
876
+ var REGRESSION_MARK = " regression";
877
+ var NO_PREVIOUS = "new";
878
+ var FILING_PREFIX = "File a cost regression: ";
879
+ var FILING_ROW_SEPARATOR = ", ";
880
+ var FILING_SUFFIX = " \u2014 reproduce with `pnpm josh cost:audit`";
881
+ var KIND_TITLE = "By session kind (this period per model: cost \u2014 input / cache read / cache write / output in dollars)";
882
+ var LONG_OUTPUT = String(cost_audit_usage.LONG_OUTPUT_TOKENS);
883
+ var TABLE_FIGURES = `cost \u2014 billed input / cache read / cache write / output tokens \xB7 calls with output over ${LONG_OUTPUT} tokens; per model in dollars`;
884
+ var PHASE_TITLE = `Lane children by phase (this period: ${TABLE_FIGURES})`;
885
+ var AGENT_TITLE = `Lane subagents by agent type (this period: ${TABLE_FIGURES})`;
886
+ function change(row2) {
887
+ if (row2.previous === 0) return NO_PREVIOUS;
888
+ const share = (row2.current - row2.previous) / row2.previous * PERCENT;
889
+ const sign = share >= 0 ? "+" : "";
890
+ return `${sign}${share.toFixed(PERCENT_DECIMALS)}%`;
891
+ }
892
+ function row_line2(row2) {
893
+ const figures = `${figure_format.format_usd(row2.current)} (prev ${figure_format.format_usd(row2.previous)}, ${change(row2)})`;
894
+ return ` ${row2.key}: ${figures}${row2.is_regression ? REGRESSION_MARK : ""}`;
895
+ }
896
+ function sections_of(audit2) {
897
+ return [
898
+ { name: "kind", title: KIND_TITLE, rows: audit2.kinds },
899
+ { name: "tool", title: "By tool category", rows: audit2.tools },
900
+ { name: "guard", title: "By guard (refusal and Stop round trips)", rows: audit2.guards }
901
+ ];
902
+ }
903
+ function merge_lines(audit2) {
904
+ if (audit2.merges === void 0) return [" merges: not read from GitHub"];
905
+ const counts = ` merges: ${String(audit2.merges.current)} (prev ${String(audit2.merges.previous)})`;
906
+ return audit2.per_merge === void 0 ? [counts] : [counts, row_line2(audit2.per_merge)];
907
+ }
908
+ var DENSITY_DECIMALS = 2;
909
+ function density_text(density) {
910
+ const calls = cost_audit_density.calls_per_request(density).toFixed(DENSITY_DECIMALS);
911
+ const single = (cost_audit_density.single_share(density) * PERCENT).toFixed(PERCENT_DECIMALS);
912
+ return `${calls} calls/request, ${single}% single-call`;
913
+ }
914
+ function density_line(audit2) {
915
+ const { current, previous } = audit2.lane_density;
916
+ return ` lane-child density: ${density_text(current)} (prev ${density_text(previous)})`;
917
+ }
918
+ function density_value(audit2) {
919
+ const { current } = audit2.lane_density;
920
+ if (current.requests === 0) return void 0;
921
+ return cost_audit_density.calls_per_request(current).toFixed(DENSITY_DECIMALS);
922
+ }
923
+ function rewrite_figures(count) {
924
+ return `${String(count.count)} (${figure_format.format_usd(count.usd)})`;
925
+ }
926
+ function rewrite_line(label, current, previous) {
927
+ return ` ${label}: ${rewrite_figures(current)} (prev ${rewrite_figures(previous)})`;
928
+ }
929
+ function rewrite_lines(audit2) {
930
+ const { current, previous } = audit2.rewrites;
931
+ const floor = String(cost_audit_rewrite.REWRITE_FLOOR_TOKENS);
932
+ return [
933
+ "",
934
+ `Full cache rewrites (cache write over ${floor} tokens, the earlier context not read back)`,
935
+ rewrite_line("after a wait of 5 min or more", current.after_wait, previous.after_wait),
936
+ rewrite_line("within 5 min", current.within_ttl, previous.within_ttl)
937
+ ];
938
+ }
939
+ function phase_line(row2) {
940
+ const { input, cache_read, cache_write, output } = row2.tokens;
941
+ const tokens = [input, cache_read, cache_write, output].map(
942
+ (count) => figure_format.format_tokens(count)
943
+ );
944
+ const long = `${String(row2.long_calls)} calls over ${LONG_OUTPUT}`;
945
+ return ` ${row2.key}: ${figure_format.format_usd(row2.usd)} \u2014 ${tokens.join(" / ")} \xB7 ${long}`;
946
+ }
947
+ function spend_line(spend) {
948
+ const terms = [spend.input, spend.cache_read, spend.cache_write, spend.output].map(
949
+ (usd) => figure_format.format_usd(usd)
950
+ );
951
+ const total = figure_format.format_usd(cost_audit_spend.total_of(spend));
952
+ return ` ${spend.model}: ${total} \u2014 ${terms.join(" / ")}`;
953
+ }
954
+ function phase_row_lines(row2) {
955
+ return [phase_line(row2), ...row2.models.map((spend) => spend_line(spend))];
956
+ }
957
+ function token_table_lines(title, rows) {
958
+ const body = rows.length === 0 ? [" none"] : rows.flatMap((row2) => phase_row_lines(row2));
959
+ return ["", title, ...body];
960
+ }
961
+ function phase_lines(audit2) {
962
+ return [
963
+ ...token_table_lines(PHASE_TITLE, audit2.phases),
964
+ ...token_table_lines(AGENT_TITLE, audit2.agents)
965
+ ];
966
+ }
967
+ function tokens_usd(tokens, usd) {
968
+ return `${figure_format.format_tokens(tokens)} tokens (${figure_format.format_usd(usd)})`;
969
+ }
970
+ function first_text(first, unit) {
971
+ const p50 = first.p50_tokens === void 0 ? "none" : figure_format.format_tokens(first.p50_tokens);
972
+ return `${p50} (${String(first.sessions)} ${unit})`;
973
+ }
974
+ function long_output_line(long) {
975
+ const share = long.all_calls === 0 ? 0 : long.calls / long.all_calls * PERCENT;
976
+ const counts = `${String(long.calls)} of ${String(long.all_calls)} calls`;
977
+ return ` output over ${String(cost_audit_usage.LONG_OUTPUT_TOKENS)} tokens: ${counts} (${share.toFixed(PERCENT_DECIMALS)}%, ${figure_format.format_usd(long.usd)})`;
978
+ }
979
+ function agent_runs_line(agent) {
980
+ const per_run = (agent.calls / agent.runs).toFixed(CALLS_PER_RUN_DECIMALS);
981
+ return ` ${agent.agent_type}: ${String(agent.runs)} runs, ${per_run} calls/run, ${figure_format.format_usd(agent.usd)}`;
982
+ }
983
+ function usage_lines(usage) {
984
+ const { cache_write: write } = usage;
985
+ const agents = usage.agents.length === 0 ? [" none"] : usage.agents.map((agent) => agent_runs_line(agent));
986
+ return [
987
+ "",
988
+ "Usage breakdown (this period: tokens and dollars)",
989
+ ` cache write 5m: ${tokens_usd(write.tokens_5m, write.usd_5m)} / 1h: ${tokens_usd(write.tokens_1h, write.usd_1h)}`,
990
+ ` first request context p50: main ${first_text(usage.first_main, "sessions")} / subagent ${first_text(usage.first_subagent, "runs")}`,
991
+ long_output_line(usage.long_output),
992
+ " subagent runs by agent type:",
993
+ ...agents
994
+ ];
995
+ }
996
+ function row_lines(row2) {
997
+ return [row_line2(row2), ...(row2.models ?? []).map((spend) => spend_line(spend))];
998
+ }
999
+ function section_lines(section) {
1000
+ const body = section.rows.length === 0 ? [" none"] : section.rows.flatMap((row2) => row_lines(row2));
1001
+ return ["", section.title, ...body];
1002
+ }
1003
+ function regression_names(audit2) {
1004
+ const head = [audit2.total, audit2.per_merge].filter((row2) => row2?.is_regression === true).map((row2) => row2.key);
1005
+ const named = sections_of(audit2).flatMap(
1006
+ (section) => section.rows.filter((row2) => row2.is_regression).map((row2) => `${section.name} ${row2.key}`)
1007
+ );
1008
+ return [...head, ...named];
1009
+ }
1010
+ function regression_text(audit2) {
1011
+ const names = regression_names(audit2);
1012
+ return names.length === 0 ? "none" : names.join(", ");
1013
+ }
1014
+ function report_lines2(audit2) {
1015
+ const days = String(audit2.days);
1016
+ return [
1017
+ `Cost audit \u2014 the last ${days} day(s) against the ${days} before`,
1018
+ row_line2(audit2.total),
1019
+ ...merge_lines(audit2),
1020
+ density_line(audit2),
1021
+ ...sections_of(audit2).flatMap((section) => section_lines(section)),
1022
+ ...rewrite_lines(audit2),
1023
+ ...phase_lines(audit2),
1024
+ ...usage_lines(audit2.usage),
1025
+ ...cost_audit_result.result_lines(audit2.results),
1026
+ ...cost_audit_sequence.sequence_lines(audit2.sequences),
1027
+ "",
1028
+ `Regressions: ${regression_text(audit2)}`
1029
+ ];
1030
+ }
1031
+ function summary_line(audit2) {
1032
+ const total = `${figure_format.format_usd(audit2.total.current)} (${change(audit2.total)})`;
1033
+ const merge = audit2.per_merge === void 0 ? "" : `, ${figure_format.format_usd(audit2.per_merge.current)} per merge`;
1034
+ return `Cost audit (${String(audit2.days)}d): ${total}${merge}; regressions: ${regression_text(audit2)}`;
1035
+ }
1036
+ function filing_lines(audit2) {
1037
+ const names = regression_names(audit2);
1038
+ if (names.length === 0) return [];
1039
+ return [FILING_PREFIX + names.join(FILING_ROW_SEPARATOR) + FILING_SUFFIX];
1040
+ }
1041
+ var cost_audit_format = {
1042
+ FILING_PREFIX,
1043
+ FILING_ROW_SEPARATOR,
1044
+ FILING_SUFFIX,
1045
+ density_value,
1046
+ filing_lines,
1047
+ report_lines: report_lines2,
1048
+ summary_line
1049
+ };
1050
+
1051
+ // tools/cost-audit/cost-audit-read.ts
1052
+ import { homedir } from "node:os";
1053
+ import path from "node:path";
1054
+ import { z } from "zod";
1055
+ var LANE_ISSUE_PATTERN = /-(\d+)$/u;
1056
+ var TRANSCRIPT_EXTENSION = /\.jsonl$/u;
1057
+ var META_SCHEMA = z.object({ agentType: z.string().min(1) });
1058
+ function first_text2(raw) {
1059
+ const block = cost_blocks.parse_line(raw).find((one) => one.type === cost_blocks.TEXT_TYPE && one.text.trim() !== "");
1060
+ return block?.text ?? "";
1061
+ }
1062
+ function line_categories(line) {
1063
+ return line.blocks.filter((block) => block.type === cost_blocks.TOOL_USE_TYPE).map((block) => cost_audit_tool.category_of(block.name, block.input));
1064
+ }
1065
+ function add_categories(parts, request_id, line) {
1066
+ const found = line_categories(line);
1067
+ const earlier = parts.categories.get(request_id) ?? [];
1068
+ if (found.length > 0) parts.categories.set(request_id, [...earlier, ...found]);
1069
+ }
1070
+ function add_line(parts, raw) {
1071
+ const outcome = cost_usage.parse_line(raw);
1072
+ const line = time_transcript_line.parse_line(raw);
1073
+ if (parts.prompt === "") parts.prompt = first_text2(raw);
1074
+ if (line !== void 0) parts.lines.push(line);
1075
+ if (outcome.kind !== "record") return;
1076
+ parts.records.push(outcome.record);
1077
+ if (line !== void 0) add_categories(parts, outcome.record.request_id, line);
1078
+ }
1079
+ function session_of(text, is_delegated, is_lane = false) {
1080
+ const parts = { records: [], categories: /* @__PURE__ */ new Map(), lines: [], prompt: "" };
1081
+ for (const raw of text.split("\n")) add_line(parts, raw);
1082
+ return {
1083
+ kind: cost_audit_kind.kind_of(parts.prompt, is_delegated),
1084
+ is_lane: is_lane && !is_delegated,
1085
+ records: cost_usage.dedupe(parts.records),
1086
+ categories: parts.categories,
1087
+ lines: parts.lines
1088
+ };
1089
+ }
1090
+ function without_seen(session, seen) {
1091
+ const records = session.records.filter((record) => !seen.has(record.request_id));
1092
+ for (const record of records) seen.add(record.request_id);
1093
+ return { ...session, records };
1094
+ }
1095
+ function dedupe_across(sessions) {
1096
+ const seen = /* @__PURE__ */ new Set();
1097
+ return sessions.map((session) => without_seen(session, seen));
1098
+ }
1099
+ function session_files(cwd, since_ms2) {
1100
+ const main = cost_transcript.session_cwd(cwd);
1101
+ const files = cost_transcript.list_sessions_across(cost_transcript.transcript_directories(main));
1102
+ return files.filter((file) => file.modified_ms >= since_ms2).toReversed();
1103
+ }
1104
+ function lane_of(file_path, lanes) {
1105
+ return lanes.find((directory) => file_path.startsWith(`${directory}${path.sep}`));
1106
+ }
1107
+ function issue_of(file_path, lanes) {
1108
+ const digits = LANE_ISSUE_PATTERN.exec(lane_of(file_path, lanes) ?? "")?.[1];
1109
+ return digits === void 0 ? void 0 : Number(digits);
1110
+ }
1111
+ function json_or_undefined(text) {
1112
+ try {
1113
+ return JSON.parse(text);
1114
+ } catch {
1115
+ return void 0;
1116
+ }
1117
+ }
1118
+ function agent_type_of(transcript_path) {
1119
+ const meta_path = transcript_path.replace(TRANSCRIPT_EXTENSION, ".meta.json");
1120
+ const text = file_reader.read_if_readable(meta_path);
1121
+ if (text === void 0) return void 0;
1122
+ const parsed = META_SCHEMA.safeParse(json_or_undefined(text));
1123
+ return parsed.success ? parsed.data.agentType : void 0;
1124
+ }
1125
+ function file_session(file, lanes) {
1126
+ const issue = issue_of(file.path, lanes);
1127
+ const session = session_of(cost_transcript.read_raw(file), file.is_delegated, issue !== void 0);
1128
+ const agent_type = file.is_delegated ? agent_type_of(file.path) : void 0;
1129
+ return { ...session, issue, agent_type };
1130
+ }
1131
+ function load(cwd, since_ms2) {
1132
+ const lanes = cost_transcript.lane_transcript_directories(
1133
+ cost_transcript.session_cwd(cwd),
1134
+ homedir()
1135
+ );
1136
+ const sessions = session_files(cwd, since_ms2).map((file) => file_session(file, lanes));
1137
+ return dedupe_across(sessions);
1138
+ }
1139
+ var cost_audit_read = { session_of, dedupe_across, issue_of, agent_type_of, load };
1140
+
1141
+ // tools/cost-audit/cost-audit-cli.ts
1142
+ var SUCCESS_EXIT_CODE = 0;
1143
+ var FAILURE_EXIT_CODE = 1;
1144
+ var USAGE = "Usage: pnpm josh cost:audit [--period <days> | --since <YYYY-MM-DD> --until <YYYY-MM-DD>] [--density]";
1145
+ var DENSITY_FLAG = "--density";
1146
+ var OPTIONS = {
1147
+ period: { type: "string" },
1148
+ since: { type: "string" },
1149
+ until: { type: "string" },
1150
+ density: { type: "boolean" }
1151
+ };
1152
+ var MAX_PERIOD_DAYS = 3650;
1153
+ var DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/u;
1154
+ var ISO_DATE_LENGTH = 10;
1155
+ var MILLISECONDS_PATTERN = /\.\d{3}Z$/u;
1156
+ var search_count_schema = z2.object({ total_count: z2.number() });
1157
+ function read_period(argv) {
1158
+ const values = cli_flags.values_of(argv, OPTIONS);
1159
+ if (values === void 0) return void 0;
1160
+ const raw = values.period ?? String(cost_audit.DEFAULT_PERIOD_DAYS);
1161
+ const days = cli_flags.to_positive(raw);
1162
+ return days !== void 0 && days <= MAX_PERIOD_DAYS ? days : void 0;
1163
+ }
1164
+ function date_ms(raw) {
1165
+ if (!DATE_PATTERN.test(raw)) return void 0;
1166
+ const ms = Date.parse(`${raw}T00:00:00Z`);
1167
+ if (Number.isNaN(ms)) return void 0;
1168
+ return new Date(ms).toISOString().slice(0, ISO_DATE_LENGTH) === raw ? ms : void 0;
1169
+ }
1170
+ function dated_span(since, until) {
1171
+ const start = date_ms(since);
1172
+ const end = date_ms(until);
1173
+ if (start === void 0 || end === void 0 || end < start) return void 0;
1174
+ const days = (end - start) / cost_audit.MS_PER_DAY + 1;
1175
+ return days <= MAX_PERIOD_DAYS ? { days, now_ms: end + cost_audit.MS_PER_DAY } : void 0;
1176
+ }
1177
+ function relative_span(argv, now_ms) {
1178
+ const days = read_period(argv);
1179
+ return days === void 0 ? void 0 : { days, now_ms };
1180
+ }
1181
+ function absolute_span(values) {
1182
+ const { period, since, until } = values;
1183
+ if (since === void 0 || until === void 0 || period !== void 0) return void 0;
1184
+ return dated_span(since, until);
1185
+ }
1186
+ function read_span(argv, now_ms) {
1187
+ const values = cli_flags.values_of(argv, OPTIONS);
1188
+ if (values === void 0) return void 0;
1189
+ const is_dated = values.since !== void 0 || values.until !== void 0;
1190
+ return is_dated ? absolute_span(values) : relative_span(argv, now_ms);
1191
+ }
1192
+ function instant(ms) {
1193
+ return new Date(ms).toISOString().replace(MILLISECONDS_PATTERN, "Z");
1194
+ }
1195
+ function merged_query(repo, window) {
1196
+ return `repo:${repo} is:pr is:merged merged:${instant(window.start_ms)}..${instant(window.end_ms)}`;
1197
+ }
1198
+ async function merge_count(repo, window) {
1199
+ const parameters = new URLSearchParams({ q: merged_query(repo, window), per_page: "1" });
1200
+ const raw = await git_gh_exec.exec_gh_api({ path: `search/issues?${parameters.toString()}` });
1201
+ return parse_json.parse_json_object_or_undefined(raw, search_count_schema)?.total_count;
1202
+ }
1203
+ async function read_merges(days, now_ms) {
1204
+ try {
1205
+ const repo = await git_gh_command.repo_get_name_with_owner();
1206
+ if (repo === void 0) return void 0;
1207
+ const [current, previous] = await Promise.all(
1208
+ cost_audit.windows_of(days, now_ms).map(async (window) => await merge_count(repo, window))
1209
+ );
1210
+ return current === void 0 || previous === void 0 ? void 0 : { current, previous };
1211
+ } catch {
1212
+ return void 0;
1213
+ }
1214
+ }
1215
+ async function read_breakdowns(sessions) {
1216
+ const [entries, events] = await Promise.all([
1217
+ lane_ledger_archive.read_history({}),
1218
+ lane_net_read.read_events({})
1219
+ ]);
1220
+ const issues = new Set(sessions.flatMap((session) => session.issue ?? []));
1221
+ const pairs = [...issues].map(
1222
+ (issue) => [issue, lane_breakdown.of(entries, events, issue)]
1223
+ );
1224
+ return new Map(pairs.filter((pair) => pair[1] !== void 0));
1225
+ }
1226
+ async function measure(cwd, days, now_ms) {
1227
+ const sessions = cost_audit_read.load(cwd, cost_audit.since_ms(days, now_ms));
1228
+ const [merges, breakdowns] = await Promise.all([
1229
+ read_merges(days, now_ms),
1230
+ read_breakdowns(sessions)
1231
+ ]);
1232
+ return cost_audit.audit({ sessions, days, now_ms, merges, breakdowns });
1233
+ }
1234
+ async function summary(cwd, now_ms = Date.now()) {
1235
+ const audit2 = await measure(cwd, cost_audit.DEFAULT_PERIOD_DAYS, now_ms);
1236
+ return [cost_audit_format.summary_line(audit2), ...cost_audit_format.filing_lines(audit2)].join(
1237
+ "\n"
1238
+ );
1239
+ }
1240
+ function printed_lines(argv, audit2) {
1241
+ if (!argv.includes(DENSITY_FLAG)) return cost_audit_format.report_lines(audit2);
1242
+ const value = cost_audit_format.density_value(audit2);
1243
+ return value === void 0 ? [] : [value];
1244
+ }
1245
+ function printed(lines) {
1246
+ for (const line of lines) console.info(line);
1247
+ return lines.length > 0 ? SUCCESS_EXIT_CODE : FAILURE_EXIT_CODE;
1248
+ }
1249
+ async function run(argv, cwd = process.cwd(), now_ms = Date.now()) {
1250
+ const span = read_span(argv, now_ms);
1251
+ if (span === void 0) {
1252
+ console.error(USAGE);
1253
+ return FAILURE_EXIT_CODE;
1254
+ }
1255
+ return printed(printed_lines(argv, await measure(cwd, span.days, span.now_ms)));
1256
+ }
1257
+ var cost_audit_cli = { USAGE, read_period, read_span, merged_query, run, summary };
1258
+
1259
+ export {
1260
+ guard_friction,
1261
+ cost_audit_format,
1262
+ cost_audit_cli
1263
+ };