codebaseiq 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (447) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/README.md +1 -1
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-ZMI2JSX2.js → chunk-23C5AD3B.js} +2 -2
  5. package/dist/chunk-2E6OUPCF.js +2 -0
  6. package/dist/chunk-2EDX3JT5.js +3 -0
  7. package/dist/chunk-2I2UHZET.js +2 -0
  8. package/dist/{chunk-T3DGWPXM.js → chunk-2OMXFE64.js} +2 -2
  9. package/dist/chunk-2PRONPAS.js +3 -0
  10. package/dist/{chunk-GW6Z3WGY.js → chunk-356EZBIP.js} +2 -2
  11. package/dist/{chunk-UDS562V4.js → chunk-36JC5BG2.js} +2 -2
  12. package/dist/chunk-3RR2K7EZ.js +20 -0
  13. package/dist/{chunk-JE3WZ6II.js → chunk-3RSBGWGL.js} +2 -2
  14. package/dist/{chunk-VE5AVNMP.js → chunk-3VJ3OCRE.js} +2 -2
  15. package/dist/{chunk-FDGD5AB5.js → chunk-4LK5OIPW.js} +2 -2
  16. package/dist/chunk-5DSL3NT2.js +17 -0
  17. package/dist/chunk-5FWR5HLG.js +90 -0
  18. package/dist/chunk-5IC2WZAL.js +22 -0
  19. package/dist/{chunk-MVB3DAEY.js → chunk-5IZRKWTZ.js} +2 -2
  20. package/dist/{chunk-Q65CQ4XL.js → chunk-5LL4KEHO.js} +2 -2
  21. package/dist/chunk-5T44HG5Y.js +88 -0
  22. package/dist/{chunk-TRRC4ZJ7.js → chunk-5ZI2PPI7.js} +2 -2
  23. package/dist/{chunk-7XAN6GKB.js → chunk-67VJAYVR.js} +2 -2
  24. package/dist/{chunk-MOVBWNIP.js → chunk-6BF3VYEF.js} +2 -2
  25. package/dist/chunk-6JMAVFL4.js +3 -0
  26. package/dist/chunk-6O3KXIDL.js +2 -0
  27. package/dist/{chunk-JOIRNPPY.js → chunk-6VREELBC.js} +2 -2
  28. package/dist/chunk-6WAPPQ5F.js +82 -0
  29. package/dist/{chunk-FW53T7EB.js → chunk-75KJGYX7.js} +2 -2
  30. package/dist/chunk-7GAK2F3H.js +77 -0
  31. package/dist/{chunk-UBGWN7I4.js → chunk-7JELP5YE.js} +2 -2
  32. package/dist/chunk-7UCDGXRW.js +8 -0
  33. package/dist/{chunk-L57ZKWVG.js → chunk-AEXQYQD7.js} +2 -2
  34. package/dist/chunk-AQI4N64O.js +22 -0
  35. package/dist/{chunk-ICFDQHAM.js → chunk-AURCQHSG.js} +2 -2
  36. package/dist/{chunk-I2T2LLK2.js → chunk-BBP7HVBJ.js} +2 -2
  37. package/dist/{chunk-OFBE4NGP.js → chunk-BFBIMTCJ.js} +2 -2
  38. package/dist/{chunk-JEJLSICM.js → chunk-BGGB5N53.js} +2 -2
  39. package/dist/{chunk-TIIC3ZE7.js → chunk-BRQL7AFJ.js} +2 -2
  40. package/dist/{chunk-YSNONTJ2.js → chunk-BWL3PMPT.js} +2 -2
  41. package/dist/chunk-C6WKPKCF.js +127 -0
  42. package/dist/{chunk-YESXMKX3.js → chunk-C7OUW52M.js} +2 -2
  43. package/dist/chunk-C7QWUBR2.js +545 -0
  44. package/dist/{chunk-4WKDMDEW.js → chunk-CCIYWXX6.js} +2 -2
  45. package/dist/{chunk-FAJQ7LWY.js → chunk-CIYA2KZN.js} +2 -2
  46. package/dist/{chunk-VEXUL62T.js → chunk-CR3OG6SQ.js} +2 -2
  47. package/dist/{chunk-JSOYNVWH.js → chunk-CVHOQONG.js} +2 -2
  48. package/dist/{chunk-LU3BMVH2.js → chunk-CW6AXOLR.js} +2 -2
  49. package/dist/{chunk-TXXOEMZJ.js → chunk-D53LWANR.js} +2 -2
  50. package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
  51. package/dist/{chunk-N3IQCBCF.js → chunk-D7AZAOZX.js} +2 -2
  52. package/dist/{chunk-RDBI2RXU.js → chunk-D7DOB27N.js} +7 -7
  53. package/dist/chunk-DAKIGMIK.js +21 -0
  54. package/dist/chunk-DDN2F6GB.js +2 -0
  55. package/dist/chunk-DUKHVPU5.js +4 -0
  56. package/dist/chunk-DVWO7RBC.js +2 -0
  57. package/dist/{chunk-HKQUXIFO.js → chunk-E52K4L2W.js} +2 -2
  58. package/dist/chunk-EIBGSU2R.js +2 -0
  59. package/dist/chunk-EN4AHLL3.js +3 -0
  60. package/dist/chunk-EQNMD62X.js +51 -0
  61. package/dist/{chunk-ENCCHKM6.js → chunk-EXZ7VLRY.js} +4 -4
  62. package/dist/{chunk-NEDP5RFQ.js → chunk-F3QSL4W2.js} +2 -2
  63. package/dist/{chunk-O6QTXQPJ.js → chunk-F74LZWCE.js} +2 -2
  64. package/dist/{chunk-BH5F2Q4O.js → chunk-FEIZXBLH.js} +2 -2
  65. package/dist/chunk-FH5WG4LE.js +2 -0
  66. package/dist/{chunk-BVAJLC5A.js → chunk-FOZ74V56.js} +2 -2
  67. package/dist/{chunk-L4NRUAGJ.js → chunk-FQTIFWLR.js} +2 -2
  68. package/dist/chunk-FTTV7IRX.js +355 -0
  69. package/dist/chunk-FWQGH2N2.js +2 -0
  70. package/dist/{chunk-CAUCPUOF.js → chunk-GDHWOA57.js} +2 -2
  71. package/dist/{chunk-6MUIJMVL.js → chunk-GIDCP7KV.js} +2 -2
  72. package/dist/{chunk-ZV3JV5G5.js → chunk-GL6UTNUB.js} +2 -2
  73. package/dist/chunk-GP7C5VAE.js +2 -0
  74. package/dist/{chunk-FQKZWM4L.js → chunk-GQLDYCWS.js} +5 -5
  75. package/dist/chunk-GQXXOS55.js +2 -0
  76. package/dist/{chunk-H3LGFZVK.js → chunk-GUFPEFBG.js} +2 -2
  77. package/dist/{chunk-NNOKTMZT.js → chunk-GV2CEZCW.js} +2 -2
  78. package/dist/{chunk-FETNQCFO.js → chunk-GVAF222T.js} +2 -2
  79. package/dist/chunk-GWYZVVKY.js +21 -0
  80. package/dist/{chunk-7FND7D7N.js → chunk-HENP2O4A.js} +2 -2
  81. package/dist/{chunk-LZYFLFEH.js → chunk-HINZQKSY.js} +2 -2
  82. package/dist/{chunk-RR7SX44N.js → chunk-HQA7EBSK.js} +2 -2
  83. package/dist/{chunk-XMQ23E27.js → chunk-HVFB3PME.js} +2 -2
  84. package/dist/chunk-I22IZYDI.js +2 -0
  85. package/dist/chunk-ICUL7XRT.js +21 -0
  86. package/dist/{chunk-CQP3THUZ.js → chunk-IHSLIIL3.js} +2 -2
  87. package/dist/{chunk-34WBMAYK.js → chunk-ITSJMNUD.js} +2 -2
  88. package/dist/{chunk-PX4RYAAK.js → chunk-IZDPGOZR.js} +2 -2
  89. package/dist/chunk-J3GLP7Q5.js +3 -0
  90. package/dist/{chunk-CVYSU6BX.js → chunk-J7AMBVWF.js} +2 -2
  91. package/dist/{chunk-Y6KHROC3.js → chunk-JCMFBF4Z.js} +2 -2
  92. package/dist/chunk-JFIA2JI3.js +3 -0
  93. package/dist/chunk-JLZLLLW5.js +3 -0
  94. package/dist/{chunk-5PUWMSDU.js → chunk-JSNTHRLQ.js} +2 -2
  95. package/dist/{chunk-C6SBF2WH.js → chunk-JX6ZWDOS.js} +2 -2
  96. package/dist/{chunk-4XTAUQFD.js → chunk-JYI7CV25.js} +2 -2
  97. package/dist/chunk-K7JLSGCJ.js +8 -0
  98. package/dist/{chunk-XWUOUWYI.js → chunk-KPZGTB2O.js} +2 -2
  99. package/dist/{chunk-VXYS3FZD.js → chunk-LKUTSP4G.js} +2 -2
  100. package/dist/{chunk-GTXSJDCO.js → chunk-LMTSB3TB.js} +2 -2
  101. package/dist/chunk-LONKINMJ.js +543 -0
  102. package/dist/{chunk-WMPRTGH2.js → chunk-LQHYYIOB.js} +2 -2
  103. package/dist/{chunk-VUIYB2V3.js → chunk-LZSQ6X7E.js} +2 -2
  104. package/dist/{chunk-ST7V3SKN.js → chunk-M2Y6PCFE.js} +2 -2
  105. package/dist/chunk-MEUHIDI3.js +7 -0
  106. package/dist/{chunk-OZYRSMSH.js → chunk-MHWMEZDA.js} +2 -2
  107. package/dist/{chunk-RKEJ6VTF.js → chunk-MQW6SJ4P.js} +2 -2
  108. package/dist/{chunk-J77SU6VA.js → chunk-MSI3K7PJ.js} +2 -2
  109. package/dist/chunk-MVRGB4KJ.js +278 -0
  110. package/dist/{chunk-DQMDCD24.js → chunk-MZNMASFM.js} +2 -2
  111. package/dist/{chunk-ID63777H.js → chunk-NBCQZSGR.js} +2 -2
  112. package/dist/chunk-NBZKSTXP.js +2 -0
  113. package/dist/{chunk-SZD2KF7Q.js → chunk-NCJILOAK.js} +2 -2
  114. package/dist/{chunk-C7QOQX32.js → chunk-NDKOVQFG.js} +2 -2
  115. package/dist/{chunk-UNBY47BC.js → chunk-NEWHKGVD.js} +2 -2
  116. package/dist/{chunk-PYAB5SM6.js → chunk-O2M3VNDY.js} +2 -2
  117. package/dist/chunk-OFGOOL6U.js +3 -0
  118. package/dist/{chunk-SWHMHUKF.js → chunk-OQUCBKOI.js} +2 -2
  119. package/dist/{chunk-7MGU3HPH.js → chunk-P4NVCOM7.js} +2 -2
  120. package/dist/{chunk-ANFVSJWQ.js → chunk-PFC44E6D.js} +2 -2
  121. package/dist/{chunk-EZNMUY67.js → chunk-PHNCEUXX.js} +2 -2
  122. package/dist/{chunk-4FC325IF.js → chunk-PTQPPPG2.js} +2 -2
  123. package/dist/chunk-PUVNH4PO.js +3 -0
  124. package/dist/chunk-Q23IMHXS.js +343 -0
  125. package/dist/chunk-Q3ZCQY2Y.js +3 -0
  126. package/dist/{chunk-KMITESMT.js → chunk-Q4XEU3UH.js} +2 -2
  127. package/dist/{chunk-QKPLA6IC.js → chunk-QEOWONKY.js} +2 -2
  128. package/dist/{chunk-BJ6SQAEN.js → chunk-QMOZZ2VX.js} +2 -2
  129. package/dist/chunk-RCIGX23V.js +60 -0
  130. package/dist/{chunk-IOP6FWIM.js → chunk-RIYJ4L33.js} +2 -2
  131. package/dist/chunk-RJVAPMHF.js +14 -0
  132. package/dist/chunk-SB7NASHU.js +2 -0
  133. package/dist/{chunk-UZGZB3VB.js → chunk-SGMNWYTH.js} +2 -2
  134. package/dist/chunk-SMDIEDM4.js +27 -0
  135. package/dist/chunk-SV2LEFVM.js +2 -0
  136. package/dist/chunk-SX72EVMY.js +3 -0
  137. package/dist/chunk-T5X7DK6C.js +3 -0
  138. package/dist/{chunk-6NW7MU72.js → chunk-T6MQNNAC.js} +2 -2
  139. package/dist/chunk-T75DS2E6.js +21 -0
  140. package/dist/{chunk-HRWGYWRJ.js → chunk-TEANKHUU.js} +2 -2
  141. package/dist/chunk-TJBOJUVN.js +3 -0
  142. package/dist/{chunk-XLQ3GLWZ.js → chunk-TJWVT4DO.js} +2 -2
  143. package/dist/{chunk-7NVGT435.js → chunk-TNJGTQWO.js} +2 -2
  144. package/dist/{chunk-NE6IU5ZD.js → chunk-TOTWJZIX.js} +2 -2
  145. package/dist/{chunk-PBI2LFKH.js → chunk-TPO7XC5Z.js} +2 -2
  146. package/dist/{chunk-HPJRBHVT.js → chunk-U33PMPNW.js} +2 -2
  147. package/dist/{chunk-QHRNXP3C.js → chunk-U7NUXDQO.js} +2 -2
  148. package/dist/chunk-UC2FD2PS.js +4 -0
  149. package/dist/{chunk-PIOMTC27.js → chunk-UQE4XFSA.js} +2 -2
  150. package/dist/chunk-UQYQBLJX.js +5 -0
  151. package/dist/{chunk-KWVHSKHK.js → chunk-USOAJHY7.js} +2 -2
  152. package/dist/{chunk-GCHRX4YW.js → chunk-UW6KD57C.js} +2 -2
  153. package/dist/{chunk-PTAWHLVJ.js → chunk-VGWZ4MOY.js} +2 -2
  154. package/dist/{chunk-XME3HPXZ.js → chunk-VWYGCMV5.js} +2 -2
  155. package/dist/{chunk-AKB7V7TV.js → chunk-W7YLRXZE.js} +2 -2
  156. package/dist/{chunk-SYDJMPES.js → chunk-WK2IQJPK.js} +2 -2
  157. package/dist/{chunk-RBAS5ZHI.js → chunk-WWCV4E6J.js} +2 -2
  158. package/dist/{chunk-OL6KJP3N.js → chunk-XMJ53WG4.js} +2 -2
  159. package/dist/chunk-XN3EKMLI.js +4 -0
  160. package/dist/chunk-XQAVQVIL.js +3 -0
  161. package/dist/{chunk-IJ4HMYBE.js → chunk-XQPPURLQ.js} +2 -2
  162. package/dist/{chunk-OVTS4DKB.js → chunk-YHPG3S2U.js} +2 -2
  163. package/dist/{chunk-WOQBZPIF.js → chunk-YRKP7PM7.js} +2 -2
  164. package/dist/chunk-YT4DVWUV.js +11 -0
  165. package/dist/chunk-YTJHCGYB.js +61 -0
  166. package/dist/chunk-Z35GOVEH.js +2 -0
  167. package/dist/{chunk-OLF4MA5W.js → chunk-Z6RL7XOE.js} +4 -4
  168. package/dist/{chunk-UP3BUZR5.js → chunk-ZAFGY22Q.js} +2 -2
  169. package/dist/{chunk-CO5R3UNA.js → chunk-ZB4C5TTR.js} +2 -2
  170. package/dist/{chunk-ZZXSWSN6.js → chunk-ZNH33XIB.js} +2 -2
  171. package/dist/{chunk-EMNIHCRB.js → chunk-ZQ62NNKN.js} +2 -2
  172. package/dist/cli-context-FJL2JHOE.js +3 -0
  173. package/dist/cli-context-PQNWHMCQ.js +2 -0
  174. package/dist/cli-program-UO7PZD6V.js +7 -0
  175. package/dist/cli.js +1 -1
  176. package/dist/{code-DlqpBDd0.d.ts → code-DfX3xeWy.d.ts} +1 -1
  177. package/dist/code-viewer-KIXEYQNJ.js +12 -0
  178. package/dist/code-viewer-VHLBLIUM.js +11 -0
  179. package/dist/command-descriptors-F5P2V3NW.js +335 -0
  180. package/dist/command-descriptors-YCLATF5I.js +337 -0
  181. package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
  182. package/dist/{db-D7sauVFH.d.ts → db-BoG_PWYH.d.ts} +2 -2
  183. package/dist/direct-navigation-4XJTXIDT.js +2 -0
  184. package/dist/direct-navigation-J5MVYYAD.js +3 -0
  185. package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-D1jx1Cql.d.ts} +1 -1
  186. package/dist/{health-DJaZXg8I.d.ts → health-DkYBS5BI.d.ts} +1 -1
  187. package/dist/index.d.ts +2 -2
  188. package/dist/index.js +1 -1
  189. package/dist/invocation-command-descriptors-RWV4VAI4.js +2 -0
  190. package/dist/invocation-command-descriptors-U76PN7IY.js +3 -0
  191. package/dist/{scip-cli-B7N3haxa.d.ts → maintenance-types-CdL5eQii.d.ts} +2 -21
  192. package/dist/output-continuation-command-BL25S26S.js +3 -0
  193. package/dist/output-continuation-command-BTETTXEC.js +2 -0
  194. package/dist/postinstall.js +1 -1
  195. package/dist/project-reindex-CRJU3IFG.js +2 -0
  196. package/dist/project-reindex-TQFCOA2O.js +3 -0
  197. package/dist/queries/affected.d.ts +2 -2
  198. package/dist/queries/affected.js +1 -1
  199. package/dist/queries/anchors.d.ts +2 -2
  200. package/dist/queries/anchors.js +1 -1
  201. package/dist/queries/architecture.d.ts +2 -2
  202. package/dist/queries/architecture.js +1 -1
  203. package/dist/queries/bottlenecks.d.ts +2 -2
  204. package/dist/queries/bottlenecks.js +1 -1
  205. package/dist/queries/by-kind.d.ts +2 -2
  206. package/dist/queries/by-kind.js +1 -1
  207. package/dist/queries/call-graph.d.ts +2 -2
  208. package/dist/queries/call-graph.js +1 -1
  209. package/dist/queries/change-surface.d.ts +2 -2
  210. package/dist/queries/change-surface.js +1 -1
  211. package/dist/queries/cleanup-plan.d.ts +2 -2
  212. package/dist/queries/cleanup-plan.js +1 -1
  213. package/dist/queries/co-change.d.ts +2 -2
  214. package/dist/queries/co-change.js +1 -1
  215. package/dist/queries/code.d.ts +3 -3
  216. package/dist/queries/code.js +1 -1
  217. package/dist/queries/complexity-hotspots.d.ts +2 -2
  218. package/dist/queries/complexity-hotspots.js +1 -1
  219. package/dist/queries/complexity.d.ts +2 -2
  220. package/dist/queries/complexity.js +1 -1
  221. package/dist/queries/context.d.ts +2 -2
  222. package/dist/queries/context.js +1 -1
  223. package/dist/queries/convergence.d.ts +2 -2
  224. package/dist/queries/convergence.js +1 -1
  225. package/dist/queries/coupling.d.ts +2 -2
  226. package/dist/queries/coupling.js +1 -1
  227. package/dist/queries/cycles.d.ts +2 -2
  228. package/dist/queries/cycles.js +1 -1
  229. package/dist/queries/dataflow.d.ts +2 -2
  230. package/dist/queries/dataflow.js +1 -1
  231. package/dist/queries/dead.d.ts +2 -2
  232. package/dist/queries/dead.js +1 -1
  233. package/dist/queries/decorative-checkers.d.ts +2 -2
  234. package/dist/queries/decorative-checkers.js +1 -1
  235. package/dist/queries/deep-chains.d.ts +2 -2
  236. package/dist/queries/deep-chains.js +1 -1
  237. package/dist/queries/dependence-slice.d.ts +3 -3
  238. package/dist/queries/dependence-slice.js +1 -1
  239. package/dist/queries/dependency-depth.d.ts +2 -2
  240. package/dist/queries/dependency-depth.js +1 -1
  241. package/dist/queries/deps.d.ts +2 -2
  242. package/dist/queries/deps.js +1 -1
  243. package/dist/queries/diff-impact.d.ts +2 -2
  244. package/dist/queries/diff-impact.js +1 -1
  245. package/dist/queries/doc-drift.d.ts +2 -2
  246. package/dist/queries/doc-drift.js +1 -1
  247. package/dist/queries/drift.d.ts +2 -2
  248. package/dist/queries/drift.js +1 -1
  249. package/dist/queries/duplicate-bodies.d.ts +2 -2
  250. package/dist/queries/duplicate-bodies.js +1 -1
  251. package/dist/queries/entry-map.d.ts +2 -2
  252. package/dist/queries/entry-map.js +1 -1
  253. package/dist/queries/evidence.d.ts +3 -3
  254. package/dist/queries/evidence.js +1 -1
  255. package/dist/queries/extract-candidates.d.ts +2 -2
  256. package/dist/queries/extract-candidates.js +1 -1
  257. package/dist/queries/fan.d.ts +2 -2
  258. package/dist/queries/fan.js +1 -1
  259. package/dist/queries/files.d.ts +2 -2
  260. package/dist/queries/files.js +1 -1
  261. package/dist/queries/health.d.ts +3 -3
  262. package/dist/queries/health.js +1 -1
  263. package/dist/queries/hierarchy.d.ts +2 -2
  264. package/dist/queries/hierarchy.js +1 -1
  265. package/dist/queries/hotspots.d.ts +2 -2
  266. package/dist/queries/hotspots.js +1 -1
  267. package/dist/queries/imports.d.ts +2 -2
  268. package/dist/queries/imports.js +1 -1
  269. package/dist/queries/incomplete-migration.d.ts +2 -2
  270. package/dist/queries/incomplete-migration.js +1 -1
  271. package/dist/queries/index.d.ts +5 -5
  272. package/dist/queries/index.js +1 -1
  273. package/dist/queries/isolated.d.ts +2 -2
  274. package/dist/queries/isolated.js +1 -1
  275. package/dist/queries/locality-candidates.d.ts +2 -2
  276. package/dist/queries/locality-candidates.js +1 -1
  277. package/dist/queries/members.d.ts +2 -2
  278. package/dist/queries/members.js +1 -1
  279. package/dist/queries/methods.d.ts +2 -2
  280. package/dist/queries/methods.js +1 -1
  281. package/dist/queries/not-implemented.d.ts +2 -2
  282. package/dist/queries/not-implemented.js +1 -1
  283. package/dist/queries/outline.d.ts +2 -2
  284. package/dist/queries/outline.js +1 -1
  285. package/dist/queries/passthrough-candidates.d.ts +2 -2
  286. package/dist/queries/passthrough-candidates.js +1 -1
  287. package/dist/queries/plan-context.d.ts +2 -2
  288. package/dist/queries/plan-context.js +1 -1
  289. package/dist/queries/react-component-duplicates.d.ts +2 -2
  290. package/dist/queries/react-component-duplicates.js +1 -1
  291. package/dist/queries/react-hook-candidates.d.ts +2 -2
  292. package/dist/queries/react-hook-candidates.js +1 -1
  293. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  294. package/dist/queries/react-large-component-pressure.js +1 -1
  295. package/dist/queries/recent-duplicates.d.ts +2 -2
  296. package/dist/queries/recent-duplicates.js +1 -1
  297. package/dist/queries/redundant-reexports.d.ts +2 -2
  298. package/dist/queries/redundant-reexports.js +1 -1
  299. package/dist/queries/reference-neighborhood.d.ts +2 -2
  300. package/dist/queries/reference-neighborhood.js +1 -1
  301. package/dist/queries/reference-reachability.d.ts +2 -2
  302. package/dist/queries/reference-reachability.js +1 -1
  303. package/dist/queries/refs.d.ts +2 -2
  304. package/dist/queries/refs.js +1 -1
  305. package/dist/queries/self-audit.d.ts +2 -2
  306. package/dist/queries/self-audit.js +1 -1
  307. package/dist/queries/similar-chains.d.ts +2 -2
  308. package/dist/queries/similar-chains.js +1 -1
  309. package/dist/queries/similar-files.d.ts +2 -2
  310. package/dist/queries/similar-files.js +1 -1
  311. package/dist/queries/similar-signatures.d.ts +2 -2
  312. package/dist/queries/similar-signatures.js +1 -1
  313. package/dist/queries/similar.d.ts +2 -2
  314. package/dist/queries/similar.js +1 -1
  315. package/dist/queries/slice.d.ts +2 -2
  316. package/dist/queries/slice.js +1 -1
  317. package/dist/queries/source-inspection.d.ts +4 -4
  318. package/dist/queries/source-inspection.js +1 -1
  319. package/dist/queries/source-search.d.ts +2 -2
  320. package/dist/queries/source-search.js +1 -1
  321. package/dist/queries/stale-abstractions.d.ts +2 -2
  322. package/dist/queries/stale-abstractions.js +1 -1
  323. package/dist/queries/stats.d.ts +2 -2
  324. package/dist/queries/surface.d.ts +2 -2
  325. package/dist/queries/surface.js +1 -1
  326. package/dist/queries/symbols.d.ts +2 -2
  327. package/dist/queries/symbols.js +1 -1
  328. package/dist/queries/system-map.d.ts +2 -2
  329. package/dist/queries/system-map.js +1 -1
  330. package/dist/queries/system.d.ts +2 -2
  331. package/dist/queries/system.js +1 -1
  332. package/dist/queries/test-quality.d.ts +2 -2
  333. package/dist/queries/test-quality.js +1 -1
  334. package/dist/queries/trace.d.ts +2 -2
  335. package/dist/queries/trace.js +1 -1
  336. package/dist/queries/twin-ab.d.ts +2 -2
  337. package/dist/queries/twin-ab.js +1 -1
  338. package/dist/queries/twin-drift.d.ts +2 -2
  339. package/dist/queries/twin-drift.js +1 -1
  340. package/dist/queries/unused-imports.d.ts +2 -2
  341. package/dist/queries/unused-imports.js +1 -1
  342. package/dist/queries/unused-params.d.ts +2 -2
  343. package/dist/queries/unused-params.js +1 -1
  344. package/dist/queries/value-flow.d.ts +3 -3
  345. package/dist/queries/value-flow.js +1 -1
  346. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  347. package/dist/queries/vue-component-duplicates.js +1 -1
  348. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  349. package/dist/queries/vue-composable-candidates.js +1 -1
  350. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  351. package/dist/queries/vue-large-view-pressure.js +1 -1
  352. package/dist/queries/wrapper-candidates.d.ts +2 -2
  353. package/dist/queries/wrapper-candidates.js +1 -1
  354. package/dist/reindex-worker.js +2 -2
  355. package/dist/reindex.d.ts +3 -5
  356. package/dist/reindex.js +72 -33
  357. package/dist/runtime.d.ts +23 -4
  358. package/dist/runtime.js +3 -3
  359. package/dist/rust-semantic-session-server.js +1 -1
  360. package/dist/rust-semantic-session-worker.js +1 -1
  361. package/dist/rust-semantic-worker.js +1 -1
  362. package/dist/sentinel-ensure-command-OSWGCFFL.js +3 -0
  363. package/dist/sentinel-ensure-command-SPW7XQLB.js +2 -0
  364. package/dist/sentinel-hook.js +39 -0
  365. package/dist/sentinel-worker.js +16 -0
  366. package/dist/typescript-mailbox-worker.js +1 -1
  367. package/dist/watch-server.js +6 -6
  368. package/docs/COMMAND_REFERENCE.md +5 -3
  369. package/docs/INDEX_GENERATIONS.md +2 -2
  370. package/docs/NPM_RELEASE.md +323 -0
  371. package/docs/schemas/npm-release-state.schema.json +4 -13
  372. package/docs/schemas/project-config.schema.json +159 -0
  373. package/package.json +10 -14
  374. package/skills/codebaseiq/SKILL.md +1 -1
  375. package/skills/concrete-plan/SKILL.md +1 -1
  376. package/ui/view/api.js +450 -0
  377. package/ui/view/app.js +394 -0
  378. package/ui/view/builder.js +323 -0
  379. package/ui/view/file-panel.js +170 -0
  380. package/ui/view/focus.js +379 -0
  381. package/ui/view/index.html +54 -0
  382. package/ui/view/map.js +424 -0
  383. package/ui/view/styles.css +1125 -0
  384. package/dist/chunk-2Q2LW5JW.js +0 -14
  385. package/dist/chunk-2X7V4HS4.js +0 -88
  386. package/dist/chunk-3IER7Q6H.js +0 -12
  387. package/dist/chunk-3JSXXYTZ.js +0 -345
  388. package/dist/chunk-476NR5B7.js +0 -2
  389. package/dist/chunk-5VKBFZZU.js +0 -3
  390. package/dist/chunk-6BQ3DSPK.js +0 -2
  391. package/dist/chunk-6CS3UQTN.js +0 -3
  392. package/dist/chunk-6OAHRI2D.js +0 -6
  393. package/dist/chunk-ADTBPVUZ.js +0 -21
  394. package/dist/chunk-BFFZDZQV.js +0 -2
  395. package/dist/chunk-BMYOV5GP.js +0 -77
  396. package/dist/chunk-C74PPYLA.js +0 -3
  397. package/dist/chunk-CWONGW6P.js +0 -3
  398. package/dist/chunk-DDZ7VHWV.js +0 -20
  399. package/dist/chunk-DR2LURYU.js +0 -3
  400. package/dist/chunk-ECQBG7PW.js +0 -564
  401. package/dist/chunk-EF2R3WNQ.js +0 -2
  402. package/dist/chunk-FM5BPL4V.js +0 -60
  403. package/dist/chunk-G6XFR4ZL.js +0 -4
  404. package/dist/chunk-GTIYTDRE.js +0 -562
  405. package/dist/chunk-HOA5YGOH.js +0 -3
  406. package/dist/chunk-KUW32IRO.js +0 -2
  407. package/dist/chunk-LTA3BRZX.js +0 -2
  408. package/dist/chunk-NAUD7LCA.js +0 -2
  409. package/dist/chunk-NCZUNH3E.js +0 -109
  410. package/dist/chunk-NNJ2KZZG.js +0 -4
  411. package/dist/chunk-NNO6A2PO.js +0 -2
  412. package/dist/chunk-OGTFJ3XD.js +0 -2
  413. package/dist/chunk-Q5ELPRKQ.js +0 -2
  414. package/dist/chunk-Q72QSKXC.js +0 -308
  415. package/dist/chunk-QCN62RTF.js +0 -3
  416. package/dist/chunk-QW7EP6WI.js +0 -21
  417. package/dist/chunk-RU65DDUP.js +0 -215
  418. package/dist/chunk-SELM5MER.js +0 -2
  419. package/dist/chunk-SMRBZ6EC.js +0 -2
  420. package/dist/chunk-SNNWPCN7.js +0 -4
  421. package/dist/chunk-TFZB6XTM.js +0 -239
  422. package/dist/chunk-UCD3H3UZ.js +0 -5
  423. package/dist/chunk-UXM43C7T.js +0 -3
  424. package/dist/chunk-VFY6Y2H6.js +0 -61
  425. package/dist/chunk-WE5RZHZ7.js +0 -5
  426. package/dist/chunk-YMGZZEW4.js +0 -2
  427. package/dist/chunk-YVCIMIOC.js +0 -12
  428. package/dist/chunk-Z54RD7VL.js +0 -3
  429. package/dist/chunk-ZKX2FRS6.js +0 -15
  430. package/dist/cli-context-3SNLDYBM.js +0 -3
  431. package/dist/cli-context-T3B7W6GG.js +0 -2
  432. package/dist/cli-program-YNOXO72B.js +0 -7
  433. package/dist/command-descriptors-6AOUKWW7.js +0 -346
  434. package/dist/command-descriptors-ZFKJSRUP.js +0 -344
  435. package/dist/direct-navigation-DP4LVMRX.js +0 -3
  436. package/dist/direct-navigation-FLUS3BT6.js +0 -2
  437. package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
  438. package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
  439. package/dist/output-continuation-command-2V2SL4TD.js +0 -2
  440. package/dist/output-continuation-command-65J5IP3O.js +0 -3
  441. package/dist/project-reindex-5JOKXAXT.js +0 -2
  442. package/dist/project-reindex-UQBIKO4M.js +0 -3
  443. package/docs/WINDOWS_SIDECAR_RELEASE.md +0 -424
  444. package/docs/schemas/windows-sidecar-provenance.schema.json +0 -137
  445. package/scripts/build-codebaseiq-windows.mjs +0 -197
  446. package/scripts/codebaseiq-windows-provenance.mjs +0 -364
  447. package/scripts/verify-codebaseiq-windows.mjs +0 -29
