codebaseiq 0.3.0 → 0.4.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 (324) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-7GAK2F3H.js → chunk-23AD24QZ.js} +12 -12
  4. package/dist/chunk-24TEZJST.js +2 -0
  5. package/dist/{chunk-356EZBIP.js → chunk-26EDDGAX.js} +2 -2
  6. package/dist/{chunk-O2M3VNDY.js → chunk-26EZWQ24.js} +2 -2
  7. package/dist/{chunk-U33PMPNW.js → chunk-2L3NCI52.js} +2 -2
  8. package/dist/{chunk-MSI3K7PJ.js → chunk-2QJAVISG.js} +2 -2
  9. package/dist/{chunk-4LK5OIPW.js → chunk-2ZBZRYX4.js} +2 -2
  10. package/dist/chunk-33AXWMO2.js +2 -0
  11. package/dist/{chunk-EQNMD62X.js → chunk-37K55EG3.js} +2 -2
  12. package/dist/{chunk-ITSJMNUD.js → chunk-3EFZ5KQ4.js} +2 -2
  13. package/dist/{chunk-D7DOB27N.js → chunk-3F23W57G.js} +2 -2
  14. package/dist/{chunk-BGGB5N53.js → chunk-3GKKCVKK.js} +2 -2
  15. package/dist/{chunk-MQW6SJ4P.js → chunk-3SYRGMCL.js} +2 -2
  16. package/dist/{chunk-PFC44E6D.js → chunk-3VDL7GTY.js} +2 -2
  17. package/dist/{chunk-7JELP5YE.js → chunk-3XBZ5PKL.js} +2 -2
  18. package/dist/{chunk-75KJGYX7.js → chunk-42PXSE74.js} +2 -2
  19. package/dist/{chunk-FEIZXBLH.js → chunk-4GIERC2P.js} +2 -2
  20. package/dist/{chunk-W7YLRXZE.js → chunk-4UXDBRIF.js} +2 -2
  21. package/dist/chunk-4XMZYLW5.js +2 -0
  22. package/dist/{chunk-6BF3VYEF.js → chunk-55NUXP2V.js} +2 -2
  23. package/dist/chunk-5AJQCOZZ.js +21 -0
  24. package/dist/{chunk-5DSL3NT2.js → chunk-5NUPFZFA.js} +2 -2
  25. package/dist/{chunk-RJVAPMHF.js → chunk-65QIFIF6.js} +2 -2
  26. package/dist/{chunk-36JC5BG2.js → chunk-66Q5VLH6.js} +2 -2
  27. package/dist/{chunk-D7AZAOZX.js → chunk-6CQPIIS7.js} +2 -2
  28. package/dist/{chunk-GV2CEZCW.js → chunk-6CTSFS7R.js} +2 -2
  29. package/dist/{chunk-Q4XEU3UH.js → chunk-6EBUAKJT.js} +2 -2
  30. package/dist/chunk-6I55VYFG.js +4 -0
  31. package/dist/chunk-6NUURWPF.js +3 -0
  32. package/dist/{chunk-MHWMEZDA.js → chunk-6P5QMOM7.js} +2 -2
  33. package/dist/{chunk-LZSQ6X7E.js → chunk-6S5FE4ZF.js} +2 -2
  34. package/dist/chunk-74LRKLNC.js +22 -0
  35. package/dist/chunk-75A23IID.js +3 -0
  36. package/dist/chunk-75VNTSO6.js +7 -0
  37. package/dist/chunk-7HBBVZJ6.js +3 -0
  38. package/dist/{chunk-VWYGCMV5.js → chunk-7PPBMBH6.js} +2 -2
  39. package/dist/{chunk-3RSBGWGL.js → chunk-7WG57A5X.js} +2 -2
  40. package/dist/{chunk-FWQGH2N2.js → chunk-7XHZX6FX.js} +2 -2
  41. package/dist/{chunk-RIYJ4L33.js → chunk-A5HJ3CJW.js} +2 -2
  42. package/dist/{chunk-LONKINMJ.js → chunk-AJ5HVC5Z.js} +2 -2
  43. package/dist/{chunk-ZAFGY22Q.js → chunk-AYRHOFLV.js} +2 -2
  44. package/dist/chunk-AZDY3EKD.js +93 -0
  45. package/dist/{chunk-CW6AXOLR.js → chunk-AZZNG5Z2.js} +2 -2
  46. package/dist/chunk-BEKCTUPY.js +3 -0
  47. package/dist/{chunk-CR3OG6SQ.js → chunk-BKKX2OU5.js} +2 -2
  48. package/dist/{chunk-5LL4KEHO.js → chunk-BQKRYKDD.js} +2 -2
  49. package/dist/{chunk-FOZ74V56.js → chunk-BVDQU2XJ.js} +2 -2
  50. package/dist/chunk-C3PPB2T5.js +5 -0
  51. package/dist/chunk-CABIZQXQ.js +21 -0
  52. package/dist/{chunk-M2Y6PCFE.js → chunk-CAH322MC.js} +2 -2
  53. package/dist/{chunk-EIBGSU2R.js → chunk-CBOOHUK4.js} +2 -2
  54. package/dist/chunk-CFIICAOM.js +2 -0
  55. package/dist/{chunk-XMJ53WG4.js → chunk-CPWYEPWQ.js} +2 -2
  56. package/dist/{chunk-LQHYYIOB.js → chunk-CRT7I7RJ.js} +2 -2
  57. package/dist/{chunk-IZDPGOZR.js → chunk-CZVSQQDU.js} +2 -2
  58. package/dist/{chunk-TNJGTQWO.js → chunk-D3KE26FS.js} +2 -2
  59. package/dist/{chunk-GP7C5VAE.js → chunk-DNRHRVKS.js} +2 -2
  60. package/dist/{chunk-SGMNWYTH.js → chunk-DOQLO74K.js} +2 -2
  61. package/dist/{chunk-AURCQHSG.js → chunk-DP3EJ6XL.js} +2 -2
  62. package/dist/{chunk-C7QWUBR2.js → chunk-DQZF7MP6.js} +2 -2
  63. package/dist/{chunk-E52K4L2W.js → chunk-DTM4EHD2.js} +2 -2
  64. package/dist/{chunk-YRKP7PM7.js → chunk-DUM7GR6B.js} +2 -2
  65. package/dist/{chunk-I22IZYDI.js → chunk-DZ4QOIRY.js} +2 -2
  66. package/dist/{chunk-EXZ7VLRY.js → chunk-E3R6TJ5T.js} +2 -2
  67. package/dist/chunk-E4DP45YU.js +3 -0
  68. package/dist/{chunk-PUVNH4PO.js → chunk-E5U6N5WI.js} +2 -2
  69. package/dist/chunk-E7T22WET.js +21 -0
  70. package/dist/{chunk-QEOWONKY.js → chunk-ED7ZAZ5V.js} +2 -2
  71. package/dist/{chunk-RCIGX23V.js → chunk-EDMG5CSO.js} +2 -2
  72. package/dist/{chunk-IHSLIIL3.js → chunk-EOSUV7H5.js} +2 -2
  73. package/dist/{chunk-FQTIFWLR.js → chunk-ESWVTSHU.js} +2 -2
  74. package/dist/{chunk-6VREELBC.js → chunk-ETZBIG6K.js} +2 -2
  75. package/dist/chunk-EYSJHKX6.js +3 -0
  76. package/dist/{chunk-Q23IMHXS.js → chunk-F4AGM7ZE.js} +37 -37
  77. package/dist/{chunk-FTTV7IRX.js → chunk-FPUJRBHL.js} +50 -50
  78. package/dist/{chunk-CCIYWXX6.js → chunk-G2UU6PQP.js} +2 -2
  79. package/dist/{chunk-C6WKPKCF.js → chunk-G3KRXNNT.js} +2 -2
  80. package/dist/{chunk-TEANKHUU.js → chunk-G3ZBP72R.js} +2 -2
  81. package/dist/{chunk-NBCQZSGR.js → chunk-GC4I33OD.js} +2 -2
  82. package/dist/{chunk-NDKOVQFG.js → chunk-GLXEWYQY.js} +2 -2
  83. package/dist/{chunk-AEXQYQD7.js → chunk-GRHNPFHT.js} +2 -2
  84. package/dist/{chunk-NBZKSTXP.js → chunk-GWESWURK.js} +2 -2
  85. package/dist/{chunk-Q3ZCQY2Y.js → chunk-GXOFPAIR.js} +2 -2
  86. package/dist/{chunk-USOAJHY7.js → chunk-H4FGIFEU.js} +2 -2
  87. package/dist/{chunk-LKUTSP4G.js → chunk-HOGS6JFP.js} +2 -2
  88. package/dist/{chunk-UQE4XFSA.js → chunk-HSJLK5MC.js} +2 -2
  89. package/dist/{chunk-BWL3PMPT.js → chunk-HTPEUJ42.js} +2 -2
  90. package/dist/{chunk-3RR2K7EZ.js → chunk-IBPXUGJV.js} +2 -2
  91. package/dist/{chunk-BFBIMTCJ.js → chunk-ITA3N7G6.js} +2 -2
  92. package/dist/chunk-JG5OWAEB.js +22 -0
  93. package/dist/{chunk-2PRONPAS.js → chunk-JGJKRTTB.js} +2 -2
  94. package/dist/{chunk-TJWVT4DO.js → chunk-JGXLB7PR.js} +2 -2
  95. package/dist/{chunk-K7JLSGCJ.js → chunk-JKUF2UG6.js} +3 -3
  96. package/dist/{chunk-CIYA2KZN.js → chunk-JOYASZRF.js} +2 -2
  97. package/dist/{chunk-U7NUXDQO.js → chunk-K3PFL5QQ.js} +2 -2
  98. package/dist/{chunk-WK2IQJPK.js → chunk-KAXBWTSX.js} +2 -2
  99. package/dist/{chunk-5ZI2PPI7.js → chunk-KHHAGHAW.js} +2 -2
  100. package/dist/{chunk-UW6KD57C.js → chunk-KJLUQVBG.js} +2 -2
  101. package/dist/{chunk-WWCV4E6J.js → chunk-KOVUXHIZ.js} +2 -2
  102. package/dist/chunk-KPMMOAV5.js +4 -0
  103. package/dist/{chunk-GDHWOA57.js → chunk-LKJZNGMA.js} +2 -2
  104. package/dist/{chunk-3VJ3OCRE.js → chunk-LMPOC372.js} +2 -2
  105. package/dist/{chunk-F3QSL4W2.js → chunk-LTPNP6D5.js} +2 -2
  106. package/dist/{chunk-MVRGB4KJ.js → chunk-M3IBH6C3.js} +9 -9
  107. package/dist/{chunk-PHNCEUXX.js → chunk-MAGBSB6E.js} +2 -2
  108. package/dist/{chunk-QMOZZ2VX.js → chunk-MFMHD36E.js} +2 -2
  109. package/dist/{chunk-LMTSB3TB.js → chunk-MJX2J5QE.js} +2 -2
  110. package/dist/{chunk-PTQPPPG2.js → chunk-N26LGGSF.js} +2 -2
  111. package/dist/{chunk-J7AMBVWF.js → chunk-NB2DAVPP.js} +2 -2
  112. package/dist/{chunk-JYI7CV25.js → chunk-NJDXNYLG.js} +2 -2
  113. package/dist/{chunk-BRQL7AFJ.js → chunk-NMKQOIYZ.js} +2 -2
  114. package/dist/{chunk-ICUL7XRT.js → chunk-NRNVMB2R.js} +2 -2
  115. package/dist/{chunk-DDN2F6GB.js → chunk-O5BWFNIH.js} +2 -2
  116. package/dist/{chunk-HVFB3PME.js → chunk-O7PCDZ5B.js} +2 -2
  117. package/dist/{chunk-KPZGTB2O.js → chunk-OAJYNPRU.js} +2 -2
  118. package/dist/{chunk-2EDX3JT5.js → chunk-OFUC6R46.js} +2 -2
  119. package/dist/chunk-OSZ7PW5K.js +5 -0
  120. package/dist/{chunk-B3UYV66Z.js → chunk-OZ2M2X7A.js} +2 -2
  121. package/dist/{chunk-6O3KXIDL.js → chunk-OZI44VCR.js} +2 -2
  122. package/dist/{chunk-XN3EKMLI.js → chunk-PCKIKOUA.js} +2 -2
  123. package/dist/{chunk-NCJILOAK.js → chunk-PFMQRHC6.js} +2 -2
  124. package/dist/chunk-PVKSZBX5.js +82 -0
  125. package/dist/{chunk-NEWHKGVD.js → chunk-QANCT4MO.js} +2 -2
  126. package/dist/{chunk-ZNH33XIB.js → chunk-QEWN7BLP.js} +2 -2
  127. package/dist/{chunk-OQUCBKOI.js → chunk-QFJ46F6F.js} +2 -2
  128. package/dist/{chunk-2E6OUPCF.js → chunk-QPQWR6CW.js} +2 -2
  129. package/dist/{chunk-YTJHCGYB.js → chunk-QX4HDF2I.js} +2 -2
  130. package/dist/{chunk-J3GLP7Q5.js → chunk-R2F2CTBA.js} +2 -2
  131. package/dist/{chunk-2OMXFE64.js → chunk-R7PXHYMY.js} +2 -2
  132. package/dist/{chunk-F74LZWCE.js → chunk-RGBZDOUO.js} +2 -2
  133. package/dist/{chunk-362QOSFD.js → chunk-RNPG5P4P.js} +2 -2
  134. package/dist/{chunk-D62CTZX6.js → chunk-RS6UYNEP.js} +2 -2
  135. package/dist/{chunk-VGWZ4MOY.js → chunk-RVBRPBLQ.js} +2 -2
  136. package/dist/{chunk-5IZRKWTZ.js → chunk-RWAZCEJD.js} +2 -2
  137. package/dist/{chunk-ZQ62NNKN.js → chunk-RWDIONS7.js} +2 -2
  138. package/dist/{chunk-HQA7EBSK.js → chunk-S3CJYDXP.js} +2 -2
  139. package/dist/{chunk-GL6UTNUB.js → chunk-S6UTKCBT.js} +2 -2
  140. package/dist/chunk-SLLFJXTW.js +27 -0
  141. package/dist/{chunk-TOTWJZIX.js → chunk-T3KTMLQT.js} +2 -2
  142. package/dist/{chunk-67VJAYVR.js → chunk-TB575ZGO.js} +2 -2
  143. package/dist/{chunk-YHPG3S2U.js → chunk-TG4GMU73.js} +2 -2
  144. package/dist/{chunk-CVHOQONG.js → chunk-THKM7OXM.js} +2 -2
  145. package/dist/{chunk-GVAF222T.js → chunk-TNLOX4TN.js} +2 -2
  146. package/dist/{chunk-HENP2O4A.js → chunk-UHFZDQZJ.js} +2 -2
  147. package/dist/{chunk-YT4DVWUV.js → chunk-UUMAM5LM.js} +2 -2
  148. package/dist/{chunk-JX6ZWDOS.js → chunk-UUT5P3V7.js} +2 -2
  149. package/dist/{chunk-Z6RL7XOE.js → chunk-VEPK6M5C.js} +2 -2
  150. package/dist/{chunk-C7OUW52M.js → chunk-VPCHKZ3I.js} +2 -2
  151. package/dist/{chunk-GIDCP7KV.js → chunk-VZY3XOBU.js} +2 -2
  152. package/dist/{chunk-XQAVQVIL.js → chunk-W6E6ME7G.js} +2 -2
  153. package/dist/{chunk-XQPPURLQ.js → chunk-WGYZBS5S.js} +2 -2
  154. package/dist/{chunk-GUFPEFBG.js → chunk-WUP24Q4U.js} +2 -2
  155. package/dist/chunk-WXUHXSLN.js +2 -0
  156. package/dist/{chunk-HINZQKSY.js → chunk-X4YZD2MP.js} +2 -2
  157. package/dist/chunk-XARPGCTL.js +2 -0
  158. package/dist/{chunk-5FWR5HLG.js → chunk-XDQ6QJF5.js} +20 -20
  159. package/dist/{chunk-JCMFBF4Z.js → chunk-XRH7R5SX.js} +2 -2
  160. package/dist/{chunk-BBP7HVBJ.js → chunk-XVJ2E7W7.js} +2 -2
  161. package/dist/{chunk-D53LWANR.js → chunk-Y7GFAU5N.js} +2 -2
  162. package/dist/{chunk-T6MQNNAC.js → chunk-YBDLHFZZ.js} +2 -2
  163. package/dist/{chunk-ZB4C5TTR.js → chunk-YI3CJPOY.js} +2 -2
  164. package/dist/chunk-YMAGXBLT.js +3 -0
  165. package/dist/{chunk-MZNMASFM.js → chunk-YRAGNEBZ.js} +2 -2
  166. package/dist/chunk-YXZAAQHZ.js +3 -0
  167. package/dist/chunk-Z2L5H2HF.js +3 -0
  168. package/dist/{chunk-JSNTHRLQ.js → chunk-ZHK7TVAJ.js} +2 -2
  169. package/dist/chunk-ZJNV27DZ.js +4 -0
  170. package/dist/{chunk-GQLDYCWS.js → chunk-ZQ6GAIUV.js} +2 -2
  171. package/dist/{chunk-TPO7XC5Z.js → chunk-ZQE2QYAC.js} +2 -2
  172. package/dist/chunk-ZUQ2MDFT.js +2 -0
  173. package/dist/cli-context-4R2LREXQ.js +3 -0
  174. package/dist/cli-context-6X7JYARX.js +2 -0
  175. package/dist/cli-failure-RECEHOM2.js +3 -0
  176. package/dist/cli-program-MXA3WTAO.js +7 -0
  177. package/dist/cli.js +1 -1
  178. package/dist/{code-viewer-VHLBLIUM.js → code-viewer-C6HE4DFC.js} +2 -2
  179. package/dist/{code-viewer-KIXEYQNJ.js → code-viewer-XHSSAMBX.js} +2 -2
  180. package/dist/{command-descriptors-YCLATF5I.js → command-descriptors-NWW34Z54.js} +171 -171
  181. package/dist/{command-descriptors-F5P2V3NW.js → command-descriptors-XHK3PK2I.js} +116 -116
  182. package/dist/{command-panels-SZONPMLJ.js → command-panels-OXMCJ2QZ.js} +2 -2
  183. package/dist/direct-navigation-236VXYBZ.js +3 -0
  184. package/dist/direct-navigation-36YSILY6.js +2 -0
  185. package/dist/index.js +1 -1
  186. package/dist/invocation-command-descriptors-35JULLNR.js +3 -0
  187. package/dist/invocation-command-descriptors-FEWSFUO2.js +2 -0
  188. package/dist/output-continuation-command-MJBVH3A5.js +2 -0
  189. package/dist/output-continuation-command-TBXIOPHQ.js +3 -0
  190. package/dist/project-reindex-5TCGOVSK.js +2 -0
  191. package/dist/project-reindex-BUNTSYKM.js +3 -0
  192. package/dist/queries/affected.js +1 -1
  193. package/dist/queries/anchors.js +1 -1
  194. package/dist/queries/architecture.js +1 -1
  195. package/dist/queries/bottlenecks.js +1 -1
  196. package/dist/queries/by-kind.js +1 -1
  197. package/dist/queries/call-graph.js +1 -1
  198. package/dist/queries/change-surface.js +1 -1
  199. package/dist/queries/cleanup-plan.js +1 -1
  200. package/dist/queries/co-change.js +1 -1
  201. package/dist/queries/code.js +1 -1
  202. package/dist/queries/complexity-hotspots.js +1 -1
  203. package/dist/queries/complexity.js +1 -1
  204. package/dist/queries/context.js +1 -1
  205. package/dist/queries/convergence.js +1 -1
  206. package/dist/queries/coupling.js +1 -1
  207. package/dist/queries/cycles.js +1 -1
  208. package/dist/queries/dataflow.js +1 -1
  209. package/dist/queries/dead.js +1 -1
  210. package/dist/queries/decorative-checkers.js +1 -1
  211. package/dist/queries/deep-chains.js +1 -1
  212. package/dist/queries/dependence-slice.js +1 -1
  213. package/dist/queries/dependency-depth.js +1 -1
  214. package/dist/queries/deps.js +1 -1
  215. package/dist/queries/diff-impact.js +1 -1
  216. package/dist/queries/doc-drift.js +1 -1
  217. package/dist/queries/drift.js +1 -1
  218. package/dist/queries/duplicate-bodies.js +1 -1
  219. package/dist/queries/entry-map.js +1 -1
  220. package/dist/queries/evidence.js +1 -1
  221. package/dist/queries/extract-candidates.js +1 -1
  222. package/dist/queries/fan.js +1 -1
  223. package/dist/queries/files.js +1 -1
  224. package/dist/queries/health.js +1 -1
  225. package/dist/queries/hierarchy.js +1 -1
  226. package/dist/queries/hotspots.js +1 -1
  227. package/dist/queries/imports.js +1 -1
  228. package/dist/queries/incomplete-migration.js +1 -1
  229. package/dist/queries/index.js +1 -1
  230. package/dist/queries/isolated.js +1 -1
  231. package/dist/queries/locality-candidates.js +1 -1
  232. package/dist/queries/members.js +1 -1
  233. package/dist/queries/methods.js +1 -1
  234. package/dist/queries/not-implemented.js +1 -1
  235. package/dist/queries/outline.js +1 -1
  236. package/dist/queries/passthrough-candidates.js +1 -1
  237. package/dist/queries/plan-context.js +1 -1
  238. package/dist/queries/react-component-duplicates.js +1 -1
  239. package/dist/queries/react-hook-candidates.js +1 -1
  240. package/dist/queries/react-large-component-pressure.js +1 -1
  241. package/dist/queries/recent-duplicates.js +1 -1
  242. package/dist/queries/redundant-reexports.js +1 -1
  243. package/dist/queries/reference-neighborhood.js +1 -1
  244. package/dist/queries/reference-reachability.js +1 -1
  245. package/dist/queries/refs.js +1 -1
  246. package/dist/queries/self-audit.js +1 -1
  247. package/dist/queries/similar-chains.js +1 -1
  248. package/dist/queries/similar-files.js +1 -1
  249. package/dist/queries/similar-signatures.js +1 -1
  250. package/dist/queries/similar.js +1 -1
  251. package/dist/queries/slice.js +1 -1
  252. package/dist/queries/source-inspection.js +1 -1
  253. package/dist/queries/source-search.js +1 -1
  254. package/dist/queries/stale-abstractions.js +1 -1
  255. package/dist/queries/surface.js +1 -1
  256. package/dist/queries/symbols.js +1 -1
  257. package/dist/queries/system-map.js +1 -1
  258. package/dist/queries/system.js +1 -1
  259. package/dist/queries/test-quality.js +1 -1
  260. package/dist/queries/trace.js +1 -1
  261. package/dist/queries/twin-ab.js +1 -1
  262. package/dist/queries/twin-drift.js +1 -1
  263. package/dist/queries/unused-imports.js +1 -1
  264. package/dist/queries/unused-params.js +1 -1
  265. package/dist/queries/value-flow.js +1 -1
  266. package/dist/queries/vue-component-duplicates.js +1 -1
  267. package/dist/queries/vue-composable-candidates.js +1 -1
  268. package/dist/queries/vue-large-view-pressure.js +1 -1
  269. package/dist/queries/wrapper-candidates.js +1 -1
  270. package/dist/reindex-worker.js +1 -1
  271. package/dist/reindex.js +30 -30
  272. package/dist/runtime.js +1 -1
  273. package/dist/rust-semantic-session-server.js +1 -1
  274. package/dist/rust-semantic-session-worker.js +1 -1
  275. package/dist/rust-semantic-worker.js +1 -1
  276. package/dist/sentinel-ensure-command-3MZCLPQY.js +2 -0
  277. package/dist/sentinel-ensure-command-LEWHIRLL.js +3 -0
  278. package/dist/sentinel-worker.js +1 -1
  279. package/dist/typescript-mailbox-worker.js +1 -1
  280. package/dist/watch-server.js +6 -6
  281. package/docs/COMMAND_REFERENCE.md +2 -2
  282. package/docs/SECURITY_MODEL.md +3 -0
  283. package/package.json +1 -1
  284. package/skills/codebaseiq/SKILL.md +15 -3
  285. package/dist/chunk-23C5AD3B.js +0 -2
  286. package/dist/chunk-2I2UHZET.js +0 -2
  287. package/dist/chunk-5IC2WZAL.js +0 -22
  288. package/dist/chunk-5T44HG5Y.js +0 -88
  289. package/dist/chunk-6JMAVFL4.js +0 -3
  290. package/dist/chunk-6WAPPQ5F.js +0 -82
  291. package/dist/chunk-7UCDGXRW.js +0 -8
  292. package/dist/chunk-AQI4N64O.js +0 -22
  293. package/dist/chunk-DAKIGMIK.js +0 -21
  294. package/dist/chunk-DUKHVPU5.js +0 -4
  295. package/dist/chunk-DVWO7RBC.js +0 -2
  296. package/dist/chunk-FH5WG4LE.js +0 -2
  297. package/dist/chunk-GQXXOS55.js +0 -2
  298. package/dist/chunk-GWYZVVKY.js +0 -21
  299. package/dist/chunk-JFIA2JI3.js +0 -3
  300. package/dist/chunk-JLZLLLW5.js +0 -3
  301. package/dist/chunk-MEUHIDI3.js +0 -7
  302. package/dist/chunk-OFGOOL6U.js +0 -3
  303. package/dist/chunk-P4NVCOM7.js +0 -2
  304. package/dist/chunk-SMDIEDM4.js +0 -27
  305. package/dist/chunk-SX72EVMY.js +0 -3
  306. package/dist/chunk-T5X7DK6C.js +0 -3
  307. package/dist/chunk-T75DS2E6.js +0 -21
  308. package/dist/chunk-TJBOJUVN.js +0 -3
  309. package/dist/chunk-UC2FD2PS.js +0 -4
  310. package/dist/chunk-UQYQBLJX.js +0 -5
  311. package/dist/chunk-Z35GOVEH.js +0 -2
  312. package/dist/cli-context-FJL2JHOE.js +0 -3
  313. package/dist/cli-context-PQNWHMCQ.js +0 -2
  314. package/dist/cli-program-UO7PZD6V.js +0 -7
  315. package/dist/direct-navigation-4XJTXIDT.js +0 -2
  316. package/dist/direct-navigation-J5MVYYAD.js +0 -3
  317. package/dist/invocation-command-descriptors-RWV4VAI4.js +0 -2
  318. package/dist/invocation-command-descriptors-U76PN7IY.js +0 -3
  319. package/dist/output-continuation-command-BL25S26S.js +0 -3
  320. package/dist/output-continuation-command-BTETTXEC.js +0 -2
  321. package/dist/project-reindex-CRJU3IFG.js +0 -2
  322. package/dist/project-reindex-TQFCOA2O.js +0 -3
  323. package/dist/sentinel-ensure-command-OSWGCFFL.js +0 -3
  324. package/dist/sentinel-ensure-command-SPW7XQLB.js +0 -2
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-DGXRDLV5.js";import{c as m}from"./chunk-HENP2O4A.js";import{a as u}from"./chunk-BGBBVSH4.js";import{d}from"./chunk-GVAF222T.js";function k(n,l={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=l,s=new m(n);return g({candidates:()=>s.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:o=>s.calleeEvidenceMap(o,{semantic:l.semantic!==!1}),evaluate:(o,c)=>c.incompleteSymbolIds.has(o.symbolId)||c.unavailableSymbolIds.has(o.symbolId)?null:h(o,c.rows.get(o.symbolId)??[],a),orderResults:(o,c)=>c.clusters.length-o.clusters.length||c.loc-o.loc,limit:r})}function h(n,l,e){let t=new Set(l.map(c=>c.symbol));if(t.size<e)return null;let a=S(t,l),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let s=d(n.symbol),o=p(s,t.size,r.length,i);return{symbol:n.symbol,shortName:s,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:u(n),totalCallees:t.size,extractionKind:o.extractionKind,actionTier:"signal",evidenceReasons:o.evidenceReasons,recommendation:o.recommendation,clusters:i}}function p(n,l,e,t){let a=Math.max(...t.map(o=>o.callees.length)),r=Math.max(...t.map(o=>o.isolation)),i=[`${l} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],s=f(n,l,e);return s!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,s],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,l,e){if(l>=10)return`callee breadth suggests orchestration: ${l} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,l){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of l){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let s=i+1;s<r.length;s++)e.get(r[i]).add(r[s]),e.get(r[s]).add(r[i])}return e}function y(n,l){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let s=i.pop();if(!e.has(s)){e.add(s),r.add(s);for(let o of l.get(s)??[])e.has(o)||i.push(o)}}t.push(r)}return t}function C(n,l){return n.filter(e=>e.size>=3).map(e=>v(e,n,l)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,l,e){let t=new Set;for(let s of l)if(s!==n)for(let o of s)t.add(o);let a=0;for(let s of n)for(let o of e.get(s)??[])t.has(o)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(d),isolation:i}}export{k as a};
2
- //# sourceMappingURL=chunk-BFBIMTCJ.js.map
1
+ import{a as g}from"./chunk-DGXRDLV5.js";import{c as m}from"./chunk-UHFZDQZJ.js";import{a as u}from"./chunk-BGBBVSH4.js";import{d}from"./chunk-TNLOX4TN.js";function k(n,l={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=l,s=new m(n);return g({candidates:()=>s.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:o=>s.calleeEvidenceMap(o,{semantic:l.semantic!==!1}),evaluate:(o,c)=>c.incompleteSymbolIds.has(o.symbolId)||c.unavailableSymbolIds.has(o.symbolId)?null:h(o,c.rows.get(o.symbolId)??[],a),orderResults:(o,c)=>c.clusters.length-o.clusters.length||c.loc-o.loc,limit:r})}function h(n,l,e){let t=new Set(l.map(c=>c.symbol));if(t.size<e)return null;let a=S(t,l),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let s=d(n.symbol),o=p(s,t.size,r.length,i);return{symbol:n.symbol,shortName:s,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:u(n),totalCallees:t.size,extractionKind:o.extractionKind,actionTier:"signal",evidenceReasons:o.evidenceReasons,recommendation:o.recommendation,clusters:i}}function p(n,l,e,t){let a=Math.max(...t.map(o=>o.callees.length)),r=Math.max(...t.map(o=>o.isolation)),i=[`${l} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],s=f(n,l,e);return s!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,s],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,l,e){if(l>=10)return`callee breadth suggests orchestration: ${l} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,l){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of l){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let s=i+1;s<r.length;s++)e.get(r[i]).add(r[s]),e.get(r[s]).add(r[i])}return e}function y(n,l){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let s=i.pop();if(!e.has(s)){e.add(s),r.add(s);for(let o of l.get(s)??[])e.has(o)||i.push(o)}}t.push(r)}return t}function C(n,l){return n.filter(e=>e.size>=3).map(e=>v(e,n,l)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,l,e){let t=new Set;for(let s of l)if(s!==n)for(let o of s)t.add(o);let a=0;for(let s of n)for(let o of e.get(s)??[])t.has(o)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(d),isolation:i}}export{k as a};
2
+ //# sourceMappingURL=chunk-ITA3N7G6.js.map
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ import{Z as Ne,_ as $e}from"./chunk-DQZF7MP6.js";import{A as Le,a as Me}from"./chunk-OSZ7PW5K.js";import{a as Y,b as z,d as w,e as T,f as Ae}from"./chunk-RS6UYNEP.js";import{Ga as P,J as H,N as Z,O as We,P as ee,Q as Ce,V as Te,W as He,X as te,c as X,d as xe,e as Ee,ka as ne,la as Pe,ma as A,na as qe,o as m,oa as _e,r as Ie,va as x,wa as Oe,xa as De}from"./chunk-AZDY3EKD.js";import{D as b,f as ve,h as B,i as ye,j as v,k as V,l as be,q as K,s as f,x as we,y as J,z as Q}from"./chunk-KPMMOAV5.js";import{b as Re}from"./chunk-Z2L5H2HF.js";import{existsSync as h,mkdirSync as At,rmdirSync as xt,unlinkSync as Et}from"fs";import{homedir as It}from"os";import{basename as Ke,dirname as D,isAbsolute as Wt,join as u,resolve as oe}from"path";import{fileURLToPath as Ct}from"url";var g="<!-- codebaseiq:agent-setup:begin -->",y="<!-- codebaseiq:agent-setup:end -->",Tt="# codebaseiq:agent-setup",M=[".codex/hooks.json",".claude/settings.local.json"],je="# codebaseiq:local-agent-hooks:begin",Fe="# codebaseiq:local-agent-hooks:end",ie="hook-architecture-stop",Je=["claude","codex"],E={claude:".claude/settings.local.json",codex:".codex/hooks.json"},Qe="sentinel-hook.mjs",Ht=u("dist","sentinel-hook.js"),Pt=u("dist","cli.js"),qt="cli-path",_t="installed-projects.json";function Xn(e){let t=e.written.length+e.unchanged.length,n=e.skipped.length;return{verdict:n===0?"ready":t===0?"blocked":"partial",ready:t,skipped:n}}function Zn(e,t={}){let n={written:[],unchanged:[],skipped:[]};return Ot(e,n),t.architectureHook!==!1&&Lt(e,n,t.architectureHook),n}function er(e,t={}){let n={removed:[],unchanged:[],skipped:[]};return Ue(e,"AGENTS.md",t,n),Ue(e,"CLAUDE.md",t,n),ze(e,t,n,r=>ct(jt(r))),st(e,t,n),Mt(e,t,n),n}function Ot(e,t){let n=[g,"## codebaseiq","","This repository uses codebaseiq as its primary code exploration surface. Use it for repository exploration, including literal search and exact source reads; native tools are for applying edits, running checks, binary content, or a specific unsupported gap that codebaseiq has explicitly reported\u2014not a parallel exploration workflow.","","The agent decides what repository fact it needs; codebaseiq locates exact referents and reports typed evidence without guessing task relevance. Load the installed `codebaseiq` skill before exploring and `codebaseiq-explore` for an end-to-end explanation; they hold the operating rules.","","| Question | Command |","| --- | --- |","| Who references this symbol? | `codebaseiq refs <symbol>` |","| Who calls it, and what does it call? | `codebaseiq call-graph <symbol>` |","| What may break if it changes? | `codebaseiq affected <symbol>` |","| Where does this value come from or go? | `codebaseiq value-flow <symbol>` |","| What does this file import, and who imports a symbol? | `codebaseiq imports <file>`, `codebaseiq imported-by <symbol>` |","| Where does this exact text occur? | `codebaseiq search <exact-text>` (insert `--` before a literal that starts with a dash) |","| What is in this file? | `codebaseiq outline <file>` |","| What is the exact source? | `codebaseiq code <selectors...>` |","| What is the connected behavior at these points? | `codebaseiq inspect --symbol <symbol> --at <file:line> --view behavior` |","","- `codebaseiq evidence --symbol <symbol> --edge <family> --direction incoming|outgoing|both` combines relationship families or batches several roots (`--symbol`, `--at`, and `--search` repeat). `--edge` and `--direction` are required; `--depth` defaults to 2 and `--max-edges` to 32. Families: execution, runtime, dataflow, state, temporal, contract, identity, ownership, dependencies.","- Read coverage before claiming an absence: `bounded` or `incomplete` output is not evidence that no caller, branch, or consumer exists. Run the printed recovery command, or add `--full` when complete coverage can change the decision.","- After a nontrivial edit, run `codebaseiq diff-impact`. Use `codebaseiq architecture` for declared structural rules and `codebaseiq health` for cleanup candidates.","- If output emits `Continue exactly:`, run that command unchanged until transport is complete.","- Sandbox cannot write the cache? Set `CODEBASEIQ_READ_ONLY=1` to query the existing index read-only.","- Commit relevant `.codebaseiq/suppressions/*.json` records with the change; do not commit local agent-tool settings. When architecture rules are configured and clean, setup installs a checkout-local Stop hook that checks architecture after indexed source changes.",y].join(`
3
+ `);Ge(e,"AGENTS.md",n,t);let r=[g,"@AGENTS.md",y].join(`
4
+ `);Ge(e,"CLAUDE.md",r,t,o=>o.includes("@AGENTS.md")&&!o.includes(g))}function Ge(e,t,n,r,o){let i=u(e,t),s=!1,a=se(i,t,r,c=>{if(o?.(c.text))return s=!0,{kind:"unchanged"};let d=Dt(c.text,n);return d===c.text?{kind:"unchanged"}:{kind:"write",text:d,...c.revision.exists?{}:{mode:420}}});a&&(!a.changed||s?r.unchanged.push(t):r.written.push(t))}function Ue(e,t,n,r){let o=u(e,t);if(n.dryRun){if(!h(o)){r.unchanged.push(t);return}try{let s=f(o,"agent instruction file");s.includes(g)?(Be(s),r.removed.push(t)):r.unchanged.push(t)}catch(s){r.skipped.push({target:t,reason:s instanceof Error?s.message:String(s)})}return}let i=se(o,t,r,s=>{if(!s.revision.exists||!s.text.includes(g))return{kind:"unchanged"};let a=Be(s.text);return a.length===0?{kind:"delete"}:{kind:"write",text:a}});i&&(i.changed?r.removed.push(t):r.unchanged.push(t))}function Dt(e,t){if(Ye(e)==="present"){let r=new RegExp(`${g}[\\s\\S]*?${y}`);return e.replace(r,t)}return e.length>0?`${e.replace(/\n*$/,`
5
+
6
+ `)}${t}
7
+ `:`${t}
8
+ `}function Be(e){Ye(e);let t=new RegExp(`${g}[\\s\\S]*?${y}`),n=e.replace(t,"").replace(/\n{3,}/g,`
9
+
10
+ `).trim();return n.length===0?"":`${n}
11
+ `}function Ye(e){let t=e.split(g).length-1,n=e.split(y).length-1;if(t===0&&n===0)return"absent";if(t===1&&n===1&&e.indexOf(g)<e.indexOf(y))return"present";throw new Error("managed codebaseiq markers are incomplete, duplicated, or out of order")}function se(e,t,n,r){try{return x(e,r,{maxRetries:0})}catch(o){n.skipped.push({target:t,reason:o instanceof Error?o.message:String(o)});return}}function Mt(e,t,n){let r=".git/hooks/pre-commit",o=u(e,r);if(!h(o)){n.unchanged.push(r);return}if(!f(o,"pre-commit hook").includes(Tt)){n.skipped.push({target:r,reason:"pre-commit hook is not managed by codebaseiq"});return}if(t.dryRun){n.removed.push(r);return}se(o,r,n,()=>({kind:"delete"}))?.changed&&n.removed.push(r)}function Lt(e,t,n={}){let r=(n.inspectReadiness??Nt)(e);if(r.state==="not-configured")return;if(r.state==="blocked"){t.skipped.push({target:"architecture Stop hook",reason:r.reason});return}let o=n.commandPrefix??"codebaseiq";for(let i of M){if(P(e,i)){t.skipped.push({target:i,reason:"tracked repository config; the checkout-local hook installer will not modify it"});continue}ae(u(e,i),i,t,s=>$t(s,o))}nt(e,t)}function ze(e,t,n,r){for(let o of M){let i=u(e,o);if(h(i)){if(P(e,o)){n.skipped.push({target:o,reason:"tracked repository config; the checkout-local hook remover will not modify it"});continue}if(t.dryRun){try{let s=et(i);JSON.stringify(r(s))!==JSON.stringify(s)&&n.removed.push(o)}catch(s){n.skipped.push({target:o,reason:k(s)})}continue}ae(i,o,n,r,!0)}}}function Nt(e){let t=De(e);if(!t.architecture||t.architecture.boundaries.length===0)return{state:"not-configured"};let n=Ie(e,t),r=Me(e,t,n);if(r.state!=="fresh")return{state:"blocked",reason:`the index is ${r.state}; refresh it before installing a persistent architecture grader`};let o;try{o=Le(e);let i=$e(Ne(o));return i.length>0?{state:"blocked",reason:`the current architecture baseline has ${i.length} enforced violation(s); make the declared policy clean before installing the Stop hook`}:{state:"ready"}}catch(i){return{state:"blocked",reason:k(i)}}finally{o?.close()}}function $t(e,t="codebaseiq"){let n=I(e.hooks),r=Array.isArray(n.Stop)?n.Stop:[],o={type:"command",command:`${t} ${ie}`,timeout:120,statusMessage:"Checking architecture boundaries"};return{...e,hooks:{...n,Stop:Xe(r,{hook:o},Ze)}}}function tr(e,t){return e===ie&&t.sentinel?.enabled===!0}function jt(e){let t=I(e.hooks),n=Array.isArray(t.Stop)?t.Stop:[],r=Ft(n),o={...t};r.length>0?o.Stop=r:delete o.Stop;let i={...e};return Object.keys(o).length>0?i.hooks=o:delete i.hooks,i}function I(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Ft(e){return e.map(t=>({...t,hooks:Array.isArray(t.hooks)?t.hooks.filter(n=>!Ze(n)):[]})).filter(t=>t.hooks.length>0)}function ce(e){return typeof e=="object"&&e!==null&&Array.isArray(e.hooks)}function Xe(e,t,n){let r=!1,o=[];for(let i of e){if(!ce(i)||!i.hooks.some(n)){o.push(i);continue}let s=i.hooks.every(n),a=[],c=!1;for(let d of i.hooks)n(d)?r||(a.push(t.hook),r=!0,c=!0):a.push(d);a.length!==0&&o.push(c&&s?Gt({...i,hooks:a},t.matcher):{...i,hooks:a})}return r||o.push({...t.matcher!==void 0?{matcher:t.matcher}:{},hooks:[t.hook]}),o}function Gt(e,t){let{matcher:n,...r}=e;return t===void 0?r:{matcher:t,...r}}function Ze(e){if(!e||typeof e!="object")return!1;let t=e.command;return typeof t=="string"&&new RegExp(`(?:^|\\s)${ie}$`,"u").test(t)}function ae(e,t,n,r,o=!1){try{x(e,s=>{let a=s.revision.exists?tt(s.text,e):{},c=r(a);return JSON.stringify(c)===JSON.stringify(a)?{kind:"unchanged"}:o&&Object.keys(c).length===0?{kind:"delete"}:{kind:"write",text:`${JSON.stringify(c,null,2)}
12
+ `,mode:384}}).changed?"written"in n?n.written.push(t):n.removed.push(t):o||n.unchanged.push(t)}catch(i){n.skipped.push({target:t,reason:k(i)})}}function et(e){return tt(f(e,"agent hook settings"),e)}function tt(e,t){let n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`Cannot update ${t}: the hook config is not a JSON object.`);return n}function nt(e,t){let n=B(e,["rev-parse","--git-path","info/exclude"]),r=n?ye(e,n):void 0;if(!r||!h(D(r))){t.skipped.push({target:".git/info/exclude",reason:"Git metadata was not found; local hook files may appear as untracked"});return}let o=Ut(B(e,["rev-parse","--show-prefix"])??"");try{x(r,i=>{let s=new RegExp(`${je}([\\s\\S]*?)${Fe}\\n?`,"gu"),a=[...i.text.matchAll(s)].flatMap(R=>R[1].split(`
13
+ `).filter(wt=>wt!=="")),c=i.text.replace(s,"").replace(/\n*$/u,""),d=[...M,Oe].map(R=>`/${o}${R}`),p=[je,...new Set([...a,...d]),Fe].join(`
14
+ `),l=`${c}${c?`
15
+
16
+ `:""}${p}
17
+ `;return l===i.text?{kind:"unchanged"}:{kind:"write",text:l,mode:420}})}catch(i){t.skipped.push({target:".git/info/exclude",reason:k(i)})}}function Ut(e){return e.replace(/[\\*?[]/gu,"\\$&")}function k(e){return e instanceof Error?e.message:String(e)}var rt={claude:[{event:"SessionStart",timeout:5},{event:"UserPromptSubmit",timeout:5},{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",timeout:15,async:!0},{event:"Stop",timeout:30},{event:"SessionEnd",timeout:2}],codex:[{event:"SessionStart",timeout:5},{event:"UserPromptSubmit",timeout:5},{event:"PostToolUse",matcher:"apply_patch|Edit|Write",timeout:15},{event:"Stop",timeout:30}]};function L(e){let t=u(e,"bin");return{directory:t,script:u(t,Qe),version:u(t,"sentinel-hook.version"),manifest:u(t,"package.json"),cliPath:u(t,qt)}}function ot(e={}){let t=Bt(e.packageRoot??D(Ct(import.meta.url)));if(!t)return{state:"skipped",reason:"the codebaseiq package root was not found"};let n=u(t.root,Ht);if(!h(n))return{state:"skipped",reason:"build the package first (dist/sentinel-hook.js was not found)"};let r=L(e.cacheRoot??m());try{let o=`${JSON.stringify({name:"codebaseiq",version:t.version,private:!0},null,2)}
18
+ `,i=[q(r.script,K(n,it("sentinel hook bundle"))),q(r.version,Buffer.from(`${t.version}
19
+ `)),q(r.manifest,Buffer.from(o)),q(r.cliPath,Buffer.from(`${oe(t.root,Pt)}
20
+ `))];return{state:"installed",script:r.script,version:t.version,changed:i.some(Boolean)}}catch(o){return{state:"skipped",reason:`the hook binary could not be installed: ${k(o)}`}}}function nr(e,t={}){let n=L(t.cacheRoot??m());if(!(re(n.version,"sentinel hook version")===e&&h(n.cliPath)))return ot(t)}function Bt(e){let t=e;for(;;){try{let r=JSON.parse(f(u(t,"package.json"),"package manifest"));if(r.name==="codebaseiq"&&typeof r.version=="string")return{root:t,version:r.version}}catch{}let n=D(t);if(n===t)return;t=n}}function it(e){return{maxBytes:be,inputKind:e}}function q(e,t){try{if(K(e,it("sentinel hook file")).equals(t))return!1}catch{}return Te(e,t),!0}function rr(e,t={}){let n=t.hosts??Je,r=t.cacheRoot??m(),o=ot({packageRoot:t.packageRoot,cacheRoot:r}),i={written:[],unchanged:[],skipped:[],binary:o,notices:[]};if(o.state==="skipped")return i.skipped.push({target:"sentinel hook binary",reason:o.reason}),i;for(let a of n){let c=E[a];if(P(e,c)){i.skipped.push({target:c,reason:"tracked repository config; the checkout-local hook installer will not modify it"});continue}let d=[];ae(u(e,c),c,i,p=>{let l=Jt(p,Qt(a,o.script,t.nodeExecutable));return d=Vt(p,l),l}),a==="codex"&&d.length>0&&i.written.includes(c)&&i.notices.push(`Codex must re-approve the changed hooks (${d.join(", ")}): open Codex once in this project and approve them. The approval it recorded for the old command no longer applies, and codebaseiq can only see that an approval exists, not that it still matches.`)}if(nt(e,i),n.map(a=>E[a]).some(a=>i.written.includes(a)||i.unchanged.includes(a)))try{on(r,e)}catch(a){i.skipped.push({target:"sentinel project registry",reason:k(a)})}return i}function Vt(e,t){let n=o=>`${o.event}:${o.group}:${o.index}:${JSON.stringify(o.hook)}`,r=new Set(O(t).map(n));return[...new Set(O(e).filter(o=>!r.has(n(o))).map(o=>o.event))]}function Kt(e,t={}){let n={removed:[],unchanged:[],skipped:[]};return ze(e,t,n,ct),st(e,t,n),n}function or(e={}){let t=e.cacheRoot??m(),n={removed:[],unchanged:[],skipped:[]};for(let o of rn(t)){if(!h(o)){e.dryRun||pt(t,o);continue}let i=Kt(o,{dryRun:e.dryRun,cacheRoot:t});n.removed.push(...i.removed.map(s=>u(o,s))),n.skipped.push(...i.skipped.map(s=>({...s,target:u(o,s.target)})))}let r=L(t);if(n.skipped.length>0)return h(r.script)&&n.skipped.push({target:r.script,reason:"kept: hooks that run it could not be removed from every project; run uninstall again once they can"}),n;for(let o of[r.script,r.version,r.manifest,r.cliPath])if(h(o)&&(n.removed.push(o),!e.dryRun))try{Et(o)}catch(i){n.skipped.push({target:o,reason:k(i)})}if(!e.dryRun)try{xt(r.directory)}catch{}return n}function st(e,t,n){let r=M;if(!(t.dryRun||n.skipped.some(o=>r.includes(o.target))))try{pt(t.cacheRoot??m(),e)}catch(o){n.skipped.push({target:"sentinel project registry",reason:k(o)})}}function _(e){if(!e||typeof e!="object")return!1;let{command:t,args:n}=e;return Array.isArray(n)&&n.includes(A)?!0:typeof t=="string"&&t.split(/\s+/u).includes(A)}function Jt(e,t){let n={...I(e.hooks)};for(let{event:r,...o}of t){let i=n[r];n[r]=Xe(Array.isArray(i)?i:[],o,_)}return{...e,hooks:n}}function ct(e){let t=I(e.hooks),n={},r=!1;for(let[i,s]of Object.entries(t)){if(!Array.isArray(s)){n[i]=s;continue}let a=[];for(let c of s){if(!ce(c)||!c.hooks.some(_)){a.push(c);continue}r=!0;let d=c.hooks.filter(p=>!_(p));d.length>0&&a.push({...c,hooks:d})}(a.length>0||s.length===0)&&(n[i]=a)}if(!r)return e;let o={...e};return Object.keys(n).length>0?o.hooks=n:delete o.hooks,o}function Qt(e,t,n=process.execPath){return rt[e].map(r=>({event:r.event,...r.matcher!==void 0?{matcher:r.matcher}:{},hook:e==="claude"?Yt(t,r):zt(t,r,n)}))}function Yt(e,t){return{type:"command",command:"node",args:[e,"--host","claude",...t.async?["--async"]:[],A],...t.async?{async:!0,asyncRewake:!0}:{},timeout:t.timeout}}function zt(e,t,n){let r=Wt(n)&&/^node(?:\.exe)?$/iu.test(Ke(n))?n:"node";return{type:"command",command:`${process.platform==="win32"?"& ":""}${Ve(r)} ${Ve(e)} --host codex ${A}`,timeout:t.timeout}}function Ve(e){if((process.platform==="win32"?/["\r\n%$`]/u:/["\r\n$`]/u).test(e))throw new Error(`${JSON.stringify(e)} cannot be quoted in a Codex hook command`);return`"${e}"`}function O(e){let t=[];for(let[n,r]of Object.entries(I(e.hooks)))Array.isArray(r)&&r.forEach((o,i)=>{ce(o)&&o.hooks.forEach((s,a)=>{_(s)&&t.push({event:n,group:i,index:a,hook:s})})});return t}function at(e){if(h(e))try{return et(e)}catch{return}}function ir(e,t={}){let n=L(t.cacheRoot??m()),r=re(n.version,"sentinel hook version"),o=re(n.cliPath,"sentinel hook CLI path");return{binary:{script:n.script,present:h(n.script),...r?{version:r}:{},...o?{cliTarget:o}:{}},hosts:Je.map(i=>{let s=E[i],a=at(u(e,s)),c=a?O(a):[],d=rt[i].map(l=>l.event),p=new Set(c.map(l=>l.event));return{host:i,file:s,events:d.filter(l=>p.has(l)),missing:d.filter(l=>!p.has(l)),scripts:[...new Set(c.flatMap(l=>Xt(l.hook)))]}})}}function re(e,t){try{return f(e,t).trim()||void 0}catch{return}}function Xt(e){return(Array.isArray(e.args)?e.args.filter(n=>typeof n=="string"):[...e.command.matchAll(/"([^"]*)"|(\S+)/gu)].map(n=>n[1]??n[2]??"")).filter(n=>Ke(n)===Qe)}function sr(e,t={}){let n=u(e,E.codex),r=at(n),o=r?O(r):[];if(o.length===0)return;let i=u(t.codexHome??process.env.CODEX_HOME??u(It(),".codex"),"config.toml"),s=tn(i),a=[...new Set([n,u(v(e),E.codex)])];return{configPath:i,hooks:o.map(({event:c,group:d,index:p})=>{let l=`:${nn(c)}:${d}:${p}`;return{event:c,key:`${n}${l}`,trusted:a.some(R=>s.has(dt(`${R}${l}`)))}})}}var Zt=/^\s*\[hooks\.state\.(?:'([^']*)'|"((?:[^"\\]|\\.)*)")\]\s*(?:#.*)?$/u,en=/^\s*trusted_hash\s*=\s*"sha256:[0-9a-f]+"/u;function tn(e){let t=new Set,n;try{n=f(e,"Codex config")}catch{return t}let r;for(let o of n.split(/\r?\n/u)){let i=Zt.exec(o);i?r=dt(i[1]??(i[2]??"").replace(/\\(["\\])/gu,"$1")):/^\s*\[/u.test(o)?r=void 0:r!==void 0&&en.test(o)&&t.add(r)}return t}function nn(e){return e.replace(/([a-z])([A-Z])/gu,"$1_$2").toLowerCase()}function dt(e){return process.platform==="win32"?e.replaceAll("/","\\").toLowerCase():e}function cr(e){let t={..._e.delivery};try{let n=JSON.parse(f(u(e,ne,Pe),"sentinel settings")).delivery;for(let r of qe){let o=n?.[r];(o==="shadow"||o==="live")&&(t[r]=o)}}catch{}return t}function de(e){return u(e,ne,_t)}function rn(e=m()){try{return ut(f(de(e),"sentinel project registry"))}catch{return[]}}function ut(e){try{let{projects:t}=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function lt(e,t){let n=de(e);At(D(n),{recursive:!0}),x(n,r=>{let o=t(r.revision.exists?ut(r.text):[]);return o===void 0?{kind:"unchanged"}:{kind:"write",text:`${JSON.stringify({projects:o},null,2)}
21
+ `,mode:384}})}function on(e,t){let n=v(oe(t));lt(e,r=>r.includes(n)?void 0:[...r,n].sort())}function pt(e,t){if(!h(de(e)))return;let n=v(oe(t));lt(e,r=>r.includes(n)?r.filter(o=>o!==n):void 0)}import{spawn as En}from"child_process";import{existsSync as In,rmSync as gt}from"fs";import{dirname as Wn,resolve as U}from"path";import{fileURLToPath as Cn}from"url";import{createHash as sn,randomUUID as ht}from"crypto";import{existsSync as cn,linkSync as an,readdirSync as dn,rmSync as un}from"fs";import{basename as ln,dirname as pn,join as S}from"path";var $=1,hn=10*6e4,mr=10080*6e4,ue="requests",fn="claims",gn="completions",mn="staging";function ft(e,t,n={}){let r=n.now?.()??new Date,o=wn(n.ttlMs),i=An(n.idempotencyKey),s=i?`key-${sn("sha256").update(i).digest("hex")}`:`request-${(n.randomId??ht)()}`,a={version:$,requestId:s,...i?{idempotencyKey:i}:{},createdAt:r.toISOString(),deadlineAt:new Date(r.getTime()+o).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},c=bn(e,s),d=vn(e,c,a,n.onStage);if(d.published)return{disposition:"accepted",request:a,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let p=le(c);if(!p)throw new Error(`Watch refresh request identity ${s} exists but is malformed.`);return{disposition:"duplicate",request:p}}function kr(e){let t=yn(e),n=new Map,r=Rn(S(e,ue),le);for(let c of N(S(e,gn))){let d=Sn(c);if(!d){r++;continue}n.set(d.requestId,d)}let o=new Set;for(let c of N(S(e,fn))){let d=kn(c);if(!d){r++;continue}o.add(d.requestId)}let i=t.filter(c=>!n.has(c.requestId)&&!o.has(c.requestId)),s=[...n.values()].filter(c=>c.outcome==="completed").length,a=[...n.values()].filter(c=>c.outcome==="expired").length;return{pending:i.length,claimed:t.filter(c=>!n.has(c.requestId)&&o.has(c.requestId)).length,completed:s,expired:a,invalid:r,...i.length>0?{oldestPendingAt:i.map(c=>c.createdAt).reduce((c,d)=>xn(c,d))}:{}}}function le(e){return pe(e,t=>{let n=t;return n.version===$&&W(n.requestId)&&(n.idempotencyKey===void 0||typeof n.idempotencyKey=="string")&&b(n.createdAt)&&b(n.deadlineAt)&&Date.parse(n.deadlineAt)>=Date.parse(n.createdAt)&&typeof n.detail=="string"&&n.detail.length>0})}function kn(e){return pe(e,t=>{let n=t;return n.version===$&&W(n.requestId)&&W(n.claimId)&&b(n.claimedAt)})}function Sn(e){return pe(e,t=>{let n=t;return n.version===$&&W(n.requestId)&&(n.claimId===void 0||W(n.claimId))&&(n.outcome==="completed"||n.outcome==="expired")&&b(n.completedAt)})}function vn(e,t,n,r){let o=S(e,mn),i=pn(t),s=X(o),a=X(i),c=S(o,`${ln(t)}.${process.pid}.${ht()}.tmp`);try{let d=te(c,n,{spacing:2,trailingNewline:!0});r?.("after-staged");try{an(c,t)}catch(l){if(l.code==="EEXIST")return{published:!1};throw l}let p=Ee(s,a,d.directorySync,xe(i));return r?.("after-published"),{published:!0,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}finally{un(c,{force:!0})}}function yn(e){let t=[];for(let n of N(S(e,ue))){let r=le(n);r&&t.push(r)}return t}function Rn(e,t){return N(e).filter(n=>!t(n)).length}function N(e,t=".json"){return cn(e)?dn(e,{withFileTypes:!0}).filter(n=>n.isFile()&&n.name.endsWith(t)).map(n=>S(e,n.name)).sort():[]}function pe(e,t){try{let n=JSON.parse(f(e,"watch refresh request record"));return t(n)?n:null}catch{return null}}function bn(e,t){return S(e,ue,`${t}.json`)}function wn(e){if(e===void 0)return hn;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function An(e){let t=e?.trim();return t?t.slice(0,512):void 0}function W(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function xn(e,t){return Date.parse(t)<Date.parse(e)?t:e}var mt=5e3,Tn=6e3,Hn=1e3,fe=10,Pn=new Set(["capabilities","check-deps","config-validate","doctor","init","install-skills","reindex","setup","setup-agent","status","suppress","uninstall","watch"]);function Mr(e){let t=e.classification;if(t.kind!=="live")return;let{state:n}=t;return n.watcher.state==="idle"&&n.lastError===void 0?n.indexGeneration:void 0}function qn(e,t=process.env){return t.CODEBASEIQ_SKIP_WATCH_SERVICE!=="1"&&!Re(t)&&!e.startsWith("__")&&!Pn.has(e)}function Lr(e){let t=e.env??process.env;if(t.CODEBASEIQ_SKIP_WATCH_SERVICE==="1")return{kind:"skipped",reason:"environment"};if(!qn(e.commandName,t))return{kind:"skipped",reason:"excluded-command"};if(e.config.watch?.enabled!==!0)return{kind:"skipped",reason:"disabled"};try{let n=_n({projectRoot:e.projectRoot,cacheDir:e.cacheDir,cliVersion:e.cliVersion,gitContext:e.gitContext,runtime:e.runtime});return{kind:n.disposition,state:n.state}}catch(n){return{kind:"failed",message:n instanceof Error?n.message:String(n)}}}function vt(e,t,n){let r=v(U(e));if(n&&v(n.projectRoot)===r)return{projectRoot:r,worktreeKind:"git",worktreeId:n.worktreeId,cliVersion:t};let o=ve(r);if(o.kind==="error")throw new Error(`Could not establish Git worktree identity for ${r}: ${o.message}`);return o.kind==="non-git"?{projectRoot:r,worktreeKind:"non-git",cliVersion:t}:{projectRoot:r,worktreeKind:"git",worktreeId:o.identity.worktreeId,cliVersion:t}}function Nr(e){return F(e,vt(e.projectRoot,e.cliVersion,e.gitContext))}function F(e,t){let n=e.runtime??Se,r=w(e.cacheDir),o=T(r.statePath),i=ke(r.lockPath);return{identity:t,classification:On(o,t,n.now(),n.isProcessAlive),lock:i,lockIsLive:i!==null&&n.isProcessAlive(i.pid),paths:r}}function _n(e){let t=e.runtime??Se,n=vt(e.projectRoot,e.cliVersion,e.gitContext),r=F(e,n),o=ge("ensure",r.classification);if(o.kind==="reuse")return j(r.paths.activityPath,t),{disposition:"reused",state:o.state};if(o.kind==="refuse-replace")throw new Error(`codebaseiq watch service pid ${o.state.pid} is still alive but its heartbeat is old. Refusing automatic replacement because civil-clock age alone cannot authorize a process signal.`);if(o.kind==="replace")me(o.state,e,t),C(r.paths,o.state.pid,t);else if(o.kind==="start"){if(r.lockIsLive){let a=kt(e,n,t,Math.min(e.startupTimeoutMs??1e3,1e3));if(a)return j(r.paths.activityPath,t),{disposition:"reused",state:a};throw new Error(`codebaseiq watch is already running for ${U(e.projectRoot)} (pid ${r.lock?.pid}; lock: ${r.paths.lockPath}) without compatible daemon state. Stop the foreground watcher before starting the service.`)}r.classification.kind==="stale"&&C(r.paths,r.classification.state.pid,t)}else throw new Error(`Unexpected ensure action: ${o.kind}`);if(r=F(e,n),o=ge("ensure",r.classification),o.kind==="reuse")return j(r.paths.activityPath,t),{disposition:"reused",state:o.state};if(o.kind==="refuse-replace")throw new Error(`codebaseiq watch service pid ${o.state.pid} remains alive with an old heartbeat; automatic replacement is not authorized.`);let i=e.serverPath??Cn(new URL("./watch-server.js",import.meta.url));t.spawnServer(i,n.projectRoot,e.cliVersion,e.watchOverrides??{},e.spawnEnv);let s=kt(e,n,t,e.startupTimeoutMs??mt);if(!s)throw new Error(`codebaseiq watch service did not become ready within ${e.startupTimeoutMs??mt}ms.`);return j(r.paths.activityPath,t),{disposition:"started",state:s}}function $r(e){let t=e.runtime??Se,n=w(e.cacheDir),r=T(n.statePath),o=r?t.isProcessAlive(r.pid)?{kind:"live",state:r}:{kind:"stale",state:r,reason:"dead-process"}:{kind:"stopped"},i=ge("stop",o);if(i.kind==="signal-stop")return me(i.state,e,t),C(n,i.state.pid,t),{disposition:"stopped",pid:i.state.pid};if(i.kind==="clean-stale")return C(n,i.state.pid,t),{disposition:"stopped",pid:i.state.pid};let s=ke(n.lockPath);return i.kind==="already-stopped"&&s&&t.isProcessAlive(s.pid)?(me(s,e,t),C(n,s.pid,t),{disposition:"stopped",pid:s.pid}):{disposition:"already-stopped"}}function yt(e,t=Date.now()){He(e,{version:1,at:new Date(t).toISOString()})}function jr(e,t,n=Date.now(),r={}){ft(w(Wn(e)).refreshRequestsPath,t,{...r,now:()=>new Date(n)}),yt(e,n)}function Fr(e,t,n={}){let r=n.pid??process.pid,o=n.isProcessAlive??V,i=()=>{},s=n.readProcessIdentity??Q,a=n.now??(()=>new Date),c={...Z,wallNow:()=>a().getTime(),isProcessAlive:o,readProcessIdentity:s},d=We(e,{kind:"watch",pid:r,processIdentity:s(r),detail:{projectRoot:U(t)},parseLegacy:G,runtime:c});if(d.kind==="contended"){let p=Rt(d.observation);return{acquired:!1,lockPath:e,message:Dn(e,t,p),release:i}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function ke(e){return Rt(ee(e,{parseLegacy:G}))}var G=e=>{let t=bt(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Rt(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return bt(e.parsed)}function bt(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!Ae(t.startedAt))return null;let n=t.processIdentity===void 0?null:we(t.processIdentity);return t.processIdentity!==void 0&&(!n||n.pid!==t.pid)?null:{version:1,pid:t.pid,...n?{processIdentity:n}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function On(e,t,n,r){if(!e)return{kind:"stopped"};if(e.protocolVersion!==Y)return{kind:"incompatible",state:e,reason:"protocol"};if(e.projectRoot!==t.projectRoot)return{kind:"incompatible",state:e,reason:"project"};let o=t.worktreeKind==="git"?t.worktreeId:void 0;if(e.worktreeId!==o)return{kind:"incompatible",state:e,reason:"worktree"};if(e.cliVersion!==t.cliVersion)return{kind:"incompatible",state:e,reason:"cli-version"};if(!r(e.pid))return{kind:"stale",state:e,reason:"dead-process"};let i=Date.parse(e.heartbeatAt);return n-i>z?{kind:"stale",state:e,reason:"old-heartbeat"}:{kind:"live",state:e}}function ge(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return he(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return he(t)}default:return he(e)}}function kt(e,t,n,r){let o=n.monotonicNow??H,i=o()+r;for(;o()<=i;){let s=F(e,t).classification;if(s.kind==="live")return s.state;n.sleep(fe)}return null}function me(e,t,n){let{pid:r}=e;if(!n.isProcessAlive(r))return;St(e,n),n.signalProcess(r);let o=t.stopTimeoutMs??Tn,i=n.monotonicNow??H,s=i()+o;for(;i()<=s;){if(!n.isProcessAlive(r))return;n.sleep(fe)}if(!n.forceSignalProcess)throw new Error(`codebaseiq watch service pid ${r} did not stop within ${o}ms and forced termination is unavailable.`);St(e,n),n.forceSignalProcess(r);let a=t.forceStopTimeoutMs??Hn,c=i()+a;for(;i()<=c;){if(!n.isProcessAlive(r))return;let d=n.readProcessIdentity(r);if(e.processIdentity&&d&&!J(e.processIdentity,d))return;n.sleep(fe)}throw new Error(`codebaseiq watch service pid ${r} remained alive ${a}ms after forced termination.`)}function C(e,t,n){if(gt(e.statePath,{force:!0}),gt(e.activityPath,{force:!0}),ke(e.lockPath)?.pid===t&&!n.isProcessAlive(t)){let o={...Z,wallNow:n.now,isProcessAlive:n.isProcessAlive,readProcessIdentity:n.readProcessIdentity},i=ee(e.lockPath,{parseLegacy:G,runtime:o});Ce(e.lockPath,i,{parseLegacy:G,runtime:o})}}function Dn(e,t,n){return`error: codebaseiq watch is already running for ${U(t)}${n?` (pid ${n.pid}, started ${n.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}function j(e,t){try{(t.recordActivity??yt)(e,t.now())}catch(n){let r=Mn(n);if(r!=="EPERM"&&r!=="EACCES"&&r!=="EROFS")throw n}}function Mn(e){return e.code}var Se={now:Date.now,monotonicNow:H,isProcessAlive:V,readProcessIdentity:Q,spawnServer(e,t,n,r,o){if(!In(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);En(process.execPath,[e,t,n,JSON.stringify(r)],{detached:!0,stdio:"ignore",windowsHide:!0,env:{...process.env,...o,CODEBASEIQ_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function St(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal codebaseiq watch pid ${e.pid}: its ownership record has no process identity.`);let n=t.readProcessIdentity(e.pid);if(!n)throw new Error(`Refusing to signal codebaseiq watch pid ${e.pid}: its process identity is unavailable.`);if(!J(e.processIdentity,n))throw new Error(`Refusing to signal codebaseiq watch pid ${e.pid}: its process identity does not match the ownership record.`)}function he(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}export{Xn as a,Zn as b,er as c,tr as d,nt as e,nr as f,rr as g,Kt as h,or as i,ir as j,sr as k,cr as l,kr as m,Mr as n,qn as o,Lr as p,Nr as q,_n as r,$r as s,jr as t,Fr as u};
22
+ //# sourceMappingURL=chunk-JG5OWAEB.js.map
@@ -1,3 +1,3 @@
1
- import{b as h}from"./chunk-P4NVCOM7.js";import{c as p}from"./chunk-6O3KXIDL.js";import{aa as m,ca as d,da as P,g as f}from"./chunk-UQYQBLJX.js";import{realpathSync as c}from"fs";import{basename as x,dirname as L,join as T,relative as I,sep as O}from"path";import{fileURLToPath as S,pathToFileURL as y}from"url";function F(n,e){return e==="."||e==="./"?y(c(n)).href:y(m(n,e).absolutePath).href}function b(n,e){let r=S(e);return I(c(n),v(r)).split(O).join("/")}function v(n){try{return c(n)}catch{try{return T(c(L(n)),x(n))}catch{return n}}}function H(n,e,r){return{textDocument:{uri:F(n,e.relativePath)},position:z(n,e),context:{includeDeclaration:r}}}function z(n,e){let r={line:e.startLine,character:e.startChar??0};try{return M(d(n,e.relativePath,{inputKind:"indexed Rust source file"}),e,r)}catch(t){if(!P(t))throw t;return r}}function M(n,e,r={line:e.startLine,character:e.startChar??0}){let t=n.split(/\r?\n/),o=t[e.startLine];if(o===void 0||e.leaf.length===0)return r;let i=Math.max(0,Math.min(r.character,o.length)),s=o.indexOf(e.leaf,i);if(s>=0)return{line:e.startLine,character:u(s,e.leaf)};let a=o.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:u(a,e.leaf)};let l=D(t,e.startLine,e.leaf);return l||r}function u(n,e){return n+Math.max(0,e.length-2)}function D(n,e,r){for(let t of[-1,1,-2,2]){let o=e+t;if(o<0||o>=n.length)continue;let i=n[o].indexOf(r);if(i>=0)return{line:o,character:u(i,r)}}return null}function K(n,e){return e.map(r=>({file:b(n,r.uri),line:r.range.start.line,column:r.range.start.character}))}function X(n){let e=new Map;for(let r of n)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,t)=>{let o=r.file.localeCompare(t.file);return o!==0?o:r.line!==t.line?r.line-t.line:r.column-t.column})}import{randomUUID as E}from"crypto";import{readdirSync as $,rmSync as j,writeFileSync as A}from"fs";import{join as g}from"path";var R="rust-analyzer-owner-",w=".json",U=16*1024;function Z(n,e){if(!n||!e.rootIdentity)return null;let r=g(n,`${R}${e.rootPid}-${E()}${w}`),t={version:1,rootIdentity:e.rootIdentity,ownsProcessGroup:e.ownsProcessGroup};return A(r,`${JSON.stringify(t)}
1
+ import{b as h}from"./chunk-33AXWMO2.js";import{c as p}from"./chunk-OZI44VCR.js";import{ea as m,g as f,ga as d,ha as P}from"./chunk-C3PPB2T5.js";import{realpathSync as c}from"fs";import{basename as x,dirname as L,join as T,relative as I,sep as O}from"path";import{fileURLToPath as S,pathToFileURL as y}from"url";function F(n,e){return e==="."||e==="./"?y(c(n)).href:y(m(n,e).absolutePath).href}function b(n,e){let r=S(e);return I(c(n),v(r)).split(O).join("/")}function v(n){try{return c(n)}catch{try{return T(c(L(n)),x(n))}catch{return n}}}function H(n,e,r){return{textDocument:{uri:F(n,e.relativePath)},position:z(n,e),context:{includeDeclaration:r}}}function z(n,e){let r={line:e.startLine,character:e.startChar??0};try{return M(d(n,e.relativePath,{inputKind:"indexed Rust source file"}),e,r)}catch(t){if(!P(t))throw t;return r}}function M(n,e,r={line:e.startLine,character:e.startChar??0}){let t=n.split(/\r?\n/),o=t[e.startLine];if(o===void 0||e.leaf.length===0)return r;let i=Math.max(0,Math.min(r.character,o.length)),s=o.indexOf(e.leaf,i);if(s>=0)return{line:e.startLine,character:u(s,e.leaf)};let a=o.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:u(a,e.leaf)};let l=D(t,e.startLine,e.leaf);return l||r}function u(n,e){return n+Math.max(0,e.length-2)}function D(n,e,r){for(let t of[-1,1,-2,2]){let o=e+t;if(o<0||o>=n.length)continue;let i=n[o].indexOf(r);if(i>=0)return{line:o,character:u(i,r)}}return null}function K(n,e){return e.map(r=>({file:b(n,r.uri),line:r.range.start.line,column:r.range.start.character}))}function X(n){let e=new Map;for(let r of n)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,t)=>{let o=r.file.localeCompare(t.file);return o!==0?o:r.line!==t.line?r.line-t.line:r.column-t.column})}import{randomUUID as E}from"crypto";import{readdirSync as $,rmSync as j,writeFileSync as A}from"fs";import{join as g}from"path";var R="rust-analyzer-owner-",w=".json",U=16*1024;function Z(n,e){if(!n||!e.rootIdentity)return null;let r=g(n,`${R}${e.rootPid}-${E()}${w}`),t={version:1,rootIdentity:e.rootIdentity,ownsProcessGroup:e.ownsProcessGroup};return A(r,`${JSON.stringify(t)}
2
2
  `,{encoding:"utf8",mode:384,flag:"wx"}),r}function ee(n){n&&j(n,{force:!0})}async function re(n,e){if(!n)return[];let r;try{r=$(n)}catch{return[]}let t=r.filter(s=>s.startsWith(R)&&s.endsWith(w)).map(s=>g(n,s)),o=[],i=[];for(let s of t){let a=C(s);a?i.push(a):o.push({reaped:!1,reason:"identity-unavailable",detail:`Rust analyzer ownership record ${s} could not be validated.`})}return o.push(...await Promise.all(i.map(s=>h(s,e)))),o}function C(n){try{let e=f(n,{maxBytes:U,inputKind:"rust-analyzer process ownership record"}),r=JSON.parse(e),t=p(r.rootIdentity);return r.version!==1||!t||typeof r.ownsProcessGroup!="boolean"?null:{rootPid:t.pid,rootIdentity:t,ownsProcessGroup:r.ownsProcessGroup,knownMembers:new Map([[t.pid,t]])}}catch{return null}}export{Z as a,ee as b,re as c,F as d,b as e,H as f,K as g,X as h};
3
- //# sourceMappingURL=chunk-2PRONPAS.js.map
3
+ //# sourceMappingURL=chunk-JGJKRTTB.js.map
@@ -1,2 +1,2 @@
1
- import{b as c,e as p,g as u,i as b}from"./chunk-SX72EVMY.js";import{h as x,v as m}from"./chunk-UC2FD2PS.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-TJWVT4DO.js.map
1
+ import{b as c,e as p,g as u,i as b}from"./chunk-YMAGXBLT.js";import{h as x,v as m}from"./chunk-6I55VYFG.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-JGXLB7PR.js.map
@@ -1,8 +1,8 @@
1
- import{e as C,f as G,m as z,n as U}from"./chunk-6JMAVFL4.js";import{D as h,E as _,F as j,H as F,o as $,q as M,s as R,t as P}from"./chunk-UC2FD2PS.js";import{execFileSync as ge}from"child_process";import{existsSync as fe,readdirSync as q}from"fs";import{extname as X,join as V}from"path";var Y=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 rt(e){let t=[],n=pe(e),r=xe(e);for(let s of me){if(ye(e,s.files)){t.push(s.language);continue}if(Re(n,s.globs)){t.push(s.language);continue}Be(r,s.extensions)&&t.push(s.language)}return t.includes("typescript")&&K(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&K(t,"c"),t}function pe(e){try{return q(e)}catch{return[]}}function ye(e,t){return t?.length?t.some(n=>fe(V(e,n))):!1}function Re(e,t){return t?.length?e.some(n=>t.some(r=>be(n,r))):!1}function be(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,r]=t.split("*");return e.startsWith(n??"")&&e.endsWith(r??"")}function xe(e){let t=ve(e);if(t)return t;let n=new Set,r=[e];for(;r.length>0;){let s=r.pop();if(!s)continue;let a;try{a=q(s,{withFileTypes:!0})}catch{continue}for(let i of a){if(i.name.startsWith(".")&&!i.name.endsWith("proj")&&!i.name.endsWith("sln")&&i.isDirectory())continue;let u=V(s,i.name);if(i.isDirectory()){Y.has(i.name)||r.push(u);continue}let d=X(i.name).toLowerCase();d&&n.add(d)}}return n}function ve(e){try{let t=ge("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 r of t.split(`
1
+ import{e as C,f as G,m as z,n as U}from"./chunk-75A23IID.js";import{D as h,E as _,F as j,H as F,o as $,q as M,s as R,t as P}from"./chunk-6I55VYFG.js";import{execFileSync as ge}from"child_process";import{existsSync as fe,readdirSync as q}from"fs";import{extname as X,join as V}from"path";var Y=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 rt(e){let t=[],n=pe(e),r=xe(e);for(let s of me){if(ye(e,s.files)){t.push(s.language);continue}if(Re(n,s.globs)){t.push(s.language);continue}Be(r,s.extensions)&&t.push(s.language)}return t.includes("typescript")&&K(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&K(t,"c"),t}function pe(e){try{return q(e)}catch{return[]}}function ye(e,t){return t?.length?t.some(n=>fe(V(e,n))):!1}function Re(e,t){return t?.length?e.some(n=>t.some(r=>be(n,r))):!1}function be(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,r]=t.split("*");return e.startsWith(n??"")&&e.endsWith(r??"")}function xe(e){let t=ve(e);if(t)return t;let n=new Set,r=[e];for(;r.length>0;){let s=r.pop();if(!s)continue;let a;try{a=q(s,{withFileTypes:!0})}catch{continue}for(let i of a){if(i.name.startsWith(".")&&!i.name.endsWith("proj")&&!i.name.endsWith("sln")&&i.isDirectory())continue;let u=V(s,i.name);if(i.isDirectory()){Y.has(i.name)||r.push(u);continue}let d=X(i.name).toLowerCase();d&&n.add(d)}}return n}function ve(e){try{let t=ge("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 r of t.split(`
2
2
  `)){if(!r||r.split("/").some(a=>Y.has(a)))continue;let s=X(r).toLowerCase();s&&n.add(s)}return n}catch{return null}}function Be(e,t){return t?.length?t.some(n=>e.has(n)):!1}function K(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as ne,statSync as De}from"fs";import{dirname as se,join as ae}from"path";import{appendFileSync as he,existsSync as Le,mkdirSync as Se,renameSync as Ae,rmSync as Te,statSync as ke,truncateSync as we}from"fs";import{basename as Oe,dirname as Me}from"path";var L=".previous",Pe=".rotation.lock",_e=2e3,E=class extends Error{constructor(n,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},N=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"},H=Object.freeze({monotonicNow:C,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=G(e,{kind:"rotating-jsonl",detail:{target:Oe(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){Se(e,{recursive:!0})},exists:Le,readBytes(e){return j(e,{maxBytes:h,inputKind:"rotating JSONL segment"})},size(e){return ke(e).size},truncate:we,remove(e){Te(e,{force:!0})},rename:Ae,append:he});function Q(e,t,n){let r=n.runtime??H,s=JSON.stringify(t);if(s===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let a=Buffer.from(`${s}
3
3
  `),i=Math.max(1,Math.floor(n.maxSegmentBytes),a.length);return ee(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(Me(e));let u=Ee(e,h,r);n.onPhase?.("tail-repaired");let d=`${e}${n.previousSuffix??L}`,o=!1,g=!1;return r.exists(e)&&r.size(e)+a.length>i&&(r.exists(d)&&(r.remove(d),g=!0),n.onPhase?.("previous-pruned"),r.rename(e,d),o=!0,n.onPhase?.("current-rotated")),r.append(e,a),n.onPhase?.("record-appended"),{lineBytes:a.length,segmentLimitBytes:i,repairedTailBytes:u,rotated:o,prunedPrevious:g}})}function Z(e,t={}){let n=t.runtime??H,r=Ne(t.maxSegmentBytes);return ee(e,t.lockTimeoutMs,n,()=>{let s=[],a=0,i=`${e}${t.previousSuffix??L}`;for(let u of[i,e]){if(!n.exists(u))continue;let d=Ie(te(u,r,n));s.push(...d.lines),a+=d.partialTailBytes}return{lines:s,ignoredPartialTailBytes:a}})}function ee(e,t,n,r){let s=`${e}${Pe}`,a=Math.max(0,t??_e),i=n.monotonicNow()+a,u;for(;;){let m=n.tryAcquireLock(s,e);if(m.kind==="acquired"){u=m.lock;break}let p=i-n.monotonicNow();if(p<=0)throw new E(s,a);n.wait(Math.min(5,p))}let d=!1,o,g;try{g=r()}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 N(s);return g}function Ee(e,t,n){if(!n.exists(e))return 0;let r=te(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let s=r.lastIndexOf(10),a=s<0?0:s+1;return n.truncate(e,a),r.length-a}function Ne(e){let t=e??h;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function te(e,t,n){let r=n.size(e);if(r>t)throw new _("rotating JSONL segment",e,"too-large",r,t);let s=n.readBytes(e),a=n.size(e);if(a!==r||s.byteLength!==r)throw new _("rotating JSONL segment",e,"changed-during-read",a,t);return s}function Ie(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
4
4
  `).filter(s=>s.length>0),partialTailBytes:e.length-n}}var Je="reindex-activity.jsonl",S=L,We=1024*1024,$e=1440*60*1e3,ie=e=>F(e,"reindex activity segment");function D(e){return ae(se(e),Je)}function je(e){if(e.reused)return 0;let t=I(e.indexPath)+I(e.dbPath);for(let n of e.shards??[])!n.reused&&n.outputBytes!==null&&(t+=n.outputBytes);return t}function bt(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=je(t);return oe(D(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:r+(t.writeTelemetry?.fallbackCopiedBytes??0),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,byLanguage:Ke(t)})}function xt(e,t){return oe(D(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function Fe(e,t,n=We,r){Q(e,t,{maxSegmentBytes:n,previousSuffix:S,...r?{runtime:r}:{}})}function Ce(e,t=new Date,n=$e,r=ie){let s=t.getTime(),a=s-n,i={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=D(e),d=[];if(r===ie){if(!ne(u)&&!ne(`${u}${S}`))return i;try{let o=Z(u,{previousSuffix:S});d=o.lines,i.ignoredPartialTailBytes=o.ignoredPartialTailBytes}catch{i.readErrors+=1,i.confidence="unavailable"}}else{let o=0;for(let g of[`${u}${S}`,u])try{d.push(...Ze(r(g))),o+=1}catch{i.readErrors+=1}o===0?i.confidence="unavailable":i.readErrors>0&&(i.confidence="partial")}for(let o of d){i.recordsRead+=1;let g=Ge(o);if(!g){i.invalidRecords+=1,i.confidence!=="unavailable"&&(i.confidence="partial");continue}let{record:l}=g,m=Date.parse(l.recordedAt);if(m<a||m>s){i.skippedRecords+=1;continue}if(i.invalidLanguageDetails=(i.invalidLanguageDetails??0)+g.invalidLanguageDetails,i.byTrigger[l.trigger.kind]=(i.byTrigger[l.trigger.kind]??0)+1,l.event==="suppressed"){i.suppressed+=1;continue}i.runs+=1,i[l.result]+=1,i.estimatedLogicalOutputBytes+=l.estimatedLogicalOutputBytes,i.estimatedWriteBytes=(i.estimatedWriteBytes??0)+(l.estimatedWriteBytes??l.estimatedLogicalOutputBytes),i.reflinkedBytes=(i.reflinkedBytes??0)+(l.reflinkedBytes??0),i.fallbackCopiedBytes=(i.fallbackCopiedBytes??0)+(l.fallbackCopiedBytes??0),l.result!=="failed"&&(g.hasLanguageDetails?i.attributedRuns=(i.attributedRuns??0)+1:i.unattributedRuns=(i.unattributedRuns??0)+1);for(let[p,y]of Ye(l.byLanguage)){let b=(i.byLanguage??={})[p]??=He();b.runs+=1,b[y.result]+=1,b.producedOutputBytes+=y.producedOutputBytes,b.durationMs+=y.durationMs}l.result==="rebuilt"&&i.oldestRebuildAt===void 0&&(i.oldestRebuildAt=l.recordedAt),(l.estimatedWriteBytes??l.estimatedLogicalOutputBytes)>0&&i.oldestWriteAt===void 0&&(i.oldestWriteAt=l.recordedAt)}return i.ignoredPartialTailBytes>0&&i.confidence!=="unavailable"&&(i.confidence="partial"),i.languageAttribution=Qe(i),i}function oe(e,t){try{return Fe(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function Ge(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!$(n.recordedAt)||!n.trigger||!Ue(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"||!R(n.durationMs)||!R(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!R(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!R(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!R(n.fallbackCopiedBytes))return null;let r=n,{byLanguage:s,...a}=r,i=qe(s);return{record:{...a,...i.byLanguage?{byLanguage:i.byLanguage}:{}},hasLanguageDetails:i.hasLanguageDetails,invalidLanguageDetails:i.invalidLanguageDetails}}catch{return null}}function vt(e,t,n=new Date){return t.enabled?ze(Ce(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function ze(e,t,n){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,s={rebuilt:e.rebuilt,estimatedWriteBytes:r};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`}:r>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:re(e.oldestWriteAt,t.windowMs,n),...s,detail:`${r}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...s}:{state:"allowed",...s}}function re(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function Ue(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 I(e){try{return De(e).size}catch{return 0}}function Ke(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(o=>o.language===n),s=r.find(o=>o.id===n),a=e.reused||(s?s.reused:r.length>0&&r.every(o=>o.reused)),i=I(ae(se(e.dbPath),"language-indexes",`${n}.scip`)),u=i>0?i:s?.outputBytes??i,d=a?0:s?.durationMs??r.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 qe(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(!Ve(s)||!Xe(a)){n+=1;continue}t[s]=a}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function Xe(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&M(t.outputBytes)&&M(t.producedOutputBytes)&&R(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function Ve(e){return P.includes(e)}function Ye(e){return e?P.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function He(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function Qe(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function Ze(e){return e.endsWith(`
5
5
  `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
6
6
  `)+1))),e.split(`
7
- `).filter(t=>t.length>0)}import{spawn as et}from"child_process";import{platform as ue}from"os";import{performance as de}from"perf_hooks";var Tt={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},B=class extends Error{constructor(n,r,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=r;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 v(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function le(e,t,n,r){let s=Math.max(0,r-n);s>0&&e.push(t.subarray(0,s))}function ce(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function kt(e){v(e.timeoutMs,"timeoutMs"),v(e.maxStdoutBytes,"maxStdoutBytes"),v(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;v(t,"terminationGraceMs");let n=e.terminationForceMs??t;return v(n,"terminationForceMs"),new Promise((r,s)=>{let a=de.now(),i;try{let c=ue()!=="win32";i=et(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 B("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,b=ue()!=="win32",J=i.pid===void 0?null:z(i.pid,b),A=()=>{clearTimeout(W),e.signal?.removeEventListener("abort",k)},T=c=>{if(y||!p)return;y=!0,A();let f=Buffer.concat(u).toString("utf8"),w=Buffer.concat(d).toString("utf8"),O=c.reaped||!c.detail?"":` Process-tree cleanup failed: ${c.detail}`;s(new B(p.kind,e.label,`${p.message}${O}`,{timedOut:p.timedOut,reaped:c.reaped,stdout:f,stderr:w,stdoutTruncated:l,stderrTruncated:m}))},x=c=>{if(!(p||y)){if(p=c,!J){T({reaped:i.pid===void 0,reason:i.pid===void 0?"terminated":"identity-unavailable"});return}U(J,{gracefulMs:t,forceMs:n}).then(T,f=>{T({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},W=setTimeout(()=>{x({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);W.unref();let k=()=>{x({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",k,{once:!0}),e.signal?.aborted&&k(),i.stdout.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ce(u,f,e.maxStdoutBytes):le(u,f,o,e.maxStdoutBytes),o+=f.length,o>e.maxStdoutBytes&&(l=!0,e.outputLimitBehavior!=="truncate-tail"&&x({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),i.stderr.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ce(d,f,e.maxStderrBytes):le(d,f,g,e.maxStderrBytes),g+=f.length,g>e.maxStderrBytes&&(m=!0,e.outputLimitBehavior!=="truncate-tail"&&x({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),i.on("error",c=>{if(!y&&!p){if(i.pid===void 0){A(),y=!0,s(new B("spawn",e.label,`${e.label} could not start: ${c.message}`,{cause:c,reaped:!0}));return}x({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${c.message}`})}}),i.on("close",(c,f)=>{if(y||p)return;y=!0,A();let w=Buffer.concat(u).toString("utf8"),O=Buffer.concat(d).toString("utf8");r({status:c,signal:f,stdout:w,stderr:O,timedOut:!1,durationMs:de.now()-a,stdoutTruncated:l,stderrTruncated:m})}),e.input===void 0?i.stdin.end():i.stdin.end(e.input)})}export{L as a,Q as b,rt as c,Je as d,bt as e,xt as f,vt as g,Tt as h,B as i,kt as j};
8
- //# sourceMappingURL=chunk-K7JLSGCJ.js.map
7
+ `).filter(t=>t.length>0)}import{spawn as et}from"child_process";import{platform as ue}from"os";import{performance as de}from"perf_hooks";var Tt={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:18e5},B=class extends Error{constructor(n,r,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=r;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 v(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function le(e,t,n,r){let s=Math.max(0,r-n);s>0&&e.push(t.subarray(0,s))}function ce(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function kt(e){v(e.timeoutMs,"timeoutMs"),v(e.maxStdoutBytes,"maxStdoutBytes"),v(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;v(t,"terminationGraceMs");let n=e.terminationForceMs??t;return v(n,"terminationForceMs"),new Promise((r,s)=>{let a=de.now(),i;try{let c=ue()!=="win32";i=et(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 B("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,b=ue()!=="win32",J=i.pid===void 0?null:z(i.pid,b),A=()=>{clearTimeout(W),e.signal?.removeEventListener("abort",k)},T=c=>{if(y||!p)return;y=!0,A();let f=Buffer.concat(u).toString("utf8"),w=Buffer.concat(d).toString("utf8"),O=c.reaped||!c.detail?"":` Process-tree cleanup failed: ${c.detail}`;s(new B(p.kind,e.label,`${p.message}${O}`,{timedOut:p.timedOut,reaped:c.reaped,stdout:f,stderr:w,stdoutTruncated:l,stderrTruncated:m}))},x=c=>{if(!(p||y)){if(p=c,!J){T({reaped:i.pid===void 0,reason:i.pid===void 0?"terminated":"identity-unavailable"});return}U(J,{gracefulMs:t,forceMs:n}).then(T,f=>{T({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},W=setTimeout(()=>{x({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);W.unref();let k=()=>{x({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",k,{once:!0}),e.signal?.aborted&&k(),i.stdout.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ce(u,f,e.maxStdoutBytes):le(u,f,o,e.maxStdoutBytes),o+=f.length,o>e.maxStdoutBytes&&(l=!0,e.outputLimitBehavior!=="truncate-tail"&&x({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),i.stderr.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ce(d,f,e.maxStderrBytes):le(d,f,g,e.maxStderrBytes),g+=f.length,g>e.maxStderrBytes&&(m=!0,e.outputLimitBehavior!=="truncate-tail"&&x({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),i.on("error",c=>{if(!y&&!p){if(i.pid===void 0){A(),y=!0,s(new B("spawn",e.label,`${e.label} could not start: ${c.message}`,{cause:c,reaped:!0}));return}x({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${c.message}`})}}),i.on("close",(c,f)=>{if(y||p)return;y=!0,A();let w=Buffer.concat(u).toString("utf8"),O=Buffer.concat(d).toString("utf8");r({status:c,signal:f,stdout:w,stderr:O,timedOut:!1,durationMs:de.now()-a,stdoutTruncated:l,stderrTruncated:m})}),e.input===void 0?i.stdin.end():i.stdin.end(e.input)})}export{L as a,Q as b,rt as c,Je as d,bt as e,xt as f,vt as g,Tt as h,B as i,kt as j};
8
+ //# sourceMappingURL=chunk-JKUF2UG6.js.map
@@ -1,3 +1,3 @@
1
- import{H as P,I as ye,a as ae,b as le,d as _,r as U,s as H,t as pe,v as de,w as B,z as me}from"./chunk-C6WKPKCF.js";import{d as E,e as ue}from"./chunk-DRENNWRG.js";import{q as fe}from"./chunk-5FWR5HLG.js";import{a as ce,e as O}from"./chunk-YT4DVWUV.js";import{a as A,i as x}from"./chunk-R2NOK63J.js";import{aa as se,da as K,h as re}from"./chunk-UQYQBLJX.js";import{existsSync as j}from"fs";import b from"path";var z=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function V(r,t){let e=t?b.dirname(b.join(r,t)):r,o=b.resolve(r);for(;e.startsWith(o);){for(let s of z){let c=b.join(e,s);if(j(c))return c}let i=b.dirname(e);if(i===e)break;e=i}for(let i of z){let s=b.join(r,i);if(j(s))return s}return null}function ge(r){let t=r.config.projectRoot,n=new Set(Ee(t,r.config.semantic?.typescript?.tsconfigs)),e=O(r,{includeIgnored:!1,extensions:U});for(let o of e){let i=V(t,o);i&&n.add(b.resolve(i))}if(n.size===0){let o=V(t);o&&n.add(b.resolve(o))}return[...n].filter(o=>!he(t,o)).sort((o,i)=>o.localeCompare(i))}function Ee(r,t=[]){let n=new Set;for(let e of t){let o=b.isAbsolute(e)?e:b.join(r,e);j(o)&&n.add(b.resolve(o))}for(let e of je(r))for(let o of z){let i=b.join(e,o);j(i)&&n.add(b.resolve(i))}if(n.size===0){let e=V(r);e&&n.add(b.resolve(e))}return[...n].filter(e=>!he(r,e)).sort((e,o)=>e.localeCompare(o))}function je(r){let t=b.join(r,"package.json");if(!j(t))return[];let n;try{n=JSON.parse(re(t,"project package manifest"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(o=>le(r,o))}function he(r,t){let n=b.relative(r,t).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}import{performance as u}from"perf_hooks";function k(r,t,n){if(r.has(t))return r.get(t);let e=n();return r.set(t,e),e}import Ie from"path";import{realpathSync as Se}from"fs";function Ae(r,t){return r.getReferences().map(n=>{let e=n.getNode();return $(e,t)})}function Oe(r){let t=r;return typeof t.findReferences=="function"?t.findReferences():[]}function Me(r,t,n,e){let o=[];for(let i of Oe(r))for(let s of Ae(i,e))s.file===t.relativePath&&s.line>=t.startLine&&s.line<=t.endLine||o.push(s);for(let i of n)o.push(i);return L(o)}function Fe(r,t,n,e){let o=[],i=n?.getStart();for(let s of r.getReferences()){let c=s.getNode();w(e,c.getSourceFile().getFilePath())===t&&(i!==void 0&&c.getStart()===i||o.push({location:$(c,e),node:c}))}return o}function $(r,t){let n=r.getSourceFile(),e=n.getLineAndColumnAtPos(r.getStart());return{file:w(t,n.getFilePath())??n.getBaseName(),line:e.line-1,column:e.column-1}}function q(r,t,n){let e=r.getSourceFile(),o=G(e,r),i=r.getText(),s=new RegExp(`\\b${fe(i)}\\b`,"g"),c=e.getFullText().split(`
1
+ import{H as P,I as ye,a as ae,b as le,d as _,r as U,s as H,t as pe,v as de,w as B,z as me}from"./chunk-G3KRXNNT.js";import{d as E,e as ue}from"./chunk-DRENNWRG.js";import{q as fe}from"./chunk-XDQ6QJF5.js";import{a as ce,e as O}from"./chunk-UUMAM5LM.js";import{a as A,i as x}from"./chunk-R2NOK63J.js";import{ea as se,h as re,ha as K}from"./chunk-C3PPB2T5.js";import{existsSync as j}from"fs";import b from"path";var z=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function V(r,t){let e=t?b.dirname(b.join(r,t)):r,o=b.resolve(r);for(;e.startsWith(o);){for(let s of z){let c=b.join(e,s);if(j(c))return c}let i=b.dirname(e);if(i===e)break;e=i}for(let i of z){let s=b.join(r,i);if(j(s))return s}return null}function ge(r){let t=r.config.projectRoot,n=new Set(Ee(t,r.config.semantic?.typescript?.tsconfigs)),e=O(r,{includeIgnored:!1,extensions:U});for(let o of e){let i=V(t,o);i&&n.add(b.resolve(i))}if(n.size===0){let o=V(t);o&&n.add(b.resolve(o))}return[...n].filter(o=>!he(t,o)).sort((o,i)=>o.localeCompare(i))}function Ee(r,t=[]){let n=new Set;for(let e of t){let o=b.isAbsolute(e)?e:b.join(r,e);j(o)&&n.add(b.resolve(o))}for(let e of je(r))for(let o of z){let i=b.join(e,o);j(i)&&n.add(b.resolve(i))}if(n.size===0){let e=V(r);e&&n.add(b.resolve(e))}return[...n].filter(e=>!he(r,e)).sort((e,o)=>e.localeCompare(o))}function je(r){let t=b.join(r,"package.json");if(!j(t))return[];let n;try{n=JSON.parse(re(t,"project package manifest"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(o=>le(r,o))}function he(r,t){let n=b.relative(r,t).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}import{performance as u}from"perf_hooks";function k(r,t,n){if(r.has(t))return r.get(t);let e=n();return r.set(t,e),e}import Ie from"path";import{realpathSync as Se}from"fs";function Ae(r,t){return r.getReferences().map(n=>{let e=n.getNode();return $(e,t)})}function Oe(r){let t=r;return typeof t.findReferences=="function"?t.findReferences():[]}function Me(r,t,n,e){let o=[];for(let i of Oe(r))for(let s of Ae(i,e))s.file===t.relativePath&&s.line>=t.startLine&&s.line<=t.endLine||o.push(s);for(let i of n)o.push(i);return L(o)}function Fe(r,t,n,e){let o=[],i=n?.getStart();for(let s of r.getReferences()){let c=s.getNode();w(e,c.getSourceFile().getFilePath())===t&&(i!==void 0&&c.getStart()===i||o.push({location:$(c,e),node:c}))}return o}function $(r,t){let n=r.getSourceFile(),e=n.getLineAndColumnAtPos(r.getStart());return{file:w(t,n.getFilePath())??n.getBaseName(),line:e.line-1,column:e.column-1}}function q(r,t,n){let e=r.getSourceFile(),o=G(e,r),i=r.getText(),s=new RegExp(`\\b${fe(i)}\\b`,"g"),c=e.getFullText().split(`
2
2
  `),a=[];for(let l=0;l<c.length;l++){if(l===o)continue;let f=c[l]??"";s.lastIndex=0;let p;for(;(p=s.exec(f))!==null;)a.push({file:t,line:l,column:p.index})}return L(a.filter(l=>w(n,Ie.join(n,l.file))===t))}function Y(r){for(let t=r;t;t=t.getParent()){let n=t.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function G(r,t){return r.getLineAndColumnAtPos(t.getStart()).line-1}function L(r){let t=new Set,n=[];for(let e of r){let o=`${e.file}:${e.line}:${e.column}`;t.has(o)||(t.add(o),n.push(e))}return n}function w(r,t){let n=r||process.cwd(),e=be(n,t);if(e)return e;try{return be(Se(n),Se(t))}catch{return null}}function be(r,t){let n=Ie.relative(r,t).replace(/\\/g,"/");return!n||n===".."||n.startsWith("../")?null:n}function xe(r,t,n,e){let o=Ue(t,e);return o.size===0?new Map:He(r,n,o)}function Ue(r,t){let n=new Map;for(let e of P(r,t)){let o=E(e.symbol)??e.leaf;if(!o)continue;let i=n.get(o);i||(i=[],n.set(o,i)),i.push(e)}return n}function He(r,t,n){let e=new Map,o=new Map;return t.forEachDescendant(i=>{for(let s of Be(r,i)){let c=n.get(s);if(!c)continue;let a=G(t,i);for(let l of c){if(a<l.startLine-1||a>l.endLine+1)continue;let f=Math.abs(a-l.startLine),p=o.get(l.symbolId);p!==void 0&&p<=f||(o.set(l.symbolId,f),e.set(l.symbolId,i))}}}),e}function Be(r,t){let n=[],e=o=>{o&&!n.includes(o)&&n.push(o)};if("getNameNode"in t&&typeof t.getNameNode=="function"){let o=t.getNameNode();e(o?.getText())}if("getName"in t&&typeof t.getName=="function"){let o=t.getName();e(o)}return r.Node.isIdentifier(t)&&e(t.getText()),n}var $e=ce("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function ke(r,t,n,e){let o=Q(r,t),i=J(o.get(e)??[],n);if(i)return i;let s=[];for(let c of o.values())for(let a of c)((a.leaf||E(a.symbol)||"").includes(e)||a.symbol.includes(e))&&s.push(a);return J(s,n)}function X(r,t,n,e){return J(Q(r,t).get(e)??[],n)}function Te(r,t){let n=new Map;for(let[e,o]of Q(r,t)){let i=o[0];i&&n.set(e,i)}return n}function Q(r,t){return $e.get(r,t,()=>{let n=new Map;for(let e of P(r,t)){let o=e.leaf||E(e.symbol);if(!o)continue;let i=n.get(o);i||(i=[],n.set(o,i)),i.push({...e,leaf:o})}for(let e of n.values())e.sort((o,i)=>o.startLine-i.startLine||o.endLine-i.endLine||o.symbolId-i.symbolId);return n})}function J(r,t){let n=null,e=Number.POSITIVE_INFINITY;for(let o of r){let i=Math.abs(o.startLine-t);(i<e||i===e&&n&&o.startLine<n.startLine)&&(n=o,e=i)}return n}import We from"path";import{realpathSync as Ke}from"fs";function De(r,t){let n=new Map,e=null,o=null,i=()=>(o??=O(r,{extensions:U}),o),s=()=>(e??=x("typescript.source-file-index",()=>_e(r.config.projectRoot,t,i()),()=>({projects:t.length,indexedDocuments:i().length})),e),c=a=>H(a)?k(n,a,()=>{let l=Ce(r.config.projectRoot,a);if(!l)return null;for(let{project:f,sourceFiles:p}of s()){let d=p.get(l)??null;if(d||(d=f.addSourceFileAtPathIfExists(l)??null,d&&Z(p,d)),d)return{project:f,sourceFile:d}}return null}):null;return{sourceFile:a=>c(a)?.sourceFile??null,sourceFileMatch:c,indexedTypeScriptLikeDocuments:i}}function _e(r,t,n){let e=t.map(({project:o})=>{let i=new Map;for(let s of o.getSourceFiles())Z(i,s);return{project:o,sourceFiles:i}});for(let o of n){let i=Ce(r,o);if(i)for(let s of e){if(s.sourceFiles.has(i))break;let c=s.project.addSourceFileAtPathIfExists(i)??null;if(c){Z(s.sourceFiles,c);break}}}return e}function Z(r,t){let n=ee(t.getFilePath());r.set(n,t);try{r.set(ee(Ke(n)),t)}catch(e){if(!K(e))throw e}}function Ce(r,t){try{return ee(se(r,t,{inputKind:"indexed TypeScript source file"}).absolutePath)}catch(n){if(!K(n))throw n;return null}}function ee(r){return We.resolve(r)}function te(r,t){for(let n of r)if(t===n.name||t.startsWith(`${n.name}/`))return n.name;return null}function Ne(r){let t=`${r.relativeDir}/src`;return[`${t}/index.ts`,`${t}/index.tsx`,`${t}/index.mts`,`${t}/index.cts`]}function ne(r,t){try{return r()}catch{t?.();return}}var ze=32;function Yt(r,t){let n=x("typescript.provider.load",()=>pe());if(!n)return B("ts-morph is not installed");let e=x("typescript.provider.tsconfig-discovery",()=>ge(r));if(e.length===0)return B("no tsconfig found");try{let o=x("typescript.provider.project-bundles",()=>de(n,e),()=>({tsconfigs:e.length}));return Ve(r,n,o)}catch(o){return B(o instanceof Error?o.message:String(o),e[0],e)}}function Ve(r,t,n,e={}){return x("typescript.provider.construct",()=>new oe(r,t,n),()=>({tsconfigs:n.length,reusedProjects:e.reusedProjects===!0}))}var oe=class{constructor(t,n,e){this.db=t;this.tsMorph=n;this.projects=e;this.workspacePackages=ae(t.config.projectRoot),this.sourceFiles=De(t,e)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(t=>t.tsconfigPath)}}importUsage(t){return k(this.importUsageCache,t,()=>{let n=this.sourceFiles.sourceFile(t);if(!n)return[];let e=Ye();return x("typescript.import-usage.file",()=>this.importUsageForSourceFile(t,n,e),()=>({file:t,...e}))})}referencesFor(t){return k(this.referencesCache,t.symbolId,()=>{let n=this.nodeForDefinition(t);return this.referencesForDefinitionNode(t,n)})}referencesForDefinitions(t,n={}){let e=new Map,o=A(),i=[];for(let f of t){let p=this.referencesCache.get(f.symbolId);p?e.set(f.symbolId,p):i.push(f)}if(i.length===0)return e;let s=i,c=n.exact?[]:i.filter(f=>!ve(f));if(c.length>=ze){let f=this.referencesForDefinitionsBySymbolScan(c);if(f.incompleteFiles.size===0)for(let p of c){let d=f.references.get(p.symbolId)??[];this.referencesCache.set(p.symbolId,d),e.set(p.symbolId,d)}if(s=i.filter(p=>ve(p)),s.length===0)return e}let a=new Map;for(let f of s){let p=a.get(f.relativePath);p?p.push(f):a.set(f.relativePath,[f])}let l=[];for(let[f,p]of a){let d=Pe();x("typescript.references-map.file",()=>{let h=this.definitionNodesForFile(f);for(let m of p){o&&(d.cacheMisses+=1);let I=h.get(m.symbolId)??null;o&&(I?d.nodeHits+=1:d.nodeMisses+=1);try{let g=this.referencesForDefinitionNode(m,I,o?d:void 0);this.referencesCache.set(m.symbolId,g),e.set(m.symbolId,g)}catch{d.preciseSearchFailures+=1,l.push(m)}}},()=>({relativePath:f,definitions:p.length,...Le(d)}))}if(l.length>0){let f=this.referencesForDefinitionsBySymbolScan(l);if(f.incompleteFiles.size===0)for(let p of l){let d=f.references.get(p.symbolId)??[];this.referencesCache.set(p.symbolId,d),e.set(p.symbolId,d)}}return e}referenceFragmentsForFiles(t){let n=ye(this.db).filter(s=>H(s.relativePath)),e=t.filter(s=>this.sourceFiles.sourceFile(s)!==null),o=this.referencesForDefinitionsBySymbolScan(n,e),i=e.filter(s=>!o.incompleteFiles.has(s));return me(n,o.references,i)}referencesForDefinitionsBySymbolScan(t,n){let e=A(),o=Pe(),i=new Map,s=new Set,c=new Set(t.map(l=>l.symbolId)),a=new Map(t.map(l=>[l.symbolId,l]));for(let l of t)i.set(l.symbolId,[]);return x("typescript.references-map.inverted-scan",()=>{let l=e?u.now():0,f=n?this.packageImportReferencesForFiles(n):this.packageImportReferences();for(let y of t){let S=f.get(y.symbolId)??[];if(S.length>0){let T=i.get(y.symbolId)??[];T.push(...S),i.set(y.symbolId,T)}e&&(o.packageReferenceCount+=S.length)}e&&(o.packageRefsMs+=u.now()-l);let p=new Map,d=new Map,h=this.hierarchyTargetsForDefinitions(t),m=new Set(t.map(y=>y.leaf).filter(Boolean)),I=e?u.now():0;for(let y of n??this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(y))continue;let S=this.sourceFiles.sourceFile(y);if(!S)continue;e&&(o.scanFiles+=1),this.addReferencesFromSourceFileScan(S,y,c,a,h,m,p,d,i,e?o:void 0)||s.add(y)}e&&(o.scanMs+=u.now()-I);let g=e?u.now():0;this.addHierarchyMemberReferences(t,i,e?o:void 0),e&&(o.hierarchyMs+=u.now()-g);for(let[y,S]of i){let T=L(S);i.set(y,T),e&&(o.referenceCount+=T.length)}},()=>({definitions:t.length,...Le(o)})),{references:i,incompleteFiles:s}}addReferencesFromSourceFileScan(t,n,e,o,i,s,c,a,l,f){let p=this.compilerCheckerForSourceFile(t),d=t.compilerNode,h=Xe(t),m=!0,I=g=>{if(this.tsMorph.ts.isIdentifier(g)){if(f&&(f.identifiers+=1),!s.has(g.text)&&!h.has(g.text)){this.tsMorph.ts.forEachChild(g,I);return}let y=this.compilerReferenceSymbol(p,g,f,()=>{m=!1});if(y){let S;c.has(y)?S=c.get(y)??null:(S=this.referenceDefinitionFromCompilerSymbol(y),c.set(y,S)),f&&(S?f.targetHits+=1:f.targetMisses+=1);let T=k(a,y,()=>this.compilerSymbolKeys(y)),R=null,D=null,v=S&&e.has(S.symbolId)?o.get(S.symbolId):void 0;if(v&&(R=W(d,g),!Re(v,n,R))){let N=d.getLineAndCharacterOfPosition(g.getStart(d));D={file:n,line:N.line,column:N.character};let C=l.get(v.symbolId)??[];C.push(D),l.set(v.symbolId,C),f&&(f.requestedHits+=1)}for(let N of T)for(let C of i.get(N)?.values()??[]){if(R??=W(d,g),Re(C,n,R))continue;if(!D){let F=d.getLineAndCharacterOfPosition(g.getStart(d));D={file:n,line:F.line,column:F.character}}let M=l.get(C.symbolId)??[];M.push(D),l.set(C.symbolId,M),f&&(f.requestedHits+=1)}}}this.tsMorph.ts.forEachChild(g,I)};return I(d),m}hierarchyTargetsForDefinitions(t){let n=new Map;for(let e of t){let o=this.nodeForDefinition(e),i=o?.compilerNode;if(!i||!this.isHierarchyMethod(i))continue;let s=i.parent;if(!this.isHierarchyContainer(s))continue;let c=this.compilerCheckerForSourceFile(o.getSourceFile()),a=c.getSymbolAtLocation(i.name);if(a)for(let l of this.hierarchyMemberSymbols(c,s,a))for(let f of this.compilerSymbolKeys(l)){let p=n.get(f)??new Map;p.set(e.symbolId,e),n.set(f,p)}}return n}hierarchyMemberSymbols(t,n,e){let o=new Set,i=new Set,s=(c,a,l)=>{if(!i.has(c)){i.add(c),o.add(a);for(let f of l){let p=f.getProperty(e.name);p&&s(f,p,this.hierarchyAncestorTypesForType(t,f))}}};return s(t.getTypeAtLocation(n),e,this.hierarchyAncestorTypes(t,n)),o}addHierarchyMemberReferences(t,n,e){let o=new Map;for(let i of t){let s=this.nodeForDefinition(i),c=s?.compilerNode;if(!c||!this.isHierarchyMethod(c))continue;let a=c.parent;if(!this.isHierarchyContainer(a))continue;let l=this.compilerCheckerForSourceFile(s.getSourceFile()),f=l.getSymbolAtLocation(c.name);if(!f)continue;let p=c.getSourceFile(),d=p.getLineAndCharacterOfPosition(c.name.getStart(p)),h={definition:i,location:{file:i.relativePath,line:d.line,column:d.character}},m=n.get(i.symbolId)??[];for(let g of this.hierarchyMemberSymbols(l,a,f))if(g!==f)for(let y of this.compilerSymbolLocations(g))m.push(y),e&&(e.hierarchyReferences+=1);n.set(i.symbolId,m);let I=this.hierarchyRootMemberSymbols(l,a,f);for(let g of I){let y=o.get(g)??new Map;y.set(i.symbolId,h),o.set(g,y)}e&&(e.hierarchyDefinitions+=1)}for(let i of o.values())if(!(i.size<2)){e&&(e.hierarchyFamilies+=1);for(let{definition:s}of i.values()){let c=n.get(s.symbolId)??[];for(let a of i.values())a.definition.symbolId!==s.symbolId&&(c.push(a.location),e&&(e.hierarchyReferences+=1));n.set(s.symbolId,c)}}}hierarchyRootMemberSymbols(t,n,e){let o=new Set,i=new Set,s=(c,a,l)=>{if(i.has(c))return;i.add(c);let f=!1;for(let p of l){let d=p.getProperty(e.name);d&&(f=!0,s(p,d,this.hierarchyAncestorTypesForType(t,p)))}if(!f)for(let p of this.compilerSymbolKeys(a))o.add(p)};return s(t.getTypeAtLocation(n),e,this.hierarchyAncestorTypes(t,n)),o}compilerSymbolKeys(t){return(t.declarations??[]).map(n=>{let e=n.getSourceFile();return`${e.fileName}\0${n.getStart(e)}\0${t.name}`})}compilerSymbolLocations(t){let n=[];for(let e of t.declarations??[]){let o=e.getSourceFile(),i=w(this.db.config.projectRoot,o.fileName);if(!i)continue;let s=e.name,c=o.getLineAndCharacterOfPosition((s??e).getStart(o));n.push({file:i,line:c.line,column:c.character})}return n}baseTypes(t,n){try{return t.getBaseTypes(n)??[]}catch{return[]}}hierarchyAncestorTypes(t,n){let e=new Set(this.hierarchyAncestorTypesForType(t,t.getTypeAtLocation(n)));for(let o of n.heritageClauses??[])for(let i of o.types)e.add(t.getTypeAtLocation(i));return[...e]}hierarchyAncestorTypesForType(t,n){let e=new Set(this.baseTypes(t,n));for(let o of n.getSymbol()?.declarations??[])if(this.isHierarchyContainer(o))for(let i of o.heritageClauses??[])for(let s of i.types)e.add(t.getTypeAtLocation(s));return[...e]}isHierarchyMethod(t){return this.tsMorph.ts.isMethodDeclaration(t)||this.tsMorph.ts.isMethodSignature(t)}isHierarchyContainer(t){return this.tsMorph.ts.isClassDeclaration(t)||this.tsMorph.ts.isClassExpression(t)||this.tsMorph.ts.isInterfaceDeclaration(t)}compilerReferenceSymbol(t,n,e,o){e&&(e.symbolLookups+=1);let i=ne(()=>t.getSymbolAtLocation(n),o);if(i){if((i.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return i;try{return e&&(e.aliasResolutions+=1),t.getAliasedSymbol(i)}catch{return o?.(),i}}}calleesFor(t){if(this.calleesCache.has(t.symbolId))return this.calleesCache.get(t.symbolId)??[];let n=k(this.fileCalleesCache,t.relativePath,()=>this.calleeMapForFile(t.relativePath));if(n.incompleteSymbolIds.has(t.symbolId))throw new Error(`TypeScript callee evidence is incomplete for ${t.symbol}.`);let e=n.callees.get(t.symbolId)??[];return this.calleesCache.set(t.symbolId,e),e}calleesForDefinitions(t){let n=new Map,e=new Map;for(let o of t){if(this.calleesCache.has(o.symbolId)){n.set(o.symbolId,this.calleesCache.get(o.symbolId)??[]);continue}let i=e.get(o.relativePath);i?i.push(o):e.set(o.relativePath,[o])}for(let[o,i]of e){let s=this.fileCalleesCache.get(o),c=new Set(i.map(l=>l.symbolId)),a=s??this.calleeMapForFile(o,c);for(let l of i){if(a.incompleteSymbolIds.has(l.symbolId))continue;let f=a.callees.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,f),n.set(l.symbolId,f)}}return n}referencesForDefinitionNode(t,n,e){let o=e?u.now():0,i=this.packageImportReferencesForDefinition(t);if(e&&(e.packageRefsMs+=u.now()-o,e.packageReferenceCount+=i.length),!n)return i;let s=e?u.now():0,c=Me(n,t,i,this.db.config.projectRoot);return e&&(e.semanticRefsMs+=u.now()-s,e.referenceCount+=c.length),c}signatureFor(t){return k(this.signatureCache,t.symbolId,()=>{let n=this.nodeForDefinition(t);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let e=n.getType().getCallSignatures()[0];if(!e)return null;let o=e.getParameters().map(s=>{let c=s.getDeclarations()[0],a=c?s.getTypeAtLocation(c).getText(c):s.getValueDeclaration()?.getType().getText()??"unknown";return we(a)}),i=e.getReturnType().getText(n);return`(${o.join(",")})=>${we(i)}`})}importUsageForSourceFile(t,n,e){let o=[],i=new Map;for(let s of n.getImportDeclarations()){e.declarations+=1;let c=_(this.db,t,s.getModuleSpecifierValue()),a=s.getImportClause()?.isTypeOnly()??!1;for(let l of ie(s)){e.entries+=1;let f=a?null:l.identifier?.getSymbol()?.compilerSymbol??null;!a&&l.identifier&&(f?e.bindingSymbols+=1:e.missingBindingSymbols+=1);let p={sourcePath:c,entry:l,typeOnlyDeclaration:a,bindingSymbol:f,references:[]};if(o.push(p),a||!l.localName||!f)continue;let d=i.get(l.localName);d?d.push(p):i.set(l.localName,[p])}}return i.size>0&&n.forEachDescendant(s=>{if(s.getKindName()!=="Identifier")return;let c=i.get(s.getText());if(!c||Ge(s))return;e.scannedIdentifiers+=1;let a=s.getSymbol()?.compilerSymbol;if(e.symbolLookups+=1,!!a){for(let l of c)if(l.bindingSymbol===a){l.references.push({location:$(s,this.db.config.projectRoot),node:s}),e.matchedReferences+=1;break}}}),o.map(s=>s.typeOnlyDeclaration?qe(t,s.sourcePath,s.entry):s.entry.identifier&&!s.bindingSymbol?(e.fallbackEntries+=1,this.valueImportUsageForEntry(t,s.sourcePath,s.entry)):this.valueImportUsageFromLocations(t,s.sourcePath,s.entry,s.references))}valueImportUsageForEntry(t,n,e){let o;try{o=e.identifier?e.identifier.findReferences():[]}catch{let s=e.identifier?q(e.identifier,t,this.db.config.projectRoot):[];return{importer:t,sourcePath:n,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:e.isTypeOnly,isUsed:e.isTypeOnly||s.length>0,isTypeUsed:e.isTypeOnly,isValueUsed:!e.isTypeOnly&&s.length>0,references:s}}let i=[];for(let s of o)for(let c of Fe(s,t,e.identifier,this.db.config.projectRoot))i.push(c);return this.valueImportUsageFromLocations(t,n,e,i)}valueImportUsageFromLocations(t,n,e,o){let i=o.some(a=>!Y(a.node)),s=o.some(a=>Y(a.node)),c=e.isTypeOnly;return{importer:t,sourcePath:n,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:c,isUsed:c||o.length>0,isTypeUsed:c||s,isValueUsed:i,references:o.map(a=>a.location)}}packageImportReferencesForDefinition(t){return this.packageImportReferences().get(t.symbolId)??[]}packageImportReferencesForFiles(t){let n=new Map,e=new Set;for(let i of t){let s=this.sourceFiles.sourceFile(i);if(s)for(let c of s.getImportDeclarations()){let a=te(this.workspacePackages,c.getModuleSpecifierValue());a&&e.add(a)}}if(e.size===0)return n;let o=this.packageExportsForNames(e);for(let i of t)this.addPackageImportReferencesForDocument(n,o,i);for(let[i,s]of n)n.set(i,L(s));return n}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let t=new Map,n=this.packageExports();for(let e of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(t,n,e);for(let[e,o]of t)t.set(e,L(o));return this.packageImportReferenceIndex=t,t}addPackageImportReferencesForDocument(t,n,e){if(this.db.isIgnored(e))return;let o=this.sourceFiles.sourceFileMatch(e);if(o)for(let i of o.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(t,n,e,i)}addPackageImportReferencesForDeclaration(t,n,e,o){let i=te(this.workspacePackages,o.getModuleSpecifierValue());if(!i)return;let s=n.get(i);if(s)for(let c of ie(o)){if(c.kind!=="named"||!c.identifier)continue;let a=s.get(c.importedName);if(!a||a.size===0)continue;let l=q(c.identifier,e,this.db.config.projectRoot);l.length>0&&tt(t,a,l)}}packageExports(){return this.packageExportIndex?this.packageExportIndex:(this.packageExportIndex=this.packageExportsForNames(new Set(this.workspacePackages.map(t=>t.name))),this.packageExportIndex)}packageExportsForNames(t){let n=new Map;for(let e of this.workspacePackages){if(!t.has(e.name))continue;let o=new Map;for(let i of Ne(e))this.collectPackageExports(e,i,o,new Set);o.size>0&&n.set(e.name,o)}return n}collectPackageExports(t,n,e,o){if(o.has(n))return;o.add(n);let i=this.sourceFiles.sourceFile(n);if(i)for(let s of i.getExportDeclarations()){let c=s.getModuleSpecifierValue(),a=c?_(this.db,n,c):n;if(!a||!a.startsWith(`${t.relativeDir}/src/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(t,a,e,o);continue}for(let f of l){let p=f.getNameNode().getText(),d=f.getAliasNode()?.getText()??p,h=this.indexedDefinitionByLeaf(a,p);if(!h)continue;let m=e.get(d);m||(m=new Set,e.set(d,m)),m.add(h.symbolId)}}}indexedDefinitionByLeaf(t,n){return k(this.indexedDefinitionLeafCache,t,()=>Te(this.db,t)).get(n)??null}nodeForDefinition(t){return k(this.definitionNodeCache,t.symbolId,()=>this.definitionNodesForFile(t.relativePath).get(t.symbolId)??null)}definitionNodesForFile(t){return k(this.fileDefinitionNodeCache,t,()=>{let n=this.sourceFiles.sourceFile(t);return n?xe(this.tsMorph,this.db,n,t):new Map})}referenceDefinitionFromCompilerSymbol(t){return this.definitionFromCompilerSymbol(t,void 0,!0)}definitionFromCompilerSymbol(t,n,e=!1){let o=t.name,i=n?u.now():0,s=t.declarations??[];n&&(n.declarationsMs+=u.now()-i,n.declarationChecks+=s.length);for(let c of s){let a=n?u.now():0,l=c.getSourceFile(),f=w(this.db.config.projectRoot,l.fileName),p=l.getLineAndCharacterOfPosition(c.getStart(l)).line;if(n&&(n.declarationLocationMs+=u.now()-a),!f||this.db.isIgnored(f))continue;let d=n?u.now():0,h=this.compilerDeclarationName(c),m=e?X(this.db,f,p,o)??(h&&h!==o?X(this.db,f,p,h):null):ke(this.db,f,p,o);if(n&&(n.indexedLookupMs+=u.now()-d),m)return{symbolId:m.symbolId,symbol:m.symbol,file:m.relativePath,line:m.startLine}}return null}compilerDeclarationName(t){let n=t.name;return n&&this.tsMorph.ts.isIdentifier(n)?n.text:null}calleeMapForFile(t,n){let e=A(),o=0,i=0,s=0,c=0,a=0,l=0,f=0,p=0,d=e?Ze():void 0;return x("typescript.callee-map.file",()=>{let h=e?u.now():0,m=this.sourceFiles.sourceFile(t);if(e&&(a=Math.round(u.now()-h)),!m)return{callees:new Map,incompleteSymbolIds:new Set};let I=e?u.now():0,g=P(this.db,t).sort((M,F)=>M.startLine-F.startLine||F.endLine-M.endLine);if(e&&(l=Math.round(u.now()-I)),o=g.length,g.length===0)return{callees:new Map,incompleteSymbolIds:new Set};let y=new Map,S=new Set,T=e?u.now():0,R=this.compilerCheckerForSourceFile(m),D=m.compilerNode;e&&(f=Math.round(u.now()-T));let v=new Map,N=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){e&&(i+=1);let F=this.semanticCalleeForCallNode(R,D,g,M,v,n,S,d);F&&(e&&(s+=1),Je(y,F.callerId,F.target))}this.tsMorph.ts.forEachChild(M,N)},C=e?u.now():0;N(D),e&&(p=Math.round(u.now()-C));for(let[M,F]of y)y.set(M,nt(F));return c=y.size,{callees:y,incompleteSymbolIds:S}},()=>({relativePath:t,definitions:o,callNodes:i,resolvedCallees:s,outputRows:c,requestedDefinitions:n?.size??o,sourceFileLookupMs:a,definitionsLoadMs:l,checkerLookupMs:f,traversalMs:p,...d?et(d):{}}))}semanticCalleeForCallNode(t,n,e,o,i,s,c,a){let l=a?u.now():0,f=Qe(e,W(n,o));if(a&&(a.callerLookupMs+=u.now()-l),!f)return null;if(s&&!s.has(f.symbolId))return a&&(a.skippedUnrequestedCallers+=1),null;let p=o.expression,d=this.compilerSymbolForExpression(t,p,a);d.incomplete&&c?.add(f.symbolId);let h=d.symbol,m=null;if(h)if(a&&(a.targetSymbolHits+=1),i.has(h))a&&(a.compilerSymbolCacheHits+=1),m=i.get(h)??null;else{a&&(a.compilerSymbolCacheMisses+=1);let I=a?u.now():0;m=this.definitionFromCompilerSymbol(h,a),a&&(a.targetLookupMs+=u.now()-I),i.set(h,m)}else a&&(a.targetMisses+=1);return m?{callerId:f.symbolId,target:{symbol:m.symbol,file:m.file,line:m.line,callsiteLine:W(n,o)}}:null}compilerSymbolForExpression(t,n,e){let o=!1,i=e?u.now():0,s=ne(()=>t.getSymbolAtLocation(n),()=>{o=!0});if(e&&(e.expressionSymbolMs+=u.now()-i),s)return{symbol:s,incomplete:!1};e&&(e.typeFallbacks+=1);let c=!1,a=e?u.now():0,l=ne(()=>t.getTypeAtLocation(n).getSymbol(),()=>{c=!0});return e&&(e.typeSymbolMs+=u.now()-a),{symbol:l,incomplete:!l&&(o||c)}}compilerCheckerForSourceFile(t){let n=t.getProject(),e=this.compilerCheckerCache.get(n);return e||(e=n.getTypeChecker().compilerObject,this.compilerCheckerCache.set(n,e)),e}};function ie(r){let t=[],n=r.getDefaultImport();n&&t.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});let e=r.getNamespaceImport();e&&t.push({identifier:e,importedName:"*",localName:e.getText(),kind:"namespace",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});for(let o of r.getNamedImports()){let i=o.getNameNode(),c=o.getAliasNode()??(i.getKindName()==="Identifier"?i:null);t.push({identifier:c,importedName:i.getText(),localName:c?.getText()??i.getText(),kind:"named",isTypeOnly:o.isTypeOnly()||(r.getImportClause()?.isTypeOnly()??!1)})}return t.length===0&&t.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),t}function qe(r,t,n){return{importer:r,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ye(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function Ge(r){for(let t=r;t;t=t.getParent())if(t.getKindName()==="ImportDeclaration")return!0;return!1}function Je(r,t,n){let e=r.get(t);e||(e=[],r.set(t,e)),e.push(n)}function Xe(r){let t=new Set;for(let n of r.getImportDeclarations())for(let e of ie(n))e.localName&&t.add(e.localName);return t}function Qe(r,t){let n=null;for(let e of r)t<e.startLine||t>e.endLine||(!n||e.startLine>=n.startLine)&&(n=e);return n}function W(r,t){return r.getLineAndCharacterOfPosition(t.getStart(r)).line}function Re(r,t,n){return t===r.relativePath&&n>=r.startLine&&n<=r.endLine}function ve(r){return r.symbol.includes("#")?ue(r.symbol)==="type"&&r.relativePath.endsWith(".d.ts"):!1}function Ze(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function et(r){return{...r,callerLookupMs:Math.round(r.callerLookupMs),expressionSymbolMs:Math.round(r.expressionSymbolMs),typeSymbolMs:Math.round(r.typeSymbolMs),targetLookupMs:Math.round(r.targetLookupMs),declarationsMs:Math.round(r.declarationsMs),declarationLocationMs:Math.round(r.declarationLocationMs),indexedLookupMs:Math.round(r.indexedLookupMs)}}function Pe(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0,preciseSearchFailures:0,hierarchyDefinitions:0,hierarchyFamilies:0,hierarchyReferences:0,hierarchyMs:0}}function Le(r){return{...r,scanMs:Math.round(r.scanMs),packageRefsMs:Math.round(r.packageRefsMs),semanticRefsMs:Math.round(r.semanticRefsMs),hierarchyMs:Math.round(r.hierarchyMs)}}function tt(r,t,n){for(let e of t){let o=r.get(e)??[];o.push(...n),r.set(e,o)}}function nt(r){let t=new Set,n=[];for(let e of r){let o=`${e.symbol}|${e.file}|${e.line}|${e.callsiteLine??""}`;t.has(o)||(t.add(o),n.push(e))}return n}function we(r){return r.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}export{ge as a,Ee as b,Yt as c,Ve as d};
3
- //# sourceMappingURL=chunk-CIYA2KZN.js.map
3
+ //# sourceMappingURL=chunk-JOYASZRF.js.map
@@ -1,3 +1,3 @@
1
- import{e as i}from"./chunk-GVAF222T.js";import{a as o}from"./chunk-F74LZWCE.js";import{x as s}from"./chunk-7GAK2F3H.js";function u(r,e){let t=s(r,e.relativePath);if(t.length===0)return!1;let n=i(e.symbol);if(!n)return!1;let c=t.slice(Math.max(0,e.startLine-2),e.startLine+1).join(`
1
+ import{e as i}from"./chunk-TNLOX4TN.js";import{a as o}from"./chunk-RGBZDOUO.js";import{x as s}from"./chunk-23AD24QZ.js";function u(r,e){let t=s(r,e.relativePath);if(t.length===0)return!1;let n=i(e.symbol);if(!n)return!1;let c=t.slice(Math.max(0,e.startLine-2),e.startLine+1).join(`
2
2
  `),a=o(n);return new RegExp(`^\\s*export\\s+(?:default\\s+)?(?:(?:async\\s+)?function\\s+${a}\\b|(?:abstract\\s+)?class\\s+${a}\\b|(?:interface|type|enum|namespace|module)\\s+${a}\\b|(?:const|let|var)\\s+${a}\\b)`,"m").test(c)?!0:p(t,n)}function p(r,e){if(!e)return!1;let t=new RegExp(`^\\s*export\\s*\\{[^}\\n]*\\b${o(e)}\\b`);return r.some(n=>t.test(n))}export{u as a};
3
- //# sourceMappingURL=chunk-U7NUXDQO.js.map
3
+ //# sourceMappingURL=chunk-K3PFL5QQ.js.map
@@ -1,2 +1,2 @@
1
- import{a as b,b as y}from"./chunk-IRQOAM5G.js";import{a as R,b as H,c as B,e as h,f as k}from"./chunk-OTOKVOJ3.js";import{a as p,b as g}from"./chunk-NMTSZXCL.js";import{M as v}from"./chunk-ICUL7XRT.js";function V(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:i=6,limit:o=20,scope:c,scanLimit:n,filePattern:d,focusFiles:f}=s,l=v(e).reactProfiles({scope:c,minBehaviorTokens:Math.max(3,i),scanLimit:n}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r})),t=b(l,r=>r.tokens);return y({profiles:l,limit:o,filePattern:d,focusFiles:f,candidateIndex:t,profile:{name:"react-hook-candidates"},compare:(r,a)=>C(r,a,m,i),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.componentA.localeCompare(a.componentA)||r.fileB.localeCompare(a.fileB)||r.componentB.localeCompare(a.componentB)})}function C(e,s,m,i){let o=p(e.tokens,s.tokens);if(o.size<i||!E(o))return null;let c=H(e.tokens,s.tokens);if(c<m)return null;let n=h(o,"hook:"),d=h(o,"react-hook:"),f=h(o,"effect:"),l=h(o,"state:"),t=h(o,"request:"),r=h(o,"handler:"),a=h(o,"handler-verb:"),u=A({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:c,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:k(o),sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:k(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:k(g(s.tokens,e.tokens)).slice(0,25),reason:P({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a}),locA:e.profile.loc,locB:s.profile.loc}}function A(e){return R({genericWords:q,stripPrefixes:w,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:S})}function S(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function E(e){let s=0,m=0,i=0,o=0,c=0,n=0,d=0;for(let t of e)t.startsWith("hook:")?s+=1:t.startsWith("react-hook:")?m+=1:t.startsWith("effect:")?i+=1:t.startsWith("request:")?o+=1:t.startsWith("handler:")||t.startsWith("handler-verb:")?c+=1:t.startsWith("state:")?n+=1:t.startsWith("state-hook:")&&(d+=1);let f=n+d,l=s+m+i+o+c+f;return B([{name:"requests",count:o},{name:"customHooks",count:s},{name:"namedStates",count:n},{name:"handlers",count:c},{name:"effects",count:i},{name:"reactHooks",count:m},{name:"namedBehavior",count:l}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{customHooks:1,requests:1,namedBehavior:5},reason:"shared custom hook and request workflow"},{min:{customHooks:1,namedStates:1,namedBehavior:5},reason:"shared custom hook and state"},{min:{customHooks:1,handlers:2,namedBehavior:5},reason:"shared custom hook and handlers"},{min:{namedStates:1,handlers:2,effects:1,namedBehavior:5},reason:"shared stateful effects"},{min:{namedStates:1,handlers:2,reactHooks:2,namedBehavior:5},reason:"shared stateful React primitives"}]).pass}function P(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var q=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),w=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{V as a};
2
- //# sourceMappingURL=chunk-WK2IQJPK.js.map
1
+ import{a as b,b as y}from"./chunk-IRQOAM5G.js";import{a as R,b as H,c as B,e as h,f as k}from"./chunk-OTOKVOJ3.js";import{a as p,b as g}from"./chunk-NMTSZXCL.js";import{M as v}from"./chunk-NRNVMB2R.js";function V(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:i=6,limit:o=20,scope:c,scanLimit:n,filePattern:d,focusFiles:f}=s,l=v(e).reactProfiles({scope:c,minBehaviorTokens:Math.max(3,i),scanLimit:n}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r})),t=b(l,r=>r.tokens);return y({profiles:l,limit:o,filePattern:d,focusFiles:f,candidateIndex:t,profile:{name:"react-hook-candidates"},compare:(r,a)=>C(r,a,m,i),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.componentA.localeCompare(a.componentA)||r.fileB.localeCompare(a.fileB)||r.componentB.localeCompare(a.componentB)})}function C(e,s,m,i){let o=p(e.tokens,s.tokens);if(o.size<i||!E(o))return null;let c=H(e.tokens,s.tokens);if(c<m)return null;let n=h(o,"hook:"),d=h(o,"react-hook:"),f=h(o,"effect:"),l=h(o,"state:"),t=h(o,"request:"),r=h(o,"handler:"),a=h(o,"handler-verb:"),u=A({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:c,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:k(o),sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:k(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:k(g(s.tokens,e.tokens)).slice(0,25),reason:P({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a}),locA:e.profile.loc,locB:s.profile.loc}}function A(e){return R({genericWords:q,stripPrefixes:w,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:S})}function S(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function E(e){let s=0,m=0,i=0,o=0,c=0,n=0,d=0;for(let t of e)t.startsWith("hook:")?s+=1:t.startsWith("react-hook:")?m+=1:t.startsWith("effect:")?i+=1:t.startsWith("request:")?o+=1:t.startsWith("handler:")||t.startsWith("handler-verb:")?c+=1:t.startsWith("state:")?n+=1:t.startsWith("state-hook:")&&(d+=1);let f=n+d,l=s+m+i+o+c+f;return B([{name:"requests",count:o},{name:"customHooks",count:s},{name:"namedStates",count:n},{name:"handlers",count:c},{name:"effects",count:i},{name:"reactHooks",count:m},{name:"namedBehavior",count:l}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{customHooks:1,requests:1,namedBehavior:5},reason:"shared custom hook and request workflow"},{min:{customHooks:1,namedStates:1,namedBehavior:5},reason:"shared custom hook and state"},{min:{customHooks:1,handlers:2,namedBehavior:5},reason:"shared custom hook and handlers"},{min:{namedStates:1,handlers:2,effects:1,namedBehavior:5},reason:"shared stateful effects"},{min:{namedStates:1,handlers:2,reactHooks:2,namedBehavior:5},reason:"shared stateful React primitives"}]).pass}function P(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var q=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),w=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{V as a};
2
+ //# sourceMappingURL=chunk-KAXBWTSX.js.map
@@ -1,2 +1,2 @@
1
- import{a as D}from"./chunk-35NLDRZC.js";import{a as C}from"./chunk-GV2CEZCW.js";function v(t,n={}){let{limit:o=10,scope:s,minDepth:h=3,edgeBasis:c="symbol-references"}=n,u=C(t,s,c==="imports"?{scipEdges:"imports-only",sourceEdges:"imports-only"}:void 0),{components:p,componentOf:y}=D(u),m=new Map;for(let e=0;e<p.length;e++)m.set(e,new Set);for(let[e,a]of u){let i=y.get(e);for(let l of a){let r=y.get(l);r!==i&&m.get(i).add(r)}}let f=new Array(p.length),b=new Array(p.length);for(let e=0;e<p.length;e++){let a=[],i=0;for(let l of[...m.get(e)].sort((r,d)=>r-d)){let r=b[l];(r>i||r===i&&I(f[l],a,p)<0)&&(i=r,a=f[l])}f[e]=[e,...a],b[e]=1+i}function R(e){return f[e]}let w=p.map(e=>[...e].sort()),S=new Set,g=[];for(let e=0;e<p.length;e++){let i=R(e).map(d=>w[d]),l=i.map(d=>d[0]);if(i.length<h)continue;let r=l.join(" ");S.has(r)||(S.add(r),g.push(j(l,i,c)))}return g.sort((e,a)=>a.depth-e.depth||e.chain.join("\0").localeCompare(a.chain.join("\0"))),B(g).slice(0,o)}function K(t,n={}){return v(t,n)}function I(t,n,o){if(n.length===0)return-1;let s=t.map(c=>[...o[c]].sort()[0]??"").join("\0"),h=n.map(c=>[...o[c]].sort()[0]??"").join("\0");return s.localeCompare(h)}function j(t,n,o){let s=n.reduce((c,u)=>c+u.length,0),h=n.filter(c=>c.length>1).length;return{chain:t,components:n,depth:n.length,fileCount:s,edgeBasis:o,actionTier:"signal",chainKind:"transitive-dependency-depth",evidenceReasons:[`${n.length} condensed dependency component(s) form the representative transitive path`,`${s} file(s) are represented; ${h} component(s) contain a dependency cycle`,`edge basis: ${o==="imports"?"resolved file imports":"cross-file symbol references plus resolved source imports"}`,"cycles count once toward depth and retain their full membership separately"],recommendation:"Review whether the chain crosses ownership or layer boundaries; shorten it only when the dependency direction is accidental."}}function B(t){let n=[];for(let o of t)n.some(s=>E(o.chain,s.chain))||n.push(o);return n}function E(t,n){if(t.length>=n.length)return!1;let o=n.length-t.length;for(let s=0;s<t.length;s++)if(t[s]!==n[o+s])return!1;return!0}export{v as a,K as b};
2
- //# sourceMappingURL=chunk-5ZI2PPI7.js.map
1
+ import{a as D}from"./chunk-35NLDRZC.js";import{a as C}from"./chunk-6CTSFS7R.js";function v(t,n={}){let{limit:o=10,scope:s,minDepth:h=3,edgeBasis:c="symbol-references"}=n,u=C(t,s,c==="imports"?{scipEdges:"imports-only",sourceEdges:"imports-only"}:void 0),{components:p,componentOf:y}=D(u),m=new Map;for(let e=0;e<p.length;e++)m.set(e,new Set);for(let[e,a]of u){let i=y.get(e);for(let l of a){let r=y.get(l);r!==i&&m.get(i).add(r)}}let f=new Array(p.length),b=new Array(p.length);for(let e=0;e<p.length;e++){let a=[],i=0;for(let l of[...m.get(e)].sort((r,d)=>r-d)){let r=b[l];(r>i||r===i&&I(f[l],a,p)<0)&&(i=r,a=f[l])}f[e]=[e,...a],b[e]=1+i}function R(e){return f[e]}let w=p.map(e=>[...e].sort()),S=new Set,g=[];for(let e=0;e<p.length;e++){let i=R(e).map(d=>w[d]),l=i.map(d=>d[0]);if(i.length<h)continue;let r=l.join(" ");S.has(r)||(S.add(r),g.push(j(l,i,c)))}return g.sort((e,a)=>a.depth-e.depth||e.chain.join("\0").localeCompare(a.chain.join("\0"))),B(g).slice(0,o)}function K(t,n={}){return v(t,n)}function I(t,n,o){if(n.length===0)return-1;let s=t.map(c=>[...o[c]].sort()[0]??"").join("\0"),h=n.map(c=>[...o[c]].sort()[0]??"").join("\0");return s.localeCompare(h)}function j(t,n,o){let s=n.reduce((c,u)=>c+u.length,0),h=n.filter(c=>c.length>1).length;return{chain:t,components:n,depth:n.length,fileCount:s,edgeBasis:o,actionTier:"signal",chainKind:"transitive-dependency-depth",evidenceReasons:[`${n.length} condensed dependency component(s) form the representative transitive path`,`${s} file(s) are represented; ${h} component(s) contain a dependency cycle`,`edge basis: ${o==="imports"?"resolved file imports":"cross-file symbol references plus resolved source imports"}`,"cycles count once toward depth and retain their full membership separately"],recommendation:"Review whether the chain crosses ownership or layer boundaries; shorten it only when the dependency direction is accidental."}}function B(t){let n=[];for(let o of t)n.some(s=>E(o.chain,s.chain))||n.push(o);return n}function E(t,n){if(t.length>=n.length)return!1;let o=n.length-t.length;for(let s=0;s<t.length;s++)if(t[s]!==n[o+s])return!1;return!0}export{v as a,K as b};
2
+ //# sourceMappingURL=chunk-KHHAGHAW.js.map
@@ -1,4 +1,4 @@
1
- import{a as o}from"./chunk-356EZBIP.js";import{b as i}from"./chunk-LMTSB3TB.js";import{y as l}from"./chunk-GVAF222T.js";function y(e,r){let s=i(e,r);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let a=s.map(()=>"?").join(", "),n=e.all(`SELECT relative_path FROM documents
1
+ import{a as o}from"./chunk-26EDDGAX.js";import{b as i}from"./chunk-MJX2J5QE.js";import{y as l}from"./chunk-TNLOX4TN.js";function y(e,r){let s=i(e,r);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let a=s.map(()=>"?").join(", "),n=e.all(`SELECT relative_path FROM documents
2
2
  WHERE relative_path IN (${a})
3
3
  ORDER BY relative_path`,...s).map(t=>t.relative_path).filter(t=>!e.isIgnored(t)),p=l(e,n,{onlyDocumented:!0,sort:!0}).map(({relativePath:t,...f})=>f),m=o(e,"forward",s).filter(t=>!e.isIgnored(t)),d=o(e,"reverse",s).filter(t=>!e.isIgnored(t));return{files:n,symbols:p,dependsOn:m,dependedOnBy:d}}function g(e,r){return y(e,r)}export{y as a,g as b};
4
- //# sourceMappingURL=chunk-UW6KD57C.js.map
4
+ //# sourceMappingURL=chunk-KJLUQVBG.js.map
@@ -1,2 +1,2 @@
1
- import{a as P,b as y}from"./chunk-IRQOAM5G.js";import{a as C,c as b,e as r,f}from"./chunk-OTOKVOJ3.js";import{a as g,b as h,c as k}from"./chunk-NMTSZXCL.js";import{M as v}from"./chunk-ICUL7XRT.js";function L(e,i={}){let{minSimilarity:o=.62,minTokens:n=8,limit:c=20,scope:l,scanLimit:u,filePattern:m,focusFiles:d}=i,s=B(e,{scope:l,minTokens:n,scanLimit:u}),p=P(s,t=>t.tokens);return y({profiles:s,limit:c,filePattern:m,focusFiles:d,candidateIndex:p,profile:{name:"vue-component-duplicates"},compare:(t,a)=>V(t,a,o),sort:(t,a)=>a.similarity-t.similarity||t.fileA.localeCompare(a.fileA)||t.fileB.localeCompare(a.fileB)})}function B(e,i){return v(e).vueProfiles({scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(o=>({file:o.file,tokens:o.templateTokens,loc:T(o)}))}function T(e){return e.totalLines}function V(e,i,o){let n=g(e.tokens,i.tokens);if(n.size<6||!R(n))return null;let c=k(e.tokens,i.tokens);if(c<o)return null;let l=r(n,"component:"),u=r(n,"prop:"),m=r(n,"event:"),d=r(n,"directive:"),s=r(n,"slot:"),p=r(n,"id:"),t=S({sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p});return{fileA:e.file,fileB:i.file,similarity:c,tokenCountA:e.tokens.size,tokenCountB:i.tokens.size,sharedTokens:f(n),sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p,evidenceClass:t.evidenceClass,actionTier:t.actionTier,evidenceClassReasons:t.reasons,recommendation:t.recommendation,uniqueToA:f(h(e.tokens,i.tokens)).slice(0,25),uniqueToB:f(h(i.tokens,e.tokens)).slice(0,25),locA:e.loc,locB:i.loc}}function R(e){let i=0,o=0;for(let n of e)n.startsWith("component:")&&(i+=1),(n.startsWith("prop:")||n.startsWith("event:")||n.startsWith("directive:")||n.startsWith("slot:"))&&(o+=1);return b([{name:"component",count:i},{name:"behavior",count:o}],[{min:{component:1},reason:"shared custom component"},{min:{behavior:3},reason:"shared Vue template structure"}]).pass}function S(e){return C({genericWords:x,primitiveGroups:[{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"},{values:e.sharedDirectives,reasonPrefix:"shared directives",bucket:"generic"},{values:e.sharedSlots,reasonPrefix:"shared slots",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedIdentifiers,label:"shared identifier",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific Vue 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 x=new Set(["actions","app","button","card","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{L as a};
2
- //# sourceMappingURL=chunk-WWCV4E6J.js.map
1
+ import{a as P,b as y}from"./chunk-IRQOAM5G.js";import{a as C,c as b,e as r,f}from"./chunk-OTOKVOJ3.js";import{a as g,b as h,c as k}from"./chunk-NMTSZXCL.js";import{M as v}from"./chunk-NRNVMB2R.js";function L(e,i={}){let{minSimilarity:o=.62,minTokens:n=8,limit:c=20,scope:l,scanLimit:u,filePattern:m,focusFiles:d}=i,s=B(e,{scope:l,minTokens:n,scanLimit:u}),p=P(s,t=>t.tokens);return y({profiles:s,limit:c,filePattern:m,focusFiles:d,candidateIndex:p,profile:{name:"vue-component-duplicates"},compare:(t,a)=>V(t,a,o),sort:(t,a)=>a.similarity-t.similarity||t.fileA.localeCompare(a.fileA)||t.fileB.localeCompare(a.fileB)})}function B(e,i){return v(e).vueProfiles({scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(o=>({file:o.file,tokens:o.templateTokens,loc:T(o)}))}function T(e){return e.totalLines}function V(e,i,o){let n=g(e.tokens,i.tokens);if(n.size<6||!R(n))return null;let c=k(e.tokens,i.tokens);if(c<o)return null;let l=r(n,"component:"),u=r(n,"prop:"),m=r(n,"event:"),d=r(n,"directive:"),s=r(n,"slot:"),p=r(n,"id:"),t=S({sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p});return{fileA:e.file,fileB:i.file,similarity:c,tokenCountA:e.tokens.size,tokenCountB:i.tokens.size,sharedTokens:f(n),sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p,evidenceClass:t.evidenceClass,actionTier:t.actionTier,evidenceClassReasons:t.reasons,recommendation:t.recommendation,uniqueToA:f(h(e.tokens,i.tokens)).slice(0,25),uniqueToB:f(h(i.tokens,e.tokens)).slice(0,25),locA:e.loc,locB:i.loc}}function R(e){let i=0,o=0;for(let n of e)n.startsWith("component:")&&(i+=1),(n.startsWith("prop:")||n.startsWith("event:")||n.startsWith("directive:")||n.startsWith("slot:"))&&(o+=1);return b([{name:"component",count:i},{name:"behavior",count:o}],[{min:{component:1},reason:"shared custom component"},{min:{behavior:3},reason:"shared Vue template structure"}]).pass}function S(e){return C({genericWords:x,primitiveGroups:[{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"},{values:e.sharedDirectives,reasonPrefix:"shared directives",bucket:"generic"},{values:e.sharedSlots,reasonPrefix:"shared slots",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedIdentifiers,label:"shared identifier",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific Vue 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 x=new Set(["actions","app","button","card","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{L as a};
2
+ //# sourceMappingURL=chunk-KOVUXHIZ.js.map
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{spawnSync as T}from"child_process";import{createHash as W}from"crypto";import{existsSync as M,lstatSync as j,realpathSync as $}from"fs";import{dirname as z,isAbsolute as U,join as K,resolve as m}from"path";function E(){return{...process.env,GIT_OPTIONAL_LOCKS:"0",LC_ALL:"C"}}var p={run(t,e){let r=I(t,e);return r.kind==="success"?r.output:void 0},runResult:I},H=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],f=/^[0-9a-f]{40,64}$/;function Ce(t,e,r){if(!f.test(e.replace(/\^$/,"")))return[];let n=T("git",["log","--first-parent",`--max-count=${r}`,"--format=%T",e,"--"],{cwd:t,encoding:"utf8",env:E(),timeout:3e4,windowsHide:!0});return n.status!==0?[]:n.stdout.split(/\r?\n/).filter(i=>f.test(i))}function Se(t,e,r=p){if(!e||e.startsWith("-")||/[\0\r\n]/.test(e))throw new Error(`Invalid Git revision ${JSON.stringify(e)}.`);let n=r.runResult(t,["rev-parse","--verify","--end-of-options",`${e}^{commit}`]);if(n.kind!=="success"||!f.test(n.output))throw new Error(`Git revision ${JSON.stringify(e)} does not resolve to exactly one commit.`);return n.output}function ke(t,e=p){let r=e.runResult(t,H);if(r.kind==="success"){let n=J(r.output);if(n)return Y(n,e)}return X(t,e)}function J(t){let e=t.split(`
3
+ `).map(c=>c.trim());if(e.length!==5)return;let[r,n,i,o,s]=e;if(!r||!n||!i||!o||!s||!f.test(o)||!f.test(s))return;let a=d(r);return{root:a,gitDir:d(g(a,n)),commonDir:d(g(a,i)),headCommit:o,treeOid:s}}function Y(t,e){let r=e.run(t.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...v(t.root,t.gitDir),commonDir:t.commonDir,repositoryId:x("repository",t.commonDir),headCommit:t.headCommit,treeOid:t.treeOid,clean:r.length===0}}function X(t,e){let r=q(t,e);if(r.kind!=="worktree")return;let n=r.identity,i=n.projectRoot,o=e.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=d(g(i,o)),a=h(e.run(i,["rev-parse","--verify","HEAD"])),c=h(e.run(i,["rev-parse","--verify","HEAD^{tree}"])),l=e.run(i,["status","--porcelain=v1","-z","--untracked-files=all"]);if(l!==void 0)return{...n,commonDir:s,repositoryId:x("repository",s),headCommit:a,treeOid:c,clean:l.length===0}}function q(t,e=p){let r=e.runResult(t,["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=d(n),o=e.run(i,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=d(g(i,o));return{kind:"worktree",identity:v(i,s)}}function v(t,e){return{projectRoot:t,gitDir:e,worktreeId:x("worktree",`${t}\0${e}`)}}function Re(t,e=p){let r=e.run(t,["worktree","list","--porcelain","-z"]);return r===void 0?[]:V(r)}function V(t){let e=[],r;for(let n of t.split("\0")){if(n===""){r&&e.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&&e.push(r),r={path:d(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&&e.push(r),e}function Pe(t,e,r=p){return h(r.run(t,e))}function g(t,e){return U(e)?e:m(t,e)}function d(t){try{return $(t)}catch{return m(t)}}function x(t,e){return W("sha256").update(`${t}\0${e}`).digest("hex").slice(0,24)}function h(t){return t?.trim()||void 0}function I(t,e){let r=T("git",["-C",t,...e],{encoding:"utf-8",env:E(),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"&&M(m(t)))&&!Q(t)?{kind:"not-repository"}:{kind:"error",message:i}}function Q(t){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let e=m(t);for(;;){try{return j(K(e,".git")),!0}catch(n){let i=n.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let r=z(e);if(r===e)return!1;e=r}}function Te(t){try{return process.kill(t,0),!0}catch(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EPERM"}}import{closeSync as b,fstatSync as y,openSync as C,readFileSync as Z,readSync as w}from"fs";import{createHash as ee}from"crypto";var B=8*1024*1024,A=64*1024*1024,te=512*1024*1024,re=256*1024*1024,u=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 O(t,e){P(e.maxBytes);let r=String(t),n=C(t,"r");try{let i=y(n);_(i,e,r);let o=Z(n),s=y(n);if(s.dev!==i.dev||s.ino!==i.ino||s.size!==i.size||o.byteLength!==i.size)throw new u(e.inputKind,r,"changed-during-read",s.size,e.maxBytes);return o}finally{b(n)}}function S(t,e,r="utf8"){return O(t,e).toString(r)}function ne(t,e){return S(t,{maxBytes:B,inputKind:e})}function ie(t,e){return S(t,{maxBytes:A,inputKind:e})}function k(t,e){P(e.maxBytes);let r=[],n=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=w(t,n,0,n.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>e.maxBytes)throw new u(e.inputKind,`file descriptor ${t}`,"too-large",i,e.maxBytes);r.push(Buffer.from(n.subarray(0,o)))}return Buffer.concat(r,i)}function oe(t,e,r="utf8"){return k(t,e).toString(r)}function D(t,e){let r=C(t,"r");try{return k(r,e)}finally{b(r)}}function R(t,e,r="utf8"){return D(t,e).toString(r)}function L(t,e,r){P(e.maxBytes);let n=String(t),i=C(t,"r");try{let o=y(i);_(o,e,n);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),a=0;for(;a<o.size;){let l=w(i,s,0,Math.min(s.length,o.size-a),a);if(l===0)break;r(s.subarray(0,l)),a+=l}let c=y(i);if(c.dev!==o.dev||c.ino!==o.ino||c.size!==o.size||a!==o.size)throw new u(e.inputKind,n,"changed-during-read",c.size,e.maxBytes);return a}finally{b(i)}}function se(t,e){let r=ee("sha256");return L(t,e,n=>r.update(n)),r.digest("hex")}function _(t,e,r){if(!t.isFile())throw new u(e.inputKind,r,"not-regular",Number(t.size),e.maxBytes);if(t.size>e.maxBytes)throw new u(e.inputKind,r,"too-large",Number(t.size),e.maxBytes)}function P(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${t}`)}var ae=new Set(["aix","android","darwin","freebsd","haiku","linux","openbsd","sunos","win32","cygwin","netbsd"]);function ce(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return e.version!==1||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0||typeof e.platform!="string"||!ae.has(e.platform)||typeof e.startToken!="string"||e.startToken.trim()===""?null:{version:1,pid:e.pid,platform:e.platform,startToken:e.startToken}}function ue(t,e){return t.version===e.version&&t.pid===e.pid&&t.platform===e.platform&&t.startToken===e.startToken}import{execFileSync as de}from"child_process";import{platform as le}from"os";var G=new WeakMap,fe=1e3,F=16*1024;function Ne(t,e=me){if(!Number.isSafeInteger(t)||t<=0)return null;if(t===process.pid){let r=G.get(e);if(r)return r}try{let r=pe(t,e);if(!r)return null;let n={version:1,pid:t,platform:e.platform,startToken:r};return t===process.pid&&G.set(e,n),n}catch{return null}}function pe(t,e){if(e.platform==="linux"||e.platform==="android")return ge(e.readFile(`/proc/${t}/stat`));if(e.platform==="win32"){let r=`([DateTimeOffset](Get-Process -Id ${t} -ErrorAction Stop).StartTime).ToUnixTimeMilliseconds()`;return N(e.run("powershell.exe",["-NoProfile","-NonInteractive","-Command",r]))}return e.platform==="darwin"||e.platform==="freebsd"||e.platform==="openbsd"||e.platform==="netbsd"?N(e.run("ps",["-p",String(t),"-o","lstart="])):null}function ge(t){let e=t.lastIndexOf(")");if(e<0)return null;let n=t.slice(e+1).trim().split(/\s+/)[19];return n&&/^\d+$/.test(n)?n:null}function N(t){let e=t.trim();return e===""?null:e}var me={platform:le(),readFile(t){return R(t,{maxBytes:F,inputKind:"process identity pseudo-file"})},run(t,e){return de(t,[...e],{encoding:"utf8",timeout:fe,maxBuffer:F,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0})}};var je=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"],$e=["entry-surface","generated-code","compatibility-shim","reflection-or-registration","test-fixture","intentional-twin","historical-coupling-ended","detector-counterexample"];function Ue(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ke(t){return typeof t=="string"&&Number.isFinite(Date.parse(t))}function He(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>=0}function Je(t){return typeof t=="string"&&t.length>0&&t.length<=256&&!/[\0\r\n]/u.test(t)}function Ye(t){return typeof t=="number"&&Number.isFinite(t)&&t>=0}export{E as a,p as b,Ce as c,Se as d,ke as e,q as f,Re as g,Pe as h,g as i,d as j,Te as k,B as l,A as m,te as n,re as o,u as p,O as q,S as r,ne as s,ie as t,oe as u,L as v,se as w,ce as x,ue as y,Ne as z,je as A,$e as B,Ue as C,Ke as D,He as E,Je as F,Ye as G};
4
+ //# sourceMappingURL=chunk-KPMMOAV5.js.map
@@ -1,7 +1,7 @@
1
- import{a as A}from"./chunk-QMOZZ2VX.js";import{a as T,b,c as W}from"./chunk-NBZKSTXP.js";import{a as R}from"./chunk-DGXRDLV5.js";import{a as N}from"./chunk-B75HZHUP.js";import{b as C,c as j}from"./chunk-HENP2O4A.js";import{a as _}from"./chunk-BGBBVSH4.js";import{b as E}from"./chunk-J7AMBVWF.js";import{A as P,d,e as w,k}from"./chunk-GVAF222T.js";import{i as L}from"./chunk-F74LZWCE.js";import{d as x}from"./chunk-3LCDIREB.js";import{basename as m,extname as I}from"path";function ce(t,n){let{scope:e,maxLoc:i=15,limit:r=30,scanLimit:o}=n??{},a=new j(t),l=K(a.fileDependencyGraph(e));return R({candidates:()=>z(t,a,e,i),orderCandidates:N,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:c=>({...J(t,a,c,{semantic:n?.semantic!==!1}),reverseFanIn:l}),evaluate:(c,u)=>q(t,a,c,u),orderResults:(c,u)=>u.callerFanIn-c.callerFanIn||u.loc-c.loc,limit:r})}function J(t,n,e,i){let r=T(t,n),o=b(r.forDefinitions(e,{semantic:!1,sourceFallback:!1})),a=[];i.semantic&&x("wrapper.semantic-candidates",()=>{a=e.filter(s=>y(t,n,s,o).length<=1)},()=>({symbols:e.length,semanticCandidates:a.length}));let l=r.forDefinitions(a,{semantic:!0,sourceFallback:!1}),c=b(l),u=new Set([...l.values()].filter(s=>s.semanticIncomplete).map(s=>s.definition.symbolId)),f=new Set([...l.values()].filter(s=>s.semanticUnavailable).map(s=>s.definition.symbolId)),g=c.size===0?o:C(o,c),h=new Map(e.map(s=>[s.symbolId,s])),S=new Map;for(let s of e){let F=y(t,n,s,g);if(F.length>1||(S.set(s.symbolId,s),F.length!==1))continue;let D=F[0],v=O(t,s.symbolId,D);if(!v)continue;let p=B(n,t,D,s.symbol,v);p?.isFunctionLike&&h.has(p.symbolId)&&S.set(p.symbolId,h.get(p.symbolId))}let M=[...S.values()];return{callerFileMap:M.length===0?g:C(g,b(r.forDefinitions(M,{semantic:!1,sourceFallback:!0}))),incompleteSymbolIds:u,unavailableSymbolIds:f}}function q(t,n,e,i){if(i.incompleteSymbolIds.has(e.symbolId)||i.unavailableSymbolIds.has(e.symbolId))return null;let r=y(t,n,e,i.callerFileMap);if(r.length!==1)return null;let o=r[0],a=O(t,e.symbolId,o);if(!a)return null;let l=B(n,t,o,e.symbol,a);if(l&&k(l.symbol))return null;let{fanIn:c,source:u}=G(i.callerFileMap,i.reverseFanIn,o,l);if(u==="function"?c<=3:c<=5)return null;let f=Q(t,e,o,l);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:_(e),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?d(l.symbol):m(o),callerFanIn:c,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function z(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(r=>!L(t,r))}function y(t,n,e,i){let r=m(e.relativePath,I(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(a=>a!==e.relativePath).filter(a=>m(a,I(a))!==r).filter(a=>{let l=n.fileKind(a);return l!=="barrel"&&l!=="entry"&&l!=="test"});return W(t,e,o).realConsumers}function O(t,n,e){return t.get(`SELECT c.start_line, c.end_line
1
+ import{a as A}from"./chunk-MFMHD36E.js";import{a as T,b,c as W}from"./chunk-GWESWURK.js";import{a as R}from"./chunk-DGXRDLV5.js";import{a as N}from"./chunk-B75HZHUP.js";import{b as C,c as j}from"./chunk-UHFZDQZJ.js";import{a as _}from"./chunk-BGBBVSH4.js";import{b as E}from"./chunk-NB2DAVPP.js";import{A as P,d,e as w,k}from"./chunk-TNLOX4TN.js";import{i as L}from"./chunk-RGBZDOUO.js";import{d as x}from"./chunk-3LCDIREB.js";import{basename as m,extname as I}from"path";function ce(t,n){let{scope:e,maxLoc:i=15,limit:r=30,scanLimit:o}=n??{},a=new j(t),l=K(a.fileDependencyGraph(e));return R({candidates:()=>z(t,a,e,i),orderCandidates:N,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:c=>({...J(t,a,c,{semantic:n?.semantic!==!1}),reverseFanIn:l}),evaluate:(c,u)=>q(t,a,c,u),orderResults:(c,u)=>u.callerFanIn-c.callerFanIn||u.loc-c.loc,limit:r})}function J(t,n,e,i){let r=T(t,n),o=b(r.forDefinitions(e,{semantic:!1,sourceFallback:!1})),a=[];i.semantic&&x("wrapper.semantic-candidates",()=>{a=e.filter(s=>y(t,n,s,o).length<=1)},()=>({symbols:e.length,semanticCandidates:a.length}));let l=r.forDefinitions(a,{semantic:!0,sourceFallback:!1}),c=b(l),u=new Set([...l.values()].filter(s=>s.semanticIncomplete).map(s=>s.definition.symbolId)),f=new Set([...l.values()].filter(s=>s.semanticUnavailable).map(s=>s.definition.symbolId)),g=c.size===0?o:C(o,c),h=new Map(e.map(s=>[s.symbolId,s])),S=new Map;for(let s of e){let F=y(t,n,s,g);if(F.length>1||(S.set(s.symbolId,s),F.length!==1))continue;let D=F[0],v=O(t,s.symbolId,D);if(!v)continue;let p=B(n,t,D,s.symbol,v);p?.isFunctionLike&&h.has(p.symbolId)&&S.set(p.symbolId,h.get(p.symbolId))}let M=[...S.values()];return{callerFileMap:M.length===0?g:C(g,b(r.forDefinitions(M,{semantic:!1,sourceFallback:!0}))),incompleteSymbolIds:u,unavailableSymbolIds:f}}function q(t,n,e,i){if(i.incompleteSymbolIds.has(e.symbolId)||i.unavailableSymbolIds.has(e.symbolId))return null;let r=y(t,n,e,i.callerFileMap);if(r.length!==1)return null;let o=r[0],a=O(t,e.symbolId,o);if(!a)return null;let l=B(n,t,o,e.symbol,a);if(l&&k(l.symbol))return null;let{fanIn:c,source:u}=G(i.callerFileMap,i.reverseFanIn,o,l);if(u==="function"?c<=3:c<=5)return null;let f=Q(t,e,o,l);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:_(e),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?d(l.symbol):m(o),callerFanIn:c,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function z(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(r=>!L(t,r))}function y(t,n,e,i){let r=m(e.relativePath,I(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(a=>a!==e.relativePath).filter(a=>m(a,I(a))!==r).filter(a=>{let l=n.fileKind(a);return l!=="barrel"&&l!=="entry"&&l!=="test"});return W(t,e,o).realConsumers}function O(t,n,e){return t.get(`SELECT c.start_line, c.end_line
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d ON c.document_id = d.id
5
5
  WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
6
  LIMIT 1`,n,e)}function B(t,n,e,i,r){let o=t.definitionsForFile(e),a=H(n,e,i,r.start_line,r.end_line);return P(o,a)}function G(t,n,e,i){if(i?.isFunctionLike){let r=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(r.length>0)return{fanIn:r.length,source:"function"}}return{fanIn:U(n,e),source:"file"}}function H(t,n,e,i,r){let o=w(e);if(!o)return i;let a=E(t,n).get(o);if(!a||a.length===0)return i;for(let l of a)if(l>=i&&l<=r)return l;return i}function K(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let r of i)n.set(r,(n.get(r)??0)+1)}return n}function U(t,n){let e=t.get(n)??0;if(e>0)return e;let i=m(n,I(n)),r=0;for(let[o,a]of t)o!==n&&m(o,I(o))===i&&a>r&&(r=a);return r}function Q(t,n,e,i){return A(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):m(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ce as a};
7
- //# sourceMappingURL=chunk-GDHWOA57.js.map
7
+ //# sourceMappingURL=chunk-LKJZNGMA.js.map
@@ -1,2 +1,2 @@
1
- import{t as c}from"./chunk-GVAF222T.js";import{o as a}from"./chunk-F74LZWCE.js";var D=4;function m(e,i,t,r={}){return p(e,i,t,r.maxReexportDepth??D,0,new Set)}function p(e,i,t,r,s,o){let f=`${i}\0${t}`;if(o.has(f)||s>r)return[];o.add(f);let u=c(e,i).filter(n=>n.leaf===t);return u.length>0?u:a(e,i).flatMap(n=>n.sourcePath?n.kind==="named"&&!n.names.includes(t)?[]:p(e,n.sourcePath,t,r,s+1,new Set(o)):[])}export{m as a};
2
- //# sourceMappingURL=chunk-3VJ3OCRE.js.map
1
+ import{t as c}from"./chunk-TNLOX4TN.js";import{o as a}from"./chunk-RGBZDOUO.js";var D=4;function m(e,i,t,r={}){return p(e,i,t,r.maxReexportDepth??D,0,new Set)}function p(e,i,t,r,s,o){let f=`${i}\0${t}`;if(o.has(f)||s>r)return[];o.add(f);let u=c(e,i).filter(n=>n.leaf===t);return u.length>0?u:a(e,i).flatMap(n=>n.sourcePath?n.kind==="named"&&!n.names.includes(t)?[]:p(e,n.sourcePath,t,r,s+1,new Set(o)):[])}export{m as a};
2
+ //# sourceMappingURL=chunk-LMPOC372.js.map
@@ -1,4 +1,4 @@
1
- import{A as f,G as u}from"./chunk-UC2FD2PS.js";import b from"ignore";import{existsSync as y,readdirSync as v}from"fs";import{dirname as d,isAbsolute as m,join as l,relative as T,resolve as S}from"path";function E(n){let t=b();return _(n,t)||t.add(F),{isIgnored:e=>g(t,n,e),filter:e=>e.filter(i=>!g(t,n,i))}}function _(n,t){let r=new Set,e=(s,a)=>{if(!(r.has(s)||!y(s)))try{let c=u(s,{maxBytes:f,inputKind:"gitignore file"});t.add(a?$(c,a):c),r.add(s)}catch{}},i=d(n),o=0;for(;i!==d(i)&&o<5&&(e(l(i,".gitignore"),""),!y(l(i,".git")));)i=d(i),o++;return h(n,"",t,e),r.size>0}function h(n,t,r,e){let i=t?l(n,t):n;e(l(i,".gitignore"),t);let o;try{o=v(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;g(r,n,`${a}/`)||h(n,a,r,e)}}function $(n,t){let r=t.replaceAll("\\","/").replace(/\/+$/,"");return n.split(/\r?\n/).map(e=>A(e,r)).join(`
1
+ import{A as f,G as u}from"./chunk-6I55VYFG.js";import b from"ignore";import{existsSync as y,readdirSync as v}from"fs";import{dirname as d,isAbsolute as m,join as l,relative as T,resolve as S}from"path";function E(n){let t=b();return _(n,t)||t.add(F),{isIgnored:e=>g(t,n,e),filter:e=>e.filter(i=>!g(t,n,i))}}function _(n,t){let r=new Set,e=(s,a)=>{if(!(r.has(s)||!y(s)))try{let c=u(s,{maxBytes:f,inputKind:"gitignore file"});t.add(a?$(c,a):c),r.add(s)}catch{}},i=d(n),o=0;for(;i!==d(i)&&o<5&&(e(l(i,".gitignore"),""),!y(l(i,".git")));)i=d(i),o++;return h(n,"",t,e),r.size>0}function h(n,t,r,e){let i=t?l(n,t):n;e(l(i,".gitignore"),t);let o;try{o=v(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;g(r,n,`${a}/`)||h(n,a,r,e)}}function $(n,t){let r=t.replaceAll("\\","/").replace(/\/+$/,"");return n.split(/\r?\n/).map(e=>A(e,r)).join(`
2
2
  `)}function A(n,t){let r=n.trimStart();if(!r||r.startsWith("#"))return n;let e=n.slice(0,n.length-r.length),i=r.startsWith("!"),o=i?r.slice(1):r;if(!o||o.startsWith("#"))return n;let s=o.startsWith("/"),a=s?o.slice(1):o,p=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${t}/${a}`:`${t}/**/${a}`;return`${e}${i?"!":""}${p}`}var F=`
3
3
  # Dependencies
4
4
  node_modules/
@@ -57,4 +57,4 @@ Thumbs.db
57
57
  # Type definitions (often noise in queries)
58
58
  *.d.ts
59
59
  `;function g(n,t,r){let e=x(t,r);if(!e)return!1;try{return n.ignores(e)}catch{return!1}}function x(n,t){if(!t||t===".")return null;if(!m(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=m(t)?t:S(n,t),e=T(n,r).replaceAll("\\","/");return!e||e==="."||e.startsWith("..")?null:e}export{E as a};
60
- //# sourceMappingURL=chunk-F3QSL4W2.js.map
60
+ //# sourceMappingURL=chunk-LTPNP6D5.js.map