codebaseiq 0.1.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 (432) hide show
  1. package/CHANGELOG.md +481 -0
  2. package/LICENSE +202 -0
  3. package/README.md +349 -0
  4. package/dist/augment-vue-worker.js +2 -0
  5. package/dist/call-graph-evidence-gNsxjCW8.d.ts +16 -0
  6. package/dist/change-analysis-types-CCtoCHbC.d.ts +9 -0
  7. package/dist/chunk-2Q2LW5JW.js +14 -0
  8. package/dist/chunk-2X7V4HS4.js +88 -0
  9. package/dist/chunk-34WBMAYK.js +2 -0
  10. package/dist/chunk-35NLDRZC.js +2 -0
  11. package/dist/chunk-362QOSFD.js +3 -0
  12. package/dist/chunk-3IER7Q6H.js +12 -0
  13. package/dist/chunk-3JSXXYTZ.js +345 -0
  14. package/dist/chunk-3LCDIREB.js +4 -0
  15. package/dist/chunk-476NR5B7.js +2 -0
  16. package/dist/chunk-4FC325IF.js +30 -0
  17. package/dist/chunk-4WKDMDEW.js +9 -0
  18. package/dist/chunk-4XTAUQFD.js +2 -0
  19. package/dist/chunk-5PUWMSDU.js +26 -0
  20. package/dist/chunk-5VKBFZZU.js +3 -0
  21. package/dist/chunk-6BQ3DSPK.js +2 -0
  22. package/dist/chunk-6CS3UQTN.js +3 -0
  23. package/dist/chunk-6MUIJMVL.js +6 -0
  24. package/dist/chunk-6NW7MU72.js +40 -0
  25. package/dist/chunk-6OAHRI2D.js +6 -0
  26. package/dist/chunk-6YTSKJJ3.js +2 -0
  27. package/dist/chunk-7FND7D7N.js +2 -0
  28. package/dist/chunk-7MGU3HPH.js +2 -0
  29. package/dist/chunk-7NVGT435.js +2 -0
  30. package/dist/chunk-7XAN6GKB.js +2 -0
  31. package/dist/chunk-AAQQPKCU.js +2 -0
  32. package/dist/chunk-ADTBPVUZ.js +21 -0
  33. package/dist/chunk-AKB7V7TV.js +2 -0
  34. package/dist/chunk-ANFVSJWQ.js +11 -0
  35. package/dist/chunk-B2OB55RR.js +3 -0
  36. package/dist/chunk-B3UYV66Z.js +4 -0
  37. package/dist/chunk-B75HZHUP.js +2 -0
  38. package/dist/chunk-BFFZDZQV.js +2 -0
  39. package/dist/chunk-BGBBVSH4.js +2 -0
  40. package/dist/chunk-BH5F2Q4O.js +2 -0
  41. package/dist/chunk-BJ6SQAEN.js +2 -0
  42. package/dist/chunk-BMYOV5GP.js +77 -0
  43. package/dist/chunk-BVAJLC5A.js +7 -0
  44. package/dist/chunk-C6SBF2WH.js +4 -0
  45. package/dist/chunk-C74PPYLA.js +3 -0
  46. package/dist/chunk-C7QOQX32.js +8 -0
  47. package/dist/chunk-CAUCPUOF.js +7 -0
  48. package/dist/chunk-CO5R3UNA.js +2 -0
  49. package/dist/chunk-CQP3THUZ.js +7 -0
  50. package/dist/chunk-CVYSU6BX.js +16 -0
  51. package/dist/chunk-CWONGW6P.js +3 -0
  52. package/dist/chunk-DDZ7VHWV.js +20 -0
  53. package/dist/chunk-DGXRDLV5.js +2 -0
  54. package/dist/chunk-DO6WQD2T.js +3 -0
  55. package/dist/chunk-DQMDCD24.js +2 -0
  56. package/dist/chunk-DR2LURYU.js +3 -0
  57. package/dist/chunk-DRENNWRG.js +2 -0
  58. package/dist/chunk-ECQBG7PW.js +564 -0
  59. package/dist/chunk-EF2R3WNQ.js +2 -0
  60. package/dist/chunk-ELNRLMC5.js +29 -0
  61. package/dist/chunk-EMNIHCRB.js +18 -0
  62. package/dist/chunk-ENCCHKM6.js +5 -0
  63. package/dist/chunk-EZNMUY67.js +5 -0
  64. package/dist/chunk-FAJQ7LWY.js +3 -0
  65. package/dist/chunk-FDGD5AB5.js +2 -0
  66. package/dist/chunk-FETNQCFO.js +117 -0
  67. package/dist/chunk-FM5BPL4V.js +60 -0
  68. package/dist/chunk-FQKZWM4L.js +49 -0
  69. package/dist/chunk-FW53T7EB.js +2 -0
  70. package/dist/chunk-G6XFR4ZL.js +4 -0
  71. package/dist/chunk-GCHRX4YW.js +4 -0
  72. package/dist/chunk-GTIYTDRE.js +562 -0
  73. package/dist/chunk-GTXSJDCO.js +2 -0
  74. package/dist/chunk-GW6Z3WGY.js +2 -0
  75. package/dist/chunk-H3LGFZVK.js +2 -0
  76. package/dist/chunk-HKQUXIFO.js +2 -0
  77. package/dist/chunk-HOA5YGOH.js +3 -0
  78. package/dist/chunk-HPJRBHVT.js +3 -0
  79. package/dist/chunk-HRWGYWRJ.js +49 -0
  80. package/dist/chunk-I2T2LLK2.js +4 -0
  81. package/dist/chunk-ICFDQHAM.js +3 -0
  82. package/dist/chunk-ID63777H.js +4 -0
  83. package/dist/chunk-IJ4HMYBE.js +3 -0
  84. package/dist/chunk-ILMHV3KM.js +2 -0
  85. package/dist/chunk-IOP6FWIM.js +2 -0
  86. package/dist/chunk-IRQOAM5G.js +2 -0
  87. package/dist/chunk-J77SU6VA.js +38 -0
  88. package/dist/chunk-JE3WZ6II.js +2 -0
  89. package/dist/chunk-JEJLSICM.js +4 -0
  90. package/dist/chunk-JOIRNPPY.js +2 -0
  91. package/dist/chunk-JSOYNVWH.js +3 -0
  92. package/dist/chunk-KMITESMT.js +2 -0
  93. package/dist/chunk-KUW32IRO.js +2 -0
  94. package/dist/chunk-KWVHSKHK.js +31 -0
  95. package/dist/chunk-L4NRUAGJ.js +18 -0
  96. package/dist/chunk-L57ZKWVG.js +6 -0
  97. package/dist/chunk-LTA3BRZX.js +2 -0
  98. package/dist/chunk-LU3BMVH2.js +10 -0
  99. package/dist/chunk-LZYFLFEH.js +2 -0
  100. package/dist/chunk-MOVBWNIP.js +16 -0
  101. package/dist/chunk-MVB3DAEY.js +3 -0
  102. package/dist/chunk-N3IQCBCF.js +29 -0
  103. package/dist/chunk-NAUD7LCA.js +2 -0
  104. package/dist/chunk-NCZUNH3E.js +109 -0
  105. package/dist/chunk-NE6IU5ZD.js +5 -0
  106. package/dist/chunk-NEDP5RFQ.js +60 -0
  107. package/dist/chunk-NMTSZXCL.js +2 -0
  108. package/dist/chunk-NNJ2KZZG.js +4 -0
  109. package/dist/chunk-NNO6A2PO.js +2 -0
  110. package/dist/chunk-NNOKTMZT.js +20 -0
  111. package/dist/chunk-O6QTXQPJ.js +13 -0
  112. package/dist/chunk-OANDYLJQ.js +2 -0
  113. package/dist/chunk-OFBE4NGP.js +2 -0
  114. package/dist/chunk-OGTFJ3XD.js +2 -0
  115. package/dist/chunk-OL6KJP3N.js +16 -0
  116. package/dist/chunk-OLF4MA5W.js +8 -0
  117. package/dist/chunk-OTOKVOJ3.js +2 -0
  118. package/dist/chunk-OVTS4DKB.js +2 -0
  119. package/dist/chunk-OZYRSMSH.js +3 -0
  120. package/dist/chunk-P5XHIJHI.js +2 -0
  121. package/dist/chunk-PBI2LFKH.js +2 -0
  122. package/dist/chunk-PIOMTC27.js +2 -0
  123. package/dist/chunk-PTAWHLVJ.js +6 -0
  124. package/dist/chunk-PX4RYAAK.js +2 -0
  125. package/dist/chunk-PYAB5SM6.js +7 -0
  126. package/dist/chunk-Q5ELPRKQ.js +2 -0
  127. package/dist/chunk-Q65CQ4XL.js +2 -0
  128. package/dist/chunk-Q72QSKXC.js +308 -0
  129. package/dist/chunk-QCN62RTF.js +3 -0
  130. package/dist/chunk-QDCCHMVZ.js +2 -0
  131. package/dist/chunk-QHRNXP3C.js +3 -0
  132. package/dist/chunk-QKPLA6IC.js +2 -0
  133. package/dist/chunk-QOKYJ33H.js +2 -0
  134. package/dist/chunk-QW7EP6WI.js +21 -0
  135. package/dist/chunk-R2NOK63J.js +4 -0
  136. package/dist/chunk-RBAS5ZHI.js +2 -0
  137. package/dist/chunk-RDBI2RXU.js +9 -0
  138. package/dist/chunk-RKEJ6VTF.js +73 -0
  139. package/dist/chunk-RR7SX44N.js +35 -0
  140. package/dist/chunk-RU65DDUP.js +215 -0
  141. package/dist/chunk-SELM5MER.js +2 -0
  142. package/dist/chunk-SGX43S2L.js +2 -0
  143. package/dist/chunk-SMRBZ6EC.js +2 -0
  144. package/dist/chunk-SNNWPCN7.js +4 -0
  145. package/dist/chunk-ST7V3SKN.js +2 -0
  146. package/dist/chunk-SWHMHUKF.js +2 -0
  147. package/dist/chunk-SYDJMPES.js +2 -0
  148. package/dist/chunk-SZD2KF7Q.js +2 -0
  149. package/dist/chunk-T3DGWPXM.js +3 -0
  150. package/dist/chunk-TFZB6XTM.js +239 -0
  151. package/dist/chunk-TIIC3ZE7.js +2 -0
  152. package/dist/chunk-TRRC4ZJ7.js +2 -0
  153. package/dist/chunk-TXXOEMZJ.js +2 -0
  154. package/dist/chunk-UBGWN7I4.js +2 -0
  155. package/dist/chunk-UCD3H3UZ.js +5 -0
  156. package/dist/chunk-UDS562V4.js +5 -0
  157. package/dist/chunk-UNBY47BC.js +3 -0
  158. package/dist/chunk-UP3BUZR5.js +74 -0
  159. package/dist/chunk-UXM43C7T.js +3 -0
  160. package/dist/chunk-UZGZB3VB.js +3 -0
  161. package/dist/chunk-VE5AVNMP.js +2 -0
  162. package/dist/chunk-VEXUL62T.js +2 -0
  163. package/dist/chunk-VFY6Y2H6.js +61 -0
  164. package/dist/chunk-VUIYB2V3.js +2 -0
  165. package/dist/chunk-VXYS3FZD.js +23 -0
  166. package/dist/chunk-WE5RZHZ7.js +5 -0
  167. package/dist/chunk-WMPRTGH2.js +2 -0
  168. package/dist/chunk-WOQBZPIF.js +2 -0
  169. package/dist/chunk-XLQ3GLWZ.js +2 -0
  170. package/dist/chunk-XME3HPXZ.js +2 -0
  171. package/dist/chunk-XMQ23E27.js +2 -0
  172. package/dist/chunk-XWUOUWYI.js +2 -0
  173. package/dist/chunk-XZEE23VG.js +5 -0
  174. package/dist/chunk-Y6KHROC3.js +7 -0
  175. package/dist/chunk-YESXMKX3.js +3 -0
  176. package/dist/chunk-YMGZZEW4.js +2 -0
  177. package/dist/chunk-YSNONTJ2.js +2 -0
  178. package/dist/chunk-YUKYB54I.js +1 -0
  179. package/dist/chunk-YVCIMIOC.js +12 -0
  180. package/dist/chunk-Z54RD7VL.js +3 -0
  181. package/dist/chunk-ZKX2FRS6.js +15 -0
  182. package/dist/chunk-ZMI2JSX2.js +2 -0
  183. package/dist/chunk-ZV3JV5G5.js +8 -0
  184. package/dist/chunk-ZZ3MWF33.js +4 -0
  185. package/dist/chunk-ZZXSWSN6.js +2 -0
  186. package/dist/cli-context-3SNLDYBM.js +3 -0
  187. package/dist/cli-context-T3B7W6GG.js +2 -0
  188. package/dist/cli-program-YNOXO72B.js +7 -0
  189. package/dist/cli.js +3 -0
  190. package/dist/code-DlqpBDd0.d.ts +121 -0
  191. package/dist/command-descriptors-6AOUKWW7.js +346 -0
  192. package/dist/command-descriptors-ZFKJSRUP.js +344 -0
  193. package/dist/command-panels-SZONPMLJ.js +3 -0
  194. package/dist/config-types-BNoC96J3.d.ts +560 -0
  195. package/dist/db-D7sauVFH.d.ts +95 -0
  196. package/dist/direct-navigation-DP4LVMRX.js +3 -0
  197. package/dist/direct-navigation-FLUS3BT6.js +2 -0
  198. package/dist/exploration-topology-BG4v30HZ.d.ts +256 -0
  199. package/dist/file-dep-graph-Bqg3t3Px.d.ts +4 -0
  200. package/dist/file-kind-BKCVMNUf.d.ts +10 -0
  201. package/dist/frontend-behavior-evidence-EfM4_9bc.d.ts +4 -0
  202. package/dist/git-history-ChNHbfZQ.d.ts +13 -0
  203. package/dist/graph-evidence-BIFqyisO.d.ts +131 -0
  204. package/dist/health-DJaZXg8I.d.ts +340 -0
  205. package/dist/index.d.ts +183 -0
  206. package/dist/index.js +2 -0
  207. package/dist/invocation-command-descriptors-QT2JMY5J.js +3 -0
  208. package/dist/invocation-command-descriptors-YN4QJEAX.js +2 -0
  209. package/dist/next-anchor-candidates-BwMczMvX.d.ts +90 -0
  210. package/dist/output-continuation-command-2V2SL4TD.js +2 -0
  211. package/dist/output-continuation-command-65J5IP3O.js +3 -0
  212. package/dist/postinstall.js +3 -0
  213. package/dist/project-reindex-5JOKXAXT.js +2 -0
  214. package/dist/project-reindex-UQBIKO4M.js +3 -0
  215. package/dist/queries/affected.d.ts +40 -0
  216. package/dist/queries/affected.js +2 -0
  217. package/dist/queries/anchors.d.ts +123 -0
  218. package/dist/queries/anchors.js +2 -0
  219. package/dist/queries/architecture.d.ts +166 -0
  220. package/dist/queries/architecture.js +2 -0
  221. package/dist/queries/bottlenecks.d.ts +68 -0
  222. package/dist/queries/bottlenecks.js +2 -0
  223. package/dist/queries/by-kind.d.ts +27 -0
  224. package/dist/queries/by-kind.js +2 -0
  225. package/dist/queries/call-graph.d.ts +52 -0
  226. package/dist/queries/call-graph.js +2 -0
  227. package/dist/queries/change-surface.d.ts +55 -0
  228. package/dist/queries/change-surface.js +2 -0
  229. package/dist/queries/cleanup-plan.d.ts +66 -0
  230. package/dist/queries/cleanup-plan.js +2 -0
  231. package/dist/queries/co-change.d.ts +90 -0
  232. package/dist/queries/co-change.js +2 -0
  233. package/dist/queries/code.d.ts +6 -0
  234. package/dist/queries/code.js +2 -0
  235. package/dist/queries/complexity-hotspots.d.ts +61 -0
  236. package/dist/queries/complexity-hotspots.js +2 -0
  237. package/dist/queries/complexity.d.ts +74 -0
  238. package/dist/queries/complexity.js +2 -0
  239. package/dist/queries/context.d.ts +146 -0
  240. package/dist/queries/context.js +2 -0
  241. package/dist/queries/convergence.d.ts +33 -0
  242. package/dist/queries/convergence.js +2 -0
  243. package/dist/queries/coupling.d.ts +32 -0
  244. package/dist/queries/coupling.js +2 -0
  245. package/dist/queries/cycles.d.ts +66 -0
  246. package/dist/queries/cycles.js +2 -0
  247. package/dist/queries/dataflow.d.ts +77 -0
  248. package/dist/queries/dataflow.js +2 -0
  249. package/dist/queries/dead.d.ts +58 -0
  250. package/dist/queries/dead.js +2 -0
  251. package/dist/queries/decorative-checkers.d.ts +34 -0
  252. package/dist/queries/decorative-checkers.js +2 -0
  253. package/dist/queries/deep-chains.d.ts +5 -0
  254. package/dist/queries/deep-chains.js +2 -0
  255. package/dist/queries/dependence-slice.d.ts +46 -0
  256. package/dist/queries/dependence-slice.js +2 -0
  257. package/dist/queries/dependency-depth.d.ts +49 -0
  258. package/dist/queries/dependency-depth.js +2 -0
  259. package/dist/queries/deps.d.ts +15 -0
  260. package/dist/queries/deps.js +2 -0
  261. package/dist/queries/diff-impact.d.ts +165 -0
  262. package/dist/queries/diff-impact.js +2 -0
  263. package/dist/queries/doc-drift.d.ts +115 -0
  264. package/dist/queries/doc-drift.js +2 -0
  265. package/dist/queries/drift.d.ts +79 -0
  266. package/dist/queries/drift.js +2 -0
  267. package/dist/queries/duplicate-bodies.d.ts +55 -0
  268. package/dist/queries/duplicate-bodies.js +2 -0
  269. package/dist/queries/entry-map.d.ts +121 -0
  270. package/dist/queries/entry-map.js +2 -0
  271. package/dist/queries/evidence.d.ts +70 -0
  272. package/dist/queries/evidence.js +2 -0
  273. package/dist/queries/extract-candidates.d.ts +52 -0
  274. package/dist/queries/extract-candidates.js +2 -0
  275. package/dist/queries/fan.d.ts +53 -0
  276. package/dist/queries/fan.js +2 -0
  277. package/dist/queries/files.d.ts +20 -0
  278. package/dist/queries/files.js +2 -0
  279. package/dist/queries/health.d.ts +8 -0
  280. package/dist/queries/health.js +2 -0
  281. package/dist/queries/hierarchy.d.ts +21 -0
  282. package/dist/queries/hierarchy.js +2 -0
  283. package/dist/queries/hotspots.d.ts +42 -0
  284. package/dist/queries/hotspots.js +2 -0
  285. package/dist/queries/imports.d.ts +34 -0
  286. package/dist/queries/imports.js +2 -0
  287. package/dist/queries/incomplete-migration.d.ts +90 -0
  288. package/dist/queries/incomplete-migration.js +2 -0
  289. package/dist/queries/index.d.ts +180 -0
  290. package/dist/queries/index.js +2 -0
  291. package/dist/queries/isolated.d.ts +24 -0
  292. package/dist/queries/isolated.js +2 -0
  293. package/dist/queries/locality-candidates.d.ts +51 -0
  294. package/dist/queries/locality-candidates.js +2 -0
  295. package/dist/queries/members.d.ts +21 -0
  296. package/dist/queries/members.js +2 -0
  297. package/dist/queries/methods.d.ts +43 -0
  298. package/dist/queries/methods.js +2 -0
  299. package/dist/queries/not-implemented.d.ts +33 -0
  300. package/dist/queries/not-implemented.js +2 -0
  301. package/dist/queries/outline.d.ts +22 -0
  302. package/dist/queries/outline.js +2 -0
  303. package/dist/queries/passthrough-candidates.d.ts +41 -0
  304. package/dist/queries/passthrough-candidates.js +2 -0
  305. package/dist/queries/plan-context.d.ts +33 -0
  306. package/dist/queries/plan-context.js +2 -0
  307. package/dist/queries/react-component-duplicates.d.ts +39 -0
  308. package/dist/queries/react-component-duplicates.js +2 -0
  309. package/dist/queries/react-hook-candidates.d.ts +44 -0
  310. package/dist/queries/react-hook-candidates.js +2 -0
  311. package/dist/queries/react-large-component-pressure.d.ts +34 -0
  312. package/dist/queries/react-large-component-pressure.js +2 -0
  313. package/dist/queries/recent-duplicates.d.ts +79 -0
  314. package/dist/queries/recent-duplicates.js +2 -0
  315. package/dist/queries/redundant-reexports.d.ts +37 -0
  316. package/dist/queries/redundant-reexports.js +2 -0
  317. package/dist/queries/reference-neighborhood.d.ts +4 -0
  318. package/dist/queries/reference-neighborhood.js +2 -0
  319. package/dist/queries/reference-reachability.d.ts +48 -0
  320. package/dist/queries/reference-reachability.js +2 -0
  321. package/dist/queries/refs.d.ts +13 -0
  322. package/dist/queries/refs.js +2 -0
  323. package/dist/queries/self-audit.d.ts +65 -0
  324. package/dist/queries/self-audit.js +2 -0
  325. package/dist/queries/similar-chains.d.ts +48 -0
  326. package/dist/queries/similar-chains.js +2 -0
  327. package/dist/queries/similar-files.d.ts +35 -0
  328. package/dist/queries/similar-files.js +2 -0
  329. package/dist/queries/similar-signatures.d.ts +46 -0
  330. package/dist/queries/similar-signatures.js +2 -0
  331. package/dist/queries/similar.d.ts +187 -0
  332. package/dist/queries/similar.js +2 -0
  333. package/dist/queries/slice.d.ts +4 -0
  334. package/dist/queries/slice.js +2 -0
  335. package/dist/queries/source-inspection.d.ts +209 -0
  336. package/dist/queries/source-inspection.js +2 -0
  337. package/dist/queries/source-search.d.ts +85 -0
  338. package/dist/queries/source-search.js +2 -0
  339. package/dist/queries/stale-abstractions.d.ts +72 -0
  340. package/dist/queries/stale-abstractions.js +2 -0
  341. package/dist/queries/stats.d.ts +15 -0
  342. package/dist/queries/stats.js +2 -0
  343. package/dist/queries/surface.d.ts +22 -0
  344. package/dist/queries/surface.js +2 -0
  345. package/dist/queries/symbols.d.ts +14 -0
  346. package/dist/queries/symbols.js +2 -0
  347. package/dist/queries/system-map.d.ts +449 -0
  348. package/dist/queries/system-map.js +2 -0
  349. package/dist/queries/system.d.ts +21 -0
  350. package/dist/queries/system.js +2 -0
  351. package/dist/queries/test-quality.d.ts +56 -0
  352. package/dist/queries/test-quality.js +2 -0
  353. package/dist/queries/trace.d.ts +68 -0
  354. package/dist/queries/trace.js +2 -0
  355. package/dist/queries/twin-ab.d.ts +66 -0
  356. package/dist/queries/twin-ab.js +2 -0
  357. package/dist/queries/twin-drift.d.ts +119 -0
  358. package/dist/queries/twin-drift.js +2 -0
  359. package/dist/queries/unused-imports.d.ts +4 -0
  360. package/dist/queries/unused-imports.js +2 -0
  361. package/dist/queries/unused-params.d.ts +38 -0
  362. package/dist/queries/unused-params.js +2 -0
  363. package/dist/queries/value-flow.d.ts +42 -0
  364. package/dist/queries/value-flow.js +2 -0
  365. package/dist/queries/vue-component-duplicates.d.ts +43 -0
  366. package/dist/queries/vue-component-duplicates.js +2 -0
  367. package/dist/queries/vue-composable-candidates.d.ts +44 -0
  368. package/dist/queries/vue-composable-candidates.js +2 -0
  369. package/dist/queries/vue-large-view-pressure.d.ts +41 -0
  370. package/dist/queries/vue-large-view-pressure.js +2 -0
  371. package/dist/queries/wrapper-candidates.d.ts +34 -0
  372. package/dist/queries/wrapper-candidates.js +2 -0
  373. package/dist/reindex-worker.js +3 -0
  374. package/dist/reindex.d.ts +254 -0
  375. package/dist/reindex.js +298 -0
  376. package/dist/repository-text-C0Q8VYdN.d.ts +19 -0
  377. package/dist/runtime.d.ts +555 -0
  378. package/dist/runtime.js +4 -0
  379. package/dist/rust-semantic-session-server.js +2 -0
  380. package/dist/rust-semantic-session-worker.js +2 -0
  381. package/dist/rust-semantic-worker.js +2 -0
  382. package/dist/scip-cli-B7N3haxa.d.ts +67 -0
  383. package/dist/source-snippet-_wrcgmZc.d.ts +15 -0
  384. package/dist/symbol-types-BIQwfoAx.d.ts +74 -0
  385. package/dist/typescript-mailbox-worker.js +2 -0
  386. package/dist/watch-server.js +8 -0
  387. package/docs/AGENT_GUIDE.md +148 -0
  388. package/docs/AI_FAILURE_MODES.md +43 -0
  389. package/docs/API.md +40 -0
  390. package/docs/API_EVOLUTION.md +77 -0
  391. package/docs/CLI_JSON_OUTPUT.md +389 -0
  392. package/docs/COMMAND_REFERENCE.md +294 -0
  393. package/docs/CONFIGURATION_WRITE_SAFETY.md +131 -0
  394. package/docs/DETECTOR_GUIDE.md +46 -0
  395. package/docs/DURABILITY.md +159 -0
  396. package/docs/INDEX_GENERATIONS.md +167 -0
  397. package/docs/LOCK_PROTOCOL.md +133 -0
  398. package/docs/MAILBOX_LIFECYCLE.md +224 -0
  399. package/docs/REGEX_POLICY.md +36 -0
  400. package/docs/REINDEX_METADATA_COMPATIBILITY.md +104 -0
  401. package/docs/RUST_DURABLE_SESSION_PROTOCOL.md +126 -0
  402. package/docs/SECURITY_MODEL.md +125 -0
  403. package/docs/TELEMETRY_RETENTION.md +84 -0
  404. package/docs/TIME_SEMANTICS.md +77 -0
  405. package/docs/WATCH_REFRESH_REQUESTS.md +123 -0
  406. package/docs/WINDOWS_SIDECAR_RELEASE.md +424 -0
  407. package/docs/accuracy-audit-checklist.md +304 -0
  408. package/docs/accuracy-hardening-goal.md +500 -0
  409. package/docs/analyzer-inventory.md +78 -0
  410. package/docs/analyzer-validation-protocol.md +84 -0
  411. package/docs/architecture-coherence-vision.md +254 -0
  412. package/docs/assets/codebaseiq-logo-dark.svg +21 -0
  413. package/docs/assets/codebaseiq-logo.svg +24 -0
  414. package/docs/locality-analyzer-design.md +193 -0
  415. package/docs/schemas/cli-json-envelope.schema.json +237 -0
  416. package/docs/schemas/cli-output-page.schema.json +104 -0
  417. package/docs/schemas/npm-release-state.schema.json +146 -0
  418. package/docs/schemas/observation-receipt.schema.json +164 -0
  419. package/docs/schemas/project-config.schema.json +318 -0
  420. package/docs/schemas/suppression-record.schema.json +79 -0
  421. package/docs/schemas/windows-sidecar-provenance.schema.json +137 -0
  422. package/package.json +482 -0
  423. package/scripts/build-codebaseiq-windows.mjs +197 -0
  424. package/scripts/codebaseiq-windows-provenance.mjs +364 -0
  425. package/scripts/evidence-product-contract.mjs +197 -0
  426. package/scripts/verify-codebaseiq-windows.mjs +29 -0
  427. package/skills/codebaseiq/SKILL.md +75 -0
  428. package/skills/codebaseiq/agents/openai.yaml +4 -0
  429. package/skills/codebaseiq-explore/SKILL.md +34 -0
  430. package/skills/codebaseiq-explore/agents/openai.yaml +4 -0
  431. package/skills/concrete-plan/SKILL.md +79 -0
  432. package/skills/concrete-plan/agents/openai.yaml +4 -0
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,2 @@
1
+ import{a as v,b as j}from"./chunk-QDCCHMVZ.js";import{a as M}from"./chunk-35NLDRZC.js";import{a as P}from"./chunk-TIIC3ZE7.js";import{a as q}from"./chunk-NNOKTMZT.js";import{t as I}from"./chunk-FETNQCFO.js";import{p as x}from"./chunk-O6QTXQPJ.js";import{a as U}from"./chunk-ADTBPVUZ.js";var T=/\.(test|spec)\.(ts|tsx|js|jsx|mts|cts)$/,D=new Map;function V(e,r,t,o){if(!r?.testPaths?.length)return[];let c=k(r),s=[];for(let i of L(e,r.testPaths)){let a=z(e,i,o),l=a?t(a):null;if(l)for(let g of x(e,i)){let C=g.sourcePath;if(!C)continue;let d=t(C);d&&d!==l&&(c.get(l)?.has(d)||s.push({testFile:i,ownerBoundary:l,importedFile:C,importedBoundary:d,reason:"outside-owner-policy"}))}}return H(s)}function k(e){let r=e.allowedDependencies??{},t=e.boundaries.map(i=>i.name),o=new Map,c=(i,a)=>{for(let l of r[i]??[])a.has(l)||(a.add(l),c(l,a))};for(let i of t){let a=new Set;c(i,a),o.set(i,a)}let s=new Map;for(let i of t){let a=new Set(o.get(i));for(let l of t)l!==i&&o.get(l)?.has(i)&&a.add(l);s.set(i,a)}return s}function L(e,r){let t=`${e.config.projectRoot}\0${r.join("\0")}`,o=D.get(t);if(o)return o;let c=new Set;for(let i of r)for(let a of j(e.config.projectRoot,i))T.test(a)&&c.add(a);let s=[...c].sort();return D.set(t,s),s}function z(e,r,t){let o=r.replace(/^tests\//,"src/").replace(/\.(test|spec)\.(\w+)$/,".$2");if(o!==r&&t(o))return o;let c=r.split("/").pop().replace(/\.(test|spec)\.(\w+)$/,".$2"),s=x(e,r).map(i=>i.sourcePath).filter(i=>!!i&&t(i)&&i.split("/").pop()===c);return s.length===1?s[0]:null}function H(e){let r=new Map;for(let t of e){let o=`${t.testFile}\0${t.importedBoundary}`;r.has(o)||r.set(o,t)}return[...r.values()].sort((t,o)=>t.testFile.localeCompare(o.testFile)||t.importedBoundary.localeCompare(o.importedBoundary))}function O(e,r){let t=(e?.boundaries??[]).filter(o=>o.paths.some(c=>v(c,r)));return t.length===1?t[0].name:null}var b="architecture:";function G(e,r,t,o={}){let c=K(e,r);if(!t||t.boundaries.length===0)return{configured:!1,boundaries:[],edges:[],forbiddenEdges:[],reciprocalPairs:[],cycles:[],coarseBoundaries:[],staleAllowances:[],boundaryLimits:[],fragileEdges:[],testBoundaryViolations:[],coverage:{totalFiles:c.length,mappedFiles:0,unmappedFiles:[],ambiguousFiles:[]},policyCoverage:{declaredRows:0,totalBoundaries:0,missingRows:[],requiresCompletePolicy:!1,requiresCompleteCoverage:!1,requiresMinimalPolicy:!1}};let s=new Map,i=new Map(t.boundaries.map(n=>[n.name,new Set])),a=[],l=[];for(let n of c){let f=t.boundaries.filter(p=>p.paths.some(F=>v(F,n))).map(p=>p.name).sort();if(f.length===0)a.push(n);else if(f.length>1)l.push({file:n,boundaries:f});else{let p=f[0];s.set(n,p),i.get(p).add(n)}}let g=new Map;for(let[n,f]of e){let p=s.get(n);if(p)for(let F of f){let R=s.get(F);if(!R||p===R)continue;let $=w(p,R),B=g.get($);B||(B={from:p,to:R,fileEdges:[],importers:new Set,importedFiles:new Set},g.set($,B)),B.fileEdges.push({fromFile:n,toFile:F}),B.importers.add(n),B.importedFiles.add(F)}}let C=[...g.values()].map(n=>N(n,t)).sort(te),d=C,E=new Map(d.map(n=>[w(n.from,n.to),n])),S=new Map(t.boundaries.map(n=>[n.name,new Set]));for(let n of d)S.get(n.from).add(n.to);let m=[];for(let n of d){if(n.from>=n.to)continue;let f=E.get(w(n.to,n.from));f&&m.push({boundaries:[n.from,n.to],forward:n,reverse:f})}let{components:A}=M(S),y=A.filter(n=>n.length>1).map(n=>J(n,d,t.requireAcyclic===!0)).sort((n,f)=>f.boundaries.length-n.boundaries.length||n.boundaries.join("/").localeCompare(f.boundaries.join("/"))),h=t.allowedDependencies??{},u=t.boundaries.map(n=>n.name).filter(n=>!Object.hasOwn(h,n)).sort();return{configured:!0,boundaries:t.boundaries.map(n=>({name:n.name,paths:[...n.paths],fileCount:i.get(n.name).size,dependencyPolicyDeclared:Object.hasOwn(h,n.name)})).sort((n,f)=>n.name.localeCompare(f.name)),edges:C,forbiddenEdges:d.filter(n=>n.policyStatus==="forbidden"),reciprocalPairs:m,cycles:y,staleAllowances:W(t,d),boundaryLimits:Y(t,d,i),fragileEdges:d.filter(n=>n.fragile),testBoundaryViolations:o.testBoundaryViolations??[],coarseBoundaries:Q(e,i,o.isModuleHierarchyFile,t.requireResolvedBoundaries===!0,n=>t.boundaries.find(f=>f.name===n)?.subUnits??"directory"),coverage:{totalFiles:c.length,mappedFiles:s.size,unmappedFiles:a,ambiguousFiles:l},policyCoverage:{declaredRows:t.boundaries.length-u.length,totalBoundaries:t.boundaries.length,missingRows:u,requiresCompletePolicy:t.requireCompletePolicy===!0,requiresCompleteCoverage:t.requireCompleteCoverage===!0,requiresMinimalPolicy:t.requireMinimalPolicy===!0}}}function ge(e,r={}){let t=q(e,r.scope,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}),o=U(e,{includeIgnored:!1}).filter(s=>!r.scope||s.includes(r.scope)),c=new Set(o);return G(t,o,e.config.architecture,{isModuleHierarchyFile:s=>_(e,s),testBoundaryViolations:V(e,e.config.architecture,s=>O(e.config.architecture,s),s=>c.has(s))})}function _(e,r){let t=P(r);return t==="test"||t==="entry"?!0:t!=="barrel"?!1:I(e,r).length===0}function ye(e){let r=e.forbiddenEdges.map(o=>`${b}forbidden-edge:${encodeURIComponent(o.from)}:${encodeURIComponent(o.to)}`);if(e.policyCoverage.requiresCompletePolicy)for(let o of e.policyCoverage.missingRows)r.push(`${b}missing-policy-row:${encodeURIComponent(o)}`);if(e.policyCoverage.requiresCompleteCoverage){for(let o of e.coverage.unmappedFiles)r.push(`${b}unmapped-file:${encodeURIComponent(o)}`);for(let o of e.coverage.ambiguousFiles)r.push(`${b}ambiguous-file:${encodeURIComponent(o.file)}:${o.boundaries.map(c=>encodeURIComponent(c)).sort().join("|")}`)}if(e.policyCoverage.requiresMinimalPolicy)for(let o of e.staleAllowances)r.push(`${b}stale-allowance:${encodeURIComponent(o.from)}:${encodeURIComponent(o.to)}`);for(let o of e.testBoundaryViolations)r.push(`${b}test-boundary:${encodeURIComponent(o.testFile)}:${encodeURIComponent(o.importedBoundary)}`);for(let o of e.boundaryLimits)r.push(`${b}boundary-limit:${o.kind}:${encodeURIComponent(o.boundary)}`);let t=new Map;for(let o of e.coarseBoundaries)o.violatesPolicy&&t.set(o.boundary,(t.get(o.boundary)??0)+1);for(let[o,c]of t){let s=`${b}coarse-boundary:${encodeURIComponent(o)}`;r.push(s);for(let i=2;i<=c;i+=1)r.push(`${s}:component:${i}`)}for(let o of e.cycles)o.violatesPolicy&&r.push(`${b}cycle:${o.boundaries.map(c=>encodeURIComponent(c)).sort().join("|")}`);return[...new Set(r)].sort()}function he(e){return!!e&&(Object.keys(e.allowedDependencies??{}).length>0||e.requireCompletePolicy===!0||e.requireCompleteCoverage===!0||e.requireAcyclic===!0||e.requireResolvedBoundaries===!0||e.requireMinimalPolicy===!0||e.maxBoundaryFanOut!==void 0||e.maxBoundaryFiles!==void 0||e.boundaries.some(r=>r.maxFiles!==void 0)||(e.testPaths?.length??0)>0)}function K(e,r){let t=new Set(r);for(let[o,c]of e){t.add(o);for(let s of c)t.add(s)}return[...t].sort()}function N(e,r){let t=[...e.fileEdges].sort((o,c)=>o.fromFile.localeCompare(c.fromFile)||o.toFile.localeCompare(c.toFile));return{from:e.from,to:e.to,policyStatus:X(r,e.from,e.to),fileEdgeCount:t.length,importerCount:e.importers.size,importedFileCount:e.importedFiles.size,examples:t.slice(0,5),fragile:t.length===1}}function X(e,r,t){return!e.allowedDependencies||!Object.hasOwn(e.allowedDependencies,r)?"undeclared":e.allowedDependencies[r].includes(t)?"allowed":"forbidden"}function J(e,r,t){let o=[...e].sort(),c=new Set(o),s=r.filter(a=>c.has(a.from)&&c.has(a.to)),i=Math.min(...s.map(a=>a.fileEdgeCount));return{boundaries:o,internalEdges:s,narrowestEdges:s.filter(a=>a.fileEdgeCount===i),violatesPolicy:t}}function Q(e,r,t=Z,o=!1,c=()=>"directory"){let s=[];for(let[i,a]of r){let l=c(i)==="file"?m=>m:ee,g=[...a].filter(m=>!t(m));if(g.length<2)continue;let C=new Set(g),d=new Map,E=new Map;for(let m of g)E.set(l(m),new Set);for(let m of g)for(let A of e.get(m)??[]){if(!C.has(A))continue;let y=l(m),h=l(A);if(y===h)continue;let u=w(y,h),n=d.get(u);n||(n={from:y,to:h,fileEdges:[]},d.set(u,n)),n.fileEdges.push({fromFile:m,toFile:A}),E.get(y).add(h)}let{components:S}=M(E);for(let m of S){if(m.length<2)continue;let A=new Set(m),y=[...d.values()].filter(u=>A.has(u.from)&&A.has(u.to)).map(u=>({from:u.from,to:u.to,fileEdgeCount:u.fileEdges.length,examples:u.fileEdges.slice(0,5)})).sort((u,n)=>u.from.localeCompare(n.from)||u.to.localeCompare(n.to)),h=Math.min(...y.map(u=>u.fileEdgeCount));s.push({boundary:i,violatesPolicy:o,subUnits:[...m].sort(),internalEdges:y,narrowestEdges:y.filter(u=>u.fileEdgeCount===h)})}}return s.sort((i,a)=>a.subUnits.length-i.subUnits.length||i.boundary.localeCompare(a.boundary))}function W(e,r){let t=new Set(r.map(i=>w(i.from,i.to))),o=e.allowedDependencies??{},c=new Set(e.boundaries.map(i=>i.name)),s=[];for(let[i,a]of Object.entries(o))if(c.has(i))for(let l of a)!c.has(l)||t.has(w(i,l))||s.push({from:i,to:l});return s.sort((i,a)=>i.from.localeCompare(a.from)||i.to.localeCompare(a.to))}function Y(e,r,t){let o=[],c=new Map;for(let s of r)c.set(s.from,(c.get(s.from)??0)+1);for(let s of e.boundaries){if(e.maxBoundaryFanOut!==void 0){let a=c.get(s.name)??0;a>e.maxBoundaryFanOut&&o.push({boundary:s.name,kind:"fan-out",observed:a,limit:e.maxBoundaryFanOut})}let i=s.maxFiles??e.maxBoundaryFiles;if(i!==void 0){let a=t.get(s.name)?.size??0;a>i&&o.push({boundary:s.name,kind:"files",observed:a,limit:i})}}return o.sort((s,i)=>s.boundary.localeCompare(i.boundary)||s.kind.localeCompare(i.kind))}function Z(e){let r=P(e);return r==="test"||r==="entry"}function ee(e){let r=e.lastIndexOf("/");return r===-1?".":e.slice(0,r)}function w(e,r){return`${e}\0${r}`}function te(e,r){return e.from.localeCompare(r.from)||e.to.localeCompare(r.to)}export{b as a,G as b,ge as c,ye as d,he as e,Q as f};
2
+ //# sourceMappingURL=chunk-WMPRTGH2.js.map
@@ -0,0 +1,2 @@
1
+ import{f as B,g as S}from"./chunk-T3DGWPXM.js";import{b as O}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-BGBBVSH4.js";import{c as k}from"./chunk-C7QOQX32.js";import{a as L}from"./chunk-TIIC3ZE7.js";import{d as P}from"./chunk-SGX43S2L.js";import{d as I,g as z,j as D,u as $}from"./chunk-FETNQCFO.js";import{b as T,k as v,p as A}from"./chunk-O6QTXQPJ.js";import{y as _}from"./chunk-BMYOV5GP.js";import{d as p}from"./chunk-3LCDIREB.js";import{d as b}from"./chunk-NNJ2KZZG.js";var U=new Set(P());function $e(e,t={}){let{includeHomonyms:n=!1,limit:i}=t,s=X(e,t).filter(r=>r.relationship==="divergent"||n&&r.relationship==="homonym");return i?s.slice(0,i):s}function X(e,t={}){let{scope:n,minSimilarity:i=.3,scanLimit:s}=t,r=Q(e,{scope:n,scanLimit:s});return Y(r,{minSimilarity:i,isDelegatePair:De(e)}).filter(a=>!a.members.some(o=>_(e,o.file,o.startLine,"twin")))}function Y(e,t={}){let n=t.minSimilarity??.3,i=t.isDelegatePair,s=e.filter(c=>!V(c.leaf)&&!fe(c.leaf)&&L(c.file)!=="test"&&!D(c.symbol)&&!Z(c.symbol)&&!j(c.symbol,c.leaf)),{recordsByLeaf:r,recordOrder:a}=p("twin-drift.group-by-leaf",()=>q(s),()=>({records:s.length})),o=p("twin-drift.cluster-leaf-names",()=>W([...r.keys()]),()=>({leaves:r.size}));return p("twin-drift.compare-clusters",()=>{let c=[];for(let h of o){let u=J(h,r,a);if(u.length<2||new Set(u.map(f=>f.file)).size<2)continue;let m=null,R=!1,C=!1,y=new Set;for(let f=0;f<u.length;f+=1)for(let w=f+1;w<u.length;w+=1){let d=u[f],g=u[w];if(d.file===g.file||!ge(d,g)||i?.(d,g,u)||i?.(g,d,u))continue;if(R=!0,y.add(d.symbol),y.add(g.symbol),d.normalizedBody===g.normalizedBody){C=!0;continue}let M=oe(d.tokens,g.tokens);(!m||M>m.similarity)&&(m={a:d,b:g,similarity:M})}if(!R)continue;let x=u.filter(f=>y.has(f.symbol)).sort((f,w)=>f.file.localeCompare(w.file)||f.startLine-w.startLine).map(se);if(!m){c.push({leaf:G(h),relationship:C?"identical":"homonym",maxDivergence:0,members:x});continue}let N=m.similarity>=n?"divergent":"homonym";c.push({leaf:G(h),relationship:N,maxDivergence:Math.round((1-m.similarity)*1e3)/1e3,members:x,...N==="divergent"?{firstDivergentTokens:ae(m.a.tokens,m.b.tokens)}:{}})}return c},()=>({clusters:o.length,records:s.length})).sort((c,h)=>h.members.length-c.members.length||h.maxDivergence-c.maxDivergence||c.leaf.localeCompare(h.leaf))}function q(e){let t=new Map,n=new Map;for(let[i,s]of e.entries()){let r=t.get(s.leaf)??[];r.push(s),t.set(s.leaf,r),n.set(s,i)}return{recordsByLeaf:t,recordOrder:n}}function J(e,t,n){let i=[...e].flatMap(s=>t.get(s)??[]);return e.size>1&&i.sort((s,r)=>(n.get(s)??0)-(n.get(r)??0)),i}function Q(e,t){let n=p("twin-drift.load-definitions",()=>$(e,{scope:t.scope}).filter(r=>ee(r)&&!e.isIgnored(r.relativePath)).filter(r=>!k(r.relativePath)));p("twin-drift.sort-definitions",()=>n.sort((r,a)=>r.relativePath.localeCompare(a.relativePath)||r.startLine-a.startLine),()=>({definitions:n.length}));let i=O(n,t.scanLimit),s=p("twin-drift.select-candidates",()=>te(i),()=>({scanned:i.length}));return p("twin-drift.build-records",()=>{let r=[];for(let a of s){let o=ne(e,a);o&&r.push(o)}return r},()=>({candidates:s.length,scanned:i.length}))}function ee(e){return e.isFunctionLike?e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&U.has(e.kind):!0:!1}function te(e){let t=e.filter(r=>r.leaf&&!V(r.leaf)&&!D(r.symbol)&&!Z(r.symbol)&&!j(r.symbol,r.leaf)),n=new Map;for(let r of t){let a=n.get(r.leaf)??[];a.push(r),n.set(r.leaf,a)}let i=W([...n.keys()]),s=new Set;for(let r of i){let a=[...r].flatMap(o=>n.get(o)??[]);if(!(a.length<2)&&!(new Set(a.map(o=>o.relativePath)).size<2)&&!a.every(o=>L(o.relativePath)==="test"))for(let o of a)s.add(o)}return e.filter(r=>s.has(r))}function ne(e,t){if(!t.leaf)return null;let n=B(e,t);if(!n||!z(t.symbol)&&!re(n,t.leaf))return null;let i=T(S(n)),s=i.replace(/\s+/g,"");if(!s||s.length<8)return null;let r=i.match(ie)??[];return r.length===0?null:{leaf:t.leaf,symbol:t.symbol,shortName:I(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:E(t),normalizedBody:s,tokens:r,isThinForwarder:H(i)}}function re(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`\\b(?:const|let|var)\\s+${n}(?:\\s*:[^=]+)?\\s*=\\s*(?:async\\s*)?(?:\\([^)]*\\)|[A-Za-z_$][\\w$]*)\\s*=>`,"s").test(e)}var ie=/[A-Za-z_$][A-Za-z0-9_$]*|\d+(?:\.\d+)?|[^\sA-Za-z0-9_$]/g;function se(e){return{symbol:e.symbol,shortName:e.shortName,file:e.file,startLine:e.startLine,endLine:e.endLine,loc:e.loc}}function oe(e,t){let n=new Set(e),i=new Set(t);if(n.size===0&&i.size===0)return 1;if(n.size===0||i.size===0)return 0;let s=0;for(let a of n)i.has(a)&&(s+=1);let r=n.size+i.size-s;return r===0?0:s/r}function ae(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;let s=e.slice(i,i+6).join(" "),r=t.slice(i,i+6).join(" ");return!s&&!r?"(bodies differ only in trailing length)":`A: ${s||"(end)"} | B: ${r||"(end)"}`}function W(e){let t=new Map;for(let a of e)t.set(a,a);let n=a=>{let o=a;for(;t.get(o)!==o;)o=t.get(o);let l=a;for(;t.get(l)!==o;){let c=t.get(l);t.set(l,o),l=c}return o},i=(a,o)=>{let l=n(a),c=n(o);l!==c&&t.set(l,c)},s=new Map;for(let a of e){let o=a.slice(0,2).toLowerCase(),l=s.get(o)??[];l.push(a),s.set(o,l)}for(let a of s.values())for(let o=0;o<a.length;o+=1)for(let l=o+1;l<a.length;l+=1)le(a[o],a[l])&&i(a[o],a[l]);let r=new Map;for(let a of e){let o=n(a),l=r.get(o)??new Set;l.add(a),r.set(o,l)}return[...r.values()]}function le(e,t){return e===t||e.toLowerCase()===t.toLowerCase()?!0:e.length<8||t.length<8||Math.abs(e.length-t.length)>2||ce(e.toLowerCase(),t.toLowerCase())/Math.max(e.length,t.length)<.8?!1:pe(e.toLowerCase(),t.toLowerCase(),2)}function ce(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;return i}function fe(e){return/^[A-Z][A-Z0-9_]*$/.test(e)||/^__[^_].*__$/.test(e)||ue.has(e.toLowerCase())}var ue=new Set(["main","row"]),me=new Set(["app","component","components","feature","features","impl","index","lib","route","routes","shared","src","tsx","typescript","ui"]);function Z(e){return e.startsWith("rust-analyzer ")&&/\/(?:tests?|benches?)\//.test(e)}var de=new Set(["default","new","reset"]);function j(e,t){return e.startsWith("rust-analyzer ")&&de.has(t.toLowerCase())}function ge(e,t){if(e.leaf.toLowerCase()!==t.leaf.toLowerCase()||e.leaf.length>4)return!0;let n=F(e);return[...F(t)].some(i=>n.has(i))}function F(e){let t=e.leaf.toLowerCase();return new Set(`${e.file}/${e.shortName}`.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>2&&n!==t&&!me.has(n)))}function pe(e,t,n){if(Math.abs(e.length-t.length)>n)return!1;let i=Array.from({length:t.length+1},(s,r)=>r);for(let s=1;s<=e.length;s+=1){let r=[s],a=r[0];for(let o=1;o<=t.length;o+=1){let l=e[s-1]===t[o-1]?0:1,c=Math.min(i[o]+1,r[o-1]+1,i[o-1]+l);r.push(c),a=Math.min(a,c)}if(a>n)return!1;i=r}return i[t.length]<=n}function ke(e){return H(T(S(e)))}function H(e){let t=e.trim();if(!t||he.test(t))return!1;let n=be(t);return n.length===0||n.length>2?!1:ye(n[n.length-1])}var he=/\b(?:if|else|for|while|switch|try|catch|do)\b/,we=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[[^[\]]*\])*\((?:[^()]|\([^()]*\))*\)$/;function ye(e){let t=e.trim().replace(/^return\s+/,"").replace(/^await\s+/,"").replace(/;\s*$/,"").trim();return we.test(t)}function be(e){let t=[],n=0,i="";for(let s of e){if(s==="("||s==="["||s==="{"?n+=1:(s===")"||s==="]"||s==="}")&&(n=Math.max(0,n-1)),s===";"&&n===0){t.push(i),i="";continue}i+=s}return i.trim()&&t.push(i),t.map(s=>s.trim()).filter(s=>s.length>0)}var Te=3;function De(e){let t=new Map;return(n,i,s)=>{if(!n.isThinForwarder)return!1;let r=`${n.symbol}\0${i.symbol}`,a=t.get(r);if(a!==void 0)return a;let o=K(e,n,i,s,Te,new Set);return t.set(r,o),o}}function K(e,t,n,i,s,r){if(s<=0||r.has(t.symbol)||(r.add(t.symbol),(v(e,t.file)??[]).filter(l=>l.line>=t.startLine&&l.line<=t.endLine&&l.calleeLeaf===n.leaf).length===0))return!1;let o=new Set(A(e,t.file).filter(l=>l.sourcePath&&(l.kind!=="namespace"||l.usedMembers.includes(n.leaf))).map(l=>l.sourcePath));if([...o].some(l=>b(l,n.file)))return!0;for(let l of i)if(!(l.symbol===t.symbol||l.symbol===n.symbol||!l.isThinForwarder)&&[...o].some(c=>b(c,l.file))&&K(e,l,n,i,s-1,r))return!0;return!1}function V(e){return e.startsWith("<")&&e.endsWith(">")}function G(e){return[...e].sort()[0]}export{$e as a,X as b,Y as c,ke as d,be as e};
2
+ //# sourceMappingURL=chunk-WOQBZPIF.js.map
@@ -0,0 +1,2 @@
1
+ import{b as c,e as p,g as u,i as b}from"./chunk-CWONGW6P.js";import{h as x,v as m}from"./chunk-NNJ2KZZG.js";import{createHash as P}from"crypto";import{TextDecoder as k}from"util";var D=new k("utf-8",{fatal:!0});function j(e){return b(e.config.projectRoot)}function I(e,t){let r=x(t),i;try{i=p(e.config.projectRoot,r,{inputKind:"repository text file"})}catch(s){if(u(s)||s instanceof c)return null;throw s}let n=T(i);return n===null?null:F(r,i,n,v(e),S(e))}function L(e,t={}){let r=j(e).filter(o=>!t.scope||o.includes(t.scope)),i=v(e),n=S(e),s=[],l=[],f=[],d=[],g=0;for(let o of r){let a;try{a=p(e.config.projectRoot,o,{inputKind:"repository text file"})}catch(y){if(y instanceof c){d.push(o);continue}if(u(y))continue;f.push(o);continue}let h=T(a);if(h===null){l.push(o);continue}g+=a.byteLength,s.push(F(o,a,h,i,n))}return{files:s,candidateFiles:r.length,scannedBytes:g,skippedBinaryPaths:l,skippedUnreadablePaths:f,skippedOversizedPaths:d}}function F(e,t,r,i,n){let s=P("sha256").update(t).digest("hex");return{relativePath:e,text:r,bytes:t.byteLength,freshness:{exactText:{state:"current",basis:"working-tree-read",sha256:s},semantic:w(e,s,i,n)}}}function w(e,t,r,i){if(!i.has(e))return{state:"unavailable",basis:"no-compiler-document"};let n=r.get(e);return n?{state:n===t?"aligned":"stale",basis:"indexed-input-fingerprint"}:{state:"unavailable",basis:"fingerprint-unavailable"}}function S(e){return new Set(e.all(`SELECT documents.relative_path FROM documents WHERE 1 = 1 ${e.pathExclusionsFor("documents")}`).map(t=>t.relative_path))}function v(e){let t=new Map;if(!e.generation.metadataRaw)return t;let r=m(e.generation.metadataRaw);if(r.kind!=="legacy"&&r.kind!=="supported")return t;let i=r.metadata.fingerprint;if(!R(i)||!Array.isArray(i.files))return t;for(let n of i.files)!R(n)||typeof n.path!="string"||typeof n.hash!="string"||t.set(n.path,n.hash);return t}function T(e){if(e.includes(0))return null;try{return D.decode(e)}catch{return null}}function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}export{j as a,I as b,L as c};
2
+ //# sourceMappingURL=chunk-XLQ3GLWZ.js.map
@@ -0,0 +1,2 @@
1
+ import{c as p}from"./chunk-7FND7D7N.js";import{a as y}from"./chunk-JOIRNPPY.js";import{a as h}from"./chunk-J77SU6VA.js";import{o as u}from"./chunk-CVYSU6BX.js";import{a as S,c as b}from"./chunk-UZGZB3VB.js";import{A as d,d as m}from"./chunk-FETNQCFO.js";function x(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,l=S(e,o);return l?c==="backward"?k(e,l,s,{semantic:r.semantic!==!1}):D(e,l,{semantic:r.semantic!==!1}):null}function j(e,o,r={}){return x(e,o,r)}function k(e,o,r,c){let s=[],l=new Set([o.symbol]),t=[o];for(let n=1;n<=r&&t.length!==0;n++){let i=[];for(let g of t){let w=h(e,g,{semantic:c.semantic,semanticEvidence:y});for(let a of w){if(l.has(a.symbol))continue;l.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function D(e,o,r){let c=new Set,s=[],l=new p(e);for(let t of u(e,o,{semantic:r.semantic,semanticEvidence:y})){if(s.length>=30)break;let n=t.enclosingSymbol??d(l.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{x as a,j as b};
2
+ //# sourceMappingURL=chunk-XME3HPXZ.js.map
@@ -0,0 +1,2 @@
1
+ import{c as y}from"./chunk-7FND7D7N.js";import{b as h,e as b}from"./chunk-UZGZB3VB.js";import{d as u,e as i,g as c}from"./chunk-FETNQCFO.js";import{f as m}from"./chunk-O6QTXQPJ.js";import{z as l}from"./chunk-ADTBPVUZ.js";import{basename as f}from"path";function g(t,o){let n=o.className,e=h(t,n);return e.match?e.total>1?{kind:"ambiguous",query:n,total:e.total,candidates:[p(e.match),...e.candidates]}:{kind:"matched",query:n,owner:L(e.match),methods:M(t,e.match)}:{kind:"missing",query:n,suggestions:b(t,n,5)}}function j(t,o){let n=g(t,{className:o});if(n.kind==="missing")throw new Error(`No class definition matched '${o}'.`);if(n.kind==="ambiguous"){let e=n.candidates.map(s=>`${s.relativePath}:${s.startLine+1}`).join(", ");throw new Error(`Class '${o}' is ambiguous across ${n.total} definitions (${e}). Qualify it with a path or exact SCIP symbol identity.`)}return n.methods}function M(t,o){let n=i(o.symbol),s=new y(t).definitionsForFile(o.relativePath).filter(r=>c(r.symbol)),a=s.filter(r=>r.parentTypeName===n||r.symbol.includes(n)),d=(a.length>0?a:S(f(o.relativePath))===n?s.filter(r=>r.symbol.includes("<invalid-global-code>")):[]).map(r=>({startLine:r.startLine,endLine:r.endLine,name:i(r.symbol)}));return l(o.relativePath)!=="clojure"?d:R(d,w(t,o))}function p(t){return{symbol:t.symbol,shortName:u(t.symbol),relativePath:t.relativePath,startLine:t.startLine}}function L(t){return{...p(t),endLine:t.endLine}}function S(t){return t.replace(/\.[^.]+$/,"")}function w(t,o){let n=i(o.symbol);return n?(m(t,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===n).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function R(t,o){let n=new Map;for(let e of[...t,...o])n.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...n.values()].sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine)}export{g as a,j as b};
2
+ //# sourceMappingURL=chunk-XMQ23E27.js.map
@@ -0,0 +1,2 @@
1
+ import{a as R,b as P}from"./chunk-IRQOAM5G.js";import{a as C,c as B,e as a,f}from"./chunk-OTOKVOJ3.js";import{a as v,b as h,c as k}from"./chunk-NMTSZXCL.js";import{M as g}from"./chunk-ADTBPVUZ.js";function D(e,o={}){let{minSimilarity:r=.62,minTokens:n=8,limit:l=20,scope:m,scanLimit:d,filePattern:p,focusFiles:u}=o,c=g(e).reactProfiles({scope:m,minJsxTokens:n,scanLimit:d}).filter(t=>t.kind==="component").map(t=>({file:t.file,component:t.name,tokens:t.jsxTokens,profile:t})),s=R(c,t=>t.tokens);return P({profiles:c,limit:l,filePattern:p,focusFiles:u,candidateIndex:s,profile:{name:"react-component-duplicates"},compare:(t,i)=>y(t,i,r),sort:(t,i)=>i.similarity-t.similarity||t.fileA.localeCompare(i.fileA)||t.componentA.localeCompare(i.componentA)||t.fileB.localeCompare(i.fileB)||t.componentB.localeCompare(i.componentB)})}function y(e,o,r){let n=v(e.tokens,o.tokens);if(n.size<6||!T(n))return null;let l=k(e.tokens,o.tokens);if(l<r)return null;let m=a(n,"component:"),d=a(n,"native:"),p=a(n,"prop:"),u=a(n,"event:"),c=a(n,"binding:"),s=b({sharedComponents:m,sharedNativeTags:d,sharedProps:p,sharedEvents:u,sharedBindings:c});return{fileA:e.file,componentA:e.component,fileB:o.file,componentB:o.component,similarity:l,tokenCountA:e.tokens.size,tokenCountB:o.tokens.size,sharedTokens:f(n),sharedComponents:m,sharedNativeTags:d,sharedProps:p,sharedEvents:u,sharedBindings:c,evidenceClass:s.evidenceClass,actionTier:s.actionTier,evidenceClassReasons:s.reasons,recommendation:s.recommendation,uniqueToA:f(h(e.tokens,o.tokens)).slice(0,25),uniqueToB:f(h(o.tokens,e.tokens)).slice(0,25),locA:e.profile.loc,locB:o.profile.loc}}function T(e){let o=0,r=0;for(let n of e)n.startsWith("component:")&&(o+=1),(n.startsWith("prop:")||n.startsWith("event:")||n.startsWith("native:")||n.startsWith("jsx:"))&&(r+=1);return B([{name:"component",count:o},{name:"shape",count:r}],[{min:{component:1},reason:"shared custom component"},{min:{shape:4},reason:"shared JSX structure"}]).pass}function b(e){return C({genericWords:w,primitiveGroups:[{values:e.sharedNativeTags,reasonPrefix:"shared native tags",bucket:"generic"},{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"}],recommendation:A})}function A(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific UI primitive around the named domain structure.";case"shared-abstraction":return"Review the existing shared component usage first; extract only if duplicated structure remains outside it.";case"generic-workflow-scaffolding":return"Generic structural overlap \u2014 verify intent before consolidating."}}var w=new Set(["actions","app","button","card","children","content","container","dialog","field","form","header","input","item","label","layout","list","modal","page","panel","row","section","shell","table","text","toolbar","ui","value","view","wrapper"]);export{D as a};
2
+ //# sourceMappingURL=chunk-XWUOUWYI.js.map
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ var c=new Map([[8,"\u2408"],[9,"\u2409"],[10,"\u2424"],[13,"\u240D"]]);function u(n,o={}){let r=o.allowNewlines??!0,i=o.allowTabs??!0,l="";for(let e=0;e<n.length;){let t=n.charCodeAt(e);if(t===27){e=f(n,e);continue}if(t===155){e=x(n,e+1);continue}if(t===144||t===152||t===157||t===158||t===159){e=a(n,e+1);continue}if(m(t)){t===10&&r?l+=`
3
+ `:t===9&&i?l+=" ":l+=c.get(t)??"\uFFFD",e+=1;continue}if(C(t)){l+="\uFFFD",e+=1;continue}l+=n[e],e+=1}return l}function T(n){return u(n,{allowNewlines:!1,allowTabs:!1})}function g(n,o=r=>process.stdout.write(r)){o(`${n}
4
+ `)}function h(n=console){let o={log:n.log.bind(n),error:n.error.bind(n),warn:n.warn.bind(n)};return n.log=(...r)=>o.log(...r.map(s)),n.error=(...r)=>o.error(...r.map(s)),n.warn=(...r)=>o.warn(...r.map(s)),()=>{n.log=o.log,n.error=o.error,n.warn=o.warn}}function s(n){return typeof n=="string"?u(n):n}function f(n,o){let r=n.charCodeAt(o+1);if(Number.isNaN(r))return n.length;if(r===91)return x(n,o+2);if(r===80||r===88||r===93||r===94||r===95)return a(n,o+2);let i=o+1;for(;i<n.length&&w(n.charCodeAt(i));)i+=1;return i<n.length&&b(n.charCodeAt(i))?i+1:o+1}function x(n,o){let r=o;for(;r<n.length;){let i=n.charCodeAt(r);if(r+=1,i>=64&&i<=126)return r}return n.length}function a(n,o){let r=o;for(;r<n.length;){let i=n.charCodeAt(r);if(i===7||i===156)return r+1;if(i===27&&n.charCodeAt(r+1)===92)return r+2;r+=1}return n.length}function w(n){return n>=32&&n<=47}function b(n){return n>=48&&n<=126}function m(n){return n<=31||n>=127&&n<=159}function C(n){return n===1564||n===8206||n===8207||n>=8234&&n<=8238||n>=8294&&n<=8297}export{u as a,T as b,g as c,h as d};
5
+ //# sourceMappingURL=chunk-XZEE23VG.js.map
@@ -0,0 +1,7 @@
1
+ import{d as j}from"./chunk-PTAWHLVJ.js";import{a as k}from"./chunk-ST7V3SKN.js";import{a as _}from"./chunk-QHRNXP3C.js";import{b as C}from"./chunk-XLQ3GLWZ.js";import{a as T}from"./chunk-VE5AVNMP.js";import{g as S}from"./chunk-J77SU6VA.js";import{a as O,b as w,e as $}from"./chunk-UZGZB3VB.js";import{d as L,e as I,t as g}from"./chunk-FETNQCFO.js";import{f as B,p as M}from"./chunk-O6QTXQPJ.js";import{v as P}from"./chunk-BMYOV5GP.js";import{a as F}from"./chunk-NNJ2KZZG.js";import{basename as le,extname as U}from"path";var ee=12,ne=280;function y(n,e,t,o){let i=te(n,e,t,o);if(i.size===0)return se();let r=[],s=new Set,l=(a,d,c,f)=>{if(d===e&&c<=o&&f>=t)return;let b=`${d}:${c}:${f}:${a}`;s.has(b)||(s.add(b),r.push({name:a,relativePath:d,startLine:c,endLine:f}))};for(let a of g(n,e))i.has(a.leaf)&&l(a.leaf,a.relativePath,a.startLine,a.endLine);for(let a of M(n,e)){let d=a.localName;if(!d||!i.has(d)||!a.sourcePath||a.kind==="namespace")continue;let c=a.importedName==="default"?d:a.importedName;for(let f of T(n,a.sourcePath,c,{maxReexportDepth:3}))l(d,f.relativePath,f.startLine,f.endLine)}r.sort(W);let u=r.map(a=>{let d=ie(n,a);return d?{...a,source:d}:null}).filter(a=>a!==null).slice(0,ee);return D(u)}function A(n,e=[]){return D(re(n.flatMap(t=>t?.inline??[]),e))}function Ne(n){return n?n.inline.reduce((e,t)=>e+t.name.length+t.source.length+32,0):0}function te(n,e,t,o){let i=B(n,e),r=new Set;if(!i)return r;for(let s=t;s<=o;s+=1)for(let l of i.identifiersByLine[s]??[])r.add(l);return r}function ie(n,e){if(e.startLine!==e.endLine)return null;let t=(P(n,e.relativePath)[e.startLine]??"").trim();if(!t||t.length>ne)return null;let o=t.indexOf("=");if(o<0||t[o+1]===">")return null;let i=t.slice(o+1).replace(/(?:\/\/|#).*$/u,"").trim();if(!i||i.includes("${")||/\b(?:function|class|struct|interface|trait|enum|lambda)\b/u.test(i))return null;let s=i.replace(/(['"`])(?:\\.|(?!\1).)*\1/gu,"").replace(/\b(?:0[xX][\dA-Fa-f_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d+)?)n?\b/gu,""),l=new Set(["true","false","null","undefined","None","True","False"]);return(s.match(/[A-Za-z_][A-Za-z0-9_]*/gu)??[]).some(a=>!l.has(a))?null:t}function re(n,e){let t=new Map;for(let o of n){if(oe(o,e))continue;let i=`${o.relativePath}:${o.startLine}:${o.endLine}:${o.name}`;t.has(i)||t.set(i,{...o})}return[...t.values()].sort(W)}function oe(n,e){return e.some(t=>t.relativePath===n.relativePath&&t.startLine<=n.startLine&&t.endLine>=n.endLine)}function W(n,e){return n.relativePath.localeCompare(e.relativePath)||n.startLine-e.startLine||n.name.localeCompare(e.name)}function D(n){return{coverage:"indexed-project-literal-values",inline:n}}function se(){return D([])}function Ae(n,e,t={}){let{context:o=0}=t,i=Y(e);if(i)return q(n,i.filePath,i.startLine,i.endLine,o);let r=Q(n,e);if(r)return K(n,r);let s=O(n,e);return s?p(n,s,o):null}function We(n,e,t={}){if(e.length===0)throw new RangeError("code requires at least one selector.");if(e.length>24)throw new RangeError(`code accepts at most ${24} selectors per complete packet; received ${e.length}.`);let o=t.context??0,i=t.members??"exported",r=e.map(u=>ue(n,u,o,i)),s=r.flatMap(u=>u.results),l=s.map(u=>({relativePath:u.relativePath,startLine:u.startLine,endLine:u.endLine}));return{requested:e.length,matched:r.filter(u=>u.status==="matched").length,ambiguous:r.filter(u=>u.status==="ambiguous").length,missing:r.filter(u=>u.status==="missing").length,entries:r,bindingClosure:A(s.map(u=>u.bindingClosure),l)}}function ue(n,e,t,o){let i=Y(e);if(i){let d=q(n,i.filePath,i.startLine,i.endLine,t);return d?de(n,e,d,t):x(n,e,"definition-source-unreadable")}let r=Q(n,e);if(r)return fe(n,e,r,t,o);let s=w(n,e);if(!s.match)return x(n,e,"definition-not-found");let l=Le(n,s),u=l.map(V);if(s.total>1){let d=s.total<=4&&l.length===s.total;return{selector:e,status:"ambiguous",kind:"source",totalCandidates:s.total,results:d?l.flatMap(c=>{let f=p(n,c,t);return f?[f]:[]}):[],definitions:[],candidates:u,omittedCandidates:Math.max(0,s.total-u.length),suggestions:[]}}let a=p(n,s.match,t);return a?ve(e,a):x(n,e,"definition-source-unreadable")}function de(n,e,t,o){let i=g(n,t.relativePath).filter(a=>!X(a,t.relativePath)),r=ce(n,t,i),s=G(r.map(a=>p(n,a,o)).filter(a=>a!==null)).filter(a=>!J(t,a)),l=new Set(s.map(a=>a.symbol)),u=r.filter(a=>!l.has(a.symbol)&&!(t.startLine<=a.startLine&&t.endLine>=a.endLine)).map(V);return{selector:e,status:"matched",kind:"source",totalCandidates:1,results:[t,...s],definitions:[],candidates:[],omittedCandidates:0,suggestions:[],rangeCoverage:{basis:"requested-range-and-same-file-call-closure",referencedDefinitions:r.length,returnedDefinitions:r.length-u.length,returnedBodies:s.length,omittedDefinitions:u.length,omittedLedger:u}}}function ce(n,e,t){if(!h(e.freshness))return[];if(t.length===0)return[];let o=S(n,t,{additive:!1,semantic:!1}),i=new Map;for(let s of t){let l=i.get(s.symbol)??[];l.push(s),i.set(s.symbol,l)}let r=new Map;for(let s of t)if(!(s.endLine<e.startLine||s.startLine>e.endLine)){for(let l of o.get(s.symbolId)??[])if(l.file===e.relativePath&&!(l.source==="ast-callsite"&&(l.chunkId<e.startLine||l.chunkId>e.endLine)))for(let u of i.get(l.symbol)??[])r.set(u.symbolId,u)}return H(n,[...r.values()],t)}function fe(n,e,t,o,i){let r=t.relativePath,s=ge(n,r),l=h(t.freshness)?g(n,r).filter(m=>!X(m,r)):[],u=l.filter(m=>_(n,m)),a=u.length>0?u:me(s,l),d=i==="all"?[]:H(n,a,l),c=i==="all"||l.length===0?[K(n,t)]:G(d.map(m=>p(n,m,o)).filter(m=>m!==null)),f=he(s,c),b=be(r,s,c),N=Ce(s);return{selector:e,status:"matched",kind:"file-source",totalCandidates:1,results:c,definitions:[],candidates:[],omittedCandidates:0,suggestions:[],fileCoverage:{members:i,basis:i==="all"||l.length===0?"complete-file-source":u.length>0?"explicit-exports-and-same-file-reference-closure":"top-level-and-same-file-reference-closure",totalDefinitions:N,returnedDefinitions:f,returnedBodies:c.length,omittedDefinitions:Math.max(0,N-f),omittedLedger:b}}}function me(n,e){let t=new Set(n.map(o=>o.symbol));return e.filter(o=>t.has(o.symbol))}function ge(n,e){return k(n,e).flatMap(t=>pe(t,e)?t.children:[t])}function X(n,e){return z(e).has(n.leaf)}function pe(n,e){return z(e).has(I(n.symbol))}function z(n){let e=le(n);return new Set([e,e.slice(0,Math.max(0,e.length-U(e).length))])}function H(n,e,t){if(e.length===0)return[];let o=S(n,t,{additive:!0,semantic:!1}),i=new Map;for(let l of t){let u=i.get(l.symbol)??[];u.push(l),i.set(l.symbol,u)}let r=new Map,s=[...e];for(;s.length>0;){let l=s.shift();if(!r.has(l.symbolId)){r.set(l.symbolId,l);for(let u of o.get(l.symbolId)??[])for(let a of i.get(u.symbol)??[])r.has(a.symbolId)||s.push(a)}}return[...r.values()].sort(ye)}function G(n){let e=[...n].sort((o,i)=>o.relativePath.localeCompare(i.relativePath)||o.startLine-i.startLine||i.endLine-o.endLine),t=[];for(let o of e)t.some(i=>J(i,o))||t.push(o);return t}function K(n,e){let t=e.text.split(`
2
+ `);return{symbol:e.relativePath,shortName:e.relativePath,relativePath:e.relativePath,startLine:0,endLine:Math.max(0,t.length-1),language:n.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath)?.language??E(e.relativePath),source:e.text,freshness:e.freshness,...h(e.freshness)?{bindingClosure:y(n,e.relativePath,0,Math.max(0,t.length-1))}:{}}}function he(n,e){return v(n).filter(t=>e.some(o=>R(t,o))).length}function be(n,e,t){let o=[];return Z(o,n,e,t,0),o}function Z(n,e,t,o,i){for(let r of t){if(o.some(l=>R(r,l)))continue;let s=v(r.children).filter(l=>!o.some(u=>R(l,u))).length;n.push({symbol:r.symbol,shortName:r.shortName,relativePath:e,startLine:r.startLine,endLine:r.endLine,signature:r.signature,depth:i,nestedDefinitions:s}),Z(n,e,r.children,o,i+1)}}function v(n){return n.flatMap(e=>[e,...v(e.children)])}function Ce(n){return v(n).length}function R(n,e){return e.startLine<=n.startLine&&e.endLine>=n.endLine}function J(n,e){return n.relativePath===e.relativePath&&n.startLine<=e.startLine&&n.endLine>=e.endLine}function ye(n,e){return n.startLine-e.startLine||e.endLine-n.endLine||n.symbol.localeCompare(e.symbol)}function ve(n,e){return{selector:n,status:"matched",kind:"source",totalCandidates:1,results:[e],definitions:[],candidates:[],omittedCandidates:0,suggestions:[]}}function x(n,e,t){return{selector:e,status:"missing",kind:"source",totalCandidates:0,results:[],definitions:[],candidates:[],omittedCandidates:0,suggestions:$(n,e,5),reason:t}}function Q(n,e){try{return C(n,e)}catch(t){if(t instanceof F)return null;throw t}}function Le(n,e){if(!e.match)return[];let t=[e.match];for(let i of e.candidates){let r=g(n,i.relativePath).find(s=>s.symbol===i.symbol&&s.startLine===i.startLine);r&&t.push(r)}let o=new Set;return t.filter(i=>{let r=`${i.relativePath}:${i.startLine}:${i.endLine}:${i.symbol}`;return o.has(r)?!1:(o.add(r),!0)})}function V(n){return{symbol:n.symbol,shortName:L(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine}}function Y(n){let e=n.match(/^(.+):(\d+)-(\d+)$/);if(!e)return null;let t=Number(e[2]),o=Number(e[3]);if(!Number.isSafeInteger(t)||t<1)throw new RangeError(`Source range start line must be a positive integer, got "${e[2]}".`);if(!Number.isSafeInteger(o)||o<t)throw new RangeError(`Source range end line must be an integer at or after ${t}, got "${e[3]}".`);return{filePath:e[1],startLine:t,endLine:o}}function p(n,e,t){let o=n.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),i=C(n,e.relativePath);if(!i)return null;let s=i.text.split(`
3
+ `),l=e.endLine<=e.startLine?j(n,e.relativePath,e.startLine,Number.MAX_SAFE_INTEGER):null,u=l?.unitType?l.unitStartLine:e.startLine,a=l?.unitType?l.unitEndLine:e.endLine,d=Math.max(0,u-t),c=Math.min(s.length-1,a+t),f=s.slice(d,c+1).join(`
4
+ `);return{symbol:e.symbol,shortName:L(e.symbol),relativePath:e.relativePath,startLine:d,endLine:c,language:o?.language??E(e.relativePath),source:f,freshness:i.freshness,...h(i.freshness)?{bindingClosure:y(n,e.relativePath,d,c)}:{}}}function q(n,e,t,o,i){let r=C(n,e);if(!r)return null;let s=n.get("SELECT language FROM documents WHERE relative_path = ?",r.relativePath),u=r.text.split(`
5
+ `);if(t>u.length)return null;let a=Math.max(0,t-1-i),d=Math.min(u.length-1,o-1+i),c=u.slice(a,d+1).join(`
6
+ `);return{symbol:`${r.relativePath}:${t}-${o}`,shortName:`${r.relativePath}:${t}-${o}`,relativePath:r.relativePath,startLine:a,endLine:d,language:s?.language??E(r.relativePath),source:c,freshness:r.freshness,...h(r.freshness)?{bindingClosure:y(n,r.relativePath,a,d)}:{}}}function h(n){return!!(n&&n.semantic.state!=="stale"&&n.semantic.basis!=="no-compiler-document")}function E(n){switch(U(n).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{y as a,A as b,Ne as c,Ae as d,We as e};
7
+ //# sourceMappingURL=chunk-Y6KHROC3.js.map
@@ -0,0 +1,3 @@
1
+ import{a as D}from"./chunk-QHRNXP3C.js";import{c as C}from"./chunk-7FND7D7N.js";import{a as I}from"./chunk-JOIRNPPY.js";import{e as P}from"./chunk-J77SU6VA.js";import{b as F}from"./chunk-UZGZB3VB.js";import{f as M,g as S}from"./chunk-C7QOQX32.js";import{d as g}from"./chunk-FETNQCFO.js";function oe(e,n={}){let t=new C(e).productionCallableDefinitions({scope:n.scope,requireCallableSymbol:!0,includeSuppressed:!0}),r=L(e,t),l=n.search?.trim().toLocaleLowerCase();return t.map(s=>j(e,s,r.get(s.symbolId)??[])).filter(s=>s!==null).map(s=>s.result).filter(s=>!l||$(s).includes(l)).sort(G)}function re(e,n,o={}){let t=F(e,n);if(!t.match)return{kind:"missing",query:n};if(t.total>1)return{kind:"ambiguous",query:n,total:t.total,candidates:[{symbol:t.match.symbol,shortName:g(t.match.symbol),relativePath:t.match.relativePath,startLine:t.match.startLine},...t.candidates]};let r=new C(e),l=r.definitionsForFile(t.match.relativePath).find(a=>a.symbol===t.match.symbol);if(!l?.isFunctionLike)return{kind:"not-entry",query:n,symbol:t.match.symbol,shortName:g(t.match.symbol),file:t.match.relativePath,reason:"The resolved symbol is not a callable definition."};let s=L(e,[l]),f=j(e,l,s.get(l.symbolId)??[]);if(!f)return{kind:"not-entry",query:n,symbol:l.symbol,shortName:g(l.symbol),file:l.relativePath,reason:"The callable is neither an external root nor an uncalled callable on a detected entry surface."};let m=K(e,r,l),i=new Set(o.expand??[]),c=z(m,i),d=new Set(c.regions.filter(a=>a.expanded).map(a=>a.id)),p=[...i].filter(a=>!d.has(a)).sort();return{kind:"matched",query:n,entry:f.result,regions:c.regions,regionEdges:c.regionEdges,unmatchedExpansions:p,coverage:{completeWithinIndexedStaticCallEdges:!0,completeWithinSelectedStaticEvidence:!0,candidateReachabilityIncluded:m.edges.some(a=>a.evidenceStrength==="candidate"),dynamicDispatchRepresented:!1,symbolCount:m.symbols.length,symbolEdgeCount:m.edges.length,exactSymbolEdgeCount:m.edges.filter(a=>a.evidenceStrength==="exact").length,candidateSymbolEdgeCount:m.edges.filter(a=>a.evidenceStrength==="candidate").length,regionCount:c.regions.length,regionEdgeCount:c.regionEdges.length,externalCallCount:m.externalCalls.length}}}function L(e,n){let o=n.filter(t=>B(e,t.relativePath)||S(e,t.symbol,t.relativePath).length>0);return P(e,o,{semantic:!1,semanticEvidence:I})}function j(e,n,o){let t=T(e,n),r=t.length>0,l=B(e,n.relativePath)&&o.length===0;if(!r&&!l)return null;let s=[...t];return l&&s.push("entry-surface-without-indexed-caller"),{definition:n,result:{symbol:n.symbol,shortName:g(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,documentation:n.documentation,confidence:r?"root":"candidate",evidence:s,indexedCallerCount:o.length}}}function B(e,n){return M(e,n)||/(?:^|\/)entry\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(n)}function T(e,n){let o=S(e,n.symbol,n.relativePath),t=[];return w(o,["package-surface-file","transitive-package-surface"])&&D(e,n)&&t.push("package-public-export"),o.includes("rust-public-library")&&t.push("rust-public-library"),o.includes("framework-entrypoint")&&t.push("framework-dispatched-export"),w(o,["configured-file","configured-path-prefix","configured-qualified-var","configured-symbol-pattern"])&&t.push("configured-entry-root"),t}function w(e,n){return n.some(o=>e.includes(o))}function $(e){return[e.symbol,e.shortName,e.file,e.documentation??"",...e.evidence].join(`
2
+ `).toLocaleLowerCase()}function G(e,n){return N(e.confidence)-N(n.confidence)||e.file.localeCompare(n.file)||e.startLine-n.startLine||e.symbol.localeCompare(n.symbol)}function N(e){return e==="root"?0:1}function K(e,n,o){let t=new Map([[o.symbol,0]]),r=new Map,l=new Map([[o.symbol,o]]),s=new Map,f=new Map,m=[o];for(;m.length>0;){let i=n.calleeMap(m,{additive:!1,semantic:!1}),c=[];for(let d of m){let p=t.get(d.symbol)??0;r.set(d.symbol,k(d,p));for(let a of i.get(d.symbolId)??[]){let y=W(n,a,l);if(!y){let R=O(d,a);f.set(J(R),R);continue}let u=p+1,h=t.get(y.symbol);(h===void 0||u<h)&&t.set(y.symbol,u),r.set(y.symbol,k(y,Math.min(u,h??u)));let v=q(d,y,a);s.set(H(v),v),h===void 0&&c.push(y)}}m=c}return{symbols:[...r.values()].sort(Q),edges:[...s.values()].sort(U),externalCalls:[...f.values()].sort(V)}}function W(e,n,o){let t=o.get(n.symbol);if(t)return t;let r=e.definitionsForFile(n.file).find(l=>l.symbol===n.symbol)??null;return r&&o.set(r.symbol,r),r}function k(e,n){return{symbol:e.symbol,shortName:g(e.symbol),file:e.relativePath,depth:n}}function q(e,n,o){return{fromSymbol:e.symbol,fromShortName:g(e.symbol),fromFile:e.relativePath,toSymbol:n.symbol,toShortName:g(n.symbol),toFile:n.relativePath,source:o.source,evidenceStrength:o.source==="scip-chunk"?"candidate":"exact"}}function O(e,n){return{fromSymbol:e.symbol,fromShortName:g(e.symbol),fromFile:e.relativePath,toSymbol:n.symbol,toShortName:g(n.symbol),reportedFile:n.file,source:n.source,evidenceStrength:n.source==="scip-chunk"?"candidate":"exact"}}function z(e,n){let o=b(e.symbols,i=>i.file),t=b(e.edges.filter(i=>i.fromFile===i.toFile),i=>i.fromFile),r=b(e.externalCalls,i=>i.fromFile),l=A(e.edges.filter(i=>i.fromFile!==i.toFile)),s=b(l,i=>i.toRegionId),f=b(l,i=>i.fromRegionId);return{regions:[...o.entries()].map(([i,c])=>{let d=x(i),p=n.has(d),a=t.get(i)??[],y=r.get(i)??[];return{id:d,file:i,minDepth:Math.min(...c.map(u=>u.depth)),symbolCount:c.length,internalEdgeCount:a.length,externalCallCount:y.length,incomingRegionIds:E((s.get(d)??[]).map(u=>u.fromRegionId)),outgoingRegionIds:E((f.get(d)??[]).map(u=>u.toRegionId)),expanded:p,symbols:p?c:[],internalEdges:p?a:[],externalCalls:p?y:[]}}).sort((i,c)=>i.minDepth-c.minDepth||i.file.localeCompare(c.file)),regionEdges:l}}function A(e){let n=new Map;for(let o of e){let t=`${o.fromFile}\0${o.toFile}`,r=n.get(t)??[];r.push(o),n.set(t,r)}return[...n.values()].map(o=>{let t=o[0];return{fromRegionId:x(t.fromFile),fromFile:t.fromFile,toRegionId:x(t.toFile),toFile:t.toFile,callCount:o.length,exactCallCount:o.filter(r=>r.evidenceStrength==="exact").length,candidateCallCount:o.filter(r=>r.evidenceStrength==="candidate").length,fromSymbols:E(o.map(r=>r.fromShortName)),toSymbols:E(o.map(r=>r.toShortName)),evidence:E(o.map(r=>r.source))}}).sort((o,t)=>o.fromFile.localeCompare(t.fromFile)||o.toFile.localeCompare(t.toFile))}function b(e,n){let o=new Map;for(let t of e){let r=n(t),l=o.get(r)??[];l.push(t),o.set(r,l)}return o}function x(e){return`file:${e}`}function E(e){return[...new Set(e)].sort()}function H(e){return`${e.fromSymbol}\0${e.toSymbol}`}function J(e){return`${e.fromSymbol}\0${e.toSymbol}`}function Q(e,n){return e.depth-n.depth||e.file.localeCompare(n.file)||e.symbol.localeCompare(n.symbol)}function U(e,n){return e.fromFile.localeCompare(n.fromFile)||e.fromSymbol.localeCompare(n.fromSymbol)||e.toSymbol.localeCompare(n.toSymbol)}function V(e,n){return e.fromFile.localeCompare(n.fromFile)||e.fromSymbol.localeCompare(n.fromSymbol)||e.toSymbol.localeCompare(n.toSymbol)}export{oe as a,re as b};
3
+ //# sourceMappingURL=chunk-YESXMKX3.js.map
@@ -0,0 +1,2 @@
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
@@ -0,0 +1,2 @@
1
+ import{d}from"./chunk-JEJLSICM.js";import{C as c}from"./chunk-ADTBPVUZ.js";import{v as s}from"./chunk-BMYOV5GP.js";var p=new Set(["arrow_function","class_declaration","constructor_declaration","field_definition","function_declaration","function_definition","function_expression","function_item","generator_function_declaration","generator_function","lexical_declaration","method","method_declaration","method_definition","object_method","variable_declaration"]);function b(n,t,e){let o=c(n,t)?.rootNode??null,r=L(o,e);if(!r)return null;let a=s(n,t);if(a.length===0)return null;let u=Math.max(0,r.startPosition.row),i=r.endPosition.column===0?r.endPosition.row-1:r.endPosition.row;return{type:r.type,startLine:u,endLine:Math.min(a.length-1,Math.max(u,i))}}function y(n,t,e,o,r){let a=d(n,t,o,r,[e]),u=a.startLine===a.endLine&&/(?:=>|\(|\{|\[|,)\s*$/u.test(s(n,t)[a.startLine]??"");if(!u&&(a.startLine>o||a.endLine<r))return a;let i=b(n,t,e);return u&&i?{startLine:i.startLine,endLine:i.endLine}:i&&i.startLine>=o&&i.endLine<=r?{startLine:i.startLine,endLine:i.endLine}:{startLine:o,endLine:r}}function L(n,t){if(!n||!f(n,t))return null;let e=m(n,t);for(;e;){if(p.has(e.type))return e;e=e.parent}return null}function m(n,t){let e=n.namedChildren.filter(o=>f(o,t)).sort((o,r)=>l(o)-l(r));return e.length>0?m(e[0],t):n}function f(n,t){return n.startPosition.row<=t&&n.endPosition.row>=t}function l(n){return n.endIndex-n.startIndex}export{b as a,y as b};
2
+ //# sourceMappingURL=chunk-YSNONTJ2.js.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-YUKYB54I.js.map
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,3 @@
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
@@ -0,0 +1,15 @@
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
@@ -0,0 +1,2 @@
1
+ import{e as n}from"./chunk-TFZB6XTM.js";function s(o,r,t,e){return n({projectRoot:o,languages:e.languages?.length?e.languages:r.languages,outputScip:t.indexPath,outputDb:t.dbPath,pnpmWorkspaces:r.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:r.indexer?.typescript?.projectMode,typescriptProjects:r.indexer?.typescript?.projects,clojureConfigPath:r.indexer?.clojure?.configPath,skipIfUnchanged:e.force!==!0,allowPartial:e.allowPartial===!0,skipAutoInstall:e.skipAutoInstall===!0,installMissing:e.installMissing===!0,trustProjectTools:e.trustProjectTools===!0,indexerConcurrency:e.indexerConcurrency??r.indexerConcurrency,trigger:e.trigger,...e.onStatus?{onStatus:e.onStatus}:{}})}export{s as a};
2
+ //# sourceMappingURL=chunk-ZMI2JSX2.js.map
@@ -0,0 +1,8 @@
1
+ import{a as D,c as L,i as H,k as O}from"./chunk-L4NRUAGJ.js";import{j as T,o as B}from"./chunk-UDS562V4.js";import{d as A}from"./chunk-NMTSZXCL.js";import{c as _}from"./chunk-7FND7D7N.js";import{d as u,e as F}from"./chunk-FETNQCFO.js";import{a as E}from"./chunk-O6QTXQPJ.js";var J=5;function le(e,n={}){let{base:o="HEAD",minContainment:a=.7,minCallees:l=3,minSiteCoverage:t=.4,maxHelpers:p=Number.POSITIVE_INFINITY,limit:c=20,scanLimit:g}=n,h=n.semantic!==!1,s=n.diffPlan??L(e,{base:o}),r={available:s.note!==D,base:o,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[],...s.note?{note:s.note}:{}};if(!r.available||s.changedFiles.length===0)return r;let k=new _(e),P=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from]));if(n.baseContentAt&&n.baseContentResultAt)throw new Error("Specify only one of baseContentAt or baseContentResultAt.");let z=n.baseContentResultAt?n.baseContentResultAt:n.baseContentAt?Q(n.baseContentAt):H({projectRoot:e.config.projectRoot,base:o,preloadPaths:O(s)}),f=Z(k,P,$,z);if(f.unavailable)return r.available=!1,r.note=`Base content unavailable: ${f.unavailable.reason}`,r;if(f.definitions.length===0)return r;let I=f.definitions.slice(0,p);f.definitions.length>p&&(r.note=`helper scoring capped at ${p} of ${f.definitions.length} new symbols`);let d=k.calleeEvidenceMap(I,{semantic:h}),q=I.filter(i=>!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)).map(i=>({def:i,callees:B((d.rows.get(i.symbolId)??[]).map(m=>m.symbol))}));for(let i of I)!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)||r.skipped.push({helperShortName:u(i.symbol),helperFile:i.relativePath,reason:"compiler-resolved callee evidence is incomplete or unavailable \u2014 unsafe to score"});let V=T(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,l),scanLimit:g,semantic:h}),M);for(let{def:i,callees:m}of q){let b=u(i.symbol);if(m.size<l){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:`fewer than ${l} meaningful callees \u2014 too small to score`});continue}let w=G(),N=Y(m,w);if(N===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let y=ee(e,i.symbolId);if(y.length===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}r.helpersChecked+=1;let v=K({candidateIndex:w,changed:P,helperCallees:m,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:a,minSiteCoverage:t,migratedFiles:y});v.length!==0&&(v.sort((C,S)=>j(S.migrationScope)-j(C.migrationScope)||S.containment-C.containment||S.siteCoverage-C.siteCoverage||C.file.localeCompare(S.file)),r.findings.push({helperSymbol:i.symbol,helperShortName:b,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:m.size,specificHelperCalleeCount:N,migratedFiles:y.sort(),leftovers:v.slice(0,J)}))}return r.findings.sort((i,m)=>(m.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(m.helperFile)),r.findings=r.findings.slice(0,c),r}function K(e){let n=[],o=U(e.helperSymbol,e.helperFile,e.migratedFiles),a=new Set;for(let l of e.helperCallees)for(let t of e.candidateIndex.candidateIndexesByCallee.get(l)??[])a.add(t);for(let l of a){let t=e.candidateIndex.corpus[l];if(t.symbol===e.helperSymbol||e.changed.has(t.file)||t.callees.has(e.helperSymbol))continue;let p=A(e.helperCallees,t.callees);if(p<e.minContainment)continue;let c=[...e.helperCallees].filter(s=>t.callees.has(s)),g=t.callees.size===0?0:c.length/t.callees.size;if(g<e.minSiteCoverage||!c.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let h=W(o,t.symbol,t.file);n.push({symbol:t.symbol,shortName:u(t.symbol),file:t.file,...h,containment:p,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,t.callees.size-c.length),sharedCallees:c.map(u).sort()})}return n}function j(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,n,o){let a=new Set([...R(n),...x(F(e))]);for(let l of o)for(let t of R(l))a.add(t);return a}function W(e,n,o){let a=new Set([...R(o),...x(F(n))]);if(e.size===0||a.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let l=[...a].filter(t=>e.has(t)).sort();return l.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${l.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function R(e){return x(e.replace(/\.[^.]+$/,""))}function x(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1&&!X.has(n))}function Y(e,n){let o=0;for(let a of e)(n.docFreq.get(a)??0)<=n.ubiquityThreshold&&(o+=1);return o}function Z(e,n,o,a){let l=[];for(let t of e.productionCallableDefinitions({files:[...n],requireFunctionLikeSymbol:!0})){if(!n.has(t.relativePath))continue;let p=o.get(t.relativePath)??t.relativePath,c=a(p);if(c.state==="unavailable")return{definitions:[],unavailable:c};(c.state==="absent"||!new RegExp(`\\b${E(t.leaf)}\\b`).test(c.content))&&l.push(t)}return{definitions:l}}function Q(e){return n=>{let o=e(n);return o===null?{state:"absent"}:{state:"present",content:o}}}function ee(e,n){return e.all(`SELECT DISTINCT ref_d.relative_path
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents ref_d ON c.document_id = ref_d.id
5
+ WHERE m.symbol_id = ?
6
+ AND m.role != 1
7
+ ${e.pathExclusionsFor("ref_d")}`,n).map(a=>a.relative_path)}export{le as a};
8
+ //# sourceMappingURL=chunk-ZV3JV5G5.js.map
@@ -0,0 +1,4 @@
1
+ var x=new Map([[8,"\u2408"],[9,"\u2409"],[10,"\u2424"],[13,"\u240D"]]);function a(n,i={}){let r=i.allowNewlines??!0,o=i.allowTabs??!0,l="";for(let e=0;e<n.length;){let t=n.charCodeAt(e);if(t===27){e=c(n,e);continue}if(t===155){e=s(n,e+1);continue}if(t===144||t===152||t===157||t===158||t===159){e=u(n,e+1);continue}if(b(t)){t===10&&r?l+=`
2
+ `:t===9&&o?l+=" ":l+=x.get(t)??"\uFFFD",e+=1;continue}if(m(t)){l+="\uFFFD",e+=1;continue}l+=n[e],e+=1}return l}function C(n){return a(n,{allowNewlines:!1,allowTabs:!1})}function T(n,i=r=>process.stdout.write(r)){i(`${n}
3
+ `)}function c(n,i){let r=n.charCodeAt(i+1);if(Number.isNaN(r))return n.length;if(r===91)return s(n,i+2);if(r===80||r===88||r===93||r===94||r===95)return u(n,i+2);let o=i+1;for(;o<n.length&&f(n.charCodeAt(o));)o+=1;return o<n.length&&w(n.charCodeAt(o))?o+1:i+1}function s(n,i){let r=i;for(;r<n.length;){let o=n.charCodeAt(r);if(r+=1,o>=64&&o<=126)return r}return n.length}function u(n,i){let r=i;for(;r<n.length;){let o=n.charCodeAt(r);if(o===7||o===156)return r+1;if(o===27&&n.charCodeAt(r+1)===92)return r+2;r+=1}return n.length}function f(n){return n>=32&&n<=47}function w(n){return n>=48&&n<=126}function b(n){return n<=31||n>=127&&n<=159}function m(n){return n===1564||n===8206||n===8207||n>=8234&&n<=8238||n>=8294&&n<=8297}export{a,C as b,T as c};
4
+ //# sourceMappingURL=chunk-ZZ3MWF33.js.map
@@ -0,0 +1,2 @@
1
+ import{d}from"./chunk-OTOKVOJ3.js";import{M as p}from"./chunk-ADTBPVUZ.js";function y(t,e={}){let{minTotalLines:i=800,minTemplateLines:n=300,minScriptLines:r=300,minStyleLines:u=500,limit:o=20,scope:a,scanLimit:l,filePattern:m}=e;return p(t).vueProfiles({scope:a,scanLimit:l}).filter(s=>!m||s.file.includes(m)).map(s=>L(s,{minTotalLines:i,minTemplateLines:n,minScriptLines:r,minStyleLines:u})).filter(s=>s!==null).sort((s,c)=>c.totalLines-s.totalLines||s.file.localeCompare(c.file)).slice(0,o)}function L(t,e){let i=d(t,b(e),"total"),{reasons:n}=i;if(n.length===0)return null;let r=i.dominantPressure,u=i.pressureKinds.includes("total")?[...new Set([...i.pressureKinds,r])]:i.pressureKinds,o=g(t.file),a=x(r,o),l=t.totalLines+t.delegatedComposableLines;return{file:t.file,totalLines:l,sfcLines:t.sfcLines,templateLines:t.templateLines,scriptLines:t.scriptLines,styleLines:t.styleLines,externalScriptLines:t.externalScriptLines,externalScriptPaths:t.externalScriptPaths,customBlockLines:t.customBlockLines,delegatedComposableLines:t.delegatedComposableLines,delegatedComposablePaths:t.delegatedComposablePaths,dominantPressure:r,pressureKinds:u,contextKind:o,recommendationKind:a,recommendation:f(a,o),reasons:n,loc:l}}function b(t){return[{axis:"total",value:e=>e.totalLines+e.delegatedComposableLines,qualifies:(e,i)=>i>=t.minTotalLines,reason:(e,i)=>e.delegatedComposableLines>0?`${i} total line(s) (${e.totalLines} component + ${e.delegatedComposableLines} delegated composable line(s) across ${e.delegatedComposablePaths.length} file(s))`:`${i} total component line(s)`,dominantEligible:!1},{axis:"template",value:e=>e.templateLines,qualifies:(e,i)=>i>=t.minTemplateLines,reason:(e,i)=>`${i} template line(s)`},{axis:"script",value:e=>e.scriptLines-e.externalScriptLines,qualifies:e=>e.scriptLines>=t.minScriptLines,reason:e=>`${e.scriptLines} script line(s)`},{axis:"style",value:e=>e.styleLines,qualifies:(e,i)=>i>=t.minStyleLines,reason:(e,i)=>`${i} style line(s)`},{axis:"external-script",value:e=>e.externalScriptLines,qualifies:(e,i)=>i>=t.minScriptLines},{axis:"custom-block",value:e=>e.customBlockLines,qualifies:()=>!1}]}function g(t){return t.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).some(n=>w.has(n))||/(?:view|page|route)\.vue$/i.test(t)||/(?:^|\/)(views|pages|routes)\//i.test(t)?"route-page":"component"}function x(t,e){return t==="style"?"style-decomposition":t==="template"?"template-decomposition":t==="external-script"?"external-script-boundary":t==="custom-block"?"custom-block-review":e==="route-page"?"route-page-decomposition":t==="script"?"script-behavior-extraction":"total-size-review"}function f(t,e){switch(t){case"template-decomposition":return e==="route-page"?"Split route template sections into named panels before extracting script behavior.":"Split repeated template sections into named presentational components.";case"script-behavior-extraction":return"Extract independent script behavior into composables, controllers, or feature modules.";case"style-decomposition":return"Review UI/style decomposition; move repeated styling to component or style primitives, not composables.";case"external-script-boundary":return"Review the external script boundary and split controller/composable modules by workflow.";case"custom-block-review":return"Review custom block ownership before splitting template or script code.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"total-size-review":return"Review the largest block first, then split by the dominant reason to change."}}var w=new Set(["landing","page","pages","route","routes","view","views"]);export{y as a};
2
+ //# sourceMappingURL=chunk-ZZXSWSN6.js.map