@joshuafolkken/kit 1.3044.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 (1236) 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/retrospective.md +2 -1
  7. package/.claude/skills/workflow-commands/split-assessment.md +4 -0
  8. package/.github/workflows/ci.yml +0 -20
  9. package/.github/workflows/pr-classification.yml +0 -5
  10. package/.github/workflows/publish.yml +0 -1
  11. package/.github/workflows/sonar-qube.yml +0 -5
  12. package/README.md +2 -0
  13. package/SECURITY.md +2 -1
  14. package/dist/.inputs-verified.json +1 -1
  15. package/dist/commands/adopt.js +29 -20
  16. package/dist/commands/auto-ok-judge-cli.js +43 -33
  17. package/dist/commands/auto-ok-main.js +73 -74
  18. package/dist/commands/backlog-budget-main.js +5 -6
  19. package/dist/commands/backlog-drive-cli.js +286 -305
  20. package/dist/commands/backlog-next-main.js +111 -108
  21. package/dist/commands/backlog-offer-main.js +148 -112
  22. package/dist/commands/backlog-plan-cli.js +123 -120
  23. package/dist/commands/backlog-triage-cli.js +131 -128
  24. package/dist/commands/backlogrun-cli.js +273 -264
  25. package/dist/commands/behavior-cli.js +23 -26
  26. package/dist/commands/bytes-command.js +56 -59
  27. package/dist/commands/cases-cli.js +4 -5
  28. package/dist/commands/check-commit-message-main.js +3 -4
  29. package/dist/commands/check-related.js +125 -119
  30. package/dist/commands/chunk-26JL4UU4.js +365 -0
  31. package/dist/commands/chunk-2BIVHPCA.js +85 -0
  32. package/dist/commands/chunk-2CKJODCK.js +245 -0
  33. package/dist/commands/chunk-2E6PSONB.js +46 -0
  34. package/dist/commands/chunk-2GA4775H.js +77 -0
  35. package/dist/commands/chunk-2O64H5UJ.js +462 -0
  36. package/dist/commands/chunk-2OEXY4GM.js +252 -0
  37. package/dist/commands/chunk-2OMIHPPE.js +51 -0
  38. package/dist/commands/chunk-2ONSHOAY.js +46 -0
  39. package/dist/commands/chunk-2Q7MGFYB.js +1208 -0
  40. package/dist/commands/chunk-2SA3W4JF.js +41 -0
  41. package/dist/commands/chunk-2VY7CJ2R.js +212 -0
  42. package/dist/commands/chunk-2WRDAQPJ.js +74 -0
  43. package/dist/commands/chunk-2XLR7R6E.js +541 -0
  44. package/dist/commands/chunk-2XZF3YFY.js +47 -0
  45. package/dist/commands/chunk-33TAOZUE.js +29 -0
  46. package/dist/commands/chunk-374XGAWD.js +158 -0
  47. package/dist/commands/chunk-3CJNQU7P.js +179 -0
  48. package/dist/commands/chunk-3D5T6KMW.js +59 -0
  49. package/dist/commands/chunk-3EW5LTN3.js +114 -0
  50. package/dist/commands/chunk-3F3RNIG2.js +128 -0
  51. package/dist/commands/chunk-3FLTEJZY.js +74 -0
  52. package/dist/commands/chunk-3JWPTRNI.js +60 -0
  53. package/dist/commands/chunk-3MQTOUXT.js +94 -0
  54. package/dist/commands/chunk-3PCUERXE.js +19 -0
  55. package/dist/commands/chunk-3U6A5WON.js +173 -0
  56. package/dist/commands/chunk-3YT3RCSI.js +140 -0
  57. package/dist/commands/chunk-43DU7DYZ.js +540 -0
  58. package/dist/commands/chunk-43H725LG.js +132 -0
  59. package/dist/commands/chunk-46STCE6Q.js +48 -0
  60. package/dist/commands/chunk-46WEC6HZ.js +82 -0
  61. package/dist/commands/chunk-47J4KOZP.js +46 -0
  62. package/dist/commands/chunk-47W7PF4T.js +22 -0
  63. package/dist/commands/chunk-4F4KARQN.js +229 -0
  64. package/dist/commands/chunk-4GUGC4IW.js +338 -0
  65. package/dist/commands/chunk-4HB7NWXP.js +263 -0
  66. package/dist/commands/chunk-4HOTJAO6.js +89 -0
  67. package/dist/commands/chunk-4I5AA4P5.js +237 -0
  68. package/dist/commands/chunk-4IDINPBE.js +525 -0
  69. package/dist/commands/chunk-4K7KLR7L.js +69 -0
  70. package/dist/commands/chunk-4MGTNY2L.js +347 -0
  71. package/dist/commands/chunk-4NSIW3UB.js +104 -0
  72. package/dist/commands/chunk-4YTKV6WV.js +37 -0
  73. package/dist/commands/chunk-5ARNFMQK.js +1263 -0
  74. package/dist/commands/chunk-5AZTSESD.js +114 -0
  75. package/dist/commands/chunk-5FUI2MLY.js +89 -0
  76. package/dist/commands/chunk-5GI5GLC4.js +214 -0
  77. package/dist/commands/chunk-5IHEBIPD.js +333 -0
  78. package/dist/commands/chunk-5KAW5GPF.js +44 -0
  79. package/dist/commands/chunk-5KSJEWXR.js +77 -0
  80. package/dist/commands/chunk-5OF2B4BF.js +35 -0
  81. package/dist/commands/chunk-5PLJ7R3D.js +126 -0
  82. package/dist/commands/chunk-5PPWXOCF.js +64 -0
  83. package/dist/commands/chunk-5VQCL33M.js +46 -0
  84. package/dist/commands/chunk-5Y7FOJLX.js +186 -0
  85. package/dist/commands/chunk-5YTEMF4O.js +110 -0
  86. package/dist/commands/chunk-62NYXZCC.js +241 -0
  87. package/dist/commands/chunk-6KUA7MRG.js +64 -0
  88. package/dist/commands/chunk-6LDEZFYR.js +88 -0
  89. package/dist/commands/chunk-6NXIZMIK.js +122 -0
  90. package/dist/commands/chunk-6O45F6YI.js +86 -0
  91. package/dist/commands/chunk-6OHJBQDE.js +184 -0
  92. package/dist/commands/chunk-6WDCCG3M.js +1249 -0
  93. package/dist/commands/chunk-6ZHXEQAI.js +715 -0
  94. package/dist/commands/chunk-736NECRD.js +16 -0
  95. package/dist/commands/chunk-77LEKVEE.js +32 -0
  96. package/dist/commands/chunk-7CX5VYOL.js +50 -0
  97. package/dist/commands/chunk-7DGHFBU7.js +247 -0
  98. package/dist/commands/chunk-7E43YW53.js +128 -0
  99. package/dist/commands/chunk-7EAYFMDN.js +235 -0
  100. package/dist/commands/chunk-7HP3FQGQ.js +51 -0
  101. package/dist/commands/chunk-7JOOMFDI.js +155 -0
  102. package/dist/commands/chunk-7OEBSPPU.js +321 -0
  103. package/dist/commands/chunk-A3JYZWBS.js +803 -0
  104. package/dist/commands/chunk-A3LCN4KA.js +84 -0
  105. package/dist/commands/chunk-ABLXBG6C.js +98 -0
  106. package/dist/commands/chunk-AN7BFVHU.js +244 -0
  107. package/dist/commands/chunk-AQCVEQSM.js +99 -0
  108. package/dist/commands/chunk-AT46EY7H.js +393 -0
  109. package/dist/commands/chunk-AU563VKH.js +75 -0
  110. package/dist/commands/chunk-AUTD5FV2.js +1077 -0
  111. package/dist/commands/chunk-AV26CMY6.js +304 -0
  112. package/dist/commands/chunk-B2PJEV3S.js +246 -0
  113. package/dist/commands/chunk-B545ENGY.js +214 -0
  114. package/dist/commands/chunk-B5HP6T4L.js +170 -0
  115. package/dist/commands/chunk-B5XYAWNN.js +37 -0
  116. package/dist/commands/chunk-B73IIRMS.js +207 -0
  117. package/dist/commands/chunk-BAEDHPXW.js +160 -0
  118. package/dist/commands/chunk-BDSG6JKH.js +977 -0
  119. package/dist/commands/chunk-BE6F4YK2.js +769 -0
  120. package/dist/commands/chunk-BFKTUD3V.js +33 -0
  121. package/dist/commands/chunk-BLRXHK2V.js +17 -0
  122. package/dist/commands/chunk-BLUAO4QW.js +173 -0
  123. package/dist/commands/chunk-BML6MEUB.js +326 -0
  124. package/dist/commands/chunk-BPDNGJXY.js +63 -0
  125. package/dist/commands/chunk-BQLKWGGC.js +118 -0
  126. package/dist/commands/chunk-BRMJVCP7.js +167 -0
  127. package/dist/commands/chunk-BRWR5YKU.js +268 -0
  128. package/dist/commands/chunk-BUZAYEBD.js +319 -0
  129. package/dist/commands/chunk-BVUL57IX.js +139 -0
  130. package/dist/commands/chunk-CC4BIGCA.js +20 -0
  131. package/dist/commands/chunk-CCHJZEF5.js +4220 -0
  132. package/dist/commands/chunk-CDK7QZWG.js +44 -0
  133. package/dist/commands/chunk-CDYFUCDC.js +72 -0
  134. package/dist/commands/chunk-CEADAQIL.js +170 -0
  135. package/dist/commands/chunk-CNL3SLM6.js +116 -0
  136. package/dist/commands/chunk-CNQ7D2GZ.js +104 -0
  137. package/dist/commands/chunk-CTXJVMHW.js +48 -0
  138. package/dist/commands/chunk-CUWT6UQO.js +13 -0
  139. package/dist/commands/chunk-CVRDJCOE.js +125 -0
  140. package/dist/commands/chunk-D6CF5QGM.js +80 -0
  141. package/dist/commands/chunk-DACNQAXC.js +20 -0
  142. package/dist/commands/chunk-DDOS32JU.js +74 -0
  143. package/dist/commands/chunk-DDZVMXZD.js +481 -0
  144. package/dist/commands/chunk-DF6QD4AF.js +52 -0
  145. package/dist/commands/chunk-DFEXNB44.js +159 -0
  146. package/dist/commands/chunk-DHDKG5HZ.js +151 -0
  147. package/dist/commands/chunk-DHJRFBKO.js +223 -0
  148. package/dist/commands/chunk-DKDWOE3C.js +78 -0
  149. package/dist/commands/chunk-DKO5VTEH.js +65 -0
  150. package/dist/commands/chunk-DLHH3MLS.js +85 -0
  151. package/dist/commands/chunk-DOYNK72G.js +81 -0
  152. package/dist/commands/chunk-DS53UUDH.js +679 -0
  153. package/dist/commands/chunk-DUA4E4ES.js +230 -0
  154. package/dist/commands/chunk-DURHGVRC.js +33 -0
  155. package/dist/commands/chunk-DVCMQMRN.js +191 -0
  156. package/dist/commands/chunk-E3YKMCCJ.js +108 -0
  157. package/dist/commands/chunk-E4F2RTKC.js +272 -0
  158. package/dist/commands/chunk-E4PFCTXN.js +127 -0
  159. package/dist/commands/chunk-EAOTR2WL.js +24 -0
  160. package/dist/commands/chunk-EE4VOZJP.js +167 -0
  161. package/dist/commands/chunk-EHVEWJQ4.js +33 -0
  162. package/dist/commands/chunk-EMFSPPMH.js +98 -0
  163. package/dist/commands/chunk-EN65ZS3S.js +73 -0
  164. package/dist/commands/chunk-ES42XPAD.js +123 -0
  165. package/dist/commands/chunk-ESUY7KTZ.js +137 -0
  166. package/dist/commands/chunk-ET6IRQ3L.js +330 -0
  167. package/dist/commands/chunk-EWCUT7U2.js +1314 -0
  168. package/dist/commands/chunk-EWXXEGXL.js +149 -0
  169. package/dist/commands/chunk-EZYW54OQ.js +7569 -0
  170. package/dist/commands/chunk-F2RDEF2J.js +205 -0
  171. package/dist/commands/chunk-F2U46HAE.js +52 -0
  172. package/dist/commands/chunk-F2VYWU6Z.js +653 -0
  173. package/dist/commands/chunk-F4SGOTUF.js +36 -0
  174. package/dist/commands/chunk-F4YMLVWN.js +183 -0
  175. package/dist/commands/chunk-F5N2QIFD.js +213 -0
  176. package/dist/commands/chunk-F7B4ESZE.js +80 -0
  177. package/dist/commands/chunk-FJM2HWKW.js +299 -0
  178. package/dist/commands/chunk-FJMXUDEY.js +3985 -0
  179. package/dist/commands/chunk-FM7VVAK6.js +426 -0
  180. package/dist/commands/chunk-FQWRM5FC.js +67 -0
  181. package/dist/commands/chunk-FT33ZCSB.js +298 -0
  182. package/dist/commands/chunk-G2DNS74C.js +53 -0
  183. package/dist/commands/chunk-G75GWNNY.js +101 -0
  184. package/dist/commands/chunk-GA2YSPFH.js +32 -0
  185. package/dist/commands/chunk-GAVSK6P6.js +230 -0
  186. package/dist/commands/chunk-GB2BRQVL.js +300 -0
  187. package/dist/commands/chunk-GBMZXFFC.js +44 -0
  188. package/dist/commands/chunk-GDP7QXYE.js +76 -0
  189. package/dist/commands/chunk-GGWXF7RJ.js +70 -0
  190. package/dist/commands/chunk-GHOTKHI4.js +30 -0
  191. package/dist/commands/chunk-GMVN6ZP2.js +48 -0
  192. package/dist/commands/chunk-GNTTGRCX.js +133 -0
  193. package/dist/commands/chunk-GOY5JECO.js +130 -0
  194. package/dist/commands/chunk-GVDRRBHZ.js +507 -0
  195. package/dist/commands/chunk-GWTBIGYC.js +550 -0
  196. package/dist/commands/chunk-GZL6ISVM.js +72 -0
  197. package/dist/commands/chunk-HALHQILI.js +51 -0
  198. package/dist/commands/chunk-HAT7AFBF.js +85 -0
  199. package/dist/commands/chunk-HDVSZ6CZ.js +292 -0
  200. package/dist/commands/chunk-HE3GOMR7.js +88 -0
  201. package/dist/commands/chunk-HEFUC4ZW.js +65 -0
  202. package/dist/commands/chunk-HESWKELD.js +60 -0
  203. package/dist/commands/chunk-HNFBEB4L.js +77 -0
  204. package/dist/commands/chunk-HRN73FQJ.js +77 -0
  205. package/dist/commands/chunk-HYE3MBAN.js +113 -0
  206. package/dist/commands/chunk-IAB6LCJL.js +18 -0
  207. package/dist/commands/chunk-IAGENI2U.js +42 -0
  208. package/dist/commands/chunk-ICPVBHIX.js +48 -0
  209. package/dist/commands/chunk-IEKW3ON6.js +161 -0
  210. package/dist/commands/chunk-IOKOHB7P.js +109 -0
  211. package/dist/commands/chunk-IONGJJYM.js +179 -0
  212. package/dist/commands/chunk-IP23WOWP.js +126 -0
  213. package/dist/commands/chunk-IPS7EBE5.js +140 -0
  214. package/dist/commands/chunk-IXZZSST7.js +459 -0
  215. package/dist/commands/chunk-J4XHEOOW.js +156 -0
  216. package/dist/commands/chunk-JDHLHYJJ.js +208 -0
  217. package/dist/commands/chunk-JEYITIWB.js +423 -0
  218. package/dist/commands/chunk-JGX7JIW4.js +126 -0
  219. package/dist/commands/chunk-JHIGDFBS.js +59 -0
  220. package/dist/commands/chunk-JI2EGXZX.js +53 -0
  221. package/dist/commands/chunk-JNV3VRK2.js +47 -0
  222. package/dist/commands/chunk-JPMAW2VZ.js +91 -0
  223. package/dist/commands/chunk-JQEY6KDP.js +90 -0
  224. package/dist/commands/chunk-JSJDIEGZ.js +88 -0
  225. package/dist/commands/chunk-JT5ICRFF.js +44 -0
  226. package/dist/commands/chunk-JUCJ4Y42.js +77 -0
  227. package/dist/commands/chunk-K3OZBV3L.js +49 -0
  228. package/dist/commands/chunk-K5H3CLZZ.js +430 -0
  229. package/dist/commands/chunk-K6P5PISC.js +114 -0
  230. package/dist/commands/chunk-KD3SEAMV.js +402 -0
  231. package/dist/commands/chunk-KDCHY7XO.js +88 -0
  232. package/dist/commands/chunk-KDGX3JTV.js +51 -0
  233. package/dist/commands/chunk-KGSEWOKI.js +353 -0
  234. package/dist/commands/chunk-KHGDZQRG.js +271 -0
  235. package/dist/commands/chunk-KIS7JFNP.js +217 -0
  236. package/dist/commands/chunk-KKHD3C2P.js +114 -0
  237. package/dist/commands/chunk-KKIIY5I5.js +67 -0
  238. package/dist/commands/chunk-KN46UC77.js +114 -0
  239. package/dist/commands/chunk-KP2BVAS5.js +125 -0
  240. package/dist/commands/chunk-KPAJBJXG.js +63 -0
  241. package/dist/commands/chunk-KPMAJP6D.js +145 -0
  242. package/dist/commands/chunk-KR6WUAJM.js +122 -0
  243. package/dist/commands/chunk-KWLNK2NJ.js +391 -0
  244. package/dist/commands/chunk-L2CLCNXW.js +144 -0
  245. package/dist/commands/chunk-L7MDU6D7.js +155 -0
  246. package/dist/commands/chunk-L7VD4MLF.js +78 -0
  247. package/dist/commands/chunk-LBMAJDGN.js +124 -0
  248. package/dist/commands/chunk-LBVYFW3I.js +38 -0
  249. package/dist/commands/chunk-LE3M42CF.js +350 -0
  250. package/dist/commands/chunk-LIPUSINQ.js +140 -0
  251. package/dist/commands/chunk-LJVZWE3A.js +1885 -0
  252. package/dist/commands/chunk-LKSSQVDA.js +49 -0
  253. package/dist/commands/chunk-LL6G34MF.js +93 -0
  254. package/dist/commands/chunk-LNQOL2CL.js +321 -0
  255. package/dist/commands/chunk-LS7P324N.js +72 -0
  256. package/dist/commands/chunk-LU5EOGFQ.js +50 -0
  257. package/dist/commands/chunk-LX2ENXHZ.js +197 -0
  258. package/dist/commands/chunk-M32UPB2D.js +110 -0
  259. package/dist/commands/chunk-M3UGRNNB.js +103 -0
  260. package/dist/commands/chunk-M4WG74Q7.js +260 -0
  261. package/dist/commands/chunk-M5HA2ZCG.js +105 -0
  262. package/dist/commands/chunk-MDGPJOLK.js +351 -0
  263. package/dist/commands/chunk-MDKRTUE4.js +288 -0
  264. package/dist/commands/chunk-MFZVRWRS.js +34 -0
  265. package/dist/commands/chunk-MHXIJKGP.js +304 -0
  266. package/dist/commands/chunk-MK4CARBI.js +90 -0
  267. package/dist/commands/chunk-MLJDW7YN.js +64 -0
  268. package/dist/commands/chunk-MNLHYAJO.js +80 -0
  269. package/dist/commands/chunk-MOD3FG4V.js +419 -0
  270. package/dist/commands/chunk-MRAEJLXL.js +83 -0
  271. package/dist/commands/chunk-MRW2WYJS.js +68 -0
  272. package/dist/commands/chunk-MXPCEZL5.js +23 -0
  273. package/dist/commands/chunk-N2XH7QBY.js +103 -0
  274. package/dist/commands/chunk-N2ZF6T4E.js +332 -0
  275. package/dist/commands/chunk-N36NZMAL.js +79 -0
  276. package/dist/commands/chunk-N4EMFHQ6.js +114 -0
  277. package/dist/commands/chunk-N4P64UIH.js +211 -0
  278. package/dist/commands/chunk-NABSSY4P.js +204 -0
  279. package/dist/commands/chunk-NDQIJBRQ.js +100 -0
  280. package/dist/commands/chunk-NDR4PCVG.js +29 -0
  281. package/dist/commands/chunk-NEOCCN6D.js +302 -0
  282. package/dist/commands/chunk-NFKWFOFM.js +45 -0
  283. package/dist/commands/chunk-NFUPJBBG.js +516 -0
  284. package/dist/commands/chunk-NHEBKL7X.js +170 -0
  285. package/dist/commands/chunk-NHTEC5U4.js +99 -0
  286. package/dist/commands/chunk-NOSG3RUP.js +84 -0
  287. package/dist/commands/chunk-NOSODWWK.js +1132 -0
  288. package/dist/commands/chunk-NPXXYG6Z.js +580 -0
  289. package/dist/commands/chunk-NR2JDBPV.js +75 -0
  290. package/dist/commands/chunk-NRULNBYI.js +1153 -0
  291. package/dist/commands/chunk-NTGF5N3N.js +110 -0
  292. package/dist/commands/chunk-NTIVNQKF.js +73 -0
  293. package/dist/commands/chunk-NUCFIYZL.js +119 -0
  294. package/dist/commands/chunk-NVMV7BYX.js +88 -0
  295. package/dist/commands/chunk-NYWPTYGL.js +169 -0
  296. package/dist/commands/chunk-NZ45KOLL.js +104 -0
  297. package/dist/commands/chunk-O45BX4EL.js +39 -0
  298. package/dist/commands/chunk-O46T4ANI.js +229 -0
  299. package/dist/commands/chunk-O5JGV7NA.js +245 -0
  300. package/dist/commands/chunk-O7ESC4HL.js +566 -0
  301. package/dist/commands/chunk-OBYLXHCH.js +86 -0
  302. package/dist/commands/chunk-OKN63ZH5.js +109 -0
  303. package/dist/commands/chunk-ON4IKRGS.js +469 -0
  304. package/dist/commands/chunk-OT74RSQO.js +82 -0
  305. package/dist/commands/chunk-OVCVINYW.js +143 -0
  306. package/dist/commands/chunk-OZKLVTYI.js +342 -0
  307. package/dist/commands/chunk-P3LJ2Q4N.js +555 -0
  308. package/dist/commands/chunk-P43GWYR6.js +185 -0
  309. package/dist/commands/chunk-P6ASP2DY.js +132 -0
  310. package/dist/commands/chunk-PBAEJ5PT.js +38 -0
  311. package/dist/commands/chunk-PCZROH3R.js +100 -0
  312. package/dist/commands/chunk-PF3PMT2Q.js +46 -0
  313. package/dist/commands/chunk-PILH72AV.js +170 -0
  314. package/dist/commands/chunk-PJYTUUTH.js +34 -0
  315. package/dist/commands/chunk-PKXTISWR.js +58 -0
  316. package/dist/commands/chunk-PSGLUBSB.js +74 -0
  317. package/dist/commands/chunk-PUQA7F6Y.js +186 -0
  318. package/dist/commands/chunk-PVRDJU2B.js +126 -0
  319. package/dist/commands/chunk-Q3HM2BEH.js +45 -0
  320. package/dist/commands/chunk-Q42NF2TL.js +47 -0
  321. package/dist/commands/chunk-Q4ULMZAS.js +106 -0
  322. package/dist/commands/chunk-QCRUPRQ2.js +207 -0
  323. package/dist/commands/chunk-QFIKPGMC.js +280 -0
  324. package/dist/commands/chunk-QSBYULSS.js +100 -0
  325. package/dist/commands/chunk-QSJCZATC.js +18 -0
  326. package/dist/commands/chunk-QTJPCXEW.js +23 -0
  327. package/dist/commands/chunk-QTQAI2M2.js +179 -0
  328. package/dist/commands/chunk-QTVVFV4Q.js +127 -0
  329. package/dist/commands/chunk-QX2EMUXV.js +102 -0
  330. package/dist/commands/chunk-QXBOECGL.js +272 -0
  331. package/dist/commands/chunk-QXCG3SG4.js +88 -0
  332. package/dist/commands/chunk-QZVMGAWV.js +307 -0
  333. package/dist/commands/chunk-R36VZIKU.js +53 -0
  334. package/dist/commands/chunk-R3F7F3TX.js +94 -0
  335. package/dist/commands/chunk-R5AABJZJ.js +1062 -0
  336. package/dist/commands/chunk-R7PYR4HW.js +389 -0
  337. package/dist/commands/chunk-RDUFVQVJ.js +997 -0
  338. package/dist/commands/chunk-RESNXNDG.js +54 -0
  339. package/dist/commands/chunk-RFIOZTXY.js +305 -0
  340. package/dist/commands/chunk-RFWB2KAV.js +102 -0
  341. package/dist/commands/chunk-RFXON3FK.js +25 -0
  342. package/dist/commands/chunk-RGEB5L37.js +66 -0
  343. package/dist/commands/chunk-RGRLLF2J.js +119 -0
  344. package/dist/commands/chunk-RLRIMYXM.js +178 -0
  345. package/dist/commands/chunk-RNB3DQOZ.js +70 -0
  346. package/dist/commands/chunk-RO4QEZJO.js +172 -0
  347. package/dist/commands/chunk-RS5HBJY6.js +161 -0
  348. package/dist/commands/chunk-RV7EQIE4.js +202 -0
  349. package/dist/commands/chunk-RWPCK3CO.js +41 -0
  350. package/dist/commands/chunk-RWYSVFIA.js +250 -0
  351. package/dist/commands/chunk-RYKK75YT.js +289 -0
  352. package/dist/commands/chunk-S4JE63QE.js +704 -0
  353. package/dist/commands/chunk-S4OZJIXD.js +134 -0
  354. package/dist/commands/chunk-SD4EX75H.js +177 -0
  355. package/dist/commands/chunk-SJITWFNY.js +480 -0
  356. package/dist/commands/chunk-SKGDMAIA.js +33 -0
  357. package/dist/commands/chunk-SNSZ25XZ.js +393 -0
  358. package/dist/commands/chunk-SQZZHK6X.js +119 -0
  359. package/dist/commands/chunk-SRTEE34O.js +93 -0
  360. package/dist/commands/chunk-SYTCTLMD.js +285 -0
  361. package/dist/commands/chunk-T6JUDQMW.js +181 -0
  362. package/dist/commands/chunk-T6OUNP7E.js +426 -0
  363. package/dist/commands/chunk-TEXUEBGE.js +208 -0
  364. package/dist/commands/chunk-TFDVTU6O.js +910 -0
  365. package/dist/commands/chunk-TFYYXETQ.js +472 -0
  366. package/dist/commands/chunk-TMFKVJUW.js +121 -0
  367. package/dist/commands/chunk-TNJU4CXD.js +32 -0
  368. package/dist/commands/chunk-TRHWBUWE.js +61 -0
  369. package/dist/commands/chunk-TROCFVCU.js +45 -0
  370. package/dist/commands/chunk-TTTZZN7F.js +269 -0
  371. package/dist/commands/chunk-TUBBESHU.js +85 -0
  372. package/dist/commands/chunk-TVZIFZZN.js +62 -0
  373. package/dist/commands/chunk-TXRWAL63.js +144 -0
  374. package/dist/commands/chunk-U46YTYJQ.js +92 -0
  375. package/dist/commands/chunk-U5EO4QEV.js +48 -0
  376. package/dist/commands/chunk-UCO333EX.js +47 -0
  377. package/dist/commands/chunk-UIXQ4IYT.js +445 -0
  378. package/dist/commands/chunk-UJGNYPMD.js +716 -0
  379. package/dist/commands/chunk-URZ4RDC4.js +220 -0
  380. package/dist/commands/chunk-UUH3DE77.js +57 -0
  381. package/dist/commands/chunk-UVY5ODCM.js +60 -0
  382. package/dist/commands/chunk-UWMB6EOU.js +45 -0
  383. package/dist/commands/chunk-UX3HCPLX.js +449 -0
  384. package/dist/commands/chunk-UY62WJV6.js +120 -0
  385. package/dist/commands/chunk-V2T5DP3B.js +224 -0
  386. package/dist/commands/chunk-VAHQ4AFM.js +585 -0
  387. package/dist/commands/chunk-VCWNMRH7.js +71 -0
  388. package/dist/commands/chunk-VHLDQ3PH.js +30 -0
  389. package/dist/commands/chunk-VL5I2IOD.js +332 -0
  390. package/dist/commands/chunk-VLN6TSPJ.js +139 -0
  391. package/dist/commands/chunk-VMG3QB6C.js +81 -0
  392. package/dist/commands/chunk-VO25PMGS.js +58 -0
  393. package/dist/commands/chunk-VTLWODJ2.js +133 -0
  394. package/dist/commands/chunk-VXE3V3OC.js +335 -0
  395. package/dist/commands/chunk-VY7ZJMDT.js +469 -0
  396. package/dist/commands/chunk-W3MDLQZF.js +137 -0
  397. package/dist/commands/chunk-W4BR6QNU.js +1241 -0
  398. package/dist/commands/chunk-WCYRNNKF.js +76 -0
  399. package/dist/commands/chunk-WEUUJIWQ.js +84 -0
  400. package/dist/commands/chunk-WNBJK6QE.js +84 -0
  401. package/dist/commands/chunk-WR5PKCQW.js +61 -0
  402. package/dist/commands/chunk-WR73HTRG.js +121 -0
  403. package/dist/commands/chunk-WRNMUQTD.js +95 -0
  404. package/dist/commands/chunk-WROJTXWZ.js +138 -0
  405. package/dist/commands/chunk-WTIPX5NG.js +43 -0
  406. package/dist/commands/chunk-WWLCQREY.js +225 -0
  407. package/dist/commands/chunk-WXLW7S4M.js +71 -0
  408. package/dist/commands/chunk-WXXLJQBO.js +67 -0
  409. package/dist/commands/chunk-X4LYH6Q4.js +56 -0
  410. package/dist/commands/chunk-XAEL24EG.js +66 -0
  411. package/dist/commands/chunk-XCCT6GKA.js +74 -0
  412. package/dist/commands/chunk-XDR2BRDL.js +216 -0
  413. package/dist/commands/chunk-XRQMVAB4.js +85 -0
  414. package/dist/commands/chunk-XSKJAG72.js +91 -0
  415. package/dist/commands/chunk-XTJA34ND.js +492 -0
  416. package/dist/commands/chunk-XUXCFPDK.js +218 -0
  417. package/dist/commands/chunk-XXPDFJRI.js +48 -0
  418. package/dist/commands/chunk-Y6OGDG5I.js +49 -0
  419. package/dist/commands/chunk-YEAE46TS.js +98 -0
  420. package/dist/commands/chunk-YEQFAEVW.js +112 -0
  421. package/dist/commands/chunk-YJZAD4Z5.js +103 -0
  422. package/dist/commands/chunk-YMAEYY5R.js +278 -0
  423. package/dist/commands/chunk-YNCF66RK.js +1052 -0
  424. package/dist/commands/chunk-YOA25SII.js +210 -0
  425. package/dist/commands/chunk-YOZTZMAT.js +38 -0
  426. package/dist/commands/chunk-YSGRHVZG.js +897 -0
  427. package/dist/commands/chunk-YSLGWRQN.js +646 -0
  428. package/dist/commands/chunk-YTXCLGGL.js +168 -0
  429. package/dist/commands/chunk-YVHJN2HS.js +74 -0
  430. package/dist/commands/chunk-YY7XVVSB.js +43 -0
  431. package/dist/commands/chunk-Z5GZV4DV.js +16 -0
  432. package/dist/commands/chunk-Z6QLFPFB.js +907 -0
  433. package/dist/commands/chunk-ZB52ZIEA.js +1629 -0
  434. package/dist/commands/chunk-ZCD4AV2P.js +73 -0
  435. package/dist/commands/chunk-ZCHZU6NX.js +799 -0
  436. package/dist/commands/chunk-ZEH2B3DF.js +239 -0
  437. package/dist/commands/chunk-ZEUKX3RZ.js +245 -0
  438. package/dist/commands/chunk-ZGANVZCA.js +92 -0
  439. package/dist/commands/chunk-ZGBXUY7R.js +198 -0
  440. package/dist/commands/chunk-ZGEUWHFF.js +297 -0
  441. package/dist/commands/chunk-ZHSNQ2F7.js +161 -0
  442. package/dist/commands/chunk-ZIIUBGON.js +773 -0
  443. package/dist/commands/chunk-ZJ5S4VFD.js +258 -0
  444. package/dist/commands/chunk-ZNIIA275.js +59 -0
  445. package/dist/commands/chunk-ZV6BZZJ2.js +271 -0
  446. package/dist/commands/ci-timing-cli.js +22 -3
  447. package/dist/commands/code-symbol-cli.js +21 -7
  448. package/dist/commands/codex-hook-adapter.js +124 -119
  449. package/dist/commands/command-derive.js +9 -11
  450. package/dist/commands/cost-audit-main.js +118 -119
  451. package/dist/commands/cost-main.js +5 -7
  452. package/dist/commands/cspell-cached.js +55 -57
  453. package/dist/commands/defect-origin-main.js +42 -37
  454. package/dist/commands/defect-report-main.js +33 -25
  455. package/dist/commands/diff-summary-cli.js +3 -4
  456. package/dist/commands/disposition-cli.js +117 -118
  457. package/dist/commands/doctor.js +24 -11
  458. package/dist/commands/document-read-cli.js +50 -53
  459. package/dist/commands/document-section-main.js +50 -53
  460. package/dist/commands/dogfood-commit-cli.js +19 -4
  461. package/dist/commands/effect-audit-cli.js +40 -41
  462. package/dist/commands/epic-audit-main.js +88 -86
  463. package/dist/commands/epic-bundle-main.js +122 -119
  464. package/dist/commands/epic-check.js +37 -31
  465. package/dist/commands/epic-main.js +129 -126
  466. package/dist/commands/epic-next-main.js +85 -83
  467. package/dist/commands/eval-run.js +6 -7
  468. package/dist/commands/format-edited-cli.js +71 -46
  469. package/dist/commands/format.js +41 -56
  470. package/dist/commands/fresh-machine-cli.js +24 -7
  471. package/dist/commands/gh-usage-cli.js +22 -22
  472. package/dist/commands/git-followup-workflow.js +158 -158
  473. package/dist/commands/git-gh-checks-failed-main.js +23 -15
  474. package/dist/commands/git-workflow.js +52 -53
  475. package/dist/commands/github-release-cli.js +3 -3
  476. package/dist/commands/hook-ledger-cli.js +93 -94
  477. package/dist/commands/init-main.js +40 -40
  478. package/dist/commands/inputs.json +2020 -1980
  479. package/dist/commands/issue-ack-cli.js +28 -21
  480. package/dist/commands/issue-already-done-cli.js +107 -110
  481. package/dist/commands/issue-body-cli.js +71 -73
  482. package/dist/commands/issue-cite-main.js +35 -28
  483. package/dist/commands/issue-comment-main.js +36 -30
  484. package/dist/commands/issue-consolidate-cli.js +54 -54
  485. package/dist/commands/issue-file-main.js +274 -148
  486. package/dist/commands/issue-fold-existing-cli.js +126 -123
  487. package/dist/commands/issue-fold-main.js +57 -60
  488. package/dist/commands/issue-lint-main.js +59 -61
  489. package/dist/commands/issue-measured-cli.js +108 -110
  490. package/dist/commands/issue-plan-cli.js +156 -155
  491. package/dist/commands/issue-premise-unmet-cli.js +111 -113
  492. package/dist/commands/issue-priority-cli.js +38 -32
  493. package/dist/commands/issue-read-main.js +38 -33
  494. package/dist/commands/issue-release-class-cli.js +37 -31
  495. package/dist/commands/issue-release-main.js +35 -29
  496. package/dist/commands/issue-scout-main.js +123 -120
  497. package/dist/commands/issue-spill-main.js +149 -144
  498. package/dist/commands/issue-state-main.js +36 -31
  499. package/dist/commands/issue-tick-cli.js +37 -31
  500. package/dist/commands/josh-completion.js +21 -24
  501. package/dist/commands/lane-adopt-cli.js +53 -55
  502. package/dist/commands/lane-breakdown-cli.js +193 -172
  503. package/dist/commands/lane-cli.js +199 -180
  504. package/dist/commands/lane-launch-main.js +106 -56
  505. package/dist/commands/lane-limit-cli.js +119 -116
  506. package/dist/commands/lane-measure-cli.js +408 -245
  507. package/dist/commands/lane-pause-cli.js +51 -54
  508. package/dist/commands/lane-plan-cli.js +148 -147
  509. package/dist/commands/lane-resolve-cli.js +48 -50
  510. package/dist/commands/lane-restart-cli.js +185 -168
  511. package/dist/commands/lane-why-cli.js +121 -122
  512. package/dist/commands/lane-withdraw-cli.js +84 -86
  513. package/dist/commands/latest-corepack.js +3 -2
  514. package/dist/commands/latest-if-required-cli.js +12 -15
  515. package/dist/commands/latest-lane-guard-main.js +2 -3
  516. package/dist/commands/latest-scope-main.js +5 -7
  517. package/dist/commands/latest-update.js +3 -2
  518. package/dist/commands/lines-command.js +8 -10
  519. package/dist/commands/lint-parallel-main.js +65 -67
  520. package/dist/commands/lint-related.js +149 -133
  521. package/dist/commands/lint-rule.js +64 -66
  522. package/dist/commands/lockfile-policy.js +29 -32
  523. package/dist/commands/main-merge-main.js +23 -25
  524. package/dist/commands/main-sync-main.js +23 -24
  525. package/dist/commands/managed-config-scope-cli.js +11 -10
  526. package/dist/commands/measure-rerun-cli.js +31 -26
  527. package/dist/commands/metrics-command.js +97 -100
  528. package/dist/commands/observation-record-cli.js +24 -14
  529. package/dist/commands/observations-flush-cli.js +50 -52
  530. package/dist/commands/overrides-check.js +1 -1
  531. package/dist/commands/package-scout-cli.js +70 -73
  532. package/dist/commands/pin-verify-cli.js +21 -2
  533. package/dist/commands/plan-consumers-main.js +3 -4
  534. package/dist/commands/plan-scaffold-cli.js +145 -146
  535. package/dist/commands/pr-classification-main.js +22 -3
  536. package/dist/commands/pre-commit-lint.js +30 -34
  537. package/dist/commands/pre-commit-type-check.js +55 -55
  538. package/dist/commands/pre-push-unit.js +69 -70
  539. package/dist/commands/pretool-guard-cli.js +111 -113
  540. package/dist/commands/prevent-main-commit.js +2 -3
  541. package/dist/commands/project-profile-cli.js +24 -9
  542. package/dist/commands/propagate.js +31 -23
  543. package/dist/commands/prose-stale-cli.js +48 -42
  544. package/dist/commands/publishable-range-check.js +3 -3
  545. package/dist/commands/read-set-cli.js +58 -61
  546. package/dist/commands/refactor-scan-cli.js +8 -9
  547. package/dist/commands/release-cli.js +57 -57
  548. package/dist/commands/release-scope-main.js +41 -36
  549. package/dist/commands/rename-cli.js +64 -36
  550. package/dist/commands/repo-party-cli.js +3 -4
  551. package/dist/commands/report-template-cli.js +4 -5
  552. package/dist/commands/reserved-run.js +17 -20
  553. package/dist/commands/retrospective-cli.js +126 -127
  554. package/dist/commands/review-attest-cli.js +28 -20
  555. package/dist/commands/review-brief-main.js +184 -167
  556. package/dist/commands/review-findings-cli.js +23 -13
  557. package/dist/commands/review-pair-cli.js +180 -156
  558. package/dist/commands/review-record-main.js +171 -147
  559. package/dist/commands/review-round2-cli.js +89 -91
  560. package/dist/commands/review-stops-cli.js +51 -54
  561. package/dist/commands/review-submit-cli.js +184 -167
  562. package/dist/commands/rule-list.js +78 -80
  563. package/dist/commands/rule-value-cli.js +115 -116
  564. package/dist/commands/ruleset-check-cli.js +23 -6
  565. package/dist/commands/run-add-cli.js +115 -75
  566. package/dist/commands/run-board-main.js +172 -169
  567. package/dist/commands/run-carry-cli.js +182 -174
  568. package/dist/commands/run-chain-cli.js +184 -160
  569. package/dist/commands/run-cut-cli.js +206 -168
  570. package/dist/commands/run-ending-cli.js +51 -54
  571. package/dist/commands/run-entry-cli.js +230 -283
  572. package/dist/commands/run-event-cli.js +18 -21
  573. package/dist/commands/run-handoff-cli.js +75 -78
  574. package/dist/commands/run-handoff-lanes-cli.js +48 -51
  575. package/dist/commands/run-hold-main.js +105 -107
  576. package/dist/commands/run-liveness-cli.js +47 -49
  577. package/dist/commands/run-merge-main.js +159 -151
  578. package/dist/commands/run-next-cli.js +128 -129
  579. package/dist/commands/run-park-cli.js +137 -140
  580. package/dist/commands/run-pause-cli.js +190 -186
  581. package/dist/commands/run-pickup-cli.js +49 -52
  582. package/dist/commands/run-prep-main.js +124 -125
  583. package/dist/commands/run-prime-cli.js +175 -147
  584. package/dist/commands/run-progress-main.js +149 -146
  585. package/dist/commands/run-report-cli.js +60 -60
  586. package/dist/commands/run-review-cli.js +229 -214
  587. package/dist/commands/run-ship-cli.js +258 -252
  588. package/dist/commands/run-ship-evidence-cli.js +71 -72
  589. package/dist/commands/run-ship-lap-W66LTXJJ.js +28 -0
  590. package/dist/commands/run-ship-wait-main.js +83 -85
  591. package/dist/commands/run-split-cli.js +176 -172
  592. package/dist/commands/run-stale-main.js +72 -75
  593. package/dist/commands/run-status-cli.js +44 -44
  594. package/dist/commands/run-step-cli.js +213 -211
  595. package/dist/commands/run-tail-cli.js +23 -18
  596. package/dist/commands/run-tidy-main.js +67 -69
  597. package/dist/commands/run-wake-main.js +206 -187
  598. package/dist/commands/run-watcher-guard-cli.js +63 -66
  599. package/dist/commands/security-audit-main.js +21 -24
  600. package/dist/commands/security-audit-provision-main.js +9 -11
  601. package/dist/commands/selfcheck-cli.js +63 -57
  602. package/dist/commands/session-language-main.js +70 -73
  603. package/dist/commands/sonar-hotspots-cli.js +9 -8
  604. package/dist/commands/sonar-new-code-cli.js +3 -4
  605. package/dist/commands/split-assess-cli.js +55 -58
  606. package/dist/commands/split-child-recover-cli.js +38 -39
  607. package/dist/commands/start.js +64 -64
  608. package/dist/commands/stash-pop-main.js +4 -5
  609. package/dist/commands/stash-push-main.js +7 -9
  610. package/dist/commands/stop-guard.js +180 -176
  611. package/dist/commands/sync-main.js +30 -15
  612. package/dist/commands/telegram-test-main.js +29 -22
  613. package/dist/commands/test-declared.js +29 -15
  614. package/dist/commands/test-e2e-guard.js +54 -54
  615. package/dist/commands/test-pinned-main.js +57 -56
  616. package/dist/commands/test-reach-cli.js +40 -32
  617. package/dist/commands/test-red-main.js +12 -14
  618. package/dist/commands/test-related-Z6YY2GFH.js +113 -0
  619. package/dist/commands/test-related-main.js +89 -89
  620. package/dist/commands/test-unit-guard-main.js +37 -37
  621. package/dist/commands/time-cli.js +54 -57
  622. package/dist/commands/time-density-cli.js +26 -29
  623. package/dist/commands/tree-status-cli.js +6 -8
  624. package/dist/commands/type-check-command.js +26 -11
  625. package/dist/commands/ui-routes-cli.js +5 -6
  626. package/dist/commands/ui-shot-cli.js +1 -1
  627. package/dist/commands/uninstall.js +44 -43
  628. package/dist/commands/unused-members-KVKZDTXD.js +329 -0
  629. package/dist/commands/unused-members-cli.js +27 -12
  630. package/dist/commands/upstream-interrupt-main.js +159 -151
  631. package/dist/commands/verification-gate.js +85 -86
  632. package/dist/commands/version-check.js +25 -8
  633. package/dist/hooks/chunk-3SA3FIQC.js +6869 -0
  634. package/dist/hooks/chunk-46PTTMGE.js +1625 -0
  635. package/dist/hooks/chunk-5NIBRHWG.js +77 -0
  636. package/dist/hooks/chunk-76QKN2K3.js +258 -0
  637. package/dist/hooks/chunk-CHEKMGFP.js +321 -0
  638. package/dist/hooks/chunk-DCILEVDR.js +5173 -0
  639. package/dist/hooks/chunk-HVNGIM5W.js +5092 -0
  640. package/dist/hooks/chunk-L6IZZ2IL.js +11219 -0
  641. package/dist/hooks/chunk-UZXMFOVK.js +9170 -0
  642. package/dist/hooks/chunk-WCJ2GWYJ.js +1381 -0
  643. package/dist/hooks/chunk-YRKS5ZKE.js +1915 -0
  644. package/dist/hooks/codex-hook-adapter.js +11 -12
  645. package/dist/hooks/daemon.js +2140 -1387
  646. package/dist/hooks/format-edited.js +6 -6
  647. package/dist/hooks/inputs.json +521 -497
  648. package/dist/hooks/pretool-guard.js +8 -8
  649. package/dist/hooks/run-ship-lap-P5555IG7.js +8 -0
  650. package/dist/hooks/session-lang.js +9 -7
  651. package/dist/hooks/stop-guard.js +962 -669
  652. package/dist/inputs.json +63 -54
  653. package/dist/josh.js +1029 -577
  654. package/dist/registry-migrate.mjs +33938 -0
  655. package/dist/version/index.js +4251 -175
  656. package/package.json +4 -1
  657. package/prompts/collaboration-workflow/principles.md +4 -1
  658. package/prompts/collaboration-workflow/rule-delivery.md +1 -1
  659. package/scripts/agent/codex-launch-identity.ts +70 -0
  660. package/scripts/auto-ok/auto-ok-cli.ts +2 -0
  661. package/scripts/auto-ok/auto-ok-judge-write.ts +2 -0
  662. package/scripts/auto-ok/auto-ok-judge.ts +3 -1
  663. package/scripts/backlog/backlog-arrival.ts +1 -1
  664. package/scripts/backlog/backlog-budget.ts +5 -2
  665. package/scripts/backlog/backlog-defect-priority.ts +1 -1
  666. package/scripts/backlog/backlog-dispatch-bound.ts +17 -0
  667. package/scripts/backlog/backlog-drain-flush.ts +38 -3
  668. package/scripts/backlog/backlog-drive-cli.ts +1 -1
  669. package/scripts/backlog/backlog-drive-hold.ts +28 -5
  670. package/scripts/backlog/backlog-drive-launch.ts +37 -15
  671. package/scripts/backlog/backlog-drive-listing.ts +39 -23
  672. package/scripts/backlog/backlog-drive-retrospective-unit.ts +3 -2
  673. package/scripts/backlog/backlog-drive-split-unit.ts +1 -0
  674. package/scripts/backlog/backlog-hold-codes.ts +7 -0
  675. package/scripts/backlog/backlog-hold-text.ts +14 -1
  676. package/scripts/backlog/backlog-measure-close.ts +6 -0
  677. package/scripts/backlog/backlog-next-shared.ts +20 -2
  678. package/scripts/backlog/backlog-next.ts +24 -3
  679. package/scripts/backlog/backlog-offer-cli.ts +69 -16
  680. package/scripts/build/build-migration.ts +25 -0
  681. package/scripts/build/build.ts +2 -0
  682. package/scripts/epic/epic-classify.ts +6 -1
  683. package/scripts/epic/epic-live.ts +46 -0
  684. package/scripts/followup/followup-failed-tests.ts +71 -10
  685. package/scripts/followup/followup-job-rerun.ts +2 -2
  686. package/scripts/gate/change-scope-action.integration.test.ts +88 -0
  687. package/scripts/gate/change-scope-action.ts +2 -0
  688. package/scripts/gate/check-related-order.ts +6 -7
  689. package/scripts/gate/check-related.ts +18 -8
  690. package/scripts/gate/core-admission.ts +17 -30
  691. package/scripts/gate/core-budget-poll.ts +183 -0
  692. package/scripts/gate/core-budget-timing.ts +1 -1
  693. package/scripts/gate/core-budget.ts +24 -112
  694. package/scripts/gate/core-wait-record.ts +52 -7
  695. package/scripts/gate/machine-capacity.ts +6 -2
  696. package/scripts/gate/metrics-totals.ts +11 -0
  697. package/scripts/gate/path-glob.test.ts +18 -0
  698. package/scripts/gate/toolchain-inputs.consumer.test.ts +36 -0
  699. package/scripts/gh/fix-gh-packages-logic.ts +22 -15
  700. package/scripts/gh/gh-request-tally.ts +4 -0
  701. package/scripts/hooks/bash-revert.ts +79 -31
  702. package/scripts/hooks/format-edited-file.ts +6 -8
  703. package/scripts/hooks/implementation-shell.ts +3 -2
  704. package/scripts/init/distributed-paths.ts +18 -5
  705. package/scripts/init/init-actions.ts +16 -1
  706. package/scripts/init/init-bootstrap.ts +2 -0
  707. package/scripts/init/init-logic.ts +40 -8
  708. package/scripts/init/init.ts +11 -3
  709. package/scripts/issue/defect-rate-cli.ts +19 -13
  710. package/scripts/issue/issue-file-batch.ts +7 -3
  711. package/scripts/issue/issue-file-cli.ts +19 -6
  712. package/scripts/issue/issue-file-main.ts +6 -1
  713. package/scripts/issue/issue-file-pass.ts +17 -0
  714. package/scripts/issue/issue-file.ts +3 -0
  715. package/scripts/issue/issue-not-before.ts +9 -2
  716. package/scripts/issue/issue-observation-gate.ts +141 -0
  717. package/scripts/issue/issue-observation-prime.ts +83 -0
  718. package/scripts/issue/issue-publication-state.ts +61 -0
  719. package/scripts/issue/issue-publication.ts +144 -0
  720. package/scripts/issue/issue-sample-prime.ts +2 -0
  721. package/scripts/issue/issue-search-count.ts +26 -0
  722. package/scripts/issue/issue-search.ts +128 -3
  723. package/scripts/issue/issue-spill-cli.ts +4 -0
  724. package/scripts/issue/upstream-interrupt-cli.ts +21 -5
  725. package/scripts/josh/josh-commands-ai.ts +1 -1
  726. package/scripts/josh/josh-commands-development.ts +1 -1
  727. package/scripts/josh/josh-commands-issue-write.ts +9 -0
  728. package/scripts/josh/josh-commands-run.ts +6 -1
  729. package/scripts/josh/josh-commands-ship.ts +5 -5
  730. package/scripts/josh/josh-run.ts +5 -2
  731. package/scripts/josh/shared-cache.ts +16 -1
  732. package/scripts/lane/lane-await.ts +15 -0
  733. package/scripts/lane/lane-cli.ts +2 -0
  734. package/scripts/lane/lane-dispatch-dependency.ts +102 -0
  735. package/scripts/lane/lane-dispatch-wait-stats.ts +239 -0
  736. package/scripts/lane/lane-dispatch.ts +44 -5
  737. package/scripts/lane/lane-early-push-count.ts +21 -0
  738. package/scripts/lane/lane-install.ts +15 -5
  739. package/scripts/lane/lane-launch-cli.ts +35 -14
  740. package/scripts/lane/lane-ledger-kind.ts +2 -0
  741. package/scripts/lane/lane-ledger-schema-ship.ts +5 -1
  742. package/scripts/lane/lane-ledger-schema.ts +15 -1
  743. package/scripts/lane/lane-ledger-write.ts +4 -1
  744. package/scripts/lane/lane-relaunch.ts +25 -2
  745. package/scripts/lane/lane-state-record.ts +2 -0
  746. package/scripts/lane/lane-state.ts +8 -1
  747. package/scripts/lane/lane-stats-tables.ts +2 -0
  748. package/scripts/lane/openai-lane-supervisor.ts +16 -1
  749. package/scripts/lib/inherited-scope.ts +48 -0
  750. package/scripts/lint/format-steps.ts +93 -0
  751. package/scripts/lint/format.ts +6 -49
  752. package/scripts/lint/lint-related-fix.ts +35 -0
  753. package/scripts/lint/lint-related.ts +22 -35
  754. package/scripts/propagate/propagate-steps.ts +9 -4
  755. package/scripts/registry-migration/migrate-cli.ts +50 -0
  756. package/scripts/registry-migration/migrate-files.ts +154 -0
  757. package/scripts/registry-migration/migrate-lock.ts +147 -0
  758. package/scripts/registry-migration/migrate.ts +235 -0
  759. package/scripts/registry-migration/npm-acquisition.ts +118 -0
  760. package/scripts/review/review-record-cli.ts +27 -13
  761. package/scripts/review/review-record-pinned.ts +15 -6
  762. package/scripts/run/add/run-add-cli.ts +21 -3
  763. package/scripts/run/add/run-add.ts +26 -9
  764. package/scripts/run/board/run-board-layout.ts +2 -2
  765. package/scripts/run/board/run-board-reason.ts +12 -0
  766. package/scripts/run/board/run-board-retry-wait.ts +35 -0
  767. package/scripts/run/board/run-board-seat.ts +9 -2
  768. package/scripts/run/board/run-board-setup.ts +6 -4
  769. package/scripts/run/carry/run-carry-reclaim.ts +12 -2
  770. package/scripts/run/carry/run-carry-session.ts +48 -0
  771. package/scripts/run/carry/run-carry.ts +21 -14
  772. package/scripts/run/cut/run-cut-resume.ts +15 -3
  773. package/scripts/run/cut/run-cut.ts +1 -1
  774. package/scripts/run/detached-launch.ts +14 -5
  775. package/scripts/run/early-push-record.ts +6 -2
  776. package/scripts/run/event/run-event-setup.ts +2 -0
  777. package/scripts/run/event/run-event-stream-emit.ts +27 -7
  778. package/scripts/run/hold/run-hold-cli.ts +40 -5
  779. package/scripts/run/merge/run-merge-cut-release.ts +17 -0
  780. package/scripts/run/merge/run-merge-human-review.ts +6 -0
  781. package/scripts/run/merge/run-merge-steps.ts +4 -57
  782. package/scripts/run/merge/run-merge-waits.ts +54 -0
  783. package/scripts/run/prime/run-prime-cli.ts +16 -2
  784. package/scripts/run/review/run-review-cli.ts +5 -7
  785. package/scripts/run/review/run-review-early-push.ts +19 -8
  786. package/scripts/run/review/run-review-join-read.ts +33 -6
  787. package/scripts/run/review/run-review-pinned-remaining.ts +124 -0
  788. package/scripts/run/review/run-review-pinned-steps.ts +7 -1
  789. package/scripts/run/run-halfrun-resume.ts +49 -6
  790. package/scripts/run/run-headless.ts +3 -0
  791. package/scripts/run/run-pr-return.ts +14 -5
  792. package/scripts/run/run-repair-attempt.ts +219 -0
  793. package/scripts/run/ship/run-ship-lap.ts +5 -17
  794. package/scripts/run/ship/run-ship-pre-detach-pinned.ts +4 -13
  795. package/scripts/run/ship/run-ship-scoped.ts +66 -30
  796. package/scripts/run/startup/run-startup-schema.ts +31 -0
  797. package/scripts/run/startup/run-startup-store.ts +130 -0
  798. package/scripts/run/startup/run-startup.ts +119 -0
  799. package/scripts/run/wake/run-wake-codex.ts +144 -0
  800. package/scripts/run/wake/run-wake-driver.ts +32 -7
  801. package/scripts/run/wake/run-wake-handoff.ts +9 -8
  802. package/scripts/run/wake/run-wake-loop.ts +23 -3
  803. package/scripts/run/wake/run-wake-ports.ts +17 -3
  804. package/scripts/run/wake/run-wake-takeover.ts +6 -3
  805. package/scripts/run/wake/run-wake-window.ts +4 -1
  806. package/scripts/run/wake/run-wake.ts +5 -0
  807. package/scripts/sync/sync-ai-files.ts +17 -0
  808. package/scripts/sync/sync-configs.ts +11 -1
  809. package/scripts/sync/sync.ts +5 -1
  810. package/scripts/test/test-related-cap.ts +7 -3
  811. package/scripts/test/test-related-imports.ts +92 -0
  812. package/scripts/test/vitest-failure-summary.ts +7 -0
  813. package/scripts/version/npm-registry.ts +45 -7
  814. package/scripts/version/upgrade-shell-command.ts +34 -2
  815. package/templates/workflows/ci.yml +0 -15
  816. package/templates/workflows/github-release.yml +0 -5
  817. package/dist/commands/chunk-23GH6B3D.js +0 -333
  818. package/dist/commands/chunk-24OATKOF.js +0 -7534
  819. package/dist/commands/chunk-24ZDAWML.js +0 -48
  820. package/dist/commands/chunk-2BB5ZR2F.js +0 -128
  821. package/dist/commands/chunk-2BJJUTZA.js +0 -59
  822. package/dist/commands/chunk-2CXT6MBR.js +0 -51
  823. package/dist/commands/chunk-2DJLAUYB.js +0 -109
  824. package/dist/commands/chunk-2EZTYLO4.js +0 -179
  825. package/dist/commands/chunk-2FJJYCBD.js +0 -149
  826. package/dist/commands/chunk-2PHOLX62.js +0 -43
  827. package/dist/commands/chunk-2QM72JCJ.js +0 -338
  828. package/dist/commands/chunk-2VRITY55.js +0 -41
  829. package/dist/commands/chunk-2XAH3MHV.js +0 -23
  830. package/dist/commands/chunk-34KZDKQJ.js +0 -304
  831. package/dist/commands/chunk-352KLSFX.js +0 -67
  832. package/dist/commands/chunk-36LOGVJ7.js +0 -38
  833. package/dist/commands/chunk-3AEDZZNL.js +0 -223
  834. package/dist/commands/chunk-3B2HEFNO.js +0 -51
  835. package/dist/commands/chunk-3PEXBHRN.js +0 -33
  836. package/dist/commands/chunk-3Z425MM3.js +0 -61
  837. package/dist/commands/chunk-3ZOX4G4U.js +0 -88
  838. package/dist/commands/chunk-452HWOJ7.js +0 -395
  839. package/dist/commands/chunk-475EFIJV.js +0 -178
  840. package/dist/commands/chunk-47UZB54M.js +0 -73
  841. package/dist/commands/chunk-4DN4XVPL.js +0 -716
  842. package/dist/commands/chunk-4DVM57T7.js +0 -86
  843. package/dist/commands/chunk-4EADHJVC.js +0 -247
  844. package/dist/commands/chunk-4HERA2GY.js +0 -95
  845. package/dist/commands/chunk-4JI35CVO.js +0 -70
  846. package/dist/commands/chunk-4L4LNWZ7.js +0 -143
  847. package/dist/commands/chunk-4N32QKJZ.js +0 -170
  848. package/dist/commands/chunk-4NRSFLG7.js +0 -185
  849. package/dist/commands/chunk-4OKRPAUT.js +0 -98
  850. package/dist/commands/chunk-4PUKDAXL.js +0 -42
  851. package/dist/commands/chunk-4Q64PG46.js +0 -478
  852. package/dist/commands/chunk-4UDTQVDD.js +0 -278
  853. package/dist/commands/chunk-4WR2LEZL.js +0 -123
  854. package/dist/commands/chunk-4ZJOC6OK.js +0 -298
  855. package/dist/commands/chunk-4ZQM4I7R.js +0 -533
  856. package/dist/commands/chunk-54X37JEJ.js +0 -170
  857. package/dist/commands/chunk-56KW5EOK.js +0 -85
  858. package/dist/commands/chunk-5CG3XU3O.js +0 -74
  859. package/dist/commands/chunk-5ESZLHDZ.js +0 -514
  860. package/dist/commands/chunk-5FBRMARM.js +0 -578
  861. package/dist/commands/chunk-5RG4S66L.js +0 -47
  862. package/dist/commands/chunk-5UJGACVN.js +0 -137
  863. package/dist/commands/chunk-5Y7B7FDL.js +0 -44
  864. package/dist/commands/chunk-5Z6E5ZUV.js +0 -89
  865. package/dist/commands/chunk-5ZNUH4LV.js +0 -1722
  866. package/dist/commands/chunk-5ZTQX7OS.js +0 -125
  867. package/dist/commands/chunk-66NX6EXR.js +0 -29
  868. package/dist/commands/chunk-66TGK5XL.js +0 -84
  869. package/dist/commands/chunk-6CFHLMKM.js +0 -555
  870. package/dist/commands/chunk-6DDK5XWK.js +0 -74
  871. package/dist/commands/chunk-6GQX752S.js +0 -145
  872. package/dist/commands/chunk-6HRRZANN.js +0 -55
  873. package/dist/commands/chunk-6MAZ55GF.js +0 -1241
  874. package/dist/commands/chunk-6OP63TBT.js +0 -78
  875. package/dist/commands/chunk-6Q3XUCLM.js +0 -204
  876. package/dist/commands/chunk-6RUWU2SB.js +0 -45
  877. package/dist/commands/chunk-6UCWAFQY.js +0 -245
  878. package/dist/commands/chunk-6WKJ3GDA.js +0 -408
  879. package/dist/commands/chunk-6YURRFRU.js +0 -461
  880. package/dist/commands/chunk-6YVURZAJ.js +0 -350
  881. package/dist/commands/chunk-6Z4YZG7P.js +0 -169
  882. package/dist/commands/chunk-77BIN247.js +0 -122
  883. package/dist/commands/chunk-7ABHNNY3.js +0 -529
  884. package/dist/commands/chunk-7C7FOKJK.js +0 -115
  885. package/dist/commands/chunk-7HAGC6SW.js +0 -1062
  886. package/dist/commands/chunk-7KKUFLH5.js +0 -56
  887. package/dist/commands/chunk-7LJQMM2K.js +0 -102
  888. package/dist/commands/chunk-7MJYLUF4.js +0 -99
  889. package/dist/commands/chunk-7NHZCI5Y.js +0 -704
  890. package/dist/commands/chunk-7OQ56DVW.js +0 -239
  891. package/dist/commands/chunk-7VWPGTZO.js +0 -260
  892. package/dist/commands/chunk-7YZXS3AK.js +0 -30
  893. package/dist/commands/chunk-A4HOQKOG.js +0 -85
  894. package/dist/commands/chunk-A6T2N7VC.js +0 -159
  895. package/dist/commands/chunk-AAUDI7WJ.js +0 -250
  896. package/dist/commands/chunk-AC26ZUG5.js +0 -259
  897. package/dist/commands/chunk-ACZ52JPI.js +0 -140
  898. package/dist/commands/chunk-AJ65WNJB.js +0 -230
  899. package/dist/commands/chunk-AK7SEO4Y.js +0 -177
  900. package/dist/commands/chunk-AKK56GNX.js +0 -205
  901. package/dist/commands/chunk-AKQYYHP2.js +0 -461
  902. package/dist/commands/chunk-ALDAS2WG.js +0 -137
  903. package/dist/commands/chunk-ANUTT56I.js +0 -85
  904. package/dist/commands/chunk-AVVMDVGO.js +0 -68
  905. package/dist/commands/chunk-B3M5WSGN.js +0 -72
  906. package/dist/commands/chunk-B7ZNIEDV.js +0 -351
  907. package/dist/commands/chunk-BCUDQWYK.js +0 -77
  908. package/dist/commands/chunk-BF6YX4HE.js +0 -70
  909. package/dist/commands/chunk-BHRS7HAM.js +0 -272
  910. package/dist/commands/chunk-BIKGPT52.js +0 -29
  911. package/dist/commands/chunk-BJA5U4Q7.js +0 -75
  912. package/dist/commands/chunk-BMKWSWWE.js +0 -126
  913. package/dist/commands/chunk-BMTYUJNT.js +0 -59
  914. package/dist/commands/chunk-BRHPRDDV.js +0 -127
  915. package/dist/commands/chunk-BRUBX64M.js +0 -33
  916. package/dist/commands/chunk-BTZJDHQT.js +0 -46
  917. package/dist/commands/chunk-BYFC6MD2.js +0 -72
  918. package/dist/commands/chunk-BYGJ3BCJ.js +0 -803
  919. package/dist/commands/chunk-C2SEDMZ3.js +0 -238
  920. package/dist/commands/chunk-C54QXJD6.js +0 -4208
  921. package/dist/commands/chunk-C6QSVO5K.js +0 -56
  922. package/dist/commands/chunk-CBAKBWSZ.js +0 -332
  923. package/dist/commands/chunk-CFHRNTE5.js +0 -326
  924. package/dist/commands/chunk-CGLLAEKZ.js +0 -110
  925. package/dist/commands/chunk-CHKYPF5O.js +0 -82
  926. package/dist/commands/chunk-CJBW6BWG.js +0 -800
  927. package/dist/commands/chunk-CJKPF5DJ.js +0 -156
  928. package/dist/commands/chunk-CKUKK7JG.js +0 -252
  929. package/dist/commands/chunk-CMHGDCGN.js +0 -263
  930. package/dist/commands/chunk-CNGTHSUS.js +0 -750
  931. package/dist/commands/chunk-CP2J4RV2.js +0 -3987
  932. package/dist/commands/chunk-CQZI7RIK.js +0 -72
  933. package/dist/commands/chunk-CWCKCZS6.js +0 -188
  934. package/dist/commands/chunk-D5HIP4HT.js +0 -289
  935. package/dist/commands/chunk-D6D6WQR6.js +0 -125
  936. package/dist/commands/chunk-D7JRJI44.js +0 -297
  937. package/dist/commands/chunk-D7OAU32Z.js +0 -119
  938. package/dist/commands/chunk-DAAX7XDS.js +0 -1208
  939. package/dist/commands/chunk-DBKTFB5V.js +0 -18
  940. package/dist/commands/chunk-DEZF7QZZ.js +0 -184
  941. package/dist/commands/chunk-DMD74E3F.js +0 -39
  942. package/dist/commands/chunk-DPJVKTO4.js +0 -41
  943. package/dist/commands/chunk-DXJQHJQ4.js +0 -73
  944. package/dist/commands/chunk-DYZOOWVW.js +0 -912
  945. package/dist/commands/chunk-EBI2BAKQ.js +0 -47
  946. package/dist/commands/chunk-EDKOSZ3K.js +0 -88
  947. package/dist/commands/chunk-EFDVE5P5.js +0 -121
  948. package/dist/commands/chunk-EGIHAEMT.js +0 -72
  949. package/dist/commands/chunk-EKLU6QR7.js +0 -507
  950. package/dist/commands/chunk-ELY76WAR.js +0 -65
  951. package/dist/commands/chunk-EM3HAZF6.js +0 -52
  952. package/dist/commands/chunk-EMTZAGT5.js +0 -51
  953. package/dist/commands/chunk-ENKFCOVY.js +0 -472
  954. package/dist/commands/chunk-ERG4QRNG.js +0 -224
  955. package/dist/commands/chunk-EUGNQCYK.js +0 -139
  956. package/dist/commands/chunk-EW4NPUMQ.js +0 -363
  957. package/dist/commands/chunk-EWVR5AEX.js +0 -140
  958. package/dist/commands/chunk-EXDFKKMH.js +0 -113
  959. package/dist/commands/chunk-EXWB34R2.js +0 -238
  960. package/dist/commands/chunk-EYMPBHDN.js +0 -61
  961. package/dist/commands/chunk-EZ7IPKIH.js +0 -20
  962. package/dist/commands/chunk-EZSO25UZ.js +0 -80
  963. package/dist/commands/chunk-F6IQHZYY.js +0 -94
  964. package/dist/commands/chunk-FDS65XOJ.js +0 -212
  965. package/dist/commands/chunk-FFHEGWPK.js +0 -91
  966. package/dist/commands/chunk-FGL6DBZU.js +0 -71
  967. package/dist/commands/chunk-FHFWNNUC.js +0 -144
  968. package/dist/commands/chunk-FIUCHMCF.js +0 -32
  969. package/dist/commands/chunk-FJX7AENO.js +0 -74
  970. package/dist/commands/chunk-FKZ5E4JD.js +0 -97
  971. package/dist/commands/chunk-FMZWRDKH.js +0 -302
  972. package/dist/commands/chunk-FOKCRIAN.js +0 -67
  973. package/dist/commands/chunk-FQGWO2ZH.js +0 -43
  974. package/dist/commands/chunk-FROACLVU.js +0 -525
  975. package/dist/commands/chunk-FURNDIT3.js +0 -34
  976. package/dist/commands/chunk-FVDQNMP6.js +0 -93
  977. package/dist/commands/chunk-FVVZIJUC.js +0 -425
  978. package/dist/commands/chunk-FWU3H4TX.js +0 -17
  979. package/dist/commands/chunk-G3HBYHFA.js +0 -16
  980. package/dist/commands/chunk-G4E4M2P4.js +0 -299
  981. package/dist/commands/chunk-G5KSL2Q2.js +0 -151
  982. package/dist/commands/chunk-G6XC7V6Y.js +0 -58
  983. package/dist/commands/chunk-GCPP5XIG.js +0 -90
  984. package/dist/commands/chunk-GITT5A5A.js +0 -198
  985. package/dist/commands/chunk-GJYMI2CM.js +0 -48
  986. package/dist/commands/chunk-GLC47H7I.js +0 -285
  987. package/dist/commands/chunk-GUR54ELE.js +0 -328
  988. package/dist/commands/chunk-GW4UWR3O.js +0 -126
  989. package/dist/commands/chunk-GY4DMCKS.js +0 -306
  990. package/dist/commands/chunk-H6JQRHDC.js +0 -80
  991. package/dist/commands/chunk-HATKF6VX.js +0 -173
  992. package/dist/commands/chunk-HG2NZQD5.js +0 -135
  993. package/dist/commands/chunk-HH3CVIFU.js +0 -93
  994. package/dist/commands/chunk-HHMMGDMP.js +0 -469
  995. package/dist/commands/chunk-HI5WPM6C.js +0 -127
  996. package/dist/commands/chunk-HQGNXR6I.js +0 -245
  997. package/dist/commands/chunk-HTIDHEEN.js +0 -108
  998. package/dist/commands/chunk-HVCQYZVD.js +0 -38
  999. package/dist/commands/chunk-HWEZRNPL.js +0 -66
  1000. package/dist/commands/chunk-HX3FFIO5.js +0 -74
  1001. package/dist/commands/chunk-HXDTA5VU.js +0 -208
  1002. package/dist/commands/chunk-I2KCGKJI.js +0 -107
  1003. package/dist/commands/chunk-I63RNFFR.js +0 -213
  1004. package/dist/commands/chunk-IAD4WLLI.js +0 -98
  1005. package/dist/commands/chunk-IB5TT73I.js +0 -177
  1006. package/dist/commands/chunk-IBAYXCMU.js +0 -156
  1007. package/dist/commands/chunk-IGDJNXX2.js +0 -49
  1008. package/dist/commands/chunk-ILGPZ47M.js +0 -33
  1009. package/dist/commands/chunk-IYJEBWW5.js +0 -44
  1010. package/dist/commands/chunk-J22PSIXR.js +0 -418
  1011. package/dist/commands/chunk-J66YBAAM.js +0 -161
  1012. package/dist/commands/chunk-J6WKZRV2.js +0 -391
  1013. package/dist/commands/chunk-J7IO3AYH.js +0 -179
  1014. package/dist/commands/chunk-JAKC2BHX.js +0 -88
  1015. package/dist/commands/chunk-JCAQ7B6J.js +0 -124
  1016. package/dist/commands/chunk-JHN6RCE6.js +0 -123
  1017. package/dist/commands/chunk-JIGBNCDR.js +0 -88
  1018. package/dist/commands/chunk-JJHWTFWQ.js +0 -76
  1019. package/dist/commands/chunk-JJRKTWLK.js +0 -64
  1020. package/dist/commands/chunk-JKOGWGQM.js +0 -92
  1021. package/dist/commands/chunk-JM6EVOFN.js +0 -172
  1022. package/dist/commands/chunk-JQXPLMCO.js +0 -81
  1023. package/dist/commands/chunk-JV24VP2O.js +0 -81
  1024. package/dist/commands/chunk-JVKXJ763.js +0 -45
  1025. package/dist/commands/chunk-K275REYP.js +0 -37
  1026. package/dist/commands/chunk-K4G3HOKS.js +0 -105
  1027. package/dist/commands/chunk-K64EIHD2.js +0 -138
  1028. package/dist/commands/chunk-KB3OQWDT.js +0 -71
  1029. package/dist/commands/chunk-KCFOP5RI.js +0 -1310
  1030. package/dist/commands/chunk-KGE4AS2Y.js +0 -134
  1031. package/dist/commands/chunk-KIILCKQR.js +0 -220
  1032. package/dist/commands/chunk-KK2SL42W.js +0 -241
  1033. package/dist/commands/chunk-KKIMVXAP.js +0 -280
  1034. package/dist/commands/chunk-KODXWMBX.js +0 -77
  1035. package/dist/commands/chunk-KPSKWTOS.js +0 -208
  1036. package/dist/commands/chunk-KVHNQHX3.js +0 -100
  1037. package/dist/commands/chunk-KWYQR5MK.js +0 -269
  1038. package/dist/commands/chunk-KXHXMERX.js +0 -214
  1039. package/dist/commands/chunk-KZ5BBBMO.js +0 -271
  1040. package/dist/commands/chunk-KZ7HD37E.js +0 -121
  1041. package/dist/commands/chunk-KZSM5M5P.js +0 -89
  1042. package/dist/commands/chunk-KZZWPUJW.js +0 -25
  1043. package/dist/commands/chunk-L7DAL54N.js +0 -347
  1044. package/dist/commands/chunk-LAR76BFA.js +0 -114
  1045. package/dist/commands/chunk-LB557AHJ.js +0 -192
  1046. package/dist/commands/chunk-LJXKVLYI.js +0 -229
  1047. package/dist/commands/chunk-LOOFYHUM.js +0 -773
  1048. package/dist/commands/chunk-LQXFVZTS.js +0 -13
  1049. package/dist/commands/chunk-LT7QSHR4.js +0 -995
  1050. package/dist/commands/chunk-LUXWDMKI.js +0 -426
  1051. package/dist/commands/chunk-LWAXXZPS.js +0 -118
  1052. package/dist/commands/chunk-LX7TIEMI.js +0 -1612
  1053. package/dist/commands/chunk-LZ5QXE5N.js +0 -244
  1054. package/dist/commands/chunk-LZPPSOTP.js +0 -122
  1055. package/dist/commands/chunk-M4UV3BEV.js +0 -313
  1056. package/dist/commands/chunk-M6JDU5EK.js +0 -133
  1057. package/dist/commands/chunk-MDLOETXL.js +0 -211
  1058. package/dist/commands/chunk-MFBNNTBM.js +0 -44
  1059. package/dist/commands/chunk-MGF64OHV.js +0 -32
  1060. package/dist/commands/chunk-MI2OS6TL.js +0 -132
  1061. package/dist/commands/chunk-MLW4S35K.js +0 -389
  1062. package/dist/commands/chunk-MN425CU6.js +0 -63
  1063. package/dist/commands/chunk-MPGJ4ONJ.js +0 -634
  1064. package/dist/commands/chunk-MRORPFSO.js +0 -402
  1065. package/dist/commands/chunk-MUGTOJUL.js +0 -319
  1066. package/dist/commands/chunk-MVHPRYHE.js +0 -91
  1067. package/dist/commands/chunk-MWO6FOSZ.js +0 -393
  1068. package/dist/commands/chunk-MXC4IBZ7.js +0 -104
  1069. package/dist/commands/chunk-N7QTMTST.js +0 -210
  1070. package/dist/commands/chunk-NDBX7LSS.js +0 -32
  1071. package/dist/commands/chunk-NEGJ77RV.js +0 -173
  1072. package/dist/commands/chunk-NEGRE5VW.js +0 -101
  1073. package/dist/commands/chunk-NFPD2P3V.js +0 -53
  1074. package/dist/commands/chunk-NHIW7JE6.js +0 -335
  1075. package/dist/commands/chunk-NILSN7A4.js +0 -158
  1076. package/dist/commands/chunk-NOLFSPOB.js +0 -74
  1077. package/dist/commands/chunk-NSAVEXVR.js +0 -353
  1078. package/dist/commands/chunk-NT67QTZO.js +0 -65
  1079. package/dist/commands/chunk-NU7W6QGT.js +0 -155
  1080. package/dist/commands/chunk-NYWGJLBU.js +0 -19
  1081. package/dist/commands/chunk-OAAVY2JK.js +0 -49
  1082. package/dist/commands/chunk-OGS2DK7I.js +0 -47
  1083. package/dist/commands/chunk-OHNP3QL2.js +0 -186
  1084. package/dist/commands/chunk-OIPV3PWW.js +0 -870
  1085. package/dist/commands/chunk-OIX2363L.js +0 -16
  1086. package/dist/commands/chunk-OJ65BZBV.js +0 -646
  1087. package/dist/commands/chunk-OKZWEVR4.js +0 -352
  1088. package/dist/commands/chunk-OL6IF4JC.js +0 -20
  1089. package/dist/commands/chunk-OMPRILFH.js +0 -29
  1090. package/dist/commands/chunk-OOWGH2RG.js +0 -85
  1091. package/dist/commands/chunk-OP2RFVLS.js +0 -102
  1092. package/dist/commands/chunk-ORKVN2LO.js +0 -56
  1093. package/dist/commands/chunk-OSBWXZJ4.js +0 -492
  1094. package/dist/commands/chunk-OT3UMEWK.js +0 -47
  1095. package/dist/commands/chunk-OVWPZDWP.js +0 -64
  1096. package/dist/commands/chunk-OWYK2BEJ.js +0 -1222
  1097. package/dist/commands/chunk-OX3VQLV2.js +0 -488
  1098. package/dist/commands/chunk-OZJP77UM.js +0 -103
  1099. package/dist/commands/chunk-OZZWRJQI.js +0 -246
  1100. package/dist/commands/chunk-P3H3DKTE.js +0 -69
  1101. package/dist/commands/chunk-P4D5RESF.js +0 -88
  1102. package/dist/commands/chunk-P4KIQRSL.js +0 -119
  1103. package/dist/commands/chunk-P5SOYWH2.js +0 -37
  1104. package/dist/commands/chunk-P7FPXAHP.js +0 -29
  1105. package/dist/commands/chunk-PE7B7242.js +0 -84
  1106. package/dist/commands/chunk-PFO7EYAP.js +0 -45
  1107. package/dist/commands/chunk-PHLOTUB7.js +0 -366
  1108. package/dist/commands/chunk-PTNQCCIB.js +0 -41
  1109. package/dist/commands/chunk-PTZEFQUX.js +0 -211
  1110. package/dist/commands/chunk-Q5Q2QYVU.js +0 -112
  1111. package/dist/commands/chunk-Q7EEIOAD.js +0 -120
  1112. package/dist/commands/chunk-QABRNGQV.js +0 -88
  1113. package/dist/commands/chunk-QAHFPCFR.js +0 -50
  1114. package/dist/commands/chunk-QDFVVRQP.js +0 -92
  1115. package/dist/commands/chunk-QGAERR7D.js +0 -99
  1116. package/dist/commands/chunk-QHWJJ6X5.js +0 -53
  1117. package/dist/commands/chunk-QJRVDE7T.js +0 -307
  1118. package/dist/commands/chunk-QMDKDQKW.js +0 -114
  1119. package/dist/commands/chunk-QOSC5RKD.js +0 -18
  1120. package/dist/commands/chunk-QQ4CIYMF.js +0 -132
  1121. package/dist/commands/chunk-QV5FKMOU.js +0 -80
  1122. package/dist/commands/chunk-QWWTC3XR.js +0 -109
  1123. package/dist/commands/chunk-QXQ56E56.js +0 -27
  1124. package/dist/commands/chunk-R54Z2Z3X.js +0 -114
  1125. package/dist/commands/chunk-R6QE5VJG.js +0 -46
  1126. package/dist/commands/chunk-RG53UFNW.js +0 -418
  1127. package/dist/commands/chunk-RGGEQM6G.js +0 -140
  1128. package/dist/commands/chunk-RH6ZWJOA.js +0 -77
  1129. package/dist/commands/chunk-RHKCWJQX.js +0 -62
  1130. package/dist/commands/chunk-RKIAX4DZ.js +0 -191
  1131. package/dist/commands/chunk-RLBFEHHC.js +0 -300
  1132. package/dist/commands/chunk-RN2YDNLF.js +0 -229
  1133. package/dist/commands/chunk-RRAIRS2T.js +0 -54
  1134. package/dist/commands/chunk-RS764ZMU.js +0 -46
  1135. package/dist/commands/chunk-RUIBQMOV.js +0 -38
  1136. package/dist/commands/chunk-RUQY5TS3.js +0 -83
  1137. package/dist/commands/chunk-RVUJ6F5L.js +0 -181
  1138. package/dist/commands/chunk-RW64VHEB.js +0 -130
  1139. package/dist/commands/chunk-RXYMJPJB.js +0 -114
  1140. package/dist/commands/chunk-S4M6UWR2.js +0 -103
  1141. package/dist/commands/chunk-SASX3W2M.js +0 -99
  1142. package/dist/commands/chunk-SFNBUB6D.js +0 -110
  1143. package/dist/commands/chunk-SJ2ZN575.js +0 -90
  1144. package/dist/commands/chunk-SP7DKYGU.js +0 -1263
  1145. package/dist/commands/chunk-SSL6A3Y4.js +0 -165
  1146. package/dist/commands/chunk-SVAKCXZ7.js +0 -44
  1147. package/dist/commands/chunk-SYOXIKB7.js +0 -705
  1148. package/dist/commands/chunk-SZG5HDNP.js +0 -321
  1149. package/dist/commands/chunk-T25S4QHL.js +0 -52
  1150. package/dist/commands/chunk-T4F33UKZ.js +0 -114
  1151. package/dist/commands/chunk-T4UYEHWG.js +0 -50
  1152. package/dist/commands/chunk-TAEGXID2.js +0 -58
  1153. package/dist/commands/chunk-TCBUX52E.js +0 -701
  1154. package/dist/commands/chunk-TEPYEUYG.js +0 -585
  1155. package/dist/commands/chunk-TFLHYC2F.js +0 -141
  1156. package/dist/commands/chunk-TJKM56WJ.js +0 -109
  1157. package/dist/commands/chunk-TLAB552K.js +0 -445
  1158. package/dist/commands/chunk-TP6L4W3W.js +0 -82
  1159. package/dist/commands/chunk-TR7WWYD5.js +0 -60
  1160. package/dist/commands/chunk-TVZXG4Y4.js +0 -197
  1161. package/dist/commands/chunk-TYNH2R66.js +0 -1150
  1162. package/dist/commands/chunk-U3IVVR4W.js +0 -33
  1163. package/dist/commands/chunk-U5P6G3UV.js +0 -77
  1164. package/dist/commands/chunk-U7XU5RG3.js +0 -86
  1165. package/dist/commands/chunk-UKBBWMLE.js +0 -1189
  1166. package/dist/commands/chunk-ULVVGGTY.js +0 -64
  1167. package/dist/commands/chunk-UNMSZGSG.js +0 -269
  1168. package/dist/commands/chunk-URDT2O2K.js +0 -36
  1169. package/dist/commands/chunk-UTHUX7VU.js +0 -88
  1170. package/dist/commands/chunk-V4Z7G4UH.js +0 -73
  1171. package/dist/commands/chunk-V5FD7DVV.js +0 -48
  1172. package/dist/commands/chunk-VCPGFBMN.js +0 -655
  1173. package/dist/commands/chunk-VGPIQNDB.js +0 -24
  1174. package/dist/commands/chunk-VJE3RJAX.js +0 -23
  1175. package/dist/commands/chunk-VK6D5CWA.js +0 -161
  1176. package/dist/commands/chunk-VOF3N4WO.js +0 -114
  1177. package/dist/commands/chunk-VQVPAVQ3.js +0 -45
  1178. package/dist/commands/chunk-VV4TQYGD.js +0 -38
  1179. package/dist/commands/chunk-W3FX7FYN.js +0 -84
  1180. package/dist/commands/chunk-W7DRUOF7.js +0 -122
  1181. package/dist/commands/chunk-WAEN2RTT.js +0 -161
  1182. package/dist/commands/chunk-WCEUMOKK.js +0 -84
  1183. package/dist/commands/chunk-WJ4NEDNI.js +0 -288
  1184. package/dist/commands/chunk-WMMGXJXP.js +0 -92
  1185. package/dist/commands/chunk-WOFLW2LX.js +0 -26
  1186. package/dist/commands/chunk-WTH6NTXU.js +0 -128
  1187. package/dist/commands/chunk-WWVYEHQT.js +0 -272
  1188. package/dist/commands/chunk-X3TNPALI.js +0 -213
  1189. package/dist/commands/chunk-XC6GG5JR.js +0 -78
  1190. package/dist/commands/chunk-XDF25GSU.js +0 -536
  1191. package/dist/commands/chunk-XFPEUYDV.js +0 -67
  1192. package/dist/commands/chunk-XFWI6WHH.js +0 -60
  1193. package/dist/commands/chunk-XGMRAKSL.js +0 -85
  1194. package/dist/commands/chunk-XHGWMD3L.js +0 -104
  1195. package/dist/commands/chunk-XKSUBUIH.js +0 -116
  1196. package/dist/commands/chunk-XPBF5DG3.js +0 -419
  1197. package/dist/commands/chunk-XUMYPESL.js +0 -160
  1198. package/dist/commands/chunk-XXC32PVL.js +0 -541
  1199. package/dist/commands/chunk-XXN2EZBY.js +0 -133
  1200. package/dist/commands/chunk-XXNEY4B3.js +0 -110
  1201. package/dist/commands/chunk-Y27PTXXI.js +0 -258
  1202. package/dist/commands/chunk-Y4EBUI6M.js +0 -237
  1203. package/dist/commands/chunk-YAU3LYNF.js +0 -60
  1204. package/dist/commands/chunk-YDURQICF.js +0 -204
  1205. package/dist/commands/chunk-YGFOGA7C.js +0 -1153
  1206. package/dist/commands/chunk-YHJ2AJMA.js +0 -66
  1207. package/dist/commands/chunk-YIA6FC3K.js +0 -78
  1208. package/dist/commands/chunk-YM77CF4D.js +0 -183
  1209. package/dist/commands/chunk-YNPRJCEO.js +0 -81
  1210. package/dist/commands/chunk-YTBQAD5W.js +0 -170
  1211. package/dist/commands/chunk-YVH2OLDS.js +0 -104
  1212. package/dist/commands/chunk-ZAAHZY2A.js +0 -19
  1213. package/dist/commands/chunk-ZBZ5DDCH.js +0 -1866
  1214. package/dist/commands/chunk-ZLRUHSOP.js +0 -48
  1215. package/dist/commands/chunk-ZNR75OXP.js +0 -444
  1216. package/dist/commands/chunk-ZSOR4ISJ.js +0 -75
  1217. package/dist/commands/chunk-ZVAIIHBE.js +0 -63
  1218. package/dist/commands/chunk-ZYFHYQA7.js +0 -51
  1219. package/dist/commands/chunk-ZZFFSQF4.js +0 -218
  1220. package/dist/commands/chunk-ZZULXNC2.js +0 -47
  1221. package/dist/commands/chunk-ZZXO6TFH.js +0 -232
  1222. package/dist/commands/run-ship-lap-W5T2VHFC.js +0 -30
  1223. package/dist/commands/test-related-ZCNC46MS.js +0 -113
  1224. package/dist/commands/unused-members-STULPRBU.js +0 -331
  1225. package/dist/hooks/chunk-5CUXGQT6.js +0 -8353
  1226. package/dist/hooks/chunk-5R5YFQR5.js +0 -931
  1227. package/dist/hooks/chunk-6RLY27FT.js +0 -232
  1228. package/dist/hooks/chunk-6YGMIODI.js +0 -86
  1229. package/dist/hooks/chunk-AO4TOV4V.js +0 -5026
  1230. package/dist/hooks/chunk-FOW4B7OQ.js +0 -1795
  1231. package/dist/hooks/chunk-G5WSPYJ6.js +0 -5663
  1232. package/dist/hooks/chunk-HHIVWGHX.js +0 -6869
  1233. package/dist/hooks/chunk-IURJANNZ.js +0 -1082
  1234. package/dist/hooks/chunk-OV22V63P.js +0 -10980
  1235. package/dist/hooks/chunk-SXABK6UV.js +0 -321
  1236. package/dist/hooks/run-ship-lap-VCEOUHQI.js +0 -8
@@ -69,13 +69,13 @@ import path3 from "node:path";
69
69
  import path from "node:path";
70
70
  var MAX_DEPTH = 64;
71
71
  function list(start_directory) {
72
- const directories = [];
72
+ const directories2 = [];
73
73
  let current = path.resolve(start_directory);
74
- while (directories.length < MAX_DEPTH && !directories.includes(current)) {
75
- directories.push(current);
74
+ while (directories2.length < MAX_DEPTH && !directories2.includes(current)) {
75
+ directories2.push(current);
76
76
  current = path.dirname(current);
77
77
  }
78
- return directories;
78
+ return directories2;
79
79
  }
80
80
  function nearest(start_directory, is_match) {
81
81
  return list(start_directory).find((directory) => is_match(directory));
@@ -116,20 +116,20 @@ var ABSENT_CODE = "ENOENT";
116
116
  function is_absent(error) {
117
117
  return error instanceof Error && "code" in error && error.code === ABSENT_CODE;
118
118
  }
119
- function read_optional(path7) {
119
+ function read_optional(path22) {
120
120
  try {
121
- return readFileSync(path7, "utf8");
121
+ return readFileSync(path22, "utf8");
122
122
  } catch (error) {
123
123
  if (is_absent(error)) return void 0;
124
124
  throw error;
125
125
  }
126
126
  }
127
- function read_file_or_empty(path7) {
128
- return read_optional(path7) ?? "";
127
+ function read_file_or_empty(path22) {
128
+ return read_optional(path22) ?? "";
129
129
  }
130
- function read_if_readable(path7) {
130
+ function read_if_readable(path22) {
131
131
  try {
132
- return readFileSync(path7, "utf8");
132
+ return readFileSync(path22, "utf8");
133
133
  } catch {
134
134
  return void 0;
135
135
  }
@@ -267,12 +267,15 @@ function resolve_effective_upstream_version(base_url, package_name, options = {}
267
267
  var MS_PER_SECOND = 1e3;
268
268
  var SECONDS_PER_MINUTE = 60;
269
269
  var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
270
+ var PROBE_TIMEOUT_MS = 2e3;
270
271
  var FETCH_TIMEOUT_MS = 1e4;
272
+ var GIT_TIMEOUT_MS = 1e4;
271
273
  var COMMAND_TIMEOUT_MS = 3e4;
272
274
  var INSTALL_TIMEOUT_MS = 6e5;
275
+ var SUITE_TIMEOUT_MS = 18e5;
273
276
 
274
277
  // scripts/version/version-commands.ts
275
- import { execaSync as execaSync4 } from "execa";
278
+ import { execaSync as execaSync5 } from "execa";
276
279
 
277
280
  // scripts/version/release-age.ts
278
281
  import { readFileSync as readFileSync3 } from "node:fs";
@@ -460,21 +463,1169 @@ function is_no_op_upgrade_command(command, installed) {
460
463
  return pins.every((pin) => installed.get(pin.name) === pin.version);
461
464
  }
462
465
 
466
+ // scripts/version/upgrade-shell-command.ts
467
+ import path10 from "node:path";
468
+
469
+ // scripts/init/init-paths.ts
470
+ import path6 from "node:path";
471
+ import { fileURLToPath } from "node:url";
472
+ var PACKAGE_DIR = path6.join(path6.dirname(fileURLToPath(import.meta.url)), "..", "..");
473
+ var PROJECT_ROOT = process.cwd();
474
+
475
+ // scripts/lib/shell-quote.ts
476
+ var QUOTE = "'";
477
+ var ESCAPED_QUOTE = String.raw`'\''`;
478
+ function single_quoted(text) {
479
+ return QUOTE + text.split(QUOTE).join(ESCAPED_QUOTE) + QUOTE;
480
+ }
481
+ var BARE_WORD = /^[\w%+,./:=@-]+$/u;
482
+ function word(token) {
483
+ return BARE_WORD.test(token) ? token : single_quoted(token);
484
+ }
485
+ var shell_quote = { single_quoted, word };
486
+
487
+ // scripts/registry-migration/npm-acquisition.ts
488
+ import path9 from "node:path";
489
+
490
+ // scripts/config-merge/parse-jsonc.ts
491
+ import { parseTree, printParseErrorCode } from "jsonc-parser";
492
+ function property_key(property) {
493
+ return String(property.children?.[0]?.value);
494
+ }
495
+ function node_value(node) {
496
+ if (node === void 0) return void 0;
497
+ const children = node.children ?? [];
498
+ if (node.type === "array") return children.map((child) => node_value(child));
499
+ if (node.type !== "object") return node.value;
500
+ return Object.fromEntries(
501
+ children.map((property) => [property_key(property), node_value(property.children?.[1])])
502
+ );
503
+ }
504
+ function parse_jsonc(content) {
505
+ const errors = [];
506
+ const tree = parseTree(content, errors, { allowTrailingComma: true });
507
+ const [first_error] = errors;
508
+ if (first_error !== void 0) {
509
+ throw new SyntaxError(
510
+ `Invalid JSONC: ${printParseErrorCode(first_error.error)} at offset ${String(first_error.offset)}`
511
+ );
512
+ }
513
+ return json_object_schema.parse(node_value(tree));
514
+ }
515
+
516
+ // scripts/gh/fix-gh-packages-logic.ts
517
+ import { loadAll as loadAll2 } from "js-yaml";
518
+ import { z as z4 } from "zod";
519
+ var GH_PACKAGES_HOST = "npm.pkg.github.com";
520
+ var RESOLUTION_BLOCK = "\n resolution:\n";
521
+ var INTEGRITY_PREFIX = " integrity: ";
522
+ var TARBALL_PREFIX = " tarball: ";
523
+ var FLOW_RESOLUTION_LINE_START = "\n resolution: {";
524
+ var FLOW_TARBALL_KEY = ", tarball: ";
525
+ var NPMRC_AUTH_TOKEN_PREFIX = `//${GH_PACKAGES_HOST}/:_authToken=`;
526
+ var REGISTRY_KEY = ":registry";
527
+ var lockfile_resolution_schema = z4.looseObject({
528
+ integrity: z4.string().optional(),
529
+ tarball: z4.string().optional()
530
+ });
531
+ var lockfile_package_schema = z4.looseObject({
532
+ resolution: lockfile_resolution_schema.optional()
533
+ });
534
+ var lockfile_document_schema = z4.looseObject({
535
+ packages: z4.record(z4.string(), lockfile_package_schema).optional()
536
+ });
537
+ function parse_lockfile_packages(raw) {
538
+ const merged = {};
539
+ for (const document of loadAll2(raw)) {
540
+ const { packages } = lockfile_document_schema.parse(document);
541
+ if (packages !== void 0) Object.assign(merged, packages);
542
+ }
543
+ return merged;
544
+ }
545
+ function registry_entry(line) {
546
+ const trimmed2 = line.trim();
547
+ if (!trimmed2.startsWith("@")) return void 0;
548
+ const eq_index = trimmed2.indexOf("=");
549
+ const key = trimmed2.slice(0, eq_index).trim();
550
+ if (eq_index === -1 || !key.endsWith(REGISTRY_KEY)) return void 0;
551
+ return [key.slice(0, -REGISTRY_KEY.length), trimmed2.slice(eq_index + 1).trim()];
552
+ }
553
+ function parse_scope_registries(npmrc2) {
554
+ const registries = /* @__PURE__ */ new Map();
555
+ for (const line of npmrc2.split("\n")) {
556
+ const entry2 = registry_entry(line);
557
+ if (entry2 !== void 0) registries.set(...entry2);
558
+ }
559
+ return registries;
560
+ }
561
+ function parse_gh_scopes(npmrc2) {
562
+ const entries = [...parse_scope_registries(npmrc2)];
563
+ return new Set(
564
+ entries.filter(([, registry]) => registry.replace(/\/$/u, "") === `https://${GH_PACKAGES_HOST}`).map(([scope2]) => scope2)
565
+ );
566
+ }
567
+ function extract_auth_token_from_line(line) {
568
+ const trimmed2 = line.trim();
569
+ if (!trimmed2.startsWith(NPMRC_AUTH_TOKEN_PREFIX)) return void 0;
570
+ const value = trimmed2.slice(NPMRC_AUTH_TOKEN_PREFIX.length);
571
+ if (value.startsWith("${") || value.length === 0) return void 0;
572
+ return value;
573
+ }
574
+ function parse_npmrc_auth_token(npmrc2) {
575
+ for (const line of npmrc2.split("\n")) {
576
+ const token = extract_auth_token_from_line(line);
577
+ if (token !== void 0) return token;
578
+ }
579
+ return void 0;
580
+ }
581
+ function scope_from_key(key) {
582
+ return key.startsWith("@") ? key.split("/", 1)[0] ?? "" : "";
583
+ }
584
+ function has_tarball(entry2) {
585
+ return entry2.resolution?.tarball !== void 0;
586
+ }
587
+ function package_path_from_key(key) {
588
+ const start = key.startsWith("@") ? 1 : 0;
589
+ const at_index = key.indexOf("@", start);
590
+ return at_index === -1 ? key : key.slice(0, at_index);
591
+ }
592
+ function package_version_from_key(key) {
593
+ const start = key.startsWith("@") ? 1 : 0;
594
+ const at_index = key.indexOf("@", start);
595
+ if (at_index === -1) return "";
596
+ return key.slice(at_index + 1).split("(", 1)[0] ?? "";
597
+ }
598
+ function should_fix_tarball(key, entry2, scopes) {
599
+ if (has_tarball(entry2)) return false;
600
+ const scope2 = scope_from_key(key);
601
+ return scope2.length > 0 && scopes.has(scope2);
602
+ }
603
+ function find_entry_start(content, package_key) {
604
+ const single = content.indexOf(`
605
+ '${package_key}':
606
+ `);
607
+ if (single !== -1) return single;
608
+ return content.indexOf(`
609
+ "${package_key}":
610
+ `);
611
+ }
612
+ function find_entry_end(content, entry_start) {
613
+ const next_match = /\n {2}['"]/u.exec(content.slice(entry_start + 1));
614
+ return next_match === null ? content.length : entry_start + 1 + next_match.index;
615
+ }
616
+ function find_integrity_eol_in_entry(entry_content) {
617
+ const resolution_pos = entry_content.indexOf(RESOLUTION_BLOCK);
618
+ if (resolution_pos === -1) return -1;
619
+ const integrity_pos = entry_content.indexOf(INTEGRITY_PREFIX, resolution_pos);
620
+ if (integrity_pos === -1) return -1;
621
+ return entry_content.indexOf("\n", integrity_pos);
622
+ }
623
+ function find_flow_resolution_brace(entry_content) {
624
+ const pos = entry_content.indexOf(FLOW_RESOLUTION_LINE_START);
625
+ if (pos === -1) return -1;
626
+ const line_end2 = entry_content.indexOf("\n", pos + 1);
627
+ const search_end = line_end2 === -1 ? entry_content.length : line_end2;
628
+ const brace = entry_content.lastIndexOf("}", search_end);
629
+ if (brace <= pos) return -1;
630
+ return brace;
631
+ }
632
+ function insert_expanded_tarball(content, entry_start, entry_end, tarball) {
633
+ const entry_content = content.slice(entry_start, entry_end);
634
+ const integrity_eol = find_integrity_eol_in_entry(entry_content);
635
+ if (integrity_eol === -1) return void 0;
636
+ if (entry_content.slice(integrity_eol + 1).startsWith(TARBALL_PREFIX)) return content;
637
+ const patched = `${entry_content.slice(0, integrity_eol + 1)}${TARBALL_PREFIX}${tarball}
638
+ ${entry_content.slice(integrity_eol + 1)}`;
639
+ return content.slice(0, entry_start) + patched + content.slice(entry_end);
640
+ }
641
+ function insert_flow_tarball(content, entry_start, entry_end, tarball) {
642
+ const entry_content = content.slice(entry_start, entry_end);
643
+ const brace_pos = find_flow_resolution_brace(entry_content);
644
+ if (brace_pos === -1) return void 0;
645
+ const open_brace = entry_content.lastIndexOf("{", brace_pos);
646
+ if (open_brace === -1) return void 0;
647
+ const flow_body = entry_content.slice(open_brace + 1, brace_pos);
648
+ if (/\btarball\s*:/u.test(flow_body)) return content;
649
+ const patched = `${entry_content.slice(0, brace_pos)}${FLOW_TARBALL_KEY}${tarball}${entry_content.slice(brace_pos)}`;
650
+ return content.slice(0, entry_start) + patched + content.slice(entry_end);
651
+ }
652
+ function insert_tarball_for_key(content, package_key, tarball) {
653
+ const entry_start = find_entry_start(content, package_key);
654
+ if (entry_start === -1) return content;
655
+ const entry_end = find_entry_end(content, entry_start);
656
+ return insert_expanded_tarball(content, entry_start, entry_end, tarball) ?? insert_flow_tarball(content, entry_start, entry_end, tarball) ?? content;
657
+ }
658
+ function patch_lockfile(content, patches) {
659
+ let result = content;
660
+ for (const [key, tarball] of patches) {
661
+ result = insert_tarball_for_key(result, key, tarball);
662
+ }
663
+ return result;
664
+ }
665
+ function resolve_token(environment_token, npmrc_token, get_fallback_token) {
666
+ if (environment_token !== void 0 && environment_token.length > 0) return environment_token;
667
+ if (npmrc_token !== void 0) return npmrc_token;
668
+ return get_fallback_token();
669
+ }
670
+ var fix_gh_packages_logic = {
671
+ parse_gh_scopes,
672
+ parse_scope_registries,
673
+ parse_npmrc_auth_token,
674
+ parse_lockfile_packages,
675
+ package_path_from_key,
676
+ package_version_from_key,
677
+ needs_tarball_fix: should_fix_tarball,
678
+ insert_tarball_for_key,
679
+ patch_lockfile,
680
+ resolve_token
681
+ };
682
+
683
+ // scripts/config-merge/list-patch.ts
684
+ function is_matching(entry2, matchers) {
685
+ return matchers.some(
686
+ (matcher) => typeof matcher === "string" ? matcher === entry2 : matcher.test(entry2)
687
+ );
688
+ }
689
+ function apply_remove(existing, remove) {
690
+ if (remove === void 0 || remove.length === 0) return existing;
691
+ return existing.filter((entry2) => !is_matching(entry2, remove));
692
+ }
693
+ function collect_additions(kept, ensure2) {
694
+ if (ensure2 === void 0) return [];
695
+ return ensure2.filter((entry2) => !kept.includes(entry2));
696
+ }
697
+ function apply_list_patch(existing, patch) {
698
+ const kept = apply_remove(existing, patch.remove);
699
+ const additions = collect_additions(kept, patch.ensure);
700
+ const is_changed = additions.length > 0 || kept.length !== existing.length;
701
+ return { next: [...additions, ...kept], is_changed };
702
+ }
703
+ var list_patch = {
704
+ is_matching,
705
+ apply_list_patch
706
+ };
707
+
708
+ // scripts/config-merge/patch-json-key.ts
709
+ import {
710
+ createScanner,
711
+ findNodeAtLocation,
712
+ getNodeValue,
713
+ parseTree as parseTree2,
714
+ stripComments
715
+ } from "jsonc-parser";
716
+
717
+ // scripts/config-merge/json-format.ts
718
+ var PRINT_WIDTH = 100;
719
+ var TAB_WIDTH = 2;
720
+ var ARRAY_CLOSE = /^\t*\],?$/u;
721
+ function is_array_open(line) {
722
+ return line.endsWith("[");
723
+ }
724
+ function is_leaf_element(line) {
725
+ return !line.endsWith("{") && !line.endsWith("[");
726
+ }
727
+ function line_width(line) {
728
+ const tabs = line.length - line.trimStart().length;
729
+ return tabs * TAB_WIDTH + (line.length - tabs);
730
+ }
731
+ function flatten_elements(elements) {
732
+ const scalars = elements.map((line) => line.trim().replace(/,$/u, ""));
733
+ return `[${scalars.join(", ")}]`;
734
+ }
735
+ function collect_block(lines, start) {
736
+ const close = lines.findIndex((line, index) => index > start && ARRAY_CLOSE.test(line));
737
+ if (close === -1) return void 0;
738
+ const elements = lines.slice(start + 1, close);
739
+ if (elements.some((line) => !is_leaf_element(line))) return void 0;
740
+ return { elements, close: lines[close] ?? "", end: close };
741
+ }
742
+ function try_inline(open, block) {
743
+ const trailing_comma = block.close.trimStart() === "]," ? "," : "";
744
+ const inlined = `${open.slice(0, -1)}${flatten_elements(block.elements)}${trailing_comma}`;
745
+ return line_width(inlined) <= PRINT_WIDTH ? inlined : void 0;
746
+ }
747
+ function rewrite_at(lines, index, line) {
748
+ const verbatim = { lines: [line], next: index + 1 };
749
+ const block = is_array_open(line) ? collect_block(lines, index) : void 0;
750
+ if (block === void 0) return verbatim;
751
+ const inlined = try_inline(line, block);
752
+ if (inlined === void 0) return verbatim;
753
+ return { lines: [inlined], next: block.end + 1 };
754
+ }
755
+ function inline_short_arrays(text) {
756
+ const lines = text.split("\n");
757
+ const output = [];
758
+ let index = 0;
759
+ while (index < lines.length) {
760
+ const rewrite = rewrite_at(lines, index, lines[index] ?? "");
761
+ output.push(...rewrite.lines);
762
+ index = rewrite.next;
763
+ }
764
+ return output.join("\n");
765
+ }
766
+ function format_json(value) {
767
+ return `${inline_short_arrays(JSON.stringify(value, void 0, " "))}
768
+ `;
769
+ }
770
+ function format_package_json(value) {
771
+ return `${JSON.stringify(value, void 0, " ")}
772
+ `;
773
+ }
774
+ var json_format = {
775
+ format_json,
776
+ format_package_json
777
+ };
778
+
779
+ // scripts/config-merge/patch-json-key.ts
780
+ var DOCUMENT_SUFFIX = "\n}\n";
781
+ var DEFAULT_INDENT = " ";
782
+ var LEADING_BLANKS = /^[\t ]*/u;
783
+ var PREVIOUS_LINE_OFFSET = 2;
784
+ var CRLF = "\r\n";
785
+ var COMMA_PROBE_VALUE = 0;
786
+ function render_value(key, value, has_trailing_comma) {
787
+ const probe_key = `${key} `;
788
+ const probe = has_trailing_comma ? { [key]: value, [probe_key]: COMMA_PROBE_VALUE } : { [key]: value };
789
+ const document = json_format.format_json(probe);
790
+ const prefix = `{
791
+ ${JSON.stringify(key)}: `;
792
+ const suffix = has_trailing_comma ? `,
793
+ ${JSON.stringify(probe_key)}: ${String(COMMA_PROBE_VALUE)}${DOCUMENT_SUFFIX}` : DOCUMENT_SUFFIX;
794
+ return document.slice(prefix.length, document.length - suffix.length);
795
+ }
796
+ function parse_root(content) {
797
+ const root2 = parseTree2(content);
798
+ return root2?.type === "object" ? root2 : void 0;
799
+ }
800
+ function replace_range(content, range, text) {
801
+ return content.slice(0, range.offset) + text + content.slice(range.offset + range.length);
802
+ }
803
+ function insert_at(content, offset, text) {
804
+ return replace_range(content, { offset, length: 0 }, text);
805
+ }
806
+ function render_indent(value_text, unit) {
807
+ if (unit === DEFAULT_INDENT || unit.length === 0) return value_text;
808
+ return value_text.replaceAll(/^\t+/gmu, (tabs) => unit.repeat(tabs.length));
809
+ }
810
+ function eol_of(content) {
811
+ return content.includes(CRLF) ? CRLF : "\n";
812
+ }
813
+ function fit_value(content, value_text, indent) {
814
+ const indented = render_indent(value_text, indent);
815
+ if (eol_of(content) === "\n") return indented;
816
+ return indented.split("\n").join(CRLF);
817
+ }
818
+ function line_indent(content, offset) {
819
+ const line_start = content.lastIndexOf("\n", offset - 1) + 1;
820
+ return LEADING_BLANKS.exec(content.slice(line_start, offset))?.[0] ?? "";
821
+ }
822
+ function line_end(content, offset) {
823
+ const index = content.indexOf("\n", offset);
824
+ if (index === -1) return content.length;
825
+ return index > offset && content[index - 1] === "\r" ? index - 1 : index;
826
+ }
827
+ function render_property(content, key, value_text, indent) {
828
+ return `${JSON.stringify(key)}: ${fit_value(content, value_text, indent)}`;
829
+ }
830
+ function insertion_offset(content, root2, value_end) {
831
+ return Math.min(line_end(content, value_end), root2.offset + root2.length - 1);
832
+ }
833
+ function separator_offset(content, offset, limit) {
834
+ const scanner = createScanner(content, true);
835
+ scanner.setPosition(offset);
836
+ scanner.scan();
837
+ const at = scanner.getTokenOffset();
838
+ return at < limit && content[at] === "," ? at : -1;
839
+ }
840
+ function has_separator_after(content, offset, limit) {
841
+ return separator_offset(content, offset, limit) !== -1;
842
+ }
843
+ function property_key2(property) {
844
+ const key = property.children?.[0]?.value;
845
+ return typeof key === "string" ? key : void 0;
846
+ }
847
+ function target_value_end(property) {
848
+ const value_node = property?.children?.[1];
849
+ return value_node === void 0 ? void 0 : value_node.offset + value_node.length;
850
+ }
851
+ function contains_comment(content, node) {
852
+ const text = content.slice(node.offset, node.offset + node.length);
853
+ return stripComments(text) !== text;
854
+ }
855
+ function rebalanced_value(content, key, value_node, has_trailing_comma) {
856
+ if (contains_comment(content, value_node)) return void 0;
857
+ const indent = line_indent(content, value_node.offset);
858
+ const rendered = fit_value(
859
+ content,
860
+ render_value(key, getNodeValue(value_node), has_trailing_comma),
861
+ indent
862
+ );
863
+ const current = content.slice(value_node.offset, value_node.offset + value_node.length);
864
+ return rendered === current ? void 0 : rendered;
865
+ }
866
+ function rebalance(content, property, has_trailing_comma) {
867
+ const key = property_key2(property);
868
+ const value_node = property.children?.[1];
869
+ if (key === void 0 || value_node === void 0) return content;
870
+ const rendered = rebalanced_value(content, key, value_node, has_trailing_comma);
871
+ return rendered === void 0 ? content : replace_range(content, value_node, rendered);
872
+ }
873
+ function append_after(content, root2, last, property) {
874
+ const value_end = last.offset + last.length;
875
+ const closing_brace = root2.offset + root2.length - 1;
876
+ const separator = has_separator_after(content, value_end, closing_brace) ? "" : ",";
877
+ const with_property = insert_at(content, insertion_offset(content, root2, value_end), property);
878
+ return insert_at(with_property, value_end, separator);
879
+ }
880
+ function insert_only_property(content, root2, property) {
881
+ const closing_brace = root2.offset + root2.length - 1;
882
+ const lead = content[closing_brace - 1] === "\n" ? "" : eol_of(content);
883
+ return insert_at(content, closing_brace, `${lead}${DEFAULT_INDENT}${property}${eol_of(content)}`);
884
+ }
885
+ function insert_property(content, root2, key, value_text) {
886
+ const last = root2.children?.at(-1);
887
+ if (last === void 0) {
888
+ const only = render_property(content, key, value_text, DEFAULT_INDENT);
889
+ return insert_only_property(content, root2, only);
890
+ }
891
+ const indent = line_indent(content, last.offset);
892
+ const property = `${eol_of(content)}${indent}${render_property(content, key, value_text, indent)}`;
893
+ return rebalance(append_after(content, root2, last, property), last, true);
894
+ }
895
+ function end_of_trailing_comment(content, end) {
896
+ const stop = line_end(content, end);
897
+ return content.slice(end, stop).trimStart().startsWith("//") ? stop : end;
898
+ }
899
+ function start_of_leading_comments(content, line_start, floor) {
900
+ let start = line_start;
901
+ while (start > floor) {
902
+ const previous = content.lastIndexOf("\n", start - PREVIOUS_LINE_OFFSET) + 1;
903
+ const is_comment_line = content.slice(previous, start).trimStart().startsWith("//");
904
+ if (!is_comment_line || previous < floor) return start;
905
+ start = previous;
906
+ }
907
+ return start;
908
+ }
909
+ function end_of_line_break(content, offset) {
910
+ if (content[offset] === "\r" && content[offset + 1] === "\n") return offset + PREVIOUS_LINE_OFFSET;
911
+ return content[offset] === "\n" ? offset + 1 : offset;
912
+ }
913
+ function body_range(content, root2, target2, separator_limit) {
914
+ const value_end = target2.offset + target2.length;
915
+ const comma = separator_limit === -1 ? -1 : separator_offset(content, value_end, separator_limit);
916
+ const end = end_of_trailing_comment(content, comma === -1 ? value_end : comma + 1);
917
+ const line_start = content.lastIndexOf("\n", target2.offset - 1) + 1;
918
+ const is_own_line = content.slice(line_start, target2.offset).trim().length === 0;
919
+ if (!is_own_line) return { offset: target2.offset, length: end - target2.offset };
920
+ const start = start_of_leading_comments(content, line_start, root2.offset + 1);
921
+ return { offset: start, length: end_of_line_break(content, end) - start };
922
+ }
923
+ function ranges_for_last_property(content, root2, previous, target2) {
924
+ const comma = separator_offset(content, previous.offset + previous.length, target2.offset);
925
+ const body = body_range(content, root2, target2, -1);
926
+ return comma === -1 ? [body] : [{ offset: comma, length: 1 }, body];
927
+ }
928
+ function removal_ranges(content, root2, index) {
929
+ const children = root2.children ?? [];
930
+ const target2 = children[index];
931
+ if (target2 === void 0) return [];
932
+ const next = children[index + 1];
933
+ if (next !== void 0) return [body_range(content, root2, target2, next.offset)];
934
+ const previous = children[index - 1];
935
+ if (previous === void 0) return [{ offset: root2.offset, length: root2.length }];
936
+ return ranges_for_last_property(content, root2, previous, target2);
937
+ }
938
+ function property_index(root2, key) {
939
+ return (root2.children ?? []).findIndex((child) => child.children?.[0]?.value === key);
940
+ }
941
+ function with_trailing_newline(content) {
942
+ return content.endsWith("\n") ? content : `${content}
943
+ `;
944
+ }
945
+ function is_followed_by_comma(content, root2, key) {
946
+ const children = root2.children ?? [];
947
+ const index = property_index(root2, key);
948
+ if (index < 0) return false;
949
+ if (index < children.length - 1) return true;
950
+ const value_end = target_value_end(children[index]);
951
+ return value_end !== void 0 && has_separator_after(content, value_end, root2.offset + root2.length);
952
+ }
953
+ function set_json_key(content, key, value) {
954
+ const root2 = parse_root(content);
955
+ if (root2 === void 0) return content;
956
+ const existing = findNodeAtLocation(root2, [key]);
957
+ const value_text = render_value(
958
+ key,
959
+ value,
960
+ existing !== void 0 && is_followed_by_comma(content, root2, key)
961
+ );
962
+ if (existing === void 0) {
963
+ return with_trailing_newline(insert_property(content, root2, key, value_text));
964
+ }
965
+ const indented = fit_value(content, value_text, line_indent(content, existing.offset));
966
+ return with_trailing_newline(replace_range(content, existing, indented));
967
+ }
968
+ function resolve_parent(content, path22) {
969
+ const root2 = parse_root(content);
970
+ if (root2 === void 0) return void 0;
971
+ const parent = path22.length > 1 ? findNodeAtLocation(root2, path22.slice(0, -1)) : root2;
972
+ return parent?.type === "object" ? parent : void 0;
973
+ }
974
+ function cut_ranges(content, parent, ranges) {
975
+ const ordered2 = ranges.toSorted((left, right) => right.offset - left.offset);
976
+ let next = content;
977
+ for (const range of ordered2) {
978
+ next = replace_range(next, range, range.offset === parent.offset ? "{}" : "");
979
+ }
980
+ return next;
981
+ }
982
+ function rebalance_new_last(content, path22) {
983
+ const parent = resolve_parent(content, path22);
984
+ const last = parent?.children?.at(-1);
985
+ if (parent === void 0 || last === void 0) return content;
986
+ return rebalance(content, last, has_separator_after(content, parent.offset, parent.offset));
987
+ }
988
+ function cut_property(content, parent, path22) {
989
+ const index = property_index(parent, path22.at(-1) ?? "");
990
+ const ranges = removal_ranges(content, parent, index);
991
+ if (ranges.length === 0) return content;
992
+ const cut = cut_ranges(content, parent, ranges);
993
+ const did_end_object = index === (parent.children ?? []).length - 1;
994
+ return did_end_object ? rebalance_new_last(cut, path22) : cut;
995
+ }
996
+ function remove_json_path(content, path22) {
997
+ const parent = resolve_parent(content, path22);
998
+ if (parent === void 0) return content;
999
+ const next = cut_property(content, parent, path22);
1000
+ return next === content ? content : with_trailing_newline(next);
1001
+ }
1002
+ function remove_json_key(content, key) {
1003
+ return remove_json_path(content, [key]);
1004
+ }
1005
+ var patch_json_key = {
1006
+ set_json_key,
1007
+ remove_json_key,
1008
+ remove_json_path,
1009
+ eol_of,
1010
+ fit_value,
1011
+ line_indent
1012
+ };
1013
+
1014
+ // scripts/config-merge/patch-json-list.ts
1015
+ function normalize_list(value) {
1016
+ if (typeof value === "string") return [value];
1017
+ if (Array.isArray(value)) return value.map(String);
1018
+ return [];
1019
+ }
1020
+ function patch_json_list_field(content, options) {
1021
+ const parsed = parse_jsonc(content);
1022
+ const existing = normalize_list(parsed[options.field]);
1023
+ const { next, is_changed } = list_patch.apply_list_patch(existing, options);
1024
+ if (!is_changed) return content;
1025
+ return patch_json_key.set_json_key(content, options.field, [...next]);
1026
+ }
1027
+ var json_list = {
1028
+ patch_json_list_field
1029
+ };
1030
+
1031
+ // scripts/config-merge/patch-yaml-list.ts
1032
+ import { dump } from "js-yaml";
1033
+ var { parse_yaml: parse_yaml2 } = yaml_document;
1034
+ function read_yaml_list_field(content, field) {
1035
+ const raw = parse_yaml2(content)[field];
1036
+ if (typeof raw === "string") return [raw];
1037
+ return Array.isArray(raw) ? string_array_schema.parse(raw) : [];
1038
+ }
1039
+ function replace_field(parsed, field, value) {
1040
+ return Object.fromEntries(
1041
+ Object.entries(parsed).map(([key, entry2]) => [key, key === field ? [...value] : entry2])
1042
+ );
1043
+ }
1044
+ function insert_after(parsed, field, value, anchor) {
1045
+ const entries = Object.entries(parsed);
1046
+ const index = entries.findIndex(([key]) => key === anchor);
1047
+ if (index === -1) return { ...parsed, [field]: [...value] };
1048
+ return Object.fromEntries([
1049
+ ...entries.slice(0, index + 1),
1050
+ [field, [...value]],
1051
+ ...entries.slice(index + 1)
1052
+ ]);
1053
+ }
1054
+ function insert_new_field(parsed, field, value, position) {
1055
+ if (position === "front") return { [field]: [...value], ...parsed };
1056
+ if (position === "end") return { ...parsed, [field]: [...value] };
1057
+ return insert_after(parsed, field, value, position.after);
1058
+ }
1059
+ function place_field(parsed, field, value, position) {
1060
+ if (Object.hasOwn(parsed, field)) return replace_field(parsed, field, value);
1061
+ return insert_new_field(parsed, field, value, position);
1062
+ }
1063
+ function patch_yaml_list_field(content, options) {
1064
+ const parsed = parse_yaml2(content);
1065
+ const existing = read_yaml_list_field(content, options.field);
1066
+ const { next, is_changed } = list_patch.apply_list_patch(existing, options);
1067
+ if (!is_changed) return content;
1068
+ const placed = place_field(parsed, options.field, next, options.position ?? "front");
1069
+ return dump(placed, options.quote_style === void 0 ? {} : { quoteStyle: options.quote_style });
1070
+ }
1071
+ var yaml_list = {
1072
+ patch_yaml_list_field,
1073
+ read_yaml_list_field
1074
+ };
1075
+
1076
+ // scripts/config-merge/index.ts
1077
+ var config_merge = {
1078
+ patch_yaml_list_field: yaml_list.patch_yaml_list_field,
1079
+ read_yaml_list_field: yaml_list.read_yaml_list_field,
1080
+ patch_json_list_field: json_list.patch_json_list_field
1081
+ };
1082
+
1083
+ // scripts/safe-chain/preinstall-command.ts
1084
+ var INSTALL_GUIDE_ANCHOR = "installing-safe-chain";
1085
+ var INSTALL_GUIDE_URL = `https://github.com/joshuafolkken/kit/blob/main/SECURITY.md#${INSTALL_GUIDE_ANCHOR}`;
1086
+ var INTEGRATION_HINT = `Warning: safe-chain (@aikidosec/safe-chain) is not scanning this install because its shell integration is not active. Install it with the hash-verified steps at ${INSTALL_GUIDE_URL} - then restart your terminal.`;
1087
+ var LOCAL_INTEGRATION_CHECK_SOURCE = `if(!process.env.CI&&!process.env.GLOBAL_AGENT_HTTP_PROXY)console.warn('${INTEGRATION_HINT}')`;
1088
+ var SAFE_CHAIN_CMD = `node -e "${LOCAL_INTEGRATION_CHECK_SOURCE}"`;
1089
+ var LEGACY_PREINSTALL_RE = /^pnpm dlx @aikidosec\/safe-chain(?:@\S+)? setup-ci(?: && node -e "[^"]*")?$/u;
1090
+ function migrate_preinstall(value) {
1091
+ return LEGACY_PREINSTALL_RE.test(value) ? SAFE_CHAIN_CMD : value;
1092
+ }
1093
+ var safe_chain_preinstall = {
1094
+ SAFE_CHAIN_CMD,
1095
+ LOCAL_INTEGRATION_CHECK_SOURCE,
1096
+ INTEGRATION_HINT,
1097
+ INSTALL_GUIDE_ANCHOR,
1098
+ migrate_preinstall
1099
+ };
1100
+
1101
+ // scripts/init/init-logic-migrate.ts
1102
+ function migrate_scripts(scripts) {
1103
+ const current = scripts["preinstall"];
1104
+ if (current === void 0) return scripts;
1105
+ return { ...scripts, preinstall: safe_chain_preinstall.migrate_preinstall(current) };
1106
+ }
1107
+ var init_logic_migrate = { migrate_scripts };
1108
+
1109
+ // scripts/init/init-logic-package-key-order.ts
1110
+ var PACKAGE_JSON_KEY_ORDER = [
1111
+ "name",
1112
+ "version",
1113
+ "description",
1114
+ "keywords",
1115
+ "homepage",
1116
+ "bugs",
1117
+ "license",
1118
+ "author",
1119
+ "contributors",
1120
+ "funding",
1121
+ "files",
1122
+ "main",
1123
+ "browser",
1124
+ "exports",
1125
+ "imports",
1126
+ "bin",
1127
+ "man",
1128
+ "directories",
1129
+ "repository",
1130
+ "type",
1131
+ "types",
1132
+ "typings",
1133
+ "typesVersions",
1134
+ "publishConfig",
1135
+ "private",
1136
+ "scripts",
1137
+ "config",
1138
+ "dependencies",
1139
+ "devDependencies",
1140
+ "peerDependencies",
1141
+ "peerDependenciesMeta",
1142
+ "bundleDependencies",
1143
+ "bundledDependencies",
1144
+ "optionalDependencies",
1145
+ "overrides",
1146
+ "resolutions",
1147
+ "packageManager",
1148
+ "engines",
1149
+ "devEngines",
1150
+ "os",
1151
+ "cpu",
1152
+ "size-limit",
1153
+ "pnpm"
1154
+ ];
1155
+
1156
+ // scripts/init/kit-base-preset.ts
1157
+ var KIT_LEFTHOOK_PRESET = /@joshuafolkken\/[^/]+\/lefthook\//u;
1158
+ var KIT_CSPELL_PRESET = /@joshuafolkken\/[^/]+\/cspell(?:\/|$)/u;
1159
+ var KIT_TSCONFIG_PRESET = /@joshuafolkken\/[^/]+\/tsconfig\//u;
1160
+ var SVELTEKIT_PRESET = /(?<![\w-])sveltekit(?![\w-])/u;
1161
+ function has_match(entries, pattern) {
1162
+ return entries.some((entry2) => pattern.test(entry2));
1163
+ }
1164
+ function is_base_present(entries, subsystem_pattern) {
1165
+ return has_match(entries, subsystem_pattern) || has_match(entries, SVELTEKIT_PRESET);
1166
+ }
1167
+ function is_lefthook_base_present(entries) {
1168
+ return is_base_present(entries, KIT_LEFTHOOK_PRESET);
1169
+ }
1170
+ function is_cspell_base_present(entries) {
1171
+ return is_base_present(entries, KIT_CSPELL_PRESET);
1172
+ }
1173
+ function is_tsconfig_base_present(entries) {
1174
+ return is_base_present(entries, KIT_TSCONFIG_PRESET);
1175
+ }
1176
+ var kit_base_preset = {
1177
+ is_lefthook_base_present,
1178
+ is_cspell_base_present,
1179
+ is_tsconfig_base_present
1180
+ };
1181
+
1182
+ // scripts/init/tsconfig-preset-migration.ts
1183
+ import { existsSync as existsSync2 } from "node:fs";
1184
+ import path7 from "node:path";
1185
+ var LEGACY_PRESET_ENTRY = /@joshuafolkken\/[^/]+\/tsconfig\/[^/]+\.jsonc$/u;
1186
+ var LEGACY_SUFFIX = ".jsonc";
1187
+ var CURRENT_SUFFIX = ".json";
1188
+ var EXTENDS_FIELD = "extends";
1189
+ function is_migration_target_present(base_directory, entry2) {
1190
+ return existsSync2(path7.resolve(base_directory, entry2));
1191
+ }
1192
+ function migrate_entry(base_directory, entry2) {
1193
+ if (!LEGACY_PRESET_ENTRY.test(entry2)) return entry2;
1194
+ const migrated = `${entry2.slice(0, -LEGACY_SUFFIX.length)}${CURRENT_SUFFIX}`;
1195
+ return is_migration_target_present(base_directory, migrated) ? migrated : entry2;
1196
+ }
1197
+ function migrate_extends_value(base_directory, raw) {
1198
+ if (typeof raw === "string") return migrate_entry(base_directory, raw);
1199
+ if (Array.isArray(raw)) {
1200
+ return string_array_schema.parse(raw).map((entry2) => migrate_entry(base_directory, entry2));
1201
+ }
1202
+ return raw;
1203
+ }
1204
+ function migrate_preset_paths(content, base_directory) {
1205
+ const parsed = parse_jsonc(content);
1206
+ const raw = parsed[EXTENDS_FIELD];
1207
+ const migrated = migrate_extends_value(base_directory, raw);
1208
+ if (JSON.stringify(migrated) === JSON.stringify(raw)) return content;
1209
+ return patch_json_key.set_json_key(content, EXTENDS_FIELD, migrated);
1210
+ }
1211
+ var tsconfig_preset_migration = {
1212
+ migrate_preset_paths
1213
+ };
1214
+
1215
+ // scripts/init/init-logic-json-merge.ts
1216
+ function merge_json_extends(content, entry2) {
1217
+ return config_merge.patch_json_list_field(content, { field: EXTENDS_FIELD, ensure: [entry2] });
1218
+ }
1219
+ function read_extends_entries(content) {
1220
+ const raw = parse_jsonc(content)[EXTENDS_FIELD];
1221
+ if (typeof raw === "string") return [raw];
1222
+ if (Array.isArray(raw)) return string_array_schema.parse(raw);
1223
+ return [];
1224
+ }
1225
+ function merge_tsconfig_extends(content, entry2, base_directory) {
1226
+ const migrated = tsconfig_preset_migration.migrate_preset_paths(content, base_directory);
1227
+ if (kit_base_preset.is_tsconfig_base_present(read_extends_entries(migrated))) return migrated;
1228
+ return merge_json_extends(migrated, entry2);
1229
+ }
1230
+ function extract_compiler_options(content) {
1231
+ const parsed = parse_jsonc(content);
1232
+ const raw = parsed["compilerOptions"];
1233
+ if (raw === void 0) return {};
1234
+ return json_object_schema.parse(raw);
1235
+ }
1236
+ function is_redundant_option(value, key, base_options) {
1237
+ if (!Object.hasOwn(base_options, key)) return false;
1238
+ return JSON.stringify(base_options[key]) === JSON.stringify(value);
1239
+ }
1240
+ var COMPILER_OPTIONS_FIELD = "compilerOptions";
1241
+ function drop_redundant_options(content, redundant) {
1242
+ let current = content;
1243
+ for (const key of redundant) {
1244
+ current = patch_json_key.remove_json_path(current, [COMPILER_OPTIONS_FIELD, key]);
1245
+ }
1246
+ return current;
1247
+ }
1248
+ function serialize_stripped(content, kept, redundant) {
1249
+ if (Object.keys(kept).length === 0) {
1250
+ return patch_json_key.remove_json_key(content, COMPILER_OPTIONS_FIELD);
1251
+ }
1252
+ return drop_redundant_options(content, redundant);
1253
+ }
1254
+ function redundant_option_keys(current, base_options) {
1255
+ return Object.entries(current).filter(([key, value]) => is_redundant_option(value, key, base_options)).map(([key]) => key);
1256
+ }
1257
+ function strip_redundant_compiler_options(content, base_options) {
1258
+ const raw = parse_jsonc(content)[COMPILER_OPTIONS_FIELD];
1259
+ if (raw === void 0) return content;
1260
+ const current = json_object_schema.parse(raw);
1261
+ const redundant = redundant_option_keys(current, base_options);
1262
+ if (redundant.length === 0) return content;
1263
+ const kept = Object.entries(current).filter(([key]) => !redundant.includes(key));
1264
+ return serialize_stripped(content, Object.fromEntries(kept), redundant);
1265
+ }
1266
+ function merge_json_array_field(content, key, values) {
1267
+ const parsed = parse_jsonc(content);
1268
+ const existing = Object.hasOwn(parsed, key) ? string_array_schema.parse(parsed[key]) : [];
1269
+ const to_add = values.filter((value) => !existing.includes(value));
1270
+ if (to_add.length === 0) return content;
1271
+ return patch_json_key.set_json_key(content, key, [...existing, ...to_add]);
1272
+ }
1273
+ function missing_entries(existing, additions) {
1274
+ return Object.entries(additions).filter(([key]) => !Object.hasOwn(existing, key));
1275
+ }
1276
+ function merge_owned_entries(current, update) {
1277
+ const current_object = json_object_schema.safeParse(current);
1278
+ const update_object = json_object_schema.safeParse(update);
1279
+ if (!current_object.success || !update_object.success) return void 0;
1280
+ const owned = current_object.data;
1281
+ const missing = missing_entries(owned, update_object.data);
1282
+ if (missing.length === 0) return void 0;
1283
+ return { ...owned, ...Object.fromEntries(missing) };
1284
+ }
1285
+ function collect_applicable_updates(parsed, updates) {
1286
+ const resolved = Object.entries(updates).map(([key, value]) => [
1287
+ key,
1288
+ Object.hasOwn(parsed, key) ? merge_owned_entries(parsed[key], value) : value
1289
+ ]);
1290
+ return Object.fromEntries(resolved.filter(([, merged]) => merged !== void 0));
1291
+ }
1292
+ function merge_json_object(content, updates) {
1293
+ const parsed = parse_jsonc(content);
1294
+ const applicable = collect_applicable_updates(parsed, updates);
1295
+ if (Object.keys(applicable).length === 0) return content;
1296
+ let current = content;
1297
+ for (const [key, value] of Object.entries(applicable)) {
1298
+ current = patch_json_key.set_json_key(current, key, value);
1299
+ }
1300
+ return current;
1301
+ }
1302
+ function serialize_package_json(value) {
1303
+ return json_format.format_package_json(value);
1304
+ }
1305
+ var SCRIPTS_PREPEND_KEYS = /* @__PURE__ */ new Set(["preinstall"]);
1306
+ function merge_package_scripts(content, scripts) {
1307
+ const parsed = parse_jsonc(content);
1308
+ const raw = parsed["scripts"];
1309
+ const existing = raw === void 0 ? {} : string_record_schema.parse(raw);
1310
+ const migrated = init_logic_migrate.migrate_scripts(existing);
1311
+ const to_add = missing_entries(migrated, scripts);
1312
+ const did_migrate = JSON.stringify(migrated) !== JSON.stringify(existing);
1313
+ if (!did_migrate && to_add.length === 0) return content;
1314
+ const prepend = Object.fromEntries(to_add.filter(([k]) => SCRIPTS_PREPEND_KEYS.has(k)));
1315
+ const append2 = Object.fromEntries(to_add.filter(([k]) => !SCRIPTS_PREPEND_KEYS.has(k)));
1316
+ return serialize_package_json({ ...parsed, scripts: { ...prepend, ...migrated, ...append2 } });
1317
+ }
1318
+ function upgrade_safe_chain_preinstall(content) {
1319
+ const parsed = parse_jsonc(content);
1320
+ const raw = parsed["scripts"];
1321
+ if (raw === void 0) return content;
1322
+ const scripts = string_record_schema.parse(raw);
1323
+ const current = scripts["preinstall"];
1324
+ if (current === void 0) return content;
1325
+ const migrated = safe_chain_preinstall.migrate_preinstall(current);
1326
+ if (migrated === current) return content;
1327
+ return serialize_package_json({ ...parsed, scripts: { ...scripts, preinstall: migrated } });
1328
+ }
1329
+ function merge_development_dependencies(content, additions) {
1330
+ const parsed = parse_jsonc(content);
1331
+ const raw = parsed["devDependencies"];
1332
+ const existing = raw === void 0 ? {} : string_record_schema.parse(raw);
1333
+ const to_add = missing_entries(existing, additions);
1334
+ if (to_add.length === 0) return content;
1335
+ return serialize_package_json({
1336
+ ...parsed,
1337
+ devDependencies: { ...existing, ...Object.fromEntries(to_add) }
1338
+ });
1339
+ }
1340
+ function merge_package_manager(content, value) {
1341
+ if (value.length === 0) return content;
1342
+ const parsed = parse_jsonc(content);
1343
+ if ("packageManager" in parsed) return content;
1344
+ return serialize_package_json({ ...parsed, packageManager: value });
1345
+ }
1346
+ function merge_development_engines(content, value) {
1347
+ const parsed = parse_jsonc(content);
1348
+ if ("devEngines" in parsed) return content;
1349
+ return serialize_package_json({ ...parsed, devEngines: value });
1350
+ }
1351
+ function has_package_scripts_marker(content, marker) {
1352
+ const parsed = parse_jsonc(content);
1353
+ const raw = parsed["scripts"];
1354
+ if (raw === void 0) return false;
1355
+ const scripts = string_record_schema.parse(raw);
1356
+ return Object.values(scripts).some((cmd) => cmd.includes(marker));
1357
+ }
1358
+ function merge_package_script_suffix(content, key, cmd) {
1359
+ const parsed = parse_jsonc(content);
1360
+ const raw = parsed["scripts"];
1361
+ if (raw === void 0) return content;
1362
+ const scripts = string_record_schema.parse(raw);
1363
+ const existing = scripts[key];
1364
+ if (existing === void 0 || existing.includes(cmd)) return content;
1365
+ const updated_value = existing.trim().length === 0 ? cmd : `${existing} && ${cmd}`;
1366
+ return serialize_package_json({ ...parsed, scripts: { ...scripts, [key]: updated_value } });
1367
+ }
1368
+ function replace_in_package_script(content, key, from, to) {
1369
+ const parsed = parse_jsonc(content);
1370
+ const raw = parsed["scripts"];
1371
+ if (raw === void 0) return content;
1372
+ const scripts = string_record_schema.parse(raw);
1373
+ const existing = scripts[key];
1374
+ if (!existing?.includes(from)) return content;
1375
+ return serialize_package_json({
1376
+ ...parsed,
1377
+ // The replacer is a function so `to` is inserted verbatim: passed as a string, a `$&` or `$1`
1378
+ // inside it would be read as a substitution pattern rather than as the text it is.
1379
+ scripts: { ...scripts, [key]: existing.replace(from, () => to) }
1380
+ });
1381
+ }
1382
+ function remove_script_with_marker(content, key, marker) {
1383
+ const parsed = parse_jsonc(content);
1384
+ const raw = parsed["scripts"];
1385
+ if (raw === void 0) return content;
1386
+ const scripts = string_record_schema.parse(raw);
1387
+ if (!scripts[key]?.includes(marker)) return content;
1388
+ const rest = Object.fromEntries(Object.entries(scripts).filter(([k]) => k !== key));
1389
+ return serialize_package_json({ ...parsed, scripts: rest });
1390
+ }
1391
+ function sort_package_json_keys(content) {
1392
+ const parsed = parse_jsonc(content);
1393
+ const all_keys = Object.keys(parsed);
1394
+ const known = PACKAGE_JSON_KEY_ORDER.filter((k) => Object.hasOwn(parsed, k));
1395
+ const unknown = all_keys.filter((k) => !PACKAGE_JSON_KEY_ORDER.includes(k));
1396
+ const ordered2 = Object.fromEntries([...known, ...unknown].map((k) => [k, parsed[k]]));
1397
+ const serialized = serialize_package_json(ordered2);
1398
+ const current = serialize_package_json(parsed);
1399
+ if (serialized === current) return content;
1400
+ return serialized;
1401
+ }
1402
+ var init_logic_json_merge = {
1403
+ merge_json_extends,
1404
+ merge_tsconfig_extends,
1405
+ extract_compiler_options,
1406
+ strip_redundant_compiler_options,
1407
+ merge_json_array_field,
1408
+ merge_json_object,
1409
+ merge_package_scripts,
1410
+ upgrade_safe_chain_preinstall,
1411
+ merge_package_script_suffix,
1412
+ replace_in_package_script,
1413
+ remove_script_with_marker,
1414
+ has_package_scripts_marker,
1415
+ merge_development_dependencies,
1416
+ merge_package_manager,
1417
+ merge_development_engines,
1418
+ sort_package_json_keys
1419
+ };
1420
+
1421
+ // scripts/registry-migration/npm-acquisition.ts
1422
+ import { z as z5 } from "zod";
1423
+
1424
+ // scripts/registry-migration/migrate-lock.ts
1425
+ import path8 from "node:path";
1426
+ import { isDeepStrictEqual } from "node:util";
1427
+ import { dump as dump2 } from "js-yaml";
1428
+ var SCOPE = "@joshuafolkken/";
1429
+ var KIT = `${SCOPE}kit`;
1430
+ var REGISTRY = "https://registry.npmjs.org/";
1431
+ var PNPM_VERSION = "12.17.0";
1432
+ function scoped_artifacts(content) {
1433
+ return Object.entries(fix_gh_packages_logic.parse_lockfile_packages(content)).filter(([key]) => key.startsWith(SCOPE)).map(([key, entry2]) => ({
1434
+ name: fix_gh_packages_logic.package_path_from_key(key),
1435
+ version: fix_gh_packages_logic.package_version_from_key(key),
1436
+ integrity: entry2.resolution?.integrity
1437
+ }));
1438
+ }
1439
+ function importer_manifests(content) {
1440
+ return yaml_document.parse_yaml_documents(content).flatMap(
1441
+ (document) => yaml_document.is_mapping_document(document["importers"]) ? Object.keys(document["importers"]) : []
1442
+ ).map((importer) => path8.join(importer, "package.json"));
1443
+ }
1444
+ function non_npm_resolution(content) {
1445
+ const entries = Object.entries(fix_gh_packages_logic.parse_lockfile_packages(content)).filter(
1446
+ ([key]) => key.startsWith(SCOPE)
1447
+ );
1448
+ for (const [key, entry2] of entries) {
1449
+ const tarball = entry2.resolution?.tarball;
1450
+ if (tarball !== void 0 && !tarball.startsWith(REGISTRY)) return key;
1451
+ }
1452
+ return void 0;
1453
+ }
1454
+ function has_npm_sources(content) {
1455
+ return non_npm_resolution(content) === void 0;
1456
+ }
1457
+ function assert_npm_sources(content) {
1458
+ const key = non_npm_resolution(content);
1459
+ if (key !== void 0) throw new Error(`Non-npm resolution remains: ${key}`);
1460
+ }
1461
+ function npmrc(content) {
1462
+ const newline = content.includes("\r\n") ? "\r\n" : "\n";
1463
+ const lines = content.split(/\r?\n/u).filter((line) => !/^\s*@joshuafolkken:registry\s*=/u.test(line));
1464
+ while (lines.at(-1) === "") lines.pop();
1465
+ lines.push(`@joshuafolkken:registry=${REGISTRY}`, "");
1466
+ return lines.join(newline);
1467
+ }
1468
+ function strip_tarball(resolution) {
1469
+ if (yaml_document.is_mapping_document(resolution)) delete resolution["tarball"];
1470
+ }
1471
+ function strip_resolutions(document) {
1472
+ if (!yaml_document.is_mapping_document(document["packages"])) return;
1473
+ const scoped = Object.entries(document["packages"]).filter(([key]) => key.startsWith(SCOPE));
1474
+ for (const [, entry2] of scoped) {
1475
+ if (yaml_document.is_mapping_document(entry2)) strip_tarball(entry2["resolution"]);
1476
+ }
1477
+ }
1478
+ function graph(content) {
1479
+ const documents = yaml_document.parse_yaml_documents(content);
1480
+ for (const document of documents) strip_resolutions(document);
1481
+ return documents;
1482
+ }
1483
+ function assert_preserved(before, after) {
1484
+ if (before === "") return;
1485
+ if (!isDeepStrictEqual(graph(before), graph(after))) {
1486
+ throw new Error(
1487
+ "Resolution changed the dependency graph or unrelated metadata; no files changed"
1488
+ );
1489
+ }
1490
+ }
1491
+ function restore_checksum(original, resolved) {
1492
+ const checksum = original["pnpmfileChecksum"];
1493
+ if (checksum === void 0 || resolved["pnpmfileChecksum"] !== void 0) return false;
1494
+ resolved["pnpmfileChecksum"] = checksum;
1495
+ return true;
1496
+ }
1497
+ function restore_pnpmfile_checksum(before, after) {
1498
+ const originals = yaml_document.parse_yaml_documents(before);
1499
+ const resolved = yaml_document.parse_yaml_documents(after);
1500
+ const restored = resolved.map(
1501
+ (document, index) => restore_checksum(originals[index] ?? {}, document)
1502
+ );
1503
+ const prefix = after.startsWith("---") ? "---\n" : "";
1504
+ return restored.includes(true) ? prefix + resolved.map((document) => dump2(document)).join("---\n") : after;
1505
+ }
1506
+ var migrate_lock = {
1507
+ SCOPE,
1508
+ KIT,
1509
+ REGISTRY,
1510
+ PNPM_VERSION,
1511
+ scoped_artifacts,
1512
+ npmrc,
1513
+ assert_preserved,
1514
+ restore_pnpmfile_checksum,
1515
+ assert_npm_sources,
1516
+ has_npm_sources,
1517
+ importer_manifests
1518
+ };
1519
+
1520
+ // scripts/registry-migration/npm-acquisition.ts
1521
+ var NPM = "https://registry.npmjs.org/";
1522
+ var SCOPE2 = "@joshuafolkken";
1523
+ var LOCKFILE = "pnpm-lock.yaml";
1524
+ var SCRIPTS = ["prepare", "postinstall"];
1525
+ var dependency_schema = z5.record(z5.string(), z5.string()).optional();
1526
+ var manifest_schema = z5.object({
1527
+ dependencies: dependency_schema,
1528
+ devDependencies: dependency_schema,
1529
+ optionalDependencies: dependency_schema,
1530
+ peerDependencies: dependency_schema
1531
+ });
1532
+ var scripts_schema = z5.looseObject({ scripts: z5.record(z5.string(), z5.string()).optional() });
1533
+ function read(root2, name) {
1534
+ return file_reader.read_file_or_empty(path9.join(root2, name));
1535
+ }
1536
+ function is_npm(content) {
1537
+ const registry = fix_gh_packages_logic.parse_scope_registries(content).get(SCOPE2);
1538
+ return registry === NPM || registry === NPM.slice(0, -1);
1539
+ }
1540
+ function is_project_npm(root2 = process.cwd()) {
1541
+ return is_npm(read(root2, ".npmrc")) && migrate_lock.has_npm_sources(read(root2, LOCKFILE));
1542
+ }
1543
+ function is_npm_only(root2) {
1544
+ const npmrc2 = read(root2, ".npmrc");
1545
+ return is_project_npm(root2) && fix_gh_packages_logic.parse_gh_scopes(npmrc2).size === 0;
1546
+ }
1547
+ function has_scoped_name(dependencies) {
1548
+ return Object.keys(dependencies ?? {}).some((name) => name.startsWith(migrate_lock.SCOPE));
1549
+ }
1550
+ function has_scoped_dependencies(content) {
1551
+ const manifest = manifest_schema.parse(parse_jsonc(content || "{}"));
1552
+ return Object.values(manifest).some((dependencies) => has_scoped_name(dependencies));
1553
+ }
1554
+ function can_initialize(root2) {
1555
+ return read(root2, "pnpm-workspace.yaml") === "" && !has_scoped_dependencies(read(root2, "package.json")) && migrate_lock.scoped_artifacts(read(root2, LOCKFILE)).length === 0;
1556
+ }
1557
+ function can_manage(root2) {
1558
+ const content = read(root2, ".npmrc");
1559
+ return is_npm(content) || !fix_gh_packages_logic.parse_scope_registries(content).has(SCOPE2) && can_initialize(root2);
1560
+ }
1561
+ function merge_npmrc(content, root2) {
1562
+ if (is_npm(content)) return migrate_lock.npmrc(content);
1563
+ if (fix_gh_packages_logic.parse_scope_registries(content).has(SCOPE2)) return content;
1564
+ if (can_initialize(root2)) return migrate_lock.npmrc(content);
1565
+ return content;
1566
+ }
1567
+ function is_script_value(content, key, value) {
1568
+ return scripts_schema.parse(parse_jsonc(content)).scripts?.[key] === value;
1569
+ }
1570
+ function strip_script(content, key, command) {
1571
+ const script = scripts_schema.parse(parse_jsonc(content)).scripts?.[key];
1572
+ if (script === void 0) return content;
1573
+ const suffix = ` && (${command} || true)`;
1574
+ if (!script.endsWith(suffix)) return content;
1575
+ return init_logic_json_merge.replace_in_package_script(
1576
+ content,
1577
+ key,
1578
+ script,
1579
+ script.slice(0, -suffix.length)
1580
+ );
1581
+ }
1582
+ function merge_lifecycle(content, root2, command) {
1583
+ if (!is_npm_only(root2)) return content;
1584
+ let merged = content;
1585
+ for (const key of SCRIPTS) merged = strip_script(merged, key, command);
1586
+ return merged;
1587
+ }
1588
+ var npm_acquisition = {
1589
+ is_npm,
1590
+ is_project_npm,
1591
+ is_npm_only,
1592
+ is_script_value,
1593
+ can_manage,
1594
+ merge_npmrc,
1595
+ merge_lifecycle
1596
+ };
1597
+
463
1598
  // scripts/version/upgrade-shell-command.ts
464
1599
  var STEP_SEPARATOR = " && ";
465
1600
  function update_scope_flag(is_local) {
466
1601
  return is_local ? "-D" : "-g";
467
1602
  }
468
1603
  function update_argv(latest, is_local, config) {
469
- return ["pnpm", "add", update_scope_flag(is_local), `${config.package_name}@${latest}`];
1604
+ const registry = !is_local && config.package_name === KIT_PACKAGE_NAME ? ["--config.@joshuafolkken:registry=https://registry.npmjs.org/"] : [];
1605
+ return [
1606
+ "pnpm",
1607
+ "add",
1608
+ update_scope_flag(is_local),
1609
+ ...registry,
1610
+ `${config.package_name}@${latest}`
1611
+ ];
470
1612
  }
471
1613
  function format_update_command(latest, is_local, config) {
472
1614
  return update_argv(latest, is_local, config).join(" ");
473
1615
  }
474
- function build_upgrade_command(latest, is_local, config) {
1616
+ function needs_migration(is_local, package_name, root2) {
1617
+ return is_local && package_name === KIT_PACKAGE_NAME && !npm_acquisition.is_project_npm(root2);
1618
+ }
1619
+ function build_upgrade_command(latest, is_local, config, root2 = process.cwd()) {
475
1620
  const steps = [update_argv(latest, is_local, config)];
1621
+ if (needs_migration(is_local, config.package_name, root2)) {
1622
+ steps.unshift(["node", path10.join(PACKAGE_DIR, "dist/registry-migrate.mjs"), latest]);
1623
+ }
476
1624
  if (is_local) steps.push(["node_modules/.bin/tsx", config.fix_gh_packages_path]);
477
- return { text: steps.map((step) => step.join(" ")).join(STEP_SEPARATOR), steps };
1625
+ return {
1626
+ text: steps.map((step) => step.map((argument) => shell_quote.word(argument)).join(" ")).join(STEP_SEPARATOR),
1627
+ steps
1628
+ };
478
1629
  }
479
1630
  function shell_upgrade_command(command) {
480
1631
  return { text: command, steps: [["sh", "-c", command]] };
@@ -644,6 +1795,12 @@ function has_timed_out(error) {
644
1795
  if (typeof error !== "object" || error === null || !("timedOut" in error)) return false;
645
1796
  return error.timedOut === true;
646
1797
  }
1798
+ var TIMEOUT_EXIT_CODE = "timeout";
1799
+ function create_spawn_error(command, exit_code) {
1800
+ const exit_code_string = exit_code === void 0 ? "unknown" : String(exit_code);
1801
+ const error_message = `git ${command} exited with code ${exit_code_string}`;
1802
+ return new Error(error_message, { cause: { exit_code: exit_code_string } });
1803
+ }
647
1804
 
648
1805
  // scripts/josh/agent-session-environment.ts
649
1806
  var SESSION_ID_KEY = "CLAUDE_CODE_SESSION_ID";
@@ -748,8 +1905,8 @@ function throw_first_failure(failures) {
748
1905
  throw first;
749
1906
  }
750
1907
  async function drain(pool, worker) {
751
- for (let entry = pool.queue.shift(); entry !== void 0 && pool.failures.length === 0; entry = pool.queue.shift()) {
752
- const [index, item] = entry;
1908
+ for (let entry2 = pool.queue.shift(); entry2 !== void 0 && pool.failures.length === 0; entry2 = pool.queue.shift()) {
1909
+ const [index, item] = entry2;
753
1910
  try {
754
1911
  pool.results.push({ index, value: await worker(item, index) });
755
1912
  } catch (error) {
@@ -772,20 +1929,20 @@ async function bounded_map(items, limit, worker) {
772
1929
  }
773
1930
  function limiter(limit) {
774
1931
  const width = pool_width(limit, Infinity);
775
- const waiting = [];
1932
+ const waiting2 = [];
776
1933
  let active = 0;
777
1934
  return {
778
1935
  async run(task) {
779
1936
  if (active < width) active += 1;
780
1937
  else {
781
- await new Promise((resolve) => {
782
- waiting.push(resolve);
1938
+ await new Promise((resolve2) => {
1939
+ waiting2.push(resolve2);
783
1940
  });
784
1941
  }
785
1942
  try {
786
1943
  return await task();
787
1944
  } finally {
788
- const next = waiting.shift();
1945
+ const next = waiting2.shift();
789
1946
  if (next === void 0) active -= 1;
790
1947
  else next();
791
1948
  }
@@ -858,7 +2015,7 @@ function redact(text) {
858
2015
  function string_leaves(value) {
859
2016
  if (typeof value === "string") return [value];
860
2017
  if (typeof value !== "object" || value === null) return [];
861
- return Object.values(value).flatMap((entry) => string_leaves(entry));
2018
+ return Object.values(value).flatMap((entry2) => string_leaves(entry2));
862
2019
  }
863
2020
  function decoded(body) {
864
2021
  const value = json_value.parse_or_undefined(body);
@@ -876,7 +2033,7 @@ var token_shape = {
876
2033
  };
877
2034
 
878
2035
  // scripts/gh/git-gh-exec.ts
879
- import { execa as execa2, execaSync } from "execa";
2036
+ import { execa as execa5, execaSync as execaSync2 } from "execa";
880
2037
 
881
2038
  // scripts/rules/git-argv.ts
882
2039
  var ENV_ASSIGNMENT = /^[A-Za-z_]\w*=/u;
@@ -925,15 +2082,15 @@ function words_of(segment) {
925
2082
  return segment.match(WORD) ?? [];
926
2083
  }
927
2084
  var PATH_SEPARATOR2 = "/";
928
- function program_name(word) {
929
- return word.slice(word.lastIndexOf(PATH_SEPARATOR2) + NEXT);
2085
+ function program_name(word2) {
2086
+ return word2.slice(word2.lastIndexOf(PATH_SEPARATOR2) + NEXT);
930
2087
  }
931
- function is_wrapper_token(word) {
932
- return word === SUBSHELL_OPEN || ENV_ASSIGNMENT.test(word.replaceAll(WORD_QUOTING, "")) || WRAPPER_WORDS.has(program_name(word));
2088
+ function is_wrapper_token(word2) {
2089
+ return word2 === SUBSHELL_OPEN || ENV_ASSIGNMENT.test(word2.replaceAll(WORD_QUOTING, "")) || WRAPPER_WORDS.has(program_name(word2));
933
2090
  }
934
- function wrapper_flag_width(word = "") {
935
- if (!word.startsWith(FLAG_PREFIX)) return 0;
936
- return WRAPPER_VALUE_FLAGS.has(word) ? AFTER_VALUE : NEXT;
2091
+ function wrapper_flag_width(word2 = "") {
2092
+ if (!word2.startsWith(FLAG_PREFIX)) return 0;
2093
+ return WRAPPER_VALUE_FLAGS.has(word2) ? AFTER_VALUE : NEXT;
937
2094
  }
938
2095
  function after_wrapper_word(words, index) {
939
2096
  let next = index + NEXT;
@@ -967,9 +2124,9 @@ function after_globals(words) {
967
2124
  function program_of(segment) {
968
2125
  const words = words_of(segment);
969
2126
  const command_index = after_wrapper(words);
970
- const word = words[command_index];
971
- if (word === void 0) return void 0;
972
- return { name: program_name(word), args: words.slice(command_index + NEXT) };
2127
+ const word2 = words[command_index];
2128
+ if (word2 === void 0) return void 0;
2129
+ return { name: program_name(word2), args: words.slice(command_index + NEXT) };
973
2130
  }
974
2131
  function arguments_of(segment, command) {
975
2132
  const call = program_of(segment);
@@ -1054,16 +2211,16 @@ function is_gh_api(segment) {
1054
2211
  }
1055
2212
  function flags_of(segment) {
1056
2213
  const words = (git_argv.arguments_of(segment, GH_COMMAND) ?? []).map(
1057
- (word) => word.replace(INCLUDE_CLUSTER, "-")
2214
+ (word2) => word2.replace(INCLUDE_CLUSTER, "-")
1058
2215
  );
1059
2216
  let has_value_pending = false;
1060
- return words.map((word, index) => [word, words[index + NEXT2] ?? ""]).filter(([word]) => {
2217
+ return words.map((word2, index) => [word2, words[index + NEXT2] ?? ""]).filter(([word2]) => {
1061
2218
  if (has_value_pending) {
1062
2219
  has_value_pending = false;
1063
2220
  return false;
1064
2221
  }
1065
- has_value_pending = API_VALUE_TAKING_FLAGS.has(word);
1066
- return word.startsWith(FLAG_PREFIX2);
2222
+ has_value_pending = API_VALUE_TAKING_FLAGS.has(word2);
2223
+ return word2.startsWith(FLAG_PREFIX2);
1067
2224
  });
1068
2225
  }
1069
2226
  function method_value(flag, next) {
@@ -1110,9 +2267,9 @@ function file_path(flag, value) {
1110
2267
  }
1111
2268
  function field_source(flag, raw) {
1112
2269
  const value = raw.replaceAll(QUOTES, "");
1113
- const path7 = file_path(flag, value);
1114
- if (path7 === void 0) return { kind: "text", value: field_value(value) };
1115
- return path7 === STANDARD_INPUT ? void 0 : { kind: "file", value: path7 };
2270
+ const path22 = file_path(flag, value);
2271
+ if (path22 === void 0) return { kind: "text", value: field_value(value) };
2272
+ return path22 === STANDARD_INPUT ? void 0 : { kind: "file", value: path22 };
1116
2273
  }
1117
2274
  function field_sources(segment) {
1118
2275
  return flags_of(segment).flatMap(([flag, next]) => {
@@ -1167,16 +2324,16 @@ function placeholder_of(segment, previous = "") {
1167
2324
  if (NUMBER.test(segment)) return "{n}";
1168
2325
  return SHA.test(segment) ? "{sha}" : segment;
1169
2326
  }
1170
- function normalized(path7) {
1171
- const [bare = ""] = path7.replace(/^\//u, "").split("?", 1);
2327
+ function normalized(path22) {
2328
+ const [bare = ""] = path22.replace(/^\//u, "").split("?", 1);
1172
2329
  const segments = bare.split("/");
1173
2330
  const is_repo = segments[0] === OWNER_REPO[0];
1174
2331
  return segments.map(
1175
2332
  (segment, index) => is_repo && index < OWNER_REPO.length ? OWNER_REPO[index] : placeholder_of(segment, segments[index - 1])
1176
2333
  ).join("/");
1177
2334
  }
1178
- function of_api(path7, method = DEFAULT_METHOD) {
1179
- const bare = normalized(path7);
2335
+ function of_api(path22, method = DEFAULT_METHOD) {
2336
+ const bare = normalized(path22);
1180
2337
  return bare === GRAPHQL ? GRAPHQL : `${method.toUpperCase()} ${bare}`;
1181
2338
  }
1182
2339
  function path_of(arguments_) {
@@ -1203,109 +2360,3005 @@ function class_of(kind) {
1203
2360
  }
1204
2361
  var gh_call_kind = { of, of_api, class_of };
1205
2362
 
1206
- // scripts/gh/gh-request-tally.ts
1207
- var STATE_KEY = /* @__PURE__ */ Symbol.for("josh.gh-request-tally");
1208
- function is_state(value) {
1209
- return typeof value === "object" && value !== null && Reflect.has(value, "endpoints");
2363
+ // scripts/run/startup/run-startup.ts
2364
+ import { randomUUID as randomUUID4 } from "node:crypto";
2365
+
2366
+ // scripts/josh/stamp-file.ts
2367
+ import { createHash } from "node:crypto";
2368
+ import { lstatSync, readFileSync as readFileSync5, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
2369
+ import path12 from "node:path";
2370
+
2371
+ // scripts/josh/platform-temporary.ts
2372
+ import { accessSync, constants } from "node:fs";
2373
+ import { tmpdir } from "node:os";
2374
+ var POSIX_TEMP_ROOT = "/tmp";
2375
+ var WINDOWS_PLATFORM = "win32";
2376
+ function is_writable_directory(directory) {
2377
+ try {
2378
+ accessSync(directory, constants.W_OK);
2379
+ return true;
2380
+ } catch {
2381
+ return false;
2382
+ }
1210
2383
  }
1211
- function shared_state() {
1212
- const existing = Reflect.get(globalThis, STATE_KEY);
1213
- if (is_state(existing)) return existing;
1214
- const state = {
1215
- tally: { calls: 0, not_modified: 0 },
1216
- endpoints: /* @__PURE__ */ new Map(),
1217
- core: { read: void 0, start: void 0 }
1218
- };
1219
- Reflect.set(globalThis, STATE_KEY, state);
1220
- return state;
2384
+ function resolve_temporary_root(platform2, can_write = is_writable_directory) {
2385
+ if (platform2 === WINDOWS_PLATFORM) return tmpdir();
2386
+ return can_write(POSIX_TEMP_ROOT) ? POSIX_TEMP_ROOT : tmpdir();
1221
2387
  }
1222
- var { tally, endpoints, core } = shared_state();
1223
- function watch_core(read) {
1224
- core.read = async () => {
1225
- try {
1226
- return await read();
1227
- } catch {
1228
- return void 0;
1229
- }
1230
- };
2388
+ var TEMP_ROOT_KEY = "JOSH_TEMP_ROOT";
2389
+ function temporary_root(override, platform2) {
2390
+ return override === void 0 || override === "" ? resolve_temporary_root(platform2) : override;
1231
2391
  }
1232
- function endpoint_of(kind) {
1233
- const count = endpoints.get(kind) ?? { calls: 0, not_modified: 0 };
1234
- endpoints.set(kind, count);
1235
- return count;
2392
+ var PLATFORM_TEMP_ROOT = temporary_root(process.env[TEMP_ROOT_KEY], process.platform);
2393
+ var platform_temporary = {
2394
+ TEMP_ROOT_KEY,
2395
+ resolve_temporary_root,
2396
+ is_writable_directory,
2397
+ temporary_root
2398
+ };
2399
+
2400
+ // scripts/lib/atomic-write.ts
2401
+ import { randomUUID } from "node:crypto";
2402
+ import { chmodSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
2403
+ import path11 from "node:path";
2404
+ var STAGING_EXTENSION = ".tmp";
2405
+ var CREATE_EXCLUSIVE_FLAG = "wx";
2406
+ function staging_path(target2, staging_directory) {
2407
+ const name = `${path11.basename(target2)}.${String(process.pid)}.${randomUUID()}${STAGING_EXTENSION}`;
2408
+ return path11.join(staging_directory, name);
2409
+ }
2410
+ function write_staged(staging, content, mode) {
2411
+ writeFileSync(staging, content, {
2412
+ flag: CREATE_EXCLUSIVE_FLAG,
2413
+ ...mode !== void 0 && { mode }
2414
+ });
2415
+ if (mode !== void 0) chmodSync(staging, mode);
1236
2416
  }
1237
- function snapshot() {
1238
- const entries = [...endpoints].map(([kind, count]) => [kind, { ...count }]);
1239
- return { ...tally, endpoints: Object.fromEntries(entries) };
2417
+ function replace_file(target2, content, options = {}) {
2418
+ const directory = options.staging_directory ?? path11.dirname(target2);
2419
+ const staging = staging_path(target2, directory);
2420
+ mkdirSync(directory, { recursive: true });
2421
+ try {
2422
+ write_staged(staging, content, options.mode);
2423
+ renameSync(staging, target2);
2424
+ } finally {
2425
+ rmSync(staging, { force: true });
2426
+ }
1240
2427
  }
1241
- function count_call(kind) {
1242
- if (core.read !== void 0) core.start ??= core.read();
1243
- tally.calls += 1;
1244
- endpoint_of(kind).calls += 1;
2428
+ var atomic_write = { replace_file };
2429
+
2430
+ // scripts/josh/stamp-file.ts
2431
+ var HASH_ALGORITHM = "sha256";
2432
+ var STAMP_SUFFIX = ".json";
2433
+ var STAMP_KEY_LENGTH = 16;
2434
+ var STAMP_FILE_MODE = 384;
2435
+ var STAMP_WRITE_FLAG = "wx";
2436
+ var STAMP_CREATE_FLAG = STAMP_WRITE_FLAG;
2437
+ var EXISTS_ERROR_CODE = "EEXIST";
2438
+ var ACCOUNT_KEY_SEPARATOR = ":";
2439
+ function digest(content) {
2440
+ return createHash(HASH_ALGORITHM).update(content).digest("hex");
2441
+ }
2442
+ function account_key() {
2443
+ return String(process.getuid?.() ?? "");
2444
+ }
2445
+ function stamp_name(prefix, root2 = PACKAGE_DIR, suffix = STAMP_SUFFIX) {
2446
+ const key = digest(`${account_key()}${ACCOUNT_KEY_SEPARATOR}${root2}`).slice(0, STAMP_KEY_LENGTH);
2447
+ return `${prefix}${key}${suffix}`;
2448
+ }
2449
+ function stamp_path(prefix, root2 = PACKAGE_DIR, suffix = STAMP_SUFFIX) {
2450
+ return path12.join(PLATFORM_TEMP_ROOT, stamp_name(prefix, root2, suffix));
2451
+ }
2452
+ function write_exclusively(target2, content) {
2453
+ rmSync2(target2, { force: true });
2454
+ writeFileSync2(target2, content, { flag: STAMP_WRITE_FLAG, mode: STAMP_FILE_MODE });
2455
+ return target2;
2456
+ }
2457
+ function write_stamp(target2, payload) {
2458
+ return write_exclusively(target2, JSON.stringify(payload));
2459
+ }
2460
+ function is_own_regular_file(source) {
2461
+ const stats = lstatSync(source);
2462
+ if (!stats.isFile()) return false;
2463
+ const uid = process.getuid?.();
2464
+ return uid === void 0 || stats.uid === uid;
2465
+ }
2466
+ function is_foreign_file(target2) {
2467
+ try {
2468
+ return lstatSync(target2).isFile() && !is_own_regular_file(target2);
2469
+ } catch {
2470
+ return false;
2471
+ }
1245
2472
  }
1246
- function count_not_modified(kind) {
1247
- tally.not_modified += 1;
1248
- endpoint_of(kind).not_modified += 1;
2473
+ function replace_text_stamp(target2, text) {
2474
+ if (is_foreign_file(target2)) {
2475
+ throw new Error(`refusing to replace another account's file: ${target2}`);
2476
+ }
2477
+ atomic_write.replace_file(target2, text, { mode: STAMP_FILE_MODE });
2478
+ return target2;
1249
2479
  }
1250
- function to_delta(start, end) {
1251
- if (start === void 0 || start.reset_ms !== end?.reset_ms) return void 0;
1252
- return end.used - start.used;
2480
+ function replace_stamp(target2, payload) {
2481
+ return replace_text_stamp(target2, JSON.stringify(payload));
1253
2482
  }
1254
- async function core_delta() {
1255
- if (core.read === void 0 || core.start === void 0) return void 0;
1256
- const [start, end] = await Promise.all([core.start, core.read()]);
1257
- return to_delta(start, end);
2483
+ function write_text_stamp(target2, text) {
2484
+ return write_exclusively(target2, text);
1258
2485
  }
1259
- function reset() {
1260
- tally.calls = 0;
1261
- tally.not_modified = 0;
1262
- endpoints.clear();
1263
- core.read = void 0;
1264
- core.start = void 0;
2486
+ function create_stamp(target2, payload) {
2487
+ try {
2488
+ writeFileSync2(target2, JSON.stringify(payload), {
2489
+ flag: STAMP_CREATE_FLAG,
2490
+ mode: STAMP_FILE_MODE
2491
+ });
2492
+ return true;
2493
+ } catch (error) {
2494
+ if (error.code === EXISTS_ERROR_CODE) return false;
2495
+ throw error;
2496
+ }
1265
2497
  }
1266
- var gh_request_tally = {
1267
- watch_core,
1268
- count_call,
1269
- count_not_modified,
1270
- snapshot,
1271
- core_delta,
1272
- reset
1273
- };
1274
-
1275
- // scripts/gh/git-gh-check.ts
1276
- import { execa } from "execa";
1277
- var GH_NOT_INSTALLED_MSG = "gh CLI is not installed. Install it from https://cli.github.com/";
1278
- var gh_check = {};
1279
- async function run_gh_check() {
2498
+ function remove_stamp(target2) {
2499
+ rmSync2(target2, { force: true });
2500
+ }
2501
+ function read_stamp_text(source) {
1280
2502
  try {
1281
- await execa("gh", ["--version"], { timeout: COMMAND_TIMEOUT_MS });
2503
+ if (!is_own_regular_file(source)) return void 0;
2504
+ return readFileSync5(source, "utf8");
1282
2505
  } catch {
1283
- delete gh_check.promise;
1284
- throw new Error(GH_NOT_INSTALLED_MSG);
2506
+ return void 0;
1285
2507
  }
1286
2508
  }
1287
- async function check_gh_installed() {
1288
- gh_check.promise ??= run_gh_check();
1289
- await gh_check.promise;
2509
+ var stamp_file = {
2510
+ create_stamp,
2511
+ digest,
2512
+ is_own_regular_file,
2513
+ read_stamp_text,
2514
+ replace_stamp,
2515
+ replace_text_stamp,
2516
+ remove_stamp,
2517
+ stamp_name,
2518
+ stamp_path,
2519
+ write_stamp,
2520
+ write_text_stamp
2521
+ };
2522
+
2523
+ // scripts/lane/lane-ledger-kind.ts
2524
+ var KIND = {
2525
+ STARTUP: "startup",
2526
+ MERGE: "merge",
2527
+ GATE: "gate",
2528
+ LOAD: "load",
2529
+ DISPATCH: "dispatch",
2530
+ STAGE: "stage",
2531
+ STOP: "stop",
2532
+ CHAIN: "chain",
2533
+ OVERLAP: "overlap",
2534
+ HELD: "held",
2535
+ RELEASED: "released",
2536
+ ROUND_ONE: "round-one",
2537
+ ROUND_TWO: "round-two",
2538
+ OFFERABLE: "offerable",
2539
+ OFFER: "offer",
2540
+ CORE_WAIT: "core-wait",
2541
+ CORE_ADMISSION: "core-admission",
2542
+ UNIT_FILES: "unit-files",
2543
+ TEST_RELATED: "test-related",
2544
+ TEST_PINNED: "test-pinned",
2545
+ SPLIT_NOTICE: "split-notice",
2546
+ SPLIT_FILED: "split-filed",
2547
+ UNPLANNED_NOTICE: "unplanned-notice",
2548
+ LANE_STATE: "lane-state",
2549
+ PUSH_MISS: "push-miss",
2550
+ EARLY_PUSH: "early-push",
2551
+ SHIP_LAP: "ship-lap",
2552
+ SIZE: "size",
2553
+ LIMIT: "limit"
2554
+ };
2555
+ var lane_ledger_kind = { KIND };
2556
+
2557
+ // scripts/lib/inherited-scope.ts
2558
+ import { AsyncLocalStorage } from "node:async_hooks";
2559
+ function storage(key) {
2560
+ const symbol = Symbol.for(key);
2561
+ const existing = Reflect.get(globalThis, symbol);
2562
+ const scope2 = existing instanceof AsyncLocalStorage ? existing : new AsyncLocalStorage();
2563
+ Reflect.set(globalThis, symbol, scope2);
2564
+ return scope2;
2565
+ }
2566
+ function create(key, schema) {
2567
+ const scope2 = storage(key);
2568
+ function local() {
2569
+ return schema.safeParse(scope2.getStore()).data;
2570
+ }
2571
+ function current() {
2572
+ return local() ?? json_value.parse_with(process.env[key] ?? "", schema);
2573
+ }
2574
+ async function within(value, run3) {
2575
+ return await scope2.run(value, run3);
2576
+ }
2577
+ function environment() {
2578
+ const value = current();
2579
+ return value === void 0 ? {} : { [key]: JSON.stringify(value) };
2580
+ }
2581
+ return { current, local, within, environment };
1290
2582
  }
2583
+ var inherited_scope = { create };
1291
2584
 
1292
- // scripts/git/parse-json-array.ts
1293
- function parse_json_loose(raw_json) {
1294
- return json_value.parse_or_undefined(raw_json);
2585
+ // scripts/run/startup/run-startup-schema.ts
2586
+ import { z as z6 } from "zod";
2587
+ var scope_schema = z6.object({
2588
+ run: z6.string(),
2589
+ attempt: z6.string(),
2590
+ issue: z6.string().optional(),
2591
+ span: z6.string().optional(),
2592
+ parent: z6.string().optional(),
2593
+ destination: z6.string().optional()
2594
+ });
2595
+ var entry_schema = scope_schema.omit({ destination: true }).extend({
2596
+ kind: z6.literal(lane_ledger_kind.KIND.STARTUP),
2597
+ at: z6.string(),
2598
+ at_ms: z6.number().nonnegative().optional(),
2599
+ id: z6.string(),
2600
+ parent: z6.string().optional(),
2601
+ phase: z6.string(),
2602
+ edge: z6.enum(["start", "done", "failed", "waiting", "api", "cache"]),
2603
+ elapsed_ms: z6.number().nonnegative().optional(),
2604
+ metric: z6.string().optional(),
2605
+ key: z6.string().optional()
2606
+ });
2607
+ var run_startup_schema = { scope_schema, entry_schema };
2608
+
2609
+ // scripts/run/startup/run-startup-store.ts
2610
+ import { randomUUID as randomUUID3 } from "node:crypto";
2611
+
2612
+ // scripts/lane/lane-ledger-write.ts
2613
+ import { closeSync, constants as constants3, openSync, writeSync } from "node:fs";
2614
+
2615
+ // scripts/josh/durable-state.ts
2616
+ import { mkdirSync as mkdirSync2 } from "node:fs";
2617
+ import path16 from "node:path";
2618
+
2619
+ // scripts/git/git-common-directory.ts
2620
+ import { execFileSync } from "node:child_process";
2621
+
2622
+ // scripts/josh/durable-state-root.ts
2623
+ import path13 from "node:path";
2624
+ var STATE_DIRECTORY = "josh";
2625
+ var RUN_STATE_DIRECTORY = "run-state";
2626
+ var OVERRIDE_STATE_DIRECTORY = "josh-state";
2627
+ function state_root(override, read_common) {
2628
+ if (override !== void 0 && override !== "") {
2629
+ return path13.join(override, OVERRIDE_STATE_DIRECTORY);
2630
+ }
2631
+ const common = read_common();
2632
+ if (common === void 0) return PLATFORM_TEMP_ROOT;
2633
+ return path13.join(common, STATE_DIRECTORY, RUN_STATE_DIRECTORY);
2634
+ }
2635
+ var STATE_ROOT_OVERRIDE = process.env[platform_temporary.TEMP_ROOT_KEY];
2636
+ var PREFIX = {
2637
+ CARRY: "josh-run-carry-",
2638
+ ENDED: "josh-run-ended-",
2639
+ EVENTS: "josh-run-events-",
2640
+ LANE_STATE: "josh-lane-state-",
2641
+ LANE_LEDGER: "josh-lane-ledger-",
2642
+ WAKE_LOG: "josh-run-wake-log-",
2643
+ BACKLOGRUN_LAUNCH: "josh-backlogrun-launch-",
2644
+ BACKLOGRUN_LOG: "josh-backlogrun-log-",
2645
+ HANDOFF_LOG: "josh-run-handoff-log-",
2646
+ SHIP_LOG: "josh-ship-log-",
2647
+ SHIP_RESULT: "josh-ship-result-",
2648
+ LANE_DISPATCH: "josh-lane-dispatch-",
2649
+ LANE_PLAN: "josh-lane-plan-",
2650
+ INVESTIGATION: "josh-investigation-record-",
2651
+ GH_USAGE: "josh-gh-usage-"
2652
+ };
2653
+ var durable_state_root = {
2654
+ PREFIX,
2655
+ STATE_DIRECTORY,
2656
+ STATE_ROOT_OVERRIDE,
2657
+ state_root
2658
+ };
2659
+
2660
+ // scripts/git/constants.ts
2661
+ import { platform } from "node:os";
2662
+ var GIT_COMMAND_UNIX = "/usr/bin/git";
2663
+ var PORCELAIN_FLAG = "--porcelain";
2664
+ var UNTRACKED_FILES_FLAG = "--untracked-files=all";
2665
+ var GIT_BINARY_KEY = "JOSH_GIT_BINARY";
2666
+ function get_git_command() {
2667
+ if (platform() === "win32") return String.raw`"C:\Program Files\Git\cmd\git.exe"`;
2668
+ return GIT_COMMAND_UNIX;
2669
+ }
2670
+ function get_git_command_for_spawn() {
2671
+ const binary = process.env[GIT_BINARY_KEY];
2672
+ if (binary !== void 0 && binary !== "") return binary;
2673
+ if (platform() === "win32") return String.raw`C:\Program Files\Git\cmd\git.exe`;
2674
+ return GIT_COMMAND_UNIX;
2675
+ }
2676
+ var git_utilities = {
2677
+ get_git_command,
2678
+ get_git_command_for_spawn
2679
+ };
2680
+
2681
+ // scripts/git/git-spawn.ts
2682
+ import { execa as execa3 } from "execa";
2683
+
2684
+ // scripts/git/git-push-transport.ts
2685
+ import { execa as execa2 } from "execa";
2686
+
2687
+ // scripts/git/git-ssh-keepalive.ts
2688
+ import { execa } from "execa";
2689
+ var SSH_KEEPALIVE_OPTIONS = "-o ServerAliveInterval=15 -o ServerAliveCountMax=3";
2690
+ var SSH_COMMAND_VARIABLE = "GIT_SSH_COMMAND";
2691
+ var SSH_LEGACY_VARIABLE = "GIT_SSH";
2692
+ var KEEPALIVE_SSH_COMMAND = `ssh ${SSH_KEEPALIVE_OPTIONS}`;
2693
+ var SSH_COMMAND_CONFIG_KEY = "core.sshCommand";
2694
+ var CONFIG_PROBE_ARGUMENTS = ["config", "--get", SSH_COMMAND_CONFIG_KEY];
2695
+ var PROBE_OPTIONS = { timeout: PROBE_TIMEOUT_MS };
2696
+ function to_environment_value(name) {
2697
+ return process.env[name]?.trim() ?? "";
2698
+ }
2699
+ function to_configured_ssh_command() {
2700
+ const from_command = to_environment_value(SSH_COMMAND_VARIABLE);
2701
+ return from_command === "" ? to_environment_value(SSH_LEGACY_VARIABLE) : from_command;
2702
+ }
2703
+ async function has_configured_ssh_command() {
2704
+ if (to_configured_ssh_command() !== "") return true;
2705
+ try {
2706
+ const git_command_bin = git_utilities.get_git_command_for_spawn();
2707
+ const { stdout } = await execa(git_command_bin, CONFIG_PROBE_ARGUMENTS, PROBE_OPTIONS);
2708
+ return stdout.trim() !== "";
2709
+ } catch (error) {
2710
+ return has_timed_out(error);
2711
+ }
1295
2712
  }
1296
- function parse_json_object_or_undefined(raw_json, schema) {
1297
- const value = parse_json_loose(raw_json);
1298
- if (value === void 0) return void 0;
1299
- return schema.parse(value);
2713
+ async function to_environment() {
2714
+ const should_keep_alive = !await has_configured_ssh_command();
2715
+ return should_keep_alive ? { [SSH_COMMAND_VARIABLE]: KEEPALIVE_SSH_COMMAND } : {};
1300
2716
  }
1301
- var parse_json = {
1302
- parse_json_object_or_undefined
2717
+ var git_ssh_keepalive = {
2718
+ to_environment
1303
2719
  };
1304
2720
 
1305
- // scripts/gh/git-gh-failure.ts
1306
- import { z as z4 } from "zod";
1307
- var error_document_schema = z4.object({ status: z4.union([z4.string(), z4.number()]).optional() }).catch({});
1308
- var GH_FAILURE_FIELD = "gh_failure";
2721
+ // scripts/git/git-push-transport.ts
2722
+ var PUSH_TIMEOUT_SECONDS = 120;
2723
+ var PUSH_TIMEOUT_MS = PUSH_TIMEOUT_SECONDS * MS_PER_SECOND;
2724
+ var PUSH_TIMEOUT_LABEL = `${String(PUSH_TIMEOUT_SECONDS)}s`;
2725
+ var PUSH_TIMEOUT_MESSAGE = "git push timed out";
2726
+ var PUSH_SUBCOMMAND = "push";
2727
+ async function to_push_options() {
2728
+ return {
2729
+ stdio: "inherit",
2730
+ timeout: PUSH_TIMEOUT_MS,
2731
+ env: await git_ssh_keepalive.to_environment()
2732
+ };
2733
+ }
2734
+ async function did_push_time_out(arguments_list) {
2735
+ const git_command_bin = git_utilities.get_git_command_for_spawn();
2736
+ const options = await to_push_options();
2737
+ try {
2738
+ await execa2(git_command_bin, [PUSH_SUBCOMMAND, ...arguments_list], options);
2739
+ return false;
2740
+ } catch (error) {
2741
+ if (has_timed_out(error)) return true;
2742
+ throw create_spawn_error(PUSH_SUBCOMMAND, get_exit_code(error));
2743
+ }
2744
+ }
2745
+ function to_manual_command(arguments_list) {
2746
+ return ["git", PUSH_SUBCOMMAND, ...arguments_list].join(" ");
2747
+ }
2748
+ function to_retry_notice(arguments_list) {
2749
+ return `${PUSH_TIMEOUT_MESSAGE} after ${PUSH_TIMEOUT_LABEL} \u2014 retrying once: ${to_manual_command(arguments_list)}`;
2750
+ }
2751
+ function create_timeout_error(arguments_list) {
2752
+ const message = `${PUSH_TIMEOUT_MESSAGE} twice (${PUSH_TIMEOUT_LABEL} each). Re-run it by hand: ${to_manual_command(arguments_list)}`;
2753
+ return new Error(message, { cause: { exit_code: TIMEOUT_EXIT_CODE } });
2754
+ }
2755
+ async function push(arguments_list) {
2756
+ if (!await did_push_time_out(arguments_list)) return;
2757
+ console.warn(to_retry_notice(arguments_list));
2758
+ if (!await did_push_time_out(arguments_list)) return;
2759
+ throw create_timeout_error(arguments_list);
2760
+ }
2761
+ var git_push_transport = {
2762
+ push
2763
+ };
2764
+
2765
+ // scripts/git/git-spawn.ts
2766
+ async function read2(arguments_, timeout_ms = GIT_TIMEOUT_MS) {
2767
+ const git_cmd = git_utilities.get_git_command_for_spawn();
2768
+ const { stdout } = await execa3(git_cmd, arguments_, { timeout: timeout_ms });
2769
+ return stdout.trimEnd();
2770
+ }
2771
+ var REMOTE_TIMEOUT_MS = PUSH_TIMEOUT_MS;
2772
+ function to_budget_error(command, error, timeout_ms) {
2773
+ if (!has_timed_out(error)) return create_spawn_error(command, get_exit_code(error));
2774
+ const seconds = String(Math.round(timeout_ms / MS_PER_SECOND));
2775
+ return new Error(`git ${command} timed out after ${seconds}s`, {
2776
+ cause: { exit_code: TIMEOUT_EXIT_CODE }
2777
+ });
2778
+ }
2779
+ async function spawn_remote(arguments_, options) {
2780
+ const git_cmd = git_utilities.get_git_command_for_spawn();
2781
+ try {
2782
+ const { stdout } = await execa3(git_cmd, arguments_, options);
2783
+ return typeof stdout === "string" ? stdout.trimEnd() : "";
2784
+ } catch (error) {
2785
+ throw to_budget_error(arguments_[0] ?? "", error, options.timeout);
2786
+ }
2787
+ }
2788
+ async function read_remote(arguments_, timeout_ms = REMOTE_TIMEOUT_MS) {
2789
+ return await spawn_remote(arguments_, {
2790
+ timeout: timeout_ms,
2791
+ env: await git_ssh_keepalive.to_environment()
2792
+ });
2793
+ }
2794
+ async function with_output_remote(command, arguments_list) {
2795
+ await spawn_remote([command, ...arguments_list], {
2796
+ stdio: "inherit",
2797
+ timeout: REMOTE_TIMEOUT_MS,
2798
+ env: await git_ssh_keepalive.to_environment()
2799
+ });
2800
+ }
2801
+ async function with_output(command, arguments_list, options = {}) {
2802
+ const { config_options = [], timeout_ms = GIT_TIMEOUT_MS } = options;
2803
+ const git_command_bin = git_utilities.get_git_command_for_spawn();
2804
+ const spawn_arguments = [...config_options, command, ...arguments_list];
2805
+ try {
2806
+ await execa3(git_command_bin, spawn_arguments, { stdio: "inherit", timeout: timeout_ms });
2807
+ } catch (error) {
2808
+ throw to_budget_error(command, error, timeout_ms);
2809
+ }
2810
+ }
2811
+ var git_spawn = {
2812
+ read: read2,
2813
+ read_remote,
2814
+ with_output,
2815
+ with_output_remote
2816
+ };
2817
+
2818
+ // scripts/git/git-diff-reads.ts
2819
+ var REFS_REMOTES_ORIGIN_PREFIX = "refs/remotes/origin/";
2820
+ var NAME_ONLY_FLAG = "--name-only";
2821
+ var DEFAULT_BRANCH_FALLBACK = "main";
2822
+ var DEFAULT_BRANCH_ARGUMENTS = ["symbolic-ref", "refs/remotes/origin/HEAD"];
2823
+ function default_branch_of(output) {
2824
+ const trimmed2 = output?.trim() ?? "";
2825
+ if (!trimmed2.startsWith(REFS_REMOTES_ORIGIN_PREFIX)) return DEFAULT_BRANCH_FALLBACK;
2826
+ return trimmed2.slice(REFS_REMOTES_ORIGIN_PREFIX.length);
2827
+ }
2828
+ async function get_default_branch() {
2829
+ try {
2830
+ return default_branch_of(await git_spawn.read([...DEFAULT_BRANCH_ARGUMENTS]));
2831
+ } catch {
2832
+ return DEFAULT_BRANCH_FALLBACK;
2833
+ }
2834
+ }
2835
+ var MERGE_BASE_COMMAND = "merge-base";
2836
+ function reference_check_arguments(reference) {
2837
+ return ["rev-parse", "--verify", "--quiet", reference];
2838
+ }
2839
+ function remote_reference_of(default_branch) {
2840
+ return `${REFS_REMOTES_ORIGIN_PREFIX}${default_branch}`;
2841
+ }
2842
+ async function reference_exists(reference) {
2843
+ try {
2844
+ await git_spawn.read([...reference_check_arguments(reference)]);
2845
+ return true;
2846
+ } catch {
2847
+ return false;
2848
+ }
2849
+ }
2850
+ async function default_branch_reference() {
2851
+ const default_branch = await get_default_branch();
2852
+ const remote_reference = remote_reference_of(default_branch);
2853
+ return await reference_exists(remote_reference) ? remote_reference : default_branch;
2854
+ }
2855
+ function merge_base_arguments(reference) {
2856
+ return [MERGE_BASE_COMMAND, reference, "HEAD"];
2857
+ }
2858
+ function incoming_base_arguments(reference) {
2859
+ return [MERGE_BASE_COMMAND, reference, "MERGE_HEAD"];
2860
+ }
2861
+ function later_base_arguments(base, incoming) {
2862
+ return [MERGE_BASE_COMMAND, "--independent", base, incoming];
2863
+ }
2864
+ function later_base_of(output, base) {
2865
+ const [later = ""] = output?.split("\n", 1) ?? [];
2866
+ return later === "" ? base : later;
2867
+ }
2868
+ async function change_base() {
2869
+ const default_branch = await default_branch_reference();
2870
+ try {
2871
+ return await git_spawn.read([...merge_base_arguments(default_branch)]);
2872
+ } catch {
2873
+ return default_branch;
2874
+ }
2875
+ }
2876
+ async function diff_main(file_path2) {
2877
+ return await git_spawn.read(["diff", await change_base(), "--", file_path2]);
2878
+ }
2879
+ var NO_PATH_QUOTING = ["-c", "core.quotePath=false"];
2880
+ var NO_RELATIVE_PATHS = "--no-relative";
2881
+ var NO_RENAME_DETECTION = "--no-renames";
2882
+ async function change_base_commit() {
2883
+ return await git_spawn.read(["rev-parse", await change_base()]);
2884
+ }
2885
+ function names_since_arguments(commit2) {
2886
+ return [
2887
+ ...NO_PATH_QUOTING,
2888
+ "diff",
2889
+ NAME_ONLY_FLAG,
2890
+ NO_RELATIVE_PATHS,
2891
+ NO_RENAME_DETECTION,
2892
+ commit2,
2893
+ "--"
2894
+ ];
2895
+ }
2896
+ async function diff_names_since(commit2) {
2897
+ return await git_spawn.read([...names_since_arguments(commit2)]);
2898
+ }
2899
+ async function tree_names_at(commit2, paths) {
2900
+ return await git_spawn.read([
2901
+ ...NO_PATH_QUOTING,
2902
+ "ls-tree",
2903
+ "-r",
2904
+ NAME_ONLY_FLAG,
2905
+ "--full-tree",
2906
+ commit2,
2907
+ "--",
2908
+ ...paths
2909
+ ]);
2910
+ }
2911
+ async function diff_main_names() {
2912
+ return await diff_names_since(await change_base());
2913
+ }
2914
+ async function diff_cached_names() {
2915
+ return await git_spawn.read([
2916
+ ...NO_PATH_QUOTING,
2917
+ "diff",
2918
+ "--cached",
2919
+ NAME_ONLY_FLAG,
2920
+ NO_RELATIVE_PATHS,
2921
+ NO_RENAME_DETECTION
2922
+ ]);
2923
+ }
2924
+ async function diff_numstat_since(base) {
2925
+ return await git_spawn.read([
2926
+ ...NO_PATH_QUOTING,
2927
+ "diff",
2928
+ "--numstat",
2929
+ NO_RELATIVE_PATHS,
2930
+ NO_RENAME_DETECTION,
2931
+ base,
2932
+ "--"
2933
+ ]);
2934
+ }
2935
+ var WHOLE_TREE_PATHSPEC = ":/";
2936
+ var UNTRACKED_ARGUMENTS = [
2937
+ ...NO_PATH_QUOTING,
2938
+ "ls-files",
2939
+ "--others",
2940
+ "--exclude-standard",
2941
+ "--full-name",
2942
+ WHOLE_TREE_PATHSPEC
2943
+ ];
2944
+ async function untracked_names() {
2945
+ return await git_spawn.read([...UNTRACKED_ARGUMENTS]);
2946
+ }
2947
+ var git_diff_reads = {
2948
+ DEFAULT_BRANCH_ARGUMENTS,
2949
+ UNTRACKED_ARGUMENTS,
2950
+ change_base,
2951
+ change_base_commit,
2952
+ default_branch_of,
2953
+ default_branch_reference,
2954
+ diff_cached_names,
2955
+ diff_main,
2956
+ diff_main_names,
2957
+ diff_numstat_since,
2958
+ diff_names_since,
2959
+ get_default_branch,
2960
+ incoming_base_arguments,
2961
+ later_base_arguments,
2962
+ later_base_of,
2963
+ merge_base_arguments,
2964
+ names_since_arguments,
2965
+ reference_check_arguments,
2966
+ remote_reference_of,
2967
+ tree_names_at,
2968
+ untracked_names
2969
+ };
2970
+
2971
+ // scripts/git/git-pre-push-hook.ts
2972
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
2973
+ import { tmpdir as tmpdir2 } from "node:os";
2974
+ import path14 from "node:path";
2975
+ var REMOTE = "origin";
2976
+ var HOOK_NAME = "pre-push";
2977
+ var PROBE_HOOK_NAME = "kit-hook-run-probe";
2978
+ var ALLOW_UNKNOWN_HOOK_NAME_FLAG = "--allow-unknown-hook-name";
2979
+ var HOOK_RUN = "run";
2980
+ var STDIN_FILE = "refs";
2981
+ var TEMPORARY_PREFIX = "kit-pre-push-";
2982
+ var ZERO_DIGIT = "0";
2983
+ async function read_remote_oid(branch2) {
2984
+ try {
2985
+ return await git_spawn.read([
2986
+ "rev-parse",
2987
+ "--verify",
2988
+ "--quiet",
2989
+ `refs/remotes/${REMOTE}/${branch2}`
2990
+ ]);
2991
+ } catch {
2992
+ return void 0;
2993
+ }
2994
+ }
2995
+ async function read_push_references() {
2996
+ const [branch2, local_oid] = await Promise.all([
2997
+ git_spawn.read(["rev-parse", "--abbrev-ref", "HEAD"]),
2998
+ git_spawn.read(["rev-parse", "HEAD"])
2999
+ ]);
3000
+ return { branch: branch2, local_oid, remote_oid: await read_remote_oid(branch2) };
3001
+ }
3002
+ function to_stdin_line(references) {
3003
+ const reference = `refs/heads/${references.branch}`;
3004
+ const remote_oid = references.remote_oid ?? ZERO_DIGIT.repeat(references.local_oid.length);
3005
+ return `${reference} ${references.local_oid} ${reference} ${remote_oid}
3006
+ `;
3007
+ }
3008
+ function to_hook_run_arguments(stdin_path, hook_name) {
3009
+ return [HOOK_RUN, "--ignore-missing", `--to-stdin=${stdin_path}`, hook_name];
3010
+ }
3011
+ async function can_probe(probe_arguments) {
3012
+ try {
3013
+ await git_spawn.read(["hook", ...probe_arguments]);
3014
+ return true;
3015
+ } catch {
3016
+ return false;
3017
+ }
3018
+ }
3019
+ async function can_run_hooks(stdin_path) {
3020
+ const [, ...options] = to_hook_run_arguments(stdin_path, PROBE_HOOK_NAME);
3021
+ if (await can_probe([HOOK_RUN, ALLOW_UNKNOWN_HOOK_NAME_FLAG, ...options])) return true;
3022
+ return await can_probe([HOOK_RUN, ...options]);
3023
+ }
3024
+ async function run_with_stdin(stdin_line) {
3025
+ const directory = await mkdtemp(path14.join(tmpdir2(), TEMPORARY_PREFIX));
3026
+ const stdin_path = path14.join(directory, STDIN_FILE);
3027
+ try {
3028
+ await writeFile(stdin_path, stdin_line);
3029
+ if (!await can_run_hooks(stdin_path)) return false;
3030
+ const url = await git_spawn.read(["remote", "get-url", REMOTE]);
3031
+ await git_spawn.with_output(
3032
+ "hook",
3033
+ [...to_hook_run_arguments(stdin_path, HOOK_NAME), "--", REMOTE, url],
3034
+ { timeout_ms: SUITE_TIMEOUT_MS }
3035
+ );
3036
+ return true;
3037
+ } finally {
3038
+ await rm(directory, { force: true, recursive: true });
3039
+ }
3040
+ }
3041
+ async function run() {
3042
+ const references = await read_push_references();
3043
+ if (references.local_oid === references.remote_oid) return true;
3044
+ return await run_with_stdin(to_stdin_line(references));
3045
+ }
3046
+ var git_pre_push_hook = {
3047
+ run
3048
+ };
3049
+
3050
+ // scripts/lib/spawn-exit.ts
3051
+ function read_spawn_stdout(result) {
3052
+ return result.stdout ?? "";
3053
+ }
3054
+ function read_spawn_stderr(result) {
3055
+ return result.stderr ?? "";
3056
+ }
3057
+
3058
+ // scripts/git/git-spawn-sync.ts
3059
+ import { execaSync } from "execa";
3060
+
3061
+ // scripts/git/git-location-environment.ts
3062
+ var GIT_LOCATION_VARIABLES = [
3063
+ "GIT_ALTERNATE_OBJECT_DIRECTORIES",
3064
+ "GIT_COMMON_DIR",
3065
+ "GIT_DIR",
3066
+ "GIT_INDEX_FILE",
3067
+ "GIT_NAMESPACE",
3068
+ "GIT_OBJECT_DIRECTORY",
3069
+ "GIT_WORK_TREE"
3070
+ ];
3071
+ function location_free_environment() {
3072
+ return Object.fromEntries(GIT_LOCATION_VARIABLES.map((name) => [name, void 0]));
3073
+ }
3074
+ function forget(name) {
3075
+ Reflect.deleteProperty(process.env, name);
3076
+ }
3077
+ function restore_one(name, value) {
3078
+ if (value === void 0) forget(name);
3079
+ else process.env[name] = value;
3080
+ }
3081
+ function clear_git_location_variables() {
3082
+ const previous = GIT_LOCATION_VARIABLES.map((name) => [name, process.env[name]]);
3083
+ for (const [name] of previous) forget(name);
3084
+ return () => {
3085
+ for (const [name, value] of previous) restore_one(name, value);
3086
+ };
3087
+ }
3088
+ var git_location_environment = { clear_git_location_variables, location_free_environment };
3089
+
3090
+ // scripts/git/git-spawn-sync.ts
3091
+ var SUCCESS_EXIT_CODE = 0;
3092
+ var C_LOCALE = { LC_ALL: "C", LANGUAGE: "C" };
3093
+ function run2(args, options = {}) {
3094
+ const result = execaSync(git_utilities.get_git_command_for_spawn(), args, {
3095
+ ...options,
3096
+ extendEnv: true,
3097
+ reject: false,
3098
+ timeout: options.timeout ?? GIT_TIMEOUT_MS
3099
+ });
3100
+ return {
3101
+ exit_code: result.exitCode,
3102
+ stdout: read_spawn_stdout(result),
3103
+ stderr: read_spawn_stderr(result)
3104
+ };
3105
+ }
3106
+ function read3(args, options = {}) {
3107
+ const result = run2(args, options);
3108
+ return result.exit_code === SUCCESS_EXIT_CODE ? result.stdout.trim() : void 0;
3109
+ }
3110
+ function located(cwd) {
3111
+ if (cwd === void 0) return {};
3112
+ return { cwd, env: git_location_environment.location_free_environment() };
3113
+ }
3114
+ function origin_url(cwd) {
3115
+ return read3(["config", "--get", "remote.origin.url"], located(cwd));
3116
+ }
3117
+ function toplevel(timeout = GIT_TIMEOUT_MS) {
3118
+ return run2(["rev-parse", "--show-toplevel"], { env: C_LOCALE, timeout });
3119
+ }
3120
+ var git_spawn_sync = { GIT_TIMEOUT_MS, C_LOCALE, run: run2, read: read3, located, origin_url, toplevel };
3121
+
3122
+ // scripts/git/git-command.ts
3123
+ var BRANCH_ARGUMENTS = ["rev-parse", "--abbrev-ref", "HEAD"];
3124
+ async function branch() {
3125
+ return await git_spawn.read([...BRANCH_ARGUMENTS]);
3126
+ }
3127
+ async function branch_at(directory) {
3128
+ return await git_spawn.read(["-C", directory, ...BRANCH_ARGUMENTS]);
3129
+ }
3130
+ async function status(directory) {
3131
+ const location = directory === void 0 ? [] : ["-C", directory];
3132
+ return await git_spawn.read([...location, "status", PORCELAIN_FLAG, UNTRACKED_FILES_FLAG]);
3133
+ }
3134
+ async function repository_root() {
3135
+ const result = git_spawn_sync.toplevel();
3136
+ if (result.exit_code !== 0) throw create_spawn_error("rev-parse", result.exit_code);
3137
+ return result.stdout.trim();
3138
+ }
3139
+ async function head_commit() {
3140
+ return await git_spawn.read(["rev-parse", "HEAD"]);
3141
+ }
3142
+ var GIT_DIRECTORY_ARGUMENTS = [
3143
+ "rev-parse",
3144
+ "--absolute-git-dir",
3145
+ "--path-format=absolute",
3146
+ "--git-common-dir"
3147
+ ];
3148
+ async function git_directories() {
3149
+ const output = await git_spawn.read([...GIT_DIRECTORY_ARGUMENTS]);
3150
+ return output.split("\n").filter((line) => line !== "");
3151
+ }
3152
+ async function diff_cached(file_path2) {
3153
+ return await git_spawn.read(["diff", "--cached", file_path2]);
3154
+ }
3155
+ async function fetch_branch(branch_name) {
3156
+ const refspec = `+refs/heads/${branch_name}:refs/remotes/origin/${branch_name}`;
3157
+ return await git_spawn.read_remote(["fetch", "origin", refspec]);
3158
+ }
3159
+ async function merge_fast_forward(branch_name) {
3160
+ return await git_spawn.read(["merge", "--ff-only", `origin/${branch_name}`], SUITE_TIMEOUT_MS);
3161
+ }
3162
+ async function fast_forward_local(branch_name) {
3163
+ return await git_spawn.read_remote(["fetch", "origin", `${branch_name}:${branch_name}`]);
3164
+ }
3165
+ async function merge_branch(branch_name, message) {
3166
+ const message_arguments = message === void 0 ? [] : ["-m", message];
3167
+ await git_spawn.with_output("merge", [...message_arguments, `origin/${branch_name}`], {
3168
+ timeout_ms: SUITE_TIMEOUT_MS
3169
+ });
3170
+ }
3171
+ async function checkout_b(branch_name) {
3172
+ return await git_spawn.read(["checkout", "-b", branch_name], SUITE_TIMEOUT_MS);
3173
+ }
3174
+ async function checkout(branch_name) {
3175
+ return await git_spawn.read(["checkout", branch_name], SUITE_TIMEOUT_MS);
3176
+ }
3177
+ async function commit(message) {
3178
+ await git_spawn.with_output("commit", ["-m", message], { timeout_ms: SUITE_TIMEOUT_MS });
3179
+ }
3180
+ async function delete_branch(branch_name) {
3181
+ await git_spawn.read(["branch", "-d", branch_name]);
3182
+ }
3183
+ async function read_commit_count(revisions) {
3184
+ const output = await git_spawn.read(["rev-list", "--count", ...revisions]);
3185
+ const parsed = Number(output);
3186
+ if (output.length > 0 && Number.isFinite(parsed)) return parsed;
3187
+ throw new Error(
3188
+ `\`git rev-list --count ${revisions.join(" ")}\` printed \`${output}\` rather than a count`
3189
+ );
3190
+ }
3191
+ async function commit_count_beyond(base, tip) {
3192
+ return await read_commit_count([`${base}..${tip}`]);
3193
+ }
3194
+ async function commit_count_unpushed(branch_name) {
3195
+ return await read_commit_count([branch_name, "--not", "--remotes"]);
3196
+ }
3197
+ function is_exit_code_128(cause) {
3198
+ return typeof cause === "object" && cause !== null && "exit_code" in cause && cause.exit_code === "128";
3199
+ }
3200
+ function is_upstream_not_set_error(error) {
3201
+ if (!(error instanceof Error)) return false;
3202
+ const { cause } = error;
3203
+ return cause !== void 0 && is_exit_code_128(cause);
3204
+ }
3205
+ var NO_VERIFY_FLAG = "--no-verify";
3206
+ async function push_with_upstream(branch_name, verify_flags) {
3207
+ await git_push_transport.push([...verify_flags, "--set-upstream", "origin", branch_name]);
3208
+ }
3209
+ async function push2() {
3210
+ const verify_flags = await git_pre_push_hook.run() ? [NO_VERIFY_FLAG] : [];
3211
+ try {
3212
+ await git_push_transport.push([...verify_flags]);
3213
+ } catch (error) {
3214
+ if (is_upstream_not_set_error(error)) {
3215
+ const current_branch = await branch();
3216
+ await push_with_upstream(current_branch, verify_flags);
3217
+ return;
3218
+ }
3219
+ throw error;
3220
+ }
3221
+ }
3222
+ async function pull_fast_forward() {
3223
+ await git_spawn.with_output_remote("pull", ["--ff-only"]);
3224
+ }
3225
+ var SHORT_NAME_FORMAT = "--format=%(refname:short)";
3226
+ var REMOTES_FLAG = "--remotes";
3227
+ async function list_branches(flags, pattern) {
3228
+ try {
3229
+ const output = await git_spawn.read([
3230
+ "branch",
3231
+ "--list",
3232
+ SHORT_NAME_FORMAT,
3233
+ ...flags,
3234
+ pattern
3235
+ ]);
3236
+ return output.split("\n").filter((line) => line.trim() !== "");
3237
+ } catch {
3238
+ return [];
3239
+ }
3240
+ }
3241
+ async function branch_names(pattern) {
3242
+ return await list_branches([], pattern);
3243
+ }
3244
+ async function branch_names_remote(pattern) {
3245
+ return await list_branches([REMOTES_FLAG], pattern);
3246
+ }
3247
+ async function branch_exists(branch_name) {
3248
+ const names = await branch_names(branch_name);
3249
+ return names.length > 0;
3250
+ }
3251
+ var ALL_PATHS_PATHSPEC = ":/";
3252
+ function exclude_pathspec(file_path2) {
3253
+ return `:(exclude,top)${file_path2}`;
3254
+ }
3255
+ async function add_tracked(excluded_paths) {
3256
+ const exclusions = excluded_paths.map((file_path2) => exclude_pathspec(file_path2));
3257
+ await git_spawn.read(["add", "-u", "--", ALL_PATHS_PATHSPEC, ...exclusions]);
3258
+ }
3259
+ async function add_path(file_path2) {
3260
+ await git_spawn.with_output("add", ["--", file_path2]);
3261
+ }
3262
+ var FIRST_PARENT_FLAG = "--first-parent";
3263
+ async function log_first_parent(limit, file_path2, tip = "HEAD") {
3264
+ const output = await git_spawn.read([
3265
+ "log",
3266
+ FIRST_PARENT_FLAG,
3267
+ "--format=%H",
3268
+ `-n`,
3269
+ String(limit),
3270
+ tip,
3271
+ "--",
3272
+ file_path2
3273
+ ]);
3274
+ return output.split("\n").filter((line) => line.length > 0);
3275
+ }
3276
+ async function show_file(spec) {
3277
+ return await git_spawn.read(["show", spec]);
3278
+ }
3279
+ var MERGE_COUNT_ARGUMENTS = [
3280
+ "rev-list",
3281
+ "--count",
3282
+ "--merges",
3283
+ FIRST_PARENT_FLAG
3284
+ ];
3285
+ function merge_count_arguments(range) {
3286
+ return [...MERGE_COUNT_ARGUMENTS, range];
3287
+ }
3288
+ async function count_merges(range) {
3289
+ const output = await git_spawn.read(merge_count_arguments(range));
3290
+ const parsed = Number(output.trim());
3291
+ return Number.isFinite(parsed) ? parsed : 0;
3292
+ }
3293
+ var git_command = {
3294
+ GIT_DIRECTORY_ARGUMENTS,
3295
+ branch,
3296
+ branch_at,
3297
+ status,
3298
+ repository_root,
3299
+ head_commit,
3300
+ git_directories,
3301
+ diff_cached,
3302
+ // The default branch, the change base and every reading against it are `git-diff-reads.ts`'s,
3303
+ // re-exported here so no call site, mock or spy moved with them.
3304
+ ...git_diff_reads,
3305
+ fetch_branch,
3306
+ merge_fast_forward,
3307
+ fast_forward_local,
3308
+ merge_branch,
3309
+ checkout_b,
3310
+ checkout,
3311
+ commit,
3312
+ commit_count_beyond,
3313
+ commit_count_unpushed,
3314
+ delete_branch,
3315
+ push: push2,
3316
+ pull_fast_forward,
3317
+ branch_exists,
3318
+ branch_names,
3319
+ branch_names_remote,
3320
+ add_tracked,
3321
+ add_path,
3322
+ log_first_parent,
3323
+ show_file,
3324
+ count_merges,
3325
+ merge_count_arguments,
3326
+ is_upstream_not_set_error
3327
+ };
3328
+
3329
+ // scripts/git/git-common-directory.ts
3330
+ var { STATE_DIRECTORY: STATE_DIRECTORY2 } = durable_state_root;
3331
+ var OWN_GIT_DIRECTORY = 0;
3332
+ var COMMON_GIT_DIRECTORY = 1;
3333
+ var PROBE_TIMEOUT_MS2 = 5e3;
3334
+ var answers = /* @__PURE__ */ new Map();
3335
+ function probe_environment(cwd) {
3336
+ if (cwd === void 0) return process.env;
3337
+ return { ...process.env, ...git_location_environment.location_free_environment() };
3338
+ }
3339
+ function cache_key(cwd) {
3340
+ if (cwd !== void 0) return `explicit\0${cwd}`;
3341
+ const locations = GIT_LOCATION_VARIABLES.map((name) => process.env[name] ?? "");
3342
+ return ["inherited", process.cwd(), ...locations].join("\0");
3343
+ }
3344
+ function read_directories(cwd) {
3345
+ try {
3346
+ const output = execFileSync(
3347
+ git_utilities.get_git_command_for_spawn(),
3348
+ [...git_command.GIT_DIRECTORY_ARGUMENTS],
3349
+ {
3350
+ cwd,
3351
+ env: probe_environment(cwd),
3352
+ encoding: "utf8",
3353
+ stdio: ["ignore", "pipe", "ignore"],
3354
+ timeout: PROBE_TIMEOUT_MS2
3355
+ }
3356
+ );
3357
+ return output.split("\n").filter((line) => line !== "");
3358
+ } catch {
3359
+ return [];
3360
+ }
3361
+ }
3362
+ function directories(cwd) {
3363
+ const key = cache_key(cwd);
3364
+ const known = answers.get(key);
3365
+ if (known !== void 0) return known;
3366
+ const read4 = read_directories(cwd);
3367
+ if (read4.length > 0) answers.set(key, read4);
3368
+ return read4;
3369
+ }
3370
+ function own(cwd) {
3371
+ return directories(cwd)[OWN_GIT_DIRECTORY];
3372
+ }
3373
+ function repository(cwd) {
3374
+ return directories(cwd)[COMMON_GIT_DIRECTORY];
3375
+ }
3376
+ async function read_repository() {
3377
+ try {
3378
+ const found = await git_command.git_directories();
3379
+ return found[COMMON_GIT_DIRECTORY];
3380
+ } catch {
3381
+ return void 0;
3382
+ }
3383
+ }
3384
+ function select_linked(found) {
3385
+ const own_directory = found[OWN_GIT_DIRECTORY];
3386
+ const common = found[COMMON_GIT_DIRECTORY];
3387
+ return own_directory === void 0 || common === void 0 || own_directory === common ? void 0 : common;
3388
+ }
3389
+ function resolve(cwd) {
3390
+ return select_linked(directories(cwd));
3391
+ }
3392
+ var git_common_directory = {
3393
+ STATE_DIRECTORY: STATE_DIRECTORY2,
3394
+ directories,
3395
+ own,
3396
+ read_repository,
3397
+ repository,
3398
+ resolve,
3399
+ select_linked
3400
+ };
3401
+
3402
+ // scripts/josh/durable-state-migrate.ts
3403
+ import { constants as constants2, copyFileSync, lstatSync as lstatSync2, readdirSync, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
3404
+ import path15 from "node:path";
3405
+ var COPIED_MARKER = ".legacy-copied";
3406
+ var MARKER_MODE = 384;
3407
+ var LOG_RETENTION_DAYS = 14;
3408
+ var DAY_MS = 864e5;
3409
+ var LOG_SUFFIX = ".log";
3410
+ var NOTE_SUFFIX = ".md";
3411
+ var RECORD_SUFFIXES = [".json", ".jsonl", LOG_SUFFIX, NOTE_SUFFIX];
3412
+ var PRUNED_SUFFIXES = [LOG_SUFFIX, NOTE_SUFFIX];
3413
+ function is_record_name(name, prefixes) {
3414
+ const has_prefix = prefixes.some((prefix) => name.startsWith(prefix));
3415
+ return has_prefix && RECORD_SUFFIXES.some((suffix) => name.endsWith(suffix));
3416
+ }
3417
+ function list_names(directory) {
3418
+ try {
3419
+ return readdirSync(directory);
3420
+ } catch {
3421
+ return [];
3422
+ }
3423
+ }
3424
+ function copy_record(from, to) {
3425
+ try {
3426
+ if (!stamp_file.is_own_regular_file(from)) return;
3427
+ copyFileSync(from, to, constants2.COPYFILE_EXCL);
3428
+ } catch {
3429
+ }
3430
+ }
3431
+ function copy_legacy(from, to, prefixes) {
3432
+ if (from === to) return;
3433
+ for (const name of list_names(from)) {
3434
+ if (is_record_name(name, prefixes)) copy_record(path15.join(from, name), path15.join(to, name));
3435
+ }
3436
+ }
3437
+ function claim_copy(directory) {
3438
+ try {
3439
+ writeFileSync3(path15.join(directory, COPIED_MARKER), "", { flag: "wx", mode: MARKER_MODE });
3440
+ return true;
3441
+ } catch {
3442
+ return false;
3443
+ }
3444
+ }
3445
+ function copy_once(from, to, prefixes) {
3446
+ if (claim_copy(to)) copy_legacy(from, to, prefixes);
3447
+ }
3448
+ function is_stale(target2, now_ms) {
3449
+ const age_ms = now_ms - lstatSync2(target2).mtimeMs;
3450
+ return age_ms > LOG_RETENTION_DAYS * DAY_MS && stamp_file.is_own_regular_file(target2);
3451
+ }
3452
+ function prune_log(target2, now_ms) {
3453
+ try {
3454
+ if (is_stale(target2, now_ms)) rmSync3(target2, { force: true });
3455
+ } catch {
3456
+ }
3457
+ }
3458
+ function prune_stale_logs(directory, prefixes, now_ms) {
3459
+ for (const name of list_names(directory)) {
3460
+ const is_pruned = PRUNED_SUFFIXES.some((suffix) => name.endsWith(suffix));
3461
+ if (is_pruned && is_record_name(name, prefixes)) {
3462
+ prune_log(path15.join(directory, name), now_ms);
3463
+ }
3464
+ }
3465
+ }
3466
+ var durable_state_migrate = { LOG_RETENTION_DAYS, copy_once, is_record_name, prune_stale_logs };
3467
+
3468
+ // scripts/josh/durable-state.ts
3469
+ var STATE_DIRECTORY_MODE = 448;
3470
+ var { PREFIX: PREFIX2, STATE_ROOT_OVERRIDE: STATE_ROOT_OVERRIDE2, state_root: state_root2 } = durable_state_root;
3471
+ function root() {
3472
+ return state_root2(STATE_ROOT_OVERRIDE2, git_common_directory.repository);
3473
+ }
3474
+ var PREFIXES = Object.values(PREFIX2);
3475
+ var ensured = /* @__PURE__ */ new Set();
3476
+ function prepare(directory) {
3477
+ mkdirSync2(directory, { recursive: true, mode: STATE_DIRECTORY_MODE });
3478
+ durable_state_migrate.copy_once(PLATFORM_TEMP_ROOT, directory, PREFIXES);
3479
+ durable_state_migrate.prune_stale_logs(directory, PREFIXES, Date.now());
3480
+ }
3481
+ function ensure(directory) {
3482
+ if (ensured.has(directory)) return directory;
3483
+ try {
3484
+ prepare(directory);
3485
+ } catch {
3486
+ return PLATFORM_TEMP_ROOT;
3487
+ }
3488
+ ensured.add(directory);
3489
+ return directory;
3490
+ }
3491
+ function durable_path(prefix, key_root, suffix) {
3492
+ return path16.join(ensure(root()), stamp_file.stamp_name(prefix, key_root, suffix));
3493
+ }
3494
+ var durable_state = {
3495
+ PREFIX: PREFIX2,
3496
+ ensure,
3497
+ path: durable_path,
3498
+ root,
3499
+ state_root: state_root2
3500
+ };
3501
+
3502
+ // scripts/agent/agent-provider.ts
3503
+ import { z as z7 } from "zod";
3504
+ var EMPTY_LENGTH = 0;
3505
+ var PROVIDER_SCHEMA = z7.enum(["anthropic", "openai"]);
3506
+ var ANTHROPIC_PROVIDER = "anthropic";
3507
+ var OPENAI_PROVIDER = "openai";
3508
+ var CODEX_SESSION_KEY = "CODEX_THREAD_ID";
3509
+ function trimmed(value) {
3510
+ const result = value?.trim();
3511
+ return result === void 0 || result.length === EMPTY_LENGTH ? void 0 : result;
3512
+ }
3513
+ function rejection(key, value, expected) {
3514
+ return { kind: "rejected", note: `${key}=${value} ${expected}, so the agent was not started` };
3515
+ }
3516
+ function has_session(environment, keys) {
3517
+ return keys.some((key) => trimmed(environment[key]) !== void 0);
3518
+ }
3519
+ var CONFLICTING_SESSIONS = {
3520
+ kind: "rejected",
3521
+ note: "both Codex and Claude Code sessions were detected"
3522
+ };
3523
+ var HANDED_PROVIDER_KEY = "JOSH_AGENT_PROVIDER";
3524
+ var DEFAULT_PROVIDER = {
3525
+ kind: "provider",
3526
+ provider: ANTHROPIC_PROVIDER,
3527
+ is_default: true
3528
+ };
3529
+ var DEFAULT_NOTICE = ` No agent session or ${HANDED_PROVIDER_KEY} was found, so the provider defaulted to ${ANTHROPIC_PROVIDER} (Claude Code).`;
3530
+ function handed_provider(environment) {
3531
+ const value = trimmed(environment[HANDED_PROVIDER_KEY]);
3532
+ if (value === void 0) return DEFAULT_PROVIDER;
3533
+ const parsed = PROVIDER_SCHEMA.safeParse(value);
3534
+ return parsed.success ? { kind: "provider", provider: parsed.data } : rejection(HANDED_PROVIDER_KEY, value, "is not an allowed provider");
3535
+ }
3536
+ function detected_provider(environment) {
3537
+ const has_codex = has_session(environment, [CODEX_SESSION_KEY]);
3538
+ const has_claude = has_session(environment, agent_session_environment.PARENT_SESSION_KEYS);
3539
+ if (has_codex === has_claude) return has_codex ? CONFLICTING_SESSIONS : void 0;
3540
+ return { kind: "provider", provider: has_codex ? OPENAI_PROVIDER : ANTHROPIC_PROVIDER };
3541
+ }
3542
+ function resolve_provider(environment = process.env) {
3543
+ return detected_provider(environment) ?? handed_provider(environment);
3544
+ }
3545
+ function default_notice(environment = process.env) {
3546
+ const selected = resolve_provider(environment);
3547
+ return selected.kind === "provider" && selected.is_default === true ? DEFAULT_NOTICE : "";
3548
+ }
3549
+ function warn_of_default(environment = process.env) {
3550
+ const notice = default_notice(environment).trim();
3551
+ if (notice !== "") console.error(notice);
3552
+ }
3553
+ function has_completion_callback(environment = process.env) {
3554
+ const selected = resolve_provider(environment);
3555
+ return selected.kind !== "provider" || selected.provider !== OPENAI_PROVIDER;
3556
+ }
3557
+ function handoff_environment(environment = process.env) {
3558
+ const selected = resolve_provider(environment);
3559
+ return selected.kind === "provider" ? { [HANDED_PROVIDER_KEY]: selected.provider } : {};
3560
+ }
3561
+ var agent_provider = {
3562
+ ANTHROPIC_PROVIDER,
3563
+ CODEX_SESSION_KEY,
3564
+ HANDED_PROVIDER_KEY,
3565
+ OPENAI_PROVIDER,
3566
+ PROVIDER_SCHEMA,
3567
+ default_notice,
3568
+ handoff_environment,
3569
+ has_completion_callback,
3570
+ rejection,
3571
+ resolve_provider,
3572
+ trimmed,
3573
+ warn_of_default
3574
+ };
3575
+
3576
+ // scripts/josh/process-identity.ts
3577
+ import { execFileSync as execFileSync2, spawnSync } from "node:child_process";
3578
+ import { randomUUID as randomUUID2 } from "node:crypto";
3579
+ import { readFileSync as readFileSync6, rmSync as rmSync4 } from "node:fs";
3580
+ import { createServer } from "node:net";
3581
+ import path17 from "node:path";
3582
+ var PS_COMMAND = "/bin/ps";
3583
+ var FORMAT_FLAG = "-o";
3584
+ var START_TIME_FORMAT = "lstart=";
3585
+ var PID_FLAG = "-p";
3586
+ var PROBE_ENVIRONMENT = { TZ: "UTC", LC_ALL: "C" };
3587
+ var LIVENESS_SIGNAL = 0;
3588
+ var NO_SUCH_PROCESS = "ESRCH";
3589
+ var LOWEST_REAL_PID = 1;
3590
+ var PROC_START_FIELD_INDEX = 19;
3591
+ var BEACON_SCHEME = "socket:";
3592
+ var BEACON_SUFFIX = ".sock";
3593
+ var BEACON_PREFIX = `josh-process-identity-${String(process.getuid?.() ?? "")}-`;
3594
+ var BEACON_ID_LENGTH = 36;
3595
+ var BEACON_ID_PATTERN = /^[\da-f-]+$/u;
3596
+ var WINDOWS_PLATFORM2 = "win32";
3597
+ var BEACON_LIVE_STATUS = 0;
3598
+ var BEACON_UNKNOWN_STATUS = 1;
3599
+ var BEACON_GONE_STATUS = 2;
3600
+ var SOCKET_PROBE_SOURCE = `const net=require('node:net');const socket=net.createConnection(process.argv[1]);socket.once('connect',()=>process.exit(${String(BEACON_LIVE_STATUS)}));socket.once('error',(error)=>process.exit(['ECONNREFUSED','ENOENT'].includes(error.code)?${String(BEACON_GONE_STATUS)}:${String(BEACON_UNKNOWN_STATUS)}));socket.setTimeout(1000,()=>process.exit(${String(BEACON_UNKNOWN_STATUS)}));`;
3601
+ var beacons = /* @__PURE__ */ new Map();
3602
+ var exit_cleanup = { is_registered: false };
3603
+ function signal_refusal(pid) {
3604
+ try {
3605
+ process.kill(pid, LIVENESS_SIGNAL);
3606
+ return void 0;
3607
+ } catch (error) {
3608
+ return error.code ?? NO_SUCH_PROCESS;
3609
+ }
3610
+ }
3611
+ function is_live_pid(pid) {
3612
+ return pid >= LOWEST_REAL_PID && signal_refusal(pid) === void 0;
3613
+ }
3614
+ function is_present_pid(pid) {
3615
+ return pid >= LOWEST_REAL_PID && signal_refusal(pid) !== NO_SUCH_PROCESS;
3616
+ }
3617
+ function read_proc_start(pid) {
3618
+ try {
3619
+ const stat = readFileSync6(`/proc/${String(pid)}/stat`, "utf8");
3620
+ const fields = stat.slice(stat.lastIndexOf(")") + 1).trim().split(/\s+/u);
3621
+ const start = fields[PROC_START_FIELD_INDEX];
3622
+ return start === void 0 ? void 0 : `proc:${start}`;
3623
+ } catch {
3624
+ return void 0;
3625
+ }
3626
+ }
3627
+ function read_ps_start(pid) {
3628
+ try {
3629
+ const printed = execFileSync2(
3630
+ PS_COMMAND,
3631
+ [FORMAT_FLAG, START_TIME_FORMAT, PID_FLAG, String(pid)],
3632
+ {
3633
+ encoding: "utf8",
3634
+ timeout: PROBE_TIMEOUT_MS,
3635
+ stdio: ["ignore", "pipe", "ignore"],
3636
+ env: PROBE_ENVIRONMENT
3637
+ }
3638
+ ).trim();
3639
+ return printed.length > 0 ? printed : void 0;
3640
+ } catch {
3641
+ return void 0;
3642
+ }
3643
+ }
3644
+ var START_PROBES = { read_proc_start, read_ps_start };
3645
+ function safe_probe(probe, pid) {
3646
+ try {
3647
+ return probe(pid);
3648
+ } catch {
3649
+ return void 0;
3650
+ }
3651
+ }
3652
+ function read_start(pid, probes = START_PROBES) {
3653
+ return safe_probe(probes.read_proc_start, pid) ?? safe_probe(probes.read_ps_start, pid);
3654
+ }
3655
+ function close_beacon(token) {
3656
+ const server = beacons.get(token);
3657
+ if (server === void 0) return;
3658
+ beacons.delete(token);
3659
+ server.close();
3660
+ rmSync4(token.slice(BEACON_SCHEME.length), { force: true });
3661
+ }
3662
+ function close_beacons() {
3663
+ for (const token of beacons.keys()) close_beacon(token);
3664
+ }
3665
+ function ensure_exit_cleanup() {
3666
+ if (exit_cleanup.is_registered) return;
3667
+ exit_cleanup.is_registered = true;
3668
+ process.once("exit", close_beacons);
3669
+ }
3670
+ function ignore_beacon_error() {
3671
+ }
3672
+ function bind_beacon(target2) {
3673
+ return createServer().on("error", ignore_beacon_error).listen(target2);
3674
+ }
3675
+ function try_bind_beacon(bind, target2) {
3676
+ try {
3677
+ const server = bind(target2);
3678
+ return server.listening ? server : void 0;
3679
+ } catch {
3680
+ return void 0;
3681
+ }
3682
+ }
3683
+ function open_beacon(bind = bind_beacon) {
3684
+ const target2 = path17.join(PLATFORM_TEMP_ROOT, `${BEACON_PREFIX}${randomUUID2()}${BEACON_SUFFIX}`);
3685
+ const token = `${BEACON_SCHEME}${target2}`;
3686
+ const server = try_bind_beacon(bind, target2);
3687
+ if (server === void 0) return void 0;
3688
+ server.unref();
3689
+ beacons.set(token, server);
3690
+ ensure_exit_cleanup();
3691
+ return token;
3692
+ }
3693
+ function resolve_own_start(probes = START_PROBES, platform2 = process.platform) {
3694
+ const start = read_start(process.pid, probes);
3695
+ if (start !== void 0 || platform2 === WINDOWS_PLATFORM2) return start;
3696
+ return open_beacon();
3697
+ }
3698
+ function is_valid_beacon_name(name) {
3699
+ if (!name.startsWith(BEACON_PREFIX) || !name.endsWith(BEACON_SUFFIX)) return false;
3700
+ const id = name.slice(BEACON_PREFIX.length, -BEACON_SUFFIX.length);
3701
+ return id.length === BEACON_ID_LENGTH && BEACON_ID_PATTERN.test(id);
3702
+ }
3703
+ function beacon_target(token) {
3704
+ if (!token.startsWith(BEACON_SCHEME)) return void 0;
3705
+ const target2 = token.slice(BEACON_SCHEME.length);
3706
+ if (path17.dirname(target2) !== PLATFORM_TEMP_ROOT) return void 0;
3707
+ return is_valid_beacon_name(path17.basename(target2)) ? target2 : void 0;
3708
+ }
3709
+ function run_socket_probe(target2, kill_after_ms = PROBE_TIMEOUT_MS) {
3710
+ return spawnSync(process.execPath, ["-e", SOCKET_PROBE_SOURCE, target2], {
3711
+ stdio: "ignore",
3712
+ timeout: kill_after_ms
3713
+ }).status ?? void 0;
3714
+ }
3715
+ function is_live_beacon(target2, probe = run_socket_probe) {
3716
+ const own3 = beacons.get(`${BEACON_SCHEME}${target2}`);
3717
+ if (own3 !== void 0) return own3.listening;
3718
+ const status2 = probe(target2);
3719
+ if (status2 === BEACON_LIVE_STATUS) return true;
3720
+ return status2 === BEACON_GONE_STATUS ? false : void 0;
3721
+ }
3722
+ function has_matching_start(pid, recorded_start, read4) {
3723
+ const observed = read4(pid);
3724
+ return observed === void 0 ? void 0 : observed === recorded_start;
3725
+ }
3726
+ function matches_recorded_start(pid, recorded_start, read4) {
3727
+ const target2 = beacon_target(recorded_start);
3728
+ return target2 === void 0 ? has_matching_start(pid, recorded_start, read4) : is_live_beacon(target2);
3729
+ }
3730
+ var own_probe = /* @__PURE__ */ new Map();
3731
+ function own_start() {
3732
+ if (!own_probe.has(process.pid)) own_probe.set(process.pid, resolve_own_start());
3733
+ return own_probe.get(process.pid);
3734
+ }
3735
+ function own_fields() {
3736
+ const start = own_start();
3737
+ return { pid: process.pid, ...start !== void 0 && { process_start: start } };
3738
+ }
3739
+ function is_same_process(pid, recorded_start, read4 = read_start) {
3740
+ if (pid === void 0 || !is_live_pid(pid)) return false;
3741
+ if (recorded_start === void 0) return void 0;
3742
+ return matches_recorded_start(pid, recorded_start, read4);
3743
+ }
3744
+ function is_present_process(pid, recorded_start, read4 = read_start) {
3745
+ if (!is_present_pid(pid)) return false;
3746
+ if (recorded_start === void 0) return void 0;
3747
+ return matches_recorded_start(pid, recorded_start, read4);
3748
+ }
3749
+ function is_own_process(pid, recorded_start) {
3750
+ return pid === process.pid && recorded_start === own_start();
3751
+ }
3752
+ var process_identity = {
3753
+ PROBE_ENVIRONMENT,
3754
+ START_PROBES,
3755
+ START_TIME_FORMAT,
3756
+ close_beacon,
3757
+ is_live_beacon,
3758
+ is_live_pid,
3759
+ is_own_process,
3760
+ is_present_pid,
3761
+ is_present_process,
3762
+ is_same_process,
3763
+ open_beacon,
3764
+ own_fields,
3765
+ own_start,
3766
+ read_start,
3767
+ resolve_own_start,
3768
+ run_socket_probe
3769
+ };
3770
+
3771
+ // scripts/issue/issue-number-shape.ts
3772
+ var ISSUE_NUMBER_PATTERN = /^[1-9]\d*$/u;
3773
+ var BAD_ISSUE_MESSAGE = "Not an issue number: ";
3774
+ var ISSUE_PREFIX = "#";
3775
+ function is_issue_number(value) {
3776
+ return ISSUE_NUMBER_PATTERN.test(value);
3777
+ }
3778
+ function require_issue_number(issue) {
3779
+ if (!is_issue_number(issue)) throw new Error(`${BAD_ISSUE_MESSAGE}${issue}`);
3780
+ }
3781
+ function single_of(positionals) {
3782
+ const [issue_number, ...rest] = positionals;
3783
+ const is_single = rest.length === 0 && issue_number !== void 0;
3784
+ return is_single && ISSUE_NUMBER_PATTERN.test(issue_number) ? issue_number : void 0;
3785
+ }
3786
+ function issue_token(token) {
3787
+ return ISSUE_NUMBER_PATTERN.test(token) ? `${ISSUE_PREFIX}${token}` : token;
3788
+ }
3789
+ var issue_number_shape = {
3790
+ ISSUE_NUMBER_PATTERN,
3791
+ is_issue_number,
3792
+ issue_token,
3793
+ require_issue_number,
3794
+ single_of
3795
+ };
3796
+
3797
+ // scripts/lib/cli-flags.ts
3798
+ import { parseArgs } from "node:util";
3799
+ var HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h"]);
3800
+ function usage_line(known_flags, command) {
3801
+ if (known_flags.length === 0) return `Usage: josh ${command}`;
3802
+ return `Usage: josh ${command} [${known_flags.join("] [")}]`;
3803
+ }
3804
+ function refuse_unknown_flags(argv, known_flags, command) {
3805
+ const unknown = argv.filter((argument) => !known_flags.includes(argument));
3806
+ if (unknown.length === 0) return void 0;
3807
+ return `Unknown argument(s): ${unknown.join(" ")}
3808
+ ${usage_line(known_flags, command)}`;
3809
+ }
3810
+ function answer_help_or_unknown(argv, known_flags, command) {
3811
+ if (argv.some((argument) => HELP_FLAGS.has(argument))) {
3812
+ console.info(usage_line(known_flags, command));
3813
+ return 0;
3814
+ }
3815
+ const refusal = refuse_unknown_flags(argv, known_flags, command);
3816
+ if (refusal === void 0) return void 0;
3817
+ console.error(refusal);
3818
+ return 1;
3819
+ }
3820
+ function parse_or_undefined2(config) {
3821
+ try {
3822
+ return parseArgs(config);
3823
+ } catch {
3824
+ return void 0;
3825
+ }
3826
+ }
3827
+ function values_of(argv, options) {
3828
+ return parse_or_undefined2({ args: [...argv], options })?.values;
3829
+ }
3830
+ function arguments_of2(argv, options) {
3831
+ return parse_or_undefined2({ args: [...argv], options, allowPositionals: true });
3832
+ }
3833
+ function string_of(value) {
3834
+ return typeof value === "string" ? value : void 0;
3835
+ }
3836
+ var LONG_FLAG_PREFIX = "--";
3837
+ var SHORT_FLAG_PREFIX = "-";
3838
+ function option_name(flag) {
3839
+ return flag.slice(LONG_FLAG_PREFIX.length);
3840
+ }
3841
+ function is_unusable_value(value) {
3842
+ if (typeof value === "boolean" || value.length === 0) return true;
3843
+ return value !== SHORT_FLAG_PREFIX && value.startsWith(SHORT_FLAG_PREFIX);
3844
+ }
3845
+ function given_values(argv, flag) {
3846
+ const name = option_name(flag);
3847
+ const given = parse_or_undefined2({
3848
+ args: [...argv],
3849
+ options: { [name]: { type: "string", multiple: true } },
3850
+ strict: false,
3851
+ allowPositionals: true
3852
+ })?.values[name];
3853
+ return Array.isArray(given) ? given : [];
3854
+ }
3855
+ function is_value_unusable(argv, flag) {
3856
+ return given_values(argv, flag).some((value) => is_unusable_value(value));
3857
+ }
3858
+ function attach_one(attached, argument, flags) {
3859
+ const previous = attached.at(-1);
3860
+ if (previous !== void 0 && flags.includes(previous)) {
3861
+ attached[attached.length - 1] = `${previous}=${argument}`;
3862
+ } else attached.push(argument);
3863
+ }
3864
+ function attach_values(argv, flags) {
3865
+ const attached = [];
3866
+ for (const argument of argv) attach_one(attached, argument, flags);
3867
+ return attached;
3868
+ }
3869
+ var COUNT_PATTERN = /^\d+$/u;
3870
+ var POSITIVE_PATTERN = /^[1-9]\d*$/u;
3871
+ function to_integer(raw, pattern) {
3872
+ if (raw === void 0 || !pattern.test(raw)) return void 0;
3873
+ const parsed = Number(raw);
3874
+ return Number.isSafeInteger(parsed) ? parsed : void 0;
3875
+ }
3876
+ function to_count(raw) {
3877
+ return to_integer(raw, COUNT_PATTERN);
3878
+ }
3879
+ function to_positive(raw) {
3880
+ return to_integer(raw, POSITIVE_PATTERN);
3881
+ }
3882
+ function read_positive_setting(raw, name, fallback) {
3883
+ const trimmed2 = raw?.trim() ?? "";
3884
+ if (trimmed2 === "") return { kind: "limit", limit: fallback };
3885
+ const limit = to_positive(trimmed2);
3886
+ if (limit !== void 0) return { kind: "limit", limit };
3887
+ return { kind: "problem", problem: `${name} must be a positive integer, not "${trimmed2}"` };
3888
+ }
3889
+ var cli_flags = {
3890
+ to_count,
3891
+ to_positive,
3892
+ read_positive_setting,
3893
+ attach_values,
3894
+ usage_line,
3895
+ refuse_unknown_flags,
3896
+ answer_help_or_unknown,
3897
+ parse_or_undefined: parse_or_undefined2,
3898
+ values_of,
3899
+ arguments_of: arguments_of2,
3900
+ string_of,
3901
+ option_name,
3902
+ given_values,
3903
+ is_value_unusable
3904
+ };
3905
+
3906
+ // scripts/run/run-invocation.ts
3907
+ var BACKLOG_COMMAND = "backlogrun";
3908
+ var KNOWN_FLAGS = ["--max", "--idle"];
3909
+ var ONLY_FLAG = "--only";
3910
+ var OPTIONS = {
3911
+ max: { type: "string" },
3912
+ idle: { type: "string" },
3913
+ only: { type: "boolean" }
3914
+ };
3915
+ var ISSUE_PREFIX2 = "#";
3916
+ var FLAG_PREFIX3 = "-";
3917
+ var TOKEN_SEPARATOR = " ";
3918
+ var FIRST_TOKEN = 0;
3919
+ var FIRST_ARGUMENT_INDEX = 1;
3920
+ var EMPTY_LENGTH2 = 0;
3921
+ var NOT_FOUND = -1;
3922
+ function tokens_of(invocation) {
3923
+ return invocation.split(TOKEN_SEPARATOR).filter((token) => token.length > EMPTY_LENGTH2);
3924
+ }
3925
+ function render_option(token) {
3926
+ if (token.name === cli_flags.option_name(ONLY_FLAG)) return ONLY_FLAG;
3927
+ const flag = KNOWN_FLAGS.find((known) => cli_flags.option_name(known) === token.name);
3928
+ const value = cli_flags.to_count(token.value);
3929
+ if (flag === void 0 || value === void 0) return void 0;
3930
+ return `${flag} ${String(value)}`;
3931
+ }
3932
+ function rendered_options(tokens) {
3933
+ const rendered = [];
3934
+ for (const token of tokens) {
3935
+ const part = render_option(token);
3936
+ if (part === void 0) return void 0;
3937
+ rendered.push(part);
3938
+ }
3939
+ return rendered;
3940
+ }
3941
+ function issue_of(token) {
3942
+ if (!token.startsWith(ISSUE_PREFIX2)) return void 0;
3943
+ const digits = token.slice(ISSUE_PREFIX2.length);
3944
+ if (!issue_number_shape.ISSUE_NUMBER_PATTERN.test(digits)) return void 0;
3945
+ const issue = Number(digits);
3946
+ return Number.isSafeInteger(issue) ? issue : void 0;
3947
+ }
3948
+ function issues_of(tokens) {
3949
+ const issues = [];
3950
+ for (const token of tokens) {
3951
+ const issue = issue_of(token.value ?? "");
3952
+ if (issue === void 0) return void 0;
3953
+ issues.push(issue);
3954
+ }
3955
+ return issues;
3956
+ }
3957
+ function argument_tokens(invocation) {
3958
+ const tokens = tokens_of(invocation);
3959
+ if (tokens[FIRST_TOKEN] !== BACKLOG_COMMAND) return void 0;
3960
+ return cli_flags.parse_or_undefined({
3961
+ args: tokens.slice(FIRST_ARGUMENT_INDEX),
3962
+ options: OPTIONS,
3963
+ allowPositionals: true,
3964
+ tokens: true
3965
+ })?.tokens;
3966
+ }
3967
+ function parse2(invocation) {
3968
+ const tokens = argument_tokens(invocation);
3969
+ if (tokens === void 0) return void 0;
3970
+ const stop = tokens.findIndex((token) => token.kind !== "positional");
3971
+ const split_at = stop === NOT_FOUND ? tokens.length : stop;
3972
+ const issues = issues_of(tokens.slice(FIRST_TOKEN, split_at));
3973
+ const flags = rendered_options(tokens.slice(split_at));
3974
+ if (issues === void 0 || flags === void 0) return void 0;
3975
+ return { issues, flags };
3976
+ }
3977
+ function issue_token2(issue) {
3978
+ return `${ISSUE_PREFIX2}${String(issue)}`;
3979
+ }
3980
+ function joined(command, rendered) {
3981
+ return [command, ...rendered].join(TOKEN_SEPARATOR);
3982
+ }
3983
+ function rebuild(invocation) {
3984
+ const parsed = parse2(invocation);
3985
+ if (parsed === void 0) return void 0;
3986
+ return joined(BACKLOG_COMMAND, [
3987
+ ...parsed.issues.map((issue) => issue_token2(issue)),
3988
+ ...parsed.flags
3989
+ ]);
3990
+ }
3991
+ function issue_numbers(invocation) {
3992
+ const tokens = tokens_of(invocation);
3993
+ const stop = tokens.findIndex((token) => token.startsWith(FLAG_PREFIX3));
3994
+ const leading = stop === NOT_FOUND ? tokens : tokens.slice(FIRST_TOKEN, stop);
3995
+ const issues = parse2(leading.join(TOKEN_SEPARATOR))?.issues;
3996
+ if (issues === void 0 || issues.length === EMPTY_LENGTH2) return void 0;
3997
+ return issues;
3998
+ }
3999
+ function has_only(invocation) {
4000
+ return parse2(invocation)?.flags.includes(ONLY_FLAG) === true;
4001
+ }
4002
+ var run_invocation = {
4003
+ has_only,
4004
+ issue_numbers,
4005
+ rebuild
4006
+ };
4007
+
4008
+ // scripts/run/carry/run-carry.ts
4009
+ import { z as z9 } from "zod";
4010
+
4011
+ // scripts/run/carry/run-carry-added.ts
4012
+ function issues_of2(added, is_priority) {
4013
+ return added.filter((entry2) => entry2.is_priority === is_priority).map((entry2) => entry2.issue);
4014
+ }
4015
+ function ordered(declared, added = []) {
4016
+ const sequence = [...issues_of2(added, true), ...declared, ...issues_of2(added, false)];
4017
+ return sequence.filter((issue, index) => sequence.indexOf(issue) === index);
4018
+ }
4019
+ function next_added(carry, additions) {
4020
+ const next = [...carry.added ?? []];
4021
+ for (const addition of additions) {
4022
+ if (next.every((entry2) => entry2.issue !== addition.issue)) next.push(addition);
4023
+ }
4024
+ return next;
4025
+ }
4026
+ function add_issues(target2, carry, additions, retries = []) {
4027
+ const next = {
4028
+ ...carry,
4029
+ added: additions.length === 0 ? carry.added : next_added(carry, additions),
4030
+ done: carry.done?.filter((issue) => !retries.includes(issue))
4031
+ };
4032
+ stamp_file.replace_stamp(target2, next);
4033
+ return next;
4034
+ }
4035
+ var run_carry_added = { add_issues, ordered };
4036
+
4037
+ // scripts/run/carry/run-carry-streak.ts
4038
+ var NO_INCREMENT = 0;
4039
+ var OUTAGE_FOLD_WINDOW_MS = 12e4;
4040
+ function has_increment(value) {
4041
+ return (value ?? NO_INCREMENT) > NO_INCREMENT;
4042
+ }
4043
+ function next_failures(carry, change) {
4044
+ if (has_increment(change.merged)) return NO_INCREMENT;
4045
+ return carry.failures + (change.failures ?? NO_INCREMENT);
4046
+ }
4047
+ function is_within_fold_window(last_outage_at, now) {
4048
+ if (last_outage_at === void 0) return false;
4049
+ const last = Date.parse(last_outage_at);
4050
+ if (Number.isNaN(last)) return false;
4051
+ return now.getTime() - last <= OUTAGE_FOLD_WINDOW_MS;
4052
+ }
4053
+ function folded_outage(carry) {
4054
+ return { outages: carry.outages, last_outage_at: carry.last_outage_at };
4055
+ }
4056
+ function counted_outage(carry, change, now) {
4057
+ const outages = carry.outages + (change.outages ?? NO_INCREMENT);
4058
+ return { outages, last_outage_at: now.toISOString() };
4059
+ }
4060
+ function next_outage(carry, change, now) {
4061
+ if (has_increment(change.outages)) {
4062
+ return is_within_fold_window(carry.last_outage_at, now) ? folded_outage(carry) : counted_outage(carry, change, now);
4063
+ }
4064
+ const is_reachable = has_increment(change.merged) || has_increment(change.failures);
4065
+ return is_reachable ? { outages: NO_INCREMENT, last_outage_at: void 0 } : folded_outage(carry);
4066
+ }
4067
+ function next_state(carry, change, now) {
4068
+ const outage = next_outage(carry, change, now);
4069
+ return {
4070
+ failures: next_failures(carry, change),
4071
+ outages: outage.outages,
4072
+ last_outage_at: outage.last_outage_at
4073
+ };
4074
+ }
4075
+ var run_carry_streak = { next_state };
4076
+
4077
+ // scripts/run/carry/run-carry-change.ts
4078
+ var NO_INCREMENT2 = 0;
4079
+ function next_done(carry, done) {
4080
+ if (done === void 0) return carry.done;
4081
+ const current = carry.done ?? [];
4082
+ return current.includes(done) ? current : [...current, done];
4083
+ }
4084
+ function next_merged_issues(carry, issue) {
4085
+ if (issue === void 0) return carry.merged_issues;
4086
+ const current = carry.merged_issues ?? [];
4087
+ return current.includes(issue) ? current : [...current, issue];
4088
+ }
4089
+ function is_duplicate_merge(carry, change) {
4090
+ const issue = change.merged_issue;
4091
+ return issue !== void 0 && carry.merged_issues?.includes(issue) === true;
4092
+ }
4093
+ function has_other_change(change) {
4094
+ const amounts = [change.filed, change.cuts, change.failures, change.outages];
4095
+ const has_amount = amounts.some((amount) => (amount ?? NO_INCREMENT2) > NO_INCREMENT2);
4096
+ return has_amount || change.done !== void 0 || change.retrospective === true;
4097
+ }
4098
+ function effective_change(carry, change) {
4099
+ if (!is_duplicate_merge(carry, change)) return change;
4100
+ return has_other_change(change) ? { ...change, merged: NO_INCREMENT2 } : void 0;
4101
+ }
4102
+ function next_counts(carry, change) {
4103
+ const cuts = change.cuts ?? NO_INCREMENT2;
4104
+ return {
4105
+ merged: carry.merged + (change.merged ?? NO_INCREMENT2),
4106
+ filed: carry.filed + (change.filed ?? NO_INCREMENT2),
4107
+ cuts: carry.cuts + cuts,
4108
+ is_handed_off: cuts > NO_INCREMENT2
4109
+ };
4110
+ }
4111
+ function apply_change(target2, carry, change, now = /* @__PURE__ */ new Date()) {
4112
+ const effective = effective_change(carry, change);
4113
+ if (effective === void 0) return carry;
4114
+ const streak = run_carry_streak.next_state(carry, effective, now);
4115
+ const next = {
4116
+ ...carry,
4117
+ ...next_counts(carry, effective),
4118
+ merged_issues: next_merged_issues(carry, effective.merged_issue),
4119
+ failures: streak.failures,
4120
+ outages: streak.outages,
4121
+ last_outage_at: streak.last_outage_at,
4122
+ done: next_done(carry, effective.done),
4123
+ retrospective: effective.retrospective === true || carry.retrospective
4124
+ };
4125
+ stamp_file.replace_stamp(target2, next);
4126
+ return next;
4127
+ }
4128
+ var run_carry_change = { apply_change };
4129
+
4130
+ // scripts/run/carry/run-carry-conversation.ts
4131
+ import { existsSync as existsSync3, statSync as statSync2 } from "node:fs";
4132
+ import path20 from "node:path";
4133
+
4134
+ // scripts/cost-runtime/cost-transcript.ts
4135
+ import { readdirSync as readdirSync2, readFileSync as readFileSync7, statSync } from "node:fs";
4136
+ import { homedir } from "node:os";
4137
+ import path19 from "node:path";
4138
+
4139
+ // scripts/lane/lane-paths.ts
4140
+ import path18 from "node:path";
4141
+ var LANE_ROOT_KEY = "JOSH_LANE_ROOT";
4142
+ var LANE_DIRECTORY_SUFFIX = "-lanes";
4143
+ var LANE_BRANCH_SUFFIX = "-lane";
4144
+ function default_lane_root(repository_root2) {
4145
+ const name = path18.basename(repository_root2);
4146
+ return path18.join(path18.dirname(repository_root2), `.${name}${LANE_DIRECTORY_SUFFIX}`);
4147
+ }
4148
+ function lane_root(repository_root2, environment = process.env) {
4149
+ const configured = environment[LANE_ROOT_KEY]?.trim() ?? "";
4150
+ return configured.length === 0 ? default_lane_root(repository_root2) : path18.resolve(configured);
4151
+ }
4152
+ function lane_directory(root2, issue) {
4153
+ return path18.join(root2, issue);
4154
+ }
4155
+ var DEFAULT_LANE_ROOT_PATTERN = new RegExp(String.raw`^\..+${LANE_DIRECTORY_SUFFIX}$`, "u");
4156
+ var DEFAULT_LANE_FILE_PATTERN = new RegExp(
4157
+ String.raw`([/\\])\.([^/\\]+)${LANE_DIRECTORY_SUFFIX}[/\\]\d+(?=[/\\]|$)`,
4158
+ "u"
4159
+ );
4160
+ function main_checkout_path(file) {
4161
+ return file.replace(DEFAULT_LANE_FILE_PATTERN, "$1$2");
4162
+ }
4163
+ function is_lane_root(directory, environment) {
4164
+ const configured = environment[LANE_ROOT_KEY]?.trim() ?? "";
4165
+ if (configured.length > 0) return path18.resolve(configured) === directory;
4166
+ return DEFAULT_LANE_ROOT_PATTERN.test(path18.basename(directory));
4167
+ }
4168
+ var CLAUDE_WORKTREES_PATTERN = /[/\\]\.claude[/\\]worktrees[/\\][^/\\]+(?:[/\\].*)?$/u;
4169
+ function checkout_of(directory) {
4170
+ return directory.replace(CLAUDE_WORKTREES_PATTERN, "");
4171
+ }
4172
+ function lane_issue_of(directory, environment = process.env) {
4173
+ const resolved = checkout_of(path18.resolve(directory));
4174
+ const issue = path18.basename(resolved);
4175
+ if (!issue_number_shape.ISSUE_NUMBER_PATTERN.test(issue)) return void 0;
4176
+ return is_lane_root(path18.dirname(resolved), environment) ? issue : void 0;
4177
+ }
4178
+ function lanes_root_of(checkout2, environment = process.env) {
4179
+ const resolved = checkout_of(path18.resolve(checkout2));
4180
+ if (lane_issue_of(resolved, environment) === void 0) return lane_root(resolved, environment);
4181
+ return path18.dirname(resolved);
4182
+ }
4183
+ function issue_here(directory = process.cwd(), environment = process.env) {
4184
+ const lane = lane_issue_of(directory, environment);
4185
+ return lane === void 0 ? void 0 : Number(lane);
4186
+ }
4187
+ function lane_branch(issue) {
4188
+ return `${issue}${LANE_BRANCH_SUFFIX}`;
4189
+ }
4190
+ var SEAT_LOCK_DIR = ".seat-locks";
4191
+ function is_lane_entry(name) {
4192
+ return issue_number_shape.ISSUE_NUMBER_PATTERN.test(name) || DEFAULT_LANE_ROOT_PATTERN.test(name);
4193
+ }
4194
+ var lane_paths = {
4195
+ LANE_BRANCH_SUFFIX,
4196
+ LANE_ROOT_KEY,
4197
+ SEAT_LOCK_DIR,
4198
+ checkout_of,
4199
+ default_lane_root,
4200
+ is_lane_entry,
4201
+ issue_here,
4202
+ lane_branch,
4203
+ lane_directory,
4204
+ lane_issue_of,
4205
+ lane_root,
4206
+ lanes_root_of,
4207
+ main_checkout_path
4208
+ };
4209
+
4210
+ // scripts/time-runtime/time-instant.ts
4211
+ function parse_instant(raw) {
4212
+ if (raw === null || raw === void 0) return void 0;
4213
+ const parsed = Date.parse(raw);
4214
+ return Number.isNaN(parsed) ? void 0 : parsed;
4215
+ }
4216
+ var time_instant = { parse_instant };
4217
+
4218
+ // scripts/cost-runtime/cost-usage.ts
4219
+ import { z as z8 } from "zod";
4220
+ var CACHE_CREATION_SCHEMA = z8.object({
4221
+ ephemeral_1h_input_tokens: z8.number().nullish(),
4222
+ ephemeral_5m_input_tokens: z8.number().nullish()
4223
+ });
4224
+ var USAGE_SCHEMA = z8.object({
4225
+ input_tokens: z8.number(),
4226
+ cache_creation_input_tokens: z8.number().nullish(),
4227
+ cache_read_input_tokens: z8.number().nullish(),
4228
+ output_tokens: z8.number(),
4229
+ output_tokens_details: z8.object({ thinking_tokens: z8.number().nullish() }).nullish(),
4230
+ cache_creation: CACHE_CREATION_SCHEMA.nullish()
4231
+ });
4232
+ var MESSAGE_SCHEMA = z8.object({
4233
+ id: z8.string().nullish(),
4234
+ model: z8.string().nullish(),
4235
+ usage: USAGE_SCHEMA.nullish()
4236
+ });
4237
+ var LINE_SCHEMA = z8.object({
4238
+ type: z8.string(),
4239
+ requestId: z8.string().nullish(),
4240
+ uuid: z8.string().nullish(),
4241
+ gitBranch: z8.string().nullish(),
4242
+ timestamp: z8.string().nullish(),
4243
+ message: MESSAGE_SCHEMA.nullish()
4244
+ });
4245
+ var SYNTHETIC_MODEL = "<synthetic>";
4246
+ var EMPTY_TOTALS = {
4247
+ input_tokens: 0,
4248
+ cache_write_5m_tokens: 0,
4249
+ cache_write_1h_tokens: 0,
4250
+ cache_read_tokens: 0,
4251
+ output_tokens: 0,
4252
+ thinking_tokens: 0,
4253
+ thinking_measured: false
4254
+ };
4255
+ var UNKNOWN_MODEL = "unknown";
4256
+ var UNKNOWN_BRANCH = "";
4257
+ function split_cache_write(usage) {
4258
+ const total = usage.cache_creation_input_tokens ?? 0;
4259
+ const detail = usage.cache_creation;
4260
+ if (!detail) return { write_5m: total, write_1h: 0 };
4261
+ const write_1h = detail.ephemeral_1h_input_tokens ?? 0;
4262
+ return { write_5m: detail.ephemeral_5m_input_tokens ?? total - write_1h, write_1h };
4263
+ }
4264
+ function thinking_usage(usage) {
4265
+ const raw = usage.output_tokens_details?.thinking_tokens;
4266
+ return { tokens: raw ?? 0, measured: raw !== null && raw !== void 0 };
4267
+ }
4268
+ function to_totals(usage) {
4269
+ const { write_5m, write_1h } = split_cache_write(usage);
4270
+ const thinking = thinking_usage(usage);
4271
+ return {
4272
+ input_tokens: usage.input_tokens,
4273
+ cache_write_5m_tokens: write_5m,
4274
+ cache_write_1h_tokens: write_1h,
4275
+ cache_read_tokens: usage.cache_read_input_tokens ?? 0,
4276
+ output_tokens: usage.output_tokens,
4277
+ thinking_tokens: thinking.tokens,
4278
+ thinking_measured: thinking.measured
4279
+ };
4280
+ }
4281
+ function declared_id(data) {
4282
+ return data.requestId ?? data.message?.id ?? data.uuid ?? void 0;
4283
+ }
4284
+ function request_id_of(data, usage) {
4285
+ const fallback = `${data.timestamp ?? ""}-${String(usage.output_tokens)}`;
4286
+ return declared_id(data) ?? fallback;
4287
+ }
4288
+ function to_record(data, usage) {
4289
+ return {
4290
+ request_id: request_id_of(data, usage),
4291
+ model: data.message?.model ?? UNKNOWN_MODEL,
4292
+ branch: data.gitBranch ?? UNKNOWN_BRANCH,
4293
+ at_ms: time_instant.parse_instant(data.timestamp),
4294
+ totals: to_totals(usage)
4295
+ };
4296
+ }
4297
+ var ASSISTANT_TYPE = "assistant";
4298
+ function is_priced_line(data) {
4299
+ return data.type === ASSISTANT_TYPE && data.message?.model !== SYNTHETIC_MODEL;
4300
+ }
4301
+ function classify(data) {
4302
+ if (!is_priced_line(data)) return { kind: "skipped" };
4303
+ const usage = data.message?.usage;
4304
+ return usage ? { kind: "record", record: to_record(data, usage) } : { kind: "no_usage" };
4305
+ }
4306
+ function parse_line(line) {
4307
+ if (line.trim() === "") return { kind: "skipped" };
4308
+ const parsed = LINE_SCHEMA.safeParse(json_value.parse_or_undefined(line));
4309
+ return parsed.success ? classify(parsed.data) : { kind: "malformed" };
4310
+ }
4311
+ function later_instant(left, right) {
4312
+ if (left === void 0) return right;
4313
+ if (right === void 0) return left;
4314
+ return Math.max(left, right);
4315
+ }
4316
+ function dedupe(records) {
4317
+ const by_id = /* @__PURE__ */ new Map();
4318
+ for (const record4 of records) {
4319
+ const seen = by_id.get(record4.request_id);
4320
+ const at_ms = later_instant(seen?.at_ms, record4.at_ms);
4321
+ by_id.set(record4.request_id, { ...seen ?? record4, at_ms });
4322
+ }
4323
+ return [...by_id.values()];
4324
+ }
4325
+ function add_totals(left, right) {
4326
+ return {
4327
+ input_tokens: left.input_tokens + right.input_tokens,
4328
+ cache_write_5m_tokens: left.cache_write_5m_tokens + right.cache_write_5m_tokens,
4329
+ cache_write_1h_tokens: left.cache_write_1h_tokens + right.cache_write_1h_tokens,
4330
+ cache_read_tokens: left.cache_read_tokens + right.cache_read_tokens,
4331
+ output_tokens: left.output_tokens + right.output_tokens,
4332
+ thinking_tokens: left.thinking_tokens + right.thinking_tokens,
4333
+ thinking_measured: left.thinking_measured || right.thinking_measured
4334
+ };
4335
+ }
4336
+ function sum_totals(records) {
4337
+ let total = EMPTY_TOTALS;
4338
+ for (const record4 of records) total = add_totals(total, record4.totals);
4339
+ return total;
4340
+ }
4341
+ function billed_input(totals) {
4342
+ return totals.input_tokens + totals.cache_write_5m_tokens + totals.cache_write_1h_tokens + totals.cache_read_tokens;
4343
+ }
4344
+ var cost_usage = {
4345
+ EMPTY_TOTALS,
4346
+ UNKNOWN_MODEL,
4347
+ SYNTHETIC_MODEL,
4348
+ parse_line,
4349
+ dedupe,
4350
+ add_totals,
4351
+ sum_totals,
4352
+ billed_input
4353
+ };
4354
+
4355
+ // scripts/cost-runtime/cost-transcript.ts
4356
+ var TRANSCRIPT_ROOT = path19.join(".claude", "projects");
4357
+ var TRANSCRIPT_EXTENSION = ".jsonl";
4358
+ var SLUG_PATTERN = /[^a-zA-Z0-9-]/gu;
4359
+ var UNIT_DIRECTORY = "subagents";
4360
+ var UNIT_ID_SEPARATOR = "/";
4361
+ function project_slug(cwd) {
4362
+ return cwd.replaceAll(SLUG_PATTERN, "-");
4363
+ }
4364
+ function transcript_directory(cwd, home = homedir()) {
4365
+ return path19.join(home, TRANSCRIPT_ROOT, project_slug(cwd));
4366
+ }
4367
+ var GIT_ENTRY = ".git";
4368
+ var GITDIR_PREFIX = "gitdir:";
4369
+ var WORKTREE_SEGMENT = `/${GIT_ENTRY}/worktrees/`;
4370
+ var NOT_FOUND2 = -1;
4371
+ function linked_worktree_gitdir(cwd) {
4372
+ try {
4373
+ const contents = readFileSync7(path19.join(cwd, GIT_ENTRY), "utf8").trim();
4374
+ return contents.startsWith(GITDIR_PREFIX) ? contents.slice(GITDIR_PREFIX.length).trim() : "";
4375
+ } catch {
4376
+ return "";
4377
+ }
4378
+ }
4379
+ function session_cwd(cwd) {
4380
+ const gitdir = linked_worktree_gitdir(cwd);
4381
+ const absolute = gitdir === "" ? "" : path19.resolve(cwd, gitdir);
4382
+ const segment = absolute.indexOf(WORKTREE_SEGMENT);
4383
+ return segment === NOT_FOUND2 ? cwd : absolute.slice(0, segment);
4384
+ }
4385
+ function read_directory(directory) {
4386
+ try {
4387
+ return readdirSync2(directory);
4388
+ } catch {
4389
+ return [];
4390
+ }
4391
+ }
4392
+ function lane_transcript_directories(main_cwd, home) {
4393
+ const projects = path19.join(home, TRANSCRIPT_ROOT);
4394
+ const prefix = `${project_slug(lane_paths.lane_root(main_cwd))}-`;
4395
+ return read_directory(projects).filter(
4396
+ (name) => name.startsWith(prefix) && issue_number_shape.ISSUE_NUMBER_PATTERN.test(name.slice(prefix.length))
4397
+ ).map((name) => path19.join(projects, name));
4398
+ }
4399
+ function transcript_directories(cwd, home = homedir()) {
4400
+ const own3 = transcript_directory(cwd, home);
4401
+ const lanes = session_cwd(cwd) === cwd ? lane_transcript_directories(cwd, home) : [];
4402
+ return [.../* @__PURE__ */ new Set([own3, ...lanes])];
4403
+ }
4404
+ var OWN_DEPTH = 0;
4405
+ function home_directory() {
4406
+ return homedir();
4407
+ }
4408
+ function to_session_file(full_path, session_id, depth) {
4409
+ try {
4410
+ return {
4411
+ session_id,
4412
+ path: full_path,
4413
+ modified_ms: statSync(full_path).mtimeMs,
4414
+ is_delegated: depth > OWN_DEPTH,
4415
+ depth
4416
+ };
4417
+ } catch {
4418
+ return void 0;
4419
+ }
4420
+ }
4421
+ function is_transcript(name) {
4422
+ return name.endsWith(TRANSCRIPT_EXTENSION);
4423
+ }
4424
+ function without_extension(name) {
4425
+ return name.slice(0, -TRANSCRIPT_EXTENSION.length);
4426
+ }
4427
+ function own_files(directory, names) {
4428
+ return names.filter((name) => is_transcript(name)).map((name) => to_session_file(path19.join(directory, name), without_extension(name), OWN_DEPTH)).filter((file) => file !== void 0);
4429
+ }
4430
+ function unit_directory(directory, session_id) {
4431
+ return path19.join(directory, session_id, UNIT_DIRECTORY);
4432
+ }
4433
+ var UNIT_DEPTH = 1;
4434
+ function level_units(subagents_directory, prefix, depth) {
4435
+ return read_directory(subagents_directory).filter((name) => is_transcript(name)).map(
4436
+ (name) => to_session_file(
4437
+ path19.join(subagents_directory, name),
4438
+ `${prefix}${UNIT_ID_SEPARATOR}${without_extension(name)}`,
4439
+ depth
4440
+ )
4441
+ ).filter((file) => file !== void 0);
4442
+ }
4443
+ function collect_units(subagents_directory, prefix, depth) {
4444
+ const nested = read_directory(subagents_directory).filter((name) => !is_transcript(name)).flatMap(
4445
+ (name) => collect_units(
4446
+ unit_directory(subagents_directory, name),
4447
+ `${prefix}${UNIT_ID_SEPARATOR}${name}`,
4448
+ depth + 1
4449
+ )
4450
+ );
4451
+ return [...level_units(subagents_directory, prefix, depth), ...nested];
4452
+ }
4453
+ function unit_files(directory, session_name) {
4454
+ return collect_units(unit_directory(directory, session_name), session_name, UNIT_DEPTH);
4455
+ }
4456
+ function list_sessions(directory) {
4457
+ const names = read_directory(directory);
4458
+ const units = names.filter((name) => !is_transcript(name)).flatMap((name) => unit_files(directory, name));
4459
+ return [...own_files(directory, names), ...units].toSorted(
4460
+ (left, right) => right.modified_ms - left.modified_ms
4461
+ );
4462
+ }
4463
+ function list_sessions_across(directories2) {
4464
+ const seen = /* @__PURE__ */ new Set();
4465
+ const merged = directories2.flatMap((directory) => list_sessions(directory));
4466
+ const newest_first = merged.toSorted((left, right) => right.modified_ms - left.modified_ms);
4467
+ const kept = [];
4468
+ for (const file of newest_first) {
4469
+ if (seen.has(file.session_id)) continue;
4470
+ seen.add(file.session_id);
4471
+ kept.push(file);
4472
+ }
4473
+ return kept;
4474
+ }
4475
+ function owning_session_id(file) {
4476
+ const [owner] = file.session_id.split(UNIT_ID_SEPARATOR);
4477
+ return owner ?? file.session_id;
4478
+ }
4479
+ function parent_session_id(file) {
4480
+ const separator = file.session_id.lastIndexOf(UNIT_ID_SEPARATOR);
4481
+ return separator === NOT_FOUND2 ? file.session_id : file.session_id.slice(0, separator);
4482
+ }
4483
+ function latest_own_index(files) {
4484
+ const index = files.findIndex((file) => !file.is_delegated);
4485
+ return index === -1 ? 0 : index;
4486
+ }
4487
+ function empty_session() {
4488
+ return {
4489
+ records: [],
4490
+ no_usage_lines: 0,
4491
+ malformed_lines: 0,
4492
+ is_readable: false,
4493
+ baseline_tokens: 0
4494
+ };
4495
+ }
4496
+ function tally(content) {
4497
+ const outcomes = content.split("\n").map((line) => cost_usage.parse_line(line));
4498
+ const records = outcomes.flatMap(
4499
+ (outcome) => outcome.kind === "record" ? [outcome.record] : []
4500
+ );
4501
+ const unique = cost_usage.dedupe(records);
4502
+ const [first] = unique;
4503
+ return {
4504
+ records: unique,
4505
+ no_usage_lines: outcomes.filter((outcome) => outcome.kind === "no_usage").length,
4506
+ malformed_lines: outcomes.filter((outcome) => outcome.kind === "malformed").length,
4507
+ is_readable: true,
4508
+ baseline_tokens: first === void 0 ? 0 : cost_usage.billed_input(first.totals)
4509
+ };
4510
+ }
4511
+ function read_session(file) {
4512
+ const content = file_reader.read_if_readable(file.path);
4513
+ if (content === void 0) return { session_id: file.session_id, ...empty_session() };
4514
+ return { session_id: file.session_id, ...tally(content) };
4515
+ }
4516
+ function read_raw(file) {
4517
+ return file_reader.read_if_readable(file.path) ?? "";
4518
+ }
4519
+ function read_optional2(file) {
4520
+ return file_reader.read_if_readable(file.path);
4521
+ }
4522
+ function directory_exists(directory) {
4523
+ try {
4524
+ return statSync(directory).isDirectory();
4525
+ } catch {
4526
+ return false;
4527
+ }
4528
+ }
4529
+ function searched_directories(directories2) {
4530
+ return directories2.map((directory) => ({
4531
+ path: directory,
4532
+ exists: directory_exists(directory)
4533
+ }));
4534
+ }
4535
+ function describe_searched(directory) {
4536
+ return ` ${directory.path} \u2014 ${directory.exists ? "no transcripts here" : "no such directory"}`;
4537
+ }
4538
+ function missing_message(searched, session_id) {
4539
+ const lead = session_id === void 0 ? "No transcripts found. Searched:" : `No transcript named ${session_id}. Searched:`;
4540
+ const listed = searched.map((directory) => describe_searched(directory));
4541
+ if (session_id !== void 0) return [lead, ...listed];
4542
+ return [
4543
+ lead,
4544
+ ...listed,
4545
+ "Claude Code writes them per project; run this from the project it ran in."
4546
+ ];
4547
+ }
4548
+ var cost_transcript = {
4549
+ TRANSCRIPT_EXTENSION,
4550
+ TRANSCRIPT_ROOT,
4551
+ UNIT_DIRECTORY,
4552
+ project_slug,
4553
+ transcript_directory,
4554
+ transcript_directories,
4555
+ session_cwd,
4556
+ lane_transcript_directories,
4557
+ unit_directory,
4558
+ list_sessions,
4559
+ list_sessions_across,
4560
+ searched_directories,
4561
+ owning_session_id,
4562
+ parent_session_id,
4563
+ latest_own_index,
4564
+ tally,
4565
+ read_session,
4566
+ read_raw,
4567
+ read_optional: read_optional2,
4568
+ missing_message,
4569
+ home_directory
4570
+ };
4571
+
4572
+ // scripts/cost-runtime/own-session.ts
4573
+ var NOT_FOUND3 = -1;
4574
+ function session_id_of(environment) {
4575
+ const value = environment[agent_session_environment.SESSION_ID_KEY];
4576
+ return value === void 0 || value === "" ? void 0 : value;
4577
+ }
4578
+ function select_own_session(files, environment) {
4579
+ const session_id = session_id_of(environment);
4580
+ if (session_id === void 0) {
4581
+ return { kind: "own", index: cost_transcript.latest_own_index(files) };
4582
+ }
4583
+ const index = files.findIndex((file) => file.session_id === session_id);
4584
+ return index === NOT_FOUND3 ? { kind: "absent", session_id } : { kind: "own", index };
4585
+ }
4586
+ var own_session = {
4587
+ session_id_of,
4588
+ select_own_session
4589
+ };
4590
+
4591
+ // scripts/run/carry/run-carry-conversation.ts
4592
+ var CONVERSATION_QUIET_MS = 6e5;
4593
+ function transcript_of(session_id, directory) {
4594
+ return path20.join(directory, `${session_id}${cost_transcript.TRANSCRIPT_EXTENSION}`);
4595
+ }
4596
+ function own_transcript(environment = process.env, directories2 = cost_transcript.transcript_directories(process.cwd())) {
4597
+ const session_id = own_session.session_id_of(environment);
4598
+ if (session_id === void 0) return void 0;
4599
+ return directories2.map((directory) => transcript_of(session_id, directory)).find((file) => existsSync3(file));
4600
+ }
4601
+ function modified_ms(transcript) {
4602
+ try {
4603
+ return statSync2(transcript).mtimeMs;
4604
+ } catch {
4605
+ return void 0;
4606
+ }
4607
+ }
4608
+ function is_recent(modified, now) {
4609
+ return modified !== void 0 && now.getTime() - modified <= CONVERSATION_QUIET_MS;
4610
+ }
4611
+ function is_conversation_live(carry, now = /* @__PURE__ */ new Date(), read_modified = modified_ms) {
4612
+ if (carry.is_handed_off === true || carry.owner_transcript === void 0) return false;
4613
+ return is_recent(read_modified(carry.owner_transcript), now);
4614
+ }
4615
+ function is_same_conversation(carry, owner) {
4616
+ return owner.transcript !== void 0 && owner.transcript === carry.owner_transcript;
4617
+ }
4618
+ function reclaim_owner(carry, owner) {
4619
+ if (carry.is_handed_off === true || !is_same_conversation(carry, owner) || owner.pid === carry.owner_pid) {
4620
+ return carry;
4621
+ }
4622
+ return { ...carry, owner_pid: owner.pid, owner_start: owner.start };
4623
+ }
4624
+ var run_carry_conversation = {
4625
+ CONVERSATION_QUIET_MS,
4626
+ transcript_of,
4627
+ own_transcript,
4628
+ is_conversation_live,
4629
+ is_same_conversation,
4630
+ reclaim_owner
4631
+ };
4632
+
4633
+ // scripts/lane/lane-child-mark-keys.ts
4634
+ var KEY = "JOSH_LANE_CHILD";
4635
+ var OVERRUN_KEY = "JOSH_LANE_OVERRUN";
4636
+ var MARK_KEYS = [KEY, OVERRUN_KEY];
4637
+ var lane_child_mark_keys = { KEY, MARK_KEYS, OVERRUN_KEY };
4638
+
4639
+ // scripts/lane/lane-child-marker.ts
4640
+ var { KEY: KEY2, OVERRUN_KEY: OVERRUN_KEY2 } = lane_child_mark_keys;
4641
+ var CACHE_TTL_KEY = "CLAUDE_CODE_PROMPT_CACHE_TTL";
4642
+ var CACHE_TTL = "5m";
4643
+ var OVERRUN_VALUE = "1";
4644
+ function environment_for(issue) {
4645
+ issue_number_shape.require_issue_number(issue);
4646
+ return { [KEY2]: issue, [CACHE_TTL_KEY]: CACHE_TTL };
4647
+ }
4648
+ function marked_issue(source = process.env) {
4649
+ const value = source[KEY2];
4650
+ if (value === void 0) return void 0;
4651
+ return issue_number_shape.ISSUE_NUMBER_PATTERN.test(value) ? value : void 0;
4652
+ }
4653
+ function overrun_environment_for(issue) {
4654
+ return { ...environment_for(issue), [OVERRUN_KEY2]: OVERRUN_VALUE };
4655
+ }
4656
+ function is_overrun(source = process.env) {
4657
+ return source[OVERRUN_KEY2] === OVERRUN_VALUE && marked_issue(source) !== void 0;
4658
+ }
4659
+ function is_child_of(directory, source = process.env) {
4660
+ const marked = marked_issue(source);
4661
+ return marked !== void 0 && marked === lane_paths.lane_issue_of(directory, { ...source });
4662
+ }
4663
+ var lane_child_marker = {
4664
+ KEY: KEY2,
4665
+ OVERRUN_KEY: OVERRUN_KEY2,
4666
+ env_for: environment_for,
4667
+ overrun_env_for: overrun_environment_for,
4668
+ is_child_of,
4669
+ is_overrun,
4670
+ marked_issue
4671
+ };
4672
+
4673
+ // scripts/run/run-headless-keys.ts
4674
+ var HEADLESS_ENV_KEY = "JOSH_RUN_HEADLESS";
4675
+ var HANDOFF_CHILD_KEY = "JOSH_HANDOFF_CHILD";
4676
+ var BESIDE_CHILD_KEY = "JOSH_BESIDE_CHILD";
4677
+ var MARK_KEYS2 = [HEADLESS_ENV_KEY, HANDOFF_CHILD_KEY, BESIDE_CHILD_KEY];
4678
+ var run_headless_keys = {
4679
+ BESIDE_CHILD_KEY,
4680
+ HANDOFF_CHILD_KEY,
4681
+ HEADLESS_ENV_KEY,
4682
+ MARK_KEYS: MARK_KEYS2
4683
+ };
4684
+
4685
+ // scripts/run/carry/run-carry-session.ts
4686
+ var KEY3 = "JOSH_CARRY_SESSION";
4687
+ function own2() {
4688
+ if (lane_child_marker.marked_issue(process.env) !== void 0 || process.env[run_headless_keys.BESIDE_CHILD_KEY] === "1" || process.env[run_headless_keys.HANDOFF_CHILD_KEY] === "1") {
4689
+ return void 0;
4690
+ }
4691
+ return process.env[KEY3];
4692
+ }
4693
+ function is_owned_by(carry, owner) {
4694
+ if (carry.owner_session !== void 0) return carry.owner_session === owner.session;
4695
+ if (run_carry_conversation.is_same_conversation(carry, owner)) return true;
4696
+ return carry.owner_pid === owner.pid && carry.owner_start === owner.start;
4697
+ }
4698
+ function retain_execution(carry, owner) {
4699
+ if (owner.session === void 0 || owner.session !== carry.owner_session || owner.pid !== void 0) {
4700
+ return owner;
4701
+ }
4702
+ return {
4703
+ ...owner,
4704
+ pid: carry.owner_pid,
4705
+ start: carry.owner_start,
4706
+ provider: carry.scheduler_provider,
4707
+ is_headless: carry.is_owner_headless
4708
+ };
4709
+ }
4710
+ var run_carry_session = { KEY: KEY3, own: own2, is_owned_by, retain_execution };
4711
+
4712
+ // scripts/run/carry/run-carry.ts
4713
+ var CARRY_PREFIX = durable_state.PREFIX.CARRY;
4714
+ var REPOSITORY_DIRECTORY_INDEX = 1;
4715
+ var NO_INCREMENT3 = 0;
4716
+ var MAX_CUTS = 6;
4717
+ var END_COMMAND = "pnpm josh run:carry --end";
4718
+ var RESUME_COMMAND = "pnpm josh run:carry --resume";
4719
+ var READ_COMMAND = "pnpm josh run:carry --json";
4720
+ var NO_OWNER = {};
4721
+ var carry_addition_schema = z9.object({ issue: z9.number(), is_priority: z9.boolean() });
4722
+ var run_carry_schema = z9.object({
4723
+ scheduler_provider: agent_provider.PROVIDER_SCHEMA.optional(),
4724
+ invocation: z9.string(),
4725
+ started_at: z9.string(),
4726
+ merged: z9.number(),
4727
+ merged_issues: z9.array(z9.number()).optional(),
4728
+ filed: z9.number(),
4729
+ cuts: z9.number(),
4730
+ // Defaulted, so a record that lacks the streak parses with a zero streak rather than failing to read.
4731
+ failures: z9.number().default(0),
4732
+ outages: z9.number().default(0),
4733
+ last_outage_at: z9.string().optional(),
4734
+ // An absent owner reads as "no owner declared", which is the not-provably-live answer rather than a
4735
+ // live one.
4736
+ owner_pid: z9.number().optional(),
4737
+ owner_session: z9.string().optional(),
4738
+ owner_start: z9.string().optional(),
4739
+ owner_transcript: z9.string().optional(),
4740
+ is_owner_headless: z9.boolean().optional(),
4741
+ is_handed_off: z9.boolean().optional(),
4742
+ done: z9.array(z9.number()).optional(),
4743
+ retrospective: z9.boolean().optional(),
4744
+ added: z9.array(carry_addition_schema).optional(),
4745
+ lane_limit: z9.number().int().positive().optional(),
4746
+ launch_limit: z9.number().int().positive().optional()
4747
+ });
4748
+ function carry_path(git_directory) {
4749
+ return durable_state.path(CARRY_PREFIX, git_directory);
4750
+ }
4751
+ async function repository_directory() {
4752
+ const directories2 = await git_command.git_directories();
4753
+ return directories2[REPOSITORY_DIRECTORY_INDEX];
4754
+ }
4755
+ function parse_carry(raw) {
4756
+ return json_value.parse_with(raw, run_carry_schema);
4757
+ }
4758
+ function classify2(raw) {
4759
+ if (raw === void 0) return { kind: "none" };
4760
+ const carry = parse_carry(raw);
4761
+ if (carry === void 0 || Number.isNaN(Date.parse(carry.started_at))) {
4762
+ return { kind: "unreadable" };
4763
+ }
4764
+ return { kind: "carried", carry };
4765
+ }
4766
+ function read_carry(target2) {
4767
+ return classify2(stamp_file.read_stamp_text(target2));
4768
+ }
4769
+ function owner_of(pid, read4 = process_identity.read_start, transcript = run_carry_conversation.own_transcript()) {
4770
+ return { pid, start: read4(pid), transcript };
4771
+ }
4772
+ function session_owner() {
4773
+ const pid = agent_session_environment.own_session_pid();
4774
+ const owner = pid === void 0 ? NO_OWNER : owner_of(pid);
4775
+ const session = run_carry_session.own();
4776
+ return session === void 0 ? owner : { ...owner, session };
4777
+ }
4778
+ function fresh_carry(invocation, owner, now) {
4779
+ return {
4780
+ ...owner.provider && { scheduler_provider: owner.provider },
4781
+ invocation,
4782
+ started_at: now.toISOString(),
4783
+ merged: NO_INCREMENT3,
4784
+ filed: NO_INCREMENT3,
4785
+ cuts: NO_INCREMENT3,
4786
+ failures: NO_INCREMENT3,
4787
+ outages: NO_INCREMENT3,
4788
+ owner_pid: owner.pid,
4789
+ owner_session: owner.session,
4790
+ owner_start: owner.start,
4791
+ owner_transcript: owner.transcript,
4792
+ is_owner_headless: owner.is_headless
4793
+ };
4794
+ }
4795
+ function begin_carry(target2, invocation, owner = NO_OWNER, now = /* @__PURE__ */ new Date()) {
4796
+ const carry = fresh_carry(invocation, owner, now);
4797
+ return stamp_file.create_stamp(target2, carry) ? carry : void 0;
4798
+ }
4799
+ function adopt_carry(target2, carry, owner = NO_OWNER) {
4800
+ const next_owner = run_carry_session.retain_execution(carry, owner);
4801
+ const next = {
4802
+ ...carry,
4803
+ scheduler_provider: next_owner.provider,
4804
+ owner_pid: next_owner.pid,
4805
+ owner_session: owner.session,
4806
+ owner_start: next_owner.start,
4807
+ owner_transcript: owner.transcript,
4808
+ is_owner_headless: next_owner.is_headless,
4809
+ is_handed_off: false
4810
+ };
4811
+ stamp_file.remove_stamp(target2);
4812
+ return stamp_file.create_stamp(target2, next) ? next : void 0;
4813
+ }
4814
+ function is_owner_live(carry, now = /* @__PURE__ */ new Date(), same_process = process_identity.is_same_process) {
4815
+ if (same_process(carry.owner_pid, carry.owner_start) !== false) return true;
4816
+ return carry.is_owner_headless !== true && run_carry_conversation.is_conversation_live(carry, now);
4817
+ }
4818
+ var { is_owned_by: is_owned_by2 } = run_carry_session;
4819
+ function is_foreign_live_owner(carry, owner) {
4820
+ return is_owner_live(carry) && !is_owned_by2(carry, owner);
4821
+ }
4822
+ function is_held_by_self(carry, caller = owner_of(process.pid)) {
4823
+ return carry.owner_pid === caller.pid && carry.owner_start === caller.start;
4824
+ }
4825
+ function is_held_by_another(carry, is_live = is_owner_live) {
4826
+ return !is_held_by_self(carry) && is_live(carry);
4827
+ }
4828
+ function is_handed_off_to(carry, invocation) {
4829
+ return carry.is_handed_off === true && carry.invocation === invocation;
4830
+ }
4831
+ function classify_claim(carry, request) {
4832
+ if (is_handed_off_to(carry, request.invocation)) return "resume";
4833
+ if (is_foreign_live_owner(carry, request.owner)) return "busy";
4834
+ if (carry.invocation !== request.invocation) return "mismatch";
4835
+ return request.is_adoption ? "resume" : "standing";
4836
+ }
4837
+ function is_count_refused(carry, owner) {
4838
+ return carry.is_handed_off === true || is_foreign_live_owner(carry, owner);
4839
+ }
4840
+ function is_at_cut_cap(carry) {
4841
+ return carry.cuts >= MAX_CUTS;
4842
+ }
4843
+ function end_carry(target2) {
4844
+ stamp_file.remove_stamp(target2);
4845
+ }
4846
+ function retrospective_done_of(read4) {
4847
+ return read4.kind === "carried" && read4.carry.retrospective === true;
4848
+ }
4849
+ function left_of(carry, declared) {
4850
+ const done = carry.done ?? [];
4851
+ return run_carry_added.ordered(declared, carry.added).filter((issue) => !done.includes(issue));
4852
+ }
4853
+ function remaining_of(carry) {
4854
+ if (carry === void 0) return void 0;
4855
+ const declared = run_invocation.issue_numbers(carry.invocation);
4856
+ const left = left_of(carry, declared ?? []);
4857
+ return declared === void 0 && left.length === 0 ? void 0 : left;
4858
+ }
4859
+ function done_note(carry) {
4860
+ const done = carry.done ?? [];
4861
+ return done.length === 0 ? "" : `, issues ${done.join(", ")} done`;
4862
+ }
4863
+ function describe_carry(carry) {
4864
+ return `${carry.invocation} started ${carry.started_at}; ${String(carry.merged)} merged, ${String(carry.filed)} filed, ${String(carry.failures)} failed in a row, ${String(carry.outages)} outage(s) in a row, ${String(carry.cuts)} cut(s) crossed${done_note(carry)}`;
4865
+ }
4866
+ function mismatch_message(carry, invocation) {
4867
+ return `A different invocation is carried here \u2014 ${describe_carry(carry)}. This one is \`${invocation}\`. End the standing record with \`${END_COMMAND}\` once you know its run is over, then begin again.`;
4868
+ }
4869
+ function busy_message(carry) {
4870
+ return `A live run holds this budget \u2014 ${describe_carry(carry)}, owner pid ${String(carry.owner_pid)} still running. Nothing was established. Wait for that run, or end its record with \`${END_COMMAND}\` once you know it is over.`;
4871
+ }
4872
+ function claim_command(invocation) {
4873
+ return `${RESUME_COMMAND} "${invocation}"`;
4874
+ }
4875
+ function standing_message(carry) {
4876
+ return `A run record is standing here that no cut handed off \u2014 ${describe_carry(carry)}. Nothing was established. Carry that budget with \`${claim_command(carry.invocation)}\`, or discard it with \`${END_COMMAND}\` and begin again.`;
4877
+ }
4878
+ function count_refused_message(carry) {
4879
+ if (carry.is_handed_off === true) {
4880
+ return `This budget was handed off at a cut and is waiting for its successor \u2014 ${describe_carry(carry)}. Nothing was counted; the cutting session must not advance a handed-off budget.`;
4881
+ }
4882
+ return `A live run owns this budget \u2014 ${describe_carry(carry)}, owner pid ${String(carry.owner_pid)} still running. Nothing was counted; only its owner advances the budget.`;
4883
+ }
4884
+ function lost_message() {
4885
+ return `Another process established a run record here first, so nothing was established. Read it with \`${READ_COMMAND}\`.`;
4886
+ }
4887
+ function nothing_to_resume_message() {
4888
+ return `Nothing is carried here, so there is no budget to resume. Begin one with \`pnpm josh run:carry --begin "<invocation>"\`.`;
4889
+ }
4890
+ function unreadable_message() {
4891
+ return `A run record is here but could not be read; clear it with \`${END_COMMAND}\` once you know no run is using it.`;
4892
+ }
4893
+ function unknown_message() {
4894
+ return "This repository\u2019s git directory could not be read, so no run record was established.";
4895
+ }
4896
+ var run_carry = {
4897
+ END_COMMAND,
4898
+ MAX_CUTS,
4899
+ NO_OWNER,
4900
+ RESUME_COMMAND,
4901
+ adopt_carry,
4902
+ apply_change: run_carry_change.apply_change,
4903
+ begin_carry,
4904
+ busy_message,
4905
+ carry_path,
4906
+ claim_command,
4907
+ classify: classify2,
4908
+ classify_claim,
4909
+ count_refused_message,
4910
+ is_at_cut_cap,
4911
+ describe_carry,
4912
+ end_carry,
4913
+ mismatch_message,
4914
+ fresh_carry,
4915
+ is_count_refused,
4916
+ is_foreign_live_owner,
4917
+ is_held_by_another,
4918
+ is_held_by_self,
4919
+ is_owner_live,
4920
+ lost_message,
4921
+ nothing_to_resume_message,
4922
+ owner_of,
4923
+ parse_carry,
4924
+ read_carry,
4925
+ remaining_of,
4926
+ repository_directory,
4927
+ retrospective_done_of,
4928
+ session_owner,
4929
+ standing_message,
4930
+ unknown_message,
4931
+ unreadable_message
4932
+ };
4933
+
4934
+ // scripts/lane/lane-ledger-write.ts
4935
+ var LEDGER_PREFIX = durable_state.PREFIX.LANE_LEDGER;
4936
+ var LEDGER_SUFFIX = ".jsonl";
4937
+ var LINE_SEPARATOR = "\n";
4938
+ var CI_WAIT_STAGE = "ci-wait";
4939
+ var CODERABBIT_WAIT_STAGE = "coderabbit-wait";
4940
+ var CODERABBIT_RATE_LIMIT_STAGE = "coderabbit-rate-limit";
4941
+ var CODERABBIT_RETRIGGER_STAGE = "coderabbit-retriggered";
4942
+ var PRE_DETACH_STAGE = "pre-detach";
4943
+ var ROUND_ONE_REUSED = "reused";
4944
+ var LEDGER_FILE_MODE = 384;
4945
+ var { O_APPEND, O_CREAT, O_NOFOLLOW, O_WRONLY } = constants3;
4946
+ var APPEND_FLAGS = O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW;
4947
+ var { KIND: KIND2 } = lane_ledger_kind;
4948
+ function target_of(repository2) {
4949
+ return durable_state.path(LEDGER_PREFIX, repository2, LEDGER_SUFFIX);
4950
+ }
4951
+ async function target() {
4952
+ if (process.env["VITEST"] !== void 0) return void 0;
4953
+ try {
4954
+ const repository2 = await run_carry.repository_directory();
4955
+ return repository2 === void 0 ? void 0 : target_of(repository2);
4956
+ } catch {
4957
+ return void 0;
4958
+ }
4959
+ }
4960
+ function append(path22, entry2) {
4961
+ const descriptor = openSync(path22, APPEND_FLAGS, LEDGER_FILE_MODE);
4962
+ try {
4963
+ if (!stamp_file.is_own_regular_file(path22)) {
4964
+ throw new Error("Ledger is not an owned regular file");
4965
+ }
4966
+ writeSync(descriptor, `${JSON.stringify(entry2)}${LINE_SEPARATOR}`);
4967
+ } finally {
4968
+ closeSync(descriptor);
4969
+ }
4970
+ }
4971
+ async function record(entry2, path22) {
4972
+ try {
4973
+ const destination = path22 ?? await target();
4974
+ if (destination !== void 0) append(destination, entry2);
4975
+ } catch {
4976
+ }
4977
+ }
4978
+ function now_iso() {
4979
+ return (/* @__PURE__ */ new Date()).toISOString();
4980
+ }
4981
+ async function record_gate(path22, gate) {
4982
+ await record({ kind: KIND2.GATE, at: now_iso(), ...gate }, path22);
4983
+ }
4984
+ async function record_merge(issue, at = /* @__PURE__ */ new Date()) {
4985
+ await record({ kind: KIND2.MERGE, at: at.toISOString(), issue });
4986
+ }
4987
+ async function record_dispatch(issue, path22) {
4988
+ await record({ kind: KIND2.DISPATCH, at: now_iso(), issue }, path22);
4989
+ }
4990
+ async function record_stage(stage, path22) {
4991
+ await record({ kind: KIND2.STAGE, at: now_iso(), ...stage }, path22);
4992
+ }
4993
+ async function record_stop(stop, path22) {
4994
+ await record({ kind: KIND2.STOP, at: now_iso(), ...stop }, path22);
4995
+ }
4996
+ async function record_chain(chain, path22) {
4997
+ await record({ kind: KIND2.CHAIN, at: now_iso(), ...chain }, path22);
4998
+ }
4999
+ async function record_overlap(overlap, path22) {
5000
+ await record({ kind: KIND2.OVERLAP, at: now_iso(), ...overlap }, path22);
5001
+ }
5002
+ async function record_held(held, path22) {
5003
+ const waiting2 = held.waiting ?? [];
5004
+ const named = waiting2.length > 0 ? { waiting: [...waiting2] } : {};
5005
+ await record({ kind: KIND2.HELD, at: now_iso(), reason: held.reason, ...named }, path22);
5006
+ }
5007
+ async function record_released(path22) {
5008
+ await record({ kind: KIND2.RELEASED, at: now_iso() }, path22);
5009
+ }
5010
+ async function record_lane_state(change, path22) {
5011
+ await record({ kind: KIND2.LANE_STATE, at: now_iso(), ...change }, path22);
5012
+ }
5013
+ async function record_offerable(is_offerable, path22) {
5014
+ await record({ kind: KIND2.OFFERABLE, at: now_iso(), is_offerable }, path22);
5015
+ }
5016
+ async function record_offer(offer, path22) {
5017
+ await record({ kind: KIND2.OFFER, at: now_iso(), ...offer }, path22);
5018
+ }
5019
+ async function record_round_one(round_one, path22) {
5020
+ await record({ kind: KIND2.ROUND_ONE, at: now_iso(), ...round_one }, path22);
5021
+ }
5022
+ async function record_round_two(round_two, path22) {
5023
+ await record({ kind: KIND2.ROUND_TWO, at: now_iso(), ...round_two }, path22);
5024
+ }
5025
+ async function record_core_wait(wait, path22) {
5026
+ const is_immediate = wait.admission_reason !== void 0 && wait.wait_reason === void 0;
5027
+ const kind = is_immediate ? KIND2.CORE_ADMISSION : KIND2.CORE_WAIT;
5028
+ await record({ kind, at: now_iso(), ...wait }, path22);
5029
+ }
5030
+ async function record_unit_files(files, path22) {
5031
+ await record({ kind: KIND2.UNIT_FILES, at: now_iso(), files: [...files] }, path22);
5032
+ }
5033
+ async function record_test_related(run3, path22) {
5034
+ await record({ kind: KIND2.TEST_RELATED, at: now_iso(), ...run3 }, path22);
5035
+ }
5036
+ async function record_test_pinned(run3, path22) {
5037
+ await record({ kind: KIND2.TEST_PINNED, at: now_iso(), ...run3 }, path22);
5038
+ }
5039
+ async function record_split_notice(notice, path22) {
5040
+ await record({ kind: KIND2.SPLIT_NOTICE, at: now_iso(), ...notice }, path22);
5041
+ }
5042
+ async function record_split_filed(filed, path22) {
5043
+ const destination = path22 ?? await target();
5044
+ if (destination === void 0) throw new Error("Could not resolve the split-child ledger");
5045
+ append(destination, { kind: KIND2.SPLIT_FILED, at: now_iso(), ...filed });
5046
+ }
5047
+ async function record_push_miss(miss, path22) {
5048
+ await record({ kind: KIND2.PUSH_MISS, at: now_iso(), ...miss }, path22);
5049
+ }
5050
+ async function record_early_push(push3, path22) {
5051
+ await record({ kind: KIND2.EARLY_PUSH, at: now_iso(), ...push3 }, path22);
5052
+ }
5053
+ async function record_ship_lap(lap, path22) {
5054
+ await record({ kind: KIND2.SHIP_LAP, at: now_iso(), ...lap }, path22);
5055
+ }
5056
+ async function record_size(size, path22) {
5057
+ await record({ kind: KIND2.SIZE, at: now_iso(), ...size }, path22);
5058
+ }
5059
+ async function record_unplanned_notice(notice, path22) {
5060
+ await record({ kind: KIND2.UNPLANNED_NOTICE, at: now_iso(), ...notice }, path22);
5061
+ }
5062
+ var lane_ledger_write = {
5063
+ CI_WAIT_STAGE,
5064
+ CODERABBIT_RATE_LIMIT_STAGE,
5065
+ CODERABBIT_RETRIGGER_STAGE,
5066
+ CODERABBIT_WAIT_STAGE,
5067
+ KIND: KIND2,
5068
+ LINE_SEPARATOR,
5069
+ PRE_DETACH_STAGE,
5070
+ ROUND_ONE_REUSED,
5071
+ append,
5072
+ record,
5073
+ record_chain,
5074
+ record_core_wait,
5075
+ record_dispatch,
5076
+ record_gate,
5077
+ record_held,
5078
+ record_lane_state,
5079
+ record_released,
5080
+ record_merge,
5081
+ record_overlap,
5082
+ record_offer,
5083
+ record_offerable,
5084
+ record_push_miss,
5085
+ record_early_push,
5086
+ record_round_one,
5087
+ record_round_two,
5088
+ record_ship_lap,
5089
+ record_size,
5090
+ record_split_filed,
5091
+ record_split_notice,
5092
+ record_stage,
5093
+ record_stop,
5094
+ record_test_pinned,
5095
+ record_test_related,
5096
+ record_unit_files,
5097
+ record_unplanned_notice,
5098
+ target,
5099
+ target_of
5100
+ };
5101
+
5102
+ // scripts/run/startup/run-startup-store.ts
5103
+ async function carried_identity(issue) {
5104
+ const repository2 = await run_carry.repository_directory();
5105
+ if (repository2 === void 0) return void 0;
5106
+ const read4 = run_carry.read_carry(run_carry.carry_path(repository2));
5107
+ if (read4.kind !== "carried") return void 0;
5108
+ return {
5109
+ run: `${repository2}:${read4.carry.started_at}`,
5110
+ attempt: randomUUID3(),
5111
+ destination: lane_ledger_write.target_of(repository2),
5112
+ ...issue !== void 0 && { issue }
5113
+ };
5114
+ }
5115
+ async function identity(issue) {
5116
+ try {
5117
+ if (process.env["VITEST"] !== void 0) return void 0;
5118
+ return await carried_identity(issue);
5119
+ } catch {
5120
+ return void 0;
5121
+ }
5122
+ }
5123
+ async function record2(entry2, destination) {
5124
+ await lane_ledger_write.record(entry2, destination);
5125
+ }
5126
+ function counts(rows, edge) {
5127
+ const result = {};
5128
+ for (const row of rows) {
5129
+ if (row.edge !== edge) continue;
5130
+ const key = row.metric ?? "unknown";
5131
+ result[key] = (result[key] ?? 0) + 1;
5132
+ }
5133
+ return result;
5134
+ }
5135
+ function is_terminal(row) {
5136
+ return row.edge === "done" || row.edge === "failed" || row.edge === "waiting";
5137
+ }
5138
+ function summary(start, rows) {
5139
+ const ending = rows.find(is_terminal);
5140
+ return {
5141
+ start,
5142
+ status: ending?.edge ?? "incomplete",
5143
+ elapsed_ms: ending?.elapsed_ms,
5144
+ api: counts(rows, "api"),
5145
+ cache: counts(rows, "cache")
5146
+ };
5147
+ }
5148
+ function by_span(entries) {
5149
+ const groups = /* @__PURE__ */ new Map();
5150
+ for (const row of entries) {
5151
+ const group = groups.get(row.id) ?? [];
5152
+ group.push(row);
5153
+ groups.set(row.id, group);
5154
+ }
5155
+ return groups;
5156
+ }
5157
+ function summarize(entries) {
5158
+ const groups = by_span(entries);
5159
+ return entries.filter((row) => row.edge === "start").map((start) => summary(start, groups.get(start.id) ?? []));
5160
+ }
5161
+ function timestamp(row) {
5162
+ return row.at_ms ?? Date.parse(row.at);
5163
+ }
5164
+ function before_end(row, other, endings) {
5165
+ const end = endings.get(other.id);
5166
+ return end !== void 0 && timestamp(row) < end;
5167
+ }
5168
+ function overlaps(left, right, endings) {
5169
+ if (left.id === right.id || left.key !== right.key) return false;
5170
+ return before_end(left, right, endings) && before_end(right, left, endings);
5171
+ }
5172
+ function concurrent_misses(entries) {
5173
+ const fills = entries.filter((row) => row.edge === "cache" && row.metric === "fill");
5174
+ const endings = new Map(entries.filter(is_terminal).map((row) => [row.id, timestamp(row)]));
5175
+ return fills.filter((row) => fills.some((other) => overlaps(row, other, endings)));
5176
+ }
5177
+ var run_startup_store = { identity, record: record2, summarize, concurrent_misses };
5178
+
5179
+ // scripts/run/startup/run-startup.ts
5180
+ var ENVIRONMENT_KEY = "JOSH_STARTUP_SCOPE";
5181
+ var scope = inherited_scope.create(ENVIRONMENT_KEY, run_startup_schema.scope_schema);
5182
+ async function record3(row) {
5183
+ try {
5184
+ await run_startup_store.record(row, scope.current()?.destination);
5185
+ } catch {
5186
+ }
5187
+ }
5188
+ function entry(current, name, edge) {
5189
+ return run_startup_schema.entry_schema.parse({
5190
+ ...current,
5191
+ kind: lane_ledger_kind.KIND.STARTUP,
5192
+ at: (/* @__PURE__ */ new Date()).toISOString(),
5193
+ at_ms: performance.timeOrigin + performance.now(),
5194
+ id: current.span ?? randomUUID4(),
5195
+ phase: name,
5196
+ edge
5197
+ });
5198
+ }
5199
+ async function completed(name, run3, options) {
5200
+ const current = scope.current();
5201
+ if (current === void 0) return await run3();
5202
+ const started = performance.now();
5203
+ await record3(entry(current, name, "start"));
5204
+ const ending = { edge: "failed" };
5205
+ try {
5206
+ const value = await run3();
5207
+ ending.edge = options.edge_of?.(value) ?? "done";
5208
+ return value;
5209
+ } finally {
5210
+ await record3({ ...entry(current, name, ending.edge), elapsed_ms: performance.now() - started });
5211
+ }
5212
+ }
5213
+ async function current_scope(options) {
5214
+ return scope.current() ?? (options.root === true ? await run_startup_store.identity(options.issue) : void 0);
5215
+ }
5216
+ async function phase(name, run3, options = {}) {
5217
+ const current = await current_scope(options);
5218
+ if (current === void 0) return await run3();
5219
+ const next = {
5220
+ ...current,
5221
+ parent: current.span,
5222
+ span: randomUUID4(),
5223
+ ...options.issue !== void 0 && { issue: options.issue }
5224
+ };
5225
+ return await scope.within(next, async () => await completed(name, run3, options));
5226
+ }
5227
+ function metric(edge, name, key) {
5228
+ const current = scope.current();
5229
+ if (current === void 0) return;
5230
+ void record3({
5231
+ ...entry(current, "", edge),
5232
+ metric: name,
5233
+ ...key !== void 0 && { key: stamp_file.digest(key) }
5234
+ });
5235
+ }
5236
+ async function waiting(name) {
5237
+ const current = scope.current();
5238
+ const started = performance.now();
5239
+ const place = { ...current, span: randomUUID4(), parent: current?.span };
5240
+ if (current !== void 0) await record3(entry({ ...current, ...place }, name, "start"));
5241
+ return async () => {
5242
+ if (current === void 0) return;
5243
+ await record3({
5244
+ ...entry({ ...current, ...place }, name, "waiting"),
5245
+ elapsed_ms: performance.now() - started
5246
+ });
5247
+ };
5248
+ }
5249
+ var run_startup = {
5250
+ ENVIRONMENT_KEY,
5251
+ phase,
5252
+ metric,
5253
+ waiting,
5254
+ environment: scope.environment,
5255
+ within: scope.within
5256
+ };
5257
+
5258
+ // scripts/gh/gh-request-tally.ts
5259
+ var STATE_KEY = /* @__PURE__ */ Symbol.for("josh.gh-request-tally");
5260
+ function is_state(value) {
5261
+ return typeof value === "object" && value !== null && Reflect.has(value, "endpoints");
5262
+ }
5263
+ function shared_state() {
5264
+ const existing = Reflect.get(globalThis, STATE_KEY);
5265
+ if (is_state(existing)) return existing;
5266
+ const state = {
5267
+ tally: { calls: 0, not_modified: 0 },
5268
+ endpoints: /* @__PURE__ */ new Map(),
5269
+ core: { read: void 0, start: void 0 }
5270
+ };
5271
+ Reflect.set(globalThis, STATE_KEY, state);
5272
+ return state;
5273
+ }
5274
+ var { tally: tally2, endpoints, core } = shared_state();
5275
+ function watch_core(read4) {
5276
+ core.read = async () => {
5277
+ try {
5278
+ return await read4();
5279
+ } catch {
5280
+ return void 0;
5281
+ }
5282
+ };
5283
+ }
5284
+ function endpoint_of(kind) {
5285
+ const count = endpoints.get(kind) ?? { calls: 0, not_modified: 0 };
5286
+ endpoints.set(kind, count);
5287
+ return count;
5288
+ }
5289
+ function snapshot() {
5290
+ const entries = [...endpoints].map(([kind, count]) => [kind, { ...count }]);
5291
+ return { ...tally2, endpoints: Object.fromEntries(entries) };
5292
+ }
5293
+ function count_call(kind) {
5294
+ run_startup.metric("api", gh_call_kind.class_of(kind));
5295
+ if (core.read !== void 0) core.start ??= core.read();
5296
+ tally2.calls += 1;
5297
+ endpoint_of(kind).calls += 1;
5298
+ }
5299
+ function count_not_modified(kind) {
5300
+ tally2.not_modified += 1;
5301
+ endpoint_of(kind).not_modified += 1;
5302
+ }
5303
+ function to_delta(start, end) {
5304
+ if (start === void 0 || start.reset_ms !== end?.reset_ms) return void 0;
5305
+ return end.used - start.used;
5306
+ }
5307
+ async function core_delta() {
5308
+ if (core.read === void 0 || core.start === void 0) return void 0;
5309
+ const [start, end] = await Promise.all([core.start, core.read()]);
5310
+ return to_delta(start, end);
5311
+ }
5312
+ function reset() {
5313
+ tally2.calls = 0;
5314
+ tally2.not_modified = 0;
5315
+ endpoints.clear();
5316
+ core.read = void 0;
5317
+ core.start = void 0;
5318
+ }
5319
+ var gh_request_tally = {
5320
+ watch_core,
5321
+ count_call,
5322
+ count_not_modified,
5323
+ snapshot,
5324
+ core_delta,
5325
+ reset
5326
+ };
5327
+
5328
+ // scripts/gh/git-gh-check.ts
5329
+ import { execa as execa4 } from "execa";
5330
+ var GH_NOT_INSTALLED_MSG = "gh CLI is not installed. Install it from https://cli.github.com/";
5331
+ var gh_check = {};
5332
+ async function run_gh_check() {
5333
+ try {
5334
+ await execa4("gh", ["--version"], { timeout: COMMAND_TIMEOUT_MS });
5335
+ } catch {
5336
+ delete gh_check.promise;
5337
+ throw new Error(GH_NOT_INSTALLED_MSG);
5338
+ }
5339
+ }
5340
+ async function check_gh_installed() {
5341
+ gh_check.promise ??= run_gh_check();
5342
+ await gh_check.promise;
5343
+ }
5344
+
5345
+ // scripts/git/parse-json-array.ts
5346
+ function parse_json_loose(raw_json) {
5347
+ return json_value.parse_or_undefined(raw_json);
5348
+ }
5349
+ function parse_json_object_or_undefined(raw_json, schema) {
5350
+ const value = parse_json_loose(raw_json);
5351
+ if (value === void 0) return void 0;
5352
+ return schema.parse(value);
5353
+ }
5354
+ var parse_json = {
5355
+ parse_json_object_or_undefined
5356
+ };
5357
+
5358
+ // scripts/gh/git-gh-failure.ts
5359
+ import { z as z10 } from "zod";
5360
+ var error_document_schema = z10.object({ status: z10.union([z10.string(), z10.number()]).optional() }).catch({});
5361
+ var GH_FAILURE_FIELD = "gh_failure";
1309
5362
  function has_stdout_field(error) {
1310
5363
  return error instanceof Error && "stdout" in error && typeof error.stdout === "string";
1311
5364
  }
@@ -1315,8 +5368,8 @@ function has_gh_failure(error) {
1315
5368
  function parse_response_status(stdout) {
1316
5369
  const document = parse_json.parse_json_object_or_undefined(stdout, error_document_schema);
1317
5370
  if (document?.status === void 0) return void 0;
1318
- const status = Number(document.status);
1319
- return Number.isSafeInteger(status) ? status : void 0;
5371
+ const status2 = Number(document.status);
5372
+ return Number.isSafeInteger(status2) ? status2 : void 0;
1320
5373
  }
1321
5374
  function classify_stdout(stdout) {
1322
5375
  return { status: parse_response_status(stdout) };
@@ -1358,17 +5411,17 @@ var DEFAULT_HOOKS = {
1358
5411
  }
1359
5412
  };
1360
5413
  function summary_status(error) {
1361
- const { status } = SUMMARY_STATUS_PATTERN.exec(error.message)?.groups ?? {};
1362
- return status === void 0 ? void 0 : Number(status);
5414
+ const { status: status2 } = SUMMARY_STATUS_PATTERN.exec(error.message)?.groups ?? {};
5415
+ return status2 === void 0 ? void 0 : Number(status2);
1363
5416
  }
1364
5417
  function has_answer(spawn_error) {
1365
5418
  if (!(spawn_error instanceof Error) || !("stdout" in spawn_error)) return false;
1366
5419
  return typeof spawn_error.stdout === "string" && spawn_error.stdout.trim().length > 0;
1367
5420
  }
1368
- function is_transient_status(status, spawn_error, is_read2) {
5421
+ function is_transient_status(status2, spawn_error, is_read2) {
1369
5422
  if (is_read2 && has_timed_out(spawn_error)) return true;
1370
- if (status === void 0) return !has_answer(spawn_error);
1371
- return status >= SERVER_ERROR_FLOOR;
5423
+ if (status2 === void 0) return !has_answer(spawn_error);
5424
+ return status2 >= SERVER_ERROR_FLOOR;
1372
5425
  }
1373
5426
  function is_final_spawn(spawn_error, is_read2) {
1374
5427
  return !is_read2 && has_timed_out(spawn_error) || get_exit_code(spawn_error) === GH_AUTH_REQUIRED_EXIT_CODE;
@@ -1376,8 +5429,8 @@ function is_final_spawn(spawn_error, is_read2) {
1376
5429
  function is_transient_request(error, is_read2) {
1377
5430
  const failure = gh_failure.failure_of(error);
1378
5431
  if (failure === void 0 || !(error instanceof Error)) return false;
1379
- const status = failure.status ?? summary_status(error);
1380
- return !is_final_spawn(error.cause, is_read2) && is_transient_status(status, error.cause, is_read2);
5432
+ const status2 = failure.status ?? summary_status(error);
5433
+ return !is_final_spawn(error.cause, is_read2) && is_transient_status(status2, error.cause, is_read2);
1381
5434
  }
1382
5435
  function is_transient(error) {
1383
5436
  return is_transient_request(error, false);
@@ -1459,9 +5512,9 @@ function to_timeout_prefix(error) {
1459
5512
  function to_gh_error(error) {
1460
5513
  const stderr = has_stderr_field(error) ? error.stderr.trim() : "";
1461
5514
  const stdout = has_stdout_field(error) ? error.stdout.trim() : "";
1462
- const summary = stderr.length > 0 ? stderr : error_text.message_of(error);
1463
- const detail = stdout.length > 0 ? `${summary}
1464
- ${stdout}` : summary;
5515
+ const summary2 = stderr.length > 0 ? stderr : error_text.message_of(error);
5516
+ const detail = stdout.length > 0 ? `${summary2}
5517
+ ${stdout}` : summary2;
1465
5518
  return gh_failure.attach(
1466
5519
  new Error(`${to_timeout_prefix(error)}${detail}`, { cause: error }),
1467
5520
  gh_failure.classify_stdout(stdout)
@@ -1473,7 +5526,7 @@ async function spawn_gh_command(arguments_, timeout_ms, cwd) {
1473
5526
  const options = to_spawn_options(timeout_ms, cwd);
1474
5527
  gh_request_tally.count_call(gh_call_kind.of(arguments_));
1475
5528
  try {
1476
- const { stdout } = await execa2("gh", arguments_, options);
5529
+ const { stdout } = await execa5("gh", arguments_, options);
1477
5530
  return stdout.trimEnd();
1478
5531
  } catch (error) {
1479
5532
  throw to_gh_error(error);
@@ -1487,7 +5540,7 @@ async function spawn_gh_command_with_stdin(input) {
1487
5540
  const options = { input: input.stdin_body, ...to_spawn_options(input.timeout_ms, input.cwd) };
1488
5541
  gh_request_tally.count_call(gh_call_kind.of(input.args));
1489
5542
  try {
1490
- const { stdout } = await execa2("gh", input.args, options);
5543
+ const { stdout } = await execa5("gh", input.args, options);
1491
5544
  return stdout.trimEnd();
1492
5545
  } catch (error) {
1493
5546
  throw to_gh_error(error);
@@ -1498,31 +5551,31 @@ async function exec_gh_command_with_stdin(input) {
1498
5551
  }
1499
5552
  var STATUS_LINE_PATTERN = /^HTTP\/[\d.]+ (?<status>\d{3})\b/u;
1500
5553
  function parse_status_line(output) {
1501
- const { status } = STATUS_LINE_PATTERN.exec(output)?.groups ?? {};
1502
- return status === void 0 ? void 0 : Number(status);
5554
+ const { status: status2 } = STATUS_LINE_PATTERN.exec(output)?.groups ?? {};
5555
+ return status2 === void 0 ? void 0 : Number(status2);
1503
5556
  }
1504
5557
  function status_of_failure(error) {
1505
5558
  return has_stdout_field(error) ? parse_status_line(error.stdout) : void 0;
1506
5559
  }
1507
- async function spawn_gh_api_status(path7, timeout_ms) {
5560
+ async function spawn_gh_api_status(path22, timeout_ms) {
1508
5561
  const options = to_spawn_options(timeout_ms);
1509
5562
  try {
1510
5563
  await check_gh_installed();
1511
- gh_request_tally.count_call(gh_call_kind.of_api(path7));
1512
- const { stdout } = await execa2("gh", ["api", "--include", "--silent", path7], options);
5564
+ gh_request_tally.count_call(gh_call_kind.of_api(path22));
5565
+ const { stdout } = await execa5("gh", ["api", "--include", "--silent", path22], options);
1513
5566
  return parse_status_line(stdout);
1514
5567
  } catch (error) {
1515
5568
  return status_of_failure(error);
1516
5569
  }
1517
5570
  }
1518
- async function exec_gh_api_status(path7, timeout_ms) {
1519
- return await gh_slots.run(async () => await spawn_gh_api_status(path7, timeout_ms));
5571
+ async function exec_gh_api_status(path22, timeout_ms) {
5572
+ return await gh_slots.run(async () => await spawn_gh_api_status(path22, timeout_ms));
1520
5573
  }
1521
- function exec_gh_api_status_sync(path7, timeout_ms) {
5574
+ function exec_gh_api_status_sync(path22, timeout_ms) {
1522
5575
  const options = to_spawn_options(timeout_ms);
1523
- gh_request_tally.count_call(gh_call_kind.of_api(path7));
5576
+ gh_request_tally.count_call(gh_call_kind.of_api(path22));
1524
5577
  try {
1525
- const { stdout } = execaSync("gh", ["api", "--include", "--silent", path7], options);
5578
+ const { stdout } = execaSync2("gh", ["api", "--include", "--silent", path22], options);
1526
5579
  return parse_status_line(stdout);
1527
5580
  } catch (error) {
1528
5581
  return status_of_failure(error);
@@ -1578,7 +5631,7 @@ async function exec_gh_api(request) {
1578
5631
  async function exec_gh_api_uncounted(request) {
1579
5632
  const options = to_spawn_options(request.timeout_ms, request.cwd);
1580
5633
  try {
1581
- const { stdout } = await execa2("gh", to_gh_api_args(request), options);
5634
+ const { stdout } = await execa5("gh", to_gh_api_args(request), options);
1582
5635
  return stdout.trimEnd();
1583
5636
  } catch (error) {
1584
5637
  throw to_gh_error(error);
@@ -1591,7 +5644,7 @@ function exec_gh_api_sync(request) {
1591
5644
  const gh_arguments = to_gh_api_args(request);
1592
5645
  gh_request_tally.count_call(gh_call_kind.of(gh_arguments));
1593
5646
  try {
1594
- const { stdout } = execaSync("gh", gh_arguments, options);
5647
+ const { stdout } = execaSync2("gh", gh_arguments, options);
1595
5648
  return stdout.trimEnd();
1596
5649
  } catch (error) {
1597
5650
  throw to_gh_error(error);
@@ -1618,9 +5671,9 @@ var git_gh_exec = {
1618
5671
  };
1619
5672
 
1620
5673
  // scripts/version/npm-registry.ts
1621
- import { execaSync as execaSync2 } from "execa";
5674
+ import { execaSync as execaSync3 } from "execa";
1622
5675
  import semver3 from "semver";
1623
- import { z as z5 } from "zod";
5676
+ import { z as z11 } from "zod";
1624
5677
  var PUBLIC_REGISTRY = "https://registry.npmjs.org";
1625
5678
  var ABBREVIATED_ACCEPT = "application/vnd.npm.install-v1+json";
1626
5679
  var FULL_ACCEPT = "application/json";
@@ -1636,24 +5689,36 @@ var github_scopes = /* @__PURE__ */ new Map();
1636
5689
  var FETCH_SCRIPT = [
1637
5690
  "const [url, accept] = process.argv.slice(1)",
1638
5691
  "const response = await fetch(url, { headers: { accept } })",
1639
- "if (!response.ok) process.exit(1)",
5692
+ "if (!response.ok) { console.error(`HTTP ${response.status}`); process.exit(1) }",
1640
5693
  "process.stdout.write(await response.text())"
1641
5694
  ].join("\n");
1642
- var version_schema = z5.string().refine((value) => semver3.valid(value) === value);
1643
- var latest_schema = z5.looseObject({ "dist-tags": z5.looseObject({ latest: version_schema }) });
1644
- var times_schema = z5.looseObject({ time: release_age.release_times_schema });
1645
- var name_schema = z5.looseObject({ name: z5.string().optional() });
5695
+ var version_schema = z11.string().refine((value) => semver3.valid(value) === value);
5696
+ var latest_schema = z11.looseObject({ "dist-tags": z11.looseObject({ latest: version_schema }) });
5697
+ var public_version_schema = z11.looseObject({
5698
+ name: z11.string(),
5699
+ version: version_schema,
5700
+ dist: z11.looseObject({ tarball: z11.url(), integrity: z11.string() })
5701
+ });
5702
+ var times_schema = z11.looseObject({ time: release_age.release_times_schema });
5703
+ var name_schema = z11.looseObject({ name: z11.string().optional() });
1646
5704
  var PUBLISHING_SCOPE = "@joshuafolkken/";
1647
5705
  function packument_url(package_name) {
1648
5706
  return `${PUBLIC_REGISTRY}/${package_name.replace(SCOPE_SEPARATOR, () => ENCODED_SCOPE_SEPARATOR)}`;
1649
5707
  }
1650
- function read_packument(package_name, accept) {
1651
- const result = execaSync2(
5708
+ function read_packument(package_name, accept, should_require = false, version) {
5709
+ const base = packument_url(package_name);
5710
+ const url = version === void 0 ? base : `${base}/${version}`;
5711
+ const result = execaSync3(
1652
5712
  process.execPath,
1653
- ["--input-type=module", "-e", FETCH_SCRIPT, packument_url(package_name), accept],
5713
+ ["--input-type=module", "-e", FETCH_SCRIPT, url, accept],
1654
5714
  { reject: false, timeout: FETCH_TIMEOUT_MS }
1655
5715
  );
1656
- if (result.exitCode !== 0) return void 0;
5716
+ if (result.exitCode !== 0) {
5717
+ if (should_require) {
5718
+ throw new Error(`Public npm request failed: ${package_name}: ${result.stderr}`);
5719
+ }
5720
+ return void 0;
5721
+ }
1657
5722
  return json_value.parse_or_undefined(result.stdout);
1658
5723
  }
1659
5724
  function is_github_registry(value) {
@@ -1664,20 +5729,21 @@ function is_github_registry(value) {
1664
5729
  return false;
1665
5730
  }
1666
5731
  }
1667
- function is_github_scope(scope) {
1668
- const is_cached_github = github_scopes.get(scope);
5732
+ function is_github_scope(scope2) {
5733
+ const is_cached_github = github_scopes.get(scope2);
1669
5734
  if (is_cached_github !== void 0) return is_cached_github;
1670
- const result = execaSync2(PNPM, ["config", "get", `${scope}${SCOPE_REGISTRY_SUFFIX}`], {
5735
+ const result = execaSync3(PNPM, ["config", "get", `${scope2}${SCOPE_REGISTRY_SUFFIX}`], {
1671
5736
  reject: false,
1672
5737
  timeout: FETCH_TIMEOUT_MS
1673
5738
  });
1674
5739
  const is_github = result.exitCode === 0 && is_github_registry(result.stdout.trim());
1675
- github_scopes.set(scope, is_github);
5740
+ github_scopes.set(scope2, is_github);
1676
5741
  return is_github;
1677
5742
  }
1678
5743
  function is_public_source(package_name) {
1679
- const scope = SCOPE_PATTERN.exec(package_name)?.[0];
1680
- return scope === void 0 || !is_github_scope(scope);
5744
+ if (package_name === KIT_PACKAGE_NAME) return true;
5745
+ const scope2 = SCOPE_PATTERN.exec(package_name)?.[0];
5746
+ return scope2 === void 0 || !is_github_scope(scope2);
1681
5747
  }
1682
5748
  function read_latest(package_name) {
1683
5749
  if (!is_public_source(package_name)) return void 0;
@@ -1693,6 +5759,15 @@ function has_public_version(package_name, version) {
1693
5759
  const parsed = times_schema.safeParse(read_packument(package_name, FULL_ACCEPT));
1694
5760
  return parsed.success && parsed.data.time[version] !== void 0;
1695
5761
  }
5762
+ function read_public_version(package_name, version) {
5763
+ if (!version_schema.safeParse(version).success) return void 0;
5764
+ const selected = public_version_schema.safeParse(
5765
+ read_packument(package_name, FULL_ACCEPT, true, version)
5766
+ );
5767
+ if (!selected.success) return void 0;
5768
+ const entry2 = selected.data;
5769
+ return entry2.name === package_name && entry2.version === version ? entry2 : void 0;
5770
+ }
1696
5771
  function published_package_name(cwd) {
1697
5772
  const name = package_manifest.read_manifest_if_valid(cwd, name_schema)?.name;
1698
5773
  if (name?.startsWith(PUBLISHING_SCOPE) !== true) return void 0;
@@ -1700,7 +5775,7 @@ function published_package_name(cwd) {
1700
5775
  }
1701
5776
  function view(spec, field, format = "text") {
1702
5777
  const format_arguments = format === "json" ? [JSON_FLAG] : [];
1703
- const result = execaSync2(PNPM, ["view", spec, field, ...format_arguments], {
5778
+ const result = execaSync3(PNPM, ["view", spec, field, ...format_arguments], {
1704
5779
  reject: false,
1705
5780
  timeout: COMMAND_TIMEOUT_MS
1706
5781
  });
@@ -1714,6 +5789,7 @@ var npm_registry = {
1714
5789
  packument_url,
1715
5790
  published_package_name,
1716
5791
  read_latest,
5792
+ read_public_version,
1717
5793
  read_release_times,
1718
5794
  valid_version,
1719
5795
  view
@@ -1773,8 +5849,8 @@ function fetch_release_times(versions_endpoint, package_name) {
1773
5849
  }
1774
5850
 
1775
5851
  // scripts/version/version-targets.ts
1776
- import path6 from "node:path";
1777
- import { execaSync as execaSync3 } from "execa";
5852
+ import path21 from "node:path";
5853
+ import { execaSync as execaSync4 } from "execa";
1778
5854
  var NODE_MODULES2 = "node_modules";
1779
5855
  function build_pnpm_ls_arguments(package_name) {
1780
5856
  return ["ls", "-g", "--json", package_name];
@@ -1785,11 +5861,11 @@ function parse_global_version(stdout, package_name) {
1785
5861
  return parsed.data[0]?.dependencies?.[package_name]?.version;
1786
5862
  }
1787
5863
  function read_global_version(package_name) {
1788
- const result = execaSync3("pnpm", build_pnpm_ls_arguments(package_name), { reject: false });
5864
+ const result = execaSync4("pnpm", build_pnpm_ls_arguments(package_name), { reject: false });
1789
5865
  return parse_global_version(result.stdout, package_name);
1790
5866
  }
1791
5867
  function read_project_version(cwd, package_name) {
1792
- const package_directory = path6.join(cwd, NODE_MODULES2, package_name);
5868
+ const package_directory = path21.join(cwd, NODE_MODULES2, package_name);
1793
5869
  return package_manifest.read_manifest_if_valid(package_directory, package_version_schema)?.version;
1794
5870
  }
1795
5871
  function read_workspace_version(cwd) {
@@ -1893,7 +5969,7 @@ function run_check(config) {
1893
5969
  }
1894
5970
  function run_upgrade_step(step) {
1895
5971
  const [executable = "", ...rest] = step;
1896
- const result = execaSync4(executable, rest, {
5972
+ const result = execaSync5(executable, rest, {
1897
5973
  stdio: "inherit",
1898
5974
  reject: false,
1899
5975
  timeout: INSTALL_TIMEOUT_MS