@ebrindley/build 2026.11.29-rc.1 → 2026.11.30

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 (999) hide show
  1. package/.build-project/providers/pricing.json +120 -120
  2. package/README.md +5 -3
  3. package/dist/ai-judge-7QRPODW5.js +189 -0
  4. package/dist/allowlist-utils-UTV2BVC6.js +29 -0
  5. package/dist/apply-completion-mode-AX3JO47P.js +111 -0
  6. package/dist/artifact-migrator-COSKRONX.js +251 -0
  7. package/dist/ask-Y6J7ZG7U.js +177 -0
  8. package/dist/auth-4S3TCG3U.js +164 -0
  9. package/dist/auth-7JFLAPPG.js +97 -0
  10. package/dist/auth-F3L4WM4X.js +100 -0
  11. package/dist/auth-LKWU6MY3.js +96 -0
  12. package/dist/auth-LWR4K5WJ.js +184 -0
  13. package/dist/auth-TCWFPNKH.js +44 -0
  14. package/dist/auth-XDO5N5W7.js +92 -0
  15. package/dist/auth-XMI6YGL5.js +98 -0
  16. package/dist/auth-liveness-JQRZYOPF.js +53 -0
  17. package/dist/autoloop-cleanup-4BWHK726.js +106 -0
  18. package/dist/autoloop-gate-policy-RU5QCRRW.js +94 -0
  19. package/dist/autoloop-helpers-MPQV3CR3.js +52 -0
  20. package/dist/autoloop-run-defaults-HLLYKMQ5.js +27 -0
  21. package/dist/autoloop-success-HIWNPIKP.js +94 -0
  22. package/dist/autoloop-trajectory-NAZJ4FDN.js +71 -0
  23. package/dist/automatic-branch-cleanup-LITC4HBH.js +49 -0
  24. package/dist/autonomous-loop-controller-25SLNJRM.js +4419 -0
  25. package/dist/backend-DQV2E5NO.js +24 -0
  26. package/dist/backend-order-FA3472YN.js +112 -0
  27. package/dist/background-executor-M6X23KQK.js +263 -0
  28. package/dist/backlog-CV5WX5NW.js +390 -0
  29. package/dist/backlog-execution-intent-55LQ2QLQ.js +80 -0
  30. package/dist/backup-active-store-J6WW5B6W.js +16 -0
  31. package/dist/backup-machine-stores-XUJIV63O.js +251 -0
  32. package/dist/backup-telemetry-db-QQCLTM6R.js +26 -0
  33. package/dist/branch-cleanup-manager-IHJLSFHO.js +35 -0
  34. package/dist/build-gate-NHIOCA4K.js +69 -0
  35. package/dist/build-root-XQ2LDGA6.js +18 -0
  36. package/dist/change-summary-2P35V4IB.js +50 -0
  37. package/dist/chunk-2ABQORVF.js +96 -0
  38. package/dist/chunk-2D6ORBMW.js +204 -0
  39. package/dist/chunk-2KEKB74O.js +430 -0
  40. package/dist/chunk-2LY6SWFQ.js +106 -0
  41. package/dist/chunk-2UYVX52G.js +572 -0
  42. package/dist/chunk-322VCETO.js +338 -0
  43. package/dist/chunk-3AM7RQFY.js +568 -0
  44. package/dist/chunk-3BOQUDNJ.js +225 -0
  45. package/dist/chunk-3FLVW5SN.js +2018 -0
  46. package/dist/chunk-3HN5RJ6B.js +220 -0
  47. package/dist/chunk-3IU5PZID.js +24661 -0
  48. package/dist/chunk-3UOKKE4L.js +47 -0
  49. package/dist/chunk-3ZTMXGTM.js +181 -0
  50. package/dist/chunk-43OVHXJP.js +230 -0
  51. package/dist/chunk-43SLX7SB.js +3881 -0
  52. package/dist/chunk-446W2N7G.js +121 -0
  53. package/dist/chunk-44KC2BDD.js +257 -0
  54. package/dist/chunk-46CV2AXU.js +485 -0
  55. package/dist/chunk-4BWTBBOZ.js +173 -0
  56. package/dist/chunk-4CI7DAXV.js +2369 -0
  57. package/dist/chunk-4DZUJPGZ.js +6549 -0
  58. package/dist/chunk-4GMK2FOY.js +4083 -0
  59. package/dist/chunk-4ICHPKL7.js +50 -0
  60. package/dist/chunk-4IRFY5CP.js +328 -0
  61. package/dist/chunk-4NTO4FZY.js +26 -0
  62. package/dist/chunk-4RENZK5G.js +187 -0
  63. package/dist/chunk-4UX7WAEA.js +97 -0
  64. package/dist/chunk-4VAEBC43.js +872 -0
  65. package/dist/chunk-52EERG2K.js +197 -0
  66. package/dist/chunk-53I5ZWN4.js +315 -0
  67. package/dist/chunk-546BJRSJ.js +31 -0
  68. package/dist/chunk-56RQ7H2T.js +242 -0
  69. package/dist/chunk-5AKJ35KU.js +643 -0
  70. package/dist/chunk-5CBUNWJ3.js +237 -0
  71. package/dist/chunk-5FT5DZJU.js +306 -0
  72. package/dist/chunk-5I5PD4FV.js +33 -0
  73. package/dist/chunk-5JEEUMVC.js +576 -0
  74. package/dist/chunk-5KM4IFF5.js +523 -0
  75. package/dist/chunk-5M37KC2C.js +2478 -0
  76. package/dist/chunk-5NGRZQ37.js +1242 -0
  77. package/dist/chunk-5NYMJQEN.js +825 -0
  78. package/dist/chunk-5OFOXMEP.js +1052 -0
  79. package/dist/chunk-5PHWFWO5.js +887 -0
  80. package/dist/chunk-5QGN4OMZ.js +455 -0
  81. package/dist/chunk-5WAEIS6W.js +73 -0
  82. package/dist/chunk-5YTEPJJ6.js +753 -0
  83. package/dist/chunk-63ZTC7YM.js +180 -0
  84. package/dist/chunk-64HUBOJA.js +1754 -0
  85. package/dist/chunk-6K3QYLDK.js +677 -0
  86. package/dist/chunk-6O335CQ4.js +353 -0
  87. package/dist/chunk-6OLYI6DQ.js +17786 -0
  88. package/dist/chunk-6SYGYHJD.js +1027 -0
  89. package/dist/chunk-6TEFCQNZ.js +1133 -0
  90. package/dist/chunk-6XDEYPQ6.js +598 -0
  91. package/dist/chunk-73LLE7JJ.js +241 -0
  92. package/dist/chunk-76A7N43R.js +73 -0
  93. package/dist/chunk-77O6UPDY.js +2950 -0
  94. package/dist/chunk-77SOS44N.js +41 -0
  95. package/dist/chunk-7GQACZFQ.js +25 -0
  96. package/dist/chunk-7GS74VLQ.js +14 -0
  97. package/dist/chunk-7HVAKVRI.js +31 -0
  98. package/dist/chunk-7IJL2VY6.js +410 -0
  99. package/dist/chunk-7JLXSLA3.js +1063 -0
  100. package/dist/chunk-7MAE7V3O.js +546 -0
  101. package/dist/chunk-7O7H26VW.js +715 -0
  102. package/dist/chunk-7QAVWRJT.js +19419 -0
  103. package/dist/chunk-7Z22NOW4.js +8254 -0
  104. package/dist/chunk-7ZS6SHKA.js +1041 -0
  105. package/dist/chunk-A3GHJ4KS.js +142 -0
  106. package/dist/chunk-A5K5ZMOO.js +1487 -0
  107. package/dist/chunk-A6CFXX4X.js +737 -0
  108. package/dist/chunk-A7FDC4RZ.js +267 -0
  109. package/dist/chunk-A7ZYF66E.js +107 -0
  110. package/dist/chunk-AAPCXLSU.js +307 -0
  111. package/dist/chunk-ADJVO6UZ.js +977 -0
  112. package/dist/chunk-ALAFMV3C.js +342 -0
  113. package/dist/chunk-ALXV5QAB.js +398 -0
  114. package/dist/chunk-AWFRGPCT.js +4524 -0
  115. package/dist/chunk-AYLDFRVR.js +90 -0
  116. package/dist/chunk-B6FHVOH4.js +245 -0
  117. package/dist/chunk-BIHFSEOF.js +258 -0
  118. package/dist/chunk-BNMT5HDH.js +490 -0
  119. package/dist/chunk-BOCPPUPD.js +141 -0
  120. package/dist/chunk-BUMTGCTJ.js +1751 -0
  121. package/dist/chunk-BX7BZSCH.js +109 -0
  122. package/dist/chunk-BXZ7M2IZ.js +19 -0
  123. package/dist/chunk-CCDLD3YQ.js +204 -0
  124. package/dist/chunk-CGEQOKBM.js +650 -0
  125. package/dist/chunk-CHWTDO62.js +116 -0
  126. package/dist/chunk-CIOL6AGZ.js +655 -0
  127. package/dist/chunk-CJLYVCXU.js +85 -0
  128. package/dist/chunk-CP7SZ7WD.js +198 -0
  129. package/dist/chunk-CQ5UFSDL.js +1437 -0
  130. package/dist/chunk-CT76GAC6.js +152 -0
  131. package/dist/chunk-DAY7PLKR.js +1224 -0
  132. package/dist/chunk-DFRASQCY.js +264 -0
  133. package/dist/chunk-DKKS7O3V.js +68 -0
  134. package/dist/chunk-DLRQF4ZI.js +123 -0
  135. package/dist/chunk-DOS76IXZ.js +66 -0
  136. package/dist/chunk-DPPKV4VM.js +80 -0
  137. package/dist/chunk-DRUCSKQA.js +9 -0
  138. package/dist/chunk-EARCDRPV.js +510 -0
  139. package/dist/chunk-EAYRH4PM.js +1841 -0
  140. package/dist/chunk-EDCLABBZ.js +539 -0
  141. package/dist/chunk-EDI2ZDDG.js +489 -0
  142. package/dist/chunk-EG7PVC23.js +737 -0
  143. package/dist/chunk-EGJE7WI7.js +916 -0
  144. package/dist/chunk-EHLYZFQ3.js +976 -0
  145. package/dist/chunk-EI6F6KXZ.js +152 -0
  146. package/dist/chunk-EN3BRJ4M.js +62 -0
  147. package/dist/chunk-ENEZ2UZK.js +4046 -0
  148. package/dist/chunk-EOHXAE4I.js +445 -0
  149. package/dist/chunk-EQ6CFKVC.js +5113 -0
  150. package/dist/chunk-ERKNN26C.js +73 -0
  151. package/dist/chunk-ET3645ZR.js +4946 -0
  152. package/dist/chunk-EVBWWBLK.js +176 -0
  153. package/dist/chunk-EXPOGJKU.js +34 -0
  154. package/dist/chunk-EYGGX5VV.js +1358 -0
  155. package/dist/chunk-FDJD6ZW4.js +293 -0
  156. package/dist/chunk-FJEJOBYT.js +453 -0
  157. package/dist/chunk-FPSMXHVW.js +112 -0
  158. package/dist/chunk-FVLPKRDI.js +1267 -0
  159. package/dist/chunk-FWGHSP45.js +103 -0
  160. package/dist/chunk-G3Y74P2M.js +145 -0
  161. package/dist/chunk-GKYTKOZD.js +323 -0
  162. package/dist/chunk-GONP4H4J.js +482 -0
  163. package/dist/chunk-GSAUTEI5.js +15732 -0
  164. package/dist/chunk-GSSF7WE7.js +5552 -0
  165. package/dist/chunk-H3F7SQPH.js +1318 -0
  166. package/dist/chunk-HCPHBNNF.js +123 -0
  167. package/dist/chunk-HDBKA6HA.js +78 -0
  168. package/dist/chunk-HEKSYGYR.js +213 -0
  169. package/dist/chunk-HHLWTZDL.js +152 -0
  170. package/dist/chunk-HK4D2JQ3.js +365 -0
  171. package/dist/chunk-HKVI2JEM.js +53 -0
  172. package/dist/chunk-HLAFY5VQ.js +81 -0
  173. package/dist/chunk-HLVBWT2S.js +490 -0
  174. package/dist/chunk-HOJJHGDE.js +151 -0
  175. package/dist/chunk-HRA3GRZP.js +860 -0
  176. package/dist/chunk-HTZKX37C.js +6283 -0
  177. package/dist/chunk-II4QJWBI.js +389 -0
  178. package/dist/chunk-IKU5ETT5.js +852 -0
  179. package/dist/chunk-ILEI77YT.js +126 -0
  180. package/dist/chunk-ILJ35CUI.js +953 -0
  181. package/dist/chunk-IPCFFUSO.js +371 -0
  182. package/dist/chunk-IRJ65U55.js +20 -0
  183. package/dist/chunk-IRNCZ7GA.js +2287 -0
  184. package/dist/chunk-IT5RHXAL.js +392 -0
  185. package/dist/chunk-ITAQSLO7.js +302 -0
  186. package/dist/chunk-J4P3PSF7.js +305 -0
  187. package/dist/chunk-JCHU42E2.js +178 -0
  188. package/dist/chunk-JCUYUAJ6.js +2188 -0
  189. package/dist/chunk-JJWFK773.js +119 -0
  190. package/dist/chunk-JLQNE3DW.js +115 -0
  191. package/dist/chunk-JPZ3RFB2.js +224 -0
  192. package/dist/chunk-JRBDRVLG.js +1611 -0
  193. package/dist/chunk-JVBFCASW.js +206 -0
  194. package/dist/chunk-JVLPITFE.js +629 -0
  195. package/dist/chunk-JVRB7H46.js +154 -0
  196. package/dist/chunk-K4FEITLB.js +535 -0
  197. package/dist/chunk-K7IHVLMC.js +699 -0
  198. package/dist/chunk-K7LDQWAZ.js +226 -0
  199. package/dist/chunk-KAU7EXOS.js +544 -0
  200. package/dist/chunk-KCWTI6L6.js +855 -0
  201. package/dist/chunk-KCXBZT6N.js +1102 -0
  202. package/dist/chunk-KD3JHVH7.js +866 -0
  203. package/dist/chunk-KHH6FLUM.js +1672 -0
  204. package/dist/chunk-KUSBLYIZ.js +48 -0
  205. package/dist/chunk-L2E25UHK.js +318 -0
  206. package/dist/chunk-L45TR7YE.js +112 -0
  207. package/dist/chunk-L65DR3DA.js +128 -0
  208. package/dist/chunk-LE3HMEYD.js +263 -0
  209. package/dist/chunk-LIKJR4OZ.js +1429 -0
  210. package/dist/chunk-LJ4DBWU4.js +891 -0
  211. package/dist/chunk-LQTESWAU.js +18 -0
  212. package/dist/chunk-LVHMHEVN.js +3588 -0
  213. package/dist/chunk-LX5IU5TX.js +205 -0
  214. package/dist/chunk-LZJGCSW2.js +47 -0
  215. package/dist/chunk-MFXDLKZ4.js +334 -0
  216. package/dist/chunk-MHZ6LG6D.js +4692 -0
  217. package/dist/chunk-MQ62MQY5.js +535 -0
  218. package/dist/chunk-MTBJJEW6.js +1533 -0
  219. package/dist/chunk-MWX6GF64.js +1232 -0
  220. package/dist/chunk-MZWATAJ5.js +396 -0
  221. package/dist/chunk-MZY2X4BY.js +293 -0
  222. package/dist/chunk-N2GVQVMZ.js +360 -0
  223. package/dist/chunk-N2QFPC23.js +43 -0
  224. package/dist/chunk-N42JP72A.js +469 -0
  225. package/dist/chunk-N4JIL2JH.js +513 -0
  226. package/dist/chunk-N6GZBJC6.js +165 -0
  227. package/dist/chunk-N7DN2XQ2.js +188 -0
  228. package/dist/chunk-NEQ5COJM.js +487 -0
  229. package/dist/chunk-NOE2AC4Y.js +698 -0
  230. package/dist/chunk-NOK2P254.js +244 -0
  231. package/dist/chunk-NPE2EY5X.js +8991 -0
  232. package/dist/chunk-NPYXYTD3.js +320 -0
  233. package/dist/chunk-NSMHZKXN.js +13 -0
  234. package/dist/chunk-NTOOED63.js +319 -0
  235. package/dist/chunk-NV25VR5N.js +49 -0
  236. package/dist/chunk-NZORX7C6.js +43 -0
  237. package/dist/chunk-O4LG7DC4.js +1104 -0
  238. package/dist/chunk-OCLFRHVC.js +7024 -0
  239. package/dist/chunk-OEPYF23A.js +4301 -0
  240. package/dist/chunk-OFYHGYW2.js +236 -0
  241. package/dist/chunk-OH534UCC.js +129 -0
  242. package/dist/chunk-OLLOF3DM.js +1087 -0
  243. package/dist/chunk-ONSRQNXK.js +3667 -0
  244. package/dist/chunk-OQQJYRL4.js +884 -0
  245. package/dist/chunk-PAU2WCB5.js +83 -0
  246. package/dist/chunk-PCLYURZM.js +205 -0
  247. package/dist/chunk-PDZFFRVP.js +1461 -0
  248. package/dist/chunk-PFFMTB4W.js +288 -0
  249. package/dist/chunk-PMC2WE7L.js +292 -0
  250. package/dist/chunk-PNQOAORK.js +104 -0
  251. package/dist/chunk-PVYPEK3I.js +53 -0
  252. package/dist/chunk-PY3LR36X.js +637 -0
  253. package/dist/chunk-QCSYILNZ.js +27 -0
  254. package/dist/chunk-QD4QLWIP.js +229 -0
  255. package/dist/chunk-QFNYI6GT.js +946 -0
  256. package/dist/chunk-QGV6VOJI.js +2170 -0
  257. package/dist/chunk-QISV2HFY.js +525 -0
  258. package/dist/chunk-QK3F2EC5.js +555 -0
  259. package/dist/chunk-QKWQWBH3.js +159 -0
  260. package/dist/chunk-QN7IPD7E.js +204 -0
  261. package/dist/chunk-QOP72VG4.js +160 -0
  262. package/dist/chunk-R4BWGIY3.js +1681 -0
  263. package/dist/chunk-R5D7OHVL.js +99 -0
  264. package/dist/chunk-R7N4LHZY.js +63 -0
  265. package/dist/chunk-RBVSIFDW.js +373 -0
  266. package/dist/chunk-REKAPAX3.js +568 -0
  267. package/dist/chunk-RGMATJ5Z.js +79 -0
  268. package/dist/chunk-RIDXBLL6.js +92 -0
  269. package/dist/chunk-RIG7HTU7.js +167 -0
  270. package/dist/chunk-RPSVTHDC.js +14351 -0
  271. package/dist/chunk-RSIZC6TO.js +192 -0
  272. package/dist/chunk-RXMMCJSL.js +459 -0
  273. package/dist/chunk-RY4NKXBB.js +61 -0
  274. package/dist/chunk-S3I7E3GU.js +1139 -0
  275. package/dist/chunk-S3ZPX3AY.js +248 -0
  276. package/dist/chunk-S5FAB637.js +1853 -0
  277. package/dist/chunk-SDP4FSKS.js +124 -0
  278. package/dist/chunk-SIIUXZN3.js +39 -0
  279. package/dist/chunk-SJUNPB4C.js +189 -0
  280. package/dist/chunk-SN6UVHBX.js +88 -0
  281. package/dist/chunk-STETQZPA.js +616 -0
  282. package/dist/chunk-SWPL2VQ5.js +3674 -0
  283. package/dist/chunk-SXKQ6S4K.js +53 -0
  284. package/dist/chunk-SZXNW33V.js +126 -0
  285. package/dist/chunk-T4D67MDH.js +452 -0
  286. package/dist/chunk-TBBMN6WY.js +5405 -0
  287. package/dist/chunk-TD4VUICM.js +128 -0
  288. package/dist/chunk-TEWWMUL3.js +120 -0
  289. package/dist/chunk-TGHMBI3P.js +936 -0
  290. package/dist/chunk-TIZDT7WN.js +342 -0
  291. package/dist/chunk-TKOQHBWL.js +2227 -0
  292. package/dist/chunk-TKUHQCSM.js +970 -0
  293. package/dist/chunk-TPMLM7RS.js +169 -0
  294. package/dist/chunk-TQZJK2GF.js +763 -0
  295. package/dist/chunk-TXSR2GAM.js +1231 -0
  296. package/dist/chunk-TYGFXH6J.js +521 -0
  297. package/dist/chunk-U7PECEL6.js +1402 -0
  298. package/dist/chunk-UENRYSCZ.js +403 -0
  299. package/dist/chunk-UFRGGXQG.js +9622 -0
  300. package/dist/chunk-UHGOKHLR.js +912 -0
  301. package/dist/chunk-UON4D7CJ.js +833 -0
  302. package/dist/chunk-V5ZK46ZN.js +69 -0
  303. package/dist/chunk-V6KIOYYV.js +380 -0
  304. package/dist/chunk-V73CTZKO.js +122 -0
  305. package/dist/chunk-VAY2U3KK.js +29 -0
  306. package/dist/chunk-VOEIZFZK.js +527 -0
  307. package/dist/chunk-VXBODKFY.js +272 -0
  308. package/dist/chunk-VXGEQLZ2.js +465 -0
  309. package/dist/chunk-VZH5DGNK.js +160 -0
  310. package/dist/chunk-WX3G2PN6.js +146 -0
  311. package/dist/chunk-WZWXLKEX.js +48 -0
  312. package/dist/chunk-X4CWMMHJ.js +2155 -0
  313. package/dist/chunk-X6R6CVUC.js +294 -0
  314. package/dist/chunk-XD63TH2A.js +3639 -0
  315. package/dist/chunk-XFT3EHMS.js +304 -0
  316. package/dist/chunk-XHHTSY2C.js +193 -0
  317. package/dist/chunk-XLERMMC6.js +1414 -0
  318. package/dist/chunk-XPLKNO54.js +272 -0
  319. package/dist/chunk-XQK54PEG.js +491 -0
  320. package/dist/chunk-XR4B4ON2.js +339 -0
  321. package/dist/chunk-XS5DH42P.js +911 -0
  322. package/dist/chunk-Y26HWPYX.js +4967 -0
  323. package/dist/chunk-Y2OSBLHL.js +260 -0
  324. package/dist/chunk-Y2TFKFAN.js +396 -0
  325. package/dist/chunk-Y3ATTWF2.js +263 -0
  326. package/dist/chunk-Y63TWT4U.js +179 -0
  327. package/dist/chunk-YA5IQXZX.js +344 -0
  328. package/dist/chunk-YBK3OAFA.js +209 -0
  329. package/dist/chunk-YIXHBDCQ.js +115 -0
  330. package/dist/chunk-YKJD7XGX.js +828 -0
  331. package/dist/chunk-YLQMRUDV.js +147 -0
  332. package/dist/chunk-YM5C6JQQ.js +460 -0
  333. package/dist/chunk-YPAVWDXQ.js +60 -0
  334. package/dist/chunk-YPCF7ZWS.js +110 -0
  335. package/dist/chunk-YUP4U7F3.js +247 -0
  336. package/dist/chunk-YY5RNFD7.js +538 -0
  337. package/dist/chunk-YZRRPMO5.js +15190 -0
  338. package/dist/chunk-Z3JFB2PG.js +498 -0
  339. package/dist/chunk-Z6USLNUD.js +1214 -0
  340. package/dist/chunk-ZEM2MURX.js +514 -0
  341. package/dist/chunk-ZFHW4JVC.js +127 -0
  342. package/dist/chunk-ZJRSXT2L.js +951 -0
  343. package/dist/chunk-ZL35PLQE.js +2898 -0
  344. package/dist/chunk-ZLBNMVDZ.js +426 -0
  345. package/dist/chunk-ZMATRK4I.js +624 -0
  346. package/dist/chunk-ZQEJEV7L.js +557 -0
  347. package/dist/chunk-ZYXZNKBR.js +540 -0
  348. package/dist/cli-utils-CR6QZ6QE.js +31 -0
  349. package/dist/cli-validation-VPKISCKF.js +124 -0
  350. package/dist/commit-utils-Q3UHGMUB.js +49 -0
  351. package/dist/compete-config-resolver-ZYXFXJES.js +125 -0
  352. package/dist/compete-results-6YCPPGUX.js +315 -0
  353. package/dist/competition-outcome-tracker-JOXGYAME.js +62 -0
  354. package/dist/config-3PHBXBUC.js +237 -0
  355. package/dist/config-BVAYS6UF.js +46 -0
  356. package/dist/config-audit-LL2QG3PL.js +371 -0
  357. package/dist/config-explain-CSX6Y66G.js +71 -0
  358. package/dist/config-loader-UQEQJQNQ.js +52 -0
  359. package/dist/config-manager-MUHTJLH7.js +114 -0
  360. package/dist/config-merger-2WV7YWJS.js +14 -0
  361. package/dist/config-validator-OXIIFA7L.js +122 -0
  362. package/dist/cost-K7VYMBQ5.js +82 -0
  363. package/dist/data-migration-state-STPHHM6A.js +35 -0
  364. package/dist/db-migrator-5QZ2C7CL.js +34 -0
  365. package/dist/default-paths-QO4RD5CH.js +49 -0
  366. package/dist/discovery-K5RNSXXI.js +53 -0
  367. package/dist/doctor-E4Q4CKHD.js +268 -0
  368. package/dist/doctor-context-blocks-ZIYP276L.js +252 -0
  369. package/dist/doctor-instructions-import-26ZYVWL2.js +70 -0
  370. package/dist/doctor-purpose-KCLMZX54.js +30 -0
  371. package/dist/domain-analyzer-EZFIDBH7.js +47 -0
  372. package/dist/ensure-initialized-ODHQ5IXB.js +75 -0
  373. package/dist/entry.js +38 -38
  374. package/dist/error-parser-core-VAX2C2BE.js +70 -0
  375. package/dist/evaluation-context-PMDGLBBW.js +61 -0
  376. package/dist/evidence-plan-resolver-5NGSVNXT.js +111 -0
  377. package/dist/execution-data-writer-C3TN7WLA.js +77 -0
  378. package/dist/execution-policy-applier-KQ36LBBN.js +63 -0
  379. package/dist/execution-preflight-W7JMM5XT.js +224 -0
  380. package/dist/execution-roles-N7KXTA5I.js +112 -0
  381. package/dist/factory-VSWXYDPJ.js +207 -0
  382. package/dist/failure-taxonomy-FCEJXQX4.js +26 -0
  383. package/dist/flywheel-allowlist-revert-BCWV5L5T.js +1 -1
  384. package/dist/flywheel-autoloop-executor-OKVYXX6O.js +307 -0
  385. package/dist/flywheel-autoloop-unverified-ZO6OGV63.js +60 -0
  386. package/dist/flywheel-competition-executor-C6M5FI2A.js +324 -0
  387. package/dist/flywheel-executor-OPFNQ5DO.js +428 -0
  388. package/dist/flywheel-git-isolation-KBUQXVRL.js +50 -0
  389. package/dist/flywheel-manifest-6JVCFVNP.js +114 -0
  390. package/dist/flywheel-model-defaults-5OXQDJCG.js +115 -0
  391. package/dist/flywheel-preflight-5N2UWTYS.js +172 -0
  392. package/dist/flywheel-resume-ALKWQU3E.js +95 -0
  393. package/dist/flywheel-resume-execution-lease-SSEDP276.js +59 -0
  394. package/dist/flywheel-safety-FZYEDI7G.js +19 -0
  395. package/dist/flywheel-scope-decision-KO6UWGHG.js +14 -0
  396. package/dist/get-telemetry-logger-LWU4WCI5.js +153 -0
  397. package/dist/git-message-style-OBFYLGHX.js +105 -0
  398. package/dist/identity-6OB7NIFV.js +25 -0
  399. package/dist/index-query-ZXNSG63P.js +37 -0
  400. package/dist/index.js +1199 -1005
  401. package/dist/indexer-GMCTRQUJ.js +44 -0
  402. package/dist/init-K777TJZ5.js +244 -0
  403. package/dist/instructions-PS3QTCXV.js +188 -0
  404. package/dist/instructions-import-offer-NIYYZFCT.js +366 -0
  405. package/dist/instructions-run-NUX7OEJA.js +116 -0
  406. package/dist/interrupted-work-JJDX5BE2.js +43 -0
  407. package/dist/invocation-telemetry-ANFI74DI.js +78 -0
  408. package/dist/invoke-provider-auth-L23ZQG6Y.js +38 -0
  409. package/dist/lab-mode-3CV2FVEJ.js +44 -0
  410. package/dist/linux-host-class-YDZGPQ77.js +31 -0
  411. package/dist/llm-judge-executor-3TR2UI4M.js +180 -0
  412. package/dist/local-ci-config-QPMPQ3CN.js +50 -0
  413. package/dist/local-executor-Y4U6GGDZ.js +282 -0
  414. package/dist/logger-KHRXKL4E.js +152 -0
  415. package/dist/matrix-prompt-builder-CNCNXQAQ.js +536 -0
  416. package/dist/merge-batch-DU5EHGBP.js +322 -0
  417. package/dist/merge-queue-GB36JHMJ.js +126 -0
  418. package/dist/merge-queue-trust-6D2NH3SI.js +21 -0
  419. package/dist/metadata-45WCCBVK.js +29 -0
  420. package/dist/model-catalog-readiness-YRGBS7Q5.js +203 -0
  421. package/dist/model-invocations-db-HLIF6QDW.js +70 -0
  422. package/dist/model-resolver-OSKB64KV.js +215 -0
  423. package/dist/model-resolver-STIKZHLT.js +43 -0
  424. package/dist/monitor-SSW7KL4T.js +96 -0
  425. package/dist/next-7MVYLB45.js +97 -0
  426. package/dist/next-BZ2PHISP.js +150 -0
  427. package/dist/opportunistic-CKPHHTW7.js +86 -0
  428. package/dist/optimization-config-resolver-2QP2UWZN.js +148 -0
  429. package/dist/path-security-I5CLJDOY.js +39 -0
  430. package/dist/paths-37XBCAKZ.js +37 -0
  431. package/dist/plan-backlog-list-fast-S2WGMPWQ.js +88 -0
  432. package/dist/plan-backlog-show-fast-JFTAZCRN.js +111 -0
  433. package/dist/plan-sprint-list-fast-ZEAXVWGM.js +108 -0
  434. package/dist/plan-sprint-status-fast-UGUK6RXM.js +114 -0
  435. package/dist/plan-task-status-fast-VBMZHPQV.js +112 -0
  436. package/dist/process-registry-7OH7WULX.js +28 -0
  437. package/dist/process-scanner-X73A5I56.js +23 -0
  438. package/dist/processes-Q5S47K3W.js +29 -0
  439. package/dist/processes-json-fast-D4MGBC7J.js +72 -0
  440. package/dist/profile-TJUHSSII.js +207 -0
  441. package/dist/project-runtime-paths-Z4PJDEKQ.js +41 -0
  442. package/dist/provider-aware-resource-manager-HBRZTPIW.js +39 -0
  443. package/dist/provider-matrix-3YJKJDVU.js +212 -0
  444. package/dist/provider-output-forwarding-FRLPKRCE.js +26 -0
  445. package/dist/provider-registry-C64B4WNA.js +136 -0
  446. package/dist/publication-turn-PKP4MLTX.js +44 -0
  447. package/dist/quality-gate-ZFFFJ2FF.js +73 -0
  448. package/dist/quickstart-WO4JWPQW.js +107 -0
  449. package/dist/readiness-KB7T7ASY.js +214 -0
  450. package/dist/readiness-NJPGSWWZ.js +141 -0
  451. package/dist/registry-DKCEDGZB.js +215 -0
  452. package/dist/repo-root-V6U62IJP.js +28 -0
  453. package/dist/resolution-engine-LJ7LFNPS.js +190 -0
  454. package/dist/resolve-provider-cli-IID7EUQK.js +44 -0
  455. package/dist/restore-telemetry-db-2JXSMSTP.js +459 -0
  456. package/dist/routing-events-P7SHI273.js +13 -0
  457. package/dist/routing-history-store-6K6K7QPY.js +47 -0
  458. package/dist/routing-planner-5WP627QU.js +218 -0
  459. package/dist/runner-2GISBYE7.js +1815 -0
  460. package/dist/runner-VY4R2ZDQ.js +1202 -0
  461. package/dist/safety-VORB2OER.js +65 -0
  462. package/dist/safety-stanza-4N4EKGJW.js +49 -0
  463. package/dist/sandbox-SHNVGNYF.js +72 -0
  464. package/dist/sandbox-Z4UKFSX5.js +80 -0
  465. package/dist/setup-temp-cleanup-CCPUVRP4.js +29 -0
  466. package/dist/shared-utils-VQZQW5WD.js +42 -0
  467. package/dist/sprint-bridge-TDGT22W4.js +116 -0
  468. package/dist/sprint-completion-dependents-7PBL523O.js +43 -0
  469. package/dist/sprint-execution-service-4A76YEJK.js +373 -0
  470. package/dist/sprint-manager-X34JLIJU.js +132 -0
  471. package/dist/sqlite-timeout-config-HEXOFTMM.js +13 -0
  472. package/dist/sqlite-wrapper-4J37RTNE.js +19 -0
  473. package/dist/stale-cleanup-orchestrator-YICA3YEU.js +71 -0
  474. package/dist/storage-access-B3CPV4FH.js +31 -0
  475. package/dist/store-XPHC4MLJ.js +25 -0
  476. package/dist/task-classifier-C3E353M3.js +521 -0
  477. package/dist/task-list-fast-7LWCFIFE.js +108 -0
  478. package/dist/task-manager-2WSEVZ3E.js +130 -0
  479. package/dist/task-report-66CTVCDC.js +64 -0
  480. package/dist/telemetry-WBGBBPCQ.js +196 -0
  481. package/dist/telemetry-lab-scope-JG6HJRES.js +31 -0
  482. package/dist/telemetry-path-resolver-BDZFUGVT.js +34 -0
  483. package/dist/telemetry-reliability-V4BYE5NU.js +77 -0
  484. package/dist/unified-state-cleanup-XJND3PQ3.js +292 -0
  485. package/dist/universal-cost-calculator-QUD75SBH.js +70 -0
  486. package/dist/user-agents-ROOKUA2R.js +30 -0
  487. package/dist/variant-execution-EFILJOXO.js +317 -0
  488. package/dist/variant-opt-parser-65YRHC2B.js +248 -0
  489. package/dist/variant-state-cleanup-LAGQ6JZM.js +287 -0
  490. package/dist/variant-worker-WEYWKED2.js +4573 -0
  491. package/dist/variant-worker.js +4 -4
  492. package/dist/variants-XLUSJZ6F.js +262 -0
  493. package/dist/verification-command-IEVDCOET.js +67 -0
  494. package/dist/verify-commands-TTX4FMHU.js +67 -0
  495. package/dist/work-edge-GG7WSEBW.js +50 -0
  496. package/dist/worker-KOF2B33T.js +1528 -0
  497. package/dist/worker.js +4 -4
  498. package/dist/workspace-tree-identity-XGYRHWQE.js +52 -0
  499. package/dist/worktree-environment-NRWIGOUP.js +60 -0
  500. package/dist/worktree-metrics-AM45GE5L.js +66 -0
  501. package/dist/writeback-573M6DNN.js +51 -0
  502. package/docs/CLI_REFERENCE.md +8 -8
  503. package/docs/reference/AGENT_CONTEXT.md +53 -5
  504. package/npm-shrinkwrap.json +2 -2
  505. package/package.json +1 -1
  506. package/templates/AGENTS.template.md +10 -27
  507. package/templates/builtin-workflows/skills/execution-contract-code/SKILL.md +4 -2
  508. package/dist/ai-judge-DHVNPGD6.js +0 -190
  509. package/dist/allowlist-utils-C3O2QUMN.js +0 -29
  510. package/dist/apply-completion-mode-UHZ5CKEK.js +0 -112
  511. package/dist/artifact-migrator-FKXM2ZHW.js +0 -251
  512. package/dist/ask-MEVFZPUC.js +0 -178
  513. package/dist/auth-3H57UDCK.js +0 -165
  514. package/dist/auth-4IRDL27A.js +0 -97
  515. package/dist/auth-AG2MHA2W.js +0 -98
  516. package/dist/auth-MRSKG3B4.js +0 -44
  517. package/dist/auth-QK3AKGIO.js +0 -101
  518. package/dist/auth-SFJ3OE2R.js +0 -185
  519. package/dist/auth-SJVDTKGV.js +0 -99
  520. package/dist/auth-ZGPTUIVB.js +0 -93
  521. package/dist/auth-liveness-3DG6JMOQ.js +0 -53
  522. package/dist/autoloop-cleanup-M2S4SLL5.js +0 -106
  523. package/dist/autoloop-gate-policy-WSIDFFLA.js +0 -95
  524. package/dist/autoloop-helpers-YL7UAPVU.js +0 -53
  525. package/dist/autoloop-run-defaults-B5MWBDMU.js +0 -27
  526. package/dist/autoloop-success-YJ4VKQJS.js +0 -95
  527. package/dist/autoloop-trajectory-F2XRLEVN.js +0 -72
  528. package/dist/automatic-branch-cleanup-YI3NBVWP.js +0 -49
  529. package/dist/autonomous-loop-controller-NMXPBYG3.js +0 -4415
  530. package/dist/backend-CAFCYODQ.js +0 -24
  531. package/dist/backend-order-JS4KDP4I.js +0 -113
  532. package/dist/background-executor-MMH3OMGR.js +0 -263
  533. package/dist/backlog-WNDSXTB2.js +0 -390
  534. package/dist/backlog-execution-intent-2PBE2EEX.js +0 -81
  535. package/dist/backup-active-store-ZCGFMD2P.js +0 -16
  536. package/dist/backup-machine-stores-UTJXNZAF.js +0 -251
  537. package/dist/backup-telemetry-db-IEP7MX6U.js +0 -26
  538. package/dist/branch-cleanup-manager-742HVESE.js +0 -35
  539. package/dist/build-gate-NFMITBO4.js +0 -70
  540. package/dist/build-root-7KNOWDTS.js +0 -18
  541. package/dist/change-summary-NT2LQ5WF.js +0 -50
  542. package/dist/chunk-276XSIJL.js +0 -491
  543. package/dist/chunk-27ARK74R.js +0 -5405
  544. package/dist/chunk-2FE3E3AI.js +0 -25
  545. package/dist/chunk-2GK4YBEG.js +0 -248
  546. package/dist/chunk-2Q7POOGY.js +0 -852
  547. package/dist/chunk-2ZBV6557.js +0 -241
  548. package/dist/chunk-3AEKBPBM.js +0 -264
  549. package/dist/chunk-3FP7EZKJ.js +0 -884
  550. package/dist/chunk-3HK7W227.js +0 -160
  551. package/dist/chunk-3I7R646L.js +0 -753
  552. package/dist/chunk-3L5C37LL.js +0 -953
  553. package/dist/chunk-3O7A5WDE.js +0 -198
  554. package/dist/chunk-3OBVSKRE.js +0 -19
  555. package/dist/chunk-3P5IN5E7.js +0 -9
  556. package/dist/chunk-3PKZPQSS.js +0 -490
  557. package/dist/chunk-3RRDBY4I.js +0 -1437
  558. package/dist/chunk-3SRQN5HS.js +0 -1029
  559. package/dist/chunk-3VRJJOGI.js +0 -258
  560. package/dist/chunk-3W6RM44N.js +0 -307
  561. package/dist/chunk-3ZY37IGM.js +0 -263
  562. package/dist/chunk-436ME67N.js +0 -373
  563. package/dist/chunk-445GJ7SE.js +0 -83
  564. package/dist/chunk-4CKSGA2M.js +0 -50
  565. package/dist/chunk-4FRHN52E.js +0 -338
  566. package/dist/chunk-4G72QZO4.js +0 -204
  567. package/dist/chunk-4QBUZIZU.js +0 -1611
  568. package/dist/chunk-4TFD62AV.js +0 -179
  569. package/dist/chunk-5574ECX7.js +0 -53
  570. package/dist/chunk-56M4KK5M.js +0 -47
  571. package/dist/chunk-57K6DGM3.js +0 -34
  572. package/dist/chunk-5AXOWRWV.js +0 -951
  573. package/dist/chunk-5GBTIYB3.js +0 -2478
  574. package/dist/chunk-5IYSVNHJ.js +0 -568
  575. package/dist/chunk-5NAEIRF7.js +0 -178
  576. package/dist/chunk-5OMO5DOQ.js +0 -629
  577. package/dist/chunk-5QKU35YH.js +0 -26
  578. package/dist/chunk-5SLVJBMF.js +0 -43
  579. package/dist/chunk-5UAEDMLD.js +0 -152
  580. package/dist/chunk-5XHIYI3C.js +0 -699
  581. package/dist/chunk-63RRVYDB.js +0 -396
  582. package/dist/chunk-6AYIB2B3.js +0 -244
  583. package/dist/chunk-6EFUFGJ7.js +0 -912
  584. package/dist/chunk-6GETJDOF.js +0 -1853
  585. package/dist/chunk-6HNWT2WY.js +0 -189
  586. package/dist/chunk-6M5ZF2WE.js +0 -288
  587. package/dist/chunk-6RSSRBQO.js +0 -514
  588. package/dist/chunk-6UYJ473L.js +0 -109
  589. package/dist/chunk-6ZVBKSOF.js +0 -173
  590. package/dist/chunk-75ECMNFC.js +0 -410
  591. package/dist/chunk-776Q6UZ5.js +0 -326
  592. package/dist/chunk-7ABZ24VQ.js +0 -398
  593. package/dist/chunk-7AQTBZRG.js +0 -698
  594. package/dist/chunk-7B4XPQ3A.js +0 -300
  595. package/dist/chunk-7FD7YASE.js +0 -272
  596. package/dist/chunk-7HZMBYW6.js +0 -169
  597. package/dist/chunk-7KVDEYUR.js +0 -260
  598. package/dist/chunk-7O4GRYXK.js +0 -616
  599. package/dist/chunk-7PKBK54N.js +0 -128
  600. package/dist/chunk-A6TYJOSB.js +0 -43
  601. package/dist/chunk-AAP4LU4F.js +0 -426
  602. package/dist/chunk-ACMYGDEC.js +0 -523
  603. package/dist/chunk-ADCBA32I.js +0 -123
  604. package/dist/chunk-ADHCK4HP.js +0 -62
  605. package/dist/chunk-AESBIXW6.js +0 -225
  606. package/dist/chunk-AKAWLZRN.js +0 -1224
  607. package/dist/chunk-AL5XVEIF.js +0 -1402
  608. package/dist/chunk-ANZTCH7G.js +0 -88
  609. package/dist/chunk-AXPHA4LS.js +0 -598
  610. package/dist/chunk-AZDXVXJE.js +0 -224
  611. package/dist/chunk-B4TCZUIA.js +0 -116
  612. package/dist/chunk-BADCEBE3.js +0 -2950
  613. package/dist/chunk-BAT7354O.js +0 -181
  614. package/dist/chunk-BCGXEZRY.js +0 -487
  615. package/dist/chunk-BQRH2P5T.js +0 -293
  616. package/dist/chunk-C74D53T7.js +0 -459
  617. package/dist/chunk-CAT22O7B.js +0 -936
  618. package/dist/chunk-CFHVPNBS.js +0 -165
  619. package/dist/chunk-CJKUM5Q2.js +0 -60
  620. package/dist/chunk-CL7QXURF.js +0 -657
  621. package/dist/chunk-CNBPLPNN.js +0 -204
  622. package/dist/chunk-CNRT6QG2.js +0 -122
  623. package/dist/chunk-CPMXKU6U.js +0 -237
  624. package/dist/chunk-CWPSXIJJ.js +0 -142
  625. package/dist/chunk-DDQPETWE.js +0 -263
  626. package/dist/chunk-DEYAKXMN.js +0 -866
  627. package/dist/chunk-DI3DC4GT.js +0 -126
  628. package/dist/chunk-DJERA5KD.js +0 -334
  629. package/dist/chunk-DLYHD7JI.js +0 -115
  630. package/dist/chunk-DOMVDY3Y.js +0 -48
  631. package/dist/chunk-DR2JTVW3.js +0 -128
  632. package/dist/chunk-DY4LST2V.js +0 -159
  633. package/dist/chunk-DZZ2ETVO.js +0 -31
  634. package/dist/chunk-EBBMNMPE.js +0 -6283
  635. package/dist/chunk-EFFA3WG2.js +0 -737
  636. package/dist/chunk-EIKUSY4Y.js +0 -106
  637. package/dist/chunk-ELZHXS2U.js +0 -3639
  638. package/dist/chunk-ENTWET7B.js +0 -389
  639. package/dist/chunk-EONWEADC.js +0 -469
  640. package/dist/chunk-ESP4GKLS.js +0 -103
  641. package/dist/chunk-ETKKYQ6H.js +0 -568
  642. package/dist/chunk-EUVNDMSQ.js +0 -4048
  643. package/dist/chunk-EUXY3GSN.js +0 -1672
  644. package/dist/chunk-EYMZGPZ3.js +0 -272
  645. package/dist/chunk-F3O7SYOU.js +0 -1681
  646. package/dist/chunk-F76UFIGF.js +0 -73
  647. package/dist/chunk-FBZ3GP4S.js +0 -220
  648. package/dist/chunk-FGHL5MTF.js +0 -204
  649. package/dist/chunk-FJA75X7L.js +0 -3881
  650. package/dist/chunk-FM75V5EE.js +0 -120
  651. package/dist/chunk-FPJBEB7H.js +0 -209
  652. package/dist/chunk-FXUYKWHO.js +0 -535
  653. package/dist/chunk-GBPDPVDM.js +0 -1461
  654. package/dist/chunk-GDTQ66FN.js +0 -344
  655. package/dist/chunk-GGIM7NWW.js +0 -1414
  656. package/dist/chunk-GH4N25AZ.js +0 -205
  657. package/dist/chunk-GJFTLFHH.js +0 -637
  658. package/dist/chunk-GJRN3UFJ.js +0 -145
  659. package/dist/chunk-GL4DTEVY.js +0 -152
  660. package/dist/chunk-GQIMUVSC.js +0 -763
  661. package/dist/chunk-GR4OO7AT.js +0 -29
  662. package/dist/chunk-GRKSOYS4.js +0 -538
  663. package/dist/chunk-GTMMUVJG.js +0 -976
  664. package/dist/chunk-GUCSW7KT.js +0 -294
  665. package/dist/chunk-GW4SN5PD.js +0 -230
  666. package/dist/chunk-GWHGTG37.js +0 -36
  667. package/dist/chunk-GXIZDTSJ.js +0 -513
  668. package/dist/chunk-H4PFYO6G.js +0 -99
  669. package/dist/chunk-H7KLGNJF.js +0 -79
  670. package/dist/chunk-H7XNJSIW.js +0 -576
  671. package/dist/chunk-HCWGNUBL.js +0 -247
  672. package/dist/chunk-HEG24XUV.js +0 -160
  673. package/dist/chunk-HIJIYOZE.js +0 -318
  674. package/dist/chunk-HIOZZVWO.js +0 -1139
  675. package/dist/chunk-HMOOMDSM.js +0 -4692
  676. package/dist/chunk-HQYED5GO.js +0 -342
  677. package/dist/chunk-I3HFHBRJ.js +0 -371
  678. package/dist/chunk-I77BAOY4.js +0 -1052
  679. package/dist/chunk-I7U34C6J.js +0 -833
  680. package/dist/chunk-IIWNMEMI.js +0 -213
  681. package/dist/chunk-ILFIYNW6.js +0 -4301
  682. package/dist/chunk-ILYUN2LB.js +0 -206
  683. package/dist/chunk-IMURUMUU.js +0 -872
  684. package/dist/chunk-IOSKAEBC.js +0 -112
  685. package/dist/chunk-IQWXTKR2.js +0 -80
  686. package/dist/chunk-IWX5SVZ7.js +0 -1533
  687. package/dist/chunk-IYQLR4KG.js +0 -887
  688. package/dist/chunk-IZU2NMRQ.js +0 -3674
  689. package/dist/chunk-J75CV2J2.js +0 -48
  690. package/dist/chunk-JGKQYDI2.js +0 -1214
  691. package/dist/chunk-JVJVEQSC.js +0 -27
  692. package/dist/chunk-JY6DF4VH.js +0 -187
  693. package/dist/chunk-JZDU34B3.js +0 -360
  694. package/dist/chunk-JZHUN5I5.js +0 -305
  695. package/dist/chunk-K3WH2Y3Z.js +0 -2188
  696. package/dist/chunk-K7ZOJSTB.js +0 -891
  697. package/dist/chunk-KBGQOREQ.js +0 -188
  698. package/dist/chunk-KBWC7J6T.js +0 -167
  699. package/dist/chunk-KPJIEMFZ.js +0 -365
  700. package/dist/chunk-KQ3CTB3O.js +0 -977
  701. package/dist/chunk-KQSXPX76.js +0 -124
  702. package/dist/chunk-KV2JP3CE.js +0 -523
  703. package/dist/chunk-KXFJCM5O.js +0 -315
  704. package/dist/chunk-KXHYE63U.js +0 -112
  705. package/dist/chunk-L3XE627V.js +0 -39
  706. package/dist/chunk-L6SOMVXU.js +0 -107
  707. package/dist/chunk-LBGCV3MK.js +0 -242
  708. package/dist/chunk-LJ74VTCM.js +0 -339
  709. package/dist/chunk-LKESNV6N.js +0 -535
  710. package/dist/chunk-LKFANUFA.js +0 -380
  711. package/dist/chunk-LLZSXNS5.js +0 -758
  712. package/dist/chunk-LQFBZZB2.js +0 -525
  713. package/dist/chunk-LUVCS2BE.js +0 -68
  714. package/dist/chunk-LZ2PEIBR.js +0 -677
  715. package/dist/chunk-M3YQTSSL.js +0 -15192
  716. package/dist/chunk-M6UHOC4I.js +0 -553
  717. package/dist/chunk-MB274FPE.js +0 -2854
  718. package/dist/chunk-MJBEWU4E.js +0 -14
  719. package/dist/chunk-MLADI4OU.js +0 -304
  720. package/dist/chunk-MNI3JNZ2.js +0 -226
  721. package/dist/chunk-MQPLYUZG.js +0 -85
  722. package/dist/chunk-MQWAKQGT.js +0 -396
  723. package/dist/chunk-MSMYATWG.js +0 -63
  724. package/dist/chunk-MTPGRJBS.js +0 -4526
  725. package/dist/chunk-MVHPKG3F.js +0 -180
  726. package/dist/chunk-MVU3TQ3I.js +0 -31
  727. package/dist/chunk-N4OUM6GV.js +0 -489
  728. package/dist/chunk-N7KJHHOZ.js +0 -2369
  729. package/dist/chunk-NDT7Y6T5.js +0 -11995
  730. package/dist/chunk-NMJR5OPH.js +0 -6549
  731. package/dist/chunk-NSIK2M5L.js +0 -510
  732. package/dist/chunk-NVZFR6OW.js +0 -69
  733. package/dist/chunk-NYMUQVN6.js +0 -546
  734. package/dist/chunk-O4ZE44FO.js +0 -855
  735. package/dist/chunk-O6KSTAYD.js +0 -624
  736. package/dist/chunk-O6SA3YFV.js +0 -1242
  737. package/dist/chunk-O7GXZRHU.js +0 -465
  738. package/dist/chunk-OAODGJ32.js +0 -1104
  739. package/dist/chunk-OFJUORWH.js +0 -7024
  740. package/dist/chunk-OKDVN7LE.js +0 -4083
  741. package/dist/chunk-OLZ2LOYC.js +0 -962
  742. package/dist/chunk-OQ5KI3EO.js +0 -17592
  743. package/dist/chunk-OSPY52VO.js +0 -1232
  744. package/dist/chunk-OXHHHXJB.js +0 -1318
  745. package/dist/chunk-OZGCHIZG.js +0 -447
  746. package/dist/chunk-P4PXB27C.js +0 -485
  747. package/dist/chunk-P5574V6F.js +0 -229
  748. package/dist/chunk-PDUW42NU.js +0 -5113
  749. package/dist/chunk-PHLTLB4A.js +0 -572
  750. package/dist/chunk-PHV66KBQ.js +0 -152
  751. package/dist/chunk-PHWAE54T.js +0 -257
  752. package/dist/chunk-PJWKI4PY.js +0 -490
  753. package/dist/chunk-PL6SM4VU.js +0 -73
  754. package/dist/chunk-PMAYERFO.js +0 -392
  755. package/dist/chunk-PMKHR7AD.js +0 -860
  756. package/dist/chunk-PSISA5D4.js +0 -445
  757. package/dist/chunk-Q4J5PBIM.js +0 -1231
  758. package/dist/chunk-Q4L4UTE2.js +0 -73
  759. package/dist/chunk-Q6ENJZP6.js +0 -104
  760. package/dist/chunk-QCBUWOYE.js +0 -1754
  761. package/dist/chunk-QKUUOEZE.js +0 -49
  762. package/dist/chunk-QMHKEQKX.js +0 -24659
  763. package/dist/chunk-QMMGT6LX.js +0 -1489
  764. package/dist/chunk-QOZEEMKE.js +0 -78
  765. package/dist/chunk-QQOBYSG4.js +0 -81
  766. package/dist/chunk-QUL3GGBH.js +0 -4967
  767. package/dist/chunk-R6RSJ3HK.js +0 -121
  768. package/dist/chunk-RABQ54O3.js +0 -430
  769. package/dist/chunk-RBF3OAJ7.js +0 -353
  770. package/dist/chunk-RCD3YW3M.js +0 -1750
  771. package/dist/chunk-RD54F2FM.js +0 -2128
  772. package/dist/chunk-RJ2Y4VD2.js +0 -555
  773. package/dist/chunk-RKGYRRJN.js +0 -3588
  774. package/dist/chunk-RRLGIW4Q.js +0 -911
  775. package/dist/chunk-RTJFWZ5G.js +0 -529
  776. package/dist/chunk-RZE5ZGVD.js +0 -244
  777. package/dist/chunk-S4WWRIIW.js +0 -1358
  778. package/dist/chunk-S5SRUYAA.js +0 -126
  779. package/dist/chunk-SA66T3C6.js +0 -197
  780. package/dist/chunk-SAMACWNI.js +0 -236
  781. package/dist/chunk-SCYAJOMO.js +0 -302
  782. package/dist/chunk-SD5YZBX2.js +0 -147
  783. package/dist/chunk-SGKRG6A6.js +0 -1841
  784. package/dist/chunk-SINZRL5A.js +0 -293
  785. package/dist/chunk-SJ7EBFIV.js +0 -825
  786. package/dist/chunk-SLAKWX36.js +0 -450
  787. package/dist/chunk-STW24UBZ.js +0 -15697
  788. package/dist/chunk-SZMBOICG.js +0 -9623
  789. package/dist/chunk-T2LMBLZZ.js +0 -141
  790. package/dist/chunk-T2OTD6Q4.js +0 -916
  791. package/dist/chunk-T47G77BS.js +0 -66
  792. package/dist/chunk-T6LVKXOA.js +0 -129
  793. package/dist/chunk-TA77GVDI.js +0 -8991
  794. package/dist/chunk-TAP56GMB.js +0 -205
  795. package/dist/chunk-TAVRUR7B.js +0 -33
  796. package/dist/chunk-TM5ZDLBK.js +0 -650
  797. package/dist/chunk-TONJC7IG.js +0 -119
  798. package/dist/chunk-TQDDSAUB.js +0 -2155
  799. package/dist/chunk-TVBWFM3J.js +0 -3667
  800. package/dist/chunk-TVTSB2CC.js +0 -154
  801. package/dist/chunk-TYWPQ2PZ.js +0 -192
  802. package/dist/chunk-TZAMJD4S.js +0 -643
  803. package/dist/chunk-U7H3FT26.js +0 -193
  804. package/dist/chunk-UAYSX7EQ.js +0 -498
  805. package/dist/chunk-UJCLBPFX.js +0 -127
  806. package/dist/chunk-UQI5FSFT.js +0 -13
  807. package/dist/chunk-UQRJOE3L.js +0 -20
  808. package/dist/chunk-UVVDU6LY.js +0 -123
  809. package/dist/chunk-UWUYNFF4.js +0 -8254
  810. package/dist/chunk-VCKGW62M.js +0 -539
  811. package/dist/chunk-VG6VUZDZ.js +0 -1087
  812. package/dist/chunk-VTTNF3EM.js +0 -482
  813. package/dist/chunk-VYYMQGGU.js +0 -110
  814. package/dist/chunk-W6PMHAG6.js +0 -97
  815. package/dist/chunk-WAGVFGD4.js +0 -1108
  816. package/dist/chunk-WE7KTHMY.js +0 -267
  817. package/dist/chunk-WIWXIET7.js +0 -403
  818. package/dist/chunk-WJ2GWDJQ.js +0 -1063
  819. package/dist/chunk-WZ7ZP3OJ.js +0 -53
  820. package/dist/chunk-X5KHWQUT.js +0 -92
  821. package/dist/chunk-XEUWCZOJ.js +0 -115
  822. package/dist/chunk-XF4AI443.js +0 -19419
  823. package/dist/chunk-XFX757OH.js +0 -4933
  824. package/dist/chunk-XFXG23QS.js +0 -1133
  825. package/dist/chunk-XFZF2PJD.js +0 -61
  826. package/dist/chunk-XQJBZMHD.js +0 -2018
  827. package/dist/chunk-XXH7EUZD.js +0 -53
  828. package/dist/chunk-Y3VCYEME.js +0 -948
  829. package/dist/chunk-Y4ZWDBV2.js +0 -1041
  830. package/dist/chunk-Y57IJDBD.js +0 -2350
  831. package/dist/chunk-Y7NKKXMX.js +0 -527
  832. package/dist/chunk-YE3RJ4UF.js +0 -320
  833. package/dist/chunk-YFSW2X2Q.js +0 -5585
  834. package/dist/chunk-YH3KASXS.js +0 -96
  835. package/dist/chunk-YJAI74UZ.js +0 -2227
  836. package/dist/chunk-YJVL2BRM.js +0 -292
  837. package/dist/chunk-YK2EU5KA.js +0 -2170
  838. package/dist/chunk-YK7R6SM7.js +0 -1267
  839. package/dist/chunk-YSA3GBD6.js +0 -737
  840. package/dist/chunk-Z4Y56344.js +0 -342
  841. package/dist/chunk-ZA6RQ365.js +0 -47
  842. package/dist/chunk-ZABV5JUW.js +0 -521
  843. package/dist/chunk-ZAS2H4UN.js +0 -1429
  844. package/dist/chunk-ZBRAQYHO.js +0 -1102
  845. package/dist/chunk-ZDAZNRRJ.js +0 -151
  846. package/dist/chunk-ZKDOWP5F.js +0 -18
  847. package/dist/chunk-ZQXNQRKW.js +0 -306
  848. package/dist/chunk-ZU3BABSQ.js +0 -146
  849. package/dist/chunk-ZUMW6TFZ.js +0 -455
  850. package/dist/chunk-ZXN6QEGQ.js +0 -176
  851. package/dist/chunk-ZZFFR5QT.js +0 -90
  852. package/dist/chunk-ZZQM2AXO.js +0 -453
  853. package/dist/cli-utils-IUUYUL23.js +0 -31
  854. package/dist/cli-validation-3Y5CBVXR.js +0 -125
  855. package/dist/commit-utils-ZTUES23W.js +0 -50
  856. package/dist/compete-config-resolver-K5ZFIA7R.js +0 -126
  857. package/dist/compete-results-MRI2RBXO.js +0 -315
  858. package/dist/competition-outcome-tracker-EWNBAYGE.js +0 -63
  859. package/dist/config-5GEJLIHS.js +0 -237
  860. package/dist/config-VWMTFJA5.js +0 -46
  861. package/dist/config-audit-3ANEFCMF.js +0 -371
  862. package/dist/config-explain-PUQGDDQW.js +0 -71
  863. package/dist/config-loader-VGGXKEAR.js +0 -52
  864. package/dist/config-manager-5ZVIIEAM.js +0 -115
  865. package/dist/config-merger-GTK2LAMB.js +0 -14
  866. package/dist/config-validator-LWNDS4FZ.js +0 -123
  867. package/dist/cost-H4LZHVEG.js +0 -83
  868. package/dist/data-migration-state-IWTL2S75.js +0 -35
  869. package/dist/db-migrator-OGN6Z2AG.js +0 -34
  870. package/dist/default-paths-MKNRMMVV.js +0 -49
  871. package/dist/discovery-OIV7N6ZM.js +0 -53
  872. package/dist/doctor-2YLBWAOX.js +0 -268
  873. package/dist/doctor-context-blocks-UO7SG3NU.js +0 -233
  874. package/dist/doctor-instructions-import-FY5RLABK.js +0 -70
  875. package/dist/doctor-purpose-UY3UANLP.js +0 -30
  876. package/dist/domain-analyzer-QKIWVWWS.js +0 -48
  877. package/dist/ensure-initialized-IUDKZTD2.js +0 -76
  878. package/dist/error-parser-core-MZFMFANN.js +0 -70
  879. package/dist/evaluation-context-YPA6QNRG.js +0 -62
  880. package/dist/evidence-plan-resolver-C6G44Y35.js +0 -112
  881. package/dist/execution-data-writer-3OPHRWXQ.js +0 -78
  882. package/dist/execution-policy-applier-SFSYHJ64.js +0 -63
  883. package/dist/execution-preflight-WBMAWGLC.js +0 -224
  884. package/dist/execution-roles-WEOTECB5.js +0 -113
  885. package/dist/factory-TVHI7LIV.js +0 -207
  886. package/dist/flywheel-autoloop-executor-OOOKI63E.js +0 -307
  887. package/dist/flywheel-autoloop-unverified-PKNBV5DF.js +0 -37
  888. package/dist/flywheel-competition-executor-J6GVZDKT.js +0 -324
  889. package/dist/flywheel-executor-HUHV522T.js +0 -428
  890. package/dist/flywheel-git-isolation-HNYVZHAX.js +0 -50
  891. package/dist/flywheel-manifest-IMDPTLWY.js +0 -114
  892. package/dist/flywheel-model-defaults-JLQZOQE7.js +0 -116
  893. package/dist/flywheel-preflight-2NDK23MK.js +0 -173
  894. package/dist/flywheel-resume-OYOYKXOF.js +0 -96
  895. package/dist/flywheel-resume-execution-lease-WALKY6GR.js +0 -59
  896. package/dist/flywheel-safety-LQZE7Z6J.js +0 -19
  897. package/dist/flywheel-scope-decision-5XZ26YNX.js +0 -14
  898. package/dist/get-telemetry-logger-V2MGHWDR.js +0 -154
  899. package/dist/git-message-style-7F3U6S2E.js +0 -106
  900. package/dist/identity-HSTKXB4R.js +0 -25
  901. package/dist/index-query-6SECY5IF.js +0 -37
  902. package/dist/indexer-Q7NPA3F6.js +0 -44
  903. package/dist/init-DFMWM27C.js +0 -244
  904. package/dist/instructions-H5XNRNIH.js +0 -189
  905. package/dist/instructions-import-offer-CYIUSJPJ.js +0 -367
  906. package/dist/instructions-run-W2NQPO37.js +0 -116
  907. package/dist/interrupted-work-I3DUCAQC.js +0 -43
  908. package/dist/invoke-provider-auth-7ABM6LER.js +0 -38
  909. package/dist/lab-mode-QAKDCPGV.js +0 -44
  910. package/dist/linux-host-class-TBQ2S5CA.js +0 -31
  911. package/dist/llm-judge-executor-46KOVUAQ.js +0 -181
  912. package/dist/local-ci-config-QGMLX6MI.js +0 -51
  913. package/dist/local-executor-EWZJ3AIM.js +0 -282
  914. package/dist/logger-FWQ5DJ5J.js +0 -153
  915. package/dist/matrix-prompt-builder-BHLYTCPD.js +0 -537
  916. package/dist/merge-batch-F7LQY5HT.js +0 -323
  917. package/dist/merge-queue-LJ56HTT3.js +0 -127
  918. package/dist/merge-queue-trust-EF77O3F6.js +0 -21
  919. package/dist/metadata-5PME4NKN.js +0 -29
  920. package/dist/model-catalog-readiness-ZIASAOXQ.js +0 -204
  921. package/dist/model-invocations-db-JG452YT3.js +0 -70
  922. package/dist/model-resolver-TJQNYDKT.js +0 -215
  923. package/dist/model-resolver-ZPNOVV2T.js +0 -43
  924. package/dist/monitor-DZNOT4YL.js +0 -97
  925. package/dist/next-JQSH6MDJ.js +0 -98
  926. package/dist/next-TSFHAJX6.js +0 -151
  927. package/dist/opportunistic-CUH6SNNQ.js +0 -86
  928. package/dist/optimization-config-resolver-2XYSWZL5.js +0 -149
  929. package/dist/path-security-MXGK2DP5.js +0 -39
  930. package/dist/paths-VPYRA5OA.js +0 -37
  931. package/dist/plan-backlog-list-fast-MQXJPID4.js +0 -89
  932. package/dist/plan-backlog-show-fast-Y6TZYLIG.js +0 -112
  933. package/dist/plan-sprint-list-fast-2WRXKK3D.js +0 -109
  934. package/dist/plan-sprint-status-fast-U4YNAECG.js +0 -115
  935. package/dist/plan-task-status-fast-DKJWYRSW.js +0 -113
  936. package/dist/process-registry-IXGR4H5W.js +0 -28
  937. package/dist/process-scanner-T3GBV73O.js +0 -23
  938. package/dist/processes-RH6V3S3G.js +0 -29
  939. package/dist/processes-json-fast-AT7F4EZ6.js +0 -72
  940. package/dist/profile-GZGJF2ZT.js +0 -207
  941. package/dist/project-runtime-paths-QWSR4WA3.js +0 -41
  942. package/dist/provider-aware-resource-manager-X6ZKM37N.js +0 -39
  943. package/dist/provider-matrix-7FMEWDLS.js +0 -212
  944. package/dist/provider-output-forwarding-4EMU26RM.js +0 -26
  945. package/dist/provider-registry-N26MRRBF.js +0 -136
  946. package/dist/publication-turn-DH3G3PFO.js +0 -45
  947. package/dist/quality-gate-BO2TJQJY.js +0 -74
  948. package/dist/quickstart-BRJADHZS.js +0 -108
  949. package/dist/readiness-UO64EUJH.js +0 -215
  950. package/dist/readiness-VENBXEAE.js +0 -142
  951. package/dist/registry-SGSBDGXX.js +0 -215
  952. package/dist/repo-root-2X7E3ZDI.js +0 -28
  953. package/dist/resolution-engine-R6PSL7VO.js +0 -191
  954. package/dist/resolve-provider-cli-DIFMYCN6.js +0 -44
  955. package/dist/restore-telemetry-db-NQSD2TNE.js +0 -459
  956. package/dist/routing-events-KSNMBELI.js +0 -13
  957. package/dist/routing-history-store-AJSWAMNY.js +0 -47
  958. package/dist/routing-planner-7W2EA2FY.js +0 -218
  959. package/dist/runner-LZVKVDXG.js +0 -1201
  960. package/dist/runner-MNDHQ44A.js +0 -1809
  961. package/dist/safety-MN75ODFJ.js +0 -65
  962. package/dist/safety-stanza-CWYF7XKO.js +0 -49
  963. package/dist/sandbox-DLUK2MG4.js +0 -72
  964. package/dist/sandbox-ELRY4M2J.js +0 -80
  965. package/dist/setup-temp-cleanup-IBL5H7RE.js +0 -29
  966. package/dist/shared-utils-QT7VJ6SJ.js +0 -42
  967. package/dist/sprint-bridge-FNBAVD3Z.js +0 -117
  968. package/dist/sprint-completion-dependents-CRFEVAO7.js +0 -43
  969. package/dist/sprint-execution-service-XN27PXWK.js +0 -373
  970. package/dist/sprint-manager-NZ4FBS6Z.js +0 -133
  971. package/dist/sqlite-timeout-config-D2A7MCIQ.js +0 -13
  972. package/dist/sqlite-wrapper-CDFTT4FW.js +0 -19
  973. package/dist/stale-cleanup-orchestrator-6TDX3SJH.js +0 -71
  974. package/dist/storage-access-4PBODLIC.js +0 -31
  975. package/dist/store-JER6IA6W.js +0 -25
  976. package/dist/task-classifier-RVIQXTR7.js +0 -521
  977. package/dist/task-list-fast-32IFMIUP.js +0 -109
  978. package/dist/task-manager-SIUGB22A.js +0 -131
  979. package/dist/task-report-INARR6CG.js +0 -64
  980. package/dist/telemetry-XKOVBIU2.js +0 -197
  981. package/dist/telemetry-lab-scope-KTRP6ZIS.js +0 -31
  982. package/dist/telemetry-path-resolver-THWRQKSF.js +0 -34
  983. package/dist/telemetry-reliability-7KUQU727.js +0 -78
  984. package/dist/unified-state-cleanup-FRARWPCV.js +0 -292
  985. package/dist/universal-cost-calculator-KN2KHWOX.js +0 -70
  986. package/dist/user-agents-LVES6I5N.js +0 -30
  987. package/dist/variant-execution-L2O255ML.js +0 -317
  988. package/dist/variant-opt-parser-XHIIJOEQ.js +0 -248
  989. package/dist/variant-state-cleanup-QJIIRPS3.js +0 -287
  990. package/dist/variant-worker-GYKUY3TE.js +0 -4573
  991. package/dist/variants-FD3MZVQN.js +0 -262
  992. package/dist/verification-command-6HO365PA.js +0 -68
  993. package/dist/verify-commands-SYYVWMSJ.js +0 -68
  994. package/dist/work-edge-6LJRL65N.js +0 -50
  995. package/dist/worker-YNMJC4GB.js +0 -1528
  996. package/dist/workspace-tree-identity-EGQNGZC3.js +0 -53
  997. package/dist/worktree-environment-KYA25PEL.js +0 -65
  998. package/dist/worktree-metrics-33YN7IFM.js +0 -67
  999. package/dist/writeback-Q7T7I4S6.js +0 -51