@@ -1,61 +0,0 @@
1
- import{g as D,h as M}from"./chunk-3IER7Q6H.js";import{e as _}from"./chunk-FM5BPL4V.js";import{a as V,b as I,ba as A,fa as N,g as S}from"./chunk-WE5RZHZ7.js";import Re from"better-sqlite3";import{existsSync as wn}from"fs";import{dirname as En,join as Tn,resolve as he}from"path";import Ve from"better-sqlite3";import{execFileSync as xe}from"child_process";import{existsSync as ve,readdirSync as Ie}from"fs";import{extname as x,join as we}from"path";function j(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:n=>Ee({projectRoot:n.projectRoot,dbPath:n.dbPath,extensions:e.extensions,onStatus:n.onStatus})}}function Ee(e){let n=new Set((e.extensions??D).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!ve(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let t=_(e.projectRoot),r=Te(e.projectRoot,n).filter(i=>!t.isIgnored(i)),o=new Ve(e.dbPath);try{let i=Fe(o,r),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
2
- VALUES (?, ?, NULL, ?)`),a=o.transaction(l=>{let f=0;for(let g of l){if(i.has(g))continue;let p=A(e.projectRoot,g,{inputKind:"auxiliary source file"}),m=s.run(Le(g),g,p);f+=Number(m.changes)}return f})(r),c={scanned:r.length,inserted:a,existing:r.length-a};return e.onStatus?.(`Augmented SQLite documents with ${a} auxiliary source file${a===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function Te(e,n){let t=Ce(e,n);if(t)return t;let r=[],o=i=>{let s=i?we(e,i):e,u;try{u=Ie(s,{withFileTypes:!0})}catch{return}for(let a of u){if(M.has(a.name))continue;let c=i?`${i}/${a.name}`:a.name;if(a.isDirectory()){o(c);continue}n.has(x(a.name).toLowerCase())&&r.push(c)}};return o(""),r.sort()}function Ce(e,n){try{return xe("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}).split(`
3
- `).filter(r=>r&&n.has(x(r).toLowerCase())).sort()}catch{return null}}function Fe(e,n){let t=new Set,r=500;for(let o=0;o<n.length;o+=r){let i=n.slice(o,o+r),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let u of s)t.add(u.relative_path)}return t}function Le(e){return x(e).toLowerCase()===".vue"?"vue":x(e).replace(/^\./,"").toLowerCase()||"source"}import{writeFileSync as Pe}from"fs";function W(e,n){let t=performance.now(),r=e.run(n);return{stageId:e.id,facts:e.facts,durationMs:performance.now()-t,result:r}}async function U(e){let n=e.readFingerprint(),t=Oe(e.cachePath,n);if(t)return e.onCacheHit?.(t.result),t.result;let r=await e.compute();return Ae(e.cachePath,e.readFingerprint(),r),r}function Oe(e,n){try{let t=JSON.parse(S(e,{maxBytes:V,inputKind:"post-index augmentation cache"}));return $(t.fingerprint)===$(n)?{result:t.result}:null}catch{return null}}function Ae(e,n,t){Pe(e,`${JSON.stringify({updatedAt:new Date().toISOString(),fingerprint:n,result:t},null,2)}
4
- `)}function $(e){return JSON.stringify(e)}import{randomUUID as De}from"crypto";import{mkdtempSync as Me,rmSync as _e,statSync as H}from"fs";import{tmpdir as je}from"os";import{join as K}from"path";import{Worker as $e}from"worker_threads";function Ne(){return{"missing-source-file":0,"missing-service-script":0,"no-definition":0,"same-file-definition":0,"unindexed-definition":0}}function y(){return{skippedReferences:0,skippedReferenceReasons:Ne(),skippedReferenceSamples:[]}}function v(e,n){e.skippedReferences+=n.skippedReferences;for(let t of Object.keys(e.skippedReferenceReasons)){e.skippedReferenceReasons[t]+=n.skippedReferenceReasons[t];for(let r of n.skippedReferenceSamples.filter(o=>o.reason===t))e.skippedReferenceSamples.filter(i=>i.reason===t&&i.sourceFile===r.sourceFile).length<2&&e.skippedReferenceSamples.push(r)}}var We=3e5,G=64*1024*1024,Ue={createResultDirectory:()=>Me(K(je(),"codebaseiq-vue-workers-")),spawn:(e,n)=>new $e(e,{workerData:n}),resultSize:e=>H(e).size,readResult:e=>S(e,{maxBytes:G,inputKind:"Vue worker result"}),removeResultDirectory:e=>_e(e,{recursive:!0,force:!0})};function J(e){return e.length>=8&&X(e.length)>1}async function z(e,n=Ue){let t=X(e.vueFiles.length),r=nn(e.vueFiles),o=rn(r,t),i=new URL("./augment-vue-worker.js",import.meta.url),s=e.timeoutMs??Ze(),u=e.maxResultBytes??en();B("timeoutMs",s),B("maxResultBytes",u);let a=De(),c=n.createResultDirectory(),l=[],f,g,p;try{for(let d=0;d<o.length;d++){let b=d,F=o[d]??[],L=F.map(ke=>ke.taskId),P=K(c,`${b}.json`),O=n.spawn(i,{projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,tasks:F,resultPath:P,runId:a,workerId:b,taskIds:L});l.push({workerId:b,taskIds:L,resultPath:P,handle:O,completion:Be(O,b)})}await He(l,s);let m=l.sort((d,b)=>d.workerId-b.workerId).map(d=>Ge(d,a,u,n));p={occurrences:m.flatMap(d=>d.occurrences),...y()};for(let d of m)v(p,d)}catch(m){f=m}finally{let m=await Ke(l);if(m.length===0)try{n.removeResultDirectory(c)}catch(d){m.push(d)}if(m.length>0){let d=f===void 0?m:[f,...m];g=new AggregateError(d,`Vue worker cleanup failed: ${Qe(d[0])}`)}}if(g)throw g;if(f!==void 0)throw f;if(!p)throw new Error("Vue workers completed without producing a merged result.");return p}function Be(e,n){return new Promise((t,r)=>{let o=!1,i=a=>{o||(o=!0,e.off("error",s),e.off("exit",u),a?r(a):t())},s=a=>{i(new Error(`Vue reference worker ${n} failed: ${a.message}`,{cause:a}))},u=a=>{i(a===0?void 0:new Error(`Vue reference worker ${n} exited with code ${a}`))};e.once("error",s),e.once("exit",u)})}async function He(e,n){let t;try{await Promise.race([Promise.all(e.map(r=>r.completion)),new Promise((r,o)=>{t=setTimeout(()=>o(new Error(`Vue reference workers timed out after ${(n/1e3).toFixed(3)}s`)),n),t.unref()})])}finally{t&&clearTimeout(t)}}async function Ke(e){return(await Promise.allSettled(e.map(async t=>t.handle.terminate()))).flatMap(t=>t.status==="rejected"?[t.reason]:[])}function Ge(e,n,t,r){let o=r.resultSize(e.resultPath);if(!Number.isSafeInteger(o)||o<0||o>t)throw new Error(`Vue reference worker ${e.workerId} result is ${o} bytes; limit is ${t} bytes`);let i;try{i=JSON.parse(r.readResult(e.resultPath))}catch(s){throw new Error(`Vue reference worker ${e.workerId} produced invalid JSON`,{cause:s})}if(!k(i)||i.version!==1||i.runId!==n||i.workerId!==e.workerId)throw new Error(`Vue reference worker ${e.workerId} result identity does not match its assignment`);if(!qe(i.taskIds,e.taskIds))throw new Error(`Vue reference worker ${e.workerId} result task identities do not match its assignment`);if(i.ok===!1)throw typeof i.error!="string"?new Error(`Vue reference worker ${e.workerId} failure payload is malformed`):new Error(`Vue reference worker ${e.workerId} failed: ${i.error}`);if(i.ok!==!0||!Je(i.result))throw new Error(`Vue reference worker ${e.workerId} success payload is malformed`);return i.result}function Je(e){if(!k(e)||!Array.isArray(e.occurrences)||!e.occurrences.every(ze)||!R(e.skippedReferences)||!k(e.skippedReferenceReasons))return!1;for(let n of["missing-source-file","missing-service-script","no-definition","same-file-definition","unindexed-definition"])if(!R(e.skippedReferenceReasons[n]))return!1;return Array.isArray(e.skippedReferenceSamples)&&e.skippedReferenceSamples.every(Xe)}function ze(e){return k(e)&&typeof e.sourceFile=="string"&&R(e.sourceLine)&&R(e.sourceStartChar)&&R(e.sourceEndChar)&&typeof e.sourceToken=="string"&&typeof e.definitionFile=="string"&&R(e.symbolId)}function Xe(e){return k(e)&&typeof e.sourceFile=="string"&&R(e.sourceLine)&&R(e.sourceStartChar)&&R(e.sourceEndChar)&&typeof e.token=="string"&&Ye(e.reason)}function Ye(e){return e==="missing-source-file"||e==="missing-service-script"||e==="no-definition"||e==="same-file-definition"||e==="unindexed-definition"}function R(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function k(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qe(e,n){return Array.isArray(e)&&e.length===n.length&&e.every((t,r)=>typeof t=="string"&&t===n[r])}function B(e,n){if(!Number.isSafeInteger(n)||n<=0)throw new TypeError(`${e} must be a positive safe integer.`)}function Qe(e){return e instanceof Error?e.message:String(e)}function X(e){let n=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKERS??0),t=Number.isFinite(n)&&n>0?n:1;return Math.max(1,Math.min(e,t))}function Ze(){let e=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKER_TIMEOUT_MS??0);return Number.isFinite(e)&&e>0?e:We}function en(){let e=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKER_RESULT_MAX_BYTES??0);return Number.isSafeInteger(e)&&e>0?e:G}function nn(e){let n=tn(),t=[];for(let r of e){let o=Y(r),i=Math.max(1,Math.ceil(o/n));for(let s=0;s<i;s++)t.push({taskId:`${t.length}:${r}:${s}`,fileName:r,startOffset:Math.floor(o*s/i),endOffset:s===i-1?Number.POSITIVE_INFINITY:Math.floor(o*(s+1)/i),countFileSkip:s===0})}return t}function tn(){return Number.POSITIVE_INFINITY}function rn(e,n){let t=Array.from({length:n},()=>({tasks:[],weight:0})),r=e.map(o=>({task:o,weight:on(o)})).sort((o,i)=>i.weight-o.weight);for(let o of r){let i=t.reduce((s,u)=>u.weight<s.weight?u:s);i.tasks.push(o.task),i.weight+=o.weight}return t.map(o=>o.tasks).filter(o=>o.length>0)}function on(e){return Number.isFinite(e.endOffset)?Math.max(1,e.endOffset-e.startOffset):Math.max(1,Y(e.fileName)-e.startOffset)}function Y(e){try{return H(e).size}catch{return 1}}import{createRequire as sn}from"module";import{existsSync as un}from"fs";import{dirname as q,extname as an,join as Q,relative as cn,resolve as ln}from"path";import{pathToFileURL as fn}from"url";function dn(e){e.transaction(()=>{e.prepare(`
5
- DELETE FROM mentions
6
- WHERE chunk_id IN (
7
- SELECT c.id
8
- FROM chunks c
9
- JOIN documents d ON d.id = c.document_id
10
- WHERE d.language = 'vue' OR d.relative_path LIKE '%.vue'
11
- )
12
- `).run(),e.prepare(`
13
- DELETE FROM chunks
14
- WHERE document_id IN (
15
- SELECT id
16
- FROM documents
17
- WHERE language = 'vue' OR relative_path LIKE '%.vue'
18
- )
19
- `).run()})()}function Z(e,n){return e.prepare(`
20
- SELECT relative_path AS relativePath
21
- FROM documents
22
- WHERE language = 'vue' OR relative_path LIKE '%.vue'
23
- ORDER BY relative_path
24
- `).all().map(r=>ln(n,r.relativePath))}function ee(e,n){let{vueCore:t,ts:r,volarTs:o}=gn(e),{parsed:i,vueOptions:s}=mn(t,r,n),u=q(n),a=t.createVueLanguagePlugin(r,i.options,s,p=>p),c=pn(t,r,a),l=Rn(u,i),{languageServiceHost:f}=o.createLanguageServiceHost(r,r.sys,c,p=>p,l),g=r.createLanguageService(f);return{ts:r,language:c,languageService:g,fileNames:i.fileNames,configDir:u}}function gn(e){let n=sn(fn(Q(e,"package.json")).href);return{vueCore:w(n,"@vue/language-core",e),ts:w(n,"typescript",e),volarTs:w(n,"@volar/typescript",e)}}function mn(e,n,t){let r=n.readConfigFile(t,n.sys.readFile);if(r.error||!r.config)throw new Error(`Failed to read ${t}`);let i=e.createParsedCommandLine(n,n.sys,t).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,n.sys.writeFile)),{parsed:n.parseJsonConfigFileContent(r.config,n.sys,q(t),void 0,t,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:n.ScriptKind.Deferred}))),vueOptions:i}}function pn(e,n,t){let r={},o=e.createLanguage([t],new Map,i=>{if(!un(i))return;let s=S(i,{maxBytes:I,inputKind:"Vue language-service source file"});r.current?.scripts.set(i,n.ScriptSnapshot.fromString(s),t.getLanguageId(i)??Vn(i))});return r.current=o,o}function Rn(e,n){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>n.options,getScriptFileNames:()=>n.fileNames,getProjectReferences:()=>n.projectReferences,getProjectVersion:()=>"0"}}function w(e,n,t){try{return e(n)}catch(r){throw(typeof r=="object"&&r!==null&&"code"in r?r.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${n} to be installed in ${t}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:r}):r}}function ne(e,n,t){let r=hn(e);return o=>{if(!o.name)return null;let i=h(n,o.fileName),s=t.get(o.fileName);if(!s)return null;let u=t.positionAt(s,o.textSpan.start),a=r.get(i);if(!a)return null;let c=a.starts.find(f=>f.line===u.line&&f.displayName===o.name);if(c)return c.symbolId;let l=a.containingByLine.get(u.line);return l&&l.displayName===o.name?l.symbolId:Sn(a.starts,u.line,2,o.name)}}function hn(e){let n=e.prepare(`
25
- SELECT
26
- d.relative_path AS relativePath,
27
- der.start_line AS startLine,
28
- der.end_line AS endLine,
29
- der.symbol_id AS symbolId,
30
- gs.display_name AS displayName
31
- FROM defn_enclosing_ranges der
32
- JOIN documents d ON d.id = der.document_id
33
- JOIN global_symbols gs ON gs.id = der.symbol_id
34
- ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
35
- `).all(),t=new Map;for(let r of n){let o=t.get(r.relativePath);o||(o={containingByLine:new Map,starts:[]},t.set(r.relativePath,o)),o.starts.push({line:r.startLine,symbolId:r.symbolId,displayName:r.displayName});for(let i=r.startLine;i<=r.endLine;i++)o.containingByLine.set(i,{symbolId:r.symbolId,displayName:r.displayName})}for(let r of t.values())r.starts.sort((o,i)=>o.line-i.line);return t}function Sn(e,n,t,r){let o=0,i=e.length-1;for(;o<=i;){let u=Math.floor((o+i)/2);e[u].line<n?o=u+1:i=u-1}let s=null;for(let u of[i,o]){let a=e[u];if(!a||a.displayName!==r)continue;let c=Math.abs(a.line-n);c>t||(!s||c<s.distance)&&(s={distance:c,symbolId:a.symbolId})}return s?.symbolId??null}function te(e,n,t){let r=de(n),o=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),i=e.prepare(`
36
- INSERT OR IGNORE INTO global_symbols (symbol, display_name, kind, documentation)
37
- VALUES (?, ?, ?, ?)
38
- `),s=0,u=new Map;return e.transaction(()=>{for(let c of t){let l=h(n,c),f=me(r.name,r.version,l);i.run(f,"default",7,`Vue component|${l}`);let g=ge(o,r,n,c);g&&(s++,u.set(c,g))}})(),{get(c){return u.get(c)??null},syntheticSymbols:s}}function re(e,n,t,r,o){return e.transaction(()=>(dn(e),bn(e,n,t,r),yn(e,o)))()}function bn(e,n,t,r){let o=e.prepare("SELECT id FROM documents WHERE relative_path = ?"),i=e.prepare(`
39
- INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
40
- VALUES (?, ?, ?, ?, X'00')
41
- `),s=e.prepare(`
42
- INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
43
- VALUES (?, ?, 1)
44
- `);for(let u of t){let a=r.get(u);if(!a)continue;let c=h(n,u),l=o.get(c);if(!l)continue;let f=i.run(l.id,-1,0,0);s.run(Number(f.lastInsertRowid),a)}}function oe(e,n){let t=de(n),r=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=ge(r,t,n,i);return o.set(i,s),s}}}function ie(e,n,t,r,o){if(e.fileName.endsWith(".vue")){let i=r.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let u=r.language.maps.get(s,i);if(E(u,e.textSpan.start)!==null)return t.get(e.fileName)}return e.fileName.startsWith(o)?t.get(e.fileName):null}return n(e)}function se(e){let n=new Set,t=[];for(let r of e){let o=ue(r);n.has(o)||(n.add(o),t.push(r))}return t}function ue(e){return[e.sourceFile,e.sourceLine,e.sourceStartChar,e.sourceEndChar,e.symbolId].join(":")}function yn(e,n){let t=vn(e,[...new Set(n.map(a=>a.sourceFile))]),r=e.prepare(`
45
- INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
46
- VALUES (?, ?, ?, ?, X'00')
47
- `),o=e.prepare(`
48
- INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
49
- VALUES (?, ?, 0)
50
- `),i=new Set,s=0,u=0;for(let a of n){let c=ue(a);if(i.has(c))continue;i.add(c);let l=t.get(a.sourceFile);if(!l)continue;let f=r.run(l,u++,a.sourceLine,a.sourceLine),g=o.run(Number(f.lastInsertRowid),a.symbolId);s+=Number(g.changes)}return s}function*ae(e){let n=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,t=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),r;for(;r=n.exec(e);){let o=r[0];t.has(o)||(yield{text:o,start:r.index,end:r.index+o.length})}}function ce(e,n){for(let[t]of e.toGeneratedLocation(n,r=>!!r.navigation))return t;return null}function E(e,n){let t=e;for(let[r]of t.toSourceLocation(n,o=>!!o.navigation))return r;return null}function kn(e,n){let t=0,r=e.lineStarts.length-1;for(;t<=r;){let i=Math.floor((t+r)/2);e.lineStarts[i]<=n?t=i+1:r=i-1}let o=Math.max(0,r);return{line:o,character:n-e.lineStarts[o]}}function le(e,n){return h(e,n).startsWith("node_modules/")}function h(e,n){return cn(e,n).replaceAll("\\","/")}function Vn(e){switch(an(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function fe(){let e=new Map;return{get(n){if(e.has(n))return e.get(n)??null;try{let t=S(n,{maxBytes:I,inputKind:"Vue source file"}),r={text:t,lineStarts:xn(t)};return e.set(n,r),r}catch{return e.set(n,null),null}},positionAt:kn}}function xn(e){let n=[0];for(let t=0;t<e.length;t++)e.charCodeAt(t)===10&&n.push(t+1);return n}function vn(e,n){let t=new Map,r=500;for(let o=0;o<n.length;o+=r){let i=n.slice(o,o+r),s=e.prepare(`SELECT id, relative_path AS relativePath FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let u of s)t.set(u.relativePath,u.id)}return t}function de(e){try{let n=JSON.parse(S(Q(e,"package.json"),{maxBytes:V,inputKind:"project package manifest"}));return{name:n.name??"workspace",version:n.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function ge(e,n,t,r){let o=h(t,r),i=me(n.name,n.version,o);return e.get(i)?.id??null}function me(e,n,t){let r=t.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${n} ${r}/default.`}async function Et(e){return W(j(),{projectRoot:e.projectRoot,dbPath:e.dbPath}),Cn(e)}async function Cn(e){let n=he(e.projectRoot,e.tsconfig);if(!wn(n))throw new Error(`Vue tsconfig not found at ${n}`);let t=new Re(e.dbPath);try{let r=Z(t,e.projectRoot),o=Tn(En(e.dbPath),"augment-vue-meta.json");return await U({cachePath:o,readFingerprint:()=>On(t,e.projectRoot,e.tsconfig),compute:()=>Fn({db:t,projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,configPath:n,vueFiles:r,onStatus:e.onStatus}),onCacheHit:i=>e.onStatus?.(`Vue references unchanged; reused ${i.resolvedReferences} cached resolved references.`)})}finally{t.close()}}async function Fn(e){let n=te(e.db,e.projectRoot,e.vueFiles),t=J(e.vueFiles)?await z({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles}):Pn(e,n);return Ln(e,n,t)}function Ln(e,n,t){let r=se(t.occurrences),o=re(e.db,e.projectRoot,e.vueFiles,n,r),i={vueFiles:e.vueFiles.length,resolvedReferences:r.length,resolvedReferenceSamples:$n(e.db,r,20),insertedMentions:o,skippedReferences:t.skippedReferences,skippedReferenceReasons:t.skippedReferenceReasons,skippedReferenceSamples:jn(t.skippedReferenceSamples,20),syntheticSymbols:n.syntheticSymbols};return e.onStatus?.(`Resolved ${i.resolvedReferences} Vue references with Volar; inserted ${i.insertedMentions} mentions.`),i}function Pn(e,n){let t=Se({db:e.db,projectRoot:e.projectRoot,configPath:e.configPath,vueSymbolLookup:n});return be({...t,vueFiles:t.context.fileNames.filter(r=>r.endsWith(".vue"))})}function On(e,n,t){let r=e.prepare(`
51
- SELECT
52
- (SELECT COUNT(*) FROM documents) AS documents,
53
- (SELECT COUNT(*) FROM global_symbols) AS symbols,
54
- (SELECT COUNT(*) FROM chunks) AS chunks,
55
- (SELECT COUNT(*) FROM mentions) AS mentions,
56
- (SELECT COUNT(*) FROM defn_enclosing_ranges) AS ranges,
57
- (SELECT MAX(id) FROM chunks) AS maxChunkId,
58
- (SELECT MAX(id) FROM global_symbols) AS maxSymbolId
59
- `).get();return{version:3,tsconfig:t,files:N(n),db:r}}function Tt(e){let n=he(e.projectRoot,e.tsconfig),t=new Re(e.dbPath,{readonly:!0});try{let r=Se({db:t,projectRoot:e.projectRoot,configPath:n,vueSymbolLookup:oe(t,e.projectRoot)});return be({vueFiles:e.vueFiles??[],tasks:e.tasks,...r})}finally{t.close()}}function Se(e){let n=fe();return{projectRoot:e.projectRoot,context:ee(e.projectRoot,e.configPath),symbolLookup:ne(e.db,e.projectRoot,n),vueSymbolLookup:e.vueSymbolLookup,sourceReader:n}}function be(e){let n=[],t=y(),r=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of r){let i=An(e,o);n.push(...i.occurrences),v(t,i)}return{occurrences:n,...t}}function An(e,n){let t=e.sourceReader.get(n.fileName);if(!t)return pe(e.projectRoot,n,"missing-source-file");let r=e.context.language.scripts.get(n.fileName),o=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!o)return pe(e.projectRoot,n,"missing-service-script");let i=e.context.language.maps.get(o,r),s=h(e.projectRoot,n.fileName),u=[...ae(t.text)],a={tokens:u.filter(c=>c.start>=n.startOffset&&c.start<n.endOffset),tokenByStart:new Map(u.map(c=>[c.start,c])),tokenTextCounts:Un(u),processedStarts:new Set};return Nn({...e,fileName:n.fileName,sourceInfo:t,sourceFile:s,map:i,tokenContext:a})}function Nn(e){let n=[],t=y();for(let r of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(r.start)||Dn(e.sourceInfo.text,r.start))continue;let o=ce(e.map,r.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(l=>!le(e.projectRoot,l.fileName));if(!s){T(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,"no-definition");continue}let u=h(e.projectRoot,s.fileName),a=Mn(e.sourceFile,r.text,u);if(a){T(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,a);continue}let c=ie(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(c===null){T(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,"unindexed-definition");continue}ye(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,u,c),e.tokenContext.processedStarts.add(r.start),Wn(n,e,r,o,u,c)}return{occurrences:n,...t}}function Dn(e,n){let t=e.lastIndexOf(`
60
- `,n-1)+1,r=e.slice(t,n);return/\bfrom\s+['"][^'"]*$/.test(r)||/\bimport\s*\(\s*['"][^'"]*$/.test(r)}function Mn(e,n,t){return t===e?"same-file-definition":t.endsWith(".vue")&&n!==t.split("/").at(-1)?.replace(/\.vue$/,"")?"unindexed-definition":null}function pe(e,n,t){let r=y();return n.countFileSkip&&(r.skippedReferences=1,r.skippedReferenceReasons[t]=1,r.skippedReferenceSamples.push({sourceFile:h(e,n.fileName),sourceLine:0,sourceStartChar:0,sourceEndChar:0,token:"",reason:t})),{occurrences:[],...r}}function T(e,n,t,r,o,i){if(e.skippedReferences++,e.skippedReferenceReasons[i]++,e.skippedReferenceSamples.filter(u=>u.reason===i&&u.sourceFile===r).length>=2)return;let s=n.positionAt(t,o.start);e.skippedReferenceSamples.push({sourceFile:r,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,token:o.text,reason:i})}function C(e,n){let t=new Map;for(let i of e){let s=t.get(i.sourceFile)??[];s.push(i),t.set(i.sourceFile,s)}let r=[...t.keys()].sort(),o=[];for(let i=0;o.length<n;i++){let s=!1;for(let u of r){let a=t.get(u)?.[i];if(a&&(o.push(a),s=!0,o.length===n))break}if(!s)break}return o}function _n(e,n){let t=C(e.filter(i=>i.sourceFile!==i.definitionFile),Math.ceil(n/2)),r=new Set(t.map(i=>`${i.sourceFile}:${i.sourceLine}:${i.sourceStartChar}:${i.sourceEndChar}:${i.symbolId}`)),o=C(e.filter(i=>!r.has(`${i.sourceFile}:${i.sourceLine}:${i.sourceStartChar}:${i.sourceEndChar}:${i.symbolId}`)),n-t.length);return[...t,...o]}function jn(e,n){let t=[...new Set(e.map(o=>o.reason))].sort(),r=[];for(let[o,i]of t.entries()){let s=t.length-o,u=Math.ceil((n-r.length)/s);r.push(...C(e.filter(a=>a.reason===i),u))}return r.slice(0,n)}function $n(e,n,t){let r=e.prepare("SELECT symbol FROM global_symbols WHERE id = ?");return _n(n,t).map(({symbolId:o,...i})=>({...i,definitionSymbol:r.get(o)?.symbol??`symbol-id:${o}`}))}function Wn(e,n,t,r,o,i){if(!((n.tokenContext.tokenTextCounts.get(t.text)??0)<=1))for(let s of Bn(n.context.languageService,n.fileName,r+1,n.map,t,n.tokenContext.tokenByStart)){if(n.tokenContext.processedStarts.has(s))continue;let u=n.tokenContext.tokenByStart.get(s);u&&(ye(e,n.sourceReader,n.sourceInfo,n.sourceFile,u,o,i),n.tokenContext.processedStarts.add(s))}}function ye(e,n,t,r,o,i,s){let u=n.positionAt(t,o.start);e.push({sourceFile:r,sourceLine:u.line,sourceStartChar:u.character,sourceEndChar:u.character+o.text.length,sourceToken:o.text,definitionFile:i,symbolId:s})}function Un(e){let n=new Map;for(let t of e)n.set(t.text,(n.get(t.text)??0)+1);return n}function Bn(e,n,t,r,o,i){let s=e.getDocumentHighlights?.(n,t,[n])??[],u=[];for(let a of s)if(a.fileName===n)for(let c of a.highlightSpans){let l=Hn(r,c.textSpan.start,i,o.text);l!==null&&u.push(l)}return u}function Hn(e,n,t,r){let o=t.get(n);if(o?.text===r)return o.start;let i=E(e,n);if(i===null)return null;let s=t.get(i);return s?.text===r?s.start:null}export{j as a,Ee as b,W as c,Et as d,Tt as e};
61
- //# sourceMappingURL=chunk-VFY6Y2H6.js.map
@@ -1,5 +0,0 @@
1
- import{closeSync as te,fstatSync as N,openSync as re,readFileSync as mt,readSync as Ce}from"fs";import{createHash as yt}from"crypto";var ke=8*1024*1024,Fe=64*1024*1024,St=512*1024*1024,xt=256*1024*1024,j=class extends Error{constructor(r,n,i,o,s){let a=i==="too-large"?`is ${o} bytes; the safety limit is ${s} bytes`:i==="not-regular"?"is not a regular file":"changed while it was being read";super(`${r} ${JSON.stringify(n)} ${a}`);this.inputKind=r;this.inputPath=n;this.reason=i;this.observedBytes=o;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="CODEBASEIQ_BOUNDED_FILE_READ"};function Ee(e,t){ie(t.maxBytes);let r=String(e),n=re(e,"r");try{let i=N(n);Ie(i,t,r);let o=mt(n),s=N(n);if(s.dev!==i.dev||s.ino!==i.ino||s.size!==i.size||o.byteLength!==i.size)throw new j(t.inputKind,r,"changed-during-read",s.size,t.maxBytes);return o}finally{te(n)}}function I(e,t,r="utf8"){return Ee(e,t).toString(r)}function D(e,t){return I(e,{maxBytes:ke,inputKind:t})}function bt(e,t){return I(e,{maxBytes:Fe,inputKind:t})}function ne(e,t){ie(t.maxBytes);let r=[],n=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=Ce(e,n,0,n.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>t.maxBytes)throw new j(t.inputKind,`file descriptor ${e}`,"too-large",i,t.maxBytes);r.push(Buffer.from(n.subarray(0,o)))}return Buffer.concat(r,i)}function Pt(e,t,r="utf8"){return ne(e,t).toString(r)}function ve(e,t){let r=re(e,"r");try{return ne(r,t)}finally{te(r)}}function jt(e,t,r="utf8"){return ve(e,t).toString(r)}function z(e,t,r){ie(t.maxBytes);let n=String(e),i=re(e,"r");try{let o=N(i);Ie(o,t,n);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),a=0;for(;a<o.size;){let u=Ce(i,s,0,Math.min(s.length,o.size-a),a);if(u===0)break;r(s.subarray(0,u)),a+=u}let c=N(i);if(c.dev!==o.dev||c.ino!==o.ino||c.size!==o.size||a!==o.size)throw new j(t.inputKind,n,"changed-during-read",c.size,t.maxBytes);return a}finally{te(i)}}function wt(e,t){let r=yt("sha256");return z(e,t,n=>r.update(n)),r.digest("hex")}function Ie(e,t,r){if(!e.isFile())throw new j(t.inputKind,r,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new j(t.inputKind,r,"too-large",Number(e.size),t.maxBytes)}function ie(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function oe(e,t,r=[]){let n=se(e);if(_e.has(n)||r.some(o=>M(n,o))||t.some(o=>Be(n,o)))return"config";if(t.some(Ne)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return"ambient";let i=Le(n);return t.some(o=>(ze[o]??[]).includes(i))?"source":"other"}function Te(e,t,r){let n=se(e);if(_e.has(n)||r?.some(o=>M(n,o))||Be(n,t)||Ne(t)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return!0;let i=Le(n);return(ze[t]??[]).includes(i)}function jn(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!De(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!De(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(Ct)?null:t}function wn(e,t){let r=new Map((e?.files??[]).map(a=>[a.path,a])),n=new Map(t.files.map(a=>[a.path,a])),i=new Set([...r.keys(),...n.keys()]),o=[];for(let a of[...i].sort()){let c=r.get(a),u=n.get(a),l=oe(a,t.languages);!c&&u?o.push({kind:"added",path:a,inputKind:l,after:u}):c&&!u?o.push({kind:"deleted",path:a,inputKind:l,before:c}):c&&u&&(c.hash!==u.hash||c.size!==u.size)&&o.push({kind:"modified",path:a,inputKind:l,before:c,after:u})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(Re(e?.files??[])||Re(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(kt)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!Ft(e,t):!0,uncertainty:[...s].sort()}}function De(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Re(e){return new Set(e.map(t=>t.path)).size!==e.length}function Ct(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"}function kt(e){return e.hash==="unreadable"||e.size<0}function Ft(e,t){return Oe(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&Oe(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function Oe(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();return r.every((i,o)=>i===n[o])}var _e=new Set([".codebaseiq.json"]),Et={typescript:["tsconfig.json"],javascript:["package.json"],java:["pom.xml","build.gradle"],scala:["build.sbt"],kotlin:["build.gradle.kts"],rust:["Cargo.toml"],python:["pyproject.toml","setup.py"],ruby:["Gemfile"],go:["go.mod"],cpp:["CMakeLists.txt","Makefile"],c:["CMakeLists.txt","Makefile"],csharp:["*.csproj","*.sln"],vb:["*.vbproj","*.sln"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},vt={typescript:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],javascript:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.json","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],java:["build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],scala:["plugins.sbt","build.properties"],kotlin:["pom.xml","build.gradle","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],rust:["Cargo.lock","rust-project.json","rust-toolchain","rust-toolchain.toml"],python:["setup.cfg","requirements*.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock"],ruby:["Gemfile.lock","gems.locked"],go:["go.sum","go.work","go.work.sum"],cpp:["compile_commands.json"],c:["compile_commands.json"],csharp:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],vb:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],dart:["pubspec.lock","analysis_options.yaml"],php:["composer.lock"],clojure:[]},Ae=new Map;function Be(e,t){return Et[t].some(r=>M(e,r))||vt[t].some(r=>M(e,r))}function M(e,t){let r=se(t).replace(/^\.\//,"");if(!r)return!1;let n=e.split("/").at(-1)??e,i=r.includes("/")?e:n;if(!r.includes("*")&&!r.includes("?"))return i===r;let o=Ae.get(r);if(!o){let s=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),Ae.set(r,o)}return o.test(i)}function se(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Le(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function Ne(e){return e==="typescript"||e==="javascript"}var ze={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{createRequire as It}from"module";var Dt=It(import.meta.url),Me=Rt().version;function Rt(){for(let e of["../package.json","../../package.json"])try{return Dt(e)}catch{}return{version:"0.0.0"}}import{createHash as Ke,randomUUID as Nt}from"crypto";import{chmodSync as Xe,existsSync as k,linkSync as zt,lstatSync as H,readdirSync as le,realpathSync as x,unlinkSync as Mt,writeSync as Gt}from"fs";import{homedir as Wt}from"os";import{basename as $t,dirname as U,isAbsolute as qe,join as y,resolve as q}from"path";import{closeSync as Ot,existsSync as At,fsyncSync as Tt,mkdirSync as _t,openSync as Bt}from"fs";import{dirname as We}from"path";function Ge(e,t,r,n){let i=0;for(;i<t.length;){let o=r.writeFile(e,t,i,t.length-i);if(!Number.isSafeInteger(o)||o<=0||o>t.length-i)throw new Error(`${n} write did not make valid forward progress`);i+=o}}function ae(e,t){if(t!=="win32")return!1;let r=e.code;return r==="EACCES"||r==="EBADF"||r==="EINVAL"||r==="EISDIR"||r==="EPERM"}var R=Object.freeze({platform:process.platform,pathExists:e=>At(e),makeDirectory:e=>_t(e,{recursive:!0}),openFile:(e,t,r)=>Bt(e,t,r),syncFile:e=>Tt(e),closeFile:e=>Ot(e)});function $e(e,t=R){let r=[],n=e;for(;!t.pathExists(n);){r.push(n);let o=We(n);if(o===n)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);n=o}let i="synced";for(let o of r.reverse())t.makeDirectory(o),i=W(i,G(We(o),t));return i}function G(e,t=R){let r;try{r=t.openFile(e,"r")}catch(n){if(ae(n,t.platform))return"unsupported";throw n}try{t.syncFile(r)}catch(n){try{t.closeFile(r)}catch{}if(ae(n,t.platform))return"unsupported";throw n}return t.closeFile(r),"synced"}function W(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{isAbsolute as Ue,relative as Lt}from"path";var m=class extends Error{constructor(r,n){super(`refusing unsafe project file path ${JSON.stringify(r)} (${n})`);this.relativePath=r;this.reason=n;this.name="UnsafeProjectPathError"}relativePath;reason;code="CODEBASEIQ_UNSAFE_PROJECT_PATH"};function ce(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function An(e){return e.replace(/\\/g,"/")}function Tn(e,t){return ce(e)===ce(t)}function He(e){let t=e.trim();if(!/^file:/i.test(t))return t;let r;try{r=new URL(t)}catch{return t}if(r.protocol!=="file:")return t;let n;try{n=decodeURIComponent(r.pathname)}catch{return t}for(n=n.replace(/\\/g,"/");n.length>1&&n.endsWith("/");)n=n.slice(0,-1);let i=/^\/([A-Za-z]):(\/|$)/.exec(n);i&&(n=`/${i[1].toUpperCase()}:${n.slice(3)}`);let o=n.split("/").map(s=>encodeURIComponent(s).replace(/%3A/gi,":")).join("/");return`file://${r.host}${o}`}function _n(e,t){return He(e)===He(t)}function S(e,t){let r=Lt(e,t);return r===""||!r.startsWith("..")&&!Ue(r)}function C(e){if(!e)throw new m(e,"empty-path");if(e.includes("\0"))throw new m(e,"nul-byte");if(Ue(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new m(e,"absolute-path");let t=ce(e);if(t.split("/").some(n=>n===".."))throw new m(e,"parent-traversal");if(!t||t===".")throw new m(e,"empty-path");return t}var Ye=1,A=".codebaseiq-cache-owner.json",Ht=16*1024,Ve=Object.freeze({...R,randomToken:()=>Nt(),linkFile:(e,t)=>zt(e,t),removeFile:e=>Mt(e),writeFile:(e,t,r,n)=>Gt(e,t,r,n)});function $(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"CODEBASEIQ_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function b(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"CODEBASEIQ_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function Ut(e,t){let r=x(e);return Jt(r,de(r,t))}function de(e,t){let r=x(e),n=process.env.CODEBASEIQ_CACHE_DIR;return n?q(n):t?.dbPath?Xt(r,t.dbPath):qt(r)}function Qe(){let e=process.env.XDG_CACHE_HOME;return y(e||y(Wt(),".cache"),"codebaseiq")}function qt(e){let t=q(e);try{t=x(t)}catch{}let r=Ke("sha256").update(t).digest("hex").slice(0,12);return y(Qe(),"projects",r)}function qn(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=y(Qe(),"repositories",e);return tt(t),x(t)}function Jn(e){return process.env.CODEBASEIQ_SHARED_CACHE!=="0"&&!process.env.CODEBASEIQ_CACHE_DIR&&!process.env.CODEBASEIQ_INDEX_DB&&!e?.dbPath}function Kn(e,t){let r=Ut(e,t);return{cacheDir:r,dbPath:y(r,"index.db"),indexPath:y(r,"index.scip"),metaPath:y(r,"meta.json")}}function Jt(e,t,r=Ve){return Kt(e,t,r).cacheDir}function Kt(e,t,r=Ve){let n=x(e),i=k(t)?"synced":tt(t,r),o=x(t),s=y(o,A);if(k(s))return ue(n,o),pe(s),O(o),{kind:"existing",cacheDir:o};Je(o),er(o),Je(o);let c=`${JSON.stringify({schemaVersion:Ye,canonicalProjectRoot:n,canonicalCacheDir:o,creatorVersion:Me},null,2)}
2
- `;try{let u=tr(s,c,r),l=W(i,u);return{kind:"published",cacheDir:o,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}catch(u){if(nr(u))return ue(n,o),{kind:"existing",cacheDir:o};throw u}}function ue(e,t){let r=x(e),n=x(t);return Vt(n,r,n)}function Xn(e,t){return k(y(t,A))?(ue(e,t),Ze(t),!0):!1}function Xt(e,t){let r;try{r=C(t)}catch(s){throw s instanceof m?$(t,s.reason):s}let n=q(e,...r.split("/"));if(n===e||!S(e,n))throw $(t,"outside-project");let i=Yt(n),o=x(i);if(!S(e,o)&&o!==e)throw $(t,"symlink-escape");return n}function Yt(e){let t=e;for(;!k(t);){let r=U(t);if(r===t)throw $(e,"no-existing-ancestor");t=r}return t}function Vt(e,t,r){let n=y(e,A);if(!k(n)||H(n).isSymbolicLink())throw b(e,"missing regular ownership record");let i=H(n);if(!i.isFile()||i.size>Ht)throw b(e,"invalid ownership record file");let o=D(n,"cache ownership record"),s=Qt(o,e);if(s.canonicalProjectRoot!==t)throw b(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==r)throw b(e,"ownership record names a different cache directory");return{record:s,ownerSha256:Ke("sha256").update(o).digest("hex"),physicalCacheDir:e}}function Qt(e,t){try{let r=JSON.parse(e);if(r.schemaVersion!==Ye||typeof r.canonicalProjectRoot!="string"||typeof r.canonicalCacheDir!="string"||typeof r.creatorVersion!="string"||!qe(r.canonicalProjectRoot)||!qe(r.canonicalCacheDir))throw new Error("invalid fields");return r}catch(r){throw b(t,`malformed ownership record: ${r instanceof Error?r.message:String(r)}`)}}function Je(e){let t=le(e).filter(r=>r!==A&&!Zt(r));if(t.length>0)throw b(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function Zt(e){return e.startsWith(`${A}.tmp-`)||[".codebaseiq-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function er(e){for(let t of le(e)){let r=y(e,t);try{let n=H(r);if(n.isSymbolicLink())throw b(e,`legacy cache entry ${t} is a symlink`);if(n.isDirectory())O(r);else if(n.isFile())pe(r);else throw b(e,`legacy cache entry ${t} is not a file or directory`)}catch(n){if(et(n))continue;throw n}}O(e)}function Ze(e,t=!1){try{let r=H(e);if(r.isSymbolicLink())throw b(e,"managed cache tree contains a symlink");if(r.isFile()){pe(e);return}if(!r.isDirectory())throw b(e,"managed cache tree contains a special file");O(e);for(let n of le(e))Ze(y(e,n),!0)}catch(r){if(t&&et(r))return;throw r}}function et(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function tt(e,t=R){let r=$e(e,t);return O(e),r}function tr(e,t,r){let n=`${e}.tmp-${process.pid}-${r.randomToken()}`,i,o=!1;try{i=r.openFile(n,"wx",384),o=!0,Ge(i,Buffer.from(t),r,"cache ownership record"),r.syncFile(i),r.closeFile(i),i=void 0,r.linkFile(n,e);let s=G(U(e),r);return r.removeFile(n),o=!1,W(s,G(U(e),r))}finally{if(i!==void 0)try{r.closeFile(i)}catch{}if(o)try{r.removeFile(n)}catch{}}}function O(e){process.platform!=="win32"&&Xe(e,448)}function pe(e){process.platform!=="win32"&&Xe(e,384)}function rr(e){if(k(e))return x(e);let t=[],r=e;for(;;){let n=U(r);if(n===r)return e;if(t.unshift($t(r)),k(n))return y(x(n),...t);r=n}}function Yn(e){return rr(q(e))}function nr(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as ir}from"child_process";import{createHash as or}from"crypto";import{existsSync as sr,lstatSync as ar,realpathSync as cr}from"fs";import{dirname as ur,isAbsolute as lr,join as dr,resolve as K}from"path";var T={run(e,t){let r=rt(e,t);return r.kind==="success"?r.output:void 0},runResult:rt},pr=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],fe=/^[0-9a-f]{40,64}$/;function ri(e,t,r=T){if(!t||t.startsWith("-")||/[\0\r\n]/.test(t))throw new Error(`Invalid Git revision ${JSON.stringify(t)}.`);let n=r.runResult(e,["rev-parse","--verify","--end-of-options",`${t}^{commit}`]);if(n.kind!=="success"||!fe.test(n.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return n.output}function ni(e,t=T){let r=t.runResult(e,pr);if(r.kind==="success"){let n=fr(r.output);if(n)return gr(n,t)}return hr(e,t)}function fr(e){let t=e.split(`
3
- `).map(c=>c.trim());if(t.length!==5)return;let[r,n,i,o,s]=t;if(!r||!n||!i||!o||!s||!fe.test(o)||!fe.test(s))return;let a=P(r);return{root:a,gitDir:P(J(a,n)),commonDir:P(J(a,i)),headCommit:o,treeOid:s}}function gr(e,t){let r=t.run(e.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...nt(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:he("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.length===0}}function hr(e,t){let r=mr(e,t);if(r.kind!=="worktree")return;let n=r.identity,i=n.projectRoot,o=t.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=P(J(i,o)),a=ge(t.run(i,["rev-parse","--verify","HEAD"])),c=ge(t.run(i,["rev-parse","--verify","HEAD^{tree}"])),u=t.run(i,["status","--porcelain=v1","-z","--untracked-files=all"]);if(u!==void 0)return{...n,commonDir:s,repositoryId:he("repository",s),headCommit:a,treeOid:c,clean:u.length===0}}function mr(e,t=T){let r=t.runResult(e,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let n=r.output.trim();if(!n)return{kind:"error",message:"Git returned an empty worktree root."};let i=P(n),o=t.run(i,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=P(J(i,o));return{kind:"worktree",identity:nt(i,s)}}function nt(e,t){return{projectRoot:e,gitDir:t,worktreeId:he("worktree",`${e}\0${t}`)}}function ii(e,t=T){let r=t.run(e,["worktree","list","--porcelain","-z"]);return r===void 0?[]:yr(r)}function yr(e){let t=[],r;for(let n of e.split("\0")){if(n===""){r&&t.push(r),r=void 0;continue}let i=n.indexOf(" "),o=i<0?n:n.slice(0,i),s=i<0?"":n.slice(i+1);if(o==="worktree"){r&&t.push(r),r={path:P(s),detached:!1,bare:!1,prunable:!1,locked:!1};continue}r&&(o==="HEAD"?r.head=s:o==="branch"?r.branch=s:o==="detached"?r.detached=!0:o==="bare"?r.bare=!0:o==="prunable"?r.prunable=!0:o==="locked"&&(r.locked=!0))}return r&&t.push(r),t}function oi(e,t,r=T){return ge(r.run(e,t))}function J(e,t){return lr(t)?t:K(e,t)}function P(e){try{return cr(e)}catch{return K(e)}}function he(e,t){return or("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function ge(e){return e?.trim()||void 0}function rt(e,t){let r=ir("git",["-C",e,...t],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let i=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,o=r.error?.code;return(/not a git repository/i.test(i)||o==="ENOENT"&&sr(K(e)))&&!Sr(e)?{kind:"not-repository"}:{kind:"error",message:i}}function Sr(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=K(e);for(;;){try{return ar(dr(t,".git")),!0}catch(n){let i=n.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let r=ur(t);if(r===t)return!1;t=r}}import{execFileSync as Kr}from"child_process";import{createHash as pt}from"crypto";import{closeSync as Xr,fstatSync as ft,lstatSync as xe,openSync as Yr,readdirSync as Vr,readFileSync as Qr,readlinkSync as Zr,realpathSync as V}from"fs";import{isAbsolute as en,join as be,relative as tn,resolve as rn,sep as nn}from"path";import{execFileSync as me}from"child_process";import{createHash as xr}from"crypto";import{mkdirSync as br,renameSync as Pr,writeFileSync as jr}from"fs";import{basename as wr,dirname as Cr,join as kr}from"path";var Fr="git-content-hashes.json",Er=32*1024*1024,vr=2e5,X=3e4,ye={encoding:"utf8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:X,killSignal:"SIGKILL"};function it(e){let t,r;try{t=me("git",["-C",e,"ls-files","-s","-z","--","."],{...ye,timeout:X}),r=me("git",["-C",e,"status","--porcelain=v1","-z","--untracked-files=all","--no-renames","--","."],{...ye,timeout:X})}catch{return null}let n=new Map,i=[];for(let l of t.split("\0")){if(!l)continue;let f=l.indexOf(" "),p=f>0?l.slice(0,f).split(" "):[];if(p.length!==3)continue;let[h,g,L]=p,w=l.slice(f+1);if(h!=="100644"&&h!=="100755"||L!=="0"){n.delete(w);continue}n.set(w,g),wr(w)===".gitattributes"&&i.push(`${w}:${g}`)}let o=new Set;for(let l of r.split("\0"))l.length>=4&&l[2]===" "&&o.add(l.slice(3));let s=Ir(e,i),a=kr(de(e),Fr),c=Dr(a,s),u=new Map;return{lookup(l){if(o.has(l))return;let f=n.get(l);if(f)return u.get(f)??c.entries[f]},seed(l,f){if(o.has(l))return;let p=n.get(l);!p||c.entries[p]||u.has(p)||u.set(p,f)},persist(){if(u.size===0)return;let l=new Set(n.values()),f={};for(let[p,h]of Object.entries(c.entries))l.has(p)&&(f[p]=h);for(let[p,h]of u)f[p]=h;if(!(Object.keys(f).length>vr))try{br(Cr(a),{recursive:!0});let p=`${a}.${process.pid}.tmp`;jr(p,JSON.stringify({version:1,salt:s,entries:f})),Pr(p,a)}catch{}}}}function Ir(e,t){let r="";try{r=me("git",["-C",e,"config","--get-regexp","^core\\.(autocrlf|eol|safecrlf)$"],{...ye,timeout:X})}catch{}return xr("sha256").update(JSON.stringify([r.trim(),t.sort()])).digest("hex")}function Dr(e,t){let r={version:1,salt:t,entries:{}};try{let n=I(e,{maxBytes:Er,inputKind:"git-content-hash-store"}),i=JSON.parse(n);if(i.version!==1||i.salt!==t||!i.entries||typeof i.entries!="object")return r;let o={};for(let[s,a]of Object.entries(i.entries))/^[0-9a-f]{40,64}$/.test(s)&&a&&typeof a.size=="number"&&Number.isInteger(a.size)&&a.size>=0&&typeof a.hash=="string"&&/^[0-9a-f]{64}$/.test(a.hash)&&(o[s]={size:a.size,hash:a.hash});return{version:1,salt:t,entries:o}}catch{return r}}import{AsyncLocalStorage as Rr}from"async_hooks";var Or=new Rr;function E(e,t){let r=Y(e);if(!r||r.missing.has(t))return;let n=r.files.get(t);if(n)return n;let i=r.readBaseFile?.(t);return i&&r.files.set(t,i),i}function v(e,t){let r=Y(e);if(r)return r.missing.has(t)?"missing":r.paths.includes(t)?"present":"missing"}function ot(e,t){return Y(e)?.fingerprints.get(t)}function F(e){return Y(e)?.paths}function Y(e){let t=Or.getStore();if(t)return t.projectRoot===P(e)?t:void 0}import{createRequire as Ar}from"module";import{existsSync as Tr,readdirSync as _r,statSync as Br}from"fs";import d from"path";var Lr=Ar(import.meta.url),st=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]);function Nr(e,t=[]){let r=d.resolve(e),n=t.flatMap(c=>Mr(r,c));if(n.length>0)return at(r,ut(n));let i=zr(r),o=ut(i),s=Gr(r,o)?[r,...o]:o,a=s.length>0?s:[r];return at(r,a)}function lt(e,t,r=[]){let n;try{n=Lr("ts-morph")}catch{return null}let i=d.resolve(e),o=t==="workspace"?Nr(i,r):["."],s=new Set;for(let a of o){let c=a==="."?i:d.join(i,a),u=d.join(c,"tsconfig.json"),l=Ur(n.ts,i);if(!l.fileExists(u))return null;let f=n.ts.readConfigFile(u,l.readFile);if(f.error)return null;let p=n.ts.parseJsonConfigFileContent(f.config,l,c);if(p.errors.length>0)return null;for(let h of p.fileNames){let g=d.resolve(h);S(i,g)&&s.add(d.relative(i,g).split(d.sep).join("/"))}}return s}function at(e,t){return[...new Set(t.map(r=>_(e,r)))].sort((r,n)=>r.localeCompare(n))}function zr(e){let t=F(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>st.has(s)))return[];let o=d.join(e,...i.split("/"));return ct(e,o)?[d.dirname(o)]:[]});let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=_r(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=d.join(i,s.name);if(s.isDirectory()){!st.has(s.name)&&!s.name.startsWith(".")&&n.push(a);continue}s.isFile()&&ct(e,a)&&r.push(d.dirname(a))}}return r}function Mr(e,t){let r=t.trim();if(!r)return[];let n=d.resolve(e,r);if(!S(e,n))return[];let i=F(e);if(i){let o=_(e,n);if(i.includes(o)&&Se(d.basename(n)))return[d.dirname(n)];let s=o==="."?"":`${o}/`;return i.some(a=>a.startsWith(s))?[n]:[]}try{let o=Br(n);if(o.isDirectory())return[n];if(o.isFile()&&Se(d.basename(n)))return[d.dirname(n)]}catch{return[]}return[]}function ct(e,t){if(!Se(d.basename(t)))return!1;let r=dt(e,t);return r?d.basename(t)==="tsconfig.json"||"include"in r||"files"in r||"references"in r:!1}function Se(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function ut(e){let t=[...new Set(e.map(r=>d.resolve(r)))].sort((r,n)=>r.localeCompare(n));return t.length<=1?t:t.filter(r=>!t.some(n=>n!==r&&Jr(r,n)))}function Gr(e,t){if(t.length===0||t.some(n=>d.resolve(n)===e))return!1;let r=d.join(e,"tsconfig.json");return $r(e,r)&&Wr(e,r)}function Wr(e,t){let n=dt(e,t)?.include;return Array.isArray(n)?n.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!d.extname(i))):!1}function dt(e,t){try{let r=JSON.parse(Hr(e,t));return r&&typeof r=="object"&&!Array.isArray(r)?r:null}catch{return null}}function $r(e,t){let r=_(e,t),n=v(e,r);return n?n==="present":Tr(t)}function Hr(e,t){let r=_(e,t);if(F(e)){let i=E(e,r);if(!i)throw Object.assign(new Error(`Snapshot file ${r} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return D(t,"TypeScript project config")}function Ur(e,t){let r=F(t);if(!r)return e.sys;let n=d.resolve(t),i=new Set(r),o=qr(n,r),s=e,a=c=>{let u=d.resolve(c);return S(n,u)?_(n,u):null};return{useCaseSensitiveFileNames:e.sys.useCaseSensitiveFileNames,fileExists(c){let u=a(c);return u===null?e.sys.fileExists(c):i.has(u)},readFile(c){let u=a(c);return u===null?e.sys.readFile(c):E(n,u)?.content.toString("utf8")},readDirectory(c,u,l,f,p){let h=d.resolve(c);return S(n,h)?s.matchFiles(h,u,l,f,e.sys.useCaseSensitiveFileNames,n,p,g=>o.get(d.resolve(g))??{files:[],directories:[]},g=>g):e.sys.readDirectory(c,u,l,f,p)}}}function qr(e,t){let r=new Map,n=new Map,i=o=>{r.has(o)||r.set(o,new Set),n.has(o)||n.set(o,new Set)};i(e);for(let o of t){let s=o.split("/"),a=e;for(let c=0;c<s.length-1;c+=1){let u=s[c];i(a),n.get(a).add(u),a=d.join(a,u),i(a)}r.get(a).add(s.at(-1))}return new Map([...r].map(([o,s])=>[o,{files:[...s].sort(),directories:[...n.get(o)??[]].sort()}]))}function _(e,t){let r=d.relative(e,t);return r?r.split(d.sep).join("/"):"."}function Jr(e,t){let r=d.relative(e,t);return!!r&&!r.startsWith("..")&&!d.isAbsolute(r)}var Q=64*1024*1024,B=class extends Error{constructor(r,n,i,o){super(`${r} ${JSON.stringify(n)} is ${i} bytes; the safety limit is ${o} bytes`);this.inputKind=r;this.inputPath=n;this.observedBytes=i;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="CODEBASEIQ_INPUT_TOO_LARGE"};function on(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function gt(e,t,r={}){let n=C(t),i=V(e),o=rn(i,...n.split("/"));if(!S(i,o)||o===i)throw new m(t,"outside-project");let s=V(o);if(!S(i,s)||s===i)throw new m(t,"outside-project");let a=xe(s);if(!a.isFile())throw new m(t,"not-a-file");let c={projectRoot:i,relativePath:n,absolutePath:s,size:a.size,mtimeMs:a.mtimeMs,device:a.dev,inode:a.ino},u=r.maxBytes??Q;if(ht(u),c.size>u)throw new B(r.inputKind??"project file",c.relativePath,c.size,u);return c}function sn(e,t,r={}){let n=C(t),i=v(e,n);if(i){if(i==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(n)} does not exist.`),{code:"ENOENT"});let c=E(e,n);if(!c)throw new m(n,"changed-during-read");let u=r.maxBytes??Q;if(ht(u),c.size>u)throw new B(r.inputKind??"project file",n,c.size,u);return Buffer.from(c.content)}let o=gt(e,t,r),s=r.maxBytes??Q,a=Yr(o.absolutePath,"r");try{let c=ft(a);if(!c.isFile()||c.dev!==o.device||c.ino!==o.inode||c.size!==o.size)throw new m(t,"changed-during-read");if(c.size>s)throw new B(r.inputKind??"project file",o.relativePath,c.size,s);let u=Qr(a),l=ft(a);if(l.dev!==c.dev||l.ino!==c.ino||l.size!==c.size||u.byteLength!==c.size)throw new m(t,"changed-during-read");return u}finally{Xr(a)}}function Ti(e,t,r={}){return sn(e,t,r).toString("utf8")}function Pe(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function _i(e,t){try{return gt(e,t),!0}catch(r){if(Pe(r))return!1;throw r}}function ht(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function an(e){return(F(e)??fn(e)??gn(e)).filter(t=>t&&!je(t)).sort()}function cn(e,t={}){let r=(t.includePaths??[]).map(C),n=[...new Set([...an(e),...r])].filter(c=>!je(c)).filter(c=>!t.language||Te(c,t.language,t.markerFiles)).filter(c=>!t.includePath||t.includePath(c)).sort(),i=V(e),o,s=()=>o??=it(i),a=n.flatMap(c=>{let u=ot(e,c);if(u)return[{path:c,size:u.fingerprintSize??u.size,hash:u.sha256}];let l=v(e,c);if(l==="present"){let g=E(e,c);if(g)return[{path:c,size:g.fingerprintSize??g.size,hash:g.sha256}]}let f=l===void 0?s():null,p=f?.lookup(c);if(p)return[{path:c,size:p.size,hash:p.hash}];let h=be(e,c);try{if(xe(h).isSymbolicLink()){let Z=V(h),ee=tn(i,Z);if(ee===".."||ee.startsWith(`..${nn}`)||en(ee))throw new Error("external symlink");let we=Zr(h);return[{path:c,size:Buffer.byteLength(we),hash:pt("sha256").update("symlink\0").update(we).digest("hex")}]}let g=pt("sha256"),L=z(h,{inputKind:"project fingerprint input",maxBytes:Q},Z=>g.update(Z)),w=g.digest("hex");return f?.seed(c,{size:L,hash:w}),[{path:c,size:L,hash:w}]}catch(g){return Pe(g)?[]:[{path:c,size:-1,hash:"unreadable"}]}});return o?.persist(),a}function Bi(e,t,r){let n=dn(t,r),i=[...n.typescriptProjects.filter(s=>ln(e,s)),...n.clojureConfigPath?[n.clojureConfigPath]:[]],o=n.languages.includes("typescript")?lt(e,n.typescriptProjectMode,n.typescriptProjects):null;return{...n,files:cn(e,{includePath:s=>{let a=oe(s,t,i);return a==="other"?!1:a!=="source"||!un(s)||!o?!0:o.has(s)},includePaths:i})}}function un(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function ln(e,t){let r;try{r=C(t)}catch{return!1}let n=v(e,r);if(n)return n==="present";try{return xe(be(e,r)).isFile()}catch(i){if(Pe(i))return!1;throw i}}function dn(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:on(t.typescriptProjects),clojureConfigPath:pn(t.clojureConfigPath)}}function pn(e){return e?.trim()||void 0}function fn(e){try{return Kr("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}).split(`
4
- `).filter(Boolean)}catch{return null}}function gn(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?be(e,n):e,o;try{o=Vr(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){je(a)||r.push(a);continue}t.push(a)}}return t}function je(e){let t=e.split("/");return e==="meta.json"||t[0]===".codebaseiq"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(r=>hn.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var hn=new Set([".git","node_modules",".codebaseiq-cache",".codebaseiq-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{ke as a,Fe as b,St as c,xt as d,j as e,Ee as f,I as g,D as h,bt as i,Pt as j,jt as k,z as l,wt as m,oe as n,jn as o,wn as p,Ct as q,Et as r,Ge as s,ae as t,R as u,$e as v,G as w,W as x,m as y,ce as z,An as A,Tn as B,He as C,_n as D,S as E,C as F,Me as G,A as H,de as I,Qe as J,qt as K,qn as L,Jn as M,Kn as N,Xn as O,Yn as P,T as Q,ri as R,ni as S,mr as T,ii as U,oi as V,J as W,P as X,Nr as Y,B as Z,on as _,gt as $,sn as aa,Ti as ba,Pe as ca,_i as da,an as ea,cn as fa,Bi as ga,dn as ha};
5
- //# sourceMappingURL=chunk-WE5RZHZ7.js.map
@@ -1,2 +0,0 @@
1
- import{existsSync as g,mkdirSync as R,symlinkSync as L,readlinkSync as S,unlinkSync as $,readdirSync as h}from"fs";import{join as a,dirname as f,resolve as d,relative as q,isAbsolute as T}from"path";import{homedir as m,platform as N}from"os";import{fileURLToPath as y}from"url";var U=N()==="win32",x=["codebaseiq","codebaseiq-explore","concrete-plan"];function P(i={}){let l=i.quiet?()=>{}:console.log,o=y(import.meta.url),u=d(f(o),"..","skills"),k=[a(m(),".claude","skills"),a(m(),".codex","skills"),a(m(),".agents","skills")],s={installed:[],skipped:[],alreadyLinked:[],pruned:[]};for(let t of k){let r=f(t);if(!g(r))continue;R(t,{recursive:!0});let e=v(t);j(t,u,e,s,l);for(let n of x){let p=a(u,n),c=a(t,n);if(!g(p)){s.skipped.push(`${e}/${n}`);continue}if(g(c)){try{let b=S(c);if(d(b)===d(p)){s.alreadyLinked.push(`${e}/${n}`),l(` ok: ${n} \u2192 ${e} (already linked)`);continue}}catch{s.skipped.push(`${e}/${n}`),l(` skip: ${n} \u2192 ${e} (exists, not a symlink)`);continue}$(c)}L(p,c,U?"junction":"dir"),s.installed.push(`${e}/${n}`),l(` done: ${n} \u2192 ${e}`)}}return s}function j(i,l,o,u,k){let s=new Set(x);for(let t of h(i)){if(s.has(t))continue;let r=a(i,t),e;try{e=d(f(r),S(r))}catch{continue}I(e,l)&&($(r),u.pruned.push(`${o}/${t}`),k(` prune: ${t} \u2192 ${o} (removed stale codebaseiq skill link)`))}}function _(i={}){let l=y(import.meta.url),o=d(f(l),"..","skills"),u=i.homeDir??m(),k=[a(u,".claude","skills"),a(u,".codex","skills"),a(u,".agents","skills")],s={removed:[],left:[],skipped:[]};for(let t of k){if(!g(t))continue;let r=v(t);for(let e of h(t)){let n=a(t,e),p;try{let c=S(n);p=d(f(n),c)}catch{s.left.push(`${r}/${e} (not a symlink)`);continue}if(!I(p,o)){s.left.push(`${r}/${e} (symlink outside codebaseiq package)`);continue}if(s.removed.push(`${r}/${e}`),!i.dryRun)try{$(n)}catch(c){s.skipped.push(`${r}/${e} (${c instanceof Error?c.message:String(c)})`)}}}return s}function I(i,l){let o=q(d(l),d(i));return o===""||!o.startsWith("..")&&!T(o)}function v(i){return i.includes(".codex")?"Codex":i.includes(".agents")?"Agents":"Claude"}function B(){console.log("codebaseiq installed (Node.js 24 LTS recommended; minimum Node.js 22) -- run 'codebaseiq setup' in a repo to install skills and build the index.")}export{x as a,P as b,_ as c,B as d};
2
- //# sourceMappingURL=chunk-YMGZZEW4.js.map
@@ -1,12 +0,0 @@
1
- import{e as V,f as X,m as A,o as H,p as Y,q as Q}from"./chunk-ZKX2FRS6.js";import{D as L,E as $,F as U,H as K,o as z,q as _,s as b,t as N}from"./chunk-NNJ2KZZG.js";import{spawn as Se}from"child_process";import{platform as Z}from"os";import{performance as ee}from"perf_hooks";var St={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},v=class extends Error{constructor(n,i,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=i;this.name="BoundedProcessError",this.timedOut=a.timedOut??!1,this.reaped=a.reaped??!1,this.stdout=a.stdout??"",this.stderr=a.stderr??"",this.stdoutTruncated=a.stdoutTruncated??!1,this.stderrTruncated=a.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function h(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function te(e,t,n,i){let s=Math.max(0,i-n);s>0&&e.push(t.subarray(0,s))}function ne(e,t,n){let i=Buffer.concat([...e,t]);e.length=0,e.push(i.subarray(Math.max(0,i.length-n)))}function Lt(e){h(e.timeoutMs,"timeoutMs"),h(e.maxStdoutBytes,"maxStdoutBytes"),h(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;h(t,"terminationGraceMs");let n=e.terminationForceMs??t;return h(n,"terminationForceMs"),new Promise((i,s)=>{let a=ee.now(),r;try{let c=Z()!=="win32";r=Se(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(c){s(new v("spawn",e.label,`${e.label} could not start.`,{cause:c,reaped:!0}));return}let u=[],d=[],o=0,g=0,l=!1,m=!1,p=null,y=!1,x=Z()!=="win32",G=r.pid===void 0?null:Y(r.pid,x),O=()=>{clearTimeout(q),e.signal?.removeEventListener("abort",E)},P=c=>{if(y||!p)return;y=!0,O();let f=Buffer.concat(u).toString("utf8"),I=Buffer.concat(d).toString("utf8"),M=c.reaped||!c.detail?"":` Process-tree cleanup failed: ${c.detail}`;s(new v(p.kind,e.label,`${p.message}${M}`,{timedOut:p.timedOut,reaped:c.reaped,stdout:f,stderr:I,stdoutTruncated:l,stderrTruncated:m}))},R=c=>{if(!(p||y)){if(p=c,!G){P({reaped:r.pid===void 0,reason:r.pid===void 0?"terminated":"identity-unavailable"});return}Q(G,{gracefulMs:t,forceMs:n}).then(P,f=>{P({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},q=setTimeout(()=>{R({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);q.unref();let E=()=>{R({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",E,{once:!0}),e.signal?.aborted&&E(),r.stdout.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ne(u,f,e.maxStdoutBytes):te(u,f,o,e.maxStdoutBytes),o+=f.length,o>e.maxStdoutBytes&&(l=!0,e.outputLimitBehavior!=="truncate-tail"&&R({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),r.stderr.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ne(d,f,e.maxStderrBytes):te(d,f,g,e.maxStderrBytes),g+=f.length,g>e.maxStderrBytes&&(m=!0,e.outputLimitBehavior!=="truncate-tail"&&R({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),r.on("error",c=>{if(!y&&!p){if(r.pid===void 0){O(),y=!0,s(new v("spawn",e.label,`${e.label} could not start: ${c.message}`,{cause:c,reaped:!0}));return}R({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${c.message}`})}}),r.on("close",(c,f)=>{if(y||p)return;y=!0,O();let I=Buffer.concat(u).toString("utf8"),M=Buffer.concat(d).toString("utf8");i({status:c,signal:f,stdout:I,stderr:M,timedOut:!1,durationMs:ee.now()-a,stdoutTruncated:l,stderrTruncated:m})}),e.input===void 0?r.stdin.end():r.stdin.end(e.input)})}import{execFileSync as ie}from"child_process";import{createRequire as Le}from"module";import{existsSync as Ae}from"fs";import{platform as B,arch as re}from"os";var S="v0.8.1",D="https://github.com/sourcegraph/scip",w=`github.com/sourcegraph/scip/cmd/scip@${S}`,se=Le(import.meta.url),ae="CODEBASEIQ_SCIP_BIN";function we(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[ae];if(t&&e.fileExists(t))return{source:"env",path:t};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function Te(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return se.resolve(`codebaseiq-windows/scip-win32-${t}.exe`)}catch{}return null}function J(e=process.env){let t=we({platform:B(),arch:re(),env:e,isOnPath:A,fileExists:Ae,resolveSidecar:Te});return t?.source==="path"?H("scip")??t.path:t?.path??null}function Et(){return J()!==null}function ke(){let e=J();if(!e)return null;try{return ie(e,["--version"],{stdio:"pipe",windowsHide:!0,timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function Oe(){let e=B(),t=re(),n,i,s;switch(e){case"darwin":n="darwin",s="tar.gz";break;case"linux":n="linux",s="tar.gz";break;default:return null}switch(t){case"arm64":i="arm64";break;case"x64":i="amd64";break;default:return null}let a=`scip-${n}-${i}.${s}`;return{url:`${D}/releases/download/${S}/${a}`,filename:a}}function It(){let e=Oe();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),B()==="darwin"||B()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${w}
2
- `),console.log("Or download that exact release manually:");else if(B()==="win32"){let t=Pe();console.log("On Windows the scip binary ships via the npm sidecar package codebaseiq-windows,"),console.log("installed automatically with codebaseiq. If it is missing:"),console.log(` npm install -g ${t}`),console.log(`Or set ${ae} to a local scip.exe path.
3
- `),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
4
- `:` ${D}/releases/tag/${S}
5
- `),console.log("After installing, ensure `scip` is on your PATH and run `codebaseiq reindex`.")}function Pe(){let t=se("../../package.json").optionalDependencies?.["codebaseiq-windows"];if(!t||!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(t))throw new Error("codebaseiq package metadata does not declare an exact Windows sidecar version.");return`codebaseiq-windows@${t}`}function Mt(e){if(A("go")){e(`Installing immutable ${w} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(ie("go",["install",w],{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env}),A("scip")){let t=J(),n=ke();if(t&&n&&n.includes(S))return e(`Successfully installed ${w}; resolved executable: ${t}; reported version: ${n}.`),!0;e(`go install completed, but the resolved scip executable did not report ${S} (executable: ${t??"unresolved"}; version: ${n??"unavailable"}).`)}}catch(t){let n=t instanceof Error?t.message:String(t);e(`go install failed: ${n}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${D}/releases`),!1}import{execFileSync as Ee}from"child_process";import{existsSync as Ie,readdirSync as ue}from"fs";import{extname as de,join as le}from"path";var ce=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Me=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function Jt(e){let t=[],n=_e(e),i=Je(e);for(let s of Me){if(Ne(e,s.files)){t.push(s.language);continue}if($e(n,s.globs)){t.push(s.language);continue}Ce(i,s.extensions)&&t.push(s.language)}return t.includes("typescript")&&oe(t,"javascript"),t.includes("cpp")&&!i.has(".c")&&oe(t,"c"),t}function _e(e){try{return ue(e)}catch{return[]}}function Ne(e,t){return t?.length?t.some(n=>Ie(le(e,n))):!1}function $e(e,t){return t?.length?e.some(n=>t.some(i=>De(n,i))):!1}function De(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,i]=t.split("*");return e.startsWith(n??"")&&e.endsWith(i??"")}function Je(e){let t=We(e);if(t)return t;let n=new Set,i=[e];for(;i.length>0;){let s=i.pop();if(!s)continue;let a;try{a=ue(s,{withFileTypes:!0})}catch{continue}for(let r of a){if(r.name.startsWith(".")&&!r.name.endsWith("proj")&&!r.name.endsWith("sln")&&r.isDirectory())continue;let u=le(s,r.name);if(r.isDirectory()){ce.has(r.name)||i.push(u);continue}let d=de(r.name).toLowerCase();d&&n.add(d)}}return n}function We(e){try{let t=Ee("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}),n=new Set;for(let i of t.split(`
6
- `)){if(!i||i.split("/").some(a=>ce.has(a)))continue;let s=de(i).toLowerCase();s&&n.add(s)}return n}catch{return null}}function Ce(e,t){return t?.length?t.some(n=>e.has(n)):!1}function oe(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as be,statSync as tt}from"fs";import{dirname as he,join as ve}from"path";import{appendFileSync as je,existsSync as Fe,mkdirSync as Ge,renameSync as qe,rmSync as ze,statSync as Ue,truncateSync as Ke}from"fs";import{basename as Ve,dirname as Xe}from"path";var T=".previous",He=".rotation.lock",Ye=2e3,W=class extends Error{constructor(n,i){super(`Timed out after ${i}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=i;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},C=class extends Error{constructor(n){super(`Rotating JSONL lock ownership changed before release: ${n}`);this.lockPath=n;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},ge=Object.freeze({monotonicNow:V,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=X(e,{kind:"rotating-jsonl",detail:{target:Ve(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){Ge(e,{recursive:!0})},exists:Fe,readBytes(e){return U(e,{maxBytes:L,inputKind:"rotating JSONL segment"})},size(e){return Ue(e).size},truncate:Ke,remove(e){ze(e,{force:!0})},rename:qe,append:je});function fe(e,t,n){let i=n.runtime??ge,s=JSON.stringify(t);if(s===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let a=Buffer.from(`${s}
7
- `),r=Math.max(1,Math.floor(n.maxSegmentBytes),a.length);return pe(e,n.lockTimeoutMs,i,()=>{i.makeDirectory(Xe(e));let u=Qe(e,L,i);n.onPhase?.("tail-repaired");let d=`${e}${n.previousSuffix??T}`,o=!1,g=!1;return i.exists(e)&&i.size(e)+a.length>r&&(i.exists(d)&&(i.remove(d),g=!0),n.onPhase?.("previous-pruned"),i.rename(e,d),o=!0,n.onPhase?.("current-rotated")),i.append(e,a),n.onPhase?.("record-appended"),{lineBytes:a.length,segmentLimitBytes:r,repairedTailBytes:u,rotated:o,prunedPrevious:g}})}function me(e,t={}){let n=t.runtime??ge,i=Ze(t.maxSegmentBytes);return pe(e,t.lockTimeoutMs,n,()=>{let s=[],a=0,r=`${e}${t.previousSuffix??T}`;for(let u of[r,e]){if(!n.exists(u))continue;let d=et(ye(u,i,n));s.push(...d.lines),a+=d.partialTailBytes}return{lines:s,ignoredPartialTailBytes:a}})}function pe(e,t,n,i){let s=`${e}${He}`,a=Math.max(0,t??Ye),r=n.monotonicNow()+a,u;for(;;){let m=n.tryAcquireLock(s,e);if(m.kind==="acquired"){u=m.lock;break}let p=r-n.monotonicNow();if(p<=0)throw new W(s,a);n.wait(Math.min(5,p))}let d=!1,o,g;try{g=i()}catch(m){d=!0,o=m}let l=!1;try{l=u.release()}catch(m){if(!d)throw m}if(d)throw o;if(!l)throw new C(s);return g}function Qe(e,t,n){if(!n.exists(e))return 0;let i=ye(e,t,n);if(i.length===0||i[i.length-1]===10)return 0;let s=i.lastIndexOf(10),a=s<0?0:s+1;return n.truncate(e,a),i.length-a}function Ze(e){let t=e??L;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function ye(e,t,n){let i=n.size(e);if(i>t)throw new $("rotating JSONL segment",e,"too-large",i,t);let s=n.readBytes(e),a=n.size(e);if(a!==i||s.byteLength!==i)throw new $("rotating JSONL segment",e,"changed-during-read",a,t);return s}function et(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
8
- `).filter(s=>s.length>0),partialTailBytes:e.length-n}}var nt="reindex-activity.jsonl",k=T,it=1024*1024,rt=1440*60*1e3,xe=e=>K(e,"reindex activity segment");function F(e){return ve(he(e),nt)}function st(e){if(e.reused)return 0;let t=j(e.indexPath)+j(e.dbPath);for(let n of e.shards??[])!n.reused&&n.outputBytes!==null&&(t+=n.outputBytes);return t}function Qt(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let i=st(t);return Be(F(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:i,estimatedWriteBytes:i+(t.writeTelemetry?.fallbackCopiedBytes??0),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,byLanguage:ct(t)})}function Zt(e,t){return Be(F(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function at(e,t,n=it,i){fe(e,t,{maxSegmentBytes:n,previousSuffix:k,...i?{runtime:i}:{}})}function ot(e,t=new Date,n=rt,i=xe){let s=t.getTime(),a=s-n,r={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(a).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,reused:0,failed:0,suppressed:0,estimatedLogicalOutputBytes:0,estimatedWriteBytes:0,reflinkedBytes:0,fallbackCopiedBytes:0,languageAttribution:"complete",attributedRuns:0,unattributedRuns:0,invalidLanguageDetails:0,byLanguage:{},byTrigger:{}},u=F(e),d=[];if(i===xe){if(!be(u)&&!be(`${u}${k}`))return r;try{let o=me(u,{previousSuffix:k});d=o.lines,r.ignoredPartialTailBytes=o.ignoredPartialTailBytes}catch{r.readErrors+=1,r.confidence="unavailable"}}else{let o=0;for(let g of[`${u}${k}`,u])try{d.push(...xt(i(g))),o+=1}catch{r.readErrors+=1}o===0?r.confidence="unavailable":r.readErrors>0&&(r.confidence="partial")}for(let o of d){r.recordsRead+=1;let g=ut(o);if(!g){r.invalidRecords+=1,r.confidence!=="unavailable"&&(r.confidence="partial");continue}let{record:l}=g,m=Date.parse(l.recordedAt);if(m<a||m>s){r.skippedRecords+=1;continue}if(r.invalidLanguageDetails=(r.invalidLanguageDetails??0)+g.invalidLanguageDetails,r.byTrigger[l.trigger.kind]=(r.byTrigger[l.trigger.kind]??0)+1,l.event==="suppressed"){r.suppressed+=1;continue}r.runs+=1,r[l.result]+=1,r.estimatedLogicalOutputBytes+=l.estimatedLogicalOutputBytes,r.estimatedWriteBytes=(r.estimatedWriteBytes??0)+(l.estimatedWriteBytes??l.estimatedLogicalOutputBytes),r.reflinkedBytes=(r.reflinkedBytes??0)+(l.reflinkedBytes??0),r.fallbackCopiedBytes=(r.fallbackCopiedBytes??0)+(l.fallbackCopiedBytes??0),l.result!=="failed"&&(g.hasLanguageDetails?r.attributedRuns=(r.attributedRuns??0)+1:r.unattributedRuns=(r.unattributedRuns??0)+1);for(let[p,y]of pt(l.byLanguage)){let x=(r.byLanguage??={})[p]??=yt();x.runs+=1,x[y.result]+=1,x.producedOutputBytes+=y.producedOutputBytes,x.durationMs+=y.durationMs}l.result==="rebuilt"&&r.oldestRebuildAt===void 0&&(r.oldestRebuildAt=l.recordedAt),(l.estimatedWriteBytes??l.estimatedLogicalOutputBytes)>0&&r.oldestWriteAt===void 0&&(r.oldestWriteAt=l.recordedAt)}return r.ignoredPartialTailBytes>0&&r.confidence!=="unavailable"&&(r.confidence="partial"),r.languageAttribution=bt(r),r}function Be(e,t){try{return at(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function ut(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!z(n.recordedAt)||!n.trigger||!lt(n.trigger.kind))return null;if(n.event==="suppressed")return n.reason==="completed-index-is-fresh"?{record:n,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(n.event!=="run"||n.result!=="rebuilt"&&n.result!=="reused"&&n.result!=="failed"||!b(n.durationMs)||!b(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!b(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!b(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!b(n.fallbackCopiedBytes))return null;let i=n,{byLanguage:s,...a}=i,r=gt(s);return{record:{...a,...r.byLanguage?{byLanguage:r.byLanguage}:{}},hasLanguageDetails:r.hasLanguageDetails,invalidLanguageDetails:r.invalidLanguageDetails}}catch{return null}}function en(e,t,n=new Date){return t.enabled?dt(ot(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function dt(e,t,n){let i=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,s={rebuilt:e.rebuilt,estimatedWriteBytes:i};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...s,detail:`reindex activity evidence is ${e.confidence}`}:e.rebuilt>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:Re(e.oldestRebuildAt,t.windowMs,n),...s,detail:`${e.rebuilt}/${t.maxRebuilds} automatic rebuild slots consumed`}:i>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:Re(e.oldestWriteAt,t.windowMs,n),...s,detail:`${i}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...s}:{state:"allowed",...s}}function Re(e,t,n){let i=e?Date.parse(e):Number.NaN;return Number.isFinite(i)&&i+t>n?i+t:n+t}function lt(e){return e==="manual-cli"||e==="setup"||e==="watch-source"||e==="watch-startup"||e==="watch-demand"||e==="watch-git-head"||e==="watch-git-index"||e==="watch-git-state"||e==="unknown"}function j(e){try{return tt(e).size}catch{return 0}}function ct(e){let t={};for(let n of e.languages){let i=(e.shards??[]).filter(o=>o.language===n),s=i.find(o=>o.id===n),a=e.reused||(s?s.reused:i.length>0&&i.every(o=>o.reused)),r=j(ve(he(e.dbPath),"language-indexes",`${n}.scip`)),u=r>0?r:s?.outputBytes??r,d=a?0:s?.durationMs??i.filter(o=>!o.reused).reduce((o,g)=>o+g.durationMs,0);t[n]={result:a?"reused":"rebuilt",outputBytes:u,producedOutputBytes:a?0:u,durationMs:d}}return t}function gt(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},n=0;for(let[s,a]of Object.entries(e)){if(!mt(s)||!ft(a)){n+=1;continue}t[s]=a}let i=Object.keys(t).length>0;return{...i?{byLanguage:t}:{},hasLanguageDetails:i,invalidLanguageDetails:n}}function ft(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&_(t.outputBytes)&&_(t.producedOutputBytes)&&b(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function mt(e){return N.includes(e)}function pt(e){return e?N.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function yt(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function bt(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function xt(e){return e.endsWith(`
9
- `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
10
- `)+1))),e.split(`
11
- `).filter(t=>t.length>0)}export{St as a,v as b,Lt as c,J as d,Et as e,ke as f,It as g,Mt as h,T as i,fe as j,Jt as k,nt as l,Qt as m,Zt as n,en as o};
12
- //# sourceMappingURL=chunk-YVCIMIOC.js.map
@@ -1,3 +0,0 @@
1
- import{I as je,L as Me,Q as Ne,R as Fe,a as J,b as ye,d as be,n as Pe,o as ke,q as Ae,r as Te}from"./chunk-QW7EP6WI.js";import{e as _e}from"./chunk-FM5BPL4V.js";import{a as f,c as he,g as y,l as Oe,p as we,q as Ee,u as z,v as $e,x as X,y as De}from"./chunk-RDBI2RXU.js";import{i as Se}from"./chunk-R2NOK63J.js";import{d as ve}from"./chunk-EF2R3WNQ.js";import{N as Ce,X as Re,a as le,b as fe,g as me,ga as Ie,h as F,j as ge,w as xe}from"./chunk-WE5RZHZ7.js";import{existsSync as W,statSync as Yn}from"fs";import{join as Wn}from"path";import{existsSync as E}from"fs";import{randomUUID as st}from"crypto";import{isAbsolute as tt,join as x,relative as nt,resolve as rt}from"path";var C=1,R=2,It="./node_modules/codebaseiq/docs/schemas/project-config.schema.json";function Q(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(a){return{kind:"malformed",reason:`invalid JSON: ${a instanceof Error?a.message:String(a)}`}}if(!f(t))return{kind:"malformed",reason:"project config must be a JSON object"};let n=t.schemaVersion;if(n!==void 0&&!Number.isInteger(n))return{kind:"malformed",reason:"schemaVersion must be an integer"};let r=n===void 0?C:n;if(r!==C&&r!==R)return{kind:"unsupported",schemaVersion:r,direction:r<C?"older":"future"};let i=t.$schema;if(i!==void 0&&(typeof i!="string"||i.trim()===""))return{kind:"malformed",reason:"$schema must be a non-empty string when present"};let o=$(t),s=r!==R||typeof t.$schema!="string";return r===C?{kind:"legacy",sourceVersion:C,config:o,needsMigration:s}:{kind:"supported",sourceVersion:R,config:o,needsMigration:s}}function $(e){let t=e,{$schema:n,schemaVersion:r,...i}=t;return{$schema:typeof n=="string"&&n.trim()!==""?n:It,schemaVersion:R,...i}}function Ve(e){return`${JSON.stringify($(e),null,2)}
2
- `}import{createHash as wt}from"crypto";var v=1,A=2,Ue=1,ne=1,te="sha256",Et=1;function ir(e,t,n){if(!y(e)||!Je(t))throw new Error("Observation identity requires a bounded projection name and positive projection version.");return{schemaVersion:Ue,canonicalizationVersion:ne,hashAlgorithm:te,projection:{name:e,version:t},digest:wt(te).update(Pt(e,t,n)).digest("hex")}}function Pt(e,t,n){return`{"canonicalizationVersion":${ne},"projection":${JSON.stringify(e)},"projectionVersion":${t},"value":${JSON.stringify(n)}}`}function kt(e){if(!f(e))return{kind:"malformed",reason:"observation receipt must be an object"};let t=e.schemaVersion;if(!Number.isInteger(t))return{kind:"malformed",reason:"observation receipt schemaVersion must be an integer"};if(t===v)return Ft(e)?{kind:"legacy",schemaVersion:v,receipt:e}:{kind:"malformed",reason:"observation receipt v1 fields are malformed or contradictory"};if(t===A)return $t(e)?{kind:"supported",schemaVersion:A,receipt:e}:{kind:"malformed",reason:"observation receipt v2 facts are malformed or contradictory"};let n=t;return{kind:"unsupported",schemaVersion:n,direction:n<v?"older":"future"}}function He(e){let t=kt(e);return t.kind==="legacy"||t.kind==="supported"}function At(e,t){return{collaborationDomain:w(b(e,n=>n.facts.collaborationDomain),b(t,n=>n.facts.collaborationDomain)),repositoryLineage:w(b(e,n=>n.facts.repositoryLineage),b(t,n=>n.facts.repositoryLineage)),workspaceInstance:w(b(e,n=>n.facts.workspaceInstance),b(t,n=>n.facts.workspaceInstance)),wholeContent:w(b(e,n=>n.facts.wholeContent),b(t,n=>n.facts.wholeContent)),relevantInputs:_t(e,t),indexInput:w(b(e,n=>n.facts.index?.inputs),b(t,n=>n.facts.index?.inputs)),indexGeneration:Tt(e,t),observationStability:Mt(e,t)}}function or(e,t,n=At(e,t)){let r=[["collaborationDomain",n.collaborationDomain],["wholeContent",n.wholeContent],["observationStability",n.observationStability]],i=[];for(let[s,a]of r)a.state!=="established"&&i.push(`${s}:${a.state}`);for(let[s,a]of[["left",e],["right",t]]){let c=Nt(a);c!=="not-applicable"&&c!=="established"&&i.push(`${s}IndexAlignment:${c}`)}let o=r.some(([,s])=>s.state==="disproven")||i.some(s=>s.endsWith(":disproven"));return{policyVersion:Et,authority:i.length===0?"completion":o?"none":"advisory",requiredRelationships:["collaborationDomain","wholeContent","observationStability"],reasons:i}}function _t(e,t){let n=qe(e),r=qe(t);return[...new Set([...n.keys(),...r.keys()])].sort().map(o=>{let s=n.get(o),a=r.get(o),c=s?.subject??a?.subject??o,p=s?.identity.projection.name??a?.identity.projection.name??o;return{subject:c,projection:p,judgment:w(s?.identity,a?.identity)}})}function qe(e){return e.schemaVersion!==A?new Map:new Map((e.facts.relevantInputs??[]).map(t=>[`${t.subject}\0${t.identity.projection.name}`,t]))}function Tt(e,t){return e.schemaVersion===v&&t.schemaVersion===v?jt(e.index?.generationIdentity,t.index?.generationIdentity):e.schemaVersion===v||t.schemaVersion===v?S("unknown",["legacy-fact-not-comparable"],Le(e),Le(t)):w(e.facts.index?.generation,t.facts.index?.generation)}function jt(e,t){let n=e?[{kind:"legacy-index-generation",value:e}]:[],r=t?[{kind:"legacy-index-generation",value:t}]:[];return e===void 0||t===void 0?Ye(n,r):S(e===t?"established":"disproven",[e===t?"identities-equal":"identities-different"],n,r)}function w(e,t){let n=e?[{kind:"identity",identity:e}]:[],r=t?[{kind:"identity",identity:t}]:[];return!e||!t?Ye(n,r):re(e,t)?S(e.digest===t.digest?"established":"disproven",[e.digest===t.digest?"identities-equal":"identities-different"],n,r):S("unknown",["identity-projections-not-comparable"],n,r)}function Mt(e,t){if(e.schemaVersion===v||t.schemaVersion===v)return S("unknown",["legacy-fact-not-comparable"],[],[]);let n=Ge(e),r=Ge(t),i=Be(e),o=Be(t);return i==="invalidated"||o==="invalidated"?S("disproven",[...i==="invalidated"?["left-observation-invalidated"]:[],...o==="invalidated"?["right-observation-invalidated"]:[]],n,r):i!=="fixed"||o!=="fixed"?S("unknown",[...i==="no-repository-source"?["left-observation-has-no-repository-source"]:i!=="fixed"?["left-observation-not-fixed"]:[],...o==="no-repository-source"?["right-observation-has-no-repository-source"]:o!=="fixed"?["right-observation-not-fixed"]:[]],n,r):S("established",["all-observed-sources-fixed"],n,r)}function Be(e){let t=e.observedSources.filter(r=>r.kind!=="process");if(t.length===0)return"no-repository-source";let n=new Map(e.stabilityProofs.map(r=>[r.source,r.kind]));return t.some(r=>n.get(r.kind)==="invalidated")?"invalidated":t.every(r=>{let i=n.get(r.kind);return i==="immutable"||i==="fixed-snapshot"})?"fixed":"unknown"}function Nt(e){if(e.schemaVersion!==A)return e.index?"unknown":"not-applicable";if(!e.observedSources.some(r=>r.kind==="index-generation"))return"not-applicable";let t=e.facts.index?.inputs;if(!t)return"unknown";let n=(e.facts.relevantInputs??[]).find(r=>re(r.identity,t))?.identity;return n?n.digest===t.digest?"established":"disproven":"unknown"}function b(e,t){return e.schemaVersion===A?t(e):void 0}function Le(e){return e.schemaVersion===v&&e.index?[{kind:"legacy-index-generation",value:e.index.generationIdentity}]:e.schemaVersion===A&&e.facts.index?[{kind:"identity",identity:e.facts.index.generation}]:[]}function Ge(e){return e.stabilityProofs.map(t=>({kind:"stability",proof:t}))}function Ye(e,t){let n=e.length===0&&t.length===0?"both-facts-missing":e.length===0?"left-fact-missing":"right-fact-missing";return S("unknown",[n],e,t)}function S(e,t,n,r){return{state:e,reasons:t,facts:{left:n,right:r}}}function re(e,t){return e.schemaVersion===t.schemaVersion&&e.canonicalizationVersion===t.canonicalizationVersion&&e.hashAlgorithm===t.hashAlgorithm&&e.projection.name===t.projection.name&&e.projection.version===t.projection.version}function Ft(e){if(!f(e))return!1;let t=e.index,n=e.worktree;return Ke(e.observedAt)&&y(e.projectIdentity)&&Ut(e.authorityKind)&&(t===void 0||f(t)&&y(t.generationIdentity)&&(t.source==="immutable"||t.source==="legacy")&&(t.alignment==="not-certified"||t.alignment==="leased"))&&(n===void 0||f(n)&&y(n.identity)&&typeof n.clean=="boolean"&&(n.headCommit===void 0||y(n.headCommit))&&(n.treeOid===void 0||y(n.treeOid)))&&Gt(e.authorityKind,t,n)}function $t(e){if(!f(e))return!1;let t=e.facts,n=e.observedSources,r=e.stabilityProofs;if(!Ke(e.observedAt)||!f(t)||!Array.isArray(n)||n.length===0||!n.every(Vt)||!ee(n,c=>c.kind)||!Array.isArray(r)||!r.every(qt)||!ee(r,c=>c.source)||r.some(c=>!n.some(p=>p.kind===c.source))||!r.every(c=>Lt(c,t))||["collaborationDomain","repositoryLineage","workspaceInstance","wholeContent"].some(c=>t[c]!==void 0&&!O(t[c])))return!1;let o=t.relevantInputs;if(o!==void 0&&(!Array.isArray(o)||!o.every(Dt)||!ee(o,c=>`${c.subject}\0${c.identity.projection.name}`)))return!1;let s=t.index;if(s!==void 0&&(!f(s)||!O(s.generation)||s.inputs!==void 0&&!O(s.inputs)||s.source!=="immutable"&&s.source!=="legacy"))return!1;let a=e.diagnostics;return(a===void 0||f(a)&&(a.clean===void 0||typeof a.clean=="boolean")&&(a.headCommit===void 0||y(a.headCommit))&&(a.treeOid===void 0||y(a.treeOid)))&&Bt(t,n)}function O(e){return!f(e)||!f(e.projection)?!1:e.schemaVersion===Ue&&e.canonicalizationVersion===ne&&e.hashAlgorithm===te&&y(e.projection.name)&&Je(e.projection.version)&&typeof e.digest=="string"&&/^[a-f0-9]{64}$/u.test(e.digest)}function Dt(e){return f(e)&&y(e.subject)&&O(e.identity)}function Vt(e){return f(e)&&We(e.kind)&&(e.identity===void 0||O(e.identity))}function qt(e){return f(e)&&We(e.source)&&(e.kind==="immutable"||e.kind==="fixed-snapshot"||e.kind==="bracketed"||e.kind==="not-established"||e.kind==="invalidated")}function Bt(e,t){let n=e.index,r=t.find(c=>c.kind==="index-generation");if(r){if(!f(n)||!O(n.generation)||r.identity&&!Z(r.identity,n.generation))return!1}else if(n!==void 0)return!1;let i=e.workspaceInstance,o=t.find(c=>c.kind==="live-workspace");if(o?.identity&&(!O(i)||!Z(o.identity,i)))return!1;let s=e.wholeContent,a=t.find(c=>c.kind==="repository-snapshot");return!(a?.identity&&(!O(s)||!Z(a.identity,s)))}function Lt(e,t){return e.kind==="not-established"||e.kind==="invalidated"?!0:e.source==="index-generation"?e.kind==="immutable"&&f(t.index)&&t.index.source==="immutable":e.source==="repository-snapshot"?e.kind==="fixed-snapshot":e.source==="live-workspace"?e.kind==="bracketed":!1}function Z(e,t){return re(e,t)&&e.digest===t.digest}function Gt(e,t,n){return e==="index-worktree"?t!==void 0&&n!==void 0:e==="index-only"?t!==void 0&&n===void 0:e==="worktree-only"?t===void 0&&n!==void 0:e==="process-local"&&t===void 0&&n===void 0}function Ut(e){return e==="index-worktree"||e==="index-only"||e==="worktree-only"||e==="process-local"}function We(e){return e==="index-generation"||e==="repository-snapshot"||e==="live-workspace"||e==="process"}function Ke(e){return typeof e=="string"&&!Number.isNaN(Date.parse(e))}function Je(e){return Number.isSafeInteger(e)&&e>0}function ee(e,t){return new Set(e.map(t)).size===e.length}function D(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.kind==="automated-adjudication"&&t.policyVersion===1&&(t.decidedBy==="agent"||t.decidedBy==="human")&&ye.includes(t.reasonCode)&&Array.isArray(t.evidence)&&t.evidence.length>0&&t.evidence.every(Ht)&&(t.observation===void 0||He(t.observation))&&!!t.invalidateOn&&typeof t.invalidateOn=="object"&&typeof t.invalidateOn.targetContentChange=="boolean"&&typeof t.invalidateOn.detectorMajorChange=="boolean"}function Ht(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return(t.kind==="source"||t.kind==="config"||t.kind==="test"||t.kind==="graph")&&typeof t.referent=="string"&&t.referent.trim()!==""&&typeof t.claim=="string"&&t.claim.trim()!==""&&(t.contentHash===void 0||/^[a-f0-9]{64}$/u.test(t.contentHash))&&(t.generation===void 0||typeof t.generation=="string"&&t.generation.length>0)}var V=class extends Error{constructor(n,r,i){super(`${n} is ${r} characters; the safety limit is ${i} characters`);this.inputKind=n;this.observedCharacters=r;this.limitCharacters=i;this.name="RegExpPatternBudgetError"}inputKind;observedCharacters;limitCharacters;code="CODEBASEIQ_REGEXP_PATTERN_BUDGET"};function ie(e,t,n,r=4096){if(!Number.isSafeInteger(r)||r<0)throw new RangeError(`maxCharacters must be a non-negative safe integer; received ${r}`);if(e.length>r)throw new V(t,e.length,r);return new RegExp(e,n)}import{createHash as ze}from"crypto";import{closeSync as Yt,fstatSync as Xe,openSync as Wt,rmSync as Kt}from"fs";import{dirname as Jt}from"path";var zt=2e3,Xt=10,Qt=3,B=class extends Error{constructor(n,r,i){super(`Concurrent edit detected for ${n}; expected revision ${Ze(r)}, but found ${Ze(i)}. The latest file was left untouched.`);this.path=n;this.original=r;this.latest=i;this.name="FileRevisionConflictError"}path;original;latest},T=class extends Error{constructor(n,r){super(`Concurrent edit detected for ${n}: ${r} changed since it was read. The latest file was left untouched; reload it and retry.`);this.path=n;this.field=r;this.name="FileContentConflictError"}path;field};function j(e,t,n={}){let r=Zt(e,n.lockTimeoutMs??zt,n.monotonicNow??ve);try{let i=Math.max(0,Math.floor(n.maxRetries??Qt));for(let o=0;;o+=1){let s=q(e),a=t(s,o);if(a.kind==="unchanged")return{changed:!1,attempts:o+1,previous:s,current:s};n.onBeforeCommit?.({attempt:o,snapshot:s,mutation:a});let c=q(e);if(!tn(s.revision,c.revision)){if(o<i)continue;throw new B(e,s.revision,c.revision)}try{en(e,a,s.revision)}catch(p){if(p.code==="EEXIST"){let l=q(e);if(o<i)continue;throw new B(e,s.revision,l.revision)}throw p}return{changed:!0,attempts:o+1,previous:s,current:q(e)}}}finally{r.release()}}function q(e){for(let t=0;t<4;t+=1){let n;try{n=Wt(e,"r");let r=Qe(Xe(n)),i=ge(n,{maxBytes:fe,inputKind:"revisioned text file"}),o=Qe(Xe(n));if(!et(r,o))continue;return{path:e,text:i,revision:{exists:!0,hash:ze("sha256").update(i).digest("hex"),identity:o}}}catch(r){if(r.code==="ENOENT")return{path:e,text:"",revision:{exists:!1,hash:ze("sha256").update("").digest("hex")}};throw r}finally{n!==void 0&&Yt(n)}}throw new Error(`Could not read a stable revision of ${e}; the file is changing continuously.`)}function Zt(e,t,n){let r=`${e}.codebaseiq-write.lock`,i=n()+Math.max(0,t);for(;;){let o=Oe(r,{kind:"revisioned-file-mutation",detail:{target:e}});if(o.kind==="acquired")return o.lock;if(n()>=i)throw new Error(`Timed out after ${t}ms waiting to update ${e}; the file was left untouched.`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,Xt)}}function en(e,t,n){if(t.kind==="delete"){if(!n.exists)return;Kt(e),xe(Jt(e));return}let r=t.mode??n.identity?.mode;n.exists?we(e,t.text,{durability:"durable",mode:r}):Ee(e,t.text,{durability:"durable",mode:r})}function tn(e,t){return e.exists===t.exists&&e.hash===t.hash&&(e.identity===void 0?t.identity===void 0:t.identity!==void 0&&et(e.identity,t.identity))}function Qe(e){return{dev:e.dev,ino:e.ino,size:e.size,mtimeMs:e.mtimeMs,mode:e.mode&511}}function et(e,t){return e.dev===t.dev&&e.ino===t.ino&&e.size===t.size&&e.mtimeMs===t.mtimeMs&&e.mode===t.mode}function Ze(e){return e.exists?e.hash.slice(0,12):"<absent>"}var I=".codebaseiq.json",at=2e3,L=5e3,oe=L,se=3*6e4,nn=60*6e4,ae={enabled:!0,windowMs:15*6e4,maxRebuilds:2,maxEstimatedWriteBytes:1024*1024*1024},rn={enabled:!1,debounceMs:at,cooldownMs:oe,gitPollMs:2e3,idleTimeoutMs:se,autoRefresh:!0,ignore:[],resourceBudget:ae};var on=new Set(["$schema","schemaVersion","collaborationDomainId","languages","indexerConcurrency","watch","indexer","dbPath","entryRoots","semantic","suppressions","declaredCouplings","locality","architecture","coverageContracts","docs"]),sn=new Set(["enabled","debounceMs","cooldownMs","gitPollMs","idleTimeoutMs","autoRefresh","ignore","resourceBudget"]),an=new Set(["enabled","windowMs","maxRebuilds","maxEstimatedWriteBytes"]),cn=new Set(["pathPrefixes","files","symbolPatterns","qualifiedVars"]),dn=new Set(["typescript","rust"]),un=new Set(["tsconfigs"]),pn=new Set(["rustAnalyzerPath"]),it=new Set(J),ln=new Set(["pnpmWorkspaces","projectMode","projects","configPath"]),fn=new Set(["architecturalBoundarySegments"]),mn=new Set(["boundaries","allowedDependencies","requireCompletePolicy","requireCompleteCoverage","requireAcyclic","requireResolvedBoundaries","requireMinimalPolicy","maxBoundaryFanOut","maxBoundaryFiles","testPaths"]),gn=new Set(["name","paths","subUnits","maxFiles"]),hn=new Set(["snapshotPaths"]),yn=new Set(["name","files","reason"]),bn=new Set(["id","check","file","reason","expiresAt","createdAt","decision"]),vn=new Set(["kind","reasonCode","decidedBy","policyVersion","observation","evidence","invalidateOn"]),Sn=new Set(["kind","referent","claim","contentHash","generation"]),xn=new Set(["targetContentChange","detectorMajorChange"]),Cn=new Set(["name","file","keys","mustEqual","allowExtra"]),Rn=new Set(["type","identifier","marker"]),On=new Set(["type","path","pattern"]),In=new Set(["object-literal-keys","string-array","markdown-list"]),wn=new Set(["top-level-dirs","file-glob","registered-commands","builtin-skills"]);function ct(e){let t=x(e,I);if(!E(t))return{};let n;try{n=me(t,{maxBytes:le,inputKind:"codebaseiq project config"})}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(`unable to read ${I} at ${t}: ${i}`,{cause:r})}return ut(Q(n),t,"read").config}function Tr(e,t={}){let n=[];_n(e,n);let r=e;r.schemaVersion!==void 0&&r.schemaVersion!==R&&n.push({level:"error",path:"schemaVersion",message:`Must be ${R}; unversioned and v${C} files are migrated while loading.`}),r.$schema!==void 0&&(typeof r.$schema!="string"||r.$schema.trim()==="")&&n.push({level:"error",path:"$schema",message:"Must be a non-empty string."}),e.collaborationDomainId!==void 0&&!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/iu.test(e.collaborationDomainId)&&n.push({level:"error",path:"collaborationDomainId",message:"Must be a lowercase or uppercase UUID v4 generated for this collaboration domain."});let i=new Set(J);for(let[l,d]of(e.languages??[]).entries())i.has(d)||n.push({level:"error",path:`languages[${l}]`,message:`Unsupported language: ${d}`});for(let[l,d]of(e.entryRoots?.symbolPatterns??[]).entries())try{ie(d,`entryRoots.symbolPatterns[${l}]`)}catch(u){n.push({level:"error",path:`entryRoots.symbolPatterns[${l}]`,message:u instanceof Error?u.message:String(u)})}e.indexerConcurrency!==void 0&&(!Number.isInteger(e.indexerConcurrency)||e.indexerConcurrency<=0)&&n.push({level:"error",path:"indexerConcurrency",message:"Must be a positive integer."}),e.watch?.debounceMs!==void 0&&e.watch.debounceMs<=0&&n.push({level:"error",path:"watch.debounceMs",message:"Must be greater than 0."}),e.watch?.cooldownMs!==void 0&&(!Number.isInteger(e.watch.cooldownMs)||e.watch.cooldownMs<0)?n.push({level:"error",path:"watch.cooldownMs",message:"Must be a non-negative integer."}):e.watch?.cooldownMs!==void 0&&e.watch.cooldownMs<L&&n.push({level:"warning",path:"watch.cooldownMs",message:`Values below ${L}ms are raised to the safety floor at runtime.`}),e.watch?.gitPollMs!==void 0&&e.watch.gitPollMs<=0&&n.push({level:"error",path:"watch.gitPollMs",message:"Must be greater than 0."}),e.watch?.idleTimeoutMs!==void 0&&(!Number.isInteger(e.watch.idleTimeoutMs)||e.watch.idleTimeoutMs<0)&&n.push({level:"error",path:"watch.idleTimeoutMs",message:"Must be a non-negative integer; 0 disables idle shutdown."}),e.watch?.autoRefresh!==void 0&&typeof e.watch.autoRefresh!="boolean"&&n.push({level:"error",path:"watch.autoRefresh",message:"Must be a boolean."});let o=e.watch?.resourceBudget;o?.enabled!==void 0&&typeof o.enabled!="boolean"&&n.push({level:"error",path:"watch.resourceBudget.enabled",message:"Must be a boolean."});for(let[l,d]of[["windowMs",o?.windowMs],["maxRebuilds",o?.maxRebuilds],["maxEstimatedWriteBytes",o?.maxEstimatedWriteBytes]])d!==void 0&&(!Number.isSafeInteger(d)||d<=0)&&n.push({level:"error",path:`watch.resourceBudget.${l}`,message:"Must be a positive safe integer."});let s=e.indexer?.typescript;if(s?.projectMode!==void 0&&s.projectMode!=="single"&&s.projectMode!=="workspace"&&n.push({level:"error",path:"indexer.typescript.projectMode",message:'Must be "single" or "workspace".'}),s?.projects!==void 0)if(!Array.isArray(s.projects))n.push({level:"error",path:"indexer.typescript.projects",message:"Must be an array."});else for(let[l,d]of s.projects.entries()){let u=`indexer.typescript.projects[${l}]`;if(typeof d!="string"||d.trim()==="")n.push({level:"error",path:u,message:"Project path must be a non-empty string."});else if(t.projectRoot){let m=rt(t.projectRoot,d),h=nt(t.projectRoot,m);h.startsWith("..")||tt(h)?n.push({level:"error",path:u,message:"Project path must stay inside the project root."}):E(m)||n.push({level:"warning",path:u,message:`TypeScript project path does not exist: ${d}`})}}s?.projectMode==="workspace"&&s.pnpmWorkspaces===!0&&n.push({level:"warning",path:"indexer.typescript.pnpmWorkspaces",message:'Ignored when projectMode is "workspace"; explicit TypeScript projects are indexed directly.'});let a=e.semantic?.rust;a?.rustAnalyzerPath!==void 0&&(typeof a.rustAnalyzerPath!="string"||a.rustAnalyzerPath.trim()==="")&&n.push({level:"error",path:"semantic.rust.rustAnalyzerPath",message:"Rust analyzer path must be a non-empty string."});let c=e.indexer?.clojure;if(c?.configPath!==void 0){let l="indexer.clojure.configPath";if(typeof c.configPath!="string"||c.configPath.trim()==="")n.push({level:"error",path:l,message:"Config path must be a non-empty string."});else if(t.projectRoot){let d=rt(t.projectRoot,c.configPath),u=nt(t.projectRoot,d);u.startsWith("..")||tt(u)?n.push({level:"error",path:l,message:"Config path must stay inside the project root."}):E(d)||n.push({level:"warning",path:l,message:`Clojure indexer config path does not exist: ${c.configPath}`})}}if(e.locality!==void 0)if(!f(e.locality))n.push({level:"error",path:"locality",message:"Must be an object."});else{let l=e.locality.architecturalBoundarySegments;if(l!==void 0)if(!Array.isArray(l))n.push({level:"error",path:"locality.architecturalBoundarySegments",message:"Must be an array."});else for(let[d,u]of l.entries()){let m=`locality.architecturalBoundarySegments[${d}]`;typeof u!="string"||u.trim()===""?n.push({level:"error",path:m,message:"Boundary segment must be a non-empty string."}):(u.includes("/")||u.includes("\\"))&&n.push({level:"error",path:m,message:"Boundary segment must be a single folder name, not a path."})}}if(En(e,n),e.declaredCouplings!==void 0&&!Array.isArray(e.declaredCouplings))n.push({level:"error",path:"declaredCouplings",message:"Must be an array."});else for(let[l,d]of(e.declaredCouplings??[]).entries()){let u=`declaredCouplings[${l}]`;if((!d.name||d.name.trim()==="")&&n.push({level:"error",path:`${u}.name`,message:"Declared coupling name is required."}),!Array.isArray(d.files)||d.files.length<2)n.push({level:"error",path:`${u}.files`,message:"Declared coupling needs at least two files."});else for(let[m,h]of d.files.entries())!h||h.trim()===""?n.push({level:"error",path:`${u}.files[${m}]`,message:"Declared coupling file path is required."}):t.projectRoot&&!E(x(t.projectRoot,h))&&n.push({level:"warning",path:`${u}.files[${m}]`,message:`Declared coupling file does not exist: ${h}`});d.reason!==void 0&&d.reason.trim()===""&&n.push({level:"error",path:`${u}.reason`,message:"Declared coupling reason cannot be blank."})}let p=t.now??new Date;e.suppressions!==void 0&&!Array.isArray(e.suppressions)&&n.push({level:"error",path:"suppressions",message:"Must be an array."});for(let[l,d]of(Array.isArray(e.suppressions)?e.suppressions:[]).entries()){let u=`suppressions[${l}]`;if(!f(d)){n.push({level:"error",path:u,message:"Suppression must be an object."});continue}if((!d.reason||d.reason.trim()==="")&&n.push({level:"error",path:`${u}.reason`,message:"Suppression reason is required."}),d.id!==void 0&&d.id.trim()===""&&n.push({level:"error",path:`${u}.id`,message:"Suppression id cannot be blank."}),d.check!==void 0&&d.check.trim()===""&&n.push({level:"error",path:`${u}.check`,message:"Suppression check cannot be blank."}),!d.id&&(!d.check||!d.file)?n.push({level:"error",path:u,message:"Suppression must include id or both check and file."}):!d.id&&d.check&&d.file&&n.push({level:"warning",path:u,message:"Check+file suppressions waive every matching finding in that file; prefer a stable id when available."}),d.file!==void 0&&(d.file.trim()===""?n.push({level:"error",path:`${u}.file`,message:"Suppression file path cannot be blank."}):t.projectRoot&&!E(x(t.projectRoot,d.file))&&n.push({level:"warning",path:`${u}.file`,message:`Suppression file does not exist: ${d.file}`})),d.expiresAt){let m=Date.parse(d.expiresAt);Number.isNaN(m)?n.push({level:"error",path:`${u}.expiresAt`,message:"Must be an ISO date string."}):m<=p.getTime()&&n.push({level:"warning",path:`${u}.expiresAt`,message:"Suppression has expired."})}if(d.decision!==void 0&&!D(d.decision))n.push({level:"error",path:`${u}.decision`,message:"Must be a valid automated-adjudication decision with reason code, evidence, and invalidation rules."});else if(d.decision&&t.projectRoot)for(let[m,h]of d.decision.evidence.entries())h.kind!=="graph"&&!E(x(t.projectRoot,h.referent))&&n.push({level:"error",path:`${u}.decision.evidence[${m}].referent`,message:`Suppression counterevidence does not exist: ${h.referent}`})}return An(e,n,t),kn(e,n),n}function En(e,t){if(e.architecture===void 0)return;if(!f(e.architecture)){t.push({level:"error",path:"architecture",message:"Must be an object."});return}let n=e.architecture.boundaries;if(!Array.isArray(n)||n.length===0){t.push({level:"error",path:"architecture.boundaries",message:"Must be a non-empty array."});return}let r=new Set,i=new Set;for(let[a,c]of n.entries()){let p=`architecture.boundaries[${a}]`;if(!f(c)){t.push({level:"error",path:p,message:"Architecture boundary must be an object."});continue}let l=c.name;typeof l!="string"||l.trim()===""?t.push({level:"error",path:`${p}.name`,message:"Boundary name is required."}):r.has(l)?t.push({level:"error",path:`${p}.name`,message:`Duplicate boundary name: ${l}`}):r.add(l);let d=c.subUnits;d!==void 0&&d!=="directory"&&d!=="file"&&t.push({level:"error",path:`${p}.subUnits`,message:"Must be 'directory' or 'file'."});let u=c.maxFiles;u!==void 0&&(typeof u!="number"||!Number.isInteger(u)||u<0)&&t.push({level:"error",path:`${p}.maxFiles`,message:"Must be a non-negative integer."});let m=c.paths;if(!Array.isArray(m)||m.length===0){t.push({level:"error",path:`${p}.paths`,message:"Boundary paths must be a non-empty array."});continue}for(let[h,k]of m.entries()){let K=`${p}.paths[${h}]`;if(typeof k!="string"||k.trim()===""){t.push({level:"error",path:K,message:"Boundary path must be a non-empty string."});continue}Pn(k)||t.push({level:"error",path:K,message:"Boundary path must be project-relative and may use only one trailing /* or /** glob."}),i.has(k)?t.push({level:"error",path:K,message:`Duplicate boundary path: ${k}`}):i.add(k)}}let o=e.architecture.allowedDependencies;if(o!==void 0&&!f(o))t.push({level:"error",path:"architecture.allowedDependencies",message:"Must be an object keyed by boundary name."});else if(f(o))for(let[a,c]of Object.entries(o)){let p=`architecture.allowedDependencies.${a}`;if(r.has(a)||t.push({level:"error",path:p,message:`Unknown source boundary: ${a}`}),!Array.isArray(c)){t.push({level:"error",path:p,message:"Dependency row must be an array."});continue}let l=new Set;for(let[d,u]of c.entries()){let m=`${p}[${d}]`;typeof u!="string"||u.trim()===""?t.push({level:"error",path:m,message:"Target boundary name is required."}):r.has(u)?l.has(u)?t.push({level:"error",path:m,message:`Duplicate target boundary: ${u}`}):l.add(u):t.push({level:"error",path:m,message:`Unknown target boundary: ${u}`})}}e.architecture.requireAcyclic!==void 0&&typeof e.architecture.requireAcyclic!="boolean"&&t.push({level:"error",path:"architecture.requireAcyclic",message:"Must be a boolean."});for(let a of["requireCompleteCoverage","requireResolvedBoundaries","requireMinimalPolicy"])e.architecture[a]!==void 0&&typeof e.architecture[a]!="boolean"&&t.push({level:"error",path:`architecture.${a}`,message:"Must be a boolean."});for(let a of["maxBoundaryFanOut","maxBoundaryFiles"]){let c=e.architecture[a];c!==void 0&&(typeof c!="number"||!Number.isInteger(c)||c<0)&&t.push({level:"error",path:`architecture.${a}`,message:"Must be a non-negative integer."})}let s=e.architecture.testPaths;if(s!==void 0&&(!Array.isArray(s)||s.some(a=>typeof a!="string"))&&t.push({level:"error",path:"architecture.testPaths",message:"Must be an array of strings."}),e.architecture.requireCompletePolicy!==void 0&&typeof e.architecture.requireCompletePolicy!="boolean")t.push({level:"error",path:"architecture.requireCompletePolicy",message:"Must be a boolean."});else if(e.architecture.requireCompletePolicy===!0){let a=f(o)?o:{};for(let c of[...r].sort())Object.hasOwn(a,c)||t.push({level:"error",path:`architecture.allowedDependencies.${c}`,message:"A dependency row is required by architecture.requireCompletePolicy."})}}function Pn(e){let t=e.replace(/\\/g,"/");if(t.startsWith("/")||t==="."||t===".."||t.split("/").includes(".."))return!1;let n=t.replace(/\/\*\*?$/,"");return n.length>0&&!/[*?[\]]/.test(n)}function kn(e,t){let n=e.docs?.snapshotPaths;if(n!==void 0){if(!Array.isArray(n)){t.push({level:"error",path:"docs.snapshotPaths",message:"Must be an array."});return}for(let[r,i]of n.entries())(typeof i!="string"||i.trim()==="")&&t.push({level:"error",path:`docs.snapshotPaths[${r}]`,message:"Snapshot path glob must be a non-empty string."})}}function An(e,t,n){if(e.coverageContracts!==void 0){if(!Array.isArray(e.coverageContracts)){t.push({level:"error",path:"coverageContracts",message:"Must be an array."});return}for(let[r,i]of e.coverageContracts.entries()){let o=`coverageContracts[${r}]`;if(!f(i)){t.push({level:"error",path:o,message:"Coverage contract must be an object."});continue}(typeof i.name!="string"||i.name.trim()==="")&&t.push({level:"error",path:`${o}.name`,message:"Coverage contract name is required."}),typeof i.file!="string"||i.file.trim()===""?t.push({level:"error",path:`${o}.file`,message:"Coverage contract file is required."}):n.projectRoot&&!E(x(n.projectRoot,i.file))&&t.push({level:"warning",path:`${o}.file`,message:`Coverage contract file does not exist: ${i.file}`}),ot(t,i.keys,`${o}.keys`,In,"Unknown coverage-contract key extractor type."),ot(t,i.mustEqual,`${o}.mustEqual`,wn,"Unknown coverage-contract ground-truth source type."),i.allowExtra!==void 0&&typeof i.allowExtra!="boolean"&&t.push({level:"error",path:`${o}.allowExtra`,message:"Must be a boolean."})}}}function ot(e,t,n,r,i){if(!f(t)){e.push({level:"error",path:n,message:'Must be an object with a "type" field.'});return}if(typeof t.type!="string"||!r.has(t.type)){e.push({level:"error",path:`${n}.type`,message:`${i} Got: ${String(t.type)}`});return}let o={"object-literal-keys":["identifier"],"string-array":["identifier"],"markdown-list":["marker"],"top-level-dirs":["path"],"file-glob":["pattern"],"registered-commands":[],"builtin-skills":[]};for(let s of o[t.type]??[])(typeof t[s]!="string"||t[s].length===0)&&e.push({level:"error",path:`${n}.${s}`,message:`"${t.type}" requires a non-empty string "${s}".`})}function jr(e){return{...rn,...e.watch,idleTimeoutMs:e.watch?.idleTimeoutMs??(e.daemon?.enabled===!0?nn:se),cooldownMs:Math.max(L,e.watch?.cooldownMs??oe),resourceBudget:{...ae,...e.watch?.resourceBudget}}}function Mr(e,t){let n=x(e,I),r=st(),i={collaborationDomainId:r,languages:t,watch:{enabled:!0,debounceMs:at,cooldownMs:oe,gitPollMs:2e3,idleTimeoutMs:se,autoRefresh:!0,resourceBudget:{...ae}}},o=j(n,s=>{if(!s.revision.exists)return{kind:"write",text:M(i)};let a=U(s,i);return a.config.collaborationDomainId?{kind:"unchanged"}:{kind:"write",text:M({...a.config,collaborationDomainId:r})}});return{configPath:n,changed:o.changed}}function Nr(e,t,n=st()){let r=x(e,I),i=t,o=j(r,s=>{let a=U(s,t);if(a.config.collaborationDomainId)return i=a.config,{kind:"unchanged"};let c={...a.config,collaborationDomainId:n};return i=c,{kind:"write",text:M(c)}});return{configPath:r,config:i,changed:o.changed}}function Fr(e,t,n){let r=x(e,I),i=[...n],o=t,s=j(r,a=>{let c=U(a,t);if(dt(t.languages,c.config.languages,i))throw new T(r,"languages");let p={...c.config,languages:i};return o=p,a.revision.exists&&!c.needsMigration&&G(p,c.config)?{kind:"unchanged"}:{kind:"write",text:M(p)}});return{configPath:r,config:o,changed:s.changed}}function $r(e,t,n){let r=x(e,I),i=t,o=j(r,s=>{let a=U(s,t);if(dt(t.watch?.enabled,a.config.watch?.enabled,n))throw new T(r,"watch.enabled");let c={...a.config,watch:{...a.config.watch,enabled:n,...n&&a.config.watch?.autoRefresh===void 0?{autoRefresh:!0}:{}}};return i=c,s.revision.exists&&!a.needsMigration&&G(c,a.config)?{kind:"unchanged"}:{kind:"write",text:M(c)}});return{configPath:r,config:i,changed:o.changed}}function U(e,t){if(!e.revision.exists)return{config:$(t),needsMigration:!0};let n=ut(Q(e.text),e.path,"update");return{config:n.config,needsMigration:n.needsMigration}}function M(e){return Ve(e)}function G(e,t){return JSON.stringify(e)===JSON.stringify(t)}function dt(e,t,n){return!G(e,t)&&!G(t,n)}function ut(e,t,n){if(e.kind==="legacy"||e.kind==="supported")return e;if(e.kind==="malformed"){let i=n==="read"?`invalid ${I} at ${t}: ${e.reason}`:`Cannot update ${t}: the latest project config is ${e.reason}.`;throw new Error(`${i} The file was left untouched.`)}let r=n==="read"?`invalid ${I} at ${t}`:`Cannot update ${t}: the latest project config is invalid`;throw new Error(`${r} (unsupported ${e.direction} schemaVersion ${e.schemaVersion}; this codebaseiq reads legacy v${C} and current v${R}). Upgrade codebaseiq before retrying; the file was left untouched.`)}function _n(e,t){if(!f(e))return;let n=e;if(g(t,n,"",on),g(t,n.watch,"watch",sn),g(t,n.watch?.resourceBudget,"watch.resourceBudget",an),g(t,n.entryRoots,"entryRoots",cn),g(t,n.semantic,"semantic",dn),g(t,n.semantic?.typescript,"semantic.typescript",un),g(t,n.semantic?.rust,"semantic.rust",pn),g(t,n.locality,"locality",fn),g(t,n.architecture,"architecture",mn),g(t,n.docs,"docs",hn),Array.isArray(n.architecture?.boundaries))for(let[r,i]of n.architecture.boundaries.entries())g(t,i,`architecture.boundaries[${r}]`,gn);if(f(n.indexer)){g(t,n.indexer,"indexer",it);for(let[r,i]of Object.entries(n.indexer))it.has(r)&&g(t,i,`indexer.${r}`,ln)}if(Array.isArray(n.declaredCouplings))for(let[r,i]of n.declaredCouplings.entries())g(t,i,`declaredCouplings[${r}]`,yn);if(Array.isArray(n.suppressions)){for(let[r,i]of n.suppressions.entries())if(g(t,i,`suppressions[${r}]`,bn),f(i.decision)){if(g(t,i.decision,`suppressions[${r}].decision`,vn),Array.isArray(i.decision.evidence))for(let[o,s]of i.decision.evidence.entries())g(t,s,`suppressions[${r}].decision.evidence[${o}]`,Sn);g(t,i.decision.invalidateOn,`suppressions[${r}].decision.invalidateOn`,xn)}}if(Array.isArray(n.coverageContracts))for(let[r,i]of n.coverageContracts.entries()){let o=`coverageContracts[${r}]`;g(t,i,o,Cn),f(i)&&(g(t,i.keys,`${o}.keys`,Rn),g(t,i.mustEqual,`${o}.mustEqual`,On))}}function g(e,t,n,r){if(f(t))for(let i of Object.keys(t))r.has(i)||e.push({level:"warning",path:n?`${n}.${i}`:i,message:"Unknown config key."})}import{existsSync as pt}from"fs";function lt(e,t,n){let r=new Date().toISOString();if(!pt(n.dbPath))return{state:"missing",checkedAt:r,metaPath:n.metaPath,reason:"No SQLite index database exists.",remedy:"Run: codebaseiq reindex"};if(!pt(n.metaPath))return{state:"unknown",checkedAt:r,metaPath:n.metaPath,reason:"No reindex metadata file exists next to the SQLite index.",remedy:"Run: codebaseiq reindex"};try{let i=be(F(n.metaPath,"reindex metadata"));if(i.kind==="unsupported")return{state:"unknown",checkedAt:r,metaPath:n.metaPath,reason:`Reindex metadata version ${i.version} is unsupported by this codebaseiq build.`,remedy:"Upgrade codebaseiq or run: codebaseiq reindex"};if(i.kind==="malformed")return{state:"unknown",checkedAt:r,metaPath:n.metaPath,reason:`Could not decode reindex metadata: ${i.reason}`,remedy:"Run: codebaseiq reindex"};let o=i.metadata,s=t.languages??Te(e),a=Tn(e,s,t),c=[...o.indexedLanguages??[]].sort(),p=i.capabilities.publishableGeneration&&JSON.stringify(o.fingerprint)===JSON.stringify(a)&&JSON.stringify(c)===JSON.stringify(a.languages),l=je(n.dbPath,n.metaPath),d=l.state==="invalid"||l.state==="drifted",u=p&&!d;return{state:u?"fresh":"stale",checkedAt:r,metaPath:n.metaPath,updatedAt:o.updatedAt,lastRefresh:o.lastRefresh,reason:d?`SQLite generation requires repair: ${l.reason}`:p?"Index metadata fingerprint matches current source files.":"Index metadata fingerprint differs from current source files.",remedy:u?void 0:"Run: codebaseiq reindex"}}catch(i){return{state:"unknown",checkedAt:r,metaPath:n.metaPath,reason:`Could not read reindex metadata: ${i instanceof Error?i.message:String(i)}`,remedy:"Run: codebaseiq reindex"}}}var H=!1,ft,_=null;function Wr(e){H=!0,ft=e?{headCommit:e.headCommit,treeOid:e.treeOid,clean:e.clean}:void 0,_=null}function Kr(){H=!1,ft=void 0,_=null}function Jr(){_=null}function Tn(e,t,n){let r=H?jn(e,t,n):null;if(r&&_?.key===r)return _.value;let i=0,o=Se("freshness.fingerprint",()=>{let s=Ie(e,t,mt(n));return i=s.files.length,s},()=>({files:i,memoScope:H}));return r&&(_={key:r,value:o}),o}function mt(e){return{pnpmWorkspaces:e.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:e.indexer?.typescript?.projectMode,typescriptProjects:e.indexer?.typescript?.projects,clojureConfigPath:e.indexer?.clojure?.configPath}}function jn(e,t,n){return JSON.stringify([Re(e),[...t].sort(),mt(n)])}import{join as Mn}from"path";var gt=4,Nn=2,Fn="typescript-semantic";function ni(e){let t=Mn(e,Fn),n=$e(t);return{...n,requestDir:n.legacyRequestDir}}function yt(e){return Pe(e)}function ri(e){let t=JSON.parse(e),n=t.protocolVersion,r=n===Nn;if(!r&&n!==gt||typeof t.id!="string"||typeof t.generation!="string"||typeof t.deadlineAtMs!="number"||!Number.isFinite(t.deadlineAtMs)||t.profileEnvironment!==void 0&&!he(t.profileEnvironment)||!t.request||!$n(t.request)||!r&&(t.mailboxVersion!==z||typeof t.operationKey!="string"||!/^[a-f0-9]{64}$/.test(t.operationKey)||t.id!==De(t.operationKey)||typeof t.clientId!="string"||!t.clientId||typeof t.enqueuedAtMs!="number"||!Number.isFinite(t.enqueuedAtMs)||t.deadlineAtMs<t.enqueuedAtMs))throw new Error("TypeScript semantic service received an invalid mailbox request.");if(!r){let o=t,s=X("typescript-semantic-v4",{generation:o.generation,profileEnvironment:o.profileEnvironment,request:o.request});if(o.operationKey!==s)throw new Error("TypeScript semantic service received a mismatched mailbox operation identity.");return o}let i=X("typescript-semantic-v2",{id:t.id,generation:t.generation,request:t.request});return{protocolVersion:gt,mailboxVersion:z,id:t.id,operationKey:i,clientId:"legacy-v2",enqueuedAtMs:t.deadlineAtMs,deadlineAtMs:t.deadlineAtMs,generation:t.generation,...t.profileEnvironment?{profileEnvironment:t.profileEnvironment}:{},request:t.request}}function $n(e){if(!e||typeof e!="object"||!("kind"in e))return!1;let t=e;switch(t.kind){case"availability":return!0;case"import-usage":return typeof t.file=="string";case"reference-fragments":return Ae(t.files)!==null;case"references":return ht(t.definitions)&&(t.exact===void 0||typeof t.exact=="boolean");case"callees":return ht(t.definitions);case"signature":return bt(t.definition);default:return!1}}function ht(e){return Array.isArray(e)&&e.every(bt)}function bt(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.symbolId=="number"&&typeof t.documentId=="number"&&typeof t.symbol=="string"&&typeof t.relativePath=="string"&&typeof t.leaf=="string"&&typeof t.startLine=="number"&&typeof t.endLine=="number"}import{existsSync as Dn,readdirSync as Vn}from"fs";import{createHash as qn}from"crypto";import{join as ue}from"path";function de(e){let t=0,n=0,r=0,i=0,o=0,s=[];for(let p of e)switch(p.state){case"legacy":t+=1;break;case"current":n+=1;break;case"unsupported-older":r+=1,s.push(ce(p));break;case"unsupported-future":i+=1,s.push(ce(p));break;case"malformed":o+=1,s.push(ce(p));break}let a=t+n,c=r+i+o;return{complete:c===0,total:e.length,accepted:a,legacy:t,current:n,unsupportedOlder:r,unsupportedFuture:i,malformed:o,omitted:c,issues:s}}function ce(e){if(e.state==="legacy"||e.state==="current")throw new Error(`accepted record ${e.path} cannot become a compatibility issue`);return{path:e.path,state:e.state,reason:e.reason??e.state}}var xt=ue(".codebaseiq","suppressions"),vt="codebaseiq-suppression",St=1,Y=2;function Bn(e){return ue(e,xt)}function Ln(e){if(e.id&&e.id.trim()!=="")return`${e.id.trim()}.json`;let t=`${e.check??""}\0${e.file??""}`;return`CHECK-${qn("sha256").update(t).digest("hex").slice(0,12).toUpperCase()}.json`}function Gn(e){return Ln(e).slice(0,-5)}function Un(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return{state:"malformed",error:"not a suppression object"};let n=e;if(n.schemaVersion===void 0&&(n.kind!==void 0||n.suppressionIdentity!==void 0||n.writer!==void 0))return{state:"malformed",error:"suppression envelope metadata requires schemaVersion"};if(n.schemaVersion!==void 0){if(!Number.isSafeInteger(n.schemaVersion))return{state:"malformed",error:"schemaVersion must be a positive safe integer"};if(n.schemaVersion!==St&&n.schemaVersion!==Y)return{state:n.schemaVersion>Y?"unsupported-future":"unsupported-older",error:`unsupported schemaVersion ${String(n.schemaVersion)}`};if(n.kind!==void 0&&n.kind!==vt)return{state:"malformed",error:`kind must be ${vt}`}}if(n.schemaVersion===St&&n.decision!==void 0)return{state:"malformed",error:"schemaVersion 1 cannot carry automated adjudication metadata"};if(n.schemaVersion===Y&&!D(n.decision))return{state:"malformed",error:"schemaVersion 2 requires a valid automated adjudication decision"};if(typeof n.reason!="string"||n.reason.trim()==="")return{state:"malformed",error:"missing reason"};if(!n.id&&!n.check)return{state:"malformed",error:"needs an id or a check"};let r=Hn(n);if(n.schemaVersion===void 0)return{state:"legacy",suppression:r,record:n,schemaVersion:0};let i=Gn(r);return n.suppressionIdentity!==i||t!==void 0&&n.suppressionIdentity!==t?{state:"malformed",error:"suppressionIdentity does not match the suppression target or filename"}:!n.writer||n.writer.tool!=="codebaseiq"||typeof n.writer.version!="string"||n.writer.version.trim()===""?{state:"malformed",error:"missing valid writer metadata"}:typeof n.createdAt!="string"||!Number.isFinite(Date.parse(n.createdAt))?{state:"malformed",error:"missing valid createdAt timestamp"}:n.updatedAt!==void 0&&(typeof n.updatedAt!="string"||!Number.isFinite(Date.parse(n.updatedAt)))?{state:"malformed",error:"invalid updatedAt timestamp"}:{state:n.schemaVersion===Y?"current":"legacy",suppression:r,record:n,schemaVersion:n.schemaVersion}}function Ct(e){let t=Bn(e);if(!Dn(t))return{suppressions:[],compatibility:de([]),warnings:[]};let n=[],r=[];for(let o of Vn(t).sort()){if(!o.endsWith(".json"))continue;let s=ue(t,o),a=`${xt}/${o}`,c;try{c=JSON.parse(F(s,"suppression record"))}catch{r.push({path:a,state:"malformed",reason:"malformed JSON"});continue}let p=Un(c,o.slice(0,-5));if("error"in p){r.push({path:a,state:p.state,reason:p.error});continue}r.push({path:a,state:p.state}),n.push(p.suppression)}let i=de(r);return{suppressions:n,compatibility:i,warnings:i.issues.map(o=>`${o.path}: ${o.reason} \u2014 ignored`)}}function Hn(e){return{...typeof e.id=="string"?{id:e.id}:{},...typeof e.check=="string"?{check:e.check}:{},...typeof e.file=="string"?{file:e.file}:{},reason:e.reason,...typeof e.expiresAt=="string"?{expiresAt:e.expiresAt}:{},...typeof e.createdAt=="string"?{createdAt:e.createdAt}:{},...e.decision?{decision:e.decision}:{}}}function Rt(){return process.env.CODEBASEIQ_PROJECT_ROOT??process.cwd()}var N,P;function Ri(e){N=e}function Oi(){return P}function Ot(e=Rt(),t=void 0){if(t===void 0&&N?.projectRoot===e&&!(N.dbPathSource==="root-fallback"&&W(N.paths.dbPath)))return N;let n=ct(e),r=Ce(e,n),i=process.env.CODEBASEIQ_INDEX_DB;if(i)return{projectRoot:e,config:n,paths:r,dbPath:i,dbPathSource:"env",gitContext:t};if(W(r.dbPath))return{projectRoot:e,config:n,paths:r,dbPath:r.dbPath,dbPathSource:"configured",gitContext:t};let o=Wn(e,"index.db");return{projectRoot:e,config:n,paths:r,dbPath:o,dbPathSource:"root-fallback",rootFallbackWarning:Xn(o,r.dbPath),gitContext:t}}function Ii(e){return Ot(e).dbPath}function wi(e,t,n,r={}){return W(n.dbPath)&&r.gitContext?.clean===!1&&r.watcherGeneration!==void 0&&yt(n.dbPath)===r.watcherGeneration?Fe(e,t,n,r.gitContext):lt(e,t,n).state==="fresh"?{kind:"local-fresh"}:Ne(e,t,n,r.gitContext)}function Ei(e){return!e.startsWith("__")&&!Kn.has(e)}var Kn=new Set(["capabilities","check-deps","config-validate","doctor","init","install-skills","reindex","setup","setup-agent","status","suppress","uninstall","watch"]);function Jn(){return zn(Rt(),{warnOnRootFallback:!0})}function zn(e,t={}){let{config:n,paths:r,dbPath:i,dbPathSource:o,rootFallbackWarning:s,gitContext:a}=Ot(e);if(!W(i))throw new Error("No index.db found. Run: codebaseiq reindex");t.warnOnRootFallback&&o==="root-fallback"&&s&&console.error(s);let c=Ct(e).suppressions,p={dbPath:i,indexPath:process.env.CODEBASEIQ_INDEX_SCIP??r.indexPath,projectRoot:e,collaborationDomainId:n.collaborationDomainId,sharedEvidenceDbPath:Me(e,n,a),entryRoots:n.entryRoots,semantic:n.semantic,suppressions:[...n.suppressions??[],...c],declaredCouplings:n.declaredCouplings,locality:n.locality,architecture:n.architecture,coverageContracts:n.coverageContracts,docs:n.docs},l=_e(e);return new ke(p,l)}function Xn(e,t){let n="unknown time";try{n=Yn(e).mtime.toISOString()}catch{}return`warning: using legacy project-root index.db (${e}, modified ${n}) because the configured index was not found at ${t}. This fallback may be stale; run 'codebaseiq reindex' to refresh the configured index.`}var pe;function Pi(e){pe=e}function ki(e){if(pe){let r=pe(),i=P;P=r;try{return e(r)}finally{P=i}}let t=Jn(),n=P;P=t;try{return e(t)}finally{P=n,t.close()}}function Ai(e,t){return t.concat([e])}function Qn(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function _i(e){switch(e.state){case"idle":return"Watching (idle)";case"waiting":{let t=Math.round((e.reindexAt-Date.now())/1e3);return`${e.changedFiles} file(s) changed, reindexing in ${t}s...`}case"indexing":return`Reindexing... (${Math.round((Date.now()-e.startedAt)/1e3)}s)`;case"cooldown":return`Cooldown (${Math.round((e.until-Date.now())/1e3)}s)${e.dirty?" \u2014 changes pending":""}`;case"budget-paused":return`Automatic reindex paused by resource budget (${Math.max(0,Math.round((e.until-Date.now())/1e3))}s; ${e.reason}; ${e.rebuilt} rebuilds, ${Qn(e.estimatedWriteBytes)} estimated writes)${e.dirty?" \u2014 changes pending":""}`;case"draining":return`Stopping safely \u2014 ${e.reason}`;default:return Zn(e)}}function Zn(e){throw new Error(`Unhandled watcher status: ${JSON.stringify(e)}`)}export{A as a,ir as b,He as c,or as d,D as e,ie as f,j as g,ct as h,Tr as i,jr as j,Mr as k,Nr as l,Fr as m,$r as n,lt as o,Wr as p,Kr as q,Jr as r,gt as s,ni as t,yt as u,ri as v,vt as w,St as x,Y as y,Bn as z,Ln as A,Gn as B,Un as C,Ct as D,Rt as E,Ri as F,Oi as G,Ot as H,Ii as I,wi as J,Ei as K,Jn as L,zn as M,Xn as N,Pi as O,ki as P,Ai as Q,Qn as R,_i as S};
3
- //# sourceMappingURL=chunk-Z54RD7VL.js.map
@@ -1,15 +0,0 @@
1
- import{H as h,J as D,M as P,N as S,O as A,P as p,Q as f,R as y}from"./chunk-NNJ2KZZG.js";var ce=new Set(["aix","android","darwin","freebsd","haiku","linux","openbsd","sunos","win32","cygwin","netbsd"]);function k(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;return r.version!==1||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.platform!="string"||!ce.has(r.platform)||typeof r.startToken!="string"||r.startToken.trim()===""?null:{version:1,pid:r.pid,platform:r.platform,startToken:r.startToken}}function m(e,r){return e.version===r.version&&e.pid===r.pid&&e.platform===r.platform&&e.startToken===r.startToken}import{execFileSync as ae}from"child_process";import{platform as le}from"os";var _=new WeakMap,de=1e3,N=16*1024;function F(e,r=fe){if(!Number.isSafeInteger(e)||e<=0)return null;if(e===process.pid){let t=_.get(r);if(t)return t}try{let t=ue(e,r);if(!t)return null;let n={version:1,pid:e,platform:r.platform,startToken:t};return e===process.pid&&_.set(r,n),n}catch{return null}}function ue(e,r){if(r.platform==="linux"||r.platform==="android")return me(r.readFile(`/proc/${e}/stat`));if(r.platform==="win32"){let t=`([DateTimeOffset](Get-Process -Id ${e} -ErrorAction Stop).StartTime).ToUnixTimeMilliseconds()`;return M(r.run("powershell.exe",["-NoProfile","-NonInteractive","-Command",t]))}return r.platform==="darwin"||r.platform==="freebsd"||r.platform==="openbsd"||r.platform==="netbsd"?M(r.run("ps",["-p",String(e),"-o","lstart="])):null}function me(e){let r=e.lastIndexOf(")");if(r<0)return null;let n=e.slice(r+1).trim().split(/\s+/)[19];return n&&/^\d+$/.test(n)?n:null}function M(e){let r=e.trim();return r===""?null:r}var fe={platform:le(),readFile(e){return D(e,{maxBytes:N,inputKind:"process identity pseudo-file"})},run(e,r){return ae(e,[...r],{encoding:"utf8",timeout:de,maxBuffer:N,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0})}};function C(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}function br(){return performance.now()}import{randomUUID as pe}from"crypto";import{closeSync as ye,fsyncSync as be,linkSync as Pe,mkdirSync as ge,openSync as Fe,statSync as we,unlinkSync as Se,writeSync as ke}from"fs";import{dirname as L}from"path";var R="codebaseiq-process-lock",E=1,w=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:C,readProcessIdentity:F,randomToken:()=>pe(),makeDirectory:e=>ge(e,{recursive:!0}),openFile:(e,r,t)=>Fe(e,r,t),writeFile:(e,r,t,n)=>ke(e,r,t,n),syncFile:e=>be(e),closeFile:e=>ye(e),linkFile:(e,r)=>Pe(e,r),readFile:e=>h(e,"process lock record"),statFile:e=>{let r=we(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>Se(e)});function Er(e,r){let t=r.runtime??w;t.makeDirectory(L(e));let n;for(let o=0;o<2;o+=1)try{return{kind:"acquired",lock:B(e,r,t),...n?{reclaimed:n}:{}}}catch(i){if(i.code!=="EEXIST")throw i;let s=b(e,{parseLegacy:r.parseLegacy,runtime:t});if(o===0&&Re(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:b(e,{parseLegacy:r.parseLegacy,runtime:t})}}function b(e,r={}){let t=r.runtime??w,n,o;try{n=t.statFile(e),o=t.readFile(e)}catch(l){return l.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let i;try{i=JSON.parse(o)}catch{return{state:"malformed",raw:o,identity:n}}let s=Ie(i);if(s)return{state:"valid",raw:o,identity:n,record:s,owner:Te(s),parsed:i};let c=r.parseLegacy?.(i)??null;return c?{state:"legacy",raw:o,identity:n,owner:c,parsed:i}:{state:"malformed",raw:o,identity:n,parsed:i}}function Ie(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==R||r.version!==E||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:k(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:R,version:E,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Re(e,r,t={}){let n=t.runtime??w;if(!T(r,n))return!1;let o=Ee(`${e}.reclaim`,n);if(!o)return!1;try{let i=b(e,{parseLegacy:t.parseLegacy,runtime:n});return!U(r,i)||!T(i,n)?!1:x(e,n)}finally{o.release()}}function B(e,r,t){let n=r.pid??process.pid,o=t.randomToken(),i=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:R,version:E,kind:r.kind,pid:n,token:o,...i?{processIdentity:i}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${o}.candidate`,l=t.openFile(c,"wx",384),a;try{P(l,Buffer.from(`${JSON.stringify(s)}
2
- `),t,"process lock"),t.syncFile(l)}catch(u){a=u}try{t.closeFile(l)}catch(u){a??=u}if(a!==void 0)throw I(c,t),a;try{t.linkFile(c,e)}catch(u){throw I(c,t),u}I(c,t);try{$(L(e),t)}catch(u){throw W(e,s,t),u}let d=!1;return{path:e,record:s,release:()=>d?!1:(d=!0,W(e,s,t))}}function W(e,r,t=w){let n=b(e,{runtime:t});return n.state!=="valid"||!n.record||n.record.pid!==r.pid||n.record.token!==r.token||r.processIdentity&&(!n.record.processIdentity||!m(r.processIdentity,n.record.processIdentity))?!1:x(e,t)}function Ee(e,r){for(let t=0;t<2;t+=1)try{return B(e,{kind:"reclaim-guard",runtime:r},r)}catch(n){if(n.code!=="EEXIST")return null;let o=b(e,{runtime:r});if(t>0||!T(o,r))return null;let i=b(e,{runtime:r});if(!U(o,i)||!x(e,r))return null}return null}function T(e,r){if(e.state==="missing")return!1;if(e.owner){if(!r.isProcessAlive(e.owner.pid))return!0;if(!e.owner.processIdentity)return!1;let t=r.readProcessIdentity(e.owner.pid);return t!==null&&!m(e.owner.processIdentity,t)}return!1}function U(e,r){return e.state===r.state&&e.raw===r.raw&&e.identity!==void 0&&r.identity!==void 0&&e.identity.dev===r.identity.dev&&e.identity.ino===r.identity.ino&&e.identity.size===r.identity.size&&e.identity.mtimeMs===r.identity.mtimeMs}function Te(e){return{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}}function $(e,r){let t;try{t=r.openFile(e,"r")}catch(n){if(S(n,process.platform))return;throw n}try{r.syncFile(t)}catch(n){if(!S(n,process.platform))throw n}finally{r.closeFile(t)}}function x(e,r){try{return r.removeFile(e),$(L(e),r),!0}catch{return!1}}function I(e,r){try{r.removeFile(e)}catch{}}var Le=Object.freeze(["EPERM","EACCES","EBUSY"]),xe=Object.freeze([10,20,40,80,160,320,640,1e3,1e3,1e3]);function Oe(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var O=Object.freeze({platform:process.platform,sleep:Oe});function ve(e,r){if(r!=="win32")return!1;let t=e?.code;return typeof t=="string"&&Le.includes(t)}function J(e,r={}){let t=r.runtime??O,n=r.delaysMs??xe;for(let o of n)try{return e()}catch(i){if(!ve(i,t.platform))throw i;t.sleep(o)}return e()}import{execFileSync as z,spawnSync as _r}from"child_process";import{platform as Be}from"os";import{resolve as Ue}from"path";import{createHash as he}from"crypto";import{existsSync as q,renameSync as De,rmSync as Ae,writeFileSync as _e}from"fs";import{tmpdir as Ne}from"os";import{join as Me}from"path";var G=`'use strict';
3
- const NativeRegExp = globalThis.RegExp;
4
- const escapeLoneSeparator = (args) =>
5
- typeof args[0] === 'string' && args[0] === '\\\\' ? ['\\\\\\\\', ...args.slice(1)] : args;
6
- globalThis.RegExp = new Proxy(NativeRegExp, {
7
- construct(target, args) {
8
- return Reflect.construct(target, escapeLoneSeparator(args));
9
- },
10
- apply(target, thisArg, args) {
11
- return Reflect.apply(target, thisArg, escapeLoneSeparator(args));
12
- },
13
- });
14
- `,Ce=/scip-python/i;function j(e,r=process.platform){return r!=="win32"||!Ce.test(e)?[]:["--require",We()]}function We(e=Ne()){let r=he("sha256").update(G).digest("hex").slice(0,16),t=Me(e,`codebaseiq-indexer-compat-${r}.cjs`);if(q(t))return t;let n=`${t}.${process.pid}.tmp`;_e(n,G);try{De(n,t)}catch{if(Ae(n,{force:!0}),!q(t))throw new Error(`could not materialize indexer compatibility preload at ${t}`)}return t}var Y=Be()==="win32";function Wr(e){let r=Y?"where":"which";try{return z(r,[e],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var $e=/\.(?:c|m)?js$/i,Je=/\.(?:exe|com)$/i;function Br(e,r){return $e.test(e)?{binary:process.execPath,args:[...j(e),e,...r]}:{binary:e,args:[...r]}}function qe(e,r){return z(e,r,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL"})}function Ur(e,r={}){let t=r.isWindows??Y,n=r.lookup??qe,o;try{o=n(t?"where":"which",[e])}catch{return null}let i=o.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(!t){let s=i[0];return s?Ue(s):null}return i.find(s=>Je.test(s))??null}import{chmodSync as Ge,constants as je,copyFileSync as ze}from"fs";import{dirname as Ye}from"path";var K=Object.freeze({...A,copyFile:(e,r)=>ze(e,r,je.COPYFILE_FICLONE),chmodFile:(e,r)=>Ge(e,r)});function Ke(e,r,t={}){let n=t.runtime??K,o=Ye(r),i=p(o,n);if(n.copyFile(e,r),n.platform==="win32")Xe(r,t.mode,n);else{t.mode!==void 0&&n.chmodFile(r,t.mode);let s=n.openFile(r,"r");try{n.syncFile(s)}finally{n.closeFile(s)}}return y(i,f(o,n))}function Xe(e,r,t){let n=!1,o;try{o=t.openFile(e,"r+")}catch(i){let s=i.code;if(s!=="EACCES"&&s!=="EPERM")throw i;t.chmodFile(e,384),n=!0,o=t.openFile(e,"r+")}try{t.syncFile(o)}finally{t.closeFile(o)}r!==void 0?t.chmodFile(e,r):n&&t.chmodFile(e,292)}import{randomUUID as He}from"crypto";import{closeSync as Ve,existsSync as Qe,fsyncSync as Ze,linkSync as er,mkdirSync as rr,openSync as tr,renameSync as nr,unlinkSync as or,writeSync as ir}from"fs";import{dirname as X}from"path";var H=Object.freeze({platform:process.platform,randomToken:()=>He(),pathExists:e=>Qe(e),makeDirectory:e=>rr(e,{recursive:!0}),openFile:(e,r,t)=>tr(e,r,t),writeFile:(e,r,t,n)=>ir(e,r,t,n),syncFile:e=>Ze(e),closeFile:e=>Ve(e),renameFile:(e,r)=>nr(e,r),linkFile:(e,r)=>er(e,r),removeFile:e=>or(e)});function Qr(e,r,t={}){let n=t.durability??"visibility",o=t.runtime??H,i=X(e),s=n==="durable"?p(i,o):(o.makeDirectory(i),"not-requested"),c=`${e}.tmp-${o.randomToken()}`,l=typeof r=="string"?Buffer.from(r):r,a,d=!1;try{a=o.openFile(c,"wx",t.mode??384),d=!0,P(a,l,o,"atomic file"),n==="durable"&&o.syncFile(a),o.closeFile(a),a=void 0,J(()=>o.renameFile(c,e),{runtime:{platform:o.platform,sleep:o.sleep??O.sleep}}),d=!1;let u=n==="durable"?y(s,f(i,o)):"not-requested";return V(n,u)}finally{if(a!==void 0)try{o.closeFile(a)}catch{}if(d)try{o.removeFile(c)}catch{}}}function Zr(e,r,t={}){let n=t.durability??"visibility",o=t.runtime??H;if(!o.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let i=X(e),s=n==="durable"?p(i,o):(o.makeDirectory(i),"not-requested"),c=`${e}.tmp-${o.randomToken()}`,l=typeof r=="string"?Buffer.from(r):r,a,d=!1;try{a=o.openFile(c,"wx",t.mode??384),d=!0,P(a,l,o,"exclusive atomic file"),n==="durable"&&o.syncFile(a),o.closeFile(a),a=void 0,o.linkFile(c,e);let u=n==="durable"?f(i,o):"not-requested";o.removeFile(c),d=!1;let se=n==="durable"?y(s,u,f(i,o)):"not-requested";return V(n,se)}finally{if(a!==void 0)try{o.closeFile(a)}catch{}if(d)try{o.removeFile(c)}catch{}}}function V(e,r){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":r==="synced"?"directory-durable":"file-flushed",directorySync:r}}import{execFileSync as ee}from"child_process";import{platform as sr}from"os";var re=1e3,te=2*1024*1024,cr=25;function st(e,r,t=ie){let n=t.readIdentity(e),o=new Map;return n&&o.set(e,n),{rootPid:e,rootIdentity:n,ownsProcessGroup:r,knownMembers:o}}async function ct(e,r,t=ie){if(!e.rootIdentity){let l=await g(e,r.gracefulMs+r.forceMs,t);return{reaped:l,reason:l?"terminated":"identity-unavailable",detail:l?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}let n=ne(e,t);if(n==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(n==="exited"&&!oe(e,t))return{reaped:!0,reason:"terminated"};if(t.platform==="win32"){try{t.terminateWindowsTree(e.rootPid)}catch(a){let d=await g(e,r.forceMs,t);return{reaped:d,reason:d?"terminated":"signal-failed",detail:d?void 0:v(a)}}let l=await g(e,r.forceMs,t);return{reaped:l,reason:l?"terminated":"deadline"}}let o=Q(e,"SIGTERM",t);if(await g(e,r.gracefulMs,t))return{reaped:!0,reason:"terminated"};let s=Q(e,"SIGKILL",t);return await g(e,r.forceMs,t)?{reaped:!0,reason:"terminated"}:s?{reaped:!1,reason:s.reason,detail:s.detail}:o?{reaped:!1,reason:o.reason,detail:o.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}function ne(e,r){let t=r.readIdentity(e.rootPid);if(!t)return"exited";if(!e.rootIdentity||!m(e.rootIdentity,t))return"mismatch";e.knownMembers.set(e.rootPid,t);for(let n of r.listDescendantPids(e.rootPid)){let o=r.readIdentity(n);o&&e.knownMembers.set(n,o)}return"owned"}function Q(e,r,t){let n=ne(e,t);if(n==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${r}.`};if(n==="owned"&&e.ownsProcessGroup)try{return t.signal(-e.rootPid,r),null}catch(i){if(!Z(i))return{reason:"signal-failed",detail:v(i)}}let o=null;for(let i of e.knownMembers.values()){let s=t.readIdentity(i.pid);if(!(!s||!m(i,s)))try{t.signal(i.pid,r)}catch(c){!Z(c)&&o===null&&(o=v(c))}}return o===null?null:{reason:"signal-failed",detail:o}}async function g(e,r,t){let n=t.now()+r;for(;oe(e,t);){if(t.now()>=n)return!1;await t.sleep(Math.min(cr,Math.max(1,n-t.now())))}return!0}function oe(e,r){if(!e.rootIdentity&&r.isProcessAlive(e.rootPid))return!0;for(let t of e.knownMembers.values()){let n=r.readIdentity(t.pid);if(n&&m(t,n))return!0}return!!(e.ownsProcessGroup&&r.isProcessGroupAlive(e.rootPid))}function ar(e){let r=ee("ps",["-axo","pid=,ppid="],{encoding:"utf8",timeout:re,maxBuffer:te,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0}),t=new Map;for(let s of r.split(/\r?\n/)){let c=/^\s*(\d+)\s+(\d+)\s*$/.exec(s);if(!c)continue;let l=Number(c[1]),a=Number(c[2]),d=t.get(a)??[];d.push(l),t.set(a,d)}let n=[],o=[...t.get(e)??[]],i=new Set;for(;o.length>0;){let s=o.pop();i.has(s)||(i.add(s),n.push(s),o.push(...t.get(s)??[]))}return n}function Z(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function v(e){return e instanceof Error?e.message:String(e)}var ie={platform:sr(),now:Date.now,readIdentity:F,isProcessAlive(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return ar(e)}catch{return[]}},signal(e,r){process.kill(e,r)},terminateWindowsTree(e){ee("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:re,maxBuffer:te,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(r=>setTimeout(r,e))}};export{k as a,m as b,F as c,C as d,br as e,Er as f,b as g,Re as h,J as i,Ke as j,Qr as k,Zr as l,Wr as m,Br as n,Ur as o,st as p,ct as q};
15
- //# sourceMappingURL=chunk-ZKX2FRS6.js.map
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as a,D as b,E as c,F as d,G as e,H as f,I as g,J as h,K as i,L as j,M as k,N as l,O as m,P as n,Q as o}from"./chunk-G6XFR4ZL.js";import"./chunk-2X7V4HS4.js";import"./chunk-SNNWPCN7.js";export{b as activateCliProjectContext,m as collect,c as currentCliDatabase,n as formatBytes,o as formatStatus,h as openDb,i as openProjectDb,f as prepareWorktreeIndex,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,j as rootIndexFallbackWarning,k as setResidentDatabaseProvider,g as sharedCachePreparationEligible,l as withDb};
3
- //# sourceMappingURL=cli-context-3SNLDYBM.js.map
@@ -1,2 +0,0 @@
1
- import{E as a,F as b,G as c,H as d,I as e,J as f,K as g,L as h,M as i,N as j,O as k,P as l,Q as m,R as n,S as o}from"./chunk-Z54RD7VL.js";import"./chunk-QW7EP6WI.js";import"./chunk-FM5BPL4V.js";import"./chunk-RDBI2RXU.js";import"./chunk-R2NOK63J.js";import"./chunk-EF2R3WNQ.js";import"./chunk-WE5RZHZ7.js";export{b as activateCliProjectContext,m as collect,c as currentCliDatabase,n as formatBytes,o as formatStatus,h as openDb,i as openProjectDb,f as prepareWorktreeIndex,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,j as rootIndexFallbackWarning,k as setResidentDatabaseProvider,g as sharedCachePreparationEligible,l as withDb};
2
- //# sourceMappingURL=cli-context-T3B7W6GG.js.map
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import{b as Y,c as Z,d as h,e as ee,h as te,j as g}from"./chunk-DR2LURYU.js";import{c as G,d as B,e as J,f as K,g as Q,h as X}from"./chunk-UXM43C7T.js";import{n as L,p as q,r as H}from"./chunk-ECQBG7PW.js";import{a as y,b as k}from"./chunk-XZEE23VG.js";import{C as M,D as u,F,H as U,I as V,N as W,o as I,p as $,q as T,r as _}from"./chunk-G6XFR4ZL.js";import{e as z}from"./chunk-3JSXXYTZ.js";import{d as D}from"./chunk-DO6WQD2T.js";import{$ as j,Z as R,_ as N,aa as A,ba as O,l as c}from"./chunk-2X7V4HS4.js";import{c as P,q as S}from"./chunk-SNNWPCN7.js";import{c as ne}from"./chunk-C74PPYLA.js";import{c as re}from"./chunk-B3UYV66Z.js";import"./chunk-362QOSFD.js";import"./chunk-B2OB55RR.js";import{Command as _e,Help as Me}from"commander";import{Option as pe}from"commander";function x(e){return e.evidence?e.evidence:ue.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var ue=new Set(["health","context","co-change"]);function oe(e){if(e.claims){if(e.claims.origin==="mixed"&&!e.claims.families?.length)throw new Error(`Mixed command ${e.id} must declare at least one claim family.`);return e.claims}let t=x(e);if(t==="mixed")throw new Error(`Mixed command ${e.id} must declare claim families.`);let n=e.agent?B(e.agent.operation):[];return n.length>0&&n.every(r=>r==="repository-observation"||r==="repository-preview")?{origin:t==="heuristic"?"heuristic":"compiler-graph",observedSources:["index-generation"],producerValidation:{status:"not-evaluated"}}:{origin:"unknown",observedSources:["process"],producerValidation:{status:"not-evaluated"}}}var ie;function ae(){return ie||{argv:process.argv.slice(2),execPath:process.execPath,...process.argv[1]!==void 0?{scriptPath:process.argv[1]}:{},cwd:process.cwd()}}function se(e,t){return K(new Map(t.map(n=>[n.id,x(n)]))),X(new Map(t.map(n=>[n.id,oe(n)]))),Q(new Map(t.flatMap(n=>n.agent?[[n.id,{...n.agent,resultUnits:he(n)}]]:[]))),t.map(n=>{let i=n.hidden?e.command(n.command,{hidden:!0}):e.command(n.command);i.description(n.description),n.helpAfter&&i.addHelpText("after",`
3
- ${n.helpAfter.trim()}
4
- `);for(let r of n.arguments??[])i.argument(r.name);for(let r of n.options??[])if(r.hidden){let o=new pe(r.flags,r.description).hideHelp();r.parser&&o.argParser(r.parser),Object.hasOwn(r,"defaultValue")&&o.default(r.defaultValue),i.addOption(o)}else r.parser&&Object.hasOwn(r,"defaultValue")?i.option(r.flags,r.description,r.parser,r.defaultValue):r.parser?i.option(r.flags,r.description,r.parser):Object.hasOwn(r,"defaultValue")?i.option(r.flags,r.description,r.defaultValue):i.option(r.flags,r.description);return i.action(async(...r)=>{try{let o=i.optsWithGlobals();fe(o);let a=ae(),s=()=>n.id===L?n.handler(...r):q({command:n.id,producerVersion:c,invocationPrefix:a.scriptPath?[a.execPath,a.scriptPath]:["codebaseiq"],argv:[...a.argv],cwd:a.cwd,json:o.json===!0,sourceSession:o.session!==!1,reemitSource:o.reemit===!0,...typeof o.outputPageSize=="number"?{pageSize:o.outputPageSize}:{},...typeof o.outputCursor=="string"?{cursor:o.outputCursor}:{}},()=>n.handler(...r)),m=n.agent?G(n.agent.operation,{args:r.slice(0,-1),options:o}):void 0;await(m?J(m,s):s())}catch(o){ge(o)}finally{u(void 0),T()}}),{descriptor:n,command:i}})}function fe(e){if(e.resultOnly===!0&&e.json!==!0)throw new Error("--result-only requires --json.");if(e.compact===!0&&e.json!==!0)throw new Error("--compact requires --json.")}function he(e){let t=e.agent?.resultUnits;if(t?.kind==="field"&&t.field.trim()==="")throw new Error(`Command ${e.id} declares an empty result-unit field.`);return t||(e.renderShape==="list"||e.renderShape==="table"||e.renderShape==="grouped-by-file"?{kind:"rows"}:{kind:"report"})}function ge(e){let t=e instanceof Error?e.message:String(e);console.error(`error: ${k(t)}`),process.exitCode=1}import{existsSync as Ce,mkdirSync as ve,writeFileSync as ye}from"fs";import{homedir as xe}from"os";import{join as C}from"path";var Ee=1440*60*1e3,me="update-check.json",be="https://registry.npmjs.org/codebaseiq/latest";async function E(e={}){let t=e.env??process.env;if(t.CODEBASEIQ_UPDATE_CHECK==="0"||t.NO_UPDATE_NOTIFIER)return;let n=e.cacheDir??Se(t),i=e.now??Date.now(),r=e.currentVersion??c,o=De(n),a=o&&i-o.checkedAt<Ee?o.latestVersion:await Re(n,e.fetchLatestVersion??je,i);if(!a||!Pe(a,r))return;(e.writeNotice??(m=>console.error(m)))(we(r,a))}function we(e,t){return[`codebaseiq update available: ${e} -> ${t}.`,"Agent: tell your human to update with: npm install -g codebaseiq@latest",""].join(`
5
- `)}function Pe(e,t){let n=ce(e),i=ce(t);if(!n||!i)return e!==t;for(let r=0;r<n.length;r++){let o=n[r]-i[r];if(o>0)return!0;if(o<0)return!1}return!1}function Se(e){let t=e.XDG_CACHE_HOME||C(xe(),".cache");return C(t,"codebaseiq")}function De(e){let t=C(e,me);if(!Ce(t))return null;try{let n=JSON.parse(S(t,"update notice cache"));return typeof n.checkedAt=="number"&&(typeof n.latestVersion=="string"||n.latestVersion===null)?{checkedAt:n.checkedAt,latestVersion:n.latestVersion}:null}catch{return null}}async function Re(e,t,n){let i;try{i=await t()}catch{i=null}return Ne(e,{checkedAt:n,latestVersion:i}),i}function Ne(e,t){try{ve(e,{recursive:!0}),ye(C(e,me),`${JSON.stringify(t,null,2)}
6
- `)}catch{}}async function je(){let e=await fetch(be,{signal:AbortSignal.timeout(1e3)});if(!e.ok)return null;let t=await e.json();return typeof t.version=="string"?t.version:null}function ce(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}var Ae=5e3,Oe=100,Ie={prepare:U,freshness:I,ensureService:h,inspectService:ee,requestRefresh:te,async reindex(e,t,n,i){let{reindexConfiguredProject:r}=await import("./project-reindex-UQBIKO4M.js");return r(e,t,n,i)},wait(e){return new Promise(t=>setTimeout(t,e))},now:Date.now};async function de(e,t=Ie,n={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};let i=$e(e,t),r=t.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,...i?{watcherGeneration:i}:{}}),o=t.freshness(e.projectRoot,e.config,e.paths),a=t.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:c,config:e.config,gitContext:e.gitContext});if(o.state==="fresh")return{source:r.kind==="local-fresh"?"existing":"shared-generation",service:a};if((a.kind==="started"||a.kind==="reused")&&(t.requestRefresh(D(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),o=await Te(e,o,t,n,a),o.state==="fresh"))return{source:"watcher",service:a};try{await t.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`codebaseiq ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(o=t.freshness(e.projectRoot,e.config,e.paths),o.state!=="fresh")throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: index remained ${o.state} (${o.reason})`);return{source:"synchronous-reindex",service:a}}function $e(e,t){if(e.config.watch?.enabled===!0)try{return Y(t.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:c,gitContext:e.gitContext}))}catch{return}}async function Te(e,t,n,i,r){if(r.state.watcher.state==="budget-paused")return t;let o=Math.max(0,i.waitMs??Ae),a=Math.max(1,i.pollMs??Oe),s=n.now()+o,m=t;for(;n.now()<s;)if(await n.wait(Math.min(a,Math.max(1,s-n.now()))),_(),m=n.freshness(e.projectRoot,e.config,e.paths),m.state==="fresh")return m;return m}async function Pt(e={}){let t=new _e;e.resident&&t.exitOverride(),e.terminalOutput&&t.configureOutput({writeOut:r=>process.stdout.write(y(r)),writeErr:r=>process.stderr.write(y(r))}),t.name("codebaseiq").description("Language-agnostic code intelligence CLI powered by SCIP indexes").version(c).option("--output-page-size <characters>","Return bounded output pages with an exact continuation command",H).option("--output-cursor <cursor>","Continue a bounded output page").option("--no-session","Disable the explicit exploration evidence ledger").option("--reemit","Recovery only: render source and graph evidence again instead of citing session receipts").option("--help-all","Display every command, including compatibility and deprecated controls");let n=await ne(e.invocationCommand);se(t,n);let i=new Me;return t.configureHelp({formatHelp:(r,o)=>r===t?re(t,n):i.formatHelp(r,o)}),t.hook("preAction",async(r,o)=>{let a=o.name();if(e.resident){await e.resident.preAction(a);return}let s=V(a),m=Z(a);if(!s&&!m){le(),await E({commandName:a});return}let d=M(),p=P(d);$(p);let v=F(d,p);u(v),le(),await E({commandName:a});let{config:b,paths:w}=v;if(s){let l=await de({commandName:a,projectRoot:d,config:b,paths:w,dbPathSource:v.dbPathSource,gitContext:p});process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-freshness: ${l.source}`),l.service.kind==="failed"&&console.error(`warning: codebaseiq watch service did not start: ${l.service.message}`),(l.service.kind==="failed"||l.service.kind==="skipped")&&g(d,c);return}if(!m){g(d,c);return}let f=h({commandName:a,projectRoot:d,cacheDir:w.cacheDir,cliVersion:c,config:b,gitContext:p});f.kind==="failed"&&console.error(`warning: codebaseiq watch service did not start: ${f.message}`),(f.kind==="failed"||f.kind==="skipped")&&g(d,c)}),t.hook("postAction",()=>u(void 0)),{program:t,descriptors:n}}function le(){if(j(),!R()||A())return;let e=null;try{e=W(t=>z(t))}catch{}O({command:N()??`codebaseiq ${process.argv.slice(2).join(" ")}`,toolVersion:c,projectFingerprint:e})}export{Pt as createCliProgram};
7
- //# sourceMappingURL=cli-program-YNOXO72B.js.map