scip-query 0.19.5 → 0.19.8

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 (421) hide show
  1. package/CHANGELOG.md +85 -1
  2. package/README.md +259 -53
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/chunk-2465DLHK.js +3 -0
  5. package/dist/{chunk-7GXM52MI.js → chunk-24GTWJ3N.js} +2 -2
  6. package/dist/{chunk-NH5ALKPW.js → chunk-2SNGN6U4.js} +2 -2
  7. package/dist/{chunk-3SVWW4PN.js → chunk-2U3OLUNJ.js} +2 -2
  8. package/dist/{chunk-XLTP42QA.js → chunk-33KUO7CG.js} +2 -2
  9. package/dist/{chunk-54HA4ZXH.js → chunk-33XTHFKR.js} +2 -2
  10. package/dist/{chunk-ZGZUZ7XE.js → chunk-3EDFLQ6A.js} +2 -2
  11. package/dist/chunk-3ZSJ3PWF.js +16 -0
  12. package/dist/{chunk-F6O7AAC3.js → chunk-43KC6EQZ.js} +2 -2
  13. package/dist/{chunk-I5RJM53C.js → chunk-464PLI5O.js} +2 -2
  14. package/dist/chunk-46XGSFNI.js +2 -0
  15. package/dist/{chunk-M7AIS73L.js → chunk-47BU5Z4T.js} +2 -2
  16. package/dist/chunk-4BV4QAZJ.js +5 -0
  17. package/dist/chunk-4YTUWQ6M.js +18 -0
  18. package/dist/{chunk-RV2FQIX3.js → chunk-5ML2BNRH.js} +2 -2
  19. package/dist/{chunk-6NSFJYRC.js → chunk-5YLUDDAF.js} +2 -2
  20. package/dist/chunk-67QRR5YC.js +6 -0
  21. package/dist/{chunk-GPBBJ5Y4.js → chunk-6GXYN7YA.js} +3 -3
  22. package/dist/{chunk-4333ETTV.js → chunk-6M7RONVB.js} +2 -2
  23. package/dist/chunk-6YTSKJJ3.js +2 -0
  24. package/dist/{chunk-QDV6RDCP.js → chunk-7FT5Y65S.js} +2 -2
  25. package/dist/{chunk-XTX6QHOF.js → chunk-7KYNAMMH.js} +2 -2
  26. package/dist/{chunk-DZ74OMG6.js → chunk-7LSVMFX7.js} +2 -2
  27. package/dist/{chunk-VTKGCT3V.js → chunk-7QHY3H7P.js} +2 -2
  28. package/dist/{chunk-MITTUCEH.js → chunk-7RAG65VK.js} +2 -2
  29. package/dist/{chunk-25LPM4DG.js → chunk-7SWJEWJF.js} +2 -2
  30. package/dist/{chunk-52ZYCAEO.js → chunk-7VCOXZH3.js} +2 -2
  31. package/dist/chunk-A2TNXAXO.js +8 -0
  32. package/dist/{chunk-IUFDSKGG.js → chunk-A3QXWFBK.js} +2 -2
  33. package/dist/{chunk-4T3LTWUS.js → chunk-AA4UWRNL.js} +2 -2
  34. package/dist/{chunk-4SALD7RU.js → chunk-ACAM6O5R.js} +2 -2
  35. package/dist/chunk-APMMR5Y2.js +2 -0
  36. package/dist/chunk-AQOFWNQJ.js +1 -0
  37. package/dist/chunk-AZFUMCQB.js +2 -0
  38. package/dist/{chunk-M7MTH5NR.js → chunk-BDOIKGDI.js} +2 -2
  39. package/dist/{chunk-BTEE5NZQ.js → chunk-BNXICU42.js} +2 -2
  40. package/dist/chunk-C5Q44Q5D.js +3 -0
  41. package/dist/{chunk-EOOJGLDU.js → chunk-CTF2GDEX.js} +2 -2
  42. package/dist/chunk-DHEQMPLW.js +2 -0
  43. package/dist/{chunk-IZKFSVBV.js → chunk-DQBCO2UY.js} +2 -2
  44. package/dist/{chunk-7B3UPBVA.js → chunk-DQGSM7RZ.js} +2 -2
  45. package/dist/chunk-E2LAW7SL.js +30 -0
  46. package/dist/chunk-E3HYEQO7.js +2 -0
  47. package/dist/chunk-E4NFOAD4.js +6 -0
  48. package/dist/chunk-E5HNT4X2.js +3 -0
  49. package/dist/{chunk-J77UIT3I.js → chunk-ELLMY7XJ.js} +2 -2
  50. package/dist/chunk-FD3HFKXR.js +5 -0
  51. package/dist/{chunk-SOAT6NLA.js → chunk-FIJCV235.js} +2 -2
  52. package/dist/{chunk-H7UKLTWJ.js → chunk-FJ5UDTQF.js} +2 -2
  53. package/dist/{chunk-HEXVUYFQ.js → chunk-GHKEJTCE.js} +2 -2
  54. package/dist/{chunk-LBMJEAEW.js → chunk-GLZTVKAB.js} +3 -3
  55. package/dist/{chunk-FWUUZTIO.js → chunk-GNC4JVAN.js} +2 -2
  56. package/dist/chunk-HIB452NU.js +949 -0
  57. package/dist/{chunk-NRCXJDHL.js → chunk-HZYDQPNY.js} +2 -2
  58. package/dist/chunk-IF6FP6B2.js +66 -0
  59. package/dist/{chunk-4RSI5EMG.js → chunk-JAY7YWS3.js} +2 -2
  60. package/dist/{chunk-STOL2BTL.js → chunk-JHF3E4YM.js} +2 -2
  61. package/dist/chunk-JORHF5AL.js +108 -0
  62. package/dist/{chunk-A2EZV2UM.js → chunk-K2WO7XY7.js} +2 -2
  63. package/dist/chunk-KFZNKUNT.js +2 -0
  64. package/dist/{chunk-YVVCVR2L.js → chunk-KJ2IIBZN.js} +2 -2
  65. package/dist/{chunk-QGXBRIM5.js → chunk-KKME5ZAI.js} +2 -2
  66. package/dist/chunk-KSGTULOS.js +9 -0
  67. package/dist/{chunk-UOAV44HR.js → chunk-KXDJAG4N.js} +3 -3
  68. package/dist/{chunk-UKZBVX4U.js → chunk-L4S2A7BV.js} +2 -2
  69. package/dist/chunk-LP3ARJKF.js +8 -0
  70. package/dist/chunk-LSOR3LQG.js +3 -0
  71. package/dist/{chunk-Q4IIEGXJ.js → chunk-MLFZP76A.js} +2 -2
  72. package/dist/{chunk-WQTAC523.js → chunk-MNSTUIDD.js} +2 -2
  73. package/dist/{chunk-VXQNNXJE.js → chunk-MSBDMFER.js} +2 -2
  74. package/dist/{chunk-X6D5IC6I.js → chunk-MZZBAITE.js} +5 -5
  75. package/dist/{chunk-I5AWSI2G.js → chunk-NE3TZUCI.js} +2 -2
  76. package/dist/{chunk-6E7UTQY7.js → chunk-NTUMF2X3.js} +2 -2
  77. package/dist/{chunk-S44IULR6.js → chunk-O23I56NA.js} +2 -2
  78. package/dist/{chunk-CFMXJPHH.js → chunk-O3O4XXO6.js} +2 -2
  79. package/dist/{chunk-IG7N5ZIK.js → chunk-OUBAF226.js} +2 -2
  80. package/dist/chunk-P3UO3EH3.js +2 -0
  81. package/dist/{chunk-YNRNA5LK.js → chunk-QGGLL3UH.js} +2 -2
  82. package/dist/chunk-QIQ63BHW.js +16 -0
  83. package/dist/{chunk-VGRICIQI.js → chunk-QJIVBYEK.js} +2 -2
  84. package/dist/chunk-QOXBSI6G.js +20 -0
  85. package/dist/chunk-QXK6UUSM.js +2 -0
  86. package/dist/{chunk-XYADIZHU.js → chunk-RA3AYNWP.js} +2 -2
  87. package/dist/chunk-RJMDJR3A.js +2 -0
  88. package/dist/{chunk-NSS46APD.js → chunk-RLH5VUMG.js} +2 -2
  89. package/dist/{chunk-GBQ5NYPR.js → chunk-S4S2WOIX.js} +6 -6
  90. package/dist/{chunk-YIJ7ZAA4.js → chunk-SERUIGV5.js} +2 -2
  91. package/dist/{chunk-FECYOO5O.js → chunk-SMQWE25B.js} +2 -2
  92. package/dist/{chunk-R4FQGQ4X.js → chunk-TAVELHYR.js} +2 -2
  93. package/dist/{chunk-U6WNH5GC.js → chunk-TWMJ3Y3G.js} +2 -2
  94. package/dist/chunk-VAXNI5NE.js +146 -0
  95. package/dist/chunk-VVY2G5ET.js +2 -0
  96. package/dist/{chunk-WER3B7MI.js → chunk-W3DBTGL4.js} +2 -2
  97. package/dist/{chunk-CNKAGUPL.js → chunk-WANA4KAQ.js} +2 -2
  98. package/dist/chunk-WJL2L6MV.js +60 -0
  99. package/dist/chunk-WUW7YUAH.js +11 -0
  100. package/dist/{chunk-QVWS2VWZ.js → chunk-WWKWUPSU.js} +2 -2
  101. package/dist/{chunk-ABMYA4TN.js → chunk-WY45BHKQ.js} +2 -2
  102. package/dist/chunk-X4FR5BZF.js +9 -0
  103. package/dist/chunk-X6RKPDY7.js +2 -0
  104. package/dist/{chunk-ZXJYMGD3.js → chunk-YLFORA5G.js} +2 -2
  105. package/dist/{chunk-KP6XRY5Z.js → chunk-YTVWB7YJ.js} +2 -2
  106. package/dist/{chunk-4XTA5OMB.js → chunk-ZCEJ63SP.js} +2 -2
  107. package/dist/{chunk-HKEHS2AS.js → chunk-ZJ5CBXK3.js} +2 -2
  108. package/dist/chunk-ZL2OGDCD.js +2 -0
  109. package/dist/cli.js +8 -3
  110. package/dist/command-descriptors-ZW5J4ZEM.js +631 -0
  111. package/dist/{config-types-D20KuvvZ.d.ts → config-types-B6MEoRNy.d.ts} +8 -0
  112. package/dist/{db-G_II8yXU.d.ts → db-DYLKr9Wn.d.ts} +18 -1
  113. package/dist/direct-navigation-42YHQPOI.js +3 -0
  114. package/dist/{health-oblXYgkF.d.ts → health-DgxIDXJC.d.ts} +1 -1
  115. package/dist/index.d.ts +2 -2
  116. package/dist/index.js +1 -1
  117. package/dist/postinstall.js +1 -1
  118. package/dist/queries/affected.d.ts +2 -2
  119. package/dist/queries/affected.js +1 -1
  120. package/dist/queries/architecture.d.ts +2 -2
  121. package/dist/queries/architecture.js +1 -1
  122. package/dist/queries/bottlenecks.d.ts +2 -2
  123. package/dist/queries/bottlenecks.js +1 -1
  124. package/dist/queries/by-kind.d.ts +2 -2
  125. package/dist/queries/by-kind.js +1 -1
  126. package/dist/queries/call-graph.d.ts +2 -2
  127. package/dist/queries/call-graph.js +1 -1
  128. package/dist/queries/change-surface.d.ts +2 -2
  129. package/dist/queries/change-surface.js +1 -1
  130. package/dist/queries/cleanup-plan.d.ts +2 -2
  131. package/dist/queries/cleanup-plan.js +1 -1
  132. package/dist/queries/co-change.d.ts +2 -2
  133. package/dist/queries/co-change.js +1 -1
  134. package/dist/queries/code.d.ts +2 -2
  135. package/dist/queries/code.js +1 -1
  136. package/dist/queries/complexity-hotspots.d.ts +2 -2
  137. package/dist/queries/complexity-hotspots.js +1 -1
  138. package/dist/queries/complexity.d.ts +2 -2
  139. package/dist/queries/complexity.js +1 -1
  140. package/dist/queries/convergence.d.ts +2 -2
  141. package/dist/queries/convergence.js +1 -1
  142. package/dist/queries/coupling.d.ts +2 -2
  143. package/dist/queries/coupling.js +1 -1
  144. package/dist/queries/cycles.d.ts +2 -2
  145. package/dist/queries/cycles.js +1 -1
  146. package/dist/queries/dataflow.d.ts +2 -2
  147. package/dist/queries/dataflow.js +1 -1
  148. package/dist/queries/dead.d.ts +2 -2
  149. package/dist/queries/dead.js +1 -1
  150. package/dist/queries/decorative-checkers.d.ts +3 -3
  151. package/dist/queries/decorative-checkers.js +1 -1
  152. package/dist/queries/deep-chains.d.ts +2 -2
  153. package/dist/queries/deep-chains.js +1 -1
  154. package/dist/queries/deps.d.ts +2 -2
  155. package/dist/queries/deps.js +1 -1
  156. package/dist/queries/diff-gate.d.ts +30 -2
  157. package/dist/queries/diff-gate.js +1 -1
  158. package/dist/queries/diff-impact.d.ts +2 -2
  159. package/dist/queries/diff-impact.js +1 -1
  160. package/dist/queries/doc-drift.d.ts +2 -2
  161. package/dist/queries/doc-drift.js +1 -1
  162. package/dist/queries/drift.d.ts +2 -2
  163. package/dist/queries/drift.js +1 -1
  164. package/dist/queries/duplicate-bodies.d.ts +2 -2
  165. package/dist/queries/duplicate-bodies.js +1 -1
  166. package/dist/queries/extract-candidates.d.ts +2 -2
  167. package/dist/queries/extract-candidates.js +1 -1
  168. package/dist/queries/fan.d.ts +2 -2
  169. package/dist/queries/fan.js +1 -1
  170. package/dist/queries/files.d.ts +2 -2
  171. package/dist/queries/health.d.ts +3 -3
  172. package/dist/queries/health.js +1 -1
  173. package/dist/queries/hierarchy.d.ts +2 -2
  174. package/dist/queries/hierarchy.js +1 -1
  175. package/dist/queries/hotspots.d.ts +2 -2
  176. package/dist/queries/hotspots.js +1 -1
  177. package/dist/queries/imports.d.ts +2 -2
  178. package/dist/queries/imports.js +1 -1
  179. package/dist/queries/incomplete-migration.d.ts +2 -2
  180. package/dist/queries/incomplete-migration.js +1 -1
  181. package/dist/queries/index.d.ts +17 -3
  182. package/dist/queries/index.js +1 -1
  183. package/dist/queries/isolated.d.ts +2 -2
  184. package/dist/queries/isolated.js +1 -1
  185. package/dist/queries/locality-candidates.d.ts +2 -2
  186. package/dist/queries/locality-candidates.js +1 -1
  187. package/dist/queries/members.d.ts +2 -2
  188. package/dist/queries/members.js +1 -1
  189. package/dist/queries/methods.d.ts +2 -2
  190. package/dist/queries/methods.js +1 -1
  191. package/dist/queries/not-implemented.d.ts +3 -3
  192. package/dist/queries/not-implemented.js +1 -1
  193. package/dist/queries/outline.d.ts +2 -2
  194. package/dist/queries/outline.js +1 -1
  195. package/dist/queries/passthrough-candidates.d.ts +2 -2
  196. package/dist/queries/passthrough-candidates.js +1 -1
  197. package/dist/queries/plan-context.d.ts +2 -2
  198. package/dist/queries/plan-context.js +1 -1
  199. package/dist/queries/react-component-duplicates.d.ts +2 -2
  200. package/dist/queries/react-component-duplicates.js +1 -1
  201. package/dist/queries/react-hook-candidates.d.ts +2 -2
  202. package/dist/queries/react-hook-candidates.js +1 -1
  203. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  204. package/dist/queries/react-large-component-pressure.js +1 -1
  205. package/dist/queries/recent-duplicates.d.ts +2 -2
  206. package/dist/queries/recent-duplicates.js +1 -1
  207. package/dist/queries/redundant-reexports.d.ts +2 -2
  208. package/dist/queries/redundant-reexports.js +1 -1
  209. package/dist/queries/refs.d.ts +2 -2
  210. package/dist/queries/refs.js +1 -1
  211. package/dist/queries/self-audit.d.ts +2 -2
  212. package/dist/queries/self-audit.js +1 -1
  213. package/dist/queries/similar-chains.d.ts +2 -2
  214. package/dist/queries/similar-chains.js +1 -1
  215. package/dist/queries/similar-files.d.ts +2 -2
  216. package/dist/queries/similar-files.js +1 -1
  217. package/dist/queries/similar-signatures.d.ts +2 -2
  218. package/dist/queries/similar-signatures.js +1 -1
  219. package/dist/queries/similar.d.ts +2 -2
  220. package/dist/queries/similar.js +1 -1
  221. package/dist/queries/slice.d.ts +2 -2
  222. package/dist/queries/slice.js +1 -1
  223. package/dist/queries/stale-abstractions.d.ts +2 -2
  224. package/dist/queries/stale-abstractions.js +1 -1
  225. package/dist/queries/stats.d.ts +2 -2
  226. package/dist/queries/stats.js +1 -1
  227. package/dist/queries/surface.d.ts +2 -2
  228. package/dist/queries/surface.js +1 -1
  229. package/dist/queries/symbols.d.ts +2 -2
  230. package/dist/queries/symbols.js +1 -1
  231. package/dist/queries/system.d.ts +2 -2
  232. package/dist/queries/system.js +1 -1
  233. package/dist/queries/test-quality.d.ts +2 -2
  234. package/dist/queries/test-quality.js +1 -1
  235. package/dist/queries/trace.d.ts +2 -2
  236. package/dist/queries/trace.js +1 -1
  237. package/dist/queries/twin-ab.d.ts +3 -3
  238. package/dist/queries/twin-ab.js +1 -1
  239. package/dist/queries/twin-drift.d.ts +2 -2
  240. package/dist/queries/twin-drift.js +1 -1
  241. package/dist/queries/unused-imports.d.ts +2 -2
  242. package/dist/queries/unused-imports.js +1 -1
  243. package/dist/queries/unused-params.d.ts +2 -2
  244. package/dist/queries/unused-params.js +1 -1
  245. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  246. package/dist/queries/vue-component-duplicates.js +1 -1
  247. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  248. package/dist/queries/vue-composable-candidates.js +1 -1
  249. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  250. package/dist/queries/vue-large-view-pressure.js +1 -1
  251. package/dist/queries/wrapper-candidates.d.ts +2 -2
  252. package/dist/queries/wrapper-candidates.js +1 -1
  253. package/dist/reindex-worker.js +26 -26
  254. package/dist/reindex.d.ts +14 -4
  255. package/dist/reindex.js +34 -38
  256. package/dist/runtime.d.ts +167 -18
  257. package/dist/runtime.js +3 -2
  258. package/dist/rust-semantic-session-server.js +1 -1
  259. package/dist/rust-semantic-session-worker.js +1 -1
  260. package/dist/rust-semantic-worker.js +1 -1
  261. package/dist/{scip-cli-kRpaexVJ.d.ts → scip-cli-Cc6c00-a.d.ts} +6 -2
  262. package/dist/watch-server.js +5 -5
  263. package/docs/AGENT_GUIDE.md +20 -4
  264. package/docs/AI_FAILURE_MODES.md +17 -17
  265. package/docs/API_EVOLUTION.md +71 -0
  266. package/docs/CLI_JSON_OUTPUT.md +168 -0
  267. package/docs/COMMAND_REFERENCE.md +10 -6
  268. package/docs/COMMITTED_RECORD_COMPATIBILITY.md +117 -0
  269. package/docs/CONFIGURATION_WRITE_SAFETY.md +130 -0
  270. package/docs/DETECTOR_GUIDE.md +46 -46
  271. package/docs/DURABILITY.md +103 -0
  272. package/docs/INDEX_GENERATIONS.md +121 -0
  273. package/docs/LOCK_PROTOCOL.md +133 -0
  274. package/docs/MAILBOX_LIFECYCLE.md +197 -0
  275. package/docs/REINDEX_METADATA_COMPATIBILITY.md +84 -0
  276. package/docs/RUST_DURABLE_SESSION_PROTOCOL.md +126 -0
  277. package/docs/SECURITY_MODEL.md +129 -0
  278. package/docs/TELEMETRY_RETENTION.md +77 -0
  279. package/docs/TIME_SEMANTICS.md +77 -0
  280. package/docs/WATCH_REFRESH_REQUESTS.md +110 -0
  281. package/docs/WINDOWS_SIDECAR_RELEASE.md +298 -0
  282. package/docs/analyzer-validation-ledger.md +24 -23
  283. package/docs/schemas/cli-json-envelope.schema.json +53 -0
  284. package/docs/schemas/cli-output-page.schema.json +104 -0
  285. package/docs/schemas/npm-release-state.schema.json +146 -0
  286. package/docs/schemas/outcome-event-record.schema.json +39 -0
  287. package/docs/schemas/project-config.schema.json +247 -0
  288. package/docs/schemas/suppression-record.schema.json +31 -0
  289. package/docs/schemas/windows-sidecar-provenance.schema.json +137 -0
  290. package/package.json +21 -10
  291. package/scripts/build-scip-windows.mjs +180 -61
  292. package/scripts/scip-windows-provenance.mjs +364 -0
  293. package/scripts/verify-scip-windows.mjs +29 -0
  294. package/skills/_shared/SKILL.md +90 -229
  295. package/skills/_shared/agents/openai.yaml +1 -1
  296. package/skills/_shared/references/agent-contract-catalog.md +105 -0
  297. package/skills/_shared/references/command-catalog.md +118 -0
  298. package/skills/_shared/references/detector-precision-and-diffgate.md +59 -0
  299. package/skills/_shared/references/evidence-and-dead-code.md +25 -0
  300. package/skills/scip-audit/SKILL.md +77 -0
  301. package/skills/scip-audit/agents/openai.yaml +4 -0
  302. package/skills/scip-audit/references/claims.md +98 -0
  303. package/skills/scip-audit/references/cleanup.md +101 -0
  304. package/skills/scip-audit/references/directory.md +222 -0
  305. package/skills/scip-audit/references/frontend.md +130 -0
  306. package/skills/scip-audit/references/integrity.md +154 -0
  307. package/skills/scip-audit/references/maintainability.md +162 -0
  308. package/skills/scip-audit/references/twin-drift.md +104 -0
  309. package/skills/scip-diagnose/SKILL.md +52 -0
  310. package/skills/scip-diagnose/agents/openai.yaml +4 -0
  311. package/skills/scip-diagnose/references/debug.md +117 -0
  312. package/skills/{scip-probe-reachability/SKILL.md → scip-diagnose/references/probe-reachability.md} +11 -27
  313. package/skills/scip-diagnose/references/root-cause.md +145 -0
  314. package/skills/scip-diagnose/references/triage.md +119 -0
  315. package/skills/scip-explore/SKILL.md +54 -85
  316. package/skills/scip-explore/agents/openai.yaml +2 -2
  317. package/skills/scip-explore/references/diagrams.md +40 -0
  318. package/skills/scip-explore/references/language-playbook.md +49 -0
  319. package/skills/scip-improve/SKILL.md +56 -0
  320. package/skills/scip-improve/agents/openai.yaml +4 -0
  321. package/skills/scip-improve/references/cleanup-batches.md +53 -0
  322. package/skills/scip-improve/references/directory-moves.md +53 -0
  323. package/skills/scip-improve/references/doc-reconcile.md +30 -0
  324. package/skills/scip-improve/references/frontend-extraction.md +39 -0
  325. package/skills/scip-improve/references/maintainability-mechanism.md +43 -0
  326. package/skills/scip-improve/references/twin-drift.md +35 -0
  327. package/skills/scip-plan/SKILL.md +68 -0
  328. package/skills/scip-plan/agents/openai.yaml +4 -0
  329. package/skills/scip-plan/references/api-impact.md +19 -0
  330. package/skills/scip-plan/references/conductor.md +41 -0
  331. package/skills/scip-plan/references/high-assurance.md +43 -0
  332. package/skills/scip-plan/references/hyper-optimization.md +50 -0
  333. package/skills/scip-plan/references/tla-model.md +88 -0
  334. package/skills/scip-query/SKILL.md +53 -98
  335. package/skills/scip-query/agents/openai.yaml +2 -2
  336. package/skills/scip-setup/SKILL.md +69 -181
  337. package/skills/scip-setup/agents/openai.yaml +3 -3
  338. package/skills/scip-setup/references/bootstrap-workflow.md +120 -0
  339. package/skills/scip-setup/references/language-verification.md +61 -0
  340. package/skills/scip-setup/references/lifecycle-commands.md +119 -0
  341. package/skills/scip-setup/references/per-repo-triage.md +24 -0
  342. package/skills/scip-verify/SKILL.md +126 -84
  343. package/skills/scip-verify/agents/openai.yaml +2 -2
  344. package/skills/scip-verify/references/calibrate-detectors.md +170 -0
  345. package/dist/chunk-2CTX5CMX.js +0 -4
  346. package/dist/chunk-2Y373BDD.js +0 -2
  347. package/dist/chunk-2YU7I3QO.js +0 -2
  348. package/dist/chunk-3MJ5YA4Y.js +0 -16
  349. package/dist/chunk-64RFXJT5.js +0 -16
  350. package/dist/chunk-7UY7SD7D.js +0 -927
  351. package/dist/chunk-B5NLK2B3.js +0 -6
  352. package/dist/chunk-C2QSK7E7.js +0 -2
  353. package/dist/chunk-C7NIYIQ4.js +0 -67
  354. package/dist/chunk-D4U5Q3FT.js +0 -7
  355. package/dist/chunk-DGAGY7RJ.js +0 -60
  356. package/dist/chunk-DLWR3NUU.js +0 -5
  357. package/dist/chunk-K2ERX4UT.js +0 -3
  358. package/dist/chunk-KHE7J5ZN.js +0 -3
  359. package/dist/chunk-L7SPDE73.js +0 -84
  360. package/dist/chunk-LHMNRHGV.js +0 -3
  361. package/dist/chunk-LM72NQ7T.js +0 -3
  362. package/dist/chunk-MSWVMDAH.js +0 -122
  363. package/dist/chunk-NH7WNNQC.js +0 -20
  364. package/dist/chunk-NPKYOIFM.js +0 -18
  365. package/dist/chunk-NZL2DBT7.js +0 -2
  366. package/dist/chunk-OMPZHGHO.js +0 -2
  367. package/dist/chunk-P2PC2WGR.js +0 -2
  368. package/dist/chunk-Q3AFUTGB.js +0 -8
  369. package/dist/chunk-QRGV2F7L.js +0 -2
  370. package/dist/chunk-TW4OG5FC.js +0 -4
  371. package/dist/chunk-U7DSEKOM.js +0 -30
  372. package/dist/chunk-V27BEQJN.js +0 -7
  373. package/dist/chunk-XAGAZSFE.js +0 -6
  374. package/dist/chunk-XBN5VO53.js +0 -2
  375. package/dist/chunk-YGAGTIDK.js +0 -11
  376. package/dist/command-descriptors-N2TL4XM2.js +0 -613
  377. package/dist/direct-navigation-DUCZCTOE.js +0 -3
  378. package/skills/scip-api-impact/SKILL.md +0 -140
  379. package/skills/scip-api-impact/agents/openai.yaml +0 -4
  380. package/skills/scip-calibrate/SKILL.md +0 -131
  381. package/skills/scip-calibrate/agents/openai.yaml +0 -4
  382. package/skills/scip-claim-audit/SKILL.md +0 -107
  383. package/skills/scip-claim-audit/agents/openai.yaml +0 -4
  384. package/skills/scip-cleanup-audit/SKILL.md +0 -130
  385. package/skills/scip-cleanup-audit/agents/openai.yaml +0 -4
  386. package/skills/scip-cleanup-improve/SKILL.md +0 -85
  387. package/skills/scip-cleanup-improve/agents/openai.yaml +0 -4
  388. package/skills/scip-concrete-plan/HIGH_ASSURANCE.md +0 -317
  389. package/skills/scip-concrete-plan/SKILL.md +0 -105
  390. package/skills/scip-concrete-plan/agents/openai.yaml +0 -4
  391. package/skills/scip-conductor/SKILL.md +0 -133
  392. package/skills/scip-conductor/agents/openai.yaml +0 -4
  393. package/skills/scip-debug/SKILL.md +0 -130
  394. package/skills/scip-debug/agents/openai.yaml +0 -4
  395. package/skills/scip-diagram/SKILL.md +0 -110
  396. package/skills/scip-diagram/agents/openai.yaml +0 -4
  397. package/skills/scip-directory-architecture/SKILL.md +0 -266
  398. package/skills/scip-directory-architecture/agents/openai.yaml +0 -4
  399. package/skills/scip-doc-reconcile/SKILL.md +0 -89
  400. package/skills/scip-doc-reconcile/agents/openai.yaml +0 -4
  401. package/skills/scip-hyper-optimization/SKILL.md +0 -156
  402. package/skills/scip-hyper-optimization/agents/openai.yaml +0 -4
  403. package/skills/scip-integrity-audit/SKILL.md +0 -152
  404. package/skills/scip-integrity-audit/agents/openai.yaml +0 -4
  405. package/skills/scip-language-playbook/SKILL.md +0 -106
  406. package/skills/scip-language-playbook/agents/openai.yaml +0 -4
  407. package/skills/scip-maintainability/SKILL.md +0 -158
  408. package/skills/scip-maintainability/agents/openai.yaml +0 -4
  409. package/skills/scip-probe-reachability/agents/openai.yaml +0 -4
  410. package/skills/scip-react-maintainability/SKILL.md +0 -101
  411. package/skills/scip-react-maintainability/agents/openai.yaml +0 -4
  412. package/skills/scip-root-cause/SKILL.md +0 -151
  413. package/skills/scip-root-cause/agents/openai.yaml +0 -4
  414. package/skills/scip-tla-model-system/SKILL.md +0 -148
  415. package/skills/scip-tla-model-system/agents/openai.yaml +0 -4
  416. package/skills/scip-triage-issue/SKILL.md +0 -133
  417. package/skills/scip-triage-issue/agents/openai.yaml +0 -4
  418. package/skills/scip-twin-drift/SKILL.md +0 -109
  419. package/skills/scip-twin-drift/agents/openai.yaml +0 -4
  420. package/skills/scip-vue-maintainability/SKILL.md +0 -107
  421. package/skills/scip-vue-maintainability/agents/openai.yaml +0 -4
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{$c as A,Aa as D,Ba as b,Cd as me,Dd as ge,Ea as se,Fa as E,Ga as M,Na as oe,Oa as ae,Qa as R,Ra as G,Rd as ye,Sa as ce,Sd as Se,Ua as j,Va as de,Wa as ue,Yd as ve,Za as N,ad as le,bd as pe,f as I,id as $,ld as F,md as he,n as re,nd as H,od as fe,x as v,xa as y,ya as ne,za as ie}from"./chunk-HIB452NU.js";import{spawn as dt}from"child_process";import{existsSync as ut,rmSync as ke}from"fs";import{dirname as lt,resolve as L}from"path";import{fileURLToPath as pt}from"url";import{createHash as He,randomUUID as Ie}from"crypto";import{existsSync as Ve,linkSync as Ue,mkdirSync as Re,readdirSync as Be,rmSync as ze}from"fs";import{basename as Ke,dirname as Je,join as S}from"path";var T=1,Ye=10*6e4,_t=10080*6e4,V="requests",Qe="claims",Xe="completions",Ze="staging";function we(e,t,r={}){let n=r.now?.()??new Date,i=ot(r.ttlMs),s=at(r.idempotencyKey),a=s?`key-${He("sha256").update(s).digest("hex")}`:`request-${(r.randomId??Ie)()}`,o={version:T,requestId:a,...s?{idempotencyKey:s}:{},createdAt:n.toISOString(),deadlineAt:new Date(n.getTime()+i).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},c=st(e,a);if(rt(e,c,o,r.onStage))return{disposition:"accepted",request:o};let u=U(c);if(!u)throw new Error(`Watch refresh request identity ${a} exists but is malformed.`);return{disposition:"duplicate",request:u}}function Lt(e){let t=nt(e),r=new Map,n=it(S(e,V),U);for(let c of P(S(e,Xe))){let d=tt(c);if(!d){n++;continue}r.set(d.requestId,d)}let i=new Set;for(let c of P(S(e,Qe))){let d=et(c);if(!d){n++;continue}i.add(d.requestId)}let s=t.filter(c=>!r.has(c.requestId)&&!i.has(c.requestId)),a=[...r.values()].filter(c=>c.outcome==="completed").length,o=[...r.values()].filter(c=>c.outcome==="expired").length;return{pending:s.length,claimed:t.filter(c=>!r.has(c.requestId)&&i.has(c.requestId)).length,completed:a,expired:o,invalid:n,...s.length>0?{oldestPendingAt:s.map(c=>c.createdAt).reduce((c,d)=>ct(c,d))}:{}}}function U(e){return B(e,t=>{let r=t;return r.version===T&&w(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&I(r.createdAt)&&I(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function et(e){return B(e,t=>{let r=t;return r.version===T&&w(r.requestId)&&w(r.claimId)&&I(r.claimedAt)})}function tt(e){return B(e,t=>{let r=t;return r.version===T&&w(r.requestId)&&(r.claimId===void 0||w(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&I(r.completedAt)})}function rt(e,t,r,n){let i=S(e,Ze),s=Je(t);Re(i,{recursive:!0}),Re(s,{recursive:!0});let a=S(i,`${Ke(t)}.${process.pid}.${Ie()}.tmp`);try{M(a,r,{spacing:2,trailingNewline:!0}),n?.("after-staged");try{Ue(a,t)}catch(o){if(o.code==="EEXIST")return!1;throw o}return se(s),n?.("after-published"),!0}finally{ze(a,{force:!0})}}function nt(e){let t=[];for(let r of P(S(e,V))){let n=U(r);n&&t.push(n)}return t}function it(e,t){return P(e).filter(r=>!t(r)).length}function P(e,t=".json"){return Ve(e)?Be(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>S(e,r.name)).sort():[]}function B(e,t){try{let r=JSON.parse(v(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function st(e,t){return S(e,V,`${t}.json`)}function ot(e){if(e===void 0)return Ye;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function at(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 ct(e,t){return Date.parse(t)<Date.parse(e)?t:e}var We=5e3,ht=2e3,be=10,ft=new Set(["bench","config-validate","hook-context","hook-stop","init","reindex","setup","setup-agent","setup-ci","setup-hooks","uninstall","watch","work-audit"]);function Kt(e){let t=e.classification;if(t.kind!=="live")return;let{state:r}=t;return r.watcher.state==="idle"&&r.lastError===void 0?r.indexGeneration:void 0}function mt(e,t=process.env){return t.SCIP_QUERY_SKIP_WATCH_SERVICE!=="1"&&!e.startsWith("__")&&!ft.has(e)}function Jt(e){let t=e.env??process.env;if(t.SCIP_QUERY_SKIP_WATCH_SERVICE==="1")return{kind:"skipped",reason:"environment"};if(!mt(e.commandName,t))return{kind:"skipped",reason:"excluded-command"};if(e.config.watch?.enabled!==!0)return{kind:"skipped",reason:"disabled"};try{let r=gt({projectRoot:e.projectRoot,cacheDir:e.cacheDir,cliVersion:e.cliVersion,gitContext:e.gitContext,runtime:e.runtime});return{kind:r.disposition,state:r.state}}catch(r){return{kind:"failed",message:r instanceof Error?r.message:String(r)}}}function Ee(e,t,r){let n=N(L(e));if(r&&N(r.projectRoot)===n)return{projectRoot:n,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let i=de(n);if(i.kind==="error")throw new Error(`Could not establish Git worktree identity for ${n}: ${i.message}`);return i.kind==="non-git"?{projectRoot:n,worktreeKind:"non-git",cliVersion:t}:{projectRoot:n,worktreeKind:"git",worktreeId:i.identity.worktreeId,cliVersion:t}}function Yt(e){return q(e,Ee(e.projectRoot,e.cliVersion,e.gitContext))}function q(e,t){let r=e.runtime??Q,n=R(e.cacheDir),i=G(n.statePath),s=Y(n.lockPath);return{identity:t,classification:yt(i,t,r.now(),r.isProcessAlive),lock:s,lockIsLive:s!==null&&r.isProcessAlive(s.pid),paths:n}}function gt(e){let t=e.runtime??Q,r=Ee(e.projectRoot,e.cliVersion,e.gitContext),n=q(e,r),i=K("ensure",n.classification);if(i.kind==="reuse")return x(n.paths.activityPath,t),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${i.state.pid} is still alive but its heartbeat is old. Refusing automatic replacement because civil-clock age alone cannot authorize a process signal.`);if(i.kind==="replace")J(i.state,e,t),k(n.paths,i.state.pid,t);else if(i.kind==="start"){if(n.lockIsLive){let o=Ce(e,r,t,Math.min(e.startupTimeoutMs??1e3,1e3));if(o)return x(n.paths.activityPath,t),{disposition:"reused",state:o};throw new Error(`scip-query watch is already running for ${L(e.projectRoot)} (pid ${n.lock?.pid}; lock: ${n.paths.lockPath}) without compatible daemon state. Stop the foreground watcher before starting the service.`)}n.classification.kind==="stale"&&k(n.paths,n.classification.state.pid,t)}else throw new Error(`Unexpected ensure action: ${i.kind}`);if(n=q(e,r),i=K("ensure",n.classification),i.kind==="reuse")return x(n.paths.activityPath,t),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${i.state.pid} remains alive with an old heartbeat; automatic replacement is not authorized.`);let s=e.serverPath??pt(new URL("./watch-server.js",import.meta.url));t.spawnServer(s,r.projectRoot,e.cliVersion,e.watchOverrides??{});let a=Ce(e,r,t,e.startupTimeoutMs??We);if(!a)throw new Error(`scip-query watch service did not become ready within ${e.startupTimeoutMs??We}ms.`);return x(n.paths.activityPath,t),{disposition:"started",state:a}}function Ae(e){let t=e.runtime??Q,r=R(e.cacheDir),n=G(r.statePath),i=n?t.isProcessAlive(n.pid)?{kind:"live",state:n}:{kind:"stale",state:n,reason:"dead-process"}:{kind:"stopped"},s=K("stop",i);if(s.kind==="signal-stop")return J(s.state,e,t),k(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};if(s.kind==="clean-stale")return k(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};let a=Y(r.lockPath);return s.kind==="already-stopped"&&a&&t.isProcessAlive(a.pid)?(J(a,e,t),k(r,a.pid,t),{disposition:"stopped",pid:a.pid}):{disposition:"already-stopped"}}function Pe(e,t=Date.now()){E(e,{version:1,at:new Date(t).toISOString()})}function Qt(e,t,r=Date.now(),n={}){we(R(lt(e)).refreshRequestsPath,t,{...n,now:()=>new Date(r)}),Pe(e,r)}function Xt(e,t,r={}){let n=r.pid??process.pid,i=r.isProcessAlive??y,s=()=>{},a=r.readProcessIdentity??D,o=r.now??(()=>new Date),c={...F,wallNow:()=>o().getTime(),isProcessAlive:i,readProcessIdentity:a},d=he(e,{kind:"watch",pid:n,processIdentity:a(n),detail:{projectRoot:L(t)},parseLegacy:_,runtime:c});if(d.kind==="contended"){let u=Te(d.observation);return{acquired:!1,lockPath:e,message:St(e,t,u),release:s}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function Y(e){return Te(H(e,{parseLegacy:_}))}var _=e=>{let t=xe(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Te(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 xe(e.parsed)}function xe(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!ce(t.startedAt))return null;let r=t.processIdentity===void 0?null:ne(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,pid:t.pid,...r?{processIdentity:r}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function yt(e,t,r,n){if(!e)return{kind:"stopped"};if(e.protocolVersion!==oe)return{kind:"incompatible",state:e,reason:"protocol"};if(e.projectRoot!==t.projectRoot)return{kind:"incompatible",state:e,reason:"project"};let i=t.worktreeKind==="git"?t.worktreeId:void 0;if(e.worktreeId!==i)return{kind:"incompatible",state:e,reason:"worktree"};if(e.cliVersion!==t.cliVersion)return{kind:"incompatible",state:e,reason:"cli-version"};if(!n(e.pid))return{kind:"stale",state:e,reason:"dead-process"};let s=Date.parse(e.heartbeatAt);return r-s>ae?{kind:"stale",state:e,reason:"old-heartbeat"}:{kind:"live",state:e}}function K(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 z(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 z(t)}default:return z(e)}}function Ce(e,t,r,n){let i=r.monotonicNow??b,s=i()+n;for(;i()<=s;){let a=q(e,t).classification;if(a.kind==="live")return a.state;r.sleep(be)}return null}function J(e,t,r){let{pid:n}=e;if(!r.isProcessAlive(n))return;Rt(e,r),r.signalProcess(n);let i=t.stopTimeoutMs??ht,s=r.monotonicNow??b,a=s()+i;for(;s()<=a;){if(!r.isProcessAlive(n))return;r.sleep(be)}throw new Error(`scip-query watch service pid ${n} did not stop within ${i}ms.`)}function k(e,t,r){if(ke(e.statePath,{force:!0}),ke(e.activityPath,{force:!0}),Y(e.lockPath)?.pid===t&&!r.isProcessAlive(t)){let i={...F,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},s=H(e.lockPath,{parseLegacy:_,runtime:i});fe(e.lockPath,s,{parseLegacy:_,runtime:i})}}function St(e,t,r){return`error: scip-query watch is already running for ${L(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}function x(e,t){try{(t.recordActivity??Pe)(e,t.now())}catch(r){let n=vt(r);if(n!=="EPERM"&&n!=="EACCES"&&n!=="EROFS")throw r}}function vt(e){return e.code}var Q={now:Date.now,monotonicNow:b,isProcessAlive:y,readProcessIdentity:D,spawnServer(e,t,r,n){if(!ut(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);dt(process.execPath,[e,t,r,JSON.stringify(n)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function Rt(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its ownership record has no process identity.`);let r=t.readProcessIdentity(e.pid);if(!r)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity is unavailable.`);if(!ie(e.processIdentity,r))throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity does not match the ownership record.`)}function z(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}import{existsSync as Oe,lstatSync as O,readdirSync as De,realpathSync as qe,rmSync as W,statSync as Me}from"fs";import{join as h,resolve as C,sep as _e}from"path";var It=3600*1e3,wt=2*1024*1024*1024,kt=300*1e3;function Wt(e){let t=e.leases.filter(o=>o.managed&&!o.live&&!o.busy),r=Ge(e.leases,e.locks),n={};for(let o of e.generations)r.has(o.generationId)||(n[o.generationId]=o.unreferencedAt??e.nowMs);let i=e.generations.filter(o=>!r.has(o.generationId)).sort((o,c)=>n[o.generationId]-n[c.generationId]||o.generationId.localeCompare(c.generationId)),s=new Set;for(let o of i)e.nowMs-n[o.generationId]>=e.policy.generationTtlMs&&s.add(o.generationId);let a=e.generations.filter(o=>!s.has(o.generationId)).reduce((o,c)=>o+c.size,0);for(let o of i){if(a<=e.policy.budgetBytes)break;s.has(o.generationId)||(s.add(o.generationId),a-=o.size)}for(let o of s)delete n[o];return{deleteWorktrees:t,deleteGenerations:e.generations.filter(o=>s.has(o.generationId)),deleteLocks:e.locks.filter(o=>!o.live),deleteTemporaries:e.temporaries.filter(o=>!o.live),protectedGenerationIds:[...r].sort(),unreferencedSince:n}}function Ge(e,t){let r=new Set(e.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of t)n.live&&r.add(n.generationId);return r}function pr(e,t,r={}){if(!pe())return{kind:"disabled"};let n=j(e);if(!n)return{kind:"unavailable"};let i=h(A(),"repositories",n.repositoryId);if(!Oe(i))return{kind:"unavailable"};let s=(r.now??Date.now)(),a=h(i,"gc-state.json"),o=Fe(a);if(!r.force&&o&&s-Date.parse(o.lastSweepAt)<kt)return{kind:"throttled",sweptAt:o.lastSweepAt};let c=me(i,{now:()=>s});if(!c)return{kind:"busy"};try{let d=je(e,i,n.repositoryId,o?.unreferencedSince??{}),u=Wt({nowMs:s,...d,policy:{generationTtlMs:r.policy?.generationTtlMs??It,budgetBytes:r.policy?.budgetBytes??wt}}),p=0,f=0;for(let l of u.deleteWorktrees){if(!Ne(l.lease))continue;let te=ge(h(l.lease.localCacheDir,"cache-lifecycle.lock"));if(te)try{if(Z(l.lease,!0))continue;try{Ae({projectRoot:l.lease.projectRoot,cacheDir:l.lease.localCacheDir,cliVersion:t})}catch{continue}if(Z(l.lease,!0))continue;W(l.lease.localCacheDir,{recursive:!0,force:!0}),W(l.leasePath,{force:!0}),f+=1}finally{te.release()}}for(let l of u.deleteLocks)W(l.path,{force:!0});for(let l of u.deleteTemporaries)W(l.path,{recursive:!0,force:!0});for(let l of u.deleteGenerations)W(l.path,{recursive:!0,force:!0}),p+=l.size;re(h(i,"evidence.db"));let g={kind:"swept",sweptAt:new Date(s).toISOString(),deletedWorktrees:f,deletedGenerations:u.deleteGenerations.length,deletedBytes:p,protectedGenerations:u.protectedGenerationIds.length},m={version:1,lastSweepAt:g.sweptAt,unreferencedSince:u.unreferencedSince,lastResult:g};return E(a,m,{spacing:2,trailingNewline:!0}),g}catch(d){return{kind:"failed",error:d instanceof Error?d.message:String(d)}}finally{c.release()}}function hr(e,t,r){let n=ye(e,r.dbPath,t);if(n)return{state:"bypassed",reason:n,localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let i=j(e);if(!i)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let s=h(A(),"repositories",i.repositoryId),a=$e(h(s,"worktrees",`${i.worktreeId}.json`)),o=Fe(h(s,"gc-state.json")),c=je(e,s,i.repositoryId,o?.unreferencedSince??{}),d=Ge(c.leases,c.locks),u=c.generations.filter(m=>!d.has(m.generationId)),p=c.generations.reduce((m,l)=>m+l.size,0),f=Se(e,t),g=0;return f&&(g=Ct(f)),{state:"managed",repositoryId:i.repositoryId,worktreeId:i.worktreeId,localCacheDir:r.cacheDir,...a?{baseGenerationId:a.baseGenerationId,activeGenerationId:a.activeGenerationId,lastAction:a.lastAction,reason:a.lastReason,lastSeenAt:a.lastSeenAt}:{},generations:c.generations.length,generationBytes:p,protectedGenerations:c.generations.filter(m=>d.has(m.generationId)).length,unreferencedGenerations:u.length,unreferencedBytes:u.reduce((m,l)=>m+l.size,0),temporaryGenerations:c.temporaries.length,sharedEvidence:{path:f,exists:g>0,bytes:g},cleanup:o?.lastResult}}function Ct(e){return[e,`${e}-wal`,`${e}-shm`].reduce((t,r)=>{try{return t+Me(r).size}catch{return t}},0)}function je(e,t,r,n){let i=new Set(ue(e).map(d=>C(d.path))),s=[];for(let d of X(h(t,"worktrees"))){if(!d.endsWith(".json"))continue;let u=h(t,"worktrees",d),p=$e(u);if(!p)continue;let f=C(p.projectRoot);s.push({leasePath:u,lease:p,managed:p.repositoryId===r&&Ne(p),live:i.has(f)||Oe(f),busy:Z(p)})}let a=[];for(let d of X(h(t,"locks"))){let u=/^([a-f0-9]{64})\.lock$/.exec(d);if(!u)continue;let p=h(t,"locks",d),f=ee(p),g=f!==void 0&&y(f),m=u[1];a.push({generationId:m,path:p,live:g})}let o=[],c=[];for(let d of X(h(t,"generations"))){let u=/^\.tmp-(\d+)-/.exec(d);if(u){let g=h(t,"generations",d),m=Number(u[1]);try{c.push({path:g,size:Le(g),live:Number.isSafeInteger(m)&&y(m)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(d))continue;let p=h(t,"generations",d),f;try{f=O(p)}catch{continue}!f.isDirectory()||f.isSymbolicLink()||o.push({generationId:d,path:p,size:Le(p),...n[d]===void 0?{}:{unreferencedAt:n[d]}})}return{leases:s,generations:o,locks:a,temporaries:c}}function Ne(e){if(e.ownershipChecksum!==ve(e)||$(e.localCacheDir)!==$(le(e.projectRoot)))return!1;let t=C(A()),r=C(h(t,"projects")),n=C(e.localCacheDir);if(!n.startsWith(`${r}${_e}`))return!1;try{let i=O(t),s=O(r),a=O(n);if(!i.isDirectory()||i.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let o=qe(r);return qe(n).startsWith(`${o}${_e}`)}catch{return!1}}function Z(e,t=!1){for(let n of t?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let i=ee(h(e.localCacheDir,n));if(i!==void 0&&y(i))return!0}let r=ee(R(e.localCacheDir).lockPath);return r!==void 0&&y(r)}function $e(e){try{let t=JSON.parse(v(e,"worktree cache lease"));return t.version!==1||typeof t.repositoryId!="string"||typeof t.worktreeId!="string"||typeof t.projectRoot!="string"||t.treeOid!==void 0&&typeof t.treeOid!="string"||typeof t.localCacheDir!="string"||t.baseGenerationId!==void 0&&typeof t.baseGenerationId!="string"||t.activeGenerationId!==void 0&&typeof t.activeGenerationId!="string"||typeof t.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(t.ownershipChecksum)||typeof t.lastAction!="string"||t.lastReason!==void 0&&typeof t.lastReason!="string"||typeof t.lastSeenAt!="string"?null:t}catch{return null}}function ee(e){try{let t=JSON.parse(v(e,"watch lock record"));return typeof t.pid=="number"&&Number.isSafeInteger(t.pid)&&t.pid>0?t.pid:void 0}catch{return}}function Fe(e){try{let t=JSON.parse(v(e,"repository cache GC state"));return t.version!==1||typeof t.lastSweepAt!="string"||!Number.isFinite(Date.parse(t.lastSweepAt))||!t.unreferencedSince||typeof t.unreferencedSince!="object"||!t.lastResult?null:t}catch{return null}}function X(e){try{return De(e)}catch{return[]}}function Le(e){let t=0,r=[e];for(;r.length>0;){let n=r.pop();for(let i of De(n,{withFileTypes:!0})){let s=h(n,i.name);i.isDirectory()?r.push(s):i.isFile()&&(t+=Me(s).size)}}return t}export{Lt as a,Kt as b,mt as c,Jt as d,Yt as e,gt as f,Ae as g,Qt as h,Xt as i,pr as j,hr as k};
3
+ //# sourceMappingURL=chunk-2465DLHK.js.map
@@ -1,2 +1,2 @@
1
- import{b as i}from"./chunk-CNKAGUPL.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
2
- //# sourceMappingURL=chunk-7GXM52MI.js.map
1
+ import{b as i}from"./chunk-WANA4KAQ.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
2
+ //# sourceMappingURL=chunk-24GTWJ3N.js.map
@@ -1,2 +1,2 @@
1
- import{b as C,f as X,g as Z}from"./chunk-Q3AFUTGB.js";import{a as F}from"./chunk-BGBBVSH4.js";import{d as le}from"./chunk-UOAV44HR.js";import{a as $,c as ne,d as te,e as ie,f as oe,g as re,i as N,j as ae,k as se,n as I}from"./chunk-LBMJEAEW.js";import{d as ee}from"./chunk-U7DSEKOM.js";import{a as H}from"./chunk-7B3UPBVA.js";import{a as O,e as z,g as w,h as E,j as W,k as Y,s as D,t as J,u as Q,v as U,w as A}from"./chunk-XYADIZHU.js";import{k as B,m as S}from"./chunk-X6D5IC6I.js";import{B as y,C as V,L as G}from"./chunk-YGAGTIDK.js";import{B as v,s as j,y as _}from"./chunk-L7SPDE73.js";import{a as M}from"./chunk-64MNV6AB.js";function ce(n,e,t={}){let i=new Map;if(e&&e.length===0)return i;let r=M(n,{includeIgnored:!1}),o=ie(n),a=e??J(n),c=new Set(a.map(m=>m.symbolId)),f=Me(a);return pe(n,i,r,o,c,f),ye(n,i,a,c),Re(n,i,r,o,c,f),t.semantic!==!1&&t.semanticEvidence&&De(i,t.semanticEvidence.callerMap(n,ve(a))),i}function pe(n,e,t,i,r,o){for(let a of t){if(!y(a))continue;let c=B(n,a);if(c)for(let f of c){if(o&&!o.has(f.calleeLeaf))continue;let m=ne(a,i.get(f.calleeLeaf)??[]);if(!m||m.length===0)continue;let s=te(n,a,m,f.memberAccess);s&&r.has(s.symbolId)&&s.file!==a&&T(e,s.symbolId,a)}}}function ye(n,e,t,i){let r=ge(t);for(let o of Se(n,i))n.isIgnored(o.relative_path)||he(o,r.get(o.symbol_id))||T(e,o.symbol_id,o.relative_path)}function Se(n,e){return ee(n,e?[...e]:void 0)}function ge(n){let e=new Map;for(let t of n)e.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return e}function he(n,e){return!!e&&e.docId===n.document_id&&n.chunk_start>=e.startLine&&n.chunk_end<=e.endLine}function Re(n,e,t,i,r,o){for(let a of t){if(y(a)!=="rust")continue;let c=S(n,a,{includeRustAttributeNames:!0});if(c.length!==0)for(let{name:f}of c){if(o&&!o.has(f))continue;let m=i.get(f);if(m)for(let s of m)r.has(s.symbolId)&&s.file!==a&&T(e,s.symbolId,a)}}}function T(n,e,t){let i=n.get(e);i||(i=new Set,n.set(e,i)),i.add(t)}function Me(n){let e=new Set;for(let t of n){let i="leaf"in t&&typeof t.leaf=="string"?t.leaf:"symbol"in t&&typeof t.symbol=="string"?z(t.symbol):"";i&&e.add(i)}return e.size>0?e:null}function ve(n){return n.filter(e=>"relativePath"in e&&"symbol"in e&&"leaf"in e)}function De(n,e){for(let[t,i]of e){let r=n.get(t);r||(r=new Set,n.set(t,r));for(let o of i)r.add(o)}}function q(n,e,t={}){return ce(n,e,t)}function K(n,e,t={}){return se(n,e,t)}function fe(n,e,t={}){let i=q(n,e,{semantic:t.semantic,semanticEvidence:t.semanticEvidence});return t.sourceFallback===!1?i:Ce(i,K(n,e))}function Ce(n,e){let t=new Map;for(let[i,r]of n)t.set(i,new Set(r));for(let[i,r]of e){let o=t.get(i)??new Set;for(let a of r)o.add(a);t.set(i,o)}return t}function ue(n,e,t){let i=e.identifierResolution==="strict"?N:ae,r=e.candidateNames?oe(e.candidateNames):null,o=0,a=0,c=0,f=0,m="";for(let s of e.paths)if(o+=1,m=s,!(!y(s)&&!(e.includeVueSfc&&V(s)))&&!n.isIgnored(s)&&!e.skipPath?.(s))try{if(r&&!re(_(n,s),r))continue;a+=1;let h=(u,b,x,g)=>{if(e.candidateNames&&!e.candidateNames.has(u))return;c+=1;let R=e.resolveTargets?e.resolveTargets({sourceFile:s,name:u,kind:b,defaultTargets:g}):g();for(let P of R)f+=1,t({sourceFile:s,name:u,target:P,occurrences:x,kind:b})},k=$(n,s);for(let[u,b]of k)h(u,"identifier",b.length,()=>i(n,s,u));for(let u of S(n,s,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let b=u.kind==="cross-language-dispatch"?()=>N(n,s,u.name):()=>i(n,s,u.name);h(u.name,u.kind,u.occurrences,b)}}finally{e.afterPath?.(s),o%10===0&&j("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:m,candidateMatchedPaths:a,visitedNames:c,visitedHits:f}))}}function de(n,e={}){let{scope:t,files:i,minLoc:r=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:a,excludeEntrySurfaces:c=!1,excludeTypesFiles:f=!1,excludeRootedSymbols:m=!1,requireFunctionLikeSymbol:s=!1,requireCallableSymbol:L=!1,excludeRustTraitImplMembers:h=!1,includeSuppressed:k=!1,sortByLocDesc:u=!1}=e,b=[],x=Ie(n,{scope:t,files:i,requireFunctionLikeSymbol:s,requireCallableSymbol:L}),g=new Map,R=new Map,P=l=>{let d=g.get(l);if(d!==void 0)return d;let p=X(n,l);return g.set(l,p),p},be=l=>{let d=R.get(l);if(d!==void 0)return d;let p=C(l);return R.set(l,p),p};for(let l of x){let d=l.relativePath;if(n.isIgnored(d)||c&&P(d)||!Fe(l,{requireFunctionLikeSymbol:s,requireCallableSymbol:L})||a!==void 0&&l.symbol===a)continue;let p=F(l);p<r||p>o||f&&Le(d)||m&&Z(n,l.symbol,d)||h&&W(l.symbol)||be(d)!=="test"&&(Y(l.symbol)||!k&&v(n,d,l.startLine)||b.push(l))}return u?b.sort((l,d)=>F(d)-F(l)):b}function Ie(n,e){return e.files!==void 0?[...new Set(e.files.map(i=>i.replace(/\\/g,"/")))].sort().filter(i=>!e.scope||i.includes(e.scope)).flatMap(i=>D(n,i)):e.requireCallableSymbol?A(n,{scope:e.scope,symbolMatches:w,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?A(n,{scope:e.scope,symbolMatches:E,sqlPrefilter:"function-like"}):U(n,e.scope)}function Fe(n,e){return e.requireCallableSymbol?w(n.symbol):e.requireFunctionLikeSymbol?E(n.symbol):n.isFunctionLike}function Le(n){return(n.split("/").pop()??"").includes("types")}var me=class{constructor(e){this.db=e}db;scopedDefinitions(e){return Q(this.db,e)}definitionsForFile(e){return D(this.db,e)}productionCallableDefinitions(e={}){return de(this.db,e)}calleeMap(e,t={}){return le(this.db,e,{...t,semanticEvidence:I})}crossFileCallerMap(e,t={}){return q(this.db,e,{...t,semanticEvidence:I})}sourceFallbackCallerFiles(e,t={}){return K(this.db,e,t)}callerFileMap(e,t={}){return fe(this.db,e,{...t,semanticEvidence:I})}frameworkReferencedSymbolIds(e){let t=new Map;for(let r of e){if(!r.leaf)continue;let o=t.get(r.leaf)??[];o.push(r.symbolId),t.set(r.leaf,o)}let i=new Set;for(let r of M(this.db,{includeIgnored:!1}))if(y(r)==="rust")for(let{name:o}of S(this.db,r,{includeRustAttributeNames:!0}))for(let a of t.get(o)??[])i.add(a);return i}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let i=new Map(e.map(o=>[o.symbolId,o.symbol])),r=this.calleeMap(e,t);return new Set([...r.entries()].filter(([o,a])=>{let c=i.get(o);return a.some(f=>f.symbol!==c)}).map(([o])=>o))}fileDependencyGraph(e){return H(this.db,e)}fileKind(e){return C(e)}hasSuppressionComment(e){return v(this.db,e.relativePath,e.startLine)}sourceFiles(){return G(this.db)}scanSourceReferences(e,t){ue(this.db,e,t)}callableSignature(e){let t=O(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{K as a,Ce as b,me as c};
2
- //# sourceMappingURL=chunk-NH5ALKPW.js.map
1
+ import{b as C,f as X,g as Z}from"./chunk-LP3ARJKF.js";import{a as F}from"./chunk-BGBBVSH4.js";import{d as le}from"./chunk-KXDJAG4N.js";import{a as $,c as ne,d as te,e as ie,f as oe,g as re,i as N,j as ae,k as se,n as I}from"./chunk-GLZTVKAB.js";import{d as ee}from"./chunk-E2LAW7SL.js";import{a as H}from"./chunk-DQGSM7RZ.js";import{a as O,e as z,g as w,h as E,j as W,k as Y,s as D,t as J,u as Q,v as U,w as A}from"./chunk-RA3AYNWP.js";import{k as B,m as S}from"./chunk-MZZBAITE.js";import{H as G,x as y,y as V}from"./chunk-WUW7YUAH.js";import{A as j,O as _,R as v}from"./chunk-JORHF5AL.js";import{a as M}from"./chunk-64MNV6AB.js";function ce(n,e,t={}){let i=new Map;if(e&&e.length===0)return i;let r=M(n,{includeIgnored:!1}),o=ie(n),a=e??J(n),c=new Set(a.map(m=>m.symbolId)),f=Me(a);return pe(n,i,r,o,c,f),ye(n,i,a,c),Re(n,i,r,o,c,f),t.semantic!==!1&&t.semanticEvidence&&De(i,t.semanticEvidence.callerMap(n,ve(a))),i}function pe(n,e,t,i,r,o){for(let a of t){if(!y(a))continue;let c=B(n,a);if(c)for(let f of c){if(o&&!o.has(f.calleeLeaf))continue;let m=ne(a,i.get(f.calleeLeaf)??[]);if(!m||m.length===0)continue;let s=te(n,a,m,f.memberAccess);s&&r.has(s.symbolId)&&s.file!==a&&T(e,s.symbolId,a)}}}function ye(n,e,t,i){let r=ge(t);for(let o of Se(n,i))n.isIgnored(o.relative_path)||he(o,r.get(o.symbol_id))||T(e,o.symbol_id,o.relative_path)}function Se(n,e){return ee(n,e?[...e]:void 0)}function ge(n){let e=new Map;for(let t of n)e.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return e}function he(n,e){return!!e&&e.docId===n.document_id&&n.chunk_start>=e.startLine&&n.chunk_end<=e.endLine}function Re(n,e,t,i,r,o){for(let a of t){if(y(a)!=="rust")continue;let c=S(n,a,{includeRustAttributeNames:!0});if(c.length!==0)for(let{name:f}of c){if(o&&!o.has(f))continue;let m=i.get(f);if(m)for(let s of m)r.has(s.symbolId)&&s.file!==a&&T(e,s.symbolId,a)}}}function T(n,e,t){let i=n.get(e);i||(i=new Set,n.set(e,i)),i.add(t)}function Me(n){let e=new Set;for(let t of n){let i="leaf"in t&&typeof t.leaf=="string"?t.leaf:"symbol"in t&&typeof t.symbol=="string"?z(t.symbol):"";i&&e.add(i)}return e.size>0?e:null}function ve(n){return n.filter(e=>"relativePath"in e&&"symbol"in e&&"leaf"in e)}function De(n,e){for(let[t,i]of e){let r=n.get(t);r||(r=new Set,n.set(t,r));for(let o of i)r.add(o)}}function q(n,e,t={}){return ce(n,e,t)}function K(n,e,t={}){return se(n,e,t)}function fe(n,e,t={}){let i=q(n,e,{semantic:t.semantic,semanticEvidence:t.semanticEvidence});return t.sourceFallback===!1?i:Ce(i,K(n,e))}function Ce(n,e){let t=new Map;for(let[i,r]of n)t.set(i,new Set(r));for(let[i,r]of e){let o=t.get(i)??new Set;for(let a of r)o.add(a);t.set(i,o)}return t}function ue(n,e,t){let i=e.identifierResolution==="strict"?N:ae,r=e.candidateNames?oe(e.candidateNames):null,o=0,a=0,c=0,f=0,m="";for(let s of e.paths)if(o+=1,m=s,!(!y(s)&&!(e.includeVueSfc&&V(s)))&&!n.isIgnored(s)&&!e.skipPath?.(s))try{if(r&&!re(_(n,s),r))continue;a+=1;let h=(u,b,x,g)=>{if(e.candidateNames&&!e.candidateNames.has(u))return;c+=1;let R=e.resolveTargets?e.resolveTargets({sourceFile:s,name:u,kind:b,defaultTargets:g}):g();for(let P of R)f+=1,t({sourceFile:s,name:u,target:P,occurrences:x,kind:b})},k=$(n,s);for(let[u,b]of k)h(u,"identifier",b.length,()=>i(n,s,u));for(let u of S(n,s,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let b=u.kind==="cross-language-dispatch"?()=>N(n,s,u.name):()=>i(n,s,u.name);h(u.name,u.kind,u.occurrences,b)}}finally{e.afterPath?.(s),o%10===0&&j("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:m,candidateMatchedPaths:a,visitedNames:c,visitedHits:f}))}}function de(n,e={}){let{scope:t,files:i,minLoc:r=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:a,excludeEntrySurfaces:c=!1,excludeTypesFiles:f=!1,excludeRootedSymbols:m=!1,requireFunctionLikeSymbol:s=!1,requireCallableSymbol:L=!1,excludeRustTraitImplMembers:h=!1,includeSuppressed:k=!1,sortByLocDesc:u=!1}=e,b=[],x=Ie(n,{scope:t,files:i,requireFunctionLikeSymbol:s,requireCallableSymbol:L}),g=new Map,R=new Map,P=l=>{let d=g.get(l);if(d!==void 0)return d;let p=X(n,l);return g.set(l,p),p},be=l=>{let d=R.get(l);if(d!==void 0)return d;let p=C(l);return R.set(l,p),p};for(let l of x){let d=l.relativePath;if(n.isIgnored(d)||c&&P(d)||!Fe(l,{requireFunctionLikeSymbol:s,requireCallableSymbol:L})||a!==void 0&&l.symbol===a)continue;let p=F(l);p<r||p>o||f&&Le(d)||m&&Z(n,l.symbol,d)||h&&W(l.symbol)||be(d)!=="test"&&(Y(l.symbol)||!k&&v(n,d,l.startLine)||b.push(l))}return u?b.sort((l,d)=>F(d)-F(l)):b}function Ie(n,e){return e.files!==void 0?[...new Set(e.files.map(i=>i.replace(/\\/g,"/")))].sort().filter(i=>!e.scope||i.includes(e.scope)).flatMap(i=>D(n,i)):e.requireCallableSymbol?A(n,{scope:e.scope,symbolMatches:w,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?A(n,{scope:e.scope,symbolMatches:E,sqlPrefilter:"function-like"}):U(n,e.scope)}function Fe(n,e){return e.requireCallableSymbol?w(n.symbol):e.requireFunctionLikeSymbol?E(n.symbol):n.isFunctionLike}function Le(n){return(n.split("/").pop()??"").includes("types")}var me=class{constructor(e){this.db=e}db;scopedDefinitions(e){return Q(this.db,e)}definitionsForFile(e){return D(this.db,e)}productionCallableDefinitions(e={}){return de(this.db,e)}calleeMap(e,t={}){return le(this.db,e,{...t,semanticEvidence:I})}crossFileCallerMap(e,t={}){return q(this.db,e,{...t,semanticEvidence:I})}sourceFallbackCallerFiles(e,t={}){return K(this.db,e,t)}callerFileMap(e,t={}){return fe(this.db,e,{...t,semanticEvidence:I})}frameworkReferencedSymbolIds(e){let t=new Map;for(let r of e){if(!r.leaf)continue;let o=t.get(r.leaf)??[];o.push(r.symbolId),t.set(r.leaf,o)}let i=new Set;for(let r of M(this.db,{includeIgnored:!1}))if(y(r)==="rust")for(let{name:o}of S(this.db,r,{includeRustAttributeNames:!0}))for(let a of t.get(o)??[])i.add(a);return i}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let i=new Map(e.map(o=>[o.symbolId,o.symbol])),r=this.calleeMap(e,t);return new Set([...r.entries()].filter(([o,a])=>{let c=i.get(o);return a.some(f=>f.symbol!==c)}).map(([o])=>o))}fileDependencyGraph(e){return H(this.db,e)}fileKind(e){return C(e)}hasSuppressionComment(e){return v(this.db,e.relativePath,e.startLine)}sourceFiles(){return G(this.db)}scanSourceReferences(e,t){ue(this.db,e,t)}callableSignature(e){let t=O(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{K as a,Ce as b,me as c};
2
+ //# sourceMappingURL=chunk-2SNGN6U4.js.map
@@ -1,4 +1,4 @@
1
- import{c as R}from"./chunk-NH5ALKPW.js";import{a as _,d as f}from"./chunk-Q3AFUTGB.js";import{d as l}from"./chunk-XYADIZHU.js";import{o as u,p,q as a}from"./chunk-X6D5IC6I.js";import{y as m}from"./chunk-L7SPDE73.js";import{a as d}from"./chunk-64MNV6AB.js";function $(e,o={}){let{scope:n,limit:r}=o,i=new R(e),t=D([...x(e,n),...O(e,i,n)]);return y(t),r?t.slice(0,r):t}function x(e,o){let n=[];for(let r of S(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||f(e,r.barrel_path)||m(e,r.barrel_path)&&a(e,r.barrel_path).length===0)continue;let i=N(e,r),t=i?.barrel_consumers??0,s=i?.direct_consumers??0;t!==0||s!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:l(r.symbol),originalFile:r.original_path,barrelConsumers:t,directConsumers:s,...b(e,r.barrel_path)})}return n}function S(e,o){let n=o?"AND barrel_d.relative_path LIKE ?":"",r=o?[`%${o}%`]:[];return e.all(`SELECT DISTINCT
1
+ import{c as R}from"./chunk-2SNGN6U4.js";import{a as _,d as f}from"./chunk-LP3ARJKF.js";import{d as l}from"./chunk-RA3AYNWP.js";import{o as u,p,q as a}from"./chunk-MZZBAITE.js";import{O as m}from"./chunk-JORHF5AL.js";import{a as d}from"./chunk-64MNV6AB.js";function $(e,o={}){let{scope:n,limit:r}=o,i=new R(e),t=D([...x(e,n),...O(e,i,n)]);return y(t),r?t.slice(0,r):t}function x(e,o){let n=[];for(let r of S(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||f(e,r.barrel_path)||m(e,r.barrel_path)&&a(e,r.barrel_path).length===0)continue;let i=N(e,r),t=i?.barrel_consumers??0,s=i?.direct_consumers??0;t!==0||s!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:l(r.symbol),originalFile:r.original_path,barrelConsumers:t,directConsumers:s,...b(e,r.barrel_path)})}return n}function S(e,o){let n=o?"AND barrel_d.relative_path LIKE ?":"",r=o?[`%${o}%`]:[];return e.all(`SELECT DISTINCT
2
2
  barrel_d.id AS barrel_doc_id,
3
3
  barrel_d.relative_path AS barrel_path,
4
4
  gs.id AS symbol_id,
@@ -58,4 +58,4 @@ import{c as R}from"./chunk-NH5ALKPW.js";import{a as _,d as f}from"./chunk-Q3AFUT
58
58
  ${e.pathExclusionsFor("consumer_d")}
59
59
  GROUP BY consumer_d.id
60
60
  )`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function O(e,o,n){let r=[];for(let i of C(e,n))h(e,i,i)>0||r.push(...I(e,o,i));return r}function C(e,o){return d(e,{scope:o,includeIgnored:!1}).filter(n=>a(e,n).length>0||u(e,n).length>0)}function I(e,o,n){let r=a(e,n).filter(t=>t.sourcePath&&!e.isIgnored(t.sourcePath)).flatMap(t=>g(e,o,n,t.sourcePath,[A(t.specifier)])),i=u(e,n).filter(t=>t.sourcePath&&!e.isIgnored(t.sourcePath)).flatMap(t=>g(e,o,n,t.sourcePath,t.kind==="named"&&t.names.length>0?t.names:[t.kind==="star"?`* from ${t.sourcePath}`:`* namespace from ${t.sourcePath}`]));return[...r,...i]}function g(e,o,n,r,i){let t=o.definitionsForFile(r);return i.map(s=>{let c=t.find(E=>E.leaf===s);return{barrelFile:n,symbol:c?.symbol??`source-reexport:${n}:${s}`,shortName:c?l(c.symbol):s,originalFile:r,barrelConsumers:0,directConsumers:h(e,r,n),...b(e,n)}})}function A(e){return e.split("::").at(-1)?.split("/").at(-1)?.replace(/\.[^.]+$/,"")??e}function b(e,o){return _(e,o)?{actionTier:"signal",surfaceEvidence:["barrel file is declared on the package public surface"],recommendation:"Review the package API before removing this re-export; local consumers are zero, but external consumers may import through the public barrel."}:{actionTier:"direct",surfaceEvidence:[],recommendation:"Remove this unused re-export when the barrel is not part of an external API surface."}}function h(e,o,n){let r=new Set;for(let i of d(e,{includeIgnored:!1}))if(i!==n)for(let t of p(e,i))t.sourcePath===o&&r.add(i);return r.size}function D(e){let o=new Set,n=[];for(let r of e){let i=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(i)||(o.add(i),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{$ as a};
61
- //# sourceMappingURL=chunk-3SVWW4PN.js.map
61
+ //# sourceMappingURL=chunk-2U3OLUNJ.js.map
@@ -1,2 +1,2 @@
1
- import{b as o}from"./chunk-B75HZHUP.js";import{s as u}from"./chunk-L7SPDE73.js";function P(e){let t=m(e.profile?.name),r=()=>{let d=e.candidates(),a=e.filterCandidate?d.filter(e.filterCandidate):d,C=e.orderCandidates?[...a].sort(e.orderCandidates):a,i=o(C,e.scanLimit);t={pipeline:e.profile?.name,loadedCandidates:d.length,filteredCandidates:a.length,scannedCandidates:i.length,evaluatedCandidates:0,matchedResults:0,emittedResults:0,scanLimitApplied:i.length<a.length,resultLimitApplied:!1};let f=e.prepare?.(i)??void 0,n=[];for(let c of i){t.evaluatedCandidates+=1;let s=e.evaluate(c,f);s&&n.push(s)}t.matchedResults=n.length,e.orderResults&&n.sort(e.orderResults);let l=typeof e.limit=="number"?n.slice(0,e.limit):n;return t.emittedResults=l.length,t.resultLimitApplied=l.length<n.length,e.onProfile?.({...t}),l};return e.profile?u(`candidate-pipeline:${e.profile.name}`,r,()=>({...p(e.profile?.metadata),...t})):r()}function m(e){return{pipeline:e,loadedCandidates:0,filteredCandidates:0,scannedCandidates:0,evaluatedCandidates:0,matchedResults:0,emittedResults:0,scanLimitApplied:!1,resultLimitApplied:!1}}function p(e){return typeof e=="function"?e():e??{}}export{P as a};
2
- //# sourceMappingURL=chunk-XLTP42QA.js.map
1
+ import{b as o}from"./chunk-B75HZHUP.js";import{A as u}from"./chunk-JORHF5AL.js";function P(e){let t=m(e.profile?.name),r=()=>{let d=e.candidates(),a=e.filterCandidate?d.filter(e.filterCandidate):d,C=e.orderCandidates?[...a].sort(e.orderCandidates):a,i=o(C,e.scanLimit);t={pipeline:e.profile?.name,loadedCandidates:d.length,filteredCandidates:a.length,scannedCandidates:i.length,evaluatedCandidates:0,matchedResults:0,emittedResults:0,scanLimitApplied:i.length<a.length,resultLimitApplied:!1};let f=e.prepare?.(i)??void 0,n=[];for(let c of i){t.evaluatedCandidates+=1;let s=e.evaluate(c,f);s&&n.push(s)}t.matchedResults=n.length,e.orderResults&&n.sort(e.orderResults);let l=typeof e.limit=="number"?n.slice(0,e.limit):n;return t.emittedResults=l.length,t.resultLimitApplied=l.length<n.length,e.onProfile?.({...t}),l};return e.profile?u(`candidate-pipeline:${e.profile.name}`,r,()=>({...p(e.profile?.metadata),...t})):r()}function m(e){return{pipeline:e,loadedCandidates:0,filteredCandidates:0,scannedCandidates:0,evaluatedCandidates:0,matchedResults:0,emittedResults:0,scanLimitApplied:!1,resultLimitApplied:!1}}function p(e){return typeof e=="function"?e():e??{}}export{P as a};
2
+ //# sourceMappingURL=chunk-33KUO7CG.js.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-FECYOO5O.js";import{a as c}from"./chunk-64MNV6AB.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
2
- //# sourceMappingURL=chunk-54HA4ZXH.js.map
1
+ import{a as u}from"./chunk-SMQWE25B.js";import{a as c}from"./chunk-64MNV6AB.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
2
+ //# sourceMappingURL=chunk-33XTHFKR.js.map
@@ -1,3 +1,3 @@
1
- import{a as S}from"./chunk-HKEHS2AS.js";import{a as y}from"./chunk-XLTP42QA.js";import{c as x}from"./chunk-NH5ALKPW.js";import{a as h,g as b}from"./chunk-Q3AFUTGB.js";import{a as P}from"./chunk-B75HZHUP.js";import{a as v}from"./chunk-BGBBVSH4.js";import{d as l,e as p,h as d}from"./chunk-XYADIZHU.js";import{a as u,h as m,i as g}from"./chunk-X6D5IC6I.js";import{z as f}from"./chunk-L7SPDE73.js";import{basename as L,extname as D}from"path";function K(n,e){let{scope:i,maxLoc:t=15,limit:r=30,scanLimit:a}=e??{},s=new x(n);return y({candidates:()=>A(n,s,i,t),orderCandidates:P,scanLimit:a,profile:{name:"passthrough-candidates"},prepare:o=>s.calleeMap(o,{semantic:e?.semantic!==!1}),evaluate:(o,c)=>w(n,o,c.get(o.symbolId)??[]),orderResults:(o,c)=>o.loc-c.loc||o.file.localeCompare(c.file),limit:r})}function w(n,e,i){let t=j(i);if(t.size!==1||!m(n,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...t.entries()][0],a=I(n,e,r),s=T(n,e),o=a.length>0||s.length>0?"signal":"direct";return{symbol:e.symbol,shortName:l(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:v(e),forwardsTo:r.symbol,forwardsToShort:l(r.symbol),forwardsToFile:r.file,actionTier:o,boundaryEvidence:a,publicFacadeEvidence:s,recommendation:E(o,a,s)}}function I(n,e,i){return S(n,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:l(e.symbol)},{label:"callee name",value:l(i.symbol)},{label:"passthrough module",value:L(e.relativePath,D(e.relativePath))},{label:"callee module",value:L(i.file,D(i.file))}])}function E(n,e,i){if(n==="signal"){if(i.length>0)return`Review the public API before inlining; public-facade evidence: ${i.slice(0,2).join("; ")}.`;let t=e.filter(F);return t.length>0?`Review the public API before inlining; public-surface evidence: ${t.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(n,e){return C(n,e)?h(n,e.relativePath)?["exported passthrough is declared on the package public surface"]:b(n,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function C(n,e){let i=f(n,e.relativePath);if(i.length===0)return!1;let t=p(e.symbol);if(!t)return!1;let r=i.slice(Math.max(0,e.startLine-2),e.startLine+1).join(`
1
+ import{a as S}from"./chunk-ZJ5CBXK3.js";import{a as y}from"./chunk-33KUO7CG.js";import{c as x}from"./chunk-2SNGN6U4.js";import{a as h,g as b}from"./chunk-LP3ARJKF.js";import{a as P}from"./chunk-B75HZHUP.js";import{a as v}from"./chunk-BGBBVSH4.js";import{d as l,e as p,h as d}from"./chunk-RA3AYNWP.js";import{a as u,h as m,i as g}from"./chunk-MZZBAITE.js";import{P as f}from"./chunk-JORHF5AL.js";import{basename as L,extname as D}from"path";function K(n,e){let{scope:i,maxLoc:t=15,limit:r=30,scanLimit:a}=e??{},s=new x(n);return y({candidates:()=>A(n,s,i,t),orderCandidates:P,scanLimit:a,profile:{name:"passthrough-candidates"},prepare:o=>s.calleeMap(o,{semantic:e?.semantic!==!1}),evaluate:(o,c)=>w(n,o,c.get(o.symbolId)??[]),orderResults:(o,c)=>o.loc-c.loc||o.file.localeCompare(c.file),limit:r})}function w(n,e,i){let t=j(i);if(t.size!==1||!m(n,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...t.entries()][0],a=I(n,e,r),s=T(n,e),o=a.length>0||s.length>0?"signal":"direct";return{symbol:e.symbol,shortName:l(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:v(e),forwardsTo:r.symbol,forwardsToShort:l(r.symbol),forwardsToFile:r.file,actionTier:o,boundaryEvidence:a,publicFacadeEvidence:s,recommendation:E(o,a,s)}}function I(n,e,i){return S(n,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:l(e.symbol)},{label:"callee name",value:l(i.symbol)},{label:"passthrough module",value:L(e.relativePath,D(e.relativePath))},{label:"callee module",value:L(i.file,D(i.file))}])}function E(n,e,i){if(n==="signal"){if(i.length>0)return`Review the public API before inlining; public-facade evidence: ${i.slice(0,2).join("; ")}.`;let t=e.filter(F);return t.length>0?`Review the public API before inlining; public-surface evidence: ${t.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(n,e){return C(n,e)?h(n,e.relativePath)?["exported passthrough is declared on the package public surface"]:b(n,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function C(n,e){let i=f(n,e.relativePath);if(i.length===0)return!1;let t=p(e.symbol);if(!t)return!1;let r=i.slice(Math.max(0,e.startLine-2),e.startLine+1).join(`
2
2
  `),a=u(t);return new RegExp(`^\\s*export\\s+(?:default\\s+)?(?:(?:async\\s+)?function\\s+${a}\\b|(?:const|let|var)\\s+${a}\\b)`,"m").test(r)?!0:R(i,t)}function R(n,e){if(!e)return!1;let i=new RegExp(`^\\s*export\\s*\\{[^}\\n]*\\b${u(e)}\\b`);return n.some(t=>i.test(t))}function F(n){return n.includes("public surface")}function j(n){let e=n.some(t=>d(t.symbol))?n.filter(t=>d(t.symbol)):n,i=new Map;for(let t of e)i.has(t.symbol)||i.set(t.symbol,t);return i}function A(n,e,i,t){return e.productionCallableDefinitions({scope:i,minLoc:3,maxLoc:t,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0}).filter(r=>!g(n,r))}export{K as a,C as b};
3
- //# sourceMappingURL=chunk-ZGZUZ7XE.js.map
3
+ //# sourceMappingURL=chunk-3EDFLQ6A.js.map
@@ -0,0 +1,16 @@
1
+ import{b as V,g as E}from"./chunk-IF6FP6B2.js";import{l as b}from"./chunk-C5Q44Q5D.js";import{a as k,b as h,g as m}from"./chunk-46XGSFNI.js";import xe from"better-sqlite3";import{existsSync as Fn}from"fs";import{dirname as On,join as Pn,resolve as ve}from"path";import B from"better-sqlite3";import{execFileSync as X}from"child_process";import{existsSync as J,readdirSync as Y}from"fs";import{extname as R,join as q}from"path";import{readdirSync as He}from"fs";import{execFileSync as Ke}from"child_process";import{extname as Be,join as Xe}from"path";var K=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],C=[".vue"],I=[".tsx",".jsx"],T=[".vue"],Ye=[...I,...T],qe=new Set(I),ze=new Set(T),G=new Set(K.map(e=>e.toLowerCase())),Qe=[...G].sort().join(","),F=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var Ze=V("source-files",{clearGroups:[]});function cn(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:n=>z({projectRoot:n.projectRoot,dbPath:n.dbPath,extensions:e.extensions,onStatus:n.onStatus})}}function z(e){let n=new Set((e.extensions??C).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!J(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=E(e.projectRoot),t=Q(e.projectRoot,n).filter(i=>!r.isIgnored(i)),o=new B(e.dbPath);try{let i=ee(o,t),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
2
+ VALUES (?, ?, NULL, ?)`),u=o.transaction(l=>{let d=0;for(let f of l){if(i.has(f))continue;let p=b(e.projectRoot,f,{inputKind:"auxiliary source file"}),W=s.run(ne(f),f,p);d+=Number(W.changes)}return d})(t),c={scanned:t.length,inserted:u,existing:t.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function Q(e,n){let r=Z(e,n);if(r)return r;let t=[],o=i=>{let s=i?q(e,i):e,a;try{a=Y(s,{withFileTypes:!0})}catch{return}for(let u of a){if(F.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}n.has(R(u.name).toLowerCase())&&t.push(c)}};return o(""),t.sort()}function Z(e,n){try{return X("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}).split(`
3
+ `).filter(t=>t&&n.has(R(t).toLowerCase())).sort()}catch{return null}}function ee(e,n){let r=new Set,t=500;for(let o=0;o<n.length;o+=t){let i=n.slice(o,o+t),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function ne(e){return R(e).toLowerCase()===".vue"?"vue":R(e).replace(/^\./,"").toLowerCase()||"source"}import{writeFileSync as gn}from"fs";function fn(e,n){let r=performance.now(),t=e.run(n);return{stageId:e.id,facts:e.facts,durationMs:performance.now()-r,result:t}}function te(){return{"missing-source-file":0,"missing-service-script":0,"no-definition":0,"same-file-definition":0,"unindexed-definition":0}}function S(){return{skippedReferences:0,skippedReferenceReasons:te(),skippedReferenceSamples:[]}}function L(e,n){e.skippedReferences+=n.skippedReferences;for(let r of Object.keys(e.skippedReferenceReasons)){e.skippedReferenceReasons[r]+=n.skippedReferenceReasons[r];for(let t of n.skippedReferenceSamples.filter(o=>o.reason===r))e.skippedReferenceSamples.filter(i=>i.reason===r&&i.sourceFile===t.sourceFile).length<2&&e.skippedReferenceSamples.push(t)}}import{createRequire as re}from"module";import{existsSync as oe}from"fs";import{dirname as O,extname as ie,join as P,relative as se,resolve as bn}from"path";import{pathToFileURL as ae}from"url";function A(e,n){let{vueCore:r,ts:t,volarTs:o}=ue(e),{parsed:i,vueOptions:s}=ce(r,t,n),a=O(n),u=r.createVueLanguagePlugin(t,i.options,s,p=>p),c=le(r,t,u),l=de(a,i),{languageServiceHost:d}=o.createLanguageServiceHost(t,t.sys,c,p=>p,l),f=t.createLanguageService(d);return{ts:t,language:c,languageService:f,fileNames:i.fileNames,configDir:a}}function ue(e){let n=re(ae(P(e,"package.json")).href);return{vueCore:y(n,"@vue/language-core",e),ts:y(n,"typescript",e),volarTs:y(n,"@volar/typescript",e)}}function ce(e,n,r){let t=n.readConfigFile(r,n.sys.readFile);if(t.error||!t.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(n,n.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,n.sys.writeFile)),{parsed:n.parseJsonConfigFileContent(t.config,n.sys,O(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:n.ScriptKind.Deferred}))),vueOptions:i}}function le(e,n,r){let t={},o=e.createLanguage([r],new Map,i=>{if(!oe(i))return;let s=m(i,{maxBytes:h,inputKind:"Vue language-service source file"});t.current?.scripts.set(i,n.ScriptSnapshot.fromString(s),r.getLanguageId(i)??me(i))});return t.current=o,o}function de(e,n){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>n.options,getScriptFileNames:()=>n.fileNames,getProjectReferences:()=>n.projectReferences,getProjectVersion:()=>"0"}}function y(e,n,r){try{return e(n)}catch(t){throw(typeof t=="object"&&t!==null&&"code"in t?t.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${n} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:t}):t}}function w(e,n,r){let t=ge(e);return o=>{if(!o.name)return null;let i=g(n,o.fileName),s=r.get(o.fileName);if(!s)return null;let a=r.positionAt(s,o.textSpan.start),u=t.get(i);if(!u)return null;let c=u.starts.find(d=>d.line===a.line&&d.displayName===o.name);if(c)return c.symbolId;let l=u.containingByLine.get(a.line);return l&&l.displayName===o.name?l.symbolId:fe(u.starts,a.line,2,o.name)}}function ge(e){let n=e.prepare(`
4
+ SELECT
5
+ d.relative_path AS relativePath,
6
+ der.start_line AS startLine,
7
+ der.end_line AS endLine,
8
+ der.symbol_id AS symbolId,
9
+ gs.display_name AS displayName
10
+ FROM defn_enclosing_ranges der
11
+ JOIN documents d ON d.id = der.document_id
12
+ JOIN global_symbols gs ON gs.id = der.symbol_id
13
+ ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
14
+ `).all(),r=new Map;for(let t of n){let o=r.get(t.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(t.relativePath,o)),o.starts.push({line:t.startLine,symbolId:t.symbolId,displayName:t.displayName});for(let i=t.startLine;i<=t.endLine;i++)o.containingByLine.set(i,{symbolId:t.symbolId,displayName:t.displayName})}for(let t of r.values())t.starts.sort((o,i)=>o.line-i.line);return r}function fe(e,n,r,t){let o=0,i=e.length-1;for(;o<=i;){let a=Math.floor((o+i)/2);e[a].line<n?o=a+1:i=a-1}let s=null;for(let a of[i,o]){let u=e[a];if(!u||u.displayName!==t)continue;let c=Math.abs(u.line-n);c>r||(!s||c<s.distance)&&(s={distance:c,symbolId:u.symbolId})}return s?.symbolId??null}function N(e,n){let r=Se(n),t=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=he(t,r,n,i);return o.set(i,s),s}}}function _(e,n,r,t,o){if(e.fileName.endsWith(".vue")){let i=t.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=t.language.maps.get(s,i);if(x(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return n(e)}function*D(e){let n=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),t;for(;t=n.exec(e);){let o=t[0];r.has(o)||(yield{text:o,start:t.index,end:t.index+o.length})}}function j(e,n){for(let[r]of e.toGeneratedLocation(n,t=>!!t.navigation))return r;return null}function x(e,n){let r=e;for(let[t]of r.toSourceLocation(n,o=>!!o.navigation))return t;return null}function pe(e,n){let r=0,t=e.lineStarts.length-1;for(;r<=t;){let i=Math.floor((r+t)/2);e.lineStarts[i]<=n?r=i+1:t=i-1}let o=Math.max(0,t);return{line:o,character:n-e.lineStarts[o]}}function M(e,n){return g(e,n).startsWith("node_modules/")}function g(e,n){return se(e,n).replaceAll("\\","/")}function me(e){switch(ie(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function $(){let e=new Map;return{get(n){if(e.has(n))return e.get(n)??null;try{let r=m(n,{maxBytes:h,inputKind:"Vue source file"}),t={text:r,lineStarts:Re(r)};return e.set(n,t),t}catch{return e.set(n,null),null}},positionAt:pe}}function Re(e){let n=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&n.push(r+1);return n}function Se(e){try{let n=JSON.parse(m(P(e,"package.json"),{maxBytes:k,inputKind:"project package manifest"}));return{name:n.name??"workspace",version:n.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function he(e,n,r,t){let o=g(r,t),i=be(n.name,n.version,o);return e.get(i)?.id??null}function be(e,n,r){let t=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${n} ${t}/default.`}function Nn(e){let n=ve(e.projectRoot,e.tsconfig),r=new xe(e.dbPath,{readonly:!0});try{let t=ke({db:r,projectRoot:e.projectRoot,configPath:n,vueSymbolLookup:N(r,e.projectRoot)});return Ve({vueFiles:e.vueFiles??[],tasks:e.tasks,...t})}finally{r.close()}}function ke(e){let n=$();return{projectRoot:e.projectRoot,context:A(e.projectRoot,e.configPath),symbolLookup:w(e.db,e.projectRoot,n),vueSymbolLookup:e.vueSymbolLookup,sourceReader:n}}function Ve(e){let n=[],r=S(),t=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of t){let i=Ee(e,o);n.push(...i.occurrences),L(r,i)}return{occurrences:n,...r}}function Ee(e,n){let r=e.sourceReader.get(n.fileName);if(!r)return U(e.projectRoot,n,"missing-source-file");let t=e.context.language.scripts.get(n.fileName),o=t?.generated?.languagePlugin.typescript?.getServiceScript(t.generated.root)?.code;if(!t||!o)return U(e.projectRoot,n,"missing-service-script");let i=e.context.language.maps.get(o,t),s=g(e.projectRoot,n.fileName),a=[...D(r.text)],u={tokens:a.filter(c=>c.start>=n.startOffset&&c.start<n.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:Le(a),processedStarts:new Set};return Ce({...e,fileName:n.fileName,sourceInfo:r,sourceFile:s,map:i,tokenContext:u})}function Ce(e){let n=[],r=S();for(let t of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(t.start)||Ie(e.sourceInfo.text,t.start))continue;let o=j(e.map,t.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(l=>!M(e.projectRoot,l.fileName));if(!s){v(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,"no-definition");continue}let a=g(e.projectRoot,s.fileName),u=Te(e.sourceFile,t.text,a);if(u){v(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,u);continue}let c=_(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(c===null){v(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,"unindexed-definition");continue}H(n,e.sourceReader,e.sourceInfo,e.sourceFile,t,a,c),e.tokenContext.processedStarts.add(t.start),Fe(n,e,t,o,a,c)}return{occurrences:n,...r}}function Ie(e,n){let r=e.lastIndexOf(`
15
+ `,n-1)+1,t=e.slice(r,n);return/\bfrom\s+['"][^'"]*$/.test(t)||/\bimport\s*\(\s*['"][^'"]*$/.test(t)}function Te(e,n,r){return r===e?"same-file-definition":r.endsWith(".vue")&&n!==r.split("/").at(-1)?.replace(/\.vue$/,"")?"unindexed-definition":null}function U(e,n,r){let t=S();return n.countFileSkip&&(t.skippedReferences=1,t.skippedReferenceReasons[r]=1,t.skippedReferenceSamples.push({sourceFile:g(e,n.fileName),sourceLine:0,sourceStartChar:0,sourceEndChar:0,token:"",reason:r})),{occurrences:[],...t}}function v(e,n,r,t,o,i){if(e.skippedReferences++,e.skippedReferenceReasons[i]++,e.skippedReferenceSamples.filter(a=>a.reason===i&&a.sourceFile===t).length>=2)return;let s=n.positionAt(r,o.start);e.skippedReferenceSamples.push({sourceFile:t,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,token:o.text,reason:i})}function Fe(e,n,r,t,o,i){if(!((n.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let s of Oe(n.context.languageService,n.fileName,t+1,n.map,r,n.tokenContext.tokenByStart)){if(n.tokenContext.processedStarts.has(s))continue;let a=n.tokenContext.tokenByStart.get(s);a&&(H(e,n.sourceReader,n.sourceInfo,n.sourceFile,a,o,i),n.tokenContext.processedStarts.add(s))}}function H(e,n,r,t,o,i,s){let a=n.positionAt(r,o.start);e.push({sourceFile:t,sourceLine:a.line,sourceStartChar:a.character,sourceEndChar:a.character+o.text.length,sourceToken:o.text,definitionFile:i,symbolId:s})}function Le(e){let n=new Map;for(let r of e)n.set(r.text,(n.get(r.text)??0)+1);return n}function Oe(e,n,r,t,o,i){let s=e.getDocumentHighlights?.(n,r,[n])??[],a=[];for(let u of s)if(u.fileName===n)for(let c of u.highlightSpans){let l=Pe(t,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function Pe(e,n,r,t){let o=r.get(n);if(o?.text===t)return o.start;let i=x(e,n);if(i===null)return null;let s=r.get(i);return s?.text===t?s.start:null}export{cn as a,fn as b,Nn as c};
16
+ //# sourceMappingURL=chunk-3ZSJ3PWF.js.map
@@ -1,2 +1,2 @@
1
- import{L as c}from"./chunk-YGAGTIDK.js";import{A as u,d as a,y as p}from"./chunk-L7SPDE73.js";var l=a("suppression-inventory",{clearGroups:["whole-project"]});function b(e){return l.get(e,()=>f(e))}function f(e){let r={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,twin:0,uncategorized:0},t=new Map,s=0;for(let o of c(e)){let n=p(e,o);if(!(!n||!n.includes("scip-query")))for(let g of n.split(/\r?\n/)){let i=u(g);if(i===null)continue;s+=1,t.set(o,(t.get(o)??0)+1);let y=d(i);r[y]+=1}}return{total:s,byCategory:r,byFile:t}}function d(e){if(!e)return"uncategorized";let r=e.toLowerCase();return r==="dead-code"?"dead":r}export{b as a};
2
- //# sourceMappingURL=chunk-F6O7AAC3.js.map
1
+ import{H as c}from"./chunk-WUW7YUAH.js";import{O as p,Q as u,l as a}from"./chunk-JORHF5AL.js";var l=a("suppression-inventory",{clearGroups:["whole-project"]});function b(e){return l.get(e,()=>f(e))}function f(e){let r={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,twin:0,uncategorized:0},t=new Map,s=0;for(let o of c(e)){let n=p(e,o);if(!(!n||!n.includes("scip-query")))for(let g of n.split(/\r?\n/)){let i=u(g);if(i===null)continue;s+=1,t.set(o,(t.get(o)??0)+1);let y=d(i);r[y]+=1}}return{total:s,byCategory:r,byFile:t}}function d(e){if(!e)return"uncategorized";let r=e.toLowerCase();return r==="dead-code"?"dead":r}export{b as a};
2
+ //# sourceMappingURL=chunk-43KC6EQZ.js.map
@@ -1,2 +1,2 @@
1
- import{a as C}from"./chunk-35NLDRZC.js";import{a as b}from"./chunk-7B3UPBVA.js";function L(t,n={}){let{limit:s=10,scope:c,minDepth:l=3}=n,p=b(t,c),{components:h,componentOf:m}=C(p),d=new Map;for(let e=0;e<h.length;e++)d.set(e,new Set);for(let[e,r]of p){let o=m.get(e);for(let a of r){let i=m.get(a);i!==o&&d.get(o).add(i)}}let f=new Array(h.length),S=new Array(h.length);for(let e=0;e<h.length;e++){let r=[],o=0;for(let a of d.get(e)){let i=S[a];i>o&&(o=i,r=f[a])}f[e]=[e,...r],S[e]=1+o}function D(e){return f[e]}let R=h.map(e=>[...e].sort()),y=new Set,u=[];for(let e=0;e<h.length;e++){let o=D(e).map(g=>R[g]),a=o.map(g=>g[0]);if(o.length<l)continue;let i=a.join(" ");y.has(i)||(y.add(i),u.push(w(a,o)))}return u.sort((e,r)=>r.depth-e.depth),I(u).slice(0,s)}function w(t,n){let s=n.reduce((l,p)=>l+p.length,0),c=n.filter(l=>l.length>1).length;return{chain:t,components:n,depth:n.length,fileCount:s,actionTier:"signal",chainKind:"transitive-dependency-depth",evidenceReasons:[`${n.length} condensed dependency component(s) form the representative transitive path`,`${s} file(s) are represented; ${c} component(s) contain a dependency cycle`,"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 I(t){let n=[];for(let s of t)n.some(c=>v(s.chain,c.chain))||n.push(s);return n}function v(t,n){if(t.length>=n.length)return!1;let s=n.length-t.length;for(let c=0;c<t.length;c++)if(t[c]!==n[s+c])return!1;return!0}export{L as a};
2
- //# sourceMappingURL=chunk-I5RJM53C.js.map
1
+ import{a as C}from"./chunk-35NLDRZC.js";import{a as b}from"./chunk-DQGSM7RZ.js";function L(t,n={}){let{limit:s=10,scope:c,minDepth:l=3}=n,p=b(t,c),{components:h,componentOf:m}=C(p),d=new Map;for(let e=0;e<h.length;e++)d.set(e,new Set);for(let[e,r]of p){let o=m.get(e);for(let a of r){let i=m.get(a);i!==o&&d.get(o).add(i)}}let f=new Array(h.length),S=new Array(h.length);for(let e=0;e<h.length;e++){let r=[],o=0;for(let a of d.get(e)){let i=S[a];i>o&&(o=i,r=f[a])}f[e]=[e,...r],S[e]=1+o}function D(e){return f[e]}let R=h.map(e=>[...e].sort()),y=new Set,u=[];for(let e=0;e<h.length;e++){let o=D(e).map(g=>R[g]),a=o.map(g=>g[0]);if(o.length<l)continue;let i=a.join(" ");y.has(i)||(y.add(i),u.push(w(a,o)))}return u.sort((e,r)=>r.depth-e.depth),I(u).slice(0,s)}function w(t,n){let s=n.reduce((l,p)=>l+p.length,0),c=n.filter(l=>l.length>1).length;return{chain:t,components:n,depth:n.length,fileCount:s,actionTier:"signal",chainKind:"transitive-dependency-depth",evidenceReasons:[`${n.length} condensed dependency component(s) form the representative transitive path`,`${s} file(s) are represented; ${c} component(s) contain a dependency cycle`,"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 I(t){let n=[];for(let s of t)n.some(c=>v(s.chain,c.chain))||n.push(s);return n}function v(t,n){if(t.length>=n.length)return!1;let s=n.length-t.length;for(let c=0;c<t.length;c++)if(t[c]!==n[s+c])return!1;return!0}export{L as a};
2
+ //# sourceMappingURL=chunk-464PLI5O.js.map
@@ -0,0 +1,2 @@
1
+ import{closeSync as l,fstatSync as f,openSync as h,readFileSync as L,readSync as g}from"fs";import{createHash as A}from"crypto";var y=8*1024*1024,R=64*1024*1024,_=512*1024*1024,b=256*1024*1024,d=class extends Error{constructor(i,a,r,n,o){let s=r==="too-large"?`is ${n} bytes; the safety limit is ${o} bytes`:r==="not-regular"?"is not a regular file":"changed while it was being read";super(`${i} ${JSON.stringify(a)} ${s}`);this.inputKind=i;this.inputPath=a;this.reason=r;this.observedBytes=n;this.limitBytes=o;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="SCIP_QUERY_BOUNDED_FILE_READ"};function B(t,e){m(e.maxBytes);let i=String(t),a=h(t,"r");try{let r=f(a);T(r,e,i);let n=L(a),o=f(a);if(o.dev!==r.dev||o.ino!==r.ino||o.size!==r.size||n.byteLength!==r.size)throw new d(e.inputKind,i,"changed-during-read",o.size,e.maxBytes);return n}finally{l(a)}}function x(t,e,i="utf8"){return B(t,e).toString(i)}function E(t,e){return x(t,{maxBytes:y,inputKind:e})}function p(t,e){m(e.maxBytes);let i=[],a=Buffer.allocUnsafe(64*1024),r=0;for(;;){let n=g(t,a,0,a.length,null);if(n===0)break;if(r+=n,!Number.isSafeInteger(r)||r>e.maxBytes)throw new d(e.inputKind,`file descriptor ${t}`,"too-large",r,e.maxBytes);i.push(Buffer.from(a.subarray(0,n)))}return Buffer.concat(i,r)}function F(t,e){let i=h(t,"r");try{return p(i,e)}finally{l(i)}}function P(t,e,i="utf8"){return F(t,e).toString(i)}function S(t,e,i){m(e.maxBytes);let a=String(t),r=h(t,"r");try{let n=f(r);T(n,e,a);let o=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,n.size))),s=0;for(;s<n.size;){let c=g(r,o,0,Math.min(o.length,n.size-s),s);if(c===0)break;i(o.subarray(0,c)),s+=c}let u=f(r);if(u.dev!==n.dev||u.ino!==n.ino||u.size!==n.size||s!==n.size)throw new d(e.inputKind,a,"changed-during-read",u.size,e.maxBytes);return s}finally{l(r)}}function I(t,e){let i=A("sha256");return S(t,e,a=>i.update(a)),i.digest("hex")}function T(t,e,i){if(!t.isFile())throw new d(e.inputKind,i,"not-regular",Number(t.size),e.maxBytes);if(t.size>e.maxBytes)throw new d(e.inputKind,i,"too-large",Number(t.size),e.maxBytes)}function m(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${t}`)}export{y as a,R as b,_ as c,b as d,d as e,B as f,x as g,E as h,P as i,S as j,I as k};
2
+ //# sourceMappingURL=chunk-46XGSFNI.js.map
@@ -1,8 +1,8 @@
1
- import{a as T,c as E,g as L,h as D}from"./chunk-NPKYOIFM.js";import{j as O,o as A}from"./chunk-CNKAGUPL.js";import{d as H}from"./chunk-KMVGRIO2.js";import{c as _}from"./chunk-NH5ALKPW.js";import{d as C,e as F}from"./chunk-XYADIZHU.js";import{a as w}from"./chunk-X6D5IC6I.js";var J=5;function ae(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??E(e,{base:a}),l={available:s.note!==T,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new _(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),j=t.baseContentAt??L(e.config.projectRoot,a,D(s)),h=Z(x,k,$,j);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let q=x.calleeMap(R,{semantic:f}),B=R.map(i=>({def:i,callees:A((q.get(i.symbolId)??[]).map(p=>p.symbol))})),V=O(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of B){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=G(),N=Y(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Q(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=K({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>z(S.migrationScope)-z(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,J)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function K(e){let t=[],a=U(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=H(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=W(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function z(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function W(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!X.has(t))}function Y(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function Z(e,t,a,o){return e.productionCallableDefinitions({files:[...t],requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${w(r.leaf)}\\b`).test(c)})}function Q(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
1
+ import{a as T,c as E,g as L,h as D}from"./chunk-4YTUWQ6M.js";import{j as O,o as A}from"./chunk-WANA4KAQ.js";import{d as H}from"./chunk-KMVGRIO2.js";import{c as _}from"./chunk-2SNGN6U4.js";import{d as C,e as F}from"./chunk-RA3AYNWP.js";import{a as w}from"./chunk-MZZBAITE.js";var J=5;function ae(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??E(e,{base:a}),l={available:s.note!==T,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new _(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),j=t.baseContentAt??L(e.config.projectRoot,a,D(s)),h=Z(x,k,$,j);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let q=x.calleeMap(R,{semantic:f}),B=R.map(i=>({def:i,callees:A((q.get(i.symbolId)??[]).map(p=>p.symbol))})),V=O(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of B){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=G(),N=Y(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Q(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=K({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>z(S.migrationScope)-z(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,J)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function K(e){let t=[],a=U(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=H(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=W(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function z(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function W(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!X.has(t))}function Y(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function Z(e,t,a,o){return e.productionCallableDefinitions({files:[...t],requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${w(r.leaf)}\\b`).test(c)})}function Q(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents ref_d ON c.document_id = ref_d.id
5
5
  WHERE m.symbol_id = ?
6
6
  AND m.role != 1
7
7
  ${e.pathExclusionsFor("ref_d")}`,t).map(o=>o.relative_path)}export{ae as a};
8
- //# sourceMappingURL=chunk-M7AIS73L.js.map
8
+ //# sourceMappingURL=chunk-47BU5Z4T.js.map
@@ -0,0 +1,5 @@
1
+ import{a as U}from"./chunk-QOKYJ33H.js";import{a as _}from"./chunk-S4S2WOIX.js";import{a as q}from"./chunk-QZ4JVECJ.js";import{A as K,D as z,F as $,H as X,J as G,L as S,O as T,p as F,w as O,x as L,y as H}from"./chunk-JORHF5AL.js";function I(t,n){let e=et(t,n)??it(t,n)??rt(t,n)??ot(t,n);return st(t,e,n)}function et(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=N(t[r]??"");o&&(i===null?(i=o,e=r):o===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let r=n+1;r<t.length;r+=1)if(N(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function N(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function it(t,n){if(!w(t[n]??""))return null;let e=n;for(;e>0&&w(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&w(t[i]??"");)i+=1;return{start:e,end:i}}function w(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function rt(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(E(o)!==null)break;if(B(o)!==null)return null;e-=1}if(e<0)return null;let i=E(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",s=E(o);if(s!==null){if(s<=i)break;r+=1;continue}if(B(o)!==null)break;r+=1}return{start:e,end:r}}function E(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function ot(t,n){let e=t[n]??"";if(W(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&V(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&V(t[r]??"");)r+=1;return{start:i,end:r}}function V(t){return B(t)===null}function B(t){return t.trim().length===0?"blank":W(t)?"heading":N(t)?"fence":w(t)?"table":E(t)!==null?"list":null}function W(t){return/^#{1,6}\s+/.test(t.trim())}function st(t,n,e){let{start:i,end:r}=n;if(r-i>40){let s=Math.floor(20);i=Math.max(i,e-s),r=Math.min(r,i+40),i=Math.max(n.start,r-40)}let o=t.slice(i,r).join(`
2
+ `).trim();return o.length<=2e3?o:`${o.slice(0,2e3).trimEnd()}...`}function A(t,n){return n.filter(e=>t.includes(e))}var ct=/<!--\s*scip-query:\s*snapshot\s*-->/i;function Z(t,n){if((t.config.docs?.snapshotPaths??[]).some(r=>q(r,n)))return!0;let i=T(t,n);return i.length>0&&ct.test(i)}var J={classifyCitation:lt,citationContexts:dt,citationKindLabel:ft,citationRemediation:gt,referenceTargets:pt,hasLineAnchoredCitation:at};function at(t){return t.some(n=>(n.lineReferences?.length??0)>0)}function lt(t){let n=t.join(`
3
+ `).toLowerCase(),e=[],i=A(n,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(i.length>0)return e.push(`configuration/example terms near citation: ${i.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:e};let r=A(n,["accepted","intentional","intentionally","retained","historical"]);if(r.length>0)return e.push(`intentional-record terms near citation: ${r.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:e};let o=A(n,["command","cli","usage","example","run","workflow"]);return o.length>0?(e.push(`guide/reference terms near citation: ${o.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:e}):(e.push(t.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:e})}function dt(t,n,e){let i=T(t,n);if(!i&&!S(t.config.projectRoot,n))return[];let r=i.split(/\r?\n/),o=e.flatMap(ut),s=[];for(let c=0;c<r.length;c+=1){let a=r[c]??"";o.some(d=>a.includes(d))&&s.push(I(r,c))}return s}function ut(t){let n=t.split("/");return[t,`./${t}`,n.slice(-3).join("/"),n.slice(-2).join("/")].filter((e,i,r)=>e.length>0&&r.indexOf(e)===i)}function ft(t){switch(t){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function gt(t,n){switch(t){case"behavioral-claim":return`Re-read ${n} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${n} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${n} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${n} is still meant to name this file.`}}function pt(t,n,e){let i=U(e),r=new Set;for(let o of n)mt(t,o,i.get(o)??[])&&r.add(o);return r}function mt(t,n,e){if(!ht.test(n)||!S(t.config.projectRoot,n))return!0;if(e.length===0)return!1;let i=G(t.config.projectRoot,n,{inputKind:"changed source file"}).split(/\r?\n/),r=yt(i);for(let o of e)for(let s=o.startLine;s<=o.endLine;s+=1)if((i[s]??"").trim()!==""&&!r.has(s))return!0;return!1}var ht=/\.(?:[cm]?[jt]sx?)$/i;function yt(t){let n=new Set,e=!1;for(let i=0;i<t.length;i+=1){let r=t[i].trim();!e&&Ct(r)&&(e=!0),e&&(n.add(i),r.endsWith(";")&&(e=!1))}return n}function Ct(t){return/^import(?:\s|$)/.test(t)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(t)}var Q=z({kind:"doc-path-evidence",invalidation:$("doc-path-evidence"),serialize:jt,deserialize:Lt}),v=/\.(?:md|mdx|rst|txt)$/i;function Dt(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var bt=3,St=/([A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6})(?::([1-9][0-9]*))?\b/g;function en(t,n={}){let{doc:e,limit:i=20,minCoupling:r=bt,includeSnapshotExcluded:o=!1}=n,s=At(t,n.historyMode??"bounded");if(!s)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=[];for(let a of s.docFiles){if(e!==void 0&&!a.includes(e)||e===void 0&&!Y(t,a)||e!==void 0&&!S(t.config.projectRoot,a))continue;let d=Z(t,a);if(d&&!o)continue;let{value:h,estimated:y}=xt(t,a,s.changeTimes.get(a)),g=Rt(t,a),u=new Map,{resolved:l,broken:p,citations:b}=wt(t,a,s.tracked,s.trackedBySuffix,s.everSeenInHistory),x=new Map(b.map(f=>[f.file,f]));for(let f of l){if(f===a||v.test(f))continue;let C=(s.changeTimes.get(f)??[]).filter(D=>D>h).length;if(C===0)continue;let m=x.get(f);u.set(f,{file:f,evidence:"reference",coChanges:0,changesSinceDocUpdate:C,...P("reference",g,m?.contexts),citationContexts:m?.contexts,citedLines:m?.lineReferences})}for(let[f,C]of s.coupling.get(a)??[]){if(C<r||!s.tracked.has(f))continue;let m=(s.changeTimes.get(f)??[]).filter(M=>M>h).length;if(m===0)continue;let D=u.get(f);D?(D.evidence="both",D.coChanges=C,Object.assign(D,P("both",g,D.citationContexts))):u.set(f,{file:f,evidence:"co-change",coChanges:C,changesSinceDocUpdate:m,...P("co-change",g)})}if(u.size===0&&p.length===0)continue;let R=[...u.values()].sort((f,C)=>C.changesSinceDocUpdate-f.changesSinceDocUpdate);c.push({doc:a,docLastChangedAt:h,staleness:R.reduce((f,C)=>f+C.changesSinceDocUpdate,0)+p.length*10,subjects:R.slice(0,8),brokenReferences:p,...d?{snapshotExcluded:!0}:{},...y?{docLastChangedAtEstimated:!0}:{}})}return c.sort((a,d)=>d.staleness-a.staleness),{available:!0,commitsAnalyzed:s.historyCommitCount,docsScanned:s.docFiles.length,findings:c.slice(0,i)}}function xt(t,n,e){if(e&&e.length>0)return{value:Math.max(...e),estimated:!1};try{return{value:Math.floor(X(t.config.projectRoot,n).mtimeMs/1e3),estimated:!0}}catch(i){if(S(t.config.projectRoot,n))throw i;return{value:0,estimated:!1}}}function Rt(t,n){let e=T(t,n).slice(0,6e3);if(!e)return{docIntent:"unknown",reasons:["doc text unavailable"]};let i=`${n}
4
+ ${e}`.toLowerCase(),r=A(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(r.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${r.join(", ")}`]};let o=A(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return o.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${o.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function P(t,n,e=[]){let i=t==="co-change"||e.length===0?null:J.classifyCitation(e);return{actionTier:Tt(t,n.docIntent,i?.actionTier),docIntent:n.docIntent,docIntentReasons:n.reasons,...i?{citationKind:i.citationKind,citationKindReasons:i.reasons}:{}}}function Tt(t,n,e){return n==="historical-note"?"support":e||(t==="co-change"?"signal":"direct")}function At(t,n){let e=_(t,{historyMode:n}),i=e.commitHistory();if(!i)return null;let r=e.trackedFiles()??new Set,o=new Map,s=new Map,c=new Set;for(let a of i.commits){let d=[...new Set(a.files)],h=d.filter(g=>v.test(g)),y=d.filter(g=>!v.test(g));for(let g of d){c.add(g);let u=o.get(g)??[];u.push(a.timestamp),o.set(g,u)}for(let g of h){let u=s.get(g);u||(u=new Map,s.set(g,u));for(let l of y)u.set(l,(u.get(l)??0)+1)}}return{changeTimes:o,coupling:s,docFiles:[...r].filter(a=>v.test(a)),everSeenInHistory:c,historyCommitCount:i.commits.length,tracked:r,trackedBySuffix:tt(r)}}function rn(t,n){if(n.size===0)return[];let e=H(),i=0,r=0,o=0,s=0,c=0,a=0;return K("doc-reference.docs-citing-files",()=>{let d=_(t).trackedFiles()??new Set;i=d.size;let h=tt(d),y=Mt(n,h),g=[];for(let u of d){if(!Y(t,u))continue;e&&(r+=1);let l=T(t,u);if(!l&&!S(t.config.projectRoot,u)){e&&(o+=1);continue}if(!It(l,y)){e&&(s+=1);continue}let p=nt(t,u,l);if(!p)continue;e&&(c+=1);let b=vt(p.candidates,n,y,d,h);if(b.size===0)continue;let x=[...new Set([...b.values()].flatMap(m=>[...m]))],R=Et(p.contextsByCandidate,x),f=[...b].map(([m,D])=>({file:m,contexts:k([...D].flatMap(M=>R.get(M)??[])).slice(0,3),lineReferences:j([...D].flatMap(M=>p.lineReferencesByCandidate.get(M)??[]))})).filter(m=>m.contexts.length>0),C=[...b.keys()];if(C.length>0){e&&(a+=1);let m=C.sort();g.push({doc:u,cited:m,citations:f,citedClaims:k(f.flatMap(D=>D.contexts)).slice(0,3)})}}return g},()=>({targets:n.size,trackedFiles:i,livingDocs:r,unreadableDocs:o,candidateMisses:s,evidenceDocs:c,citedDocs:a}))}function Y(t,n){return v.test(n)&&!Dt(n)&&S(t.config.projectRoot,n)}function tt(t){let n=new Map;for(let e of t){let i=e.split("/");for(let r of[2,3]){if(i.length<r)continue;let o=i.slice(-r).join("/"),s=n.get(o)??[];s.push(e),n.set(o,s)}}return n}function Mt(t,n){let e=new Set(t);for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let s=r.slice(-o).join("/"),c=n.get(s);c?.length===1&&c[0]===i&&e.add(s)}}return e}function vt(t,n,e,i,r){let o=new Map;for(let s of t){if(!e.has(s))continue;let c;if(n.has(s))c=s;else if(i.has(s))c=s;else{let d=r.get(s);d?.length===1&&(c=d[0])}if(!c||!n.has(c))continue;let a=o.get(c)??new Set;a.add(s),o.set(c,a)}return o}function wt(t,n,e,i,r){let o=new Set,s=new Set,c=nt(t,n);if(!c)return{resolved:o,broken:[],citations:[]};let a=c.candidates,d=c.contextsByCandidate,h=c.lineReferencesByCandidate,y=new Map,g=new Map,u=(l,p)=>{let b=d.get(p);if(b&&b.length>0){let R=y.get(l)??[];R.push(...b),y.set(l,k(R).slice(0,3))}let x=h.get(p);x&&x.length>0&&g.set(l,j([...g.get(l)??[],...x]))};for(let l of a){if(e.has(l)){o.add(l),u(l,l);continue}let p=i.get(l);if(p&&p.length===1){o.add(p[0]),u(p[0],l);continue}p&&p.length>1||r.has(l)&&s.add(l)}return{resolved:o,broken:[...s],citations:[...y].map(([l,p])=>({file:l,contexts:p,lineReferences:g.get(l)}))}}function Et(t,n){let e=new Map;for(let i of n){let r=t.get(i);r&&r.length>0&&e.set(i,[...r])}return e}function nt(t,n,e){let i=e;if(i===void 0&&(i=T(t,n),!i&&!S(t.config.projectRoot,n)))return null;let r=F(t,n,i),o=Q.read(t,n,r);if(o)return o;let s=kt(i);return Q.write(t,n,r,s),s}function It(t,n){for(let e of n)if(t.includes(e))return!0;return!1}function kt(t){let n=t.split(/\r?\n/),e=new Set,i=new Map,r=new Map;for(let o=0;o<n.length;o+=1){let s=n[o]??"";for(let c of s.matchAll(St)){let a=(c[1]??"").replace(/^\.?\//,"");if(a.length===0)continue;e.add(a);let d=c[2]?Number(c[2]):null;d!==null&&Number.isSafeInteger(d)&&r.set(a,j([...r.get(a)??[],d]));let h=I(n,o);if(h.length===0)continue;let y=i.get(a)??[];y.push(h),i.set(a,k(y).slice(0,3))}}return{candidates:[...e],contextsByCandidate:i,lineReferencesByCandidate:r}}function jt(t){let n={candidates:t.candidates,contextsByCandidate:[...t.contextsByCandidate.entries()],lineReferencesByCandidate:[...t.lineReferencesByCandidate.entries()]};return JSON.stringify(n)}function Lt(t){try{let n=JSON.parse(t);if(!O(n))return null;let e=L(n.candidates),i=Nt(n.contextsByCandidate),r=_t(n.lineReferencesByCandidate);return!e||!i?null:{candidates:e,contextsByCandidate:new Map(i),lineReferencesByCandidate:new Map(r??[])}}catch{return null}}function _t(t){if(t===void 0)return[];if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string"||!Array.isArray(e[1]))return null;let i=[];for(let r of e[1]){if(typeof r!="number"||!Number.isSafeInteger(r))return null;i.push(r)}n.push([e[0],j(i)])}return n}function Nt(t){if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;let i=L(e[1]);if(!i)return null;n.push([e[0],i])}return n}function k(t){let n=[];for(let e of new Set(t))n.some(i=>Bt(i,e))||n.push(e);return n}function j(t){return[...new Set(t)].sort((n,e)=>n-e)}function Bt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),r=Math.min(e.length,i.length);if(r===0)return!1;if(r<3)return t.includes(n)||n.includes(t);let o=new Set(i),s=e.filter(c=>o.has(c)).length;return s>=3&&s/r>=.6}export{Z as a,J as b,Dt as c,en as d,rn as e};
5
+ //# sourceMappingURL=chunk-4BV4QAZJ.js.map
@@ -0,0 +1,18 @@
1
+ import{a as A}from"./chunk-QOKYJ33H.js";import{a as _,c as B}from"./chunk-2SNGN6U4.js";import{l as v}from"./chunk-E2LAW7SL.js";import{n as y}from"./chunk-LSOR3LQG.js";import{d as M,g as b,i as N}from"./chunk-RA3AYNWP.js";import{A as x}from"./chunk-WUW7YUAH.js";import{J as w}from"./chunk-JORHF5AL.js";import{execFileSync as g}from"child_process";import{existsSync as q}from"fs";import{basename as P}from"path";var H="Unable to compute git diff.";function Ae(e,n={}){let i=n.plan??J(e,n);return i.note?V(i.note,i.changedFileLines):i.changedFiles.length===0?K(i.changedFileLines):Y(i.changedFiles,[Z(e,i.changedFiles,i.changedFiles,i.changedRanges)])}function J(e,n={}){let{base:i="HEAD"}=n;try{let t=y(e.config.projectRoot,i),r=Q(e.config.projectRoot,t),s=r.changedFileLines,a=se(e,s),o=oe(e,r.changedRanges);return{changedFileLines:s,changedFiles:a,changedRanges:o,renamedFiles:te(e.config.projectRoot,t,a,r),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:H}}}function Z(e,n,i,t=[]){let r=new B(e),s=new Set(i),a=A(t),o=[],c=new Map,u=n.flatMap(f=>r.definitionsForFile(f)).filter(Le),d=u.filter(f=>le(f,a)),l=de(e,u,d,a),m=me([...d,...l.definitions]).sort((f,h)=>f.relativePath.localeCompare(h.relativePath)||f.startLine-h.startLine),p=m.map(f=>f.symbolId),F=ye(e,p),G=be(e,p,i),I=m.filter(f=>(F.get(f.symbolId)??0)===0),R=$(()=>v(e,I)),j=I.filter(f=>(R.get(f.symbolId)?.size??0)===0),U=$(()=>_(e,j));for(let f of m)he(e,f,s,o,c,R.get(f.symbolId)??new Set,U.get(f.symbolId)??new Set,F.get(f.symbolId)??0,G.get(f.symbolId)??new Set);return{changedSymbols:o,consumerEntries:[...c.entries()].map(([f,h])=>({file:f,symbols:[...h].sort()})),attributionNotes:l.notes}}function Y(e,n){let i=new Map,t=n.flatMap(a=>a.changedSymbols),r=n.flatMap(a=>a.attributionNotes??[]);for(let a of n)for(let o of a.consumerEntries){let c=i.get(o.file);c||(c=new Set,i.set(o.file,c));for(let u of o.symbols)c.add(u)}let s=Se(i);return{changedFiles:[...e],changedSymbols:t,affectedConsumers:s,attributionNotes:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:t.length,totalAffectedFiles:s.length}}}function V(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function K(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function Q(e,n){let i=g("git",["diff","--name-status","--find-renames",n,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-status","--find-renames","--cached",n,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),s=g("git",["diff","--unified=0",n,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),a=g("git",["diff","--unified=0","--cached",n,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),o=ie([i,t]);return{changedFileLines:[...new Set([...o.changedFiles,...O(r)])],changedRanges:z([...T(s),...T(a)]),renamedFiles:o.renamedFiles,deletedFiles:o.deletedFiles}}function D(e,n,i){try{let t=y(e,n);return X(e,t,i)}catch{return null}}function X(e,n,i){try{return g("git",["show",`${n}:./${i}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function Pe(e,n,i=[]){let t=ee(e,n,i);return r=>(t.has(r)||t.set(r,D(e,n,r)),t.get(r)??null)}function Ee(e,n=e.changedFiles){let i=new Map(e.renamedFiles.map(t=>[t.to,t.from]));return[...new Set(n.map(t=>i.get(t)??t))]}function ee(e,n,i){let t=[...new Set(i)],r=new Map;if(t.length===0)return r;try{let s=y(e,n),a=t.map(c=>`${s}:./${c}
2
+ `).join(""),o=g("git",["cat-file","--batch"],{cwd:e,input:a,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]});return ne(o,t)}catch{for(let s of t)r.set(s,D(e,n,s));return r}}function ne(e,n){let i=new Map,t=0;for(let r of n){let s=e.indexOf(10,t);if(s<0)throw new Error("git cat-file batch output ended before object header");let a=e.subarray(t,s).toString("utf-8");if(t=s+1,a.endsWith(" missing")){i.set(r,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(a);if(!o)throw new Error(`unexpected git cat-file batch header: ${a}`);let[,c,u]=o,d=Number(u);if(!Number.isFinite(d)||d<0)throw new Error(`unexpected git cat-file batch size: ${a}`);if(t+d>e.length)throw new Error("git cat-file batch output ended before blob payload");let l=e.subarray(t,t+d);i.set(r,c==="blob"?l.toString("utf-8"):null),t+=d,e[t]===10&&(t+=1)}return i}function te(e,n,i,t){if(i.length===0)return[];let r=new Map,s=new Set;for(let o of t.renamedFiles)i.includes(o.to)&&(r.set(o.to,o),s.add(o.from));let a=t.deletedFiles;if(a.length===0)return[...r.values()].sort((o,c)=>o.to.localeCompare(c.to));for(let o of i){if(r.has(o)||!q(`${e}/${o}`))continue;let c=a.filter(l=>!s.has(l)).filter(l=>P(l)===P(o));if(c.length===0)continue;let u=w(e,o),d=c.map(l=>({from:l,to:o,similarity:re(D(e,n,l)??"",u)})).sort((l,m)=>m.similarity-l.similarity)[0];d&&d.similarity>=.45&&(r.set(o,d),s.add(d.from))}return[...r.values()].sort((o,c)=>o.to.localeCompare(c.to))}function ie(e){let n=new Set,i=new Map,t=new Set;for(let r of e.flatMap(s=>O(s))){let[s,a,o]=r.split(" ");if(!(!s||!a)){if(s.startsWith("R")&&o){n.add(o),i.set(o,{from:a,to:o,similarity:Number(s.slice(1))/100});continue}n.add(a),s.startsWith("D")&&t.add(a)}}return{changedFiles:[...n],renamedFiles:[...i.values()],deletedFiles:[...t]}}function re(e,n){let i=new Set(E(e)),t=new Set(E(n));if(i.size===0&&t.size===0)return 1;if(i.size===0||t.size===0)return 0;let r=0;for(let s of i)t.has(s)&&(r+=1);return 2*r/(i.size+t.size)}function E(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function O(e){return e.split(`
3
+ `).map(n=>n.trim()).filter(n=>n.length>0)}function se(e,n){let i=k(e),t=[];for(let r of n){let s=i(r);s&&!e.isIgnored(s)&&t.push(s)}return t}function oe(e,n){let i=k(e),t=[];for(let r of n){let s=i(r.file);s&&!e.isIgnored(s)&&t.push({...r,file:s})}return z(t)}function k(e){let n=e.all(`SELECT relative_path FROM documents
4
+ ORDER BY id`).map(t=>t.relative_path),i=new Map(n.map(t=>[t,t]));return t=>{let r=t.replace(/\\/g,"/"),s=i.get(r);return s||(n.find(a=>a.endsWith(r))??null)}}function T(e){let n=[],i=null;for(let t of e.split(`
5
+ `)){if(t.startsWith("+++ ")){i=ae(t.slice(4).trim());continue}if(!i||!t.startsWith("@@ "))continue;let r=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(t);if(!r)continue;let s=Math.max(0,Number(r[1])-1),a=r[2]===void 0?1:Number(r[2]);n.push({file:i,startLine:s,endLine:Math.max(s,s+Math.max(a,1)-1)})}return n}function ae(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function z(e){let n=new Set,i=[];for(let t of e){let r=`${t.file}:${t.startLine}:${t.endLine}`;n.has(r)||(n.add(r),i.push(t))}return i}function le(e,n){let i=n.get(e.relativePath);return!i||i.length===0?!0:i.some(t=>C(e.startLine,e.endLine,t.startLine,t.endLine))}function ce(e,n,i){let t=new Map,r=[],s=W(e),a=ge(i);for(let o of n){let c=s.get(o.file)??[];if(c.some(l=>C(l.startLine,l.endLine,o.startLine,o.endLine)))continue;let u=a.get(o.file)??[],d=pe(u,o);if(d){let l=c.find(m=>m.startLine>=d.startLine&&m.startLine<=d.endLine);if(l){t.set(l.symbolId,l),r.push(S(o,"ast-widened"));continue}}if(u.length===0){let l=[...c].filter(m=>m.startLine<=o.startLine).sort((m,p)=>p.startLine-m.startLine||m.endLine-p.endLine)[0];if(l){t.set(l.symbolId,l),r.push(S(o,"nearest-preceding"));continue}}r.push(S(o,"unattributed"))}return{definitions:[...t.values()],notes:r}}function de(e,n,i,t){let r=W(i),s=[],a=[],o=[...new Set(n.map(c=>c.relativePath))];for(let c of o){let u=t.get(c)??[];if(u.length===0)continue;let d=r.get(c)??[];for(let l of u)d.some(m=>C(m.startLine,m.endLine,l.startLine,l.endLine))||s.push(l);s.some(l=>l.file===c)&&a.push(...fe(e,c))}return ce(n,s,a)}function fe(e,n){let i=x(e,n);return i?i.rootNode.namedChildren.filter(ue).map(t=>({file:n,startLine:t.startPosition.row,endLine:t.endPosition.row})).filter(t=>t.endLine>=t.startLine):[]}function ue(e){return e.endPosition.row<e.startPosition.row?!1:!new Set(["import_statement","comment"]).has(e.type)}function me(e){let n=new Map;for(let i of e)n.set(i.symbolId,i);return[...n.values()]}function W(e){let n=new Map;for(let i of e){let t=n.get(i.relativePath)??[];t.push(i),n.set(i.relativePath,t)}return n}function ge(e){let n=new Map;for(let i of e){let t=n.get(i.file)??[];t.push(i),n.set(i.file,t)}return n}function pe(e,n){return e.filter(i=>i.startLine<=n.startLine&&i.endLine>=n.endLine).sort((i,t)=>i.endLine-i.startLine-(t.endLine-t.startLine))[0]}function S(e,n){return{file:e.file,startLine:e.startLine,endLine:e.endLine,method:n}}function C(e,n,i,t){return e<=t&&i<=n}function he(e,n,i,t,r,s,a,o,c){let u=Math.max(o,s.size,a.size);if(!De(n,u))return;let d=M(n.symbol);t.push({symbol:n.symbol,shortName:d,file:n.relativePath,startLine:n.startLine,endLine:n.endLine,fanIn:u});for(let l of c)L(e,i,r,l,d);for(let l of s)L(e,i,r,l,d);for(let l of a)L(e,i,r,l,d)}function $(e){try{return e()}catch(n){return console.error(`warning: diff-impact enrichment scan failed, continuing without it: ${n instanceof Error?n.message:n}`),new Map}}function ye(e,n){if(n.length===0)return new Map;let i=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
6
+ FROM mentions m
7
+ JOIN chunks c ON m.chunk_id = c.id
8
+ WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
9
+ AND m.role != 1
10
+ GROUP BY m.symbol_id`,...n);return new Map(i.map(t=>[t.symbol_id,t.fan_in]))}function be(e,n,i){if(n.length===0||i.length===0)return new Map;let t=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
11
+ FROM mentions m
12
+ JOIN chunks c ON m.chunk_id = c.id
13
+ JOIN documents ref_d ON c.document_id = ref_d.id
14
+ WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
15
+ AND m.role != 1
16
+ AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
17
+ ${e.pathExclusionsFor("ref_d")}`,...n,...i),r=new Map;for(let s of t){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function L(e,n,i,t,r){if(e.isIgnored(t)||n.has(t))return;let s=i.get(t);s||(s=new Set,i.set(t,s)),s.add(r)}function Se(e){return[...e.entries()].map(([n,i])=>({file:n,consumedSymbols:i.size})).sort((n,i)=>i.consumedSymbols-n.consumedSymbols)}function Le(e){return!(N(e.symbol)||e.parentTypeName!==null&&!b(e.symbol))}function De(e,n){return b(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{H as a,Ae as b,J as c,Z as d,Y as e,D as f,Pe as g,Ee as h,ee as i,ce as j};
18
+ //# sourceMappingURL=chunk-4YTUWQ6M.js.map
@@ -1,2 +1,2 @@
1
- import{b}from"./chunk-54HA4ZXH.js";import{m as d,x as f}from"./chunk-XYADIZHU.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
2
- //# sourceMappingURL=chunk-RV2FQIX3.js.map
1
+ import{b}from"./chunk-33XTHFKR.js";import{m as d,x as f}from"./chunk-RA3AYNWP.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
2
+ //# sourceMappingURL=chunk-5ML2BNRH.js.map
@@ -1,2 +1,2 @@
1
- import{d as f}from"./chunk-B3X6KU75.js";import{N as d}from"./chunk-YGAGTIDK.js";function S(n,e={}){let{minComponentLines:o=300,minFileLines:i=800,minJsxTokens:u=80,minBehaviorTokens:s=40,limit:a=20,scope:m,scanLimit:c,filePattern:p}=e;return d(n).reactProfiles({scope:m,scanLimit:c}).filter(t=>t.kind==="component").filter(t=>!p||t.file.includes(p)||t.name.includes(p)).map(t=>C(t,{minComponentLines:o,minFileLines:i,minJsxTokens:u,minBehaviorTokens:s})).filter(t=>t!==null).sort((t,r)=>r.componentLines-t.componentLines||r.fileLines-t.fileLines||t.file.localeCompare(r.file)).slice(0,a)}function C(n,e){let o=Math.max(80,Math.floor(e.minComponentLines/2)),i=f(n,x({minComponentLines:e.minComponentLines,minFileLines:e.minFileLines,minJsxTokens:e.minJsxTokens,minBehaviorTokens:e.minBehaviorTokens,substantialComponentLines:o}),"component"),{reasons:u}=i;if(u.length===0)return null;let s=i.dominantPressure,a=i.pressureKinds,m=b(n),c=R(s,a,m);return{file:n.file,component:n.name,componentLines:n.loc,fileLines:n.fileLines,jsxTokens:n.jsxTokens.size,behaviorTokens:n.behaviorTokens.size,dominantPressure:s,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:v(c,m),reasons:u,loc:n.loc}}function x(n){return[{axis:"component",value:e=>e.loc,qualifies:(e,o)=>o>=n.minComponentLines,reason:(e,o)=>`${o} component line(s)`},{axis:"file",value:e=>e.fileLines,qualifies:(e,o)=>o>=n.minFileLines&&e.loc>=n.substantialComponentLines,reason:(e,o)=>`${o} file line(s)`},{axis:"jsx-structure",value:e=>e.jsxTokens.size,weightedValue:(e,o)=>o*3,qualifies:(e,o)=>o>=n.minJsxTokens,reason:(e,o)=>`${o} JSX structure token(s)`},{axis:"hook-behavior",value:e=>e.behaviorTokens.size,weightedValue:(e,o)=>o*4,qualifies:(e,o)=>o>=n.minBehaviorTokens,reason:(e,o)=>`${o} behavior token(s)`}]}function b(n){let e=n.file.split(/[\\/]+/).filter(Boolean),o=e.slice(0,-1).map(r=>r.toLowerCase()),i=(e.at(-1)??n.name).replace(/\.[^.]+$/,""),s=o.findIndex(r=>k.has(r))>=0,a=o.some(r=>h.has(r));if(L(i)||L(n.name))return"component";let c=T.has(i.toLowerCase()),p=/(?:Page|Route|Screen)$/.test(n.name),l=s&&/View$/.test(n.name),t=!a&&i.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()===n.name.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()&&/(?:Page|Route|Screen|View)$/.test(i);return c||p||l||t?"route-page":"component"}function L(n){let e=n.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return e.at(-1)&&g.has(e.at(-1))?!0:[...g].some(o=>n.endsWith(P(o)))}function R(n,e,o){return n==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":e.includes("hook-behavior")?"behavior-extraction":e.includes("jsx-structure")?"jsx-decomposition":e.includes("file")?"file-decomposition":n==="jsx-structure"?"jsx-decomposition":n==="file"&&!e.includes("component")?"file-decomposition":"component-decomposition"}function v(n,e){switch(n){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return e==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),g=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),k=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),T=new Set(["page","route","screen"]);function P(n){return n.charAt(0).toUpperCase()+n.slice(1)}export{S as a};
2
- //# sourceMappingURL=chunk-6NSFJYRC.js.map
1
+ import{d as f}from"./chunk-B3X6KU75.js";import{J as d}from"./chunk-WUW7YUAH.js";function S(n,e={}){let{minComponentLines:o=300,minFileLines:i=800,minJsxTokens:u=80,minBehaviorTokens:s=40,limit:a=20,scope:m,scanLimit:c,filePattern:p}=e;return d(n).reactProfiles({scope:m,scanLimit:c}).filter(t=>t.kind==="component").filter(t=>!p||t.file.includes(p)||t.name.includes(p)).map(t=>C(t,{minComponentLines:o,minFileLines:i,minJsxTokens:u,minBehaviorTokens:s})).filter(t=>t!==null).sort((t,r)=>r.componentLines-t.componentLines||r.fileLines-t.fileLines||t.file.localeCompare(r.file)).slice(0,a)}function C(n,e){let o=Math.max(80,Math.floor(e.minComponentLines/2)),i=f(n,x({minComponentLines:e.minComponentLines,minFileLines:e.minFileLines,minJsxTokens:e.minJsxTokens,minBehaviorTokens:e.minBehaviorTokens,substantialComponentLines:o}),"component"),{reasons:u}=i;if(u.length===0)return null;let s=i.dominantPressure,a=i.pressureKinds,m=b(n),c=R(s,a,m);return{file:n.file,component:n.name,componentLines:n.loc,fileLines:n.fileLines,jsxTokens:n.jsxTokens.size,behaviorTokens:n.behaviorTokens.size,dominantPressure:s,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:v(c,m),reasons:u,loc:n.loc}}function x(n){return[{axis:"component",value:e=>e.loc,qualifies:(e,o)=>o>=n.minComponentLines,reason:(e,o)=>`${o} component line(s)`},{axis:"file",value:e=>e.fileLines,qualifies:(e,o)=>o>=n.minFileLines&&e.loc>=n.substantialComponentLines,reason:(e,o)=>`${o} file line(s)`},{axis:"jsx-structure",value:e=>e.jsxTokens.size,weightedValue:(e,o)=>o*3,qualifies:(e,o)=>o>=n.minJsxTokens,reason:(e,o)=>`${o} JSX structure token(s)`},{axis:"hook-behavior",value:e=>e.behaviorTokens.size,weightedValue:(e,o)=>o*4,qualifies:(e,o)=>o>=n.minBehaviorTokens,reason:(e,o)=>`${o} behavior token(s)`}]}function b(n){let e=n.file.split(/[\\/]+/).filter(Boolean),o=e.slice(0,-1).map(r=>r.toLowerCase()),i=(e.at(-1)??n.name).replace(/\.[^.]+$/,""),s=o.findIndex(r=>k.has(r))>=0,a=o.some(r=>h.has(r));if(L(i)||L(n.name))return"component";let c=T.has(i.toLowerCase()),p=/(?:Page|Route|Screen)$/.test(n.name),l=s&&/View$/.test(n.name),t=!a&&i.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()===n.name.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()&&/(?:Page|Route|Screen|View)$/.test(i);return c||p||l||t?"route-page":"component"}function L(n){let e=n.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return e.at(-1)&&g.has(e.at(-1))?!0:[...g].some(o=>n.endsWith(P(o)))}function R(n,e,o){return n==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":e.includes("hook-behavior")?"behavior-extraction":e.includes("jsx-structure")?"jsx-decomposition":e.includes("file")?"file-decomposition":n==="jsx-structure"?"jsx-decomposition":n==="file"&&!e.includes("component")?"file-decomposition":"component-decomposition"}function v(n,e){switch(n){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return e==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),g=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),k=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),T=new Set(["page","route","screen"]);function P(n){return n.charAt(0).toUpperCase()+n.slice(1)}export{S as a};
2
+ //# sourceMappingURL=chunk-5YLUDDAF.js.map
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{$e as C,Ge as R,He as B,Se as b,Ue as A,Ve as F,Wc as M,We as p,Ye as V,_ as N,cf as W,da as y,ea as v,ee as G,kb as J,qe as u,re as k,se as T,ue as d,vb as E}from"./chunk-HIB452NU.js";var ae=G,q=(e=>parseInt(e,10)),K=(e=>{let t=parseInt(e,10);if(!Number.isFinite(t)||t<1)throw new Error(`Expected a positive integer, got ${e}`);return t}),me=parseFloat,le=parseInt;function l(e,t,o,...n){return n.length>0?{flags:e,description:t,parser:o,defaultValue:n[0]}:{flags:e,description:t,parser:o}}function X(){return l("--json","Output as JSON for programmatic consumption")}function Y(){return l("--compact","Emit minified one-line JSON (use with --json)")}function Q(e=[]){let t=w(e);return t.some(o=>o.flags==="--compact")?t:[...t,Y()]}function w(e=[]){return e.some(t=>t.flags==="--json")?e:[...e,X()]}function x(e,t=[]){return{category:e,examples:t}}function S(e,t,o,n,r){return{answers:typeof e=="string"?[e]:e,returns:typeof t=="string"?[t]:t,inputs:o,coverage:n,...r?{scope:r}:{}}}function z(e){return e.generation.identity}function H(e){return W({version:1,...e})}function U(e,t){let o;try{o=JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{throw new Error("Invalid result cursor. Run the command again without --cursor.")}if(!Z(o))throw new Error("Invalid result cursor. Run the command again without --cursor.");if(o.command!==t.command||o.target!==t.target)throw new Error("This cursor belongs to a different command or target. Run again without --cursor.");if(o.indexGeneration!==t.indexGeneration)throw new Error("The index changed after this cursor was issued. Run again without --cursor.");return o}function Z(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===1&&typeof t.command=="string"&&typeof t.target=="string"&&Number.isSafeInteger(t.offset)&&(t.offset??-1)>=0&&typeof t.indexGeneration=="string"&&t.indexGeneration.length>0}function P(e,t){let o=y(e,t),n=te(o);for(let r of n)console.log(r)}function $(e,t,o="No results found for resolved symbol."){return y(e,t).match?o:ee(t,v(e,t,5))}function O(e,t,o,n){return{..._(e,t),[n]:o}}function _(e,t){let o=y(e,t);return o.match?{matched:!0,resolved:{symbol:o.match.symbol,shortName:N(o.match.symbol),relativePath:o.match.relativePath},otherMatches:o.candidates.map(n=>({shortName:n.shortName,relativePath:n.relativePath,startLine:n.startLine})),totalMatches:o.total}:{matched:!1,suggestions:v(e,t,5)}}function ee(e,t){let o=`No definition matched '${e}'.`;return t.length>0?`${o} Suggestions: ${t.join(", ")}`:o}function te(e){if(!e.match||e.total<=1)return[];let t=e.match,o=Math.max(0,e.total-1),n=[`Resolved: ${N(t.symbol)} (${t.relativePath}) -- ${o} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=e.candidates.slice(0,3);return r.length>0&&n.push(`Alternates: ${r.map(s=>`${s.shortName} (${s.relativePath}:${u(s.startLine)})`).join("; ")}`),n.push(""),n}var oe=R(({db:e,args:t,opts:o})=>{let n=b(t,0),r=p(o,"signatures"),s=E(e,n);if(p(o,"json")){C("outline",t,o,s);return}if(s.length===0)return d.empty(`No symbols found for "${n}".`);function i(D,f){for(let a of D){let c=" ".repeat(f),m=r&&a.signature?` - ${ne(a.signature)}`:"";console.log(`${c}${k(a.startLine,a.endLine)} ${a.shortName}${m}`),i(a.children,f+1)}}i(s,0)});function ne(e){return e.length>120?`${e.slice(0,117)}...`:e}var re=B("refs",({db:e,args:t,opts:o,budget:n})=>{let r=b(t,0),s=J(e,r,{semantic:n.semantic}).sort((h,j)=>h.relativePath.localeCompare(j.relativePath)||h.line-j.line),i=A(o,"cursor"),f=F(o,"limit")??(i?50:s.length),a=z(e),c=i?U(i,{command:"refs",target:r,indexGeneration:a}).offset:0;if(c>s.length)throw new Error("This cursor points past the current result set. Run again without --cursor.");let m=s.slice(c,c+f),L=c+m.length,g=L<s.length?{cursor:H({command:"refs",target:r,offset:L,indexGeneration:a}),indexGeneration:a}:void 0,I={complete:c===0&&m.length===s.length,totalKnown:!0,returned:m.length,total:s.length,omitted:s.length-m.length,...g?{continuation:g}:{}};if(p(o,"json")){C("refs",t,o,O(e,r,m,"references"),{analysisBudget:n.analysisBudget,coverage:I});return}if(m.length===0)return d.empty($(e,r,"No references found."));P(e,r),d.groupedByFile(m,h=>` line ${u(h.line)}`),g&&console.log(`
3
+ ${I.omitted} omitted; continue with --cursor ${g.cursor}`)}),se=R(({db:e,args:t,opts:o})=>{let n=b(t,0),r=M(e,n,{context:V(o,"context",0)});if(p(o,"json")){C("code",t,o,O(e,n,r,"code"));return}if(!r)return d.empty($(e,n,"Symbol found, but source was unreadable."));P(e,n),console.log(`${T(r.relativePath,r.startLine,r.endLine)} ${r.shortName} [${r.language??"unknown"}]
4
+ `);let s=r.source.split(`
5
+ `);for(let i=0;i<s.length;i++)console.log(` ${String(u(r.startLine+i)).padStart(4)} ${s[i]}`)}),Se=[{id:"refs",command:"refs <symbol>",description:"Find all files referencing a symbol",options:Q([l("--full","Run unbounded semantic analysis on large indexes"),l("-n, --limit <n>","Maximum reference sites to return",K),l("--cursor <cursor>","Continue a prior bounded result (implies --limit 50 when omitted)")]),budget:"semantic",agent:{answers:["Which files reference this symbol?","Is this symbol used anywhere, or only defined?"],returns:["referencing file paths","reference line numbers grouped by file"],inputs:["symbol"],coverage:"bounded",contrasts:[{command:"imported-by",distinction:"imported-by lists files importing the symbol; refs covers every reference site, imported or not."},{command:"affected",distinction:"refs is one hop out; affected is the transitive closure of what could break."}]},renderShape:"grouped-by-file",docs:x("Navigation",["scip-query refs login"]),handler:re},{id:"outline",command:"outline <file>",description:"Tree view of symbols in a file, with line ranges",agent:S("What symbols and nesting exist in this file?","symbol names, nesting, and line ranges",["file"],"complete"),options:w([l("--signatures","Show trimmed symbol signatures")]),renderShape:"custom",docs:x("Navigation"),handler:oe},{id:"code",command:"code <symbol>",description:"Read the source code for a symbol (bounded to its definition range)",agent:S("What is the compiler-resolved definition source for this symbol?","definition identity, source, and line range",["symbol"],"complete"),options:w([l("-C, --context <n>","Extra lines of context above/below",q,0)]),renderShape:"custom",docs:x("Navigation"),handler:se}];export{ae as a,q as b,K as c,me as d,le as e,l as f,X as g,Y as h,Q as i,w as j,x as k,S as l,P as m,$ as n,O as o,_ as p,Se as q};
6
+ //# sourceMappingURL=chunk-67QRR5YC.js.map
@@ -1,5 +1,5 @@
1
- import{b as w}from"./chunk-ZGZUZ7XE.js";import{b as g}from"./chunk-FECYOO5O.js";import{c as h,d as f}from"./chunk-MTDBHTSF.js";import{d as u,e as c,h as m,p as b,q as p}from"./chunk-XYADIZHU.js";import{dirname as $,relative as T,resolve as k}from"path";var A=new Set(f());function O(t,n){return`tests/generated/twin-ab/${y(t)}-vs-${y(n)}.test.ts`}function y(t){return(t.split(/[/#]/).pop()||t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"symbol"}function I(t,n,a,e){let o=d(t,n);if(!o.ok)return o;let i=d(t,a);if(!i.ok)return i;let r=o.symbol.paramCount===null||i.symbol.paramCount===null?null:o.symbol.paramCount===i.symbol.paramCount,s=v(o.symbol,i.symbol,t.config.projectRoot,e,r);return{ok:!0,a:o.symbol,b:i.symbol,signatureCompatible:r,testSource:s}}function d(t,n){let e=g(t,n).match;if(!e)return{ok:!1,reason:`${n} does not resolve to an indexed symbol.`};let i=t.get("SELECT kind FROM global_symbols WHERE id = ?",e.symbolId)?.kind??null;if(!(i!==null?A.has(i):m(e.symbol)))return{ok:!1,reason:`${n} resolves to ${u(e.symbol)}${i!==null?` with SCIP kind ${h(i)}`:""} \u2014 twin-ab compares call outputs, so both referents must be functions or methods.`};if(!w(t,e))return{ok:!1,reason:`${n} (${u(e.symbol)} at ${e.relativePath}:${e.startLine+1}) is not exported \u2014 twin-ab needs an importable named binding for both twins.`};let s=t.get("SELECT documentation FROM global_symbols WHERE id = ?",e.symbolId),l=b(p(s?.documentation??null));return{ok:!0,symbol:{ref:n,symbol:e.symbol,shortName:c(e.symbol)||u(e.symbol),file:e.relativePath,startLine:e.startLine,signature:l,paramCount:l?x(l):null}}}function x(t){let n=t.indexOf("(");if(n===-1)return null;let a=0,e=-1;for(let s=n;s<t.length;s+=1){let l=t[s];if(l==="(")a+=1;else if(l===")"&&(a-=1,a===0)){e=s;break}}if(e===-1)return null;let o=t.slice(n+1,e).trim();if(!o)return 0;let i=1,r=0;for(let s of o)s==="("||s==="["||s==="{"?r+=1:s===")"||s==="]"||s==="}"?r=Math.max(0,r-1):s===","&&r===0&&(i+=1);return i}function S(t,n,a){let e=$(n),o=k(t,a),r=T(e,o).replace(/\\/g,"/").replace(/\.tsx?$/,".js");return r.startsWith(".")?r:`./${r}`}function v(t,n,a,e,o){let i=S(a,e,t.file),r=S(a,e,n.file),s=o===null?"Signature comparison: unknown (one or both signatures unavailable in the index) \u2014 check by hand.":o?"Signature comparison: param counts match.":"Signature comparison: param counts DIFFER \u2014 twins may not be directly comparable; check by hand.";return`/**
2
- * Generated by 'scip-query twin-ab'. scip-integrity-audit drill 5
1
+ import{b as w}from"./chunk-3EDFLQ6A.js";import{b as g}from"./chunk-SMQWE25B.js";import{c as h,d as f}from"./chunk-MTDBHTSF.js";import{d as c,e as u,h as m,p as b,q as p}from"./chunk-RA3AYNWP.js";import{dirname as $,relative as T,resolve as k}from"path";var A=new Set(f());function O(t,n){return`tests/generated/twin-ab/${y(t)}-vs-${y(n)}.test.ts`}function y(t){return(t.split(/[/#]/).pop()||t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"symbol"}function I(t,n,a,e){let o=d(t,n);if(!o.ok)return o;let i=d(t,a);if(!i.ok)return i;let r=o.symbol.paramCount===null||i.symbol.paramCount===null?null:o.symbol.paramCount===i.symbol.paramCount,s=v(o.symbol,i.symbol,t.config.projectRoot,e,r);return{ok:!0,a:o.symbol,b:i.symbol,signatureCompatible:r,testSource:s}}function d(t,n){let e=g(t,n).match;if(!e)return{ok:!1,reason:`${n} does not resolve to an indexed symbol.`};let i=t.get("SELECT kind FROM global_symbols WHERE id = ?",e.symbolId)?.kind??null;if(!(i!==null?A.has(i):m(e.symbol)))return{ok:!1,reason:`${n} resolves to ${c(e.symbol)}${i!==null?` with SCIP kind ${h(i)}`:""} \u2014 twin-ab compares call outputs, so both referents must be functions or methods.`};if(!w(t,e))return{ok:!1,reason:`${n} (${c(e.symbol)} at ${e.relativePath}:${e.startLine+1}) is not exported \u2014 twin-ab needs an importable named binding for both twins.`};let s=t.get("SELECT documentation FROM global_symbols WHERE id = ?",e.symbolId),l=b(p(s?.documentation??null));return{ok:!0,symbol:{ref:n,symbol:e.symbol,shortName:u(e.symbol)||c(e.symbol),file:e.relativePath,startLine:e.startLine,signature:l,paramCount:l?x(l):null}}}function x(t){let n=t.indexOf("(");if(n===-1)return null;let a=0,e=-1;for(let s=n;s<t.length;s+=1){let l=t[s];if(l==="(")a+=1;else if(l===")"&&(a-=1,a===0)){e=s;break}}if(e===-1)return null;let o=t.slice(n+1,e).trim();if(!o)return 0;let i=1,r=0;for(let s of o)s==="("||s==="["||s==="{"?r+=1:s===")"||s==="]"||s==="}"?r=Math.max(0,r-1):s===","&&r===0&&(i+=1);return i}function S(t,n,a){let e=$(n),o=k(t,a),r=T(e,o).replace(/\\/g,"/").replace(/\.tsx?$/,".js");return r.startsWith(".")?r:`./${r}`}function v(t,n,a,e,o){let i=S(a,e,t.file),r=S(a,e,n.file),s=o===null?"Signature comparison: unknown (one or both signatures unavailable in the index) \u2014 check by hand.":o?"Signature comparison: param counts match.":"Signature comparison: param counts DIFFER \u2014 twins may not be directly comparable; check by hand.";return`/**
2
+ * Generated by 'scip-query twin-ab'. scip-audit integrity scenario.
3
3
  * ("cross-examine same-concept twins"): where one concept is computed in
4
4
  * more than one place, feed both the same input and require the same
5
5
  * answer. Disagreement between twins means at least one is wrong \u2014
@@ -37,4 +37,4 @@ describe.skipIf(inputs.length === 0)('twin-ab: ${t.shortName} vs ${n.shortName}'
37
37
  });
38
38
  });
39
39
  `}export{O as a,I as b};
40
- //# sourceMappingURL=chunk-GPBBJ5Y4.js.map
40
+ //# sourceMappingURL=chunk-6GXYN7YA.js.map
@@ -1,3 +1,3 @@
1
- import{c as p}from"./chunk-GBQ5NYPR.js";import{b as D}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{d as g,t as B}from"./chunk-XYADIZHU.js";import{b as f}from"./chunk-X6D5IC6I.js";import{C as d,z as y}from"./chunk-L7SPDE73.js";import{createHash as A}from"crypto";var h=3;function H(e,t={}){let{scope:o,maxLoc:n=15,minLoc:i=h,limit:r,scanLimit:s}=t,l=p(e),u=L(e,{scope:o,maxLoc:n,scanLimit:s}).map(a=>x(e,a,l,i)).filter(a=>a!==null),c=v(u);return r?c.slice(0,r):c}function M(e,t,o={}){let{scope:n,maxLoc:i=15,minLoc:r=h,scanLimit:s}=o,l=p(e),u=L(e,{scope:n,maxLoc:i,scanLimit:s}).map(a=>x(e,a,l,r)).filter(a=>a!==null),c=u.find(a=>a.symbol===t);return c?u.filter(a=>a.symbol!==c.symbol&&a.normalizedBody===c.normalizedBody&&a.file!==c.file).sort(z).map(({normalizedBody:a,...C})=>C):[]}function I(e){let t=S(e);return f(t).replace(/\s+/g,"")}function v(e){let t=new Map;for(let n of e){if(n.normalizedBody.length<8)continue;let i=F(n.normalizedBody),r=t.get(i)??[];r.push(n),t.set(i,r)}let o=[];for(let[n,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let s=[...i].sort(z).map(({normalizedBody:l,...u})=>u);o.push({hash:n,canonical:s[0],functions:s})}return o.sort((n,i)=>{let r=i.functions.length-n.functions.length;if(r!==0)return r;let s=b(i)-b(n);return s!==0?s:n.canonical.file.localeCompare(i.canonical.file)}),o}function L(e,t){let o=B(e,{scope:t.scope}).filter(n=>n.isFunctionLike&&!e.isIgnored(n.relativePath)).filter(n=>!d(e,n.relativePath,n.startLine,"similar")).filter(n=>m(n)<=t.maxLoc);return o.sort((n,i)=>m(i)-m(n)||n.relativePath.localeCompare(i.relativePath)),D(o,t.scanLimit)}function x(e,t,o,n){let i=E(e,t);if(!i||W(i)<n)return null;let r=P(e,t);return r?{symbol:t.symbol,shortName:g(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:o?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function P(e,t){let o=E(e,t);return o&&I(o)||null}function E(e,t){let o=y(e,t.relativePath);return o.length===0?null:o.slice(t.startLine,t.endLine+1).join(`
1
+ import{c as p}from"./chunk-S4S2WOIX.js";import{b as D}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{d as g,t as B}from"./chunk-RA3AYNWP.js";import{b as f}from"./chunk-MZZBAITE.js";import{P as y,S as d}from"./chunk-JORHF5AL.js";import{createHash as A}from"crypto";var h=3;function H(e,t={}){let{scope:o,maxLoc:n=15,minLoc:i=h,limit:r,scanLimit:s}=t,l=p(e),u=L(e,{scope:o,maxLoc:n,scanLimit:s}).map(a=>x(e,a,l,i)).filter(a=>a!==null),c=v(u);return r?c.slice(0,r):c}function M(e,t,o={}){let{scope:n,maxLoc:i=15,minLoc:r=h,scanLimit:s}=o,l=p(e),u=L(e,{scope:n,maxLoc:i,scanLimit:s}).map(a=>x(e,a,l,r)).filter(a=>a!==null),c=u.find(a=>a.symbol===t);return c?u.filter(a=>a.symbol!==c.symbol&&a.normalizedBody===c.normalizedBody&&a.file!==c.file).sort(z).map(({normalizedBody:a,...C})=>C):[]}function I(e){let t=S(e);return f(t).replace(/\s+/g,"")}function v(e){let t=new Map;for(let n of e){if(n.normalizedBody.length<8)continue;let i=F(n.normalizedBody),r=t.get(i)??[];r.push(n),t.set(i,r)}let o=[];for(let[n,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let s=[...i].sort(z).map(({normalizedBody:l,...u})=>u);o.push({hash:n,canonical:s[0],functions:s})}return o.sort((n,i)=>{let r=i.functions.length-n.functions.length;if(r!==0)return r;let s=b(i)-b(n);return s!==0?s:n.canonical.file.localeCompare(i.canonical.file)}),o}function L(e,t){let o=B(e,{scope:t.scope}).filter(n=>n.isFunctionLike&&!e.isIgnored(n.relativePath)).filter(n=>!d(e,n.relativePath,n.startLine,"similar")).filter(n=>m(n)<=t.maxLoc);return o.sort((n,i)=>m(i)-m(n)||n.relativePath.localeCompare(i.relativePath)),D(o,t.scanLimit)}function x(e,t,o,n){let i=E(e,t);if(!i||W(i)<n)return null;let r=P(e,t);return r?{symbol:t.symbol,shortName:g(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:o?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function P(e,t){let o=E(e,t);return o&&I(o)||null}function E(e,t){let o=y(e,t.relativePath);return o.length===0?null:o.slice(t.startLine,t.endLine+1).join(`
2
2
  `)}function S(e){let t=e.indexOf("{"),o=e.lastIndexOf("}");if(t>=0&&o>t)return e.slice(t+1,o);let n=e.indexOf("=>");return n>=0?e.slice(n+2).replace(/;+\s*$/,""):e}function W(e){return S(e).split(/\r?\n/).map(o=>o.trim()).filter(o=>o.length>0).length}function F(e){return A("sha256").update(e).digest("hex").slice(0,16)}function z(e,t){let o=e.ageCommits??-1;return(t.ageCommits??-1)-o||e.file.localeCompare(t.file)||e.startLine-t.startLine}function b(e){return e.functions.reduce((t,o)=>t+o.loc,0)}export{H as a,M as b,I as c,v as d,P as e,E as f,S as g};
3
- //# sourceMappingURL=chunk-4333ETTV.js.map
3
+ //# sourceMappingURL=chunk-6M7RONVB.js.map
@@ -0,0 +1,2 @@
1
+ import{statSync as r}from"fs";function o(t){let e=t.get("SELECT COUNT(*) as c FROM documents").c,s=t.get("SELECT COUNT(*) as c FROM global_symbols").c,n=t.get("SELECT COUNT(*) as c FROM mentions WHERE role = 1").c,i=t.get("SELECT COUNT(*) as c FROM mentions WHERE role != 1").c;return{documents:e,symbols:s,definitions:n,references:i,...a(t.generation.databasePath)}}function a(t){try{let e=r(t);return{indexSizeBytes:e.size,lastBuilt:e.mtime}}catch{return{indexSizeBytes:0,lastBuilt:null}}}export{o as a};
2
+ //# sourceMappingURL=chunk-6YTSKJJ3.js.map
@@ -1,4 +1,4 @@
1
- import{a as D,b as v,c as $,d as B}from"./chunk-P2PC2WGR.js";import{a as K}from"./chunk-XLTP42QA.js";import{b as I,c as A}from"./chunk-NH5ALKPW.js";import{b as M,g as R}from"./chunk-Q3AFUTGB.js";import{a as g}from"./chunk-BGBBVSH4.js";import{b as k,d as F,e as b}from"./chunk-XYADIZHU.js";import{l as w}from"./chunk-X6D5IC6I.js";import{y as C}from"./chunk-L7SPDE73.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},d=e?.semantic!==!1,a=new A(t),m=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>g(c)-g(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let c=U(u),f=W(t,a,u,c,{semantic:d}),h=u.filter(P=>{let x=S(t,P,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&j(P,x.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,h,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=S(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!j(f.definition,f.realConsumers.length,y))return null;let h=V(t,f);return!l&&h.confidence==="low"?null:h},orderResults:(u,c)=>p[u.confidence]-p[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&g(s)>=i.minLoc).filter(s=>g(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>M(s.relativePath)!=="test").filter(s=>!R(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function L(t,e,n,i){return v(D(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function W(t,e,n,i,s){let r=L(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let m=S(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&T(a.relativePath))}),o=s.semantic&&l.length>0?I(r,L(t,e,l,{semantic:!0,sourceFallback:!1})):r,d=l.filter(a=>S(t,a,o,i).realConsumers.length<=1);return I(o,L(t,e,d,{semantic:!1,sourceFallback:!0}))}function U(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=b(n.symbol);s&&i.set(s,n)}return e}function S(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:d}=$(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:o+d,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),l=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:g(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:l.actionTier,stalenessKind:l.stalenessKind,recommendation:l.recommendation}}function z(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=v(D(t,e).forDefinitions(l,{semantic:s.semantic,sourceFallback:!0})),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,o)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=b(n.symbol);i&&e.set(N(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(E(t,n.relativePath,n.startLine)!=="class")return null;let i=b(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(N(n.relativePath,s))??null:null}function G(t,e,n){let i=b(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,i))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let i=C(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=k(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=i.get(e.relativePath);if(!l)return!1;let o=[...s.get(r)??[]],d=new Set;for(;o.length>0;){let a=o.pop();if(d.has(a))continue;d.add(a);let m=l.get(a);if(!m)continue;let y=n.get(m.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of s.get(a)??[])o.push(p)}return!1}function E(t,e,n){let i=C(t,e);if(!i)return"other";let s=i.split(`
1
+ import{a as D,b as v,c as $,d as B}from"./chunk-X6RKPDY7.js";import{a as K}from"./chunk-33KUO7CG.js";import{b as I,c as A}from"./chunk-2SNGN6U4.js";import{b as M,g as R}from"./chunk-LP3ARJKF.js";import{a as g}from"./chunk-BGBBVSH4.js";import{b as k,d as F,e as b}from"./chunk-RA3AYNWP.js";import{l as w}from"./chunk-MZZBAITE.js";import{O as C}from"./chunk-JORHF5AL.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},d=e?.semantic!==!1,a=new A(t),m=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>g(c)-g(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let c=U(u),f=W(t,a,u,c,{semantic:d}),h=u.filter(P=>{let x=S(t,P,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&j(P,x.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,h,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=S(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!j(f.definition,f.realConsumers.length,y))return null;let h=V(t,f);return!l&&h.confidence==="low"?null:h},orderResults:(u,c)=>p[u.confidence]-p[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&g(s)>=i.minLoc).filter(s=>g(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>M(s.relativePath)!=="test").filter(s=>!R(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function L(t,e,n,i){return v(D(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function W(t,e,n,i,s){let r=L(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let m=S(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&T(a.relativePath))}),o=s.semantic&&l.length>0?I(r,L(t,e,l,{semantic:!0,sourceFallback:!1})):r,d=l.filter(a=>S(t,a,o,i).realConsumers.length<=1);return I(o,L(t,e,d,{semantic:!1,sourceFallback:!0}))}function U(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=b(n.symbol);s&&i.set(s,n)}return e}function S(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:d}=$(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:o+d,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),l=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:g(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:l.actionTier,stalenessKind:l.stalenessKind,recommendation:l.recommendation}}function z(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=v(D(t,e).forDefinitions(l,{semantic:s.semantic,sourceFallback:!0})),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,o)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=b(n.symbol);i&&e.set(N(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(E(t,n.relativePath,n.startLine)!=="class")return null;let i=b(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(N(n.relativePath,s))??null:null}function G(t,e,n){let i=b(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,i))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let i=C(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=k(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=i.get(e.relativePath);if(!l)return!1;let o=[...s.get(r)??[]],d=new Set;for(;o.length>0;){let a=o.pop();if(d.has(a))continue;d.add(a);let m=l.get(a);if(!m)continue;let y=n.get(m.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of s.get(a)??[])o.push(p)}return!1}function E(t,e,n){let i=C(t,e);if(!i)return"other";let s=i.split(`
2
2
  `),r=Math.max(0,n-2),l=Math.min(s.length-1,n+2);for(let o=r;o<=l;o++){let a=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(a))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(a))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(a))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(a))return"enum"}return"other"}function ee(t,e){let n=C(t,e.relativePath);if(!n)return!1;let i=b(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),l=n.split(`
3
3
  `);for(let o=0;o<l.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(l[o]??""))return!0;return!1}function ne(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{de as a};
4
- //# sourceMappingURL=chunk-QDV6RDCP.js.map
4
+ //# sourceMappingURL=chunk-7FT5Y65S.js.map
@@ -1,4 +1,4 @@
1
- import{a as M}from"./chunk-XLTP42QA.js";import{c as C}from"./chunk-3MJ5YA4Y.js";import{b as f,c as I}from"./chunk-NH5ALKPW.js";import{h as d}from"./chunk-U7DSEKOM.js";import{d as h}from"./chunk-MTDBHTSF.js";import{d as g}from"./chunk-XYADIZHU.js";import{f as y}from"./chunk-X6D5IC6I.js";var x=new Set(h());function N(e,n){let{scope:o,minLoc:r=10,limit:i=30,scanLimit:t}=n??{},s=new I(e);return M({candidates:()=>s.productionCallableDefinitions({scope:o,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),scanLimit:t,filterCandidate:S,profile:{name:"complexity-hotspots"},prepare:a=>{let l=B(e,a),m=n?.semantic!==!1,c=m?d(e):null;c?.materializeReferences(a,{prefetchCallees:!0});let u=s.crossFileCallerMap(a,{semantic:!1});return{callerMap:c?f(u,c.callerMap(a)):u,calleeMap:s.calleeMap(a,{semantic:m}),languageByFile:l,clojureCallableIds:D(e,a,l),branchEstimates:C(e,a)}},evaluate:(a,l)=>L(a,l,r),orderResults:(a,l)=>l.score-a.score||l.loc-a.loc,limit:i})}function S(e){return e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&x.has(e.kind):!0}function L(e,n,o){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<o)return null;let i=n.callerMap.get(e.symbolId)?.size??0,t=n.calleeMap.get(e.symbolId)??[],s=new Set,a=new Set;for(let p of t){let b=`${p.symbol}|${p.file}`;s.add(b),p.file!==e.relativePath&&a.add(b)}let l=a.size,m=s.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},u=c.branches+1;return{symbol:e.symbol,shortName:g(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:i,fanOut:l,calleeCount:m,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(i/5)*Math.max(l/5,1)*Math.max(u/5,1)*100)/100}}function B(e,n){let o=[...new Set(n.map(t=>t.relativePath))];if(o.length===0)return new Map;let r=o.map(()=>"?").join(", "),i=e.all(`SELECT relative_path, language
1
+ import{a as M}from"./chunk-33KUO7CG.js";import{c as C}from"./chunk-QIQ63BHW.js";import{b as f,c as I}from"./chunk-2SNGN6U4.js";import{h as d}from"./chunk-E2LAW7SL.js";import{d as h}from"./chunk-MTDBHTSF.js";import{d as g}from"./chunk-RA3AYNWP.js";import{f as y}from"./chunk-MZZBAITE.js";var x=new Set(h());function N(e,n){let{scope:o,minLoc:r=10,limit:i=30,scanLimit:t}=n??{},s=new I(e);return M({candidates:()=>s.productionCallableDefinitions({scope:o,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),scanLimit:t,filterCandidate:S,profile:{name:"complexity-hotspots"},prepare:a=>{let l=B(e,a),m=n?.semantic!==!1,c=m?d(e):null;c?.materializeReferences(a,{prefetchCallees:!0});let u=s.crossFileCallerMap(a,{semantic:!1});return{callerMap:c?f(u,c.callerMap(a)):u,calleeMap:s.calleeMap(a,{semantic:m}),languageByFile:l,clojureCallableIds:D(e,a,l),branchEstimates:C(e,a)}},evaluate:(a,l)=>L(a,l,r),orderResults:(a,l)=>l.score-a.score||l.loc-a.loc,limit:i})}function S(e){return e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&x.has(e.kind):!0}function L(e,n,o){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<o)return null;let i=n.callerMap.get(e.symbolId)?.size??0,t=n.calleeMap.get(e.symbolId)??[],s=new Set,a=new Set;for(let p of t){let b=`${p.symbol}|${p.file}`;s.add(b),p.file!==e.relativePath&&a.add(b)}let l=a.size,m=s.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},u=c.branches+1;return{symbol:e.symbol,shortName:g(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:i,fanOut:l,calleeCount:m,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(i/5)*Math.max(l/5,1)*Math.max(u/5,1)*100)/100}}function B(e,n){let o=[...new Set(n.map(t=>t.relativePath))];if(o.length===0)return new Map;let r=o.map(()=>"?").join(", "),i=e.all(`SELECT relative_path, language
2
2
  FROM documents
3
3
  WHERE relative_path IN (${r})`,...o);return new Map(i.map(t=>[t.relative_path,t.language?.toLowerCase()??null]))}function D(e,n,o){let r=new Set,i=new Map;for(let t of n){if(o.get(t.relativePath)!=="clojure")continue;let s=i.get(t.relativePath);s||(s=new Set((y(e,t.relativePath)?.callables??[]).map(a=>`${a.name}:${a.startLine}`)),i.set(t.relativePath,s)),s.has(`${t.leaf}:${t.startLine}`)&&r.add(t.symbolId)}return r}export{N as a};
4
- //# sourceMappingURL=chunk-XTX6QHOF.js.map
4
+ //# sourceMappingURL=chunk-7KYNAMMH.js.map
@@ -1,2 +1,2 @@
1
- import{a as k,b as C}from"./chunk-U6WNH5GC.js";import{a as V,b as R,c as F,e as o,f as v}from"./chunk-B3X6KU75.js";import{a as B,b as g}from"./chunk-KMVGRIO2.js";import{N as y}from"./chunk-YGAGTIDK.js";function j(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:t=6,limit:i=20,scope:l,scanLimit:c,filePattern:d,focusFiles:h}=s,u=y(e).vueProfiles({scope:l,minBehaviorTokens:Math.max(3,t),scanLimit:c}).map(r=>({file:r.file,tokens:r.behaviorTokens,profile:r})),n=k(u,r=>r.tokens);return C({profiles:u,limit:i,filePattern:d,focusFiles:h,candidateIndex:n,profile:{name:"vue-composable-candidates"},compare:(r,a)=>T(r,a,m,t),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.fileB.localeCompare(a.fileB)})}function T(e,s,m,t){let i=B(e.tokens,s.tokens);if(i.size<t||!P(i))return null;let l=R(e.tokens,s.tokens);if(l<m)return null;let c=o(i,"composable:"),d=o(i,"store:"),h=o(i,"reactivity:"),u=o(i,"lifecycle:"),n=o(i,"request:"),r=o(i,"function:"),a=o(i,"function-verb:"),b=o(i,"template-binding:"),p=o(i,"template-event:"),f=q({sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p});return{fileA:e.file,fileB:s.file,similarity:l,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:v(i),sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p,evidenceClass:f.evidenceClass,actionTier:f.actionTier,evidenceClassReasons:f.reasons,recommendation:f.recommendation,uniqueToA:v(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:v(g(s.tokens,e.tokens)).slice(0,25),reason:S({sharedComposables:c,sharedStores:d,sharedRequests:n,sharedLifecycle:u,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function q(e){return V({genericWords:A,primitiveGroups:[{values:e.sharedReactivity,reasonPrefix:"shared reactivity primitive",bucket:"generic"},{values:e.sharedLifecycle,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedComposables,label:"shared composable",fallbackBucket:"shared-abstraction"},{names:e.sharedStores,label:"shared store",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedFunctions,label:"shared function",fallbackBucket:"generic"},{names:e.sharedFunctionVerbs,label:"shared action verb",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"},{names:e.sharedTemplateEvents,label:"shared template event",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store 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 composable-extraction evidence."}}function P(e){let s=0,m=0,t=0,i=0,l=0,c=0,d=0;for(let n of e)n.startsWith("composable:")?s+=1:n.startsWith("store:")?m+=1:n.startsWith("request:")?t+=1:n.startsWith("lifecycle:")?i+=1:n.startsWith("function:")?l+=1:n.startsWith("reactivity:")?c+=1:(n.startsWith("function-verb:")||n.startsWith("template-binding:")||n.startsWith("template-event:"))&&(d+=1);let h=s+m,u=h+t+i+l+d;return F([{name:"requests",count:t},{name:"lifecycle",count:i},{name:"functions",count:l},{name:"reusableHooks",count:h},{name:"reactivity",count:c},{name:"namedBehavior",count:u}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{lifecycle:1,functions:2,namedBehavior:4},reason:"shared lifecycle workflow"},{min:{reusableHooks:2,requests:1,namedBehavior:5},reason:"shared reusable Vue hooks and requests"},{min:{reusableHooks:2,functions:2,namedBehavior:5},reason:"shared reusable Vue hooks and functions"},{min:{functions:2,reactivity:1,namedBehavior:4},reason:"shared reactive functions"}]).pass}function S(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}var A=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{j as a};
2
- //# sourceMappingURL=chunk-DZ74OMG6.js.map
1
+ import{a as k,b as C}from"./chunk-TWMJ3Y3G.js";import{a as V,b as R,c as F,e as o,f as v}from"./chunk-B3X6KU75.js";import{a as B,b as g}from"./chunk-KMVGRIO2.js";import{J as y}from"./chunk-WUW7YUAH.js";function j(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:t=6,limit:i=20,scope:l,scanLimit:c,filePattern:d,focusFiles:h}=s,u=y(e).vueProfiles({scope:l,minBehaviorTokens:Math.max(3,t),scanLimit:c}).map(r=>({file:r.file,tokens:r.behaviorTokens,profile:r})),n=k(u,r=>r.tokens);return C({profiles:u,limit:i,filePattern:d,focusFiles:h,candidateIndex:n,profile:{name:"vue-composable-candidates"},compare:(r,a)=>T(r,a,m,t),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.fileB.localeCompare(a.fileB)})}function T(e,s,m,t){let i=B(e.tokens,s.tokens);if(i.size<t||!P(i))return null;let l=R(e.tokens,s.tokens);if(l<m)return null;let c=o(i,"composable:"),d=o(i,"store:"),h=o(i,"reactivity:"),u=o(i,"lifecycle:"),n=o(i,"request:"),r=o(i,"function:"),a=o(i,"function-verb:"),b=o(i,"template-binding:"),p=o(i,"template-event:"),f=q({sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p});return{fileA:e.file,fileB:s.file,similarity:l,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:v(i),sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p,evidenceClass:f.evidenceClass,actionTier:f.actionTier,evidenceClassReasons:f.reasons,recommendation:f.recommendation,uniqueToA:v(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:v(g(s.tokens,e.tokens)).slice(0,25),reason:S({sharedComposables:c,sharedStores:d,sharedRequests:n,sharedLifecycle:u,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function q(e){return V({genericWords:A,primitiveGroups:[{values:e.sharedReactivity,reasonPrefix:"shared reactivity primitive",bucket:"generic"},{values:e.sharedLifecycle,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedComposables,label:"shared composable",fallbackBucket:"shared-abstraction"},{names:e.sharedStores,label:"shared store",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedFunctions,label:"shared function",fallbackBucket:"generic"},{names:e.sharedFunctionVerbs,label:"shared action verb",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"},{names:e.sharedTemplateEvents,label:"shared template event",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store 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 composable-extraction evidence."}}function P(e){let s=0,m=0,t=0,i=0,l=0,c=0,d=0;for(let n of e)n.startsWith("composable:")?s+=1:n.startsWith("store:")?m+=1:n.startsWith("request:")?t+=1:n.startsWith("lifecycle:")?i+=1:n.startsWith("function:")?l+=1:n.startsWith("reactivity:")?c+=1:(n.startsWith("function-verb:")||n.startsWith("template-binding:")||n.startsWith("template-event:"))&&(d+=1);let h=s+m,u=h+t+i+l+d;return F([{name:"requests",count:t},{name:"lifecycle",count:i},{name:"functions",count:l},{name:"reusableHooks",count:h},{name:"reactivity",count:c},{name:"namedBehavior",count:u}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{lifecycle:1,functions:2,namedBehavior:4},reason:"shared lifecycle workflow"},{min:{reusableHooks:2,requests:1,namedBehavior:5},reason:"shared reusable Vue hooks and requests"},{min:{reusableHooks:2,functions:2,namedBehavior:5},reason:"shared reusable Vue hooks and functions"},{min:{functions:2,reactivity:1,namedBehavior:4},reason:"shared reactive functions"}]).pass}function S(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}var A=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{j as a};
2
+ //# sourceMappingURL=chunk-7LSVMFX7.js.map