@@ -1,3674 +0,0 @@
1
- import {
2
- detectHostConcurrencyBudget
3
- } from "./chunk-BZRLSZNV.js";
4
- import {
5
- getAvailableMemoryGB
6
- } from "./chunk-WKUXAHFT.js";
7
- import {
8
- GUARD_KIT_VERSION,
9
- classifyGuardState,
10
- knowledgeDoctorChecks
11
- } from "./chunk-7O4GRYXK.js";
12
- import {
13
- inspectCiIntegration,
14
- renderCiIntegration
15
- } from "./chunk-5XHIYI3C.js";
16
- import {
17
- recordReadinessDiagnostic
18
- } from "./chunk-445GJ7SE.js";
19
- import {
20
- formatDurationMs
21
- } from "./chunk-2L36U25O.js";
22
- import {
23
- listPendingNudges,
24
- readPendingOfferNotice,
25
- renderPendingNudges
26
- } from "./chunk-MB274FPE.js";
27
- import {
28
- DECLARE_STACK_COMMAND,
29
- describeDimension,
30
- detectStack,
31
- isStackDriftKind,
32
- isStackUndetectedAndUndeclared,
33
- readIntentContract,
34
- resolveIntent
35
- } from "./chunk-RD54F2FM.js";
36
- import {
37
- readProviderDryRunFreshness
38
- } from "./chunk-GT6HFKJB.js";
39
- import {
40
- RuntimeRequirements,
41
- ensureBuildInitialized,
42
- resolveRepoRootForBuildDir
43
- } from "./chunk-Y4ZWDBV2.js";
44
- import {
45
- hasStrictMcpConfigBeenProbed,
46
- isStrictMcpConfigSupported,
47
- probeStrictMcpConfig
48
- } from "./chunk-OQ5KI3EO.js";
49
- import {
50
- planningStorageUnavailableReason
51
- } from "./chunk-T5XLUYV3.js";
52
- import {
53
- listYamlFiles
54
- } from "./chunk-GW4SN5PD.js";
55
- import {
56
- loadAllItems
57
- } from "./chunk-ACMYGDEC.js";
58
- import {
59
- getPlanningRoot
60
- } from "./chunk-LBGCV3MK.js";
61
- import {
62
- getBucketArchivePathByKind,
63
- getBucketPathByKind
64
- } from "./chunk-7ABZ24VQ.js";
65
- import {
66
- ConfigManager
67
- } from "./chunk-JGKQYDI2.js";
68
- import {
69
- discoverOpencode
70
- } from "./chunk-HQYED5GO.js";
71
- import {
72
- probeProviderCliVersion
73
- } from "./chunk-KBGQOREQ.js";
74
- import {
75
- SCHEMA_VERSION,
76
- checkSchemaVersion
77
- } from "./chunk-OFJUORWH.js";
78
- import {
79
- SETUP_CHECK_READINESS_OPTIONS,
80
- getProviderReadiness,
81
- isGateReadyProvider,
82
- probeProviderCli,
83
- readinessProbeContextForOptions,
84
- resolveNamedReadiness,
85
- resolveProviderParityLabel,
86
- resolveReadinessScope
87
- } from "./chunk-O6SA3YFV.js";
88
- import {
89
- resolvePlanningContextForRoot
90
- } from "./chunk-ANZTCH7G.js";
91
- import {
92
- invalidateAuthOutcome,
93
- lookupAuthOutcome,
94
- recordAuthOutcome
95
- } from "./chunk-4FRHN52E.js";
96
- import {
97
- BooleanFlagSchema,
98
- validateCommandOptions
99
- } from "./chunk-GRKSOYS4.js";
100
- import {
101
- formatSandboxDegradedSummary
102
- } from "./chunk-3O7A5WDE.js";
103
- import {
104
- detectUnbornBranch,
105
- parseCurrentBranchRef
106
- } from "./chunk-N744MVJQ.js";
107
- import {
108
- TelemetryPathResolver
109
- } from "./chunk-GQIMUVSC.js";
110
- import {
111
- execGit
112
- } from "./chunk-PUDY56H6.js";
113
- import {
114
- normalizeEngineId,
115
- resolveProviderCliCommand
116
- } from "./chunk-KPJIEMFZ.js";
117
- import {
118
- ProviderRegistry,
119
- getProviderConfig,
120
- isConfigValidityError
121
- } from "./chunk-TVBWFM3J.js";
122
- import {
123
- resolveProvidersConfigPath
124
- } from "./chunk-MNI3JNZ2.js";
125
- import {
126
- formatSupportedNodeMajors,
127
- isSupportedNodeMajor,
128
- parseNodeMajor
129
- } from "./chunk-Q6ENJZP6.js";
130
- import {
131
- getDataDir,
132
- getUserConfigFile
133
- } from "./chunk-O6KSTAYD.js";
134
- import {
135
- getBuiltInTaskTypesDir,
136
- getRejectedPathEnvWarnings,
137
- getRepoTaskTypesDir
138
- } from "./chunk-P4PXB27C.js";
139
- import {
140
- BUILD_CODEX_BACKEND,
141
- getRuntimeEnv,
142
- readEnv
143
- } from "./chunk-NMJR5OPH.js";
144
-
145
- // src/cli/commands/doctor-ci.ts
146
- async function checkCiIntegrationHealth(root) {
147
- try {
148
- const snapshot = await inspectCiIntegration(root);
149
- return {
150
- name: "CI integration",
151
- category: "git",
152
- status: "info",
153
- fixable: false,
154
- message: snapshot.intentError ?? (snapshot.primary === "local" ? "Local CI is configured; host enforcement is not checked by doctor." : snapshot.workflows.length ? "Workflow definitions found; hosted activity and enforcement are not checked by doctor." : "No CI workflow or Local CI hook detected."),
155
- details: `${renderCiIntegration(snapshot).join("\n")}
156
- build ci status can inspect GitHub; build init can review setup.`
157
- };
158
- } catch {
159
- return {
160
- name: "CI integration",
161
- category: "git",
162
- status: "info",
163
- fixable: false,
164
- message: "CI inspection is unavailable; no configuration was changed."
165
- };
166
- }
167
- }
168
-
169
- // src/cli/commands/doctor-init-notices.ts
170
- function checkPendingInitNotices(cwd) {
171
- let count = 0;
172
- try {
173
- count = listPendingNudges(cwd).filter((record) => isStackDriftKind(record.kind)).length;
174
- } catch {
175
- }
176
- if (count === 0) {
177
- return {
178
- name: "Pending Init Notices",
179
- category: "knowledge",
180
- status: "pass",
181
- message: "No pending init notices",
182
- notices_pending: 0
183
- };
184
- }
185
- return {
186
- name: "Pending Init Notices",
187
- category: "knowledge",
188
- status: "info",
189
- message: `${count} init notice(s) pending review`,
190
- details: "Notices are shown below (human output) or after the summary.",
191
- notices_pending: count
192
- };
193
- }
194
- function checkPendingOfferNotice(cwd) {
195
- let notice;
196
- try {
197
- notice = readPendingOfferNotice(cwd);
198
- } catch {
199
- notice = void 0;
200
- }
201
- if (!notice) {
202
- return {
203
- name: "Knowledge Offer",
204
- category: "knowledge",
205
- status: "pass",
206
- message: "No pending stack resources offer"
207
- };
208
- }
209
- return {
210
- name: "Knowledge Offer",
211
- category: "knowledge",
212
- // Both skip causes (non-interactive, suppressed) are normal headless states.
213
- status: "info",
214
- message: notice.message,
215
- details: `Offer skipped ${notice.skippedAt.slice(0, 10)} (${notice.cause}); it clears when an offer runs.`
216
- };
217
- }
218
- function renderDoctorPendingNudges(cwd, options, renderOptions = {}) {
219
- const policy = {
220
- json: options.json === true,
221
- quiet: false,
222
- verbose: options.verbose === true,
223
- debug: false,
224
- noColor: false,
225
- level: "normal"
226
- };
227
- try {
228
- return renderPendingNudges(cwd, policy, {
229
- ...renderOptions,
230
- includeAge: true,
231
- readOnly: true,
232
- includeRecord: (record) => isStackDriftKind(record.kind)
233
- });
234
- } catch {
235
- return { rendered: false, deliveredKeys: [], pendingCount: 0 };
236
- }
237
- }
238
-
239
- // src/cli/commands/doctor.ts
240
- import * as fs3 from "fs/promises";
241
- import * as os from "os";
242
- import * as path3 from "path";
243
- import { fileURLToPath } from "url";
244
- import chalk2 from "chalk";
245
- import { Command as Command2 } from "commander";
246
- import { execa } from "execa";
247
- import { z as z2 } from "zod";
248
-
249
- // src/orchestrator/execution-role-preflight.ts
250
- var SET_ADVISORY_FIX = "build config set roles.reviewer.policy advisory";
251
- function configSourceOf(reviewer) {
252
- const source = reviewer.providerSource?.trim();
253
- return source && source.length > 0 ? source : "roles.reviewer.provider";
254
- }
255
- function displayNameOf(hints, providerId) {
256
- const name = hints?.displayName?.trim();
257
- return name && name.length > 0 ? name : providerId;
258
- }
259
- function buildInstallFix(providerId, hints) {
260
- const name = displayNameOf(hints, providerId);
261
- const install = hints?.installCommand?.trim();
262
- const installStep = install ? `Install ${name}: ${install}` : `Install the ${name} CLI`;
263
- return `${installStep}, or downgrade the gate with \`${SET_ADVISORY_FIX}\`.`;
264
- }
265
- function buildUnverifiedAuthNote(providerId, hints) {
266
- const name = displayNameOf(hints, providerId);
267
- return `No action needed: ${name} auth is checked on first run (build doctor --probe verifies sooner).`;
268
- }
269
- function buildAuthFix(providerId, hints) {
270
- const name = displayNameOf(hints, providerId);
271
- const auth = hints?.authCommand?.trim();
272
- const authStep = auth ? `Re-authenticate ${name}: ${auth}` : `Re-authenticate the ${name} CLI`;
273
- return `${authStep}, or downgrade the gate with \`${SET_ADVISORY_FIX}\`.`;
274
- }
275
- function buildAutomaticFallbackFix(providerId, hints) {
276
- const name = displayNameOf(hints, providerId);
277
- const install = hints?.installCommand?.trim();
278
- const installStep = install ? `Install ${name}: ${install}` : `Install the ${name} CLI`;
279
- return `${installStep}, pin an installed reviewer with \`build config set roles.reviewer.provider <installed-provider>\`, or downgrade the gate with \`${SET_ADVISORY_FIX}\`.`;
280
- }
281
- function buildExecutorSeparationFix() {
282
- return `Pin a reviewer that differs from the executor provider(s) via \`build config set roles.reviewer.provider <provider>\`, or downgrade the gate with \`${SET_ADVISORY_FIX}\`.`;
283
- }
284
- function bindingSourceOf(reviewer) {
285
- if (reviewer.bindingSource) return reviewer.bindingSource;
286
- const source = reviewer.providerSource ?? "";
287
- if (source.includes("same-as-executor fallback")) return "automatic-fallback-executor";
288
- if (source.includes("cross-provider reviewer rule") || source.includes("providerPreference") || source.includes("--reviewer-provider-preference")) {
289
- return "automatic-independent";
290
- }
291
- return "explicit";
292
- }
293
- function isAutomaticBinding(reviewer) {
294
- const source = bindingSourceOf(reviewer);
295
- return source === "automatic-independent" || source === "automatic-fallback-executor";
296
- }
297
- function isSameAsExecutor(reviewer) {
298
- if (reviewer.sameAsExecutor === true) return true;
299
- if (reviewer.sameAsExecutor === false) return false;
300
- return reviewer.sameVendorReview === true;
301
- }
302
- async function resolveHints(deps, providerId) {
303
- if (!deps.resolveFixHints) return void 0;
304
- try {
305
- return await deps.resolveFixHints(providerId);
306
- } catch {
307
- return void 0;
308
- }
309
- }
310
- async function preflightExecutionRoles(roles, deps) {
311
- const errors = [];
312
- const warnings = [];
313
- const { reviewer } = roles;
314
- const gate = reviewer.gate;
315
- if (gate === "off") {
316
- return { ok: true, errors, warnings };
317
- }
318
- const strict = gate === "high-severity-blocks";
319
- const provider = reviewer.provider;
320
- const configSource = configSourceOf(reviewer);
321
- const hints = await resolveHints(deps, provider);
322
- const issue = (reason, fix, code) => ({
323
- role: "reviewer",
324
- provider,
325
- ...code ? { code } : {},
326
- reason,
327
- configSource,
328
- fix
329
- });
330
- const installed = await deps.isProviderInstalled(provider);
331
- if (!installed) {
332
- const automatic = isAutomaticBinding(reviewer);
333
- const item = automatic ? issue(
334
- `Reviewer provider "${provider}" was selected automatically but is not installed, so review degrades to the executor provider and reviewer independence is lost.`,
335
- buildAutomaticFallbackFix(provider, hints)
336
- ) : issue(
337
- `Reviewer provider "${provider}" is not installed.`,
338
- buildInstallFix(provider, hints)
339
- );
340
- if (strict && !automatic) {
341
- errors.push(item);
342
- } else {
343
- warnings.push(item);
344
- }
345
- return { ok: errors.length === 0, errors, warnings };
346
- }
347
- const auth = await deps.checkAuthLiveness(provider);
348
- if (auth === "failed") {
349
- const item = issue(
350
- `Reviewer provider "${provider}" is installed but not authenticated.`,
351
- buildAuthFix(provider, hints)
352
- );
353
- if (strict) {
354
- errors.push(item);
355
- } else {
356
- warnings.push(item);
357
- }
358
- } else if (auth === "unknown") {
359
- warnings.push(
360
- issue(
361
- `Reviewer provider "${provider}" auth status is unknown (not verified cheaply).`,
362
- buildUnverifiedAuthNote(provider, hints),
363
- "reviewer_auth_unknown"
364
- )
365
- );
366
- }
367
- if (isSameAsExecutor(reviewer)) {
368
- if (bindingSourceOf(reviewer) === "automatic-fallback-executor") {
369
- warnings.push(
370
- issue(
371
- `reviewer independence lost: no executor-independent reviewer provider was available, so review falls back to the executor provider "${provider}".`,
372
- buildExecutorSeparationFix()
373
- )
374
- );
375
- } else if (strict) {
376
- errors.push(
377
- issue(
378
- `Reviewer provider "${provider}" is the same as an executor provider, so executor separation fails as required by block and repair policies. (Reviewer may still match the orchestrator; that is allowed.)`,
379
- buildExecutorSeparationFix()
380
- )
381
- );
382
- } else {
383
- warnings.push(
384
- issue(
385
- `reduced review assurance: reviewer provider "${provider}" equals an executor provider (executor separation not met); running advisory review anyway. Invocation independence remains a declared stage contract only \u2014 not verified.`,
386
- buildExecutorSeparationFix()
387
- )
388
- );
389
- }
390
- }
391
- return { ok: errors.length === 0, errors, warnings };
392
- }
393
- function unwrapValue(field) {
394
- if (field && typeof field === "object" && "value" in field) {
395
- return field.value;
396
- }
397
- return field;
398
- }
399
- function provenanceOf(field) {
400
- if (field && typeof field === "object") {
401
- const record = field;
402
- if (typeof record.sourcePath === "string" && record.sourcePath.length > 0) {
403
- return record.sourcePath;
404
- }
405
- if (typeof record.source === "string" && record.source.length > 0) {
406
- return record.source;
407
- }
408
- }
409
- return void 0;
410
- }
411
- function adaptResolvedExecutionRoles(resolved) {
412
- if (!resolved || typeof resolved !== "object") return null;
413
- const record = resolved;
414
- const executorRaw = record.executor;
415
- const reviewerRaw = record.reviewer;
416
- if (!executorRaw || typeof executorRaw !== "object") return null;
417
- if (!reviewerRaw || typeof reviewerRaw !== "object") return null;
418
- const executor = executorRaw;
419
- const reviewer = reviewerRaw;
420
- const executorProvider = unwrapValue(executor.provider);
421
- const reviewerProvider = unwrapValue(reviewer.provider);
422
- if (typeof executorProvider !== "string" || executorProvider.length === 0) return null;
423
- if (typeof reviewerProvider !== "string" || reviewerProvider.length === 0) return null;
424
- const gate = unwrapValue(reviewer.gate);
425
- const normalizedGate = gate === "off" || gate === "advisory" || gate === "high-severity-blocks" ? gate : "advisory";
426
- const assuranceRaw = record.reviewAssurance;
427
- let sameAsExecutor = false;
428
- if (assuranceRaw && typeof assuranceRaw === "object") {
429
- const separation = assuranceRaw.executorSeparation;
430
- if (separation === "same-as-executor") sameAsExecutor = true;
431
- else if (separation === "separated") sameAsExecutor = false;
432
- else {
433
- sameAsExecutor = record.sameVendorReview === true || reviewer.sameVendorReview === true;
434
- }
435
- } else {
436
- sameAsExecutor = record.sameVendorReview === true || reviewer.sameVendorReview === true;
437
- }
438
- const providerSource = provenanceOf(reviewer.provider) ?? (typeof reviewer.providerSource === "string" ? reviewer.providerSource : void 0) ?? (typeof reviewer.source === "string" ? reviewer.source : void 0);
439
- const executorModel = unwrapValue(executor.model);
440
- const reviewerModel = unwrapValue(reviewer.model);
441
- const bindingSourceRaw = reviewer.bindingSource;
442
- const bindingSource = bindingSourceRaw === "explicit" || bindingSourceRaw === "automatic-independent" || bindingSourceRaw === "automatic-fallback-executor" ? bindingSourceRaw : void 0;
443
- return {
444
- executor: {
445
- provider: executorProvider,
446
- ...typeof executorModel === "string" ? { model: executorModel } : {}
447
- },
448
- reviewer: {
449
- provider: reviewerProvider,
450
- ...typeof reviewerModel === "string" ? { model: reviewerModel } : {},
451
- gate: normalizedGate,
452
- sameVendorReview: sameAsExecutor,
453
- sameAsExecutor,
454
- ...providerSource ? { providerSource } : {},
455
- ...bindingSource ? { bindingSource } : {}
456
- }
457
- };
458
- }
459
- async function loadResolvedExecutionRoles(cwd = process.cwd()) {
460
- const [{ resolveExecutionRoles }, { isExecutionPolicyEngaged }] = await Promise.all([
461
- import("./execution-roles-WEOTECB5.js"),
462
- import("./execution-policy-applier-SFSYHJ64.js")
463
- ]);
464
- const resolved = resolveExecutionRoles({ cwd });
465
- if (!isExecutionPolicyEngaged(resolved)) {
466
- return null;
467
- }
468
- return adaptResolvedExecutionRoles(resolved);
469
- }
470
- function createExecutionRolePreflightDeps() {
471
- return {
472
- isProviderInstalled: async (providerId) => {
473
- try {
474
- const { resolveProviderCliCommand: resolveProviderCliCommand2 } = await import("./resolve-provider-cli-DIFMYCN6.js");
475
- const { probeProviderCli: probeProviderCli2 } = await import("./readiness-VENBXEAE.js");
476
- const resolved = resolveProviderCliCommand2(providerId);
477
- const probe = await probeProviderCli2(resolved.command, ["--version"], resolved.prefixArgs);
478
- return probe.present && probe.healthy;
479
- } catch {
480
- return false;
481
- }
482
- },
483
- checkAuthLiveness: async (providerId) => {
484
- try {
485
- const { lookupFreshAuthFailure } = await import("./auth-liveness-3DG6JMOQ.js");
486
- const failure = await lookupFreshAuthFailure(providerId);
487
- return failure ? "failed" : "unknown";
488
- } catch {
489
- return "unknown";
490
- }
491
- },
492
- resolveFixHints: async (providerId) => {
493
- try {
494
- const { getProviderConfig: getProviderConfig2 } = await import("./provider-registry-N26MRRBF.js");
495
- const config = getProviderConfig2(providerId);
496
- const displayName = config.display_name?.trim() || config.name?.trim() || void 0;
497
- const installCommand = config.cli?.install_command?.trim() || config.cli?.install_note?.trim() || void 0;
498
- const authCommand = config.auth?.note?.trim() || void 0;
499
- return { displayName, installCommand, authCommand };
500
- } catch {
501
- return void 0;
502
- }
503
- }
504
- };
505
- }
506
- async function runExecutionRolesPreflight(cwd = process.cwd(), deps = createExecutionRolePreflightDeps()) {
507
- const loaded = await loadResolvedExecutionRoles(cwd);
508
- if (!loaded) {
509
- return { result: null, roles: null };
510
- }
511
- const roles = await repickUninstalledAutomaticReviewer(cwd, loaded, deps);
512
- const result = await preflightExecutionRoles(roles, deps);
513
- return { result, roles };
514
- }
515
- async function repickUninstalledAutomaticReviewer(cwd, roles, deps) {
516
- if (roles.reviewer.gate === "off") return roles;
517
- if (bindingSourceOf(roles.reviewer) !== "automatic-independent") return roles;
518
- if (await deps.isProviderInstalled(roles.reviewer.provider)) return roles;
519
- try {
520
- const [{ resolveExecutionRoles }, { ProviderRegistry: ProviderRegistry2 }, { loadProviderRegistryForCwd }] = await Promise.all([
521
- import("./execution-roles-WEOTECB5.js"),
522
- import("./provider-registry-N26MRRBF.js"),
523
- import("./resolution-engine-R6PSL7VO.js")
524
- ]);
525
- const enabled = ProviderRegistry2.getEnabledProviders(loadProviderRegistryForCwd(cwd));
526
- const eligibleReviewerProviders = [];
527
- for (const candidate of enabled) {
528
- if (await deps.isProviderInstalled(candidate.id)) {
529
- eligibleReviewerProviders.push(candidate.id);
530
- }
531
- }
532
- const repicked = adaptResolvedExecutionRoles(
533
- resolveExecutionRoles({ cwd, eligibleReviewerProviders })
534
- );
535
- return repicked ?? roles;
536
- } catch {
537
- return roles;
538
- }
539
- }
540
- async function runStampedExecutionRolesPreflight(roles, deps = createExecutionRolePreflightDeps()) {
541
- return preflightExecutionRoles(roles, deps);
542
- }
543
- function formatPreflightDetails(result) {
544
- const lines = [
545
- ...result.errors.map((issue) => `Error: ${formatPreflightIssue(issue)}`),
546
- ...result.warnings.map((issue) => {
547
- const label = issue.code === "reviewer_auth_unknown" ? "Info" : "Warning";
548
- return `${label}: ${formatPreflightIssue(issue)}`;
549
- })
550
- ];
551
- return lines.length > 0 ? lines.join("\n") : void 0;
552
- }
553
- function formatPreflightIssue(issue) {
554
- return `${issue.reason} (source: ${issue.configSource}) Fix: ${issue.fix}`;
555
- }
556
-
557
- // src/planning/archive-reconciliation.ts
558
- function hasArchivedMarker(item) {
559
- const fm = item.frontMatter;
560
- return typeof fm.archivedAt === "string" && fm.archivedAt.length > 0;
561
- }
562
- function indexById(items) {
563
- const map = /* @__PURE__ */ new Map();
564
- for (const item of items) {
565
- if (!map.has(item.id)) {
566
- map.set(item.id, item);
567
- }
568
- }
569
- return map;
570
- }
571
- function detectDuplicates(kind, active, archived) {
572
- const archivedById = indexById(archived);
573
- const issues = [];
574
- for (const activeItem of active) {
575
- const archivedMatch = archivedById.get(activeItem.id);
576
- if (!archivedMatch) continue;
577
- const preferred = hasArchivedMarker(archivedMatch) ? "archive" : hasArchivedMarker(activeItem) ? "active" : "archive";
578
- issues.push({
579
- kind,
580
- id: activeItem.id,
581
- activePath: activeItem.filePath,
582
- archivePath: archivedMatch.filePath,
583
- preferred
584
- });
585
- }
586
- return issues;
587
- }
588
- function detectDanglingSprintMembership(sprints, activeTaskIds, archivedTaskIds) {
589
- const issues = [];
590
- for (const sprint of sprints) {
591
- const taskIdsRaw = sprint.frontMatter.taskIds;
592
- if (!Array.isArray(taskIdsRaw)) continue;
593
- for (const taskId of taskIdsRaw) {
594
- if (typeof taskId !== "string") continue;
595
- if (activeTaskIds.has(taskId)) continue;
596
- if (archivedTaskIds.has(taskId)) {
597
- issues.push({ sprintId: sprint.id, taskId, reason: "archived-but-listed" });
598
- } else {
599
- issues.push({ sprintId: sprint.id, taskId, reason: "missing" });
600
- }
601
- }
602
- }
603
- return issues;
604
- }
605
- function detectOrphanedFollowups(backlogActive, backlogArchived) {
606
- const knownBacklogIds = /* @__PURE__ */ new Set();
607
- for (const item of [...backlogActive, ...backlogArchived]) {
608
- knownBacklogIds.add(item.id);
609
- }
610
- const issues = [];
611
- for (const item of backlogActive) {
612
- const spawnedFrom = item.frontMatter.spawnedFrom;
613
- if (typeof spawnedFrom !== "string" || spawnedFrom.length === 0) continue;
614
- if (!knownBacklogIds.has(spawnedFrom)) {
615
- issues.push({ followupId: item.id, parentId: spawnedFrom, followupPath: item.filePath });
616
- }
617
- }
618
- return issues;
619
- }
620
- async function detectArchiveReconciliationIssues(planningRoot = getPlanningRoot()) {
621
- const taskActiveDir = getBucketPathByKind("task", planningRoot);
622
- const taskArchiveDir = getBucketArchivePathByKind("task", planningRoot);
623
- const backlogActiveDir = getBucketPathByKind("backlog", planningRoot);
624
- const backlogArchiveDir = getBucketArchivePathByKind("backlog", planningRoot);
625
- const sprintActiveDir = getBucketPathByKind("sprint", planningRoot);
626
- const [activeTasks, archivedTasks, activeBacklog, archivedBacklog, sprints] = await Promise.all([
627
- loadAllItems(planningRoot, [taskActiveDir]),
628
- loadAllItems(planningRoot, [taskArchiveDir]),
629
- loadAllItems(planningRoot, [backlogActiveDir]),
630
- loadAllItems(planningRoot, [backlogArchiveDir]),
631
- loadAllItems(planningRoot, [sprintActiveDir])
632
- ]);
633
- const duplicateRecords = [
634
- ...detectDuplicates("task", activeTasks, archivedTasks),
635
- ...detectDuplicates("backlog", activeBacklog, archivedBacklog)
636
- ];
637
- const activeTaskIds = new Set(activeTasks.map((t) => t.id));
638
- const archivedTaskIds = new Set(archivedTasks.map((t) => t.id));
639
- const danglingSprintMembership = detectDanglingSprintMembership(
640
- sprints,
641
- activeTaskIds,
642
- archivedTaskIds
643
- );
644
- const orphanedFollowups = detectOrphanedFollowups(activeBacklog, archivedBacklog);
645
- return {
646
- duplicateRecords,
647
- danglingSprintMembership,
648
- orphanedFollowups,
649
- totalIssues: duplicateRecords.length + danglingSprintMembership.length + orphanedFollowups.length
650
- };
651
- }
652
- function formatArchiveReconciliationReport(report) {
653
- if (report.totalIssues === 0) return "";
654
- const lines = [];
655
- if (report.duplicateRecords.length > 0) {
656
- lines.push(`Duplicate active+archive records: ${report.duplicateRecords.length}`);
657
- for (const dup of report.duplicateRecords) {
658
- lines.push(` ${dup.kind} ${dup.id} (keep: ${dup.preferred})`);
659
- }
660
- }
661
- if (report.danglingSprintMembership.length > 0) {
662
- lines.push(`Dangling sprint membership: ${report.danglingSprintMembership.length}`);
663
- for (const ref of report.danglingSprintMembership) {
664
- lines.push(` sprint ${ref.sprintId} -> ${ref.taskId} (${ref.reason})`);
665
- }
666
- }
667
- if (report.orphanedFollowups.length > 0) {
668
- lines.push(`Orphaned followups: ${report.orphanedFollowups.length}`);
669
- for (const orphan of report.orphanedFollowups) {
670
- lines.push(` ${orphan.followupId} -> missing parent ${orphan.parentId}`);
671
- }
672
- }
673
- return lines.join("\n");
674
- }
675
-
676
- // src/cli/commands/doctor-claude-alias-advisory.ts
677
- var CLAUDE_ALIAS_FLAGSHIP_MIN_VERSION = "2.1.219";
678
- var CLAUDE_BEDROCK_REGION_PREFIX_MIN_VERSION = "2.1.224";
679
- var CHECK_NAME = "Claude family aliases";
680
- function parseClaudeCliRelease(version) {
681
- const match = /(\d+(?:\.\d+)*)/.exec(version?.trim() ?? "");
682
- return match?.[1] ? match[1].split(".").map(Number) : void 0;
683
- }
684
- function isOlderThan(version, minimum) {
685
- const observed = parseClaudeCliRelease(version);
686
- if (!observed) return false;
687
- const required = parseClaudeCliRelease(minimum) ?? [];
688
- for (let index = 0; index < Math.max(observed.length, required.length); index++) {
689
- const left = observed[index] ?? 0;
690
- const right = required[index] ?? 0;
691
- if (left !== right) return left < right;
692
- }
693
- return false;
694
- }
695
- function claudeAliasAdvisories(input) {
696
- const version = input.version?.trim();
697
- const advisories = [];
698
- if (isOlderThan(version, CLAUDE_ALIAS_FLAGSHIP_MIN_VERSION)) {
699
- advisories.push(
700
- `Claude CLI ${version} predates ${CLAUDE_ALIAS_FLAGSHIP_MIN_VERSION}: a family alias resolves to an older flagship on this CLI, so registry roles that use one run that older model.`
701
- );
702
- }
703
- if (input.backend === "bedrock" && isOlderThan(version, CLAUDE_BEDROCK_REGION_PREFIX_MIN_VERSION)) {
704
- advisories.push(
705
- `Claude CLI ${version} predates ${CLAUDE_BEDROCK_REGION_PREFIX_MIN_VERSION}: ANTHROPIC_BEDROCK_REGION_PREFIX is unavailable, so a family alias on Bedrock uses the CLI's own default region prefix.`
706
- );
707
- }
708
- return advisories;
709
- }
710
- async function checkClaudeAliasAdvisory() {
711
- let command;
712
- let prefixArgs;
713
- try {
714
- const resolved = resolveProviderCliCommand("claude");
715
- command = resolved.command;
716
- prefixArgs = resolved.prefixArgs ?? [];
717
- } catch {
718
- return {
719
- name: CHECK_NAME,
720
- category: "providers",
721
- status: "info",
722
- message: "Claude CLI not configured; skipping family-alias version advisory"
723
- };
724
- }
725
- const version = await probeProviderCliVersion({ command, prefixArgs });
726
- if (!version) {
727
- return {
728
- name: CHECK_NAME,
729
- category: "providers",
730
- status: "info",
731
- message: "Claude CLI version not reported; family-alias resolution not assessed"
732
- };
733
- }
734
- if (!parseClaudeCliRelease(version)) {
735
- return {
736
- name: CHECK_NAME,
737
- category: "providers",
738
- status: "info",
739
- message: `Claude CLI version "${version}" carries no release number; family-alias resolution not assessed`
740
- };
741
- }
742
- const { resolveClaudeBackend } = await import("./model-resolver-ZPNOVV2T.js");
743
- const backend = resolveClaudeBackend(process.env, process.cwd());
744
- const advisories = claudeAliasAdvisories({ version, backend });
745
- if (advisories.length === 0) {
746
- return {
747
- name: CHECK_NAME,
748
- category: "providers",
749
- status: "pass",
750
- message: `Claude CLI ${version} resolves family aliases to the current flagship`
751
- };
752
- }
753
- return {
754
- name: CHECK_NAME,
755
- category: "providers",
756
- status: "info",
757
- message: advisories.join(" "),
758
- details: `Upgrade the Claude CLI to ${CLAUDE_BEDROCK_REGION_PREFIX_MIN_VERSION} or newer, or redirect the alias with ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU}_MODEL. Build passes the alias through by design; the CLI owns what the family means. See docs/PROVIDER_SETUP.md.`
759
- };
760
- }
761
-
762
- // src/cli/commands/doctor-configured-providers.ts
763
- function explicitDefaultsProviderIds(sources) {
764
- const ids = [];
765
- for (const source of sources) {
766
- if (source.type !== "project" && source.type !== "user" || !source.exists) continue;
767
- const providers = source.data?.defaults?.providers;
768
- if (providers && typeof providers === "object") ids.push(...Object.keys(providers));
769
- }
770
- return ids;
771
- }
772
- function configuredProviderIds(config, sources) {
773
- const enabled = Object.entries(config?.providers ?? {}).filter(([, providerConfig]) => providerConfig?.enabled).map(([providerId]) => providerId);
774
- return [...enabled, ...explicitDefaultsProviderIds(sources)];
775
- }
776
-
777
- // src/cli/commands/doctor-fix-summary.ts
778
- function describeUnrepairedChecks(checks) {
779
- const manual = checks.filter((c) => !c.fixable && (c.status === "warn" || c.status === "fail"));
780
- if (manual.length === 0) return void 0;
781
- return `--fix does not repair ${manual.length} remaining issue(s): ${manual.map((c) => c.name).join(", ")}. Follow the instructions in their messages above.`;
782
- }
783
-
784
- // src/cli/commands/doctor-guard.ts
785
- import { promises as fs } from "fs";
786
- import * as path from "path";
787
- var GUARD_DIR_REL = path.join(".build-project", "guard");
788
- var GUARD_LOCK_REL = path.join(GUARD_DIR_REL, "checks.lock");
789
- var INIT_INSTALL_CMD = "build init --guardrails";
790
- var INIT_REINSTALL_CMD = "build init --guardrails --reinstall-guard";
791
- async function readGuardLock(repoRoot) {
792
- try {
793
- const raw = await fs.readFile(path.join(repoRoot, GUARD_LOCK_REL), "utf8");
794
- const parsed = JSON.parse(raw);
795
- const version = typeof parsed.version === "string" ? parsed.version : typeof parsed.kitVersion === "string" ? parsed.kitVersion : typeof parsed.kit_version === "string" ? parsed.kit_version : void 0;
796
- const container = parsed.files ?? parsed.hashes;
797
- let files = [];
798
- if (Array.isArray(container)) {
799
- files = container.filter((f) => typeof f === "string");
800
- } else if (container && typeof container === "object") {
801
- files = Object.keys(container);
802
- }
803
- return { version, files };
804
- } catch {
805
- return null;
806
- }
807
- }
808
- var defaultGuardInspector = async (repoRoot) => {
809
- const state = classifyGuardState(repoRoot).state;
810
- const lock = await readGuardLock(repoRoot);
811
- return {
812
- state,
813
- bundledVersion: GUARD_KIT_VERSION,
814
- installedVersion: lock?.version,
815
- generatedFiles: lock?.files
816
- };
817
- };
818
- async function checkGuardrails(repoRoot, options = {}) {
819
- const inspect = options.inspect ?? defaultGuardInspector;
820
- let inspection;
821
- try {
822
- inspection = await inspect(repoRoot);
823
- } catch (error) {
824
- return [
825
- {
826
- name: "Guardrails",
827
- category: "guardrails",
828
- status: "info",
829
- message: "guardrail kit status unavailable",
830
- details: error instanceof Error ? error.message : String(error)
831
- }
832
- ];
833
- }
834
- if (!inspection) {
835
- return [
836
- {
837
- name: "Guardrails",
838
- category: "guardrails",
839
- status: "info",
840
- message: "guardrail kit module unavailable",
841
- details: "Guard kit could not be loaded in this install; guardrails status is unknown."
842
- }
843
- ];
844
- }
845
- return [checkForState(inspection)];
846
- }
847
- function checkForState(inspection) {
848
- const { state, bundledVersion, installedVersion, generatedFiles } = inspection;
849
- switch (state) {
850
- case "absent":
851
- return {
852
- name: "Guardrails",
853
- category: "guardrails",
854
- status: "info",
855
- message: "guardrail kit not installed",
856
- details: `Optional: install the read-only guardrail kit with "${INIT_INSTALL_CMD}".`
857
- };
858
- case "current":
859
- return {
860
- name: "Guardrails",
861
- category: "guardrails",
862
- status: "pass",
863
- message: `guardrail kit current (version ${installedVersion ?? bundledVersion}); run build guard verify`
864
- };
865
- case "upgradable":
866
- return {
867
- name: "Guardrails",
868
- category: "guardrails",
869
- status: "info",
870
- message: `guardrail kit upgradable (installed ${installedVersion ?? "unknown"}, bundled ${bundledVersion}); run build guard verify after upgrade`,
871
- details: `Run "${INIT_INSTALL_CMD}" to upgrade, then "build guard verify" (config.json is preserved).`
872
- };
873
- case "tampered":
874
- return {
875
- name: "Guardrails",
876
- category: "guardrails",
877
- status: "warn",
878
- message: "guardrail kit modified (hash mismatch)",
879
- details: formatMismatchDetails(generatedFiles)
880
- };
881
- case "partial":
882
- return {
883
- name: "Guardrails",
884
- category: "guardrails",
885
- status: "warn",
886
- message: "guardrail kit incomplete (missing lock or generated files)",
887
- details: formatMismatchDetails(generatedFiles)
888
- };
889
- }
890
- }
891
- function formatMismatchDetails(generatedFiles) {
892
- const suffix = `Run "${INIT_REINSTALL_CMD}" to restore the generated guard files.`;
893
- if (generatedFiles && generatedFiles.length > 0) {
894
- return `Generated guard files: ${generatedFiles.join(", ")}. ${suffix}`;
895
- }
896
- return suffix;
897
- }
898
-
899
- // src/cli/commands/doctor-metrics.ts
900
- import chalk from "chalk";
901
- import { Command } from "commander";
902
- import { z } from "zod";
903
- async function loadTelemetryHealthTracker() {
904
- const mod = await import("./telemetry-health-tracker-4F7JR7H7.js");
905
- return mod.TelemetryHealthTracker;
906
- }
907
- var DoctorMetricsOptionsSchema = z.object({
908
- json: BooleanFlagSchema.optional(),
909
- prometheus: BooleanFlagSchema.optional(),
910
- verbose: BooleanFlagSchema.optional()
911
- }).strict();
912
- var DoctorMetricsMonitorOptionsSchema = z.object({
913
- interval: z.number().optional(),
914
- json: BooleanFlagSchema.optional(),
915
- prometheus: BooleanFlagSchema.optional()
916
- }).strict();
917
- function buildUnavailableHealthMetrics() {
918
- return {
919
- queueDepth: 0,
920
- fallbackMode: false,
921
- errorRate: 0,
922
- databaseHealthy: false,
923
- lastErrorTimestamp: null,
924
- errorsLastHour: 0,
925
- unresolvedErrors: 0
926
- };
927
- }
928
- function isHealthSchemaPresent(db) {
929
- const row = db.prepare(
930
- "SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'telemetry_errors' LIMIT 1"
931
- ).get();
932
- return row !== void 0;
933
- }
934
- async function openTelemetryDb() {
935
- const { openConfiguredTelemetryDb } = await import("./storage-access-4PBODLIC.js");
936
- const TelemetryHealthTracker = await loadTelemetryHealthTracker();
937
- const readonlyResult = openConfiguredTelemetryDb();
938
- if (!readonlyResult.db) {
939
- return readonlyResult;
940
- }
941
- const { dbPath } = readonlyResult;
942
- if (isHealthSchemaPresent(readonlyResult.db)) {
943
- return readonlyResult;
944
- }
945
- readonlyResult.db.close();
946
- const writableResult = openConfiguredTelemetryDb({ writable: true });
947
- if (!writableResult.db) {
948
- return writableResult;
949
- }
950
- try {
951
- new TelemetryHealthTracker(writableResult.db);
952
- } catch (error) {
953
- writableResult.db.close();
954
- return {
955
- db: null,
956
- dbPath,
957
- error: error instanceof Error ? error.message : String(error)
958
- };
959
- }
960
- writableResult.db.close();
961
- return openConfiguredTelemetryDb();
962
- }
963
- function readDoctorMetricsOptions(command) {
964
- const globals = command.optsWithGlobals();
965
- return validateCommandOptions(DoctorMetricsOptionsSchema, {
966
- json: globals.json,
967
- prometheus: globals.prometheus,
968
- verbose: globals.verbose
969
- });
970
- }
971
- async function collectHealthMetrics(db) {
972
- const TelemetryHealthTracker = await loadTelemetryHealthTracker();
973
- const tracker = new TelemetryHealthTracker(db);
974
- const queueDepth = 0;
975
- const fallbackMode = false;
976
- const health = tracker.getHealthMetrics(queueDepth, fallbackMode);
977
- const metrics = {
978
- queueDepth: health.queue_depth,
979
- fallbackMode: health.fallback_mode_active,
980
- errorRate: health.error_rate,
981
- databaseHealthy: health.database_healthy,
982
- lastErrorTimestamp: health.last_error_timestamp || null,
983
- errorsLastHour: health.errors_last_hour,
984
- unresolvedErrors: health.unresolved_errors
985
- };
986
- try {
987
- const mttr = tracker.calculateMTTR(24);
988
- metrics.mttr = {
989
- meanTimeToResolution: Math.round(mttr.mean_time_to_resolution),
990
- p50: Math.round(mttr.p50_resolution_time),
991
- p95: Math.round(mttr.p95_resolution_time),
992
- p99: Math.round(mttr.p99_resolution_time),
993
- resolutionRate: mttr.resolution_rate,
994
- errorCount24h: mttr.error_count_last_24h
995
- };
996
- } catch (_error) {
997
- }
998
- return metrics;
999
- }
1000
- function formatMetricsJson(metrics, extras = {}) {
1001
- try {
1002
- getDataDir();
1003
- } catch {
1004
- }
1005
- const pathEnvWarnings = getRejectedPathEnvWarnings();
1006
- return JSON.stringify(
1007
- {
1008
- status: getHealthStatus(metrics),
1009
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1010
- uptime: Math.floor(process.uptime()),
1011
- metrics,
1012
- ...extras.telemetryDb ? { telemetryDb: extras.telemetryDb } : {},
1013
- ...extras.databaseError ? { databaseError: extras.databaseError } : {},
1014
- ...pathEnvWarnings.length > 0 ? { pathEnvWarnings } : {}
1015
- },
1016
- null,
1017
- 2
1018
- );
1019
- }
1020
- function formatMetricsPrometheus(metrics) {
1021
- const lines = [];
1022
- lines.push("# HELP build_error_rate Error rate as decimal (0.0-1.0)");
1023
- lines.push("# TYPE build_error_rate gauge");
1024
- lines.push(`build_error_rate ${metrics.errorRate.toFixed(4)}`);
1025
- lines.push("# HELP build_database_healthy Database health status (1=healthy, 0=unhealthy)");
1026
- lines.push("# TYPE build_database_healthy gauge");
1027
- lines.push(`build_database_healthy ${metrics.databaseHealthy ? 1 : 0}`);
1028
- lines.push("# HELP build_errors_last_hour Number of errors in last hour");
1029
- lines.push("# TYPE build_errors_last_hour gauge");
1030
- lines.push(`build_errors_last_hour ${metrics.errorsLastHour}`);
1031
- lines.push("# HELP build_unresolved_errors Number of unresolved errors");
1032
- lines.push("# TYPE build_unresolved_errors gauge");
1033
- lines.push(`build_unresolved_errors ${metrics.unresolvedErrors}`);
1034
- if (metrics.mttr) {
1035
- lines.push("# HELP build_mttr_ms Mean time to resolution in milliseconds");
1036
- lines.push("# TYPE build_mttr_ms gauge");
1037
- lines.push(`build_mttr_ms ${metrics.mttr.meanTimeToResolution}`);
1038
- lines.push("# HELP build_mttr_p50_ms 50th percentile time to resolution (ms)");
1039
- lines.push("# TYPE build_mttr_p50_ms gauge");
1040
- lines.push(`build_mttr_p50_ms ${metrics.mttr.p50}`);
1041
- lines.push("# HELP build_mttr_p95_ms 95th percentile time to resolution (ms)");
1042
- lines.push("# TYPE build_mttr_p95_ms gauge");
1043
- lines.push(`build_mttr_p95_ms ${metrics.mttr.p95}`);
1044
- lines.push("# HELP build_mttr_p99_ms 99th percentile time to resolution (ms)");
1045
- lines.push("# TYPE build_mttr_p99_ms gauge");
1046
- lines.push(`build_mttr_p99_ms ${metrics.mttr.p99}`);
1047
- lines.push("# HELP build_resolution_rate Error resolution rate (0.0-1.0)");
1048
- lines.push("# TYPE build_resolution_rate gauge");
1049
- lines.push(`build_resolution_rate ${metrics.mttr.resolutionRate.toFixed(4)}`);
1050
- lines.push("# HELP build_error_count_24h Error count in last 24 hours");
1051
- lines.push("# TYPE build_error_count_24h gauge");
1052
- lines.push(`build_error_count_24h ${metrics.mttr.errorCount24h}`);
1053
- }
1054
- lines.push(`# Generated at ${(/* @__PURE__ */ new Date()).toISOString()}`);
1055
- return `${lines.join("\n")}
1056
- `;
1057
- }
1058
- function formatMetricsTable(metrics, verbose = false) {
1059
- const lines = [];
1060
- lines.push(chalk.bold.cyan("\nBuild Telemetry Metrics\n"));
1061
- const status = getHealthStatus(metrics);
1062
- const statusColor = status === "healthy" ? chalk.green : status === "degraded" ? chalk.yellow : chalk.red;
1063
- const statusIcon = status === "healthy" ? "OK" : status === "degraded" ? "Warning: " : "Error";
1064
- lines.push(
1065
- `${statusColor(statusIcon)} Status: ${statusColor(status.toUpperCase())}`
1066
- );
1067
- lines.push(`Error Rate: ${(metrics.errorRate * 100).toFixed(2)}%`);
1068
- lines.push(
1069
- `${metrics.databaseHealthy ? "OK" : "Error"} Database: ${metrics.databaseHealthy ? chalk.green("Healthy") : chalk.red("Unhealthy")}`
1070
- );
1071
- if (metrics.errorsLastHour > 0) {
1072
- lines.push(chalk.yellow(`Warning: Errors (last hour): ${metrics.errorsLastHour}`));
1073
- } else {
1074
- lines.push("OK Errors (last hour): 0");
1075
- }
1076
- if (metrics.unresolvedErrors > 0) {
1077
- lines.push(chalk.yellow(`Warning: Unresolved: ${metrics.unresolvedErrors}`));
1078
- } else {
1079
- lines.push("OK Unresolved: 0");
1080
- }
1081
- if (verbose && metrics.lastErrorTimestamp) {
1082
- const lastErrorTime = new Date(metrics.lastErrorTimestamp);
1083
- const minutesAgo = Math.floor((Date.now() - lastErrorTime.getTime()) / 6e4);
1084
- lines.push(`Last Error: ${minutesAgo} minutes ago`);
1085
- }
1086
- if (verbose && metrics.mttr) {
1087
- lines.push(chalk.bold.cyan("\nResolution Metrics (24h)\n"));
1088
- lines.push(
1089
- `Time: MTTR (mean): ${formatDurationMs(metrics.mttr.meanTimeToResolution)}`
1090
- );
1091
- lines.push(`MTTR (P50): ${formatDurationMs(metrics.mttr.p50)}`);
1092
- lines.push(`MTTR (P95): ${formatDurationMs(metrics.mttr.p95)}`);
1093
- lines.push(`MTTR (P99): ${formatDurationMs(metrics.mttr.p99)}`);
1094
- lines.push(`OK Resolution Rate: ${(metrics.mttr.resolutionRate * 100).toFixed(1)}%`);
1095
- lines.push(`Error Count (24h): ${metrics.mttr.errorCount24h}`);
1096
- }
1097
- if (verbose && metrics.lastErrorTimestamp) {
1098
- lines.push(chalk.bold.cyan("\nDetails\n"));
1099
- lines.push(`Last Error: ${metrics.lastErrorTimestamp}`);
1100
- }
1101
- lines.push("");
1102
- return lines.join("\n");
1103
- }
1104
- function getHealthStatus(metrics) {
1105
- if (!metrics.databaseHealthy) {
1106
- return "unhealthy";
1107
- }
1108
- if (metrics.errorRate > 0.1 || metrics.unresolvedErrors > 0) {
1109
- return "degraded";
1110
- }
1111
- return "healthy";
1112
- }
1113
- async function displayDatabaseStatus(options = {}) {
1114
- const { db, dbPath, error } = await openTelemetryDb();
1115
- if (!db) {
1116
- const metrics = buildUnavailableHealthMetrics();
1117
- if (options.json) {
1118
- console.log(
1119
- formatMetricsJson(metrics, {
1120
- telemetryDb: dbPath,
1121
- databaseError: error ?? "Telemetry database unavailable"
1122
- })
1123
- );
1124
- process.exit(1);
1125
- }
1126
- console.log(chalk.yellow(`Warning: ${error ?? "Telemetry database not found"}`));
1127
- console.log(` Path: ${dbPath}`);
1128
- console.log(" Run: build init");
1129
- process.exit(1);
1130
- }
1131
- try {
1132
- const metrics = await collectHealthMetrics(db);
1133
- if (options.json) {
1134
- console.log(formatMetricsJson(metrics, { telemetryDb: dbPath }));
1135
- } else if (options.prometheus) {
1136
- console.log(formatMetricsPrometheus(metrics));
1137
- } else {
1138
- console.log(formatMetricsTable(metrics, options.verbose ?? false));
1139
- }
1140
- } catch (error2) {
1141
- if (options.json) {
1142
- const metrics = buildUnavailableHealthMetrics();
1143
- console.log(
1144
- formatMetricsJson(metrics, {
1145
- telemetryDb: dbPath,
1146
- databaseError: error2 instanceof Error ? error2.message : String(error2)
1147
- })
1148
- );
1149
- process.exit(1);
1150
- }
1151
- console.error(
1152
- chalk.red("Failed to collect health metrics:"),
1153
- error2 instanceof Error ? error2.message : String(error2)
1154
- );
1155
- process.exit(1);
1156
- } finally {
1157
- db.close();
1158
- }
1159
- }
1160
- async function monitorHealth(options) {
1161
- const { db, dbPath, error } = await openTelemetryDb();
1162
- if (!db) {
1163
- if (options.json) {
1164
- const metrics = buildUnavailableHealthMetrics();
1165
- console.log(
1166
- formatMetricsJson(metrics, {
1167
- telemetryDb: dbPath,
1168
- databaseError: error ?? "Telemetry database unavailable"
1169
- })
1170
- );
1171
- process.exit(1);
1172
- }
1173
- console.log(chalk.yellow(`Warning: ${error ?? "Telemetry database not found"}`));
1174
- console.log(` Path: ${dbPath}`);
1175
- console.log(" Run: build init");
1176
- return;
1177
- }
1178
- const interval = (options.interval || 2) * 1e3;
1179
- const isJson = options.json || false;
1180
- const isPrometheus = options.prometheus || false;
1181
- try {
1182
- while (true) {
1183
- const metrics = await collectHealthMetrics(db);
1184
- if (isJson) {
1185
- console.log(formatMetricsJson(metrics));
1186
- } else if (isPrometheus) {
1187
- console.log(formatMetricsPrometheus(metrics));
1188
- } else {
1189
- console.clear?.();
1190
- console.log(formatMetricsTable(metrics, false));
1191
- }
1192
- await new Promise((resolve) => setTimeout(resolve, interval));
1193
- }
1194
- } catch (error2) {
1195
- console.error(
1196
- chalk.red("Error Monitoring error:"),
1197
- error2 instanceof Error ? error2.message : String(error2)
1198
- );
1199
- process.exit(1);
1200
- } finally {
1201
- db.close();
1202
- }
1203
- }
1204
- function createDoctorMetricsCommand() {
1205
- const metricsCmd = new Command("metrics");
1206
- metricsCmd.description(
1207
- "Monitor telemetry-derived operational metrics (not the install doctor)\n\nNote: For install / provider auth diagnostics use `build doctor`.\n`build doctor metrics` reports runtime telemetry from the local SQLite store.\n\nExamples:\n build doctor metrics # Show metrics status\n build doctor metrics --json # Output as JSON\n build doctor metrics --prometheus # Prometheus format\n build doctor metrics monitor # Real-time monitoring\n build doctor metrics monitor --interval 5 # Update every 5 seconds"
1208
- );
1209
- const checkCmd = new Command("check");
1210
- checkCmd.description("Run telemetry metrics check and display results");
1211
- checkCmd.option("--json", "Output as JSON");
1212
- checkCmd.option("--prometheus", "Output in Prometheus text format");
1213
- checkCmd.option("-v, --verbose", "Show detailed information");
1214
- checkCmd.action(async function() {
1215
- const validatedOptions = readDoctorMetricsOptions(this);
1216
- const { db, dbPath, error } = await openTelemetryDb();
1217
- if (!db) {
1218
- const metrics = buildUnavailableHealthMetrics();
1219
- if (validatedOptions.json) {
1220
- console.log(
1221
- formatMetricsJson(metrics, {
1222
- telemetryDb: dbPath,
1223
- databaseError: error ?? "Telemetry database unavailable"
1224
- })
1225
- );
1226
- process.exit(1);
1227
- }
1228
- console.log(chalk.yellow(`Warning: ${error ?? "Telemetry database not found"}`));
1229
- console.log(` Path: ${dbPath}`);
1230
- console.log(" Run: build init");
1231
- process.exit(1);
1232
- }
1233
- let degraded = false;
1234
- try {
1235
- const metrics = await collectHealthMetrics(db);
1236
- const status = getHealthStatus(metrics);
1237
- degraded = status !== "healthy";
1238
- if (validatedOptions.json) {
1239
- console.log(formatMetricsJson(metrics, { telemetryDb: dbPath }));
1240
- } else if (validatedOptions.prometheus) {
1241
- console.log(formatMetricsPrometheus(metrics));
1242
- } else {
1243
- console.log(formatMetricsTable(metrics, validatedOptions.verbose));
1244
- }
1245
- } finally {
1246
- db.close();
1247
- }
1248
- if (degraded) process.exit(1);
1249
- });
1250
- const monitorCmd = new Command("monitor");
1251
- monitorCmd.description("Watch telemetry metrics in real-time");
1252
- monitorCmd.option("--interval <seconds>", "Update interval in seconds", "2");
1253
- monitorCmd.option("--json", "Output as JSON");
1254
- monitorCmd.option("--prometheus", "Output in Prometheus text format");
1255
- monitorCmd.action(async (options) => {
1256
- const monitorOptions = {
1257
- interval: options.interval ? Number.parseInt(String(options.interval), 10) : 2,
1258
- json: Boolean(options.json),
1259
- prometheus: Boolean(options.prometheus)
1260
- };
1261
- const validatedOptions = validateCommandOptions(
1262
- DoctorMetricsMonitorOptionsSchema,
1263
- monitorOptions
1264
- );
1265
- await monitorHealth(validatedOptions);
1266
- });
1267
- metricsCmd.addCommand(checkCmd);
1268
- metricsCmd.addCommand(monitorCmd);
1269
- metricsCmd.option("--json", "Output as JSON");
1270
- metricsCmd.option("--prometheus", "Output in Prometheus text format");
1271
- metricsCmd.option("-v, --verbose", "Show detailed information");
1272
- metricsCmd.action(async function() {
1273
- const validatedOptions = readDoctorMetricsOptions(this);
1274
- await displayDatabaseStatus(validatedOptions);
1275
- });
1276
- return metricsCmd;
1277
- }
1278
-
1279
- // src/cli/commands/doctor-native-sqlite.ts
1280
- var loadBetterSqlite3 = async () => (await import("better-sqlite3")).default;
1281
- async function checkNativeSqlite(load2 = loadBetterSqlite3) {
1282
- try {
1283
- const Database = await load2();
1284
- const db = new Database(":memory:");
1285
- try {
1286
- const row = db.prepare("SELECT 1 AS ok").get();
1287
- if (row?.ok !== 1) throw new Error("in-memory query returned an unexpected result");
1288
- } finally {
1289
- db.close();
1290
- }
1291
- return {
1292
- name: "Native SQLite",
1293
- category: "build",
1294
- status: "pass",
1295
- message: "better-sqlite3 loads"
1296
- };
1297
- } catch (error) {
1298
- return {
1299
- name: "Native SQLite",
1300
- category: "build",
1301
- status: "fail",
1302
- message: "better-sqlite3 cannot load; telemetry and planning databases will not work",
1303
- details: `${error instanceof Error ? error.message : String(error)}. Reinstall Build under a supported Node version. Linux glibc prebuilds require glibc >=2.34 and libstdc++ with GLIBCXX_3.4.29; older glibc systems have no source-build fallback.`
1304
- };
1305
- }
1306
- }
1307
-
1308
- // src/cli/commands/doctor-storage.ts
1309
- function checkPlanningStorageBackend(repoRoot) {
1310
- try {
1311
- if (resolvePlanningContextForRoot(repoRoot).backend !== "checkout") return void 0;
1312
- } catch {
1313
- return void 0;
1314
- }
1315
- return {
1316
- name: "Planning Storage",
1317
- category: "build",
1318
- status: "info",
1319
- message: "Planning buckets are tracked in the checkout; `build plan storage enable` moves them to the build/work branch"
1320
- };
1321
- }
1322
- async function checkBuildBranchNameConflict(repoRoot) {
1323
- let refs;
1324
- try {
1325
- const result = await execGit(
1326
- ["for-each-ref", "--format=%(refname)", "refs/heads/", "refs/remotes/"],
1327
- { cwd: repoRoot }
1328
- );
1329
- if (result.exitCode !== 0) return void 0;
1330
- refs = result.stdout;
1331
- } catch {
1332
- return void 0;
1333
- }
1334
- const conflicts = refs.split("\n").map((ref) => ref.trim()).filter((ref) => {
1335
- const parts = ref.split("/");
1336
- const name = parts[1] === "heads" ? parts.slice(2) : parts[1] === "remotes" ? parts.slice(3) : [];
1337
- return name.length === 1 && name[0]?.toLowerCase() === "build";
1338
- }).map((ref) => ref.replace(/^refs\/(heads|remotes)\//, ""));
1339
- if (conflicts.length === 0) return void 0;
1340
- return {
1341
- name: "Build Branch Names",
1342
- category: "git",
1343
- status: "warn",
1344
- message: `A branch named ${conflicts.join(", ")} blocks Build from creating its build/... branches`,
1345
- details: 'Git cannot hold a branch named "build" alongside branches under "build/" (on macOS the names clash in any letter case). Rename that branch, locally with `git branch -m <old> <new>` and on the remote by pushing the new name and deleting the old one.'
1346
- };
1347
- }
1348
-
1349
- // src/core/task-types/packaged-copies.ts
1350
- import { createHash } from "crypto";
1351
- import * as fs2 from "fs/promises";
1352
- import * as path2 from "path";
1353
- import * as yaml from "js-yaml";
1354
-
1355
- // src/core/task-types/shipped-task-type-fingerprints.json
1356
- var shipped_task_type_fingerprints_default = {
1357
- about: "sha256 of every templates/.build-project/task-types version that build init could copy into a repository before it stopped copying task types. Generated by scripts/generate-task-type-fingerprints.mjs; no maintenance needed.",
1358
- fingerprints: {
1359
- "4c9a35f0939a138008cb46679cc07889f45fc3592c1c284f8c6cae34b338f750": {
1360
- id: "analysis",
1361
- shipped: "2026-08-17"
1362
- },
1363
- "64b66ece5f41b0144fc494bd0a7ed5cadf30bbff20f54e69850904f37aaf0127": {
1364
- id: "analysis",
1365
- shipped: "2026-09-15"
1366
- },
1367
- a562c77b1744f6f2d3178bcc0bd9e171c6d1c18a7e7393375511830c210f0008: {
1368
- id: "analysis",
1369
- shipped: "2026-09-26"
1370
- },
1371
- "280a7a8f9c46de1e4c42f01efbbcef378ec728ea9e36b67a055101dd7e195075": {
1372
- id: "architecture",
1373
- shipped: "2026-08-17"
1374
- },
1375
- f76e6ef5160b568ad7d54eb8a51bfa2b12bf910bde4f9b110216104bc0b2c796: {
1376
- id: "architecture",
1377
- shipped: "2026-09-15"
1378
- },
1379
- "7ac93c055b45d7f3c3ab794e35d6f9b9768e5edd46f9fd6dfde3a5e6057ef77d": {
1380
- id: "architecture",
1381
- shipped: "2026-09-26"
1382
- },
1383
- "8c5c152f7fe44436b5edf63bd8cdab9a395cdb579dd1b111cabb86788dacb43d": {
1384
- id: "doc",
1385
- shipped: "2026-08-17"
1386
- },
1387
- bc81f4c08c4b410ec89c41828c653da20071788beee29643721a1887575226fc: {
1388
- id: "doc",
1389
- shipped: "2026-09-26"
1390
- },
1391
- "6f3e5218c85e2ca1b47b880c14101b3bbae63613bd715ccb596a3f686f3eeb6e": {
1392
- id: "feature",
1393
- shipped: "2026-08-17"
1394
- },
1395
- "01fe455c0db9e813d6c8280654b5df1407c26c72e7e2bf0aa3c1796329b67337": {
1396
- id: "feature",
1397
- shipped: "2026-09-26"
1398
- },
1399
- f0e1e4f76ef434529fa8c52a6a23f28c4262b9b2bfb93e4ad1b372488f608d22: {
1400
- id: "general",
1401
- shipped: "2026-08-17"
1402
- },
1403
- "169a3316cc15d9cfebf8af76f96a914ea68bd73452d94c7da44515ff6b60c9f8": {
1404
- id: "general",
1405
- shipped: "2026-09-26"
1406
- },
1407
- e813bb3fd1587a9e1d9a82095b43680d19c5393ba5e10536d232fa8f8fca2cb2: {
1408
- id: "security",
1409
- shipped: "2026-08-17"
1410
- },
1411
- "70e6d7e168fc96b7b5dfde0603f2025ff53af48ed717f361a0623d5bcd443365": {
1412
- id: "security",
1413
- shipped: "2026-09-26"
1414
- }
1415
- }
1416
- };
1417
-
1418
- // src/core/task-types/packaged-copies.ts
1419
- var SHIPPED_TASK_TYPE_VERSIONS = shipped_task_type_fingerprints_default.fingerprints;
1420
- function sha256(bytes) {
1421
- return createHash("sha256").update(bytes).digest("hex");
1422
- }
1423
- function taskTypeId(bytes, filePath) {
1424
- try {
1425
- const parsed = yaml.load(bytes.toString("utf8"), { schema: yaml.JSON_SCHEMA });
1426
- const id = parsed?.id;
1427
- if (typeof id === "string" && id.length > 0) return id;
1428
- } catch {
1429
- }
1430
- return path2.basename(filePath).replace(/\.ya?ml$/, "");
1431
- }
1432
- async function findPackagedTaskTypeCopies(options) {
1433
- const repoFiles = await listYamlFiles(options.repoDir);
1434
- if (repoFiles.length === 0) return { fileCount: 0, copies: [] };
1435
- const shipped = options.shipped ?? SHIPPED_TASK_TYPE_VERSIONS;
1436
- const currentIdByHash = /* @__PURE__ */ new Map();
1437
- for (const filePath of await listYamlFiles(options.builtInDir ?? getBuiltInTaskTypesDir())) {
1438
- const bytes = await fs2.readFile(filePath);
1439
- currentIdByHash.set(sha256(bytes), taskTypeId(bytes, filePath));
1440
- }
1441
- const currentIds = new Set(currentIdByHash.values());
1442
- const repoEntries = [];
1443
- const repoIdCounts = /* @__PURE__ */ new Map();
1444
- for (const filePath of repoFiles) {
1445
- const bytes = await fs2.readFile(filePath);
1446
- const id = taskTypeId(bytes, filePath);
1447
- repoEntries.push({ file: path2.basename(filePath), hash: sha256(bytes), id });
1448
- repoIdCounts.set(id, (repoIdCounts.get(id) ?? 0) + 1);
1449
- }
1450
- const copies = [];
1451
- for (const { file, hash, id } of repoEntries) {
1452
- const version = shipped[hash];
1453
- const currentId = currentIdByHash.get(hash);
1454
- const sharedId = (repoIdCounts.get(id) ?? 0) > 1;
1455
- if (currentId !== void 0) {
1456
- copies.push({ file, id: currentId, kind: "current", shipped: version?.shipped, sharedId });
1457
- } else if (version) {
1458
- const kind = currentIds.has(version.id) ? "older" : "retired";
1459
- copies.push({ file, id: version.id, kind, shipped: version.shipped, sharedId });
1460
- }
1461
- }
1462
- return { fileCount: repoFiles.length, copies };
1463
- }
1464
-
1465
- // src/cli/commands/doctor-task-types.ts
1466
- var CHECK_NAME2 = "Repo Task Types";
1467
- function describeCopy(copy) {
1468
- const file = `.build-project/task-types/${copy.file}`;
1469
- const shipped = copy.shipped ? ` shipped ${copy.shipped}` : "";
1470
- const shared = `Another repo file also defines ${copy.id}, so packaged updates still won't apply after deleting this one.`;
1471
- switch (copy.kind) {
1472
- case "older":
1473
- return copy.sharedId ? `${file} matches the packaged ${copy.id} task type${shipped}. ${shared}` : `${file} matches the packaged ${copy.id} task type${shipped}; it overrides newer packaged versions. Delete it to receive updates, or keep it to stay on that version.`;
1474
- case "current":
1475
- return copy.sharedId ? `${file} matches the current packaged ${copy.id} task type. ${shared}` : `${file} matches the current packaged ${copy.id} task type; it will override future packaged versions. Delete it to receive future updates, or keep it to stay on this version.`;
1476
- case "retired":
1477
- return `${file} matches the packaged ${copy.id} task type${shipped}, which this install no longer ships; ${copy.sharedId ? `another repo file also defines ${copy.id}.` : `it is now the only definition of ${copy.id}.`}`;
1478
- }
1479
- }
1480
- async function checkRepoTaskTypes(repoRoot, options = {}) {
1481
- let report;
1482
- try {
1483
- report = await findPackagedTaskTypeCopies({
1484
- ...options,
1485
- repoDir: getRepoTaskTypesDir(repoRoot)
1486
- });
1487
- } catch (error) {
1488
- return {
1489
- name: CHECK_NAME2,
1490
- category: "build",
1491
- status: "info",
1492
- message: "Could not compare repo task types with packaged versions",
1493
- details: error instanceof Error ? error.message : String(error)
1494
- };
1495
- }
1496
- const { fileCount, copies } = report;
1497
- if (copies.length === 0) {
1498
- return {
1499
- name: CHECK_NAME2,
1500
- category: "build",
1501
- status: "pass",
1502
- message: fileCount === 0 ? "No repo task-type files; packaged task types apply" : `${fileCount} repo task-type override(s); none match a packaged version`
1503
- };
1504
- }
1505
- const lines = copies.map(describeCopy);
1506
- const overrides = fileCount - copies.length;
1507
- if (overrides > 0) {
1508
- lines.push(`${overrides} other file(s) match no packaged version and are repo overrides.`);
1509
- }
1510
- return {
1511
- name: CHECK_NAME2,
1512
- category: "build",
1513
- status: "info",
1514
- message: `${copies.length} of ${fileCount} repo task-type file(s) match a packaged version; run build doctor --verbose for details`,
1515
- details: lines.join("\n ")
1516
- };
1517
- }
1518
-
1519
- // src/cli/commands/doctor.ts
1520
- var BetterSqlite3Ctor = null;
1521
- async function getBetterSqlite3() {
1522
- if (!BetterSqlite3Ctor) {
1523
- const mod = await import("better-sqlite3");
1524
- BetterSqlite3Ctor = mod.default;
1525
- }
1526
- return BetterSqlite3Ctor;
1527
- }
1528
- var HOMEBREW_NODE_24_PATH = "/opt/homebrew/opt/node@24/bin/node";
1529
- async function preferredNode24Path() {
1530
- try {
1531
- await fs3.access(HOMEBREW_NODE_24_PATH);
1532
- return HOMEBREW_NODE_24_PATH;
1533
- } catch {
1534
- return null;
1535
- }
1536
- }
1537
- function formatNode24Remediation(preferredPath) {
1538
- if (preferredPath) {
1539
- return `Build requires Node.js ${formatSupportedNodeMajors()}; use ${preferredPath} or put /opt/homebrew/opt/node@24/bin first in PATH.`;
1540
- }
1541
- return `Build requires Node.js ${formatSupportedNodeMajors()} first on PATH. Run: nvm install 24; export PATH="$(dirname "$(nvm which 24)"):$PATH"; hash -r; command -v node; node --version; npm config get prefix.`;
1542
- }
1543
- function isLikelyBetterSqlite3NativeLoadMismatch(error) {
1544
- const code = error?.code;
1545
- const message = error instanceof Error ? error.message : String(error);
1546
- return code === "ERR_DLOPEN_FAILED" || message.includes("NODE_MODULE_VERSION") || /compiled against a different Node\.js version/i.test(message) || /was compiled for a different Node\.js version/i.test(message) || /module did not self-register/i.test(message) || /invalid ELF header/i.test(message) || /incompatible architecture/i.test(message) || /better[-_]sqlite3/i.test(message) && /\.node\b/i.test(message);
1547
- }
1548
- function formatDatabaseNativeErrorDetails(error) {
1549
- const message = error instanceof Error ? error.message : String(error);
1550
- if (!isLikelyBetterSqlite3NativeLoadMismatch(error)) {
1551
- return message;
1552
- }
1553
- return `${message}
1554
- Remediation: reinstall Build under the active Node (npm install -g @ebrindley/build; source checkout: rm -rf node_modules && npm ci), then rerun build doctor.`;
1555
- }
1556
- var HealthCommandOptionsSchema = z2.object({
1557
- json: BooleanFlagSchema.optional(),
1558
- verbose: BooleanFlagSchema.optional(),
1559
- fix: BooleanFlagSchema.optional(),
1560
- all: BooleanFlagSchema.optional(),
1561
- provider: z2.string().optional(),
1562
- providersOnly: BooleanFlagSchema.optional(),
1563
- matrix: BooleanFlagSchema.optional(),
1564
- strict: BooleanFlagSchema.optional(),
1565
- requireReady: BooleanFlagSchema.optional(),
1566
- probe: BooleanFlagSchema.optional(),
1567
- refresh: BooleanFlagSchema.optional(),
1568
- checkLinks: BooleanFlagSchema.optional()
1569
- }).strict();
1570
- function isStrictBlockingWarning(check) {
1571
- if (check.name === "Linux write boundary" || check.name === "Agent Wrapper Imports") {
1572
- return false;
1573
- }
1574
- if (check.category === "providers" && check.name === "Provider CLIs") {
1575
- return false;
1576
- }
1577
- if (check.category === "providers" && (check.name === "OpenCode discovery" || /auth not observed/i.test(check.message))) {
1578
- return false;
1579
- }
1580
- return true;
1581
- }
1582
- function isRequireReadyFailure(check) {
1583
- return check.category === "providers" && check.name === "Provider CLIs" && (check.readinessGateLabel === "zero-ready" || check.readinessReadyCount === 0);
1584
- }
1585
- function exitForHealthFailures(checks, options) {
1586
- const failedChecks = checks.filter((c) => c.status === "fail");
1587
- const warnChecks = checks.filter((c) => c.status === "warn" && isStrictBlockingWarning(c));
1588
- if (failedChecks.length > 0) {
1589
- process.exit(1);
1590
- }
1591
- if (options.requireReady && checks.some((check) => isRequireReadyFailure(check))) {
1592
- process.exit(1);
1593
- }
1594
- if (options.strict && warnChecks.length > 0) {
1595
- process.exit(1);
1596
- }
1597
- }
1598
- async function checkGit() {
1599
- try {
1600
- const result = await execa("git", ["--version"]);
1601
- const version = result.stdout.trim();
1602
- let details = version;
1603
- try {
1604
- const whichCmd = process.platform === "win32" ? "where" : "which";
1605
- const whichResult = await execa(whichCmd, ["git"]);
1606
- details = `${version} \u2014 ${whichResult.stdout.trim()}`;
1607
- } catch (_whichError) {
1608
- }
1609
- return {
1610
- name: "Git",
1611
- category: "git",
1612
- status: "pass",
1613
- message: version,
1614
- details
1615
- };
1616
- } catch (error) {
1617
- return {
1618
- name: "Git",
1619
- category: "git",
1620
- status: "fail",
1621
- message: "Git not found or not accessible",
1622
- details: error instanceof Error ? error.message : String(error)
1623
- };
1624
- }
1625
- }
1626
- var PROVIDER_CLI_SPECS = [
1627
- { id: "claude", versionArgs: ["--version"] },
1628
- { id: "codex", versionArgs: ["--version"] },
1629
- { id: "copilot", versionArgs: ["--version"] },
1630
- { id: "cursor", versionArgs: ["--version"] },
1631
- { id: "gemini", versionArgs: ["--version"] },
1632
- { id: "grok", versionArgs: ["--version"] },
1633
- { id: "kiro", versionArgs: ["--version"] },
1634
- { id: "pi", versionArgs: ["--version"] },
1635
- { id: "antigravity", versionArgs: ["--version"] },
1636
- { id: "opencode", versionArgs: ["--version"] }
1637
- ];
1638
- var PROVIDER_CLI_SPEC_IDS = PROVIDER_CLI_SPECS.map((s) => s.id);
1639
- var AUTH_PROBE_HINT_PROVIDERS = /* @__PURE__ */ new Set(["grok"]);
1640
- var PROVIDER_EXTRA_HEALTH_CHECKS = [
1641
- { providerId: "opencode", runWithoutProviderFilter: false, check: checkOpencodeDiscovery },
1642
- { providerId: "claude", runWithoutProviderFilter: true, check: checkClaudeStrictMcpConfig },
1643
- { providerId: "claude", runWithoutProviderFilter: true, check: checkLegacyClaudePlugin },
1644
- { providerId: "claude", runWithoutProviderFilter: true, check: checkClaudeAliasAdvisory }
1645
- ];
1646
- async function collectProviderExtraHealthChecks(options) {
1647
- const checks = [];
1648
- for (const entry of PROVIDER_EXTRA_HEALTH_CHECKS) {
1649
- const requested = options.all === true || options.provider === entry.providerId || entry.runWithoutProviderFilter && !options.provider;
1650
- if (requested) {
1651
- checks.push(await entry.check());
1652
- }
1653
- }
1654
- return checks;
1655
- }
1656
- function providerHealthReadinessOptions(providerId) {
1657
- const activeAuthProviders = /* @__PURE__ */ new Set(["cursor", "grok"]);
1658
- return {
1659
- mode: "execute",
1660
- authProbeMode: activeAuthProviders.has(providerId) ? "active" : "passive"
1661
- };
1662
- }
1663
- async function formatLastSeenAuth(providerId) {
1664
- const lookup = await lookupAuthOutcome(providerId);
1665
- if (!lookup || lookup.stale || !lookup.contextMatches) {
1666
- return "none";
1667
- }
1668
- return `${lookup.entry.result}, ${lookup.entry.observedAt}`;
1669
- }
1670
- async function recordHealthAuthOutcome(providerId, result, message) {
1671
- await recordAuthOutcome(providerId, result, {
1672
- source: "health-probe",
1673
- message
1674
- }).catch(() => {
1675
- });
1676
- }
1677
- function normalizeProviderId(value) {
1678
- return normalizeEngineId(value.trim());
1679
- }
1680
- async function checkOpencodeDiscovery() {
1681
- let command;
1682
- let prefixArgs;
1683
- try {
1684
- ({ command, prefixArgs } = resolveProviderCliCommand("opencode"));
1685
- } catch {
1686
- return {
1687
- name: "OpenCode discovery",
1688
- category: "providers",
1689
- status: "fail",
1690
- message: "OpenCode CLI not resolved",
1691
- details: "Install OpenCode or set BUILD_OPENCODE_CLI_COMMAND. Run: build doctor --provider opencode"
1692
- };
1693
- }
1694
- const cliProbe = await probeProviderCli(command, ["--version"], prefixArgs, {
1695
- providerId: "opencode"
1696
- });
1697
- const cliInstalled = cliProbe.present;
1698
- const discovery = await discoverOpencode({
1699
- cliCommand: command,
1700
- prefixArgs,
1701
- cliInstalled,
1702
- refreshModels: false,
1703
- includeModelsDev: true,
1704
- modelsDevCacheDir: path3.join(
1705
- getRuntimeEnv("BUILD_TELEMETRY_DIR") ?? path3.join(process.cwd(), ".build-project"),
1706
- "cache",
1707
- "opencode"
1708
- )
1709
- });
1710
- const parts = [];
1711
- parts.push(`CLI installed: ${cliInstalled ? "yes" : "no"}`);
1712
- if (discovery.authList.rawOk) {
1713
- const credentialNames = discovery.authList.credentialProviders ?? [];
1714
- const environmentNames = discovery.authList.environmentProviders ?? [];
1715
- parts.push(`Auth: ${credentialNames.length > 0 ? credentialNames.join(", ") : "not observed"}`);
1716
- if (environmentNames.length > 0) {
1717
- parts.push(`Capability (parent-env): ${environmentNames.join(", ")}`);
1718
- }
1719
- } else {
1720
- parts.push(
1721
- `Providers (auth list): unsupported or failed${discovery.authList.unsupportedMessage ? ` (${discovery.authList.unsupportedMessage.slice(0, 80)})` : ""}`
1722
- );
1723
- }
1724
- if (discovery.models.rawOk) {
1725
- parts.push(
1726
- `Models: ${discovery.models.modelIds.length > 0 ? discovery.models.modelIds.slice(0, 15).join(", ") + (discovery.models.modelIds.length > 15 ? ` (+${discovery.models.modelIds.length - 15} more)` : "") : "none"}`
1727
- );
1728
- } else {
1729
- parts.push(
1730
- `Models: unsupported or failed${discovery.models.unsupportedMessage ? ` (${discovery.models.unsupportedMessage.slice(0, 80)})` : ""}`
1731
- );
1732
- }
1733
- if (discovery.modelsDev) {
1734
- const source = discovery.modelsDev.source === "network" ? "fresh" : "cache";
1735
- parts.push(
1736
- `models.dev: ${source}${discovery.modelsDev.fetchedAt ? ` @ ${new Date(discovery.modelsDev.fetchedAt).toISOString()}` : ""}`
1737
- );
1738
- }
1739
- const credentialProviders = discovery.authList.credentialProviders ?? [];
1740
- const environmentProviders = discovery.authList.environmentProviders ?? [];
1741
- const hasCredentialAuth = credentialProviders.length > 0;
1742
- const envOnlyCapability = cliInstalled && discovery.authList.rawOk && !hasCredentialAuth && (environmentProviders.length > 0 || discovery.models.modelIds.length > 0);
1743
- const status = cliInstalled && discovery.authList.rawOk && discovery.models.rawOk && hasCredentialAuth ? "pass" : cliInstalled ? "warn" : "fail";
1744
- const message = status === "pass" ? `CLI installed; ${credentialProviders.length} credential provider(s); ${discovery.models.modelIds.length} model(s)` : envOnlyCapability ? "CLI present; auth not observed (parent-env vendors are capability only)" : cliInstalled ? discovery.authList.rawOk && discovery.models.rawOk ? "CLI present; no OpenCode providers or models discovered" : "CLI present; auth list or models unavailable" : "OpenCode CLI not installed";
1745
- return {
1746
- name: "OpenCode discovery",
1747
- category: "providers",
1748
- status,
1749
- message,
1750
- details: parts.join(" | ")
1751
- };
1752
- }
1753
- async function getProvidersToCheck(options) {
1754
- const validIds = PROVIDER_CLI_SPECS.map((s) => s.id);
1755
- if (options.provider) {
1756
- const requested = normalizeProviderId(options.provider);
1757
- if (!validIds.includes(requested)) {
1758
- throw new Error(
1759
- `Unknown provider: ${options.provider}. Valid providers: ${validIds.join(", ")}`
1760
- );
1761
- }
1762
- return {
1763
- providers: [requested],
1764
- isDiscoveryMode: false,
1765
- selectionScope: "provider"
1766
- };
1767
- }
1768
- if (options.all) {
1769
- return {
1770
- providers: PROVIDER_CLI_SPECS.map((s) => s.id),
1771
- isDiscoveryMode: false,
1772
- selectionScope: "all"
1773
- };
1774
- }
1775
- const configured = /* @__PURE__ */ new Set();
1776
- const defaultProvider = process.env.BUILD_DEFAULT_PROVIDER;
1777
- if (defaultProvider) {
1778
- const normalized = normalizeProviderId(defaultProvider);
1779
- if (validIds.includes(normalized)) {
1780
- configured.add(normalized);
1781
- }
1782
- }
1783
- try {
1784
- const { ConfigManager: ConfigManager2 } = await import("./config-manager-5ZVIIEAM.js");
1785
- const manager = new ConfigManager2({
1786
- enableCache: false,
1787
- cwd: process.cwd()
1788
- });
1789
- const resolved = await manager.loadConfig({}, true);
1790
- const config = resolved.config;
1791
- const hasExplicitConfig = resolved.sources.some(
1792
- (source) => (source.type === "project" || source.type === "user") && source.exists
1793
- );
1794
- if (hasExplicitConfig) {
1795
- for (const providerId of configuredProviderIds(config, resolved.sources)) {
1796
- configured.add(normalizeProviderId(providerId));
1797
- }
1798
- const configuredDefault = config?.defaults?.provider ?? config?.defaultProvider;
1799
- if (configuredDefault) {
1800
- configured.add(normalizeProviderId(String(configuredDefault)));
1801
- }
1802
- }
1803
- } catch (error) {
1804
- if (isConfigValidityError(error)) {
1805
- throw error;
1806
- }
1807
- }
1808
- if (configured.size > 0) {
1809
- const validIds2 = new Set(PROVIDER_CLI_SPECS.map((s) => s.id));
1810
- const filteredProviders = [...configured].filter((id) => validIds2.has(id));
1811
- if (filteredProviders.length > 0) {
1812
- return {
1813
- providers: filteredProviders,
1814
- isDiscoveryMode: false,
1815
- selectionScope: "configured"
1816
- };
1817
- }
1818
- }
1819
- return {
1820
- providers: PROVIDER_CLI_SPECS.map((s) => s.id),
1821
- isDiscoveryMode: true,
1822
- selectionScope: "discovery"
1823
- };
1824
- }
1825
- async function checkProviderCLIs(optionsOrVerbose = false) {
1826
- const options = typeof optionsOrVerbose === "boolean" ? { includeVerboseDetails: optionsOrVerbose } : optionsOrVerbose;
1827
- const includeVerboseDetails = options.includeVerboseDetails ?? false;
1828
- const {
1829
- providers: providersToCheck,
1830
- isDiscoveryMode,
1831
- selectionScope
1832
- } = await getProvidersToCheck(options);
1833
- const specsToCheck = PROVIDER_CLI_SPECS.filter((spec) => providersToCheck.includes(spec.id));
1834
- const uncheckedProviderIds = selectionScope === "configured" ? PROVIDER_CLI_SPECS.map((spec) => spec.id).filter((id) => !providersToCheck.includes(id)) : [];
1835
- const available = [];
1836
- const degraded = [];
1837
- const authUnobserved = [];
1838
- const sandboxBlocked = [];
1839
- const missing = [];
1840
- const providerBreakdown = [];
1841
- const providerReadiness = [];
1842
- const gateReadyProviders = /* @__PURE__ */ new Set();
1843
- const authMissing = [];
1844
- const authReady = [];
1845
- const lastSeenAuthMap = /* @__PURE__ */ new Map();
1846
- for (const spec of specsToCheck) {
1847
- lastSeenAuthMap.set(spec.id, await formatLastSeenAuth(spec.id));
1848
- }
1849
- const repoRoot = resolveRepoRootForBuildDir(process.cwd());
1850
- for (const spec of specsToCheck) {
1851
- let config;
1852
- try {
1853
- config = getProviderConfig(spec.id);
1854
- } catch {
1855
- missing.push({ id: spec.id });
1856
- if (includeVerboseDetails) {
1857
- providerBreakdown.push({ id: spec.id, status: "missing" });
1858
- }
1859
- continue;
1860
- }
1861
- if (!config?.cli) {
1862
- missing.push({ id: spec.id });
1863
- if (includeVerboseDetails) {
1864
- providerBreakdown.push({ id: spec.id, status: "missing" });
1865
- }
1866
- continue;
1867
- }
1868
- const readinessOptions = options.probe ? {
1869
- ...providerHealthReadinessOptions(spec.id)
1870
- } : {
1871
- ...SETUP_CHECK_READINESS_OPTIONS,
1872
- cliProbeMode: "execute",
1873
- sandboxProbeMode: "execute",
1874
- probeAuth: async () => "unknown"
1875
- };
1876
- const probeContext = readinessProbeContextForOptions(readinessOptions);
1877
- const readiness = await getProviderReadiness(spec.id, readinessOptions);
1878
- if (isGateReadyProvider(readiness)) gateReadyProviders.add(readiness.provider);
1879
- if (options.probe) {
1880
- void recordReadinessDiagnostic(readiness, {
1881
- phase: "health",
1882
- cliProbeMode: "execute",
1883
- ...readinessOptions.authProbeMode ? { authProbeMode: readinessOptions.authProbeMode } : {}
1884
- });
1885
- }
1886
- const dryRun = readProviderDryRunFreshness(spec.id, repoRoot);
1887
- const resolved = resolveNamedReadiness(readiness, dryRun);
1888
- const scope = resolveReadinessScope(readiness, resolved);
1889
- const parityLabel = resolveProviderParityLabel(readiness, resolved);
1890
- providerReadiness.push({
1891
- provider: spec.id,
1892
- known: readiness.known,
1893
- configured: readiness.configured,
1894
- installed: readiness.installed,
1895
- cliHealthy: readiness.cliHealthy,
1896
- authenticated: readiness.authenticated,
1897
- ready: readiness.ready,
1898
- scope: scope.label,
1899
- ...scope.detail ? { scopeDetail: scope.detail } : {},
1900
- ...readiness.readinessNote ? { readinessNote: readiness.readinessNote } : {},
1901
- ...readiness.reasonCode ? { reasonCode: readiness.reasonCode } : {},
1902
- parityLabel,
1903
- resolved,
1904
- probe: probeContext
1905
- });
1906
- const lastSeenAuth = lastSeenAuthMap.get(spec.id) ?? "";
1907
- if (!readiness.command && !readiness.installed) {
1908
- missing.push({
1909
- id: spec.id,
1910
- installCommand: config.cli?.install_command
1911
- });
1912
- if (includeVerboseDetails) {
1913
- providerBreakdown.push({
1914
- id: spec.id,
1915
- status: "missing",
1916
- installCommand: config.cli?.install_command,
1917
- lastSeenAuth
1918
- });
1919
- }
1920
- continue;
1921
- }
1922
- if (!readiness.installed) {
1923
- missing.push({
1924
- id: spec.id,
1925
- installCommand: config.cli?.install_command
1926
- });
1927
- if (includeVerboseDetails) {
1928
- providerBreakdown.push({
1929
- id: spec.id,
1930
- status: "missing",
1931
- resolvedCommand: readiness.command,
1932
- installCommand: config.cli?.install_command,
1933
- lastSeenAuth
1934
- });
1935
- }
1936
- } else if (!readiness.cliHealthy) {
1937
- degraded.push({
1938
- id: spec.id,
1939
- reason: readiness.reason ?? "Unknown issue"
1940
- });
1941
- if (includeVerboseDetails) {
1942
- providerBreakdown.push({
1943
- id: spec.id,
1944
- status: "degraded",
1945
- resolvedCommand: readiness.command,
1946
- degradedReason: readiness.reason,
1947
- lastSeenAuth
1948
- });
1949
- }
1950
- } else {
1951
- if (readiness.sandboxCapable === false) {
1952
- const deniedPaths = readiness.sandboxDeniedPaths?.join(", ") ?? "";
1953
- const summary = deniedPaths ? `${spec.id}: sandbox blocked (${deniedPaths})` : formatSandboxDegradedSummary({
1954
- providerId: spec.id,
1955
- capable: false,
1956
- probed: [],
1957
- missing: []
1958
- });
1959
- const verboseReason = readiness.sandboxReason ?? "CLI present, sandbox capability denied";
1960
- sandboxBlocked.push({ id: spec.id, paths: deniedPaths });
1961
- degraded.push({ id: spec.id, reason: summary });
1962
- if (includeVerboseDetails) {
1963
- providerBreakdown.push({
1964
- id: spec.id,
1965
- status: "degraded",
1966
- resolvedCommand: readiness.command,
1967
- degradedReason: verboseReason,
1968
- lastSeenAuth
1969
- });
1970
- }
1971
- continue;
1972
- }
1973
- const authState = readiness.authenticated;
1974
- if (authState === "no") {
1975
- if (options.probe) {
1976
- await recordHealthAuthOutcome(
1977
- spec.id,
1978
- "failed",
1979
- readiness.reason ?? "Health probe reported authentication missing"
1980
- );
1981
- }
1982
- authMissing.push(spec.id);
1983
- const authMissingReason = spec.id === "codex" && readEnv(BUILD_CODEX_BACKEND).value?.trim().toLowerCase() === "bedrock" ? 'CLI present, auth missing; Bedrock runs need an AWS credential chain, not "codex login"' : "CLI present, auth missing";
1984
- degraded.push({ id: spec.id, reason: authMissingReason });
1985
- if (includeVerboseDetails) {
1986
- providerBreakdown.push({
1987
- id: spec.id,
1988
- status: "degraded",
1989
- resolvedCommand: readiness.command,
1990
- degradedReason: authMissingReason,
1991
- lastSeenAuth: lastSeenAuthMap.get(spec.id) ?? ""
1992
- });
1993
- }
1994
- continue;
1995
- }
1996
- if (authState === "unknown") {
1997
- const activeProbeUnknown = options.probe === true && readiness.reason?.includes("active auth probe could not verify headless execution");
1998
- const defaultProbeHintUnknown = AUTH_PROBE_HINT_PROVIDERS.has(spec.id) && options.provider === spec.id && options.probe !== true;
1999
- if (activeProbeUnknown || defaultProbeHintUnknown) {
2000
- const reason2 = defaultProbeHintUnknown ? `installed; auth checked on first run; run \`build doctor --probe --provider ${spec.id}\` to verify headless execution` : readiness.reason ?? "CLI present, active auth probe inconclusive";
2001
- degraded.push({
2002
- id: spec.id,
2003
- reason: reason2
2004
- });
2005
- if (includeVerboseDetails) {
2006
- providerBreakdown.push({
2007
- id: spec.id,
2008
- status: "degraded",
2009
- resolvedCommand: readiness.command,
2010
- degradedReason: reason2,
2011
- lastSeenAuth
2012
- });
2013
- }
2014
- continue;
2015
- }
2016
- const cached = await lookupAuthOutcome(spec.id);
2017
- const freshFailure = cached?.entry.result === "failed" && !cached.stale && cached.contextMatches;
2018
- if (!freshFailure) {
2019
- authUnobserved.push(spec.id);
2020
- available.push(spec.id);
2021
- if (includeVerboseDetails) {
2022
- providerBreakdown.push({
2023
- id: spec.id,
2024
- status: "available",
2025
- resolvedCommand: readiness.command,
2026
- lastSeenAuth
2027
- });
2028
- }
2029
- continue;
2030
- }
2031
- const reason = "CLI present, cached auth failure";
2032
- degraded.push({
2033
- id: spec.id,
2034
- reason
2035
- });
2036
- if (includeVerboseDetails) {
2037
- providerBreakdown.push({
2038
- id: spec.id,
2039
- status: "degraded",
2040
- resolvedCommand: readiness.command,
2041
- degradedReason: reason,
2042
- lastSeenAuth
2043
- });
2044
- }
2045
- continue;
2046
- }
2047
- if (authState === "yes") {
2048
- if (readiness.authEvidence === "execution") {
2049
- await recordHealthAuthOutcome(spec.id, "ok", "Health probe succeeded");
2050
- }
2051
- authReady.push(spec.id);
2052
- }
2053
- available.push(spec.id);
2054
- if (includeVerboseDetails) {
2055
- providerBreakdown.push({
2056
- id: spec.id,
2057
- status: "available",
2058
- resolvedCommand: readiness.command,
2059
- degradedReason: readiness.warning,
2060
- lastSeenAuth: lastSeenAuthMap.get(spec.id) ?? ""
2061
- });
2062
- }
2063
- }
2064
- }
2065
- const missingDetails = missing.map(
2066
- (entry) => entry.installCommand ? `${entry.id} (install: ${entry.installCommand})` : entry.id
2067
- ).join(", ");
2068
- const degradedDetails = degraded.map((entry) => `${entry.id} (${entry.reason})`).join(", ");
2069
- const lastSeenParts = specsToCheck.map(
2070
- (spec) => `${spec.id}: ${lastSeenAuthMap.get(spec.id) ?? ""}`
2071
- );
2072
- const baseDetails = (() => {
2073
- const parts = [];
2074
- if (available.length > 0) {
2075
- parts.push(`CLI present: ${available.join(", ")}`);
2076
- }
2077
- if (degraded.length > 0) {
2078
- parts.push(`Degraded: ${degradedDetails}`);
2079
- }
2080
- if (authUnobserved.length > 0) {
2081
- parts.push(
2082
- `No current auth observation: ${authUnobserved.join(", ")} (expected; provider execution is the probe)`
2083
- );
2084
- }
2085
- if (authMissing.length > 0) {
2086
- parts.push(`Auth missing: ${authMissing.join(", ")}`);
2087
- }
2088
- if (authReady.length > 0) {
2089
- parts.push(`Auth ready: ${authReady.join(", ")}`);
2090
- }
2091
- const assumedReady = providerReadiness.filter((entry) => entry.readinessNote === "env-var-auth-assumed").map((entry) => entry.provider);
2092
- if (assumedReady.length > 0) {
2093
- parts.push(`Readiness assumed: ${assumedReady.join(", ")}`);
2094
- }
2095
- if (lastSeenParts.length > 0) {
2096
- parts.push(`Last seen auth: ${lastSeenParts.join(", ")}`);
2097
- }
2098
- if (missing.length > 0) {
2099
- parts.push(`Missing: ${missingDetails}`);
2100
- }
2101
- if (uncheckedProviderIds.length > 0) {
2102
- parts.push(`Not checked: ${uncheckedProviderIds.join(", ")} (use --all to include)`);
2103
- }
2104
- if (parts.length === 0) {
2105
- return "No provider CLIs checked";
2106
- }
2107
- return parts.join(" | ");
2108
- })();
2109
- const discoveryModeNote = isDiscoveryMode ? `
2110
-
2111
- Info: Discovery mode: No configured providers found, checking all known providers.
2112
- Tip: Set BUILD_DEFAULT_PROVIDER or configure providers in build.config.jsonc / ${getUserConfigFile()}` : "";
2113
- const details = (() => {
2114
- if (!includeVerboseDetails) return baseDetails + discoveryModeNote;
2115
- if (providerBreakdown.length === 0) return baseDetails + discoveryModeNote;
2116
- const breakdown = providerBreakdown.map((provider) => {
2117
- let statusMark;
2118
- switch (provider.status) {
2119
- case "available":
2120
- statusMark = "OK";
2121
- break;
2122
- case "degraded":
2123
- statusMark = "Warning:";
2124
- break;
2125
- default:
2126
- statusMark = "Error";
2127
- }
2128
- const commandPart = provider.resolvedCommand ? `: ${provider.resolvedCommand}` : ": missing";
2129
- const statusSuffix = (() => {
2130
- if (provider.status === "missing" && provider.installCommand) {
2131
- return ` (install: ${provider.installCommand})`;
2132
- }
2133
- if (provider.status === "degraded" && provider.degradedReason) {
2134
- const lastSeen = provider.lastSeenAuth ? `; lastSeenAuth: ${provider.lastSeenAuth}` : "";
2135
- return ` (${provider.degradedReason}${lastSeen})`;
2136
- }
2137
- if (provider.lastSeenAuth) {
2138
- return ` (lastSeenAuth: ${provider.lastSeenAuth})`;
2139
- }
2140
- return "";
2141
- })();
2142
- return `${statusMark} ${provider.id}${commandPart}${statusSuffix}`;
2143
- }).join("\n ");
2144
- return `${baseDetails}${discoveryModeNote}
2145
-
2146
- ${breakdown}`;
2147
- })();
2148
- const totalChecked = specsToCheck.length;
2149
- const healthyCount = available.length;
2150
- const degradedCount = degraded.length;
2151
- const missingCount = missing.length;
2152
- const gateReadyCount = gateReadyProviders.size;
2153
- const readinessGateLabel = gateReadyCount === 0 ? "zero-ready" : gateReadyCount === 1 ? "one-ready" : "multi-ready";
2154
- const gateMeta = {
2155
- readinessGateLabel,
2156
- readinessReadyCount: gateReadyCount
2157
- };
2158
- if (options.requireReady && gateReadyCount === 0) {
2159
- return {
2160
- name: "Provider CLIs",
2161
- category: "providers",
2162
- status: "fail",
2163
- message: isDiscoveryMode ? "No ready providers (--require-ready, discovery mode)" : "No ready providers (--require-ready)",
2164
- details,
2165
- ...providerReadiness.length > 0 ? { providerReadiness } : {},
2166
- ...gateMeta
2167
- };
2168
- }
2169
- if (healthyCount === 0 && degradedCount === 0) {
2170
- return {
2171
- name: "Provider CLIs",
2172
- category: "providers",
2173
- status: "fail",
2174
- message: isDiscoveryMode ? "No provider CLIs present (discovery mode)" : "No provider CLIs present",
2175
- details,
2176
- ...providerReadiness.length > 0 ? { providerReadiness } : {},
2177
- ...gateMeta
2178
- };
2179
- }
2180
- if (missingCount > 0 || degradedCount > 0) {
2181
- const statusParts = [];
2182
- if (healthyCount > 0) statusParts.push(`${healthyCount} healthy`);
2183
- if (degradedCount > 0) statusParts.push(`${degradedCount} degraded`);
2184
- if (missingCount > 0) {
2185
- statusParts.push(`${missingCount} missing (${missing.map((entry) => entry.id).join(", ")})`);
2186
- }
2187
- if ((options.strict || options.requireReady) && gateReadyCount > 0) {
2188
- statusParts.push(`${gateReadyCount} ready`);
2189
- }
2190
- return {
2191
- name: "Provider CLIs",
2192
- category: "providers",
2193
- status: degradedCount > 0 || missingCount > 0 ? "warn" : "pass",
2194
- message: (() => {
2195
- if (options.provider) {
2196
- const sandboxEntry = sandboxBlocked.find((entry) => entry.id === options.provider);
2197
- if (sandboxEntry) {
2198
- return sandboxEntry.paths ? `${options.provider} sandbox blocked (${sandboxEntry.paths})` : `${options.provider} sandbox/policy blocked`;
2199
- }
2200
- if (authMissing.includes(options.provider)) {
2201
- return `${options.provider} CLI present, auth missing`;
2202
- }
2203
- }
2204
- return `${statusParts.join(", ")} of ${totalChecked} ${selectionScope === "configured" ? "configured " : ""}checked${isDiscoveryMode ? " (discovery mode)" : ""}${uncheckedProviderIds.length > 0 ? `; ${uncheckedProviderIds.length} known provider(s) not checked` : ""}`;
2205
- })(),
2206
- details,
2207
- ...providerReadiness.length > 0 ? { providerReadiness } : {},
2208
- ...gateMeta
2209
- };
2210
- }
2211
- const scopedPassMessage = selectionScope === "configured" && uncheckedProviderIds.length > 0 ? `${healthyCount} of ${totalChecked} configured provider CLIs present; ${uncheckedProviderIds.length} known provider(s) not checked` : void 0;
2212
- return {
2213
- name: "Provider CLIs",
2214
- category: "providers",
2215
- status: "pass",
2216
- message: options.provider && authReady.includes(options.provider) ? `${options.provider} CLI present and authenticated` : scopedPassMessage ?? (totalChecked === PROVIDER_CLI_SPECS.length ? `All ${healthyCount} provider CLIs present${isDiscoveryMode ? " (discovery mode)" : ""}` : `${healthyCount} of ${totalChecked} checked provider CLIs present${isDiscoveryMode ? " (discovery mode)" : ""}`),
2217
- details,
2218
- ...providerReadiness.length > 0 ? { providerReadiness } : {},
2219
- ...gateMeta
2220
- };
2221
- }
2222
- async function checkBuildDirectory(cwd) {
2223
- const buildDir = path3.join(cwd, ".build-project");
2224
- try {
2225
- await fs3.stat(buildDir);
2226
- try {
2227
- await fs3.access(buildDir, fs3.constants.W_OK);
2228
- return {
2229
- name: ".build-project Directory",
2230
- category: "build",
2231
- status: "pass",
2232
- message: "Directory exists and is writable",
2233
- details: buildDir
2234
- };
2235
- } catch (_error) {
2236
- return {
2237
- name: ".build-project Directory",
2238
- category: "build",
2239
- status: "fail",
2240
- message: "Directory not writable",
2241
- details: buildDir,
2242
- fixable: false
2243
- };
2244
- }
2245
- } catch (_error) {
2246
- return {
2247
- name: ".build-project Directory",
2248
- category: "build",
2249
- status: "warn",
2250
- message: "Directory not found",
2251
- details: 'Run "build init" or "build doctor --fix" to initialize',
2252
- fixable: true
2253
- };
2254
- }
2255
- }
2256
- async function checkNestedBuildDirectory(cwd) {
2257
- const nestedDir = path3.join(cwd, ".build-project", ".build-project");
2258
- try {
2259
- const stats = await fs3.stat(nestedDir);
2260
- if (stats.isDirectory()) {
2261
- return {
2262
- name: "Nested .build-project Directory",
2263
- category: "build",
2264
- status: "warn",
2265
- message: "Found nested .build-project/.build-project/ directory (bug artifact)",
2266
- details: `This directory was created by a bug and should be removed: ${nestedDir}`,
2267
- fixable: true
2268
- };
2269
- }
2270
- } catch (_error) {
2271
- }
2272
- return null;
2273
- }
2274
- async function checkRequiredDirectories(cwd) {
2275
- const missing = [];
2276
- const present = [];
2277
- for (const dir of RuntimeRequirements.directories) {
2278
- const fullPath = path3.join(cwd, ".build-project", dir);
2279
- try {
2280
- await fs3.stat(fullPath);
2281
- present.push(dir);
2282
- } catch (_error) {
2283
- missing.push(dir);
2284
- }
2285
- }
2286
- if (missing.length === 0) {
2287
- return {
2288
- name: "Required Directories",
2289
- category: "build",
2290
- status: "pass",
2291
- message: `All ${RuntimeRequirements.directories.length} directories present`,
2292
- details: `All present: ${present.join(", ")}`
2293
- };
2294
- }
2295
- if (missing.length === RuntimeRequirements.directories.length) {
2296
- return {
2297
- name: "Required Directories",
2298
- category: "build",
2299
- status: "fail",
2300
- message: "No directories found",
2301
- details: `Present: ${present.join(", ")} | Missing: ${missing.join(", ")}`,
2302
- fixable: true
2303
- };
2304
- }
2305
- return {
2306
- name: "Required Directories",
2307
- category: "build",
2308
- status: "warn",
2309
- message: `${missing.length} directories missing`,
2310
- details: `Present: ${present.join(", ")} | Missing: ${missing.join(", ")}`,
2311
- fixable: true
2312
- };
2313
- }
2314
- async function checkArchiveReconciliation() {
2315
- let report;
2316
- try {
2317
- report = await detectArchiveReconciliationIssues();
2318
- } catch (error) {
2319
- const unavailable = planningStorageUnavailableReason(error);
2320
- return {
2321
- name: "Archive Reconciliation",
2322
- category: "build",
2323
- status: "warn",
2324
- message: unavailable ? `Planning storage unavailable: ${unavailable}` : "Could not scan for archive reconciliation issues",
2325
- details: error instanceof Error ? error.message : String(error)
2326
- };
2327
- }
2328
- if (report.totalIssues === 0) {
2329
- return {
2330
- name: "Archive Reconciliation",
2331
- category: "build",
2332
- status: "pass",
2333
- message: "No archive/restore reconciliation issues"
2334
- };
2335
- }
2336
- return {
2337
- name: "Archive Reconciliation",
2338
- category: "build",
2339
- status: "warn",
2340
- message: `${report.totalIssues} archive reconciliation issue(s) detected`,
2341
- details: formatArchiveReconciliationReport(report)
2342
- };
2343
- }
2344
- async function checkProviderConfig(cwd) {
2345
- const providersConfigPath = resolveProvidersConfigPath({ cwd });
2346
- try {
2347
- ProviderRegistry.load(void 0, cwd);
2348
- const ignoredUserModelEntries = ProviderRegistry.describeIgnoredUserModelEntries();
2349
- if (ignoredUserModelEntries) {
2350
- return {
2351
- name: "Provider Config",
2352
- category: "build",
2353
- status: "warn",
2354
- message: "Provider catalog loaded; invalid user model entries were ignored",
2355
- details: ignoredUserModelEntries
2356
- };
2357
- }
2358
- const projectPolicyPresent = await fs3.stat(providersConfigPath).then(() => true).catch((error) => {
2359
- if (error.code === "ENOENT") return false;
2360
- throw error;
2361
- });
2362
- return {
2363
- name: "Provider Config",
2364
- category: "build",
2365
- status: "pass",
2366
- message: "Provider catalog loaded",
2367
- details: projectPolicyPresent ? `Release catalog with project policy: ${providersConfigPath}` : `Release catalog: ${ProviderRegistry.getLoadedConfigPath()}`
2368
- };
2369
- } catch (error) {
2370
- return {
2371
- name: "Provider Config",
2372
- category: "build",
2373
- status: "warn",
2374
- message: "Cannot load provider catalog",
2375
- details: error instanceof Error ? error.message : String(error)
2376
- };
2377
- }
2378
- }
2379
- async function checkExecutionRoles() {
2380
- try {
2381
- const outcome = await runExecutionRolesPreflight(process.cwd());
2382
- if (!outcome.result || !outcome.roles) {
2383
- return null;
2384
- }
2385
- const { errors, warnings } = outcome.result;
2386
- const details = formatPreflightDetails(outcome.result);
2387
- const reviewer = outcome.roles.reviewer;
2388
- if (errors.length > 0) {
2389
- return {
2390
- name: "Execution Roles",
2391
- category: "build",
2392
- status: "fail",
2393
- message: `Reviewer not ready for gate "${reviewer.gate}"`,
2394
- details
2395
- };
2396
- }
2397
- if (warnings.length > 0) {
2398
- const deferredAuthOnly = warnings.every(
2399
- (warning) => warning.code === "reviewer_auth_unknown"
2400
- );
2401
- return {
2402
- name: "Execution Roles",
2403
- category: "build",
2404
- status: deferredAuthOnly ? "info" : "warn",
2405
- message: deferredAuthOnly ? `Reviewer installed; auth checked on first run (gate "${reviewer.gate}")` : `Reviewer degraded (gate "${reviewer.gate}")`,
2406
- details
2407
- };
2408
- }
2409
- return {
2410
- name: "Execution Roles",
2411
- category: "build",
2412
- status: "pass",
2413
- message: `Reviewer ready (gate "${reviewer.gate}")`
2414
- };
2415
- } catch (error) {
2416
- return {
2417
- name: "Execution Roles",
2418
- category: "build",
2419
- status: "fail",
2420
- message: "Invalid execution-role configuration",
2421
- details: error instanceof Error ? error.message : String(error)
2422
- };
2423
- }
2424
- }
2425
- async function checkSteeringInstructions() {
2426
- const { getShadowedLegacyInstructionsPath, getUserInstructionsPath, loadUserInstructionsFile } = await import("./user-agents-LVES6I5N.js");
2427
- const instructionsPath = getUserInstructionsPath();
2428
- const loaded = loadUserInstructionsFile();
2429
- const shadowedLegacy = getShadowedLegacyInstructionsPath();
2430
- const shadowedNote = shadowedLegacy ? ` ${shadowedLegacy} is ignored because instructions.md exists beside it; merge and delete it.` : "";
2431
- if (!loaded) {
2432
- return {
2433
- name: "Global Instructions",
2434
- category: "build",
2435
- status: "info",
2436
- message: "No Build instructions file; using built-in steering defaults",
2437
- details: `Optional: customize provider runs with "build config instructions edit" (${instructionsPath}). Steering-capable provider runs inherit it.`
2438
- };
2439
- }
2440
- if (!loaded.source.editedByUser) {
2441
- return {
2442
- name: "Global Instructions",
2443
- category: "build",
2444
- status: "info",
2445
- message: "Build instructions file present (unedited default)",
2446
- details: `Tip: tailor it with "build config instructions edit" (${instructionsPath}). Steering-capable provider runs inherit it.${shadowedNote}`
2447
- };
2448
- }
2449
- if (shadowedLegacy) {
2450
- return {
2451
- name: "Global Instructions",
2452
- category: "build",
2453
- status: "info",
2454
- message: "Build instructions file present (customized); a legacy AGENTS.md is ignored",
2455
- details: `${instructionsPath}.${shadowedNote}`
2456
- };
2457
- }
2458
- return {
2459
- name: "Global Instructions",
2460
- category: "build",
2461
- status: "pass",
2462
- message: "Build instructions file present (customized)",
2463
- details: instructionsPath
2464
- };
2465
- }
2466
- async function checkLinuxWriteBoundary() {
2467
- try {
2468
- const { resolveLinuxHostClass, formatLinuxHostClassNote } = await import("./linux-host-class-TBQ2S5CA.js");
2469
- const resolution = resolveLinuxHostClass();
2470
- if (resolution.hostClass === "desktop-unacked") {
2471
- return {
2472
- name: "Linux write boundary",
2473
- category: "system",
2474
- status: "warn",
2475
- message: "Linux desktop write consent is not recorded; on a VM, container or cloud host run `build sandbox trust linux --host isolated`, on a desktop `--ack-desktop`",
2476
- details: "This is not a sandbox-blocked provider. Write-capable runs need `build sandbox trust linux --ack-desktop` or, for a VM/container/cloud instance, `build sandbox trust linux --host isolated`."
2477
- };
2478
- }
2479
- if (resolution.hostClass === "not-applicable") {
2480
- return {
2481
- name: "Linux write boundary",
2482
- category: "system",
2483
- status: "pass",
2484
- message: "Host class not applicable on this platform",
2485
- details: `source=${resolution.source}`
2486
- };
2487
- }
2488
- const note = resolution.note ?? formatLinuxHostClassNote(resolution);
2489
- return {
2490
- name: "Linux write boundary",
2491
- category: "system",
2492
- status: "pass",
2493
- message: `Host class ${resolution.hostClass} (source=${resolution.source}); writes allowed`,
2494
- details: note ?? "Provider CLIs can write anywhere $USER can. This is not Seatbelt-sandboxed."
2495
- };
2496
- } catch (error) {
2497
- return {
2498
- name: "Linux write boundary",
2499
- category: "system",
2500
- status: "info",
2501
- message: "Linux host-class posture could not be resolved",
2502
- details: error instanceof Error ? error.message : String(error)
2503
- };
2504
- }
2505
- }
2506
- async function checkVerificationPrivilegeBoundary() {
2507
- let verificationLabel = "unavailable";
2508
- try {
2509
- const { PROJECT_VERIFICATION_SANDBOX_ID, resolveSandboxLabel } = await import("./safety-stanza-CWYF7XKO.js");
2510
- verificationLabel = resolveSandboxLabel(
2511
- PROJECT_VERIFICATION_SANDBOX_ID,
2512
- PROJECT_VERIFICATION_SANDBOX_ID
2513
- );
2514
- } catch {
2515
- verificationLabel = "unavailable";
2516
- }
2517
- return {
2518
- name: "Verification Privileges",
2519
- category: "system",
2520
- status: "info",
2521
- message: "Project verification wraps when a boundary is available; otherwise it is an ordinary child",
2522
- details: `Test, build, lint, and typecheck commands from the target repository wrap when a generated macOS seatbelt or accepted container boundary is available. On unsupported platforms or when the sandbox is disabled, they run as ordinary child processes. Live verification posture: ${verificationLabel}. The command allowlist constrains the command string, not what the invoked script does. Treat running Build against an unfamiliar repository as running that repository's code. See docs/reference/SECURITY.md (Project Verification Executes Target-Repository Code).`
2523
- };
2524
- }
2525
- async function checkClaudeStrictMcpConfig() {
2526
- let command;
2527
- let prefixArgs;
2528
- try {
2529
- const resolved = resolveProviderCliCommand("claude");
2530
- command = resolved.command;
2531
- prefixArgs = resolved.prefixArgs ?? [];
2532
- } catch {
2533
- return {
2534
- name: "Claude strict-mcp-config",
2535
- category: "providers",
2536
- status: "info",
2537
- message: "Claude CLI not configured; skipping strict-mcp-config check"
2538
- };
2539
- }
2540
- const probe = await probeProviderCli(command, ["--version"], prefixArgs, {
2541
- providerId: "claude"
2542
- });
2543
- if (!probe.present) {
2544
- return {
2545
- name: "Claude strict-mcp-config",
2546
- category: "providers",
2547
- status: "info",
2548
- message: "Claude CLI not installed; skipping strict-mcp-config check"
2549
- };
2550
- }
2551
- if (!hasStrictMcpConfigBeenProbed()) {
2552
- const { wrapWithSandbox } = await import("./sandbox-ELRY4M2J.js");
2553
- const { metadata } = await import("./metadata-5PME4NKN.js");
2554
- const sandboxed = wrapWithSandbox({
2555
- workingDir: process.cwd(),
2556
- command,
2557
- args: [...prefixArgs, "--help"],
2558
- providerName: metadata.name,
2559
- env: process.env
2560
- });
2561
- await probeStrictMcpConfig(
2562
- sandboxed?.command ?? command,
2563
- sandboxed?.args ?? [...prefixArgs, "--help"]
2564
- );
2565
- }
2566
- if (!hasStrictMcpConfigBeenProbed()) {
2567
- return {
2568
- name: "Claude strict-mcp-config",
2569
- category: "providers",
2570
- status: "info",
2571
- message: "Claude CLI --strict-mcp-config support not determined; probe did not complete",
2572
- details: "The claude --help probe timed out or failed to start; re-run doctor to retry."
2573
- };
2574
- }
2575
- const supported = isStrictMcpConfigSupported();
2576
- if (supported) {
2577
- return {
2578
- name: "Claude strict-mcp-config",
2579
- category: "providers",
2580
- status: "pass",
2581
- message: "Claude CLI supports --strict-mcp-config; judge MCP isolation active"
2582
- };
2583
- }
2584
- return {
2585
- name: "Claude strict-mcp-config",
2586
- category: "providers",
2587
- status: "warn",
2588
- message: "Claude CLI does not support --strict-mcp-config; judge MCP isolation unavailable",
2589
- details: "Judge runs may inherit project MCP servers, reducing determinism. Upgrade the Claude CLI to enable strict MCP isolation."
2590
- };
2591
- }
2592
- async function checkLegacyClaudePlugin() {
2593
- const { checkClaudeCode } = await import("./setup-claude-code-NF4ZSHVE.js");
2594
- const { resolveBuildRoot } = await import("./build-root-7KNOWDTS.js");
2595
- const result = await checkClaudeCode(resolveBuildRoot(), { scope: "user" });
2596
- const cleanupCommand = "build provider disconnect claude";
2597
- if (!result.hasLegacyResidue && result.pluginState.hasClaudeCli && !result.pluginState.listAvailable) {
2598
- return {
2599
- name: "Legacy Claude plugin",
2600
- category: "providers",
2601
- status: "info",
2602
- message: "legacy plugin residue could not be checked",
2603
- details: `Claude plugin enumeration was unavailable. Optional cleanup: ${cleanupCommand}. Does not affect native Claude CLI provider readiness.`
2604
- };
2605
- }
2606
- if (!result.hasLegacyResidue) {
2607
- return {
2608
- name: "Legacy Claude plugin",
2609
- category: "providers",
2610
- status: "pass",
2611
- message: "no legacy Build Claude Code plugin residue"
2612
- };
2613
- }
2614
- return {
2615
- name: "Legacy Claude plugin",
2616
- category: "providers",
2617
- status: "info",
2618
- message: `legacy residue present (plugin ids: ${result.pluginState.installedIds.join(", ")})`,
2619
- details: `Optional cleanup: ${cleanupCommand}. Does not affect native Claude CLI provider readiness.`
2620
- };
2621
- }
2622
- async function checkLegacyRepoLocalTelemetry(buildDir) {
2623
- const { hasLegacyRepoLocalTelemetryPaths } = await import("./data-migration-state-IWTL2S75.js");
2624
- const legacy = hasLegacyRepoLocalTelemetryPaths(buildDir);
2625
- const present = [legacy.db, legacy.invocations, legacy.synthesis].filter(
2626
- (entry) => entry !== null
2627
- );
2628
- if (present.length === 0) {
2629
- return null;
2630
- }
2631
- const parts = [];
2632
- for (const legacyDb of [legacy.db, legacy.invocations]) {
2633
- if (!legacyDb) continue;
2634
- parts.push(
2635
- `${legacyDb} is leftover checkout SQLite; the live databases are under the data root. Run "build data migrate execute" to merge those databases. Do not delete the checkout copy until migration has finished.`
2636
- );
2637
- }
2638
- if (legacy.synthesis) {
2639
- parts.push(
2640
- `${legacy.synthesis} is leftover checkout synthesis; live artifacts write under the resolved telemetry directory (printed by \`build doctor --verbose\`). \`build data migrate execute\` does not move synthesis records. Do not delete this path.`
2641
- );
2642
- }
2643
- return {
2644
- name: "Legacy repo-local telemetry",
2645
- category: "build",
2646
- status: "info",
2647
- message: "Legacy repo-local telemetry present",
2648
- details: parts.join(" ")
2649
- };
2650
- }
2651
- async function checkDatabases(cwd) {
2652
- const buildDir = path3.join(cwd, ".build-project");
2653
- const dbDir = TelemetryPathResolver.getInstance().resolveDbDir(buildDir);
2654
- const variantsDbPath = path3.join(dbDir, "variants.db");
2655
- const validationsDbPath = path3.join(dbDir, "validations.db");
2656
- const checks = [];
2657
- const legacyCheck = await checkLegacyRepoLocalTelemetry(buildDir);
2658
- if (legacyCheck) {
2659
- checks.push(legacyCheck);
2660
- }
2661
- let variantsDbExists = false;
2662
- try {
2663
- await fs3.stat(variantsDbPath);
2664
- variantsDbExists = true;
2665
- } catch {
2666
- }
2667
- if (!variantsDbExists) {
2668
- checks.push({
2669
- name: "variants.db",
2670
- category: "build",
2671
- status: "info",
2672
- message: "Not initialized yet",
2673
- details: 'Telemetry database is created automatically on first execution. Run "build init --db" to pre-create, or "build doctor --fix" to initialize now.',
2674
- fixable: true
2675
- });
2676
- } else {
2677
- try {
2678
- const SqliteDB = await getBetterSqlite3();
2679
- const db = new SqliteDB(variantsDbPath, { readonly: true });
2680
- try {
2681
- const result = db.prepare("SELECT 1 as test").get();
2682
- if (result?.test !== 1) {
2683
- checks.push({
2684
- name: "variants.db",
2685
- category: "build",
2686
- status: "fail",
2687
- message: "Database query failed",
2688
- details: variantsDbPath,
2689
- fixable: true
2690
- });
2691
- db.close();
2692
- return checks;
2693
- }
2694
- const integrityResult = db.prepare("PRAGMA quick_check").get();
2695
- if (integrityResult?.quick_check !== "ok") {
2696
- checks.push({
2697
- name: "variants.db",
2698
- category: "build",
2699
- status: "fail",
2700
- message: "Database integrity check failed",
2701
- details: `${variantsDbPath} - Run "build doctor --fix"; if corruption remains, follow the database quarantine procedure in docs/TROUBLESHOOTING.md`,
2702
- fixable: true
2703
- });
2704
- db.close();
2705
- return checks;
2706
- }
2707
- const schemaVersion = checkSchemaVersion(db);
2708
- if (schemaVersion !== SCHEMA_VERSION) {
2709
- checks.push({
2710
- name: "variants.db",
2711
- category: "build",
2712
- status: "warn",
2713
- message: `Schema version mismatch (expected ${SCHEMA_VERSION}, found ${schemaVersion})`,
2714
- details: variantsDbPath,
2715
- fixable: true
2716
- });
2717
- } else {
2718
- checks.push({
2719
- name: "variants.db",
2720
- category: "build",
2721
- status: "pass",
2722
- message: `Healthy (schema v${schemaVersion})`,
2723
- details: variantsDbPath
2724
- });
2725
- }
2726
- db.close();
2727
- } catch (error) {
2728
- db.close();
2729
- checks.push({
2730
- name: "variants.db",
2731
- category: "build",
2732
- status: "fail",
2733
- message: "Database error",
2734
- details: error instanceof Error ? error.message : String(error),
2735
- fixable: true
2736
- });
2737
- }
2738
- } catch (error) {
2739
- const likelyNativeMismatch = isLikelyBetterSqlite3NativeLoadMismatch(error);
2740
- checks.push({
2741
- name: "variants.db",
2742
- category: "build",
2743
- status: "fail",
2744
- message: likelyNativeMismatch ? "better-sqlite3 native module load mismatch" : "Database could not be opened",
2745
- details: formatDatabaseNativeErrorDetails(error),
2746
- fixable: true
2747
- });
2748
- }
2749
- }
2750
- let validationsDbExists = false;
2751
- try {
2752
- await fs3.stat(validationsDbPath);
2753
- validationsDbExists = true;
2754
- } catch {
2755
- }
2756
- if (!validationsDbExists) {
2757
- checks.push({
2758
- name: "validations.db",
2759
- category: "build",
2760
- status: "info",
2761
- message: "Not present (optional)"
2762
- });
2763
- } else {
2764
- try {
2765
- const SqliteDB = await getBetterSqlite3();
2766
- const db = new SqliteDB(validationsDbPath, { readonly: true });
2767
- try {
2768
- const result = db.prepare("SELECT 1 as test").get();
2769
- if (result?.test === 1) {
2770
- checks.push({
2771
- name: "validations.db",
2772
- category: "build",
2773
- status: "pass",
2774
- message: "Accessible",
2775
- details: validationsDbPath
2776
- });
2777
- }
2778
- db.close();
2779
- } catch (error) {
2780
- db.close();
2781
- checks.push({
2782
- name: "validations.db",
2783
- category: "build",
2784
- status: "warn",
2785
- message: "Database error",
2786
- details: error instanceof Error ? error.message : String(error)
2787
- });
2788
- }
2789
- } catch (error) {
2790
- const likelyNativeMismatch = isLikelyBetterSqlite3NativeLoadMismatch(error);
2791
- checks.push({
2792
- name: "validations.db",
2793
- category: "build",
2794
- status: "warn",
2795
- message: likelyNativeMismatch ? "better-sqlite3 native module load mismatch" : "Database could not be opened",
2796
- details: formatDatabaseNativeErrorDetails(error)
2797
- });
2798
- }
2799
- }
2800
- return checks;
2801
- }
2802
- async function checkStateMarker(cwd) {
2803
- const stateFile = path3.join(cwd, ".build-project", "state", "init.json");
2804
- try {
2805
- const content = await fs3.readFile(stateFile, "utf-8");
2806
- const state = JSON.parse(content);
2807
- const issues = [];
2808
- if (state.schemaVersion !== SCHEMA_VERSION) {
2809
- issues.push(`Schema v${state.schemaVersion} (expected v${SCHEMA_VERSION})`);
2810
- }
2811
- if (state.tier !== "runtime" && state.tier !== "full") {
2812
- issues.push(`Invalid tier: ${state.tier}`);
2813
- }
2814
- if (issues.length > 0) {
2815
- return {
2816
- name: "State Marker",
2817
- category: "build",
2818
- status: "warn",
2819
- message: "State file has issues",
2820
- details: issues.join(", "),
2821
- fixable: true
2822
- };
2823
- }
2824
- return {
2825
- name: "State Marker",
2826
- category: "build",
2827
- status: "pass",
2828
- message: `Initialized (v${state.version}, tier: ${state.tier})`,
2829
- details: state.lastCheckedAt ? `Last checked: ${new Date(state.lastCheckedAt).toLocaleString()}` : "Last checked: unknown"
2830
- };
2831
- } catch (error) {
2832
- if (error.code === "ENOENT") {
2833
- return {
2834
- name: "State Marker",
2835
- category: "build",
2836
- status: "warn",
2837
- message: "State file not found",
2838
- details: 'Run "build doctor --fix" to initialize',
2839
- fixable: true
2840
- };
2841
- }
2842
- return {
2843
- name: "State Marker",
2844
- category: "build",
2845
- status: "warn",
2846
- message: "Cannot read state file",
2847
- details: error instanceof Error ? error.message : String(error),
2848
- fixable: true
2849
- };
2850
- }
2851
- }
2852
- async function checkTelemetryMode(repoRoot) {
2853
- const buildDir = getRuntimeEnv("BUILD_TELEMETRY_DIR") ?? path3.join(repoRoot, ".build-project");
2854
- const dbDir = TelemetryPathResolver.getInstance().resolveDbDir(buildDir);
2855
- const variantsDbPath = path3.join(dbDir, "variants.db");
2856
- try {
2857
- await fs3.stat(variantsDbPath);
2858
- const SqliteDB = await getBetterSqlite3();
2859
- const db = new SqliteDB(variantsDbPath, { readonly: true });
2860
- try {
2861
- db.prepare("SELECT 1").get();
2862
- db.close();
2863
- return {
2864
- name: "Telemetry Mode",
2865
- category: "build",
2866
- status: "pass",
2867
- message: "Database mode (full features)",
2868
- details: variantsDbPath
2869
- };
2870
- } catch (_error) {
2871
- db.close();
2872
- return {
2873
- name: "Telemetry Mode",
2874
- category: "build",
2875
- status: "warn",
2876
- message: "Degraded mode (JSONL-only)",
2877
- details: variantsDbPath
2878
- };
2879
- }
2880
- } catch (_error) {
2881
- return {
2882
- name: "Telemetry Mode",
2883
- category: "build",
2884
- status: "warn",
2885
- message: "Degraded mode (JSONL-only)",
2886
- details: variantsDbPath
2887
- };
2888
- }
2889
- }
2890
- async function resolveBuildPackageRoot() {
2891
- let current = path3.dirname(fileURLToPath(import.meta.url));
2892
- while (true) {
2893
- try {
2894
- const packageJsonPath = path3.join(current, "package.json");
2895
- const packageJson = JSON.parse(await fs3.readFile(packageJsonPath, "utf8"));
2896
- if (packageJson.name === "@ebrindley/build") {
2897
- return current;
2898
- }
2899
- } catch {
2900
- }
2901
- const parent = path3.dirname(current);
2902
- if (parent === current) {
2903
- return process.cwd();
2904
- }
2905
- current = parent;
2906
- }
2907
- }
2908
- async function checkDistArtifacts() {
2909
- try {
2910
- const { checkBuildFreshness } = await import("./flywheel-preflight-2NDK23MK.js");
2911
- const result = await checkBuildFreshness(await resolveBuildPackageRoot());
2912
- if (result.passed) {
2913
- return {
2914
- name: "Build Artifacts",
2915
- category: "build",
2916
- status: "pass",
2917
- message: result.metadata?.packageMode ? "packaged dist artifacts are present" : "dist/entry.js is present and fresh",
2918
- details: result.warning
2919
- };
2920
- }
2921
- return {
2922
- name: "Build Artifacts",
2923
- category: "build",
2924
- status: "warn",
2925
- message: "Build artifacts need refresh",
2926
- details: result.error ? `${result.error} This is expected after source changes in a development checkout. Most source tests do not require fresh dist output; run npm run build when testing the bundled build binary against the latest source.` : "Most source tests do not require fresh dist output; run npm run build when testing the bundled build binary against the latest source."
2927
- };
2928
- } catch (error) {
2929
- return {
2930
- name: "Build Artifacts",
2931
- category: "build",
2932
- status: "warn",
2933
- message: "Could not verify dist artifacts",
2934
- details: error instanceof Error ? error.message : String(error)
2935
- };
2936
- }
2937
- }
2938
- async function calculateDirectorySize(dirPath) {
2939
- let totalSize = 0;
2940
- const entries = await fs3.readdir(dirPath, { withFileTypes: true });
2941
- for (const entry of entries) {
2942
- const entryPath = path3.join(dirPath, entry.name);
2943
- if (entry.isDirectory()) {
2944
- totalSize += await calculateDirectorySize(entryPath);
2945
- } else if (entry.isFile()) {
2946
- const stat2 = await fs3.stat(entryPath);
2947
- totalSize += stat2.size;
2948
- }
2949
- }
2950
- return totalSize;
2951
- }
2952
- var FOREIGN_COORDINATION_LOCK_REMEDIATION = "Local process liveness cannot be verified for foreign locks. Verify the owning machine is not running Build against this repo, then delete the lock file:";
2953
- var UNREADABLE_COORDINATION_LOCK_REMEDIATION = "Build cannot safely verify unreadable coordination locks. Verify no Build process owns the lock, then delete the lock file:";
2954
- function formatCoordinationLockAge(ageMs) {
2955
- const ageSec = Math.round(ageMs / 1e3);
2956
- if (ageSec < 60) {
2957
- return `${ageSec}s`;
2958
- }
2959
- const ageMin = Math.round(ageSec / 60);
2960
- if (ageMin < 60) {
2961
- return `${ageMin}m`;
2962
- }
2963
- const ageHours = Math.round(ageMin / 60);
2964
- return `${ageHours}h`;
2965
- }
2966
- function formatCoordinationLockLine(diagnostic) {
2967
- const machinePart = diagnostic.machineIdShort ?? "unknown";
2968
- const pidPart = diagnostic.pid ?? "n/a";
2969
- const agePart = formatCoordinationLockAge(diagnostic.ageMs);
2970
- return `${diagnostic.name}: ${diagnostic.classification} (pid=${pidPart}, machine=${machinePart}, age=${agePart})`;
2971
- }
2972
- function isForeignStaleCoordinationLock(diagnostic, staleMs) {
2973
- if (diagnostic.classification !== "foreign-machine") {
2974
- return false;
2975
- }
2976
- return diagnostic.ageMs >= staleMs;
2977
- }
2978
- async function checkCoordinationLocks() {
2979
- const { DEFAULT_STALE_LOCK_MS, diagnoseCoordinationLocks } = await import("./backend-CAFCYODQ.js");
2980
- const cwd = process.cwd();
2981
- const locksDir = path3.join(cwd, ".build-project", "planning", "coordination", "locks");
2982
- const diagnostics = diagnoseCoordinationLocks(locksDir);
2983
- if (diagnostics.length === 0) {
2984
- return null;
2985
- }
2986
- const foreignStaleLocks = diagnostics.filter(
2987
- (diagnostic) => isForeignStaleCoordinationLock(diagnostic, DEFAULT_STALE_LOCK_MS)
2988
- );
2989
- const unreadableLocks = diagnostics.filter((d) => d.classification === "unreadable");
2990
- const liveCount = diagnostics.filter((d) => d.classification === "live").length;
2991
- const staleSameMachineCount = diagnostics.filter(
2992
- (d) => d.classification === "stale-same-machine"
2993
- ).length;
2994
- const foreignCount = diagnostics.filter((d) => d.classification === "foreign-machine").length;
2995
- const detailLines = diagnostics.map(formatCoordinationLockLine);
2996
- const remediationLines = foreignStaleLocks.map(
2997
- (diagnostic) => `${FOREIGN_COORDINATION_LOCK_REMEDIATION} ${diagnostic.lockPath}`
2998
- );
2999
- remediationLines.push(
3000
- ...unreadableLocks.map(
3001
- (diagnostic) => `${UNREADABLE_COORDINATION_LOCK_REMEDIATION} ${diagnostic.lockPath}`
3002
- )
3003
- );
3004
- const manualRemediationCount = foreignStaleLocks.length + unreadableLocks.length;
3005
- let status = "pass";
3006
- if (foreignStaleLocks.length > 0 || unreadableLocks.length > 0) {
3007
- status = "warn";
3008
- } else if (staleSameMachineCount > 0) {
3009
- status = "info";
3010
- }
3011
- const messageParts = [`${diagnostics.length} coordination lock(s)`];
3012
- if (liveCount > 0) {
3013
- messageParts.push(`${liveCount} live`);
3014
- }
3015
- if (staleSameMachineCount > 0) {
3016
- messageParts.push(`${staleSameMachineCount} stale-same-machine`);
3017
- }
3018
- if (foreignCount > 0) {
3019
- messageParts.push(`${foreignCount} foreign-machine`);
3020
- }
3021
- if (unreadableLocks.length > 0) {
3022
- messageParts.push(`${unreadableLocks.length} unreadable`);
3023
- }
3024
- if (manualRemediationCount > 0) {
3025
- messageParts.push(`${manualRemediationCount} require manual remediation`);
3026
- }
3027
- const detailsParts = [...detailLines];
3028
- if (remediationLines.length > 0) {
3029
- detailsParts.push("", ...remediationLines);
3030
- }
3031
- return {
3032
- name: "Coordination Locks",
3033
- category: "build",
3034
- status,
3035
- message: messageParts.join("; "),
3036
- details: detailsParts.join("\n ")
3037
- };
3038
- }
3039
- async function checkDiskSpace(repoRoot) {
3040
- const buildDir = getRuntimeEnv("BUILD_TELEMETRY_DIR") ?? path3.join(repoRoot, ".build-project");
3041
- const telemetryDir = TelemetryPathResolver.getInstance().resolveTelemetryDir(buildDir);
3042
- try {
3043
- try {
3044
- await fs3.stat(telemetryDir);
3045
- } catch (_error) {
3046
- return {
3047
- name: "Telemetry Storage",
3048
- category: "resources",
3049
- status: "info",
3050
- message: "Telemetry directory not found",
3051
- details: 'Run "build init" to initialize'
3052
- };
3053
- }
3054
- const totalSize = await calculateDirectorySize(telemetryDir);
3055
- const sizeMB = totalSize / (1024 * 1024);
3056
- const sizeGB = sizeMB / 1024;
3057
- if (sizeGB > 2) {
3058
- return {
3059
- name: "Telemetry Storage",
3060
- category: "resources",
3061
- status: "fail",
3062
- message: `Telemetry directory very large: ${sizeGB.toFixed(2)} GB`,
3063
- details: 'Consider running "build cleanup" to remove old data'
3064
- };
3065
- }
3066
- if (sizeMB > 500) {
3067
- return {
3068
- name: "Telemetry Storage",
3069
- category: "resources",
3070
- status: "warn",
3071
- message: `Telemetry directory: ${sizeMB.toFixed(1)} MB`,
3072
- details: "Consider periodic cleanup"
3073
- };
3074
- }
3075
- return {
3076
- name: "Telemetry Storage",
3077
- category: "resources",
3078
- status: "pass",
3079
- message: `Telemetry directory: ${sizeMB.toFixed(1)} MB`,
3080
- details: telemetryDir
3081
- };
3082
- } catch (error) {
3083
- return {
3084
- name: "Telemetry Storage",
3085
- category: "resources",
3086
- status: "fail",
3087
- message: "Cannot measure telemetry directory size",
3088
- details: error instanceof Error ? error.message : String(error)
3089
- };
3090
- }
3091
- }
3092
- async function checkMemory() {
3093
- try {
3094
- const totalGB = os.totalmem() / (1024 * 1024 * 1024);
3095
- const freeGB = getAvailableMemoryGB();
3096
- const usedPercent = Math.max(0, (totalGB - freeGB) / totalGB * 100);
3097
- if (freeGB < 0.5) {
3098
- return {
3099
- name: "Memory",
3100
- category: "resources",
3101
- status: "fail",
3102
- message: `Critical: only ${freeGB.toFixed(2)} GB available`,
3103
- details: `${usedPercent.toFixed(1)}% used of ${totalGB.toFixed(1)} GB total`
3104
- };
3105
- }
3106
- if (freeGB < 1) {
3107
- return {
3108
- name: "Memory",
3109
- category: "resources",
3110
- status: "warn",
3111
- message: `Low memory: ${freeGB.toFixed(2)} GB available`,
3112
- details: `${usedPercent.toFixed(1)}% used of ${totalGB.toFixed(1)} GB total`
3113
- };
3114
- }
3115
- return {
3116
- name: "Memory",
3117
- category: "resources",
3118
- status: "pass",
3119
- message: `${freeGB.toFixed(2)} GB available of ${totalGB.toFixed(1)} GB`,
3120
- details: `${usedPercent.toFixed(1)}% used`
3121
- };
3122
- } catch (error) {
3123
- return {
3124
- name: "Memory",
3125
- category: "resources",
3126
- status: "fail",
3127
- message: "Cannot check system memory",
3128
- details: error instanceof Error ? error.message : String(error)
3129
- };
3130
- }
3131
- }
3132
- async function checkNodeVersion() {
3133
- const currentVersion = process.version;
3134
- const preferredPath = await preferredNode24Path();
3135
- if (!isSupportedNodeMajor(parseNodeMajor(currentVersion))) {
3136
- return {
3137
- name: "Node.js",
3138
- category: "system",
3139
- status: "fail",
3140
- message: `Node.js ${currentVersion} is not supported`,
3141
- details: formatNode24Remediation(preferredPath)
3142
- };
3143
- }
3144
- const homebrewDetail = preferredPath ? ` | Homebrew Node 24: ${preferredPath}` : "";
3145
- return {
3146
- name: "Node.js",
3147
- category: "system",
3148
- status: "pass",
3149
- message: `Node.js ${currentVersion}`,
3150
- details: `${process.platform}/${process.arch} \u2014 ${process.execPath}${homebrewDetail}`
3151
- };
3152
- }
3153
- async function checkGitRepository() {
3154
- try {
3155
- const result = await execa("git", ["rev-parse", "--is-inside-work-tree"]);
3156
- if (result.stdout.trim() === "true") {
3157
- let branchName = "unknown";
3158
- let unbornBranch;
3159
- const branch = await execa("git", ["rev-parse", "--symbolic-full-name", "HEAD"], {
3160
- reject: false
3161
- });
3162
- const parsedBranch = branch.exitCode === 0 ? parseCurrentBranchRef(branch.stdout) : "HEAD";
3163
- if (parsedBranch !== "HEAD") {
3164
- branchName = parsedBranch;
3165
- } else {
3166
- unbornBranch = await detectUnbornBranch(process.cwd());
3167
- if (unbornBranch) {
3168
- branchName = unbornBranch;
3169
- } else {
3170
- const symbolicBranch = await execa("git", ["symbolic-ref", "--short", "HEAD"], {
3171
- reject: false
3172
- });
3173
- if (symbolicBranch.exitCode === 0 && symbolicBranch.stdout.trim()) {
3174
- branchName = symbolicBranch.stdout.trim();
3175
- }
3176
- }
3177
- }
3178
- const unbornNote = unbornBranch ? "; repository has no commits yet" : "";
3179
- let details;
3180
- try {
3181
- const remoteResult = await execa("git", ["remote", "get-url", "origin"], { reject: false });
3182
- const remoteUrl = remoteResult.stdout.trim();
3183
- details = remoteUrl ? `branch: ${branchName}, remote: ${remoteUrl}` : `branch: ${branchName}, no remote`;
3184
- } catch (_remoteError) {
3185
- details = `branch: ${branchName}, no remote`;
3186
- }
3187
- try {
3188
- const missing = [];
3189
- for (const key of ["user.name", "user.email"]) {
3190
- const identity = await execGit(["config", "--get", key], { cwd: process.cwd() });
3191
- if (identity.exitCode !== 0 || !identity.stdout.trim()) missing.push(key);
3192
- }
3193
- if (missing.length > 0) {
3194
- return {
3195
- name: "Git Repository",
3196
- category: "git",
3197
- status: "warn",
3198
- message: `Inside git repository (branch: ${branchName})${unbornNote}; commit identity is incomplete`,
3199
- details: `${details}. Set ${missing.map((key) => `git config ${key} "${key === "user.name" ? "Your Name" : "you@example.com"}"`).join(" and ")} (or use --global for your usual identity).`
3200
- };
3201
- }
3202
- } catch {
3203
- return {
3204
- name: "Git Repository",
3205
- category: "git",
3206
- status: "warn",
3207
- message: `Inside git repository (branch: ${branchName})${unbornNote}; commit identity could not be checked`,
3208
- details
3209
- };
3210
- }
3211
- if (unbornBranch) {
3212
- return {
3213
- name: "Git Repository",
3214
- category: "git",
3215
- status: "warn",
3216
- message: `Inside git repository (branch: ${branchName})${unbornNote}`,
3217
- details: `${details}. HEAD does not resolve to a commit yet; the first commit will create ${branchName}.`
3218
- };
3219
- }
3220
- return {
3221
- name: "Git Repository",
3222
- category: "git",
3223
- status: "pass",
3224
- message: `Inside git repository (branch: ${branchName})`,
3225
- details
3226
- };
3227
- }
3228
- return {
3229
- name: "Git Repository",
3230
- category: "git",
3231
- status: "warn",
3232
- message: "Not inside a git repository",
3233
- details: "Some features may not work correctly"
3234
- };
3235
- } catch (_error) {
3236
- return {
3237
- name: "Git Repository",
3238
- category: "git",
3239
- status: "warn",
3240
- message: "Not inside a git repository",
3241
- details: "Some features may not work correctly"
3242
- };
3243
- }
3244
- }
3245
- var DOCTOR_LINK_CHECK_TIMEOUT_MS = 5e3;
3246
- async function checkKnowledgeKit(cwd, options = {}) {
3247
- const checkLinks = options.checkLinks === true;
3248
- try {
3249
- const result = await knowledgeDoctorChecks(cwd, {
3250
- checkLinks,
3251
- linkTimeoutMs: DOCTOR_LINK_CHECK_TIMEOUT_MS,
3252
- ...options.probeLink ? { probeLink: options.probeLink } : {}
3253
- });
3254
- if (!result.manifestPresent) {
3255
- const intent = readIntentContract(cwd);
3256
- if (intent.status === "ok" && intent.contract.status !== "retired") {
3257
- const resolved = resolveIntent(detectStack(cwd), intent.contract).contract;
3258
- const lines = resolved.dimensions.map((d) => describeDimension(d));
3259
- const hasConflict = resolved.status === "conflict";
3260
- return {
3261
- name: "Knowledge Kit",
3262
- category: "knowledge",
3263
- status: "warn",
3264
- message: hasConflict ? `No stack resources accepted; stack intent "${intent.contract.spec}" has unresolved conflicts \u2014 run build init knowledge offer (headless) or build init in a terminal to receive them` : `No stack resources accepted yet (stack intent "${intent.contract.spec}" pending) \u2014 run build init knowledge offer (headless) or build init in a terminal to receive them`,
3265
- details: `Declared ${intent.contract.declaredAt.slice(0, 10)}${intent.contract.rationale ? ` \u2014 ${intent.contract.rationale}` : ""}
3266
- ${lines.join("\n ")}
3267
- Run 'build init knowledge offer' (headless) or 'build init' in a terminal to review recommendations${hasConflict ? " and resolve the conflict" : ""}.`
3268
- };
3269
- }
3270
- return {
3271
- name: "Knowledge Kit",
3272
- category: "knowledge",
3273
- status: "info",
3274
- message: isStackUndetectedAndUndeclared(cwd) ? `No stack resources accepted yet; no stack detected. If the intended stack is decided, declare it: ${DECLARE_STACK_COMMAND}` : "No stack resources accepted yet",
3275
- details: "Run 'build init' in an interactive session to review stack recommendations."
3276
- };
3277
- }
3278
- if (result.findings.length === 0) {
3279
- return {
3280
- name: "Knowledge Kit",
3281
- category: "knowledge",
3282
- status: "pass",
3283
- message: checkLinks ? "Knowledge manifest present; no issues found (links checked)" : "Knowledge manifest present; no issues found"
3284
- };
3285
- }
3286
- const severityToStatus = (severity) => severity === "error" ? "fail" : severity === "warn" ? "warn" : "info";
3287
- const worst = result.findings.some((f) => f.severity === "error") ? "fail" : result.findings.some((f) => f.severity === "warn") ? "warn" : "info";
3288
- const details = result.findings.map((finding) => `[${severityToStatus(finding.severity)}] ${finding.message}`).join("\n ");
3289
- return {
3290
- name: "Knowledge Kit",
3291
- category: "knowledge",
3292
- status: worst,
3293
- message: `${result.findings.length} knowledge finding(s)`,
3294
- details
3295
- };
3296
- } catch (error) {
3297
- return {
3298
- name: "Knowledge Kit",
3299
- category: "knowledge",
3300
- status: "warn",
3301
- message: "Could not run knowledge checks",
3302
- details: error instanceof Error ? error.message : String(error)
3303
- };
3304
- }
3305
- }
3306
- async function runAllHealthChecks(options) {
3307
- const allChecks = [];
3308
- if (options.providersOnly) {
3309
- const includeVerboseProviderDetails2 = Boolean(options.verbose) && !options.json;
3310
- allChecks.push(
3311
- await checkProviderCLIs({
3312
- includeVerboseDetails: includeVerboseProviderDetails2,
3313
- all: options.all,
3314
- provider: options.provider,
3315
- probe: options.probe,
3316
- strict: options.strict,
3317
- requireReady: options.requireReady
3318
- })
3319
- );
3320
- allChecks.push(...await collectProviderExtraHealthChecks(options));
3321
- return allChecks;
3322
- }
3323
- allChecks.push(await checkNodeVersion());
3324
- allChecks.push(await checkMemory());
3325
- allChecks.push(await checkGit());
3326
- allChecks.push(await checkGitRepository());
3327
- const includeVerboseProviderDetails = Boolean(options.verbose) && !options.json;
3328
- allChecks.push(
3329
- await checkProviderCLIs({
3330
- includeVerboseDetails: includeVerboseProviderDetails,
3331
- all: options.all,
3332
- provider: options.provider,
3333
- probe: options.probe,
3334
- strict: options.strict,
3335
- requireReady: options.requireReady
3336
- })
3337
- );
3338
- allChecks.push(...await collectProviderExtraHealthChecks(options));
3339
- allChecks.push(await checkVerificationPrivilegeBoundary());
3340
- allChecks.push(await checkLinuxWriteBoundary());
3341
- const repoRoot = resolveRepoRootForBuildDir(process.cwd());
3342
- allChecks.push(await checkBuildDirectory(repoRoot));
3343
- const nestedCheck = await checkNestedBuildDirectory(repoRoot);
3344
- if (nestedCheck) allChecks.push(nestedCheck);
3345
- allChecks.push(await checkRequiredDirectories(repoRoot));
3346
- allChecks.push(await checkRepoTaskTypes(repoRoot));
3347
- allChecks.push(await checkArchiveReconciliation());
3348
- allChecks.push(await checkProviderConfig(repoRoot));
3349
- const executionRolesCheck = await checkExecutionRoles();
3350
- if (executionRolesCheck) allChecks.push(executionRolesCheck);
3351
- allChecks.push(await checkSteeringInstructions());
3352
- allChecks.push((await import("./doctor-instructions-import-FY5RLABK.js")).checkInstructionsImport());
3353
- allChecks.push(await checkNativeSqlite());
3354
- allChecks.push(...await checkDatabases(repoRoot));
3355
- allChecks.push(await checkStateMarker(repoRoot));
3356
- allChecks.push(await checkTelemetryMode(repoRoot));
3357
- allChecks.push(await checkDistArtifacts());
3358
- const coordinationLockCheck = await checkCoordinationLocks();
3359
- if (coordinationLockCheck) allChecks.push(coordinationLockCheck);
3360
- const knowledgeCwd = repoRoot;
3361
- allChecks.push(await checkKnowledgeKit(knowledgeCwd, { checkLinks: options.checkLinks }));
3362
- allChecks.push(checkPendingInitNotices(knowledgeCwd));
3363
- allChecks.push(checkPendingOfferNotice(knowledgeCwd));
3364
- const purposeCheck = (await import("./doctor-purpose-UY3UANLP.js")).checkPurposeSuggestion(knowledgeCwd);
3365
- if (purposeCheck) allChecks.push(purposeCheck);
3366
- allChecks.push(...(await import("./doctor-context-blocks-UO7SG3NU.js")).checkContextBlocks(knowledgeCwd));
3367
- allChecks.push(await checkCiIntegrationHealth(knowledgeCwd));
3368
- allChecks.push(...await checkGuardrails(knowledgeCwd));
3369
- const storageCheck = checkPlanningStorageBackend(repoRoot);
3370
- if (storageCheck) allChecks.push(storageCheck);
3371
- const branchNameCheck = await checkBuildBranchNameConflict(repoRoot);
3372
- if (branchNameCheck) allChecks.push(branchNameCheck);
3373
- allChecks.push(await checkDiskSpace(repoRoot));
3374
- allChecks.push(await checkConcurrencyBudget());
3375
- return allChecks;
3376
- }
3377
- async function checkConcurrencyBudget() {
3378
- try {
3379
- const budget = detectHostConcurrencyBudget();
3380
- const basis = `${budget.totalMemoryGB.toFixed(0)} GB RAM, ${budget.performanceCores} performance cores`;
3381
- const recommendation = `up to ${budget.legSlots} concurrent legs, ${budget.validationSlots} concurrent validations (${basis})`;
3382
- let effectiveValue;
3383
- try {
3384
- const merged = await new ConfigManager().loadConfig();
3385
- const asValidConcurrency = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
3386
- effectiveValue = asValidConcurrency(merged.config.variants?.maxConcurrent) ?? asValidConcurrency(merged.config.worktree?.maxConcurrent);
3387
- } catch {
3388
- }
3389
- if (effectiveValue !== void 0 && effectiveValue > budget.legSlots) {
3390
- return {
3391
- name: "Concurrency budget",
3392
- category: "resources",
3393
- status: "warn",
3394
- message: `Effective max concurrent (${effectiveValue}) exceeds this host's recommendation`,
3395
- details: `This host recommends ${recommendation}. The configured value still runs as asked; validation pacing covers only repair-loop gates and baseline capture, and memory pressure shedding runs only in health-assisted mode and the flywheel.`
3396
- };
3397
- }
3398
- return {
3399
- name: "Concurrency budget",
3400
- category: "resources",
3401
- status: "info",
3402
- message: `Recommended: ${recommendation}`,
3403
- details: `Effective max concurrent (config or default): ${effectiveValue ?? 4}. Recommendations are advisory; Build runs what you ask for.`
3404
- };
3405
- } catch (error) {
3406
- return {
3407
- name: "Concurrency budget",
3408
- category: "resources",
3409
- status: "info",
3410
- message: "Could not compute a host concurrency recommendation",
3411
- details: error instanceof Error ? error.message : String(error)
3412
- };
3413
- }
3414
- }
3415
- function displayHealthResults(checks, options) {
3416
- if (options.json) {
3417
- console.log(JSON.stringify(checks, null, 2));
3418
- return;
3419
- }
3420
- console.log(chalk2.bold.cyan("\nBuild Health Check\n"));
3421
- const categories = {
3422
- system: [],
3423
- git: [],
3424
- providers: [],
3425
- build: [],
3426
- knowledge: [],
3427
- guardrails: [],
3428
- resources: []
3429
- };
3430
- for (const check of checks) {
3431
- categories[check.category]?.push(check);
3432
- }
3433
- const categoryNames = {
3434
- system: "System Environment",
3435
- git: "Git Configuration",
3436
- providers: "AI Providers",
3437
- build: "Build Installation",
3438
- knowledge: "Knowledge & Init Drift",
3439
- guardrails: "Guardrails",
3440
- resources: "System Resources"
3441
- };
3442
- for (const [category, categoryChecks] of Object.entries(categories)) {
3443
- if (categoryChecks.length === 0) continue;
3444
- console.log(chalk2.bold(categoryNames[category]));
3445
- for (const check of categoryChecks) {
3446
- let statusIcon = "";
3447
- let statusColor;
3448
- switch (check.status) {
3449
- case "pass":
3450
- statusIcon = "OK";
3451
- statusColor = chalk2.green;
3452
- break;
3453
- case "warn":
3454
- statusIcon = "Warning: ";
3455
- statusColor = chalk2.yellow;
3456
- break;
3457
- case "fail":
3458
- statusIcon = "Error";
3459
- statusColor = chalk2.red;
3460
- break;
3461
- case "info":
3462
- statusIcon = "Info:";
3463
- statusColor = chalk2.blue;
3464
- break;
3465
- }
3466
- const checkName = check.name.padEnd(25);
3467
- console.log(` ${statusColor(statusIcon)} ${chalk2.bold(checkName)} ${check.message}`);
3468
- if (options.verbose && check.details) {
3469
- console.log(chalk2.gray(` ${check.details}`));
3470
- }
3471
- }
3472
- console.log();
3473
- }
3474
- const passCount = checks.filter((c) => c.status === "pass").length;
3475
- const warnCount = checks.filter((c) => c.status === "warn").length;
3476
- const failCount = checks.filter((c) => c.status === "fail").length;
3477
- const infoCount = checks.filter((c) => c.status === "info").length;
3478
- const fixableCount = checks.filter((c) => c.fixable && c.status !== "pass").length;
3479
- console.log(chalk2.bold.cyan("Summary\n"));
3480
- console.log(` ${chalk2.green("Passed")}: ${passCount}`);
3481
- if (warnCount > 0) console.log(` ${chalk2.yellow("Warnings")}: ${warnCount}`);
3482
- if (failCount > 0) console.log(` ${chalk2.red("Failed")}: ${failCount}`);
3483
- if (infoCount > 0) console.log(` ${chalk2.blue("Info")}: ${infoCount}`);
3484
- console.log();
3485
- if (failCount > 0) {
3486
- console.log(chalk2.bold.red("Error: Checks Failed\n"));
3487
- console.log(chalk2.gray(" Some checks failed. Review the issues above."));
3488
- if (fixableCount > 0) {
3489
- console.log(chalk2.gray(` ${fixableCount} issue(s) can be fixed automatically.`));
3490
- console.log(chalk2.gray(" Run: build doctor --fix"));
3491
- }
3492
- } else if (warnCount > 0) {
3493
- console.log(chalk2.bold.yellow("Warning: Warnings Detected\n"));
3494
- console.log(chalk2.gray(" System is operational but some issues were found."));
3495
- if (fixableCount > 0) {
3496
- console.log(chalk2.gray(` ${fixableCount} issue(s) can be fixed automatically.`));
3497
- console.log(chalk2.gray(" Run: build doctor --fix"));
3498
- }
3499
- } else {
3500
- console.log(chalk2.bold.green("OK: All Systems Healthy\n"));
3501
- console.log(chalk2.gray(" Build is ready to use!"));
3502
- }
3503
- const unrepaired = options.fix ? describeUnrepairedChecks(checks) : void 0;
3504
- if (unrepaired) console.log(chalk2.gray(` ${unrepaired}`));
3505
- if (!options.verbose && (warnCount > 0 || failCount > 0)) {
3506
- console.log(chalk2.gray("\nTip: Run with --verbose flag for more details"));
3507
- }
3508
- console.log();
3509
- }
3510
- function createDoctorCommand() {
3511
- const health = new Command2("doctor");
3512
- health.description(
3513
- "Check system health and diagnose issues\n\nExamples:\n build doctor # Check configured providers only\n build doctor --all # Check all known providers\n build doctor --provider claude # Check specific provider\n build doctor --providers-only --provider claude # Check provider CLI and cached auth evidence\n build doctor --probe --provider claude # Probe provider auth and update cached evidence\n build doctor --verbose # Show detailed information\n build doctor --fix # Automatically repair issues\n build doctor --json # Output as JSON\n build doctor --matrix # Show provider support matrix"
3514
- );
3515
- health.aliases(["d"]);
3516
- health.addCommand(createDoctorMetricsCommand());
3517
- health.option("--json", "(OPTIONAL) Output results as JSON");
3518
- health.option("-v, --verbose", "(OPTIONAL) Show detailed information");
3519
- health.option("--fix", "(OPTIONAL) Attempt to repair issues automatically");
3520
- health.option("-a, --all", "(OPTIONAL) Check all known providers");
3521
- health.option("-p, --provider <id>", "(OPTIONAL) Check specific provider only");
3522
- health.option("--providers-only", "(OPTIONAL) Check provider CLI and cached auth evidence only");
3523
- health.option("--matrix", "(OPTIONAL) Show provider support matrix with tier and health status");
3524
- health.option(
3525
- "--strict",
3526
- "(OPTIONAL) Exit non-zero on identity failures (CLI missing, config invalid). Unobserved auth and zero ready providers do not fail"
3527
- );
3528
- health.option(
3529
- "--require-ready",
3530
- "(OPTIONAL) Exit non-zero when no checked provider can run (opt-in readiness gate)"
3531
- );
3532
- health.option("--probe", "(OPTIONAL) Run provider auth probes and update auth liveness cache");
3533
- health.option("--refresh", "(OPTIONAL) Clear cached auth liveness before checking");
3534
- health.option(
3535
- "--check-links",
3536
- "(OPTIONAL) Probe stack-resource source URLs for dead links (network; 5s/link; default off)"
3537
- );
3538
- health.action(async (options) => {
3539
- const validatedOptions = validateCommandOptions(HealthCommandOptionsSchema, options);
3540
- if (validatedOptions.refresh) {
3541
- await invalidateAuthOutcome(validatedOptions.provider);
3542
- }
3543
- if (validatedOptions.matrix) {
3544
- const { collectProviderMatrix } = await import("./provider-matrix-7FMEWDLS.js");
3545
- const { renderProviderMatrix } = await import("./provider-matrix-renderer-MEC3PER7.js");
3546
- const rows = await collectProviderMatrix({
3547
- probeAuth: true,
3548
- providerFilter: validatedOptions.provider
3549
- });
3550
- if (validatedOptions.json) {
3551
- const checks2 = await runAllHealthChecks(validatedOptions);
3552
- console.log(JSON.stringify({ checks: checks2, providerMatrix: rows }, null, 2));
3553
- exitForHealthFailures(checks2, validatedOptions);
3554
- return;
3555
- }
3556
- console.log(renderProviderMatrix(rows));
3557
- const skipNormalChecks = !validatedOptions.all && !validatedOptions.providersOnly && !validatedOptions.fix;
3558
- if (skipNormalChecks) {
3559
- if (rows.some((row) => row.status !== "available")) {
3560
- process.exit(1);
3561
- }
3562
- return;
3563
- }
3564
- }
3565
- if (validatedOptions.fix) {
3566
- const repairOutput = validatedOptions.json ? console.error : console.log;
3567
- repairOutput(chalk2.bold.cyan("\nRepairing Build Installation\n"));
3568
- const cwd = resolveRepoRootForBuildDir(process.cwd());
3569
- const nestedDir = path3.join(cwd, ".build-project", ".build-project");
3570
- try {
3571
- const stats = await fs3.stat(nestedDir);
3572
- if (stats.isDirectory()) {
3573
- repairOutput(
3574
- chalk2.gray("Removing nested .build-project/.build-project/ directory (bug artifact)...")
3575
- );
3576
- await fs3.rm(nestedDir, { recursive: true, force: true });
3577
- repairOutput(chalk2.green(" OK Removed nested directory"));
3578
- }
3579
- } catch (_error) {
3580
- }
3581
- try {
3582
- const result = await ensureBuildInitialized({
3583
- cwd,
3584
- tier: "runtime",
3585
- repair: true,
3586
- verbose: validatedOptions.verbose && !validatedOptions.json,
3587
- allowDegraded: true
3588
- });
3589
- if (result.status === "ok") {
3590
- repairOutput(chalk2.green("OK: Repair completed successfully"));
3591
- } else if (result.status === "degraded") {
3592
- repairOutput(chalk2.yellow("Warning: Repair completed with warnings (degraded mode)"));
3593
- } else {
3594
- repairOutput(chalk2.red("Error: Repair failed"));
3595
- }
3596
- if (result.actions.created.length > 0) {
3597
- repairOutput(chalk2.gray(`
3598
- Created ${result.actions.created.length} item(s):`));
3599
- for (const item of result.actions.created) {
3600
- repairOutput(chalk2.gray(` - ${item}`));
3601
- }
3602
- }
3603
- if (result.actions.repaired.length > 0) {
3604
- repairOutput(chalk2.gray(`
3605
- Repaired ${result.actions.repaired.length} item(s):`));
3606
- for (const item of result.actions.repaired) {
3607
- repairOutput(chalk2.gray(` - ${item}`));
3608
- }
3609
- }
3610
- if (result.warnings.length > 0) {
3611
- repairOutput(chalk2.yellow(`
3612
- Warnings (${result.warnings.length}):`));
3613
- for (const warning of result.warnings) {
3614
- repairOutput(chalk2.yellow(` Warning: ${warning}`));
3615
- }
3616
- }
3617
- if (result.errors.length > 0) {
3618
- repairOutput(chalk2.red(`
3619
- Errors (${result.errors.length}):`));
3620
- for (const error of result.errors) {
3621
- repairOutput(chalk2.red(` Error ${error.message}`));
3622
- if (error.path) {
3623
- repairOutput(chalk2.gray(` Path: ${error.path}`));
3624
- }
3625
- }
3626
- }
3627
- if (result.nextSteps.length > 0) {
3628
- repairOutput(chalk2.bold("\nNext Steps:"));
3629
- for (const step of result.nextSteps) {
3630
- repairOutput(chalk2.gray(` \u2022 ${step}`));
3631
- }
3632
- }
3633
- repairOutput(chalk2.gray(`
3634
- Completed in ${result.initDurationMs}ms`));
3635
- repairOutput(chalk2.gray(`Telemetry mode: ${result.telemetryMode}`));
3636
- if (result.schemaVersion) {
3637
- repairOutput(chalk2.gray(`Schema version: ${result.schemaVersion}`));
3638
- }
3639
- repairOutput();
3640
- repairOutput(chalk2.bold.cyan("Re-running Health Checks\n"));
3641
- } catch (error) {
3642
- console.error(
3643
- chalk2.red("Error: Repair failed:"),
3644
- error instanceof Error ? error.message : String(error)
3645
- );
3646
- process.exit(1);
3647
- }
3648
- }
3649
- const checks = await runAllHealthChecks(validatedOptions);
3650
- displayHealthResults(checks, validatedOptions);
3651
- renderDoctorPendingNudges(resolveRepoRootForBuildDir(process.cwd()), validatedOptions);
3652
- exitForHealthFailures(checks, validatedOptions);
3653
- });
3654
- return health;
3655
- }
3656
-
3657
- export {
3658
- checkPendingInitNotices,
3659
- checkPendingOfferNotice,
3660
- renderDoctorPendingNudges,
3661
- runExecutionRolesPreflight,
3662
- runStampedExecutionRolesPreflight,
3663
- formatPreflightIssue,
3664
- isStrictBlockingWarning,
3665
- PROVIDER_CLI_SPEC_IDS,
3666
- checkProviderCLIs,
3667
- checkLinuxWriteBoundary,
3668
- checkCoordinationLocks,
3669
- checkGitRepository,
3670
- checkKnowledgeKit,
3671
- runAllHealthChecks,
3672
- createDoctorCommand
3673
- };
3674
- //# sourceMappingURL=chunk-IZU2NMRQ.js.map