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
@@ -1,6 +0,0 @@
1
- import{a as m}from"./chunk-54HA4ZXH.js";import{a as h}from"./chunk-FECYOO5O.js";import{d as g}from"./chunk-XYADIZHU.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let i=h(t,e);return i?R(t,i,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),i;try{i=f(r,"utf-8")}catch{return null}let n=i.split(`
2
- `),c=Math.max(0,e.startLine-a),l=Math.min(n.length-1,e.endLine+a),u=n.slice(c,l+1).join(`
3
- `);return{symbol:e.symbol,shortName:g(e.symbol),relativePath:e.relativePath,startLine:c,endLine:l,language:s?.language??v(e.relativePath),source:u}}function j(t,e,a,s,r){let i=m(t,e);if(!i)return null;let n=t.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",i);if(!n)return null;let c=d(t.config.projectRoot,n.relative_path),l;try{l=f(c,"utf-8")}catch{return null}let u=l.split(`
4
- `),o=Math.max(0,a-1-r),p=Math.min(u.length-1,s-1+r),b=u.slice(o,p+1).join(`
5
- `);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:p,language:n.language??v(n.relative_path),source:b}}function v(t){switch(y(t).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{M as a};
6
- //# sourceMappingURL=chunk-B5NLK2B3.js.map
@@ -1,2 +0,0 @@
1
- import{statSync as c}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,...r(t.config.dbPath)}}function r(t){try{let e=c(t);return{indexSizeBytes:e.size,lastBuilt:e.mtime}}catch{return{indexSizeBytes:0,lastBuilt:null}}}export{o as a};
2
- //# sourceMappingURL=chunk-C2QSK7E7.js.map
@@ -1,67 +0,0 @@
1
- function V(e,t){let n=e.split("/").at(-1)??e;if(P.has(n)||n===".scipquery.json"||/^tsconfig(?:\..+)?\.json$/.test(n))return"config";if(/\.d\.(?:ts|mts|cts)$/.test(e.toLowerCase()))return"ambient";let o=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return t.some(i=>(C[i]??[]).includes(o))?"source":"other"}function j(e,t,n){let o=e.split("/").at(-1)??e;if(n?.includes(e)||n?.includes(o)||P.has(o))return!0;let i=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(C[t]??[]).includes(i)}function ce(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!y(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!y(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(M)?null:t}function le(e,t){let n=new Map((e?.files??[]).map(a=>[a.path,a])),o=new Map(t.files.map(a=>[a.path,a])),i=new Set([...n.keys(),...o.keys()]),r=[];for(let a of[...i].sort()){let c=n.get(a),l=o.get(a),p=V(a,t.languages);!c&&l?r.push({kind:"added",path:a,inputKind:p,after:l}):c&&!l?r.push({kind:"deleted",path:a,inputKind:p,before:c}):c&&l&&(c.hash!==l.hash||c.size!==l.size)&&r.push({kind:"modified",path:a,inputKind:p,before:c,after:l})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(b(e?.files??[])||b(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(A)&&s.add("unreadable-input"),{version:1,changes:r,projectIdentityChanged:e?!L(e,t):!0,uncertainty:[...s].sort()}}function y(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function b(e){return new Set(e.map(t=>t.path)).size!==e.length}function M(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&typeof t.hash=="string"}function A(e){return e.hash==="unreadable"||e.size<0}function L(e,t){return m(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&m(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function m(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),o=[...t].sort();return n.every((i,r)=>i===o[r])}var P=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock","deps.edn","project.clj","bb.edn","shadow-cljs.edn"]),C={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{execFileSync as W}from"child_process";import{createHash as S}from"crypto";import{lstatSync as _,readdirSync as O,readFileSync as G,readlinkSync as E,realpathSync as F}from"fs";import{isAbsolute as $,join as x,relative as K,sep as T}from"path";function R(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function z(e){return(U(e)??q(e)).filter(t=>t&&!k(t)).sort()}function B(e,t={}){let n=z(e).filter(i=>!t.language||j(i,t.language,t.markerFiles)).filter(i=>!t.includePath||t.includePath(i)),o=F(e);return n.map(i=>{let r=x(e,i);try{if(_(r).isSymbolicLink()){let a=F(r),c=K(o,a);if(c===".."||c.startsWith(`..${T}`)||$(c))throw new Error("external symlink");let l=E(r);return{path:i,size:Buffer.byteLength(l),hash:S("sha256").update("symlink\0").update(l).digest("hex")}}let s=G(r);return{path:i,size:s.byteLength,hash:S("sha256").update(s).digest("hex")}}catch{return{path:i,size:-1,hash:"unreadable"}}})}function ye(e,t,n){return{version:2,languages:[...t].sort(),pnpmWorkspaces:n.typescriptProjectMode!=="workspace"&&n.pnpmWorkspaces===!0,typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:R(n.typescriptProjects),clojureConfigPath:N(n.clojureConfigPath),files:B(e)}}function N(e){return e?.trim()||void 0}function U(e){try{return W("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
2
- `).filter(Boolean)}catch{return null}}function q(e){let t=[],n=[""];for(;n.length>0;){let o=n.pop(),i=o?x(e,o):e,r;try{r=O(i,{withFileTypes:!0})}catch{continue}for(let s of r){let a=o?`${o}/${s.name}`:s.name;if(s.isDirectory()){k(a)||n.push(a);continue}t.push(a)}}return t}function k(e){let t=e.split("/");return e==="meta.json"||t.some(n=>H.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var H=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import J from"ignore";import{readFileSync as X,existsSync as v,readdirSync as Y}from"fs";import{dirname as g,isAbsolute as D,join as u,relative as Q,resolve as Z}from"path";function Ce(e){let t=J();return ee(e,t)||t.add(re),{isIgnored:o=>f(t,e,o),filter:o=>o.filter(i=>!f(t,e,i))}}function ee(e,t){let n=new Set,o=(s,a)=>{if(!(n.has(s)||!v(s)))try{let c=X(s,"utf-8");t.add(a?te(c,a):c),n.add(s)}catch{}},i=g(e),r=0;for(;i!==g(i)&&r<5&&(o(u(i,".gitignore"),""),!v(u(i,".git")));)i=g(i),r++;return I(e,"",t,o),n.size>0}function I(e,t,n,o){let i=t?u(e,t):e;o(u(i,".gitignore"),t);let r;try{r=Y(i,{withFileTypes:!0})}catch{return}for(let s of r){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;f(n,e,`${a}/`)||I(e,a,n,o)}}function te(e,t){let n=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(o=>ne(o,n)).join(`
3
- `)}function ne(e,t){let n=e.trimStart();if(!n||n.startsWith("#"))return e;let o=e.slice(0,e.length-n.length),i=n.startsWith("!"),r=i?n.slice(1):n;if(!r||r.startsWith("#"))return e;let s=r.startsWith("/"),a=s?r.slice(1):r,p=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${t}/${a}`:`${t}/**/${a}`;return`${o}${i?"!":""}${p}`}var re=`
4
- # Dependencies
5
- node_modules/
6
- vendor/
7
- .bundle/
8
-
9
- # Build output
10
- dist/
11
- build/
12
- out/
13
- target/
14
- bin/
15
- obj/
16
-
17
- # Python
18
- __pycache__/
19
- *.pyc
20
- *.pyo
21
- .venv/
22
- venv/
23
- .env/
24
- env/
25
- *.egg-info/
26
-
27
- # Rust
28
- target/
29
-
30
- # Java / Kotlin / Scala
31
- *.class
32
- .gradle/
33
- .mvn/
34
-
35
- # C# / .NET
36
- bin/
37
- obj/
38
- packages/
39
-
40
- # Go
41
- vendor/
42
-
43
- # Dart
44
- .dart_tool/
45
- build/
46
-
47
- # PHP
48
- vendor/
49
-
50
- # IDE / OS
51
- .idea/
52
- .vscode/
53
- *.swp
54
- *.swo
55
- .DS_Store
56
- Thumbs.db
57
-
58
- # Type definitions (often noise in queries)
59
- *.d.ts
60
- `;function f(e,t,n){let o=ie(t,n);if(!o)return!1;try{return e.ignores(o)}catch{return!1}}function ie(e,t){if(!t||t===".")return null;if(!D(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let n=D(t)?t:Z(e,t),o=Q(e,n).replaceAll("\\","/");return!o||o==="."||o.startsWith("..")?null:o}var oe=[];function d(e){e.groups.length>0&&oe.push(e)}function w(){let e=new WeakMap;return{cache:e,ensure(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}}}function ke(e,t){let{cache:n,ensure:o}=w(),i={get(r,s,a){let c=o(r);if(c.has(s))return c.get(s);let l=a();return c.set(s,l),l},invalidate(r,s){n.get(r)?.delete(s)},invalidateAll(r){n.delete(r)},size(r){return n.get(r)?.size??0}};return d({name:e,groups:t.clearGroups,clearAll:r=>i.invalidateAll(r),clearFile:(r,s)=>i.invalidate(r,s)}),i}function ve(e,t){let n=new WeakMap,o={get(i,r){let s=n.get(i);if(s)return s.value;let a=r();return n.set(i,{value:a}),a},invalidate(i){n.delete(i)},has(i){return n.has(i)}};return d({name:e,groups:t.clearGroups,clearAll:i=>o.invalidate(i)}),o}var se={clearGroups:["whole-project","source-file"]};function De(e){return ae(e,se)}function ae(e,t){let{cache:n,ensure:o}=w(),i={get(r,s,a,c){let l=o(r),p=l.get(s);if(p&&p.source===a)return p.value;let h=c();return l.set(s,{source:a,value:h}),h},invalidate(r,s){n.get(r)?.delete(s)},invalidateAll(r){n.delete(r)}};return d({name:e,groups:t.clearGroups,clearAll:r=>i.invalidateAll(r),clearFile:(r,s)=>i.invalidate(r,s)}),i}function we(e,t={}){let n=t.scope?"AND relative_path LIKE ?":"",o=t.like?"AND relative_path LIKE ?":"",i=[...t.scope?[`%${t.scope}%`]:[],...t.like?[t.like]:[]],r=e.all(`SELECT relative_path
61
- FROM documents
62
- WHERE 1 = 1
63
- ${e.pathExclusionsFor("documents")}
64
- ${n}
65
- ${o}
66
- ORDER BY relative_path`,...i).map(a=>a.relative_path),s=t.extensions?r.filter(a=>t.extensions.some(c=>a.toLowerCase().endsWith(c.toLowerCase()))):r;return t.includeIgnored===!1?s.filter(a=>!e.isIgnored(a)):s}export{V as a,ce as b,le as c,R as d,B as e,ye as f,d as g,ke as h,ve as i,De as j,ae as k,we as l,Ce as m};
67
- //# sourceMappingURL=chunk-C7NIYIQ4.js.map
@@ -1,7 +0,0 @@
1
- import d from"process";import{existsSync as J,readFileSync as Re}from"fs";import{dirname as D,join as we,resolve as v,sep as be}from"path";import{fileURLToPath as Se}from"url";import{spawn as Z}from"child_process";var l=class extends Error{},h=class extends Error{constructor(r,n,i){super(`rust-analyzer LSP request ${n} failed: ${i}`);this.code=r}code},ee=3e4,g=class{constructor(e,r={}){this.transport=e;this.requestTimeoutMs=r.requestTimeoutMs??ee,this.configuration=r.configuration??{},this.transport.onData(n=>this.handleData(n)),this.transport.onClose((n,i)=>this.rejectPending(new Error(ae(n,i)))),this.transport.onError(n=>this.rejectPending(n))}transport;nextId=1;buffer=Buffer.alloc(0);pending=new Map;diagnosedUris=new Set;diagnosticWaiters=new Map;readinessWaiters=new Set;requestTimeoutMs;configuration;currentServerStatusGeneration=0;latestServerStatus=null;shutdownStarted=!1;async initialize(e,r={}){let n=e.capabilities??{},i=n.experimental&&typeof n.experimental=="object"&&!Array.isArray(n.experimental)?n.experimental:{},s=await this.request("initialize",{...e,capabilities:{...n,experimental:{...i,serverStatusNotification:!0}}},r);return this.notify("initialized",{}),s}async references(e,r={}){let n=await this.request("textDocument/references",e,r);return Array.isArray(n)?n:[]}async definition(e,r={}){let n=await this.request("textDocument/definition",e,r);return ne(n)}async prepareCallHierarchy(e,r={}){let n=await this.request("textDocument/prepareCallHierarchy",e,r);return Array.isArray(n)?n:[]}async outgoingCalls(e,r={}){let n=await this.request("callHierarchy/outgoingCalls",{item:e},r);return Array.isArray(n)?n:[]}async hover(e,r={}){let n=await this.request("textDocument/hover",e,r);return n&&typeof n=="object"?n:null}async readinessBarrier(e={}){try{await this.request("scip-query/readinessBarrier",null,e)}catch(r){if(r instanceof h&&r.code===-32601)return;throw r}}serverStatusGeneration(){return this.currentServerStatusGeneration}serverStatusSnapshot(){let e=this.latestServerStatus;return e?{generation:e.generation,status:{...e.status}}:null}waitForQuiescence(e,r){let n=this.latestServerStatus;if(n&&n.generation>e){if(n.status.health==="error")return Promise.reject(q());if(n.status.quiescent)return Promise.resolve(n.status)}return new Promise((i,s)=>{let u={afterGeneration:e,resolve:i,reject:s,timeout:setTimeout(()=>{this.readinessWaiters.delete(u),s(new Error(`rust-analyzer readiness timed out after ${r}ms`))},r)};this.readinessWaiters.add(u)})}didOpenTextDocument(e){this.notify("textDocument/didOpen",{textDocument:e})}waitForDiagnostics(e,r){return this.diagnosedUris.has(e)?Promise.resolve(!0):new Promise(n=>{let i=a=>{clearTimeout(s),n(a)},s=setTimeout(()=>{let a=this.diagnosticWaiters.get(e)?.filter(c=>c!==i);a&&a.length>0?this.diagnosticWaiters.set(e,a):this.diagnosticWaiters.delete(e),n(!1)},r),u=this.diagnosticWaiters.get(e)??[];u.push(i),this.diagnosticWaiters.set(e,u)})}async shutdown(e={}){if(!this.shutdownStarted){this.shutdownStarted=!0;try{await this.request("shutdown",null,e),this.notify("exit",null)}catch(r){throw this.notify("exit",null),this.transport.kill(),r}}}request(e,r,n={}){let i=R(n.timeoutMs??this.requestTimeoutMs,n.deadlineMs),s=this.nextId++,u={jsonrpc:"2.0",id:s,method:e,params:r};return new Promise((a,c)=>{let f=setTimeout(()=>{this.pending.delete(s),c(i.deadlineLimited?new l(`rust-analyzer readiness deadline expired during LSP request ${e}`):new Error(`rust-analyzer LSP request ${e} timed out after ${i.timeoutMs}ms`))},i.timeoutMs);this.pending.set(s,{method:e,deadlineMs:n.deadlineMs,resolve:y=>a(y),reject:c,timeout:f}),this.transport.write(z(u))})}notify(e,r){this.transport.write(z({jsonrpc:"2.0",method:e,params:r}))}handleData(e){for(this.buffer=Buffer.concat([this.buffer,e]);;){let r=this.buffer.indexOf(`\r
2
- \r
3
- `);if(r<0)return;let n=this.buffer.subarray(0,r).toString("ascii"),i=/(?:^|\r\n)Content-Length:\s*(\d+)/i.exec(n);if(!i){this.rejectPending(new Error("rust-analyzer LSP response missing Content-Length header"));return}let s=Number(i[1]),u=r+4,a=u+s;if(this.buffer.length<a)return;let c=this.buffer.subarray(u,a).toString("utf8");this.buffer=this.buffer.subarray(a),this.dispatchMessage(oe(c))}}dispatchMessage(e){if(this.recordDiagnosticNotification(e),this.recordServerStatusNotification(e),e.id!==void 0&&e.id!==null&&e.method){this.respondToServerRequest(e);return}if(e.id===void 0||e.id===null)return;let r=this.pending.get(e.id);if(r){if(clearTimeout(r.timeout),this.pending.delete(e.id),e.error){r.reject(new h(e.error.code,r.method,e.error.message));return}if(r.deadlineMs!==void 0&&Date.now()>=r.deadlineMs){r.reject(new l(`rust-analyzer readiness deadline expired during LSP request ${r.method}`));return}r.resolve(e.result)}}recordDiagnosticNotification(e){if(e.method!=="textDocument/publishDiagnostics")return;let r=e.params,n=r&&typeof r=="object"&&typeof r.uri=="string"?r.uri:null;if(!n)return;this.diagnosedUris.add(n);let i=this.diagnosticWaiters.get(n)??[];this.diagnosticWaiters.delete(n),i.forEach(s=>s(!0))}recordServerStatusNotification(e){if(e.method!=="experimental/serverStatus"||e.id!==void 0||!te(e.params))return;let r=e.params,n={health:r.health,quiescent:r.quiescent,...typeof r.message=="string"?{message:r.message}:{}},i=++this.currentServerStatusGeneration;if(this.latestServerStatus={generation:i,status:n},n.health==="error"){this.rejectReadinessWaiters(q());return}if(n.quiescent)for(let s of this.readinessWaiters)i<=s.afterGeneration||(clearTimeout(s.timeout),this.readinessWaiters.delete(s),s.resolve(n))}respondToServerRequest(e){if(e.id===void 0||e.id===null||!e.method)return;let r=e.method==="workspace/configuration"?this.workspaceConfiguration(e.params):null;this.transport.write(z({jsonrpc:"2.0",id:e.id,result:r}))}workspaceConfiguration(e){return(e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]).map(n=>typeof n.section=="string"?re(this.configuration,n.section):this.configuration)}rejectPending(e){for(let[r,n]of this.pending)clearTimeout(n.timeout),n.reject(e),this.pending.delete(r);this.rejectReadinessWaiters(e)}rejectReadinessWaiters(e){for(let r of this.readinessWaiters)clearTimeout(r.timeout),r.reject(e),this.readinessWaiters.delete(r)}};function R(t,e,r=Date.now){if(e===void 0)return{timeoutMs:t,deadlineLimited:!1};let n=e-r();if(n<=0)throw new l("rust-analyzer readiness deadline expired before LSP operation");return{timeoutMs:Math.min(t,n),deadlineLimited:n<=t}}function te(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return(e.health==="ok"||e.health==="warning"||e.health==="error")&&typeof e.quiescent=="boolean"&&(e.message===void 0||e.message===null||typeof e.message=="string")}function q(){return new l("rust-analyzer reported error health before reaching readiness")}function re(t,e){let r=e.startsWith("rust-analyzer.")?e.slice(14):e;if(r===""||r==="rust-analyzer")return t;let n=t;for(let i of r.split(".")){if(!n||typeof n!="object")return null;n=n[i]}return n??null}function ne(t){return t?(Array.isArray(t)?t:[t]).flatMap(r=>ie(r)?[r]:se(r)?[{uri:r.targetUri,range:r.targetSelectionRange}]:[]):[]}function ie(t){return!!(t&&typeof t=="object"&&typeof t.uri=="string")}function se(t){return!!(t&&typeof t=="object"&&typeof t.targetUri=="string")}function W(t,e,r=process.env){let n=Z(t,[],{cwd:e,env:r,stdio:["pipe","pipe","pipe"]});return{write(i){n.stdin.write(i)},onData(i){n.stdout.on("data",i)},onClose(i){n.on("close",i)},onError(i){n.on("error",i)},kill(){n.kill()}}}function z(t){let e=JSON.stringify(t);return`Content-Length: ${Buffer.byteLength(e,"utf8")}\r
4
- \r
5
- ${e}`}function oe(t){let e=JSON.parse(t);if(!e||typeof e!="object")throw new Error("rust-analyzer LSP response was not a JSON object");return e}function ae(t,e){return`rust-analyzer LSP transport closed${e?` by ${e}`:t===null?"":` with code ${t}`}`}async function j(t,e,r,n=Date.now){let i=r-n();if(i<=0)throw new l("rust-analyzer readiness deadline expired before quiescence");try{let s=await t.waitForQuiescence(e,i);if(w(r,n,"during quiescence"),s.health==="error")throw new l("rust-analyzer reported error health before reaching readiness");if(!s.quiescent)throw new l("rust-analyzer did not report quiescence before reaching readiness");return s}catch(s){throw s instanceof l?s:new l(s instanceof Error?s.message:String(s))}}async function Ge(t,e,r,n,i,s=Date.now,u=x){let a=await j(t,e,n,s);if(r===0)return a;let c=t.serverStatusSnapshot();if(!c)throw new l("rust-analyzer status is unavailable after initial document open");return await ue(t,c,r,n,i,s,u)??a}async function ue(t,e,r,n,i,s=Date.now,u=x){if(r===0)return null;if(!e)throw new l("rust-analyzer status is unavailable before document open");E(e.status,"before document open");try{await t.readinessBarrier({deadlineMs:n}),w(n,s,"during post-open synchronization")}catch(f){throw f instanceof l?f:new l(f instanceof Error?f.message:String(f))}let a=t.serverStatusSnapshot();if(!a||a.generation<e.generation)throw new l("rust-analyzer status is unavailable after document open");let c;return a.generation===e.generation?(E(a.status,"after document open"),c=a.status):c=await j(t,e.generation,n,s),await P(i,n,s,u),c}async function Qe(t,e,r,n=Date.now){let i=R(e,r,n);await t(i.timeoutMs),w(r,n,"during diagnostics")}async function P(t,e,r=Date.now,n=x){if(t<=0)return;if(R(t,e,r).deadlineLimited)throw new l("rust-analyzer readiness deadline cannot accommodate delay");await n(t),w(e,r,"during delay")}async function Ke(t,e){try{return await t()}catch(r){throw r instanceof l&&await e(),r}}function Ve(t){return t instanceof l?{ok:!1,error:t.message}:null}function w(t,e,r){if(t-e()<=0)throw new l(`rust-analyzer readiness deadline expired ${r}`)}function E(t,e){if(t.health==="error")throw new l(`rust-analyzer reported error health ${e}`);if(!t.quiescent)throw new l(`rust-analyzer did not report quiescence ${e}`)}function x(t){return new Promise(e=>setTimeout(e,t))}import{existsSync as le,readFileSync as ce}from"fs";import{relative as fe,resolve as H,sep as de}from"path";import{fileURLToPath as pe,pathToFileURL as me}from"url";function b(t,e){return me(H(t,e)).href}function C(t,e){let r=pe(e);return fe(t,r).split(de).join("/")}function S(t,e,r){return{textDocument:{uri:b(t,e.relativePath)},position:ye(t,e),context:{includeDeclaration:r}}}function ye(t,e){let r={line:e.startLine,character:e.startChar??0},n=H(t,e.relativePath);if(!le(n))return r;try{return he(ce(n,"utf8"),e,r)}catch{return r}}function he(t,e,r={line:e.startLine,character:e.startChar??0}){let n=t.split(/\r?\n/),i=n[e.startLine];if(i===void 0||e.leaf.length===0)return r;let s=Math.max(0,Math.min(r.character,i.length)),u=i.indexOf(e.leaf,s);if(u>=0)return{line:e.startLine,character:A(u,e.leaf)};let a=i.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:A(a,e.leaf)};let c=ge(n,e.startLine,e.leaf);return c||r}function A(t,e){return t+Math.max(0,e.length-2)}function ge(t,e,r){for(let n of[-1,1,-2,2]){let i=e+n;if(i<0||i>=t.length)continue;let s=t[i].indexOf(r);if(s>=0)return{line:i,character:A(s,r)}}return null}function F(t,e){return e.map(r=>({file:C(t,r.uri),line:r.range.start.line,column:r.range.start.character}))}function $(t){let e=new Map;for(let r of t)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,n)=>{let i=r.file.localeCompare(n.file);return i!==0?i:r.line!==n.line?r.line-n.line:r.column-n.column})}async function ve(t){let e=t.includeReferences!==!1,r=t.includeCallees===!0,n=t.includeSignatures===!0,i={timeoutMs:t.requestTimeoutMs},s=Le(t),u=B(t),a=U(t),c=N(t),f=ke(t.projectRoot,s),y=Me(t.projectRoot,f),k=De(f),p=new g(W(t.rustAnalyzerBinary,y),{requestTimeoutMs:t.requestTimeoutMs,configuration:k});try{let L=await p.initialize({processId:d.pid,rootUri:b(y,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:k});if(e&&!L.capabilities.referencesProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/references support.",references:u.map(o=>[o.symbolId,[]]),...r?{callees:a.map(o=>[o.symbolId,[]])}:{}};if(r&&!L.capabilities.callHierarchyProvider)return{available:!1,reason:"rust-analyzer initialized without call hierarchy support.",references:u.map(o=>[o.symbolId,[]]),callees:a.map(o=>[o.symbolId,[]]),...n?{signatures:c.map(o=>[o.symbolId,null])}:{}};if(n&&!L.capabilities.hoverProvider)return{available:!1,reason:"rust-analyzer initialized without hover support.",references:u.map(o=>[o.symbolId,[]]),...r?{callees:a.map(o=>[o.symbolId,[]])}:{},signatures:c.map(o=>[o.symbolId,null])};let V=Ie(p,t.projectRoot,s);await Oe(p,V,t.diagnosticsTimeoutMs??1e4),await K(t.settleDelayMs??5e3);let I=e?await T(u,t.concurrency??8,async o=>{let O=await _(p,S(t.projectRoot,o,!1),{requestTimeoutMs:t.requestTimeoutMs,retryTimeoutMs:t.referenceRetryTimeoutMs});return{symbolId:o.symbolId,references:$(F(t.projectRoot,O.locations)),complete:O.complete}}):u.map(o=>({symbolId:o.symbolId,references:[],complete:!0})),X=r?await T(a,t.concurrency??8,async o=>({symbolId:o.symbolId,callees:await We(p,t.projectRoot,o,i)})):[],Y=n?await T(c,t.concurrency??8,async o=>({symbolId:o.symbolId,signature:await ze(p,t.projectRoot,o,i)})):[];return{available:!0,references:I.filter(o=>o.complete).map(o=>[o.symbolId,o.references]),incompleteReferenceSymbolIds:I.filter(o=>!o.complete).map(o=>o.symbolId),...r?{callees:X.map(o=>[o.symbolId,o.callees])}:{},...n?{signatures:Y.map(o=>[o.symbolId,o.signature])}:{}}}finally{await p.shutdown().catch(()=>{})}}function B(t){return t.referenceDefinitions??t.definitions}function U(t){return t.calleeDefinitions??t.definitions}function N(t){return t.signatureDefinitions??t.definitions}function Le(t){return[...t.includeReferences!==!1?B(t):[],...t.includeCallees===!0?U(t):[],...t.includeSignatures===!0?N(t):[]]}async function ze(t,e,r,n={}){let i=S(e,r,!1),s=await Pe(t,{textDocument:i.textDocument,position:i.position},n);return xe(s)}async function Pe(t,e,r={}){try{return await t.hover(e,r)}catch(n){if(m(n),!(n instanceof Error?n.message:String(n)).includes("content modified"))return null;await Q(r.deadlineMs);try{return await t.hover(e,r)}catch(s){return m(s),null}}}function xe(t){if(!t)return null;let e=Ae(t.contents),r=/```(?:rust)?\s*([\s\S]*?)```/i.exec(e),n=r?r[1]:e;for(let i of n.split(/\r?\n/)){let s=i.replace(/^`+|`+$/g,"").trim();if(s&&Te(s))return s}return null}function Ae(t){return typeof t=="string"?t:Array.isArray(t)?t.map(Ce).join(`
6
- `):"value"in t?t.value:""}function Ce(t){return typeof t=="string"?t:t.value}function Te(t){return/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?(?:unsafe\s+)?(?:extern\s+(?:"[^"]+"\s+)?)?(?:fn|struct|enum|trait|type|const|static|mod)\b/.test(t)}function De(t){return{...t.length>0?{linkedProjects:t}:{},references:{excludeImports:!1,excludeTests:!1}}}function Me(t,e){return e.length===1?D(e[0]):v(t)}function ke(t,e){let r=v(t),n=[],i=new Set;for(let s of e){let u=D(v(r,s.relativePath));for(;$e(r,u);){let a=we(u,"Cargo.toml");if(J(a)){i.has(a)||(i.add(a),n.push(a));break}let c=D(u);if(c===u)break;u=c}}return n}function Ie(t,e,r){let n=new Set,i=[];for(let s of r){if(n.has(s.relativePath))continue;n.add(s.relativePath);let u=v(e,s.relativePath);if(!J(u))continue;let a=b(e,s.relativePath);t.didOpenTextDocument({uri:a,languageId:"rust",version:1,text:Re(u,"utf8")}),i.push(a)}return i}async function Oe(t,e,r){await Promise.all(e.map(n=>t.waitForDiagnostics(n,r).catch(()=>!1)))}async function lt(t,e){return(await _(t,e)).locations}async function _(t,e,r={}){try{return{locations:await t.references(e,{timeoutMs:r.requestTimeoutMs,deadlineMs:r.deadlineMs}),complete:!0}}catch(n){m(n);let i=n instanceof Error?n.message:String(n);if(M(n))return qe(t,e,r);if(!i.includes("content modified"))return{locations:[],complete:!0};await Q(r.deadlineMs);try{return{locations:await t.references(e,G(r)),complete:!0}}catch(s){return m(s),{locations:[],complete:!M(s)}}}}async function qe(t,e,r){if(!r.retryTimeoutMs||r.retryTimeoutMs<=0)return{locations:[],complete:!1};let n=G(r);try{return{locations:await t.references(e,n),complete:!0}}catch(i){return m(i),{locations:[],complete:!M(i)}}}function G(t){return{...t.retryTimeoutMs&&t.retryTimeoutMs>0?{timeoutMs:t.retryTimeoutMs}:{},...t.deadlineMs!==void 0?{deadlineMs:t.deadlineMs}:{}}}function M(t){let e=t instanceof Error?t.message:String(t);return e.includes("rust-analyzer LSP request")&&e.includes("timed out after")}async function We(t,e,r,n={}){let i=S(e,r,!1),s=await Ee(t,{textDocument:i.textDocument,position:i.position},n),u=(await Promise.all(s.map(a=>je(t,a,n)))).flat();return Fe(He(e,u))}async function Ee(t,e,r={}){try{return await t.prepareCallHierarchy(e,r)}catch(n){return m(n),[]}}async function je(t,e,r={}){try{return await t.outgoingCalls(e,r)}catch(n){return m(n),[]}}async function Q(t){if(t===void 0){await K(1e3);return}await P(1e3,t)}function m(t){if(t instanceof l)throw t}function He(t,e){return e.map(r=>({symbol:r.to.name,file:C(t,r.to.uri),line:r.to.selectionRange.start.line}))}function Fe(t){let e=new Set,r=[];for(let n of t){let i=`${n.symbol}\0${n.file}\0${n.line}`;e.has(i)||(e.add(i),r.push(n))}return r.sort((n,i)=>n.file.localeCompare(i.file)||n.line-i.line||n.symbol.localeCompare(i.symbol))}function K(t){return t<=0?Promise.resolve():new Promise(e=>setTimeout(e,t))}function $e(t,e){return e===t||e.startsWith(`${t}${be}`)}async function T(t,e,r){let n=new Array(t.length),i=0,s=Math.max(1,Math.min(t.length,Math.floor(e)));return await Promise.all(Array.from({length:s},async()=>{for(;i<t.length;){let u=i++;n[u]=await r(t[u])}})),n}async function Je(){return new Promise((t,e)=>{let r=[];d.stdin.on("data",n=>r.push(n)),d.stdin.on("error",e),d.stdin.on("end",()=>t(Buffer.concat(r).toString("utf8")))})}async function Be(){try{let t=JSON.parse(await Je()),e=await ve(t);d.stdout.write(JSON.stringify(e))}catch(t){let e={available:!1,reason:t instanceof Error?t.message:String(t),references:[]};d.stdout.write(JSON.stringify(e)),d.exitCode=1}}d.argv[1]&&Se(import.meta.url)===d.argv[1]&&Be();export{g as a,W as b,Ge as c,ue as d,Qe as e,Ke as f,Ve as g,b as h,C as i,S as j,F as k,$ as l,ve as m,B as n,U as o,N as p,Le as q,ze as r,Pe as s,xe as t,De as u,Me as v,ke as w,Ie as x,Oe as y,lt as z,_ as A,We as B,K as C,T as D};
7
- //# sourceMappingURL=chunk-D4U5Q3FT.js.map
@@ -1,60 +0,0 @@
1
- import m from"ignore";import{readFileSync as p,existsSync as f,readdirSync as b}from"fs";import{dirname as d,isAbsolute as u,join as l,relative as v,resolve as $}from"path";function A(n){let t=m();return S(n,t)||t.add(_),{isIgnored:e=>g(t,n,e),filter:e=>e.filter(i=>!g(t,n,i))}}function S(n,t){let r=new Set,e=(s,a)=>{if(!(r.has(s)||!f(s)))try{let c=p(s,"utf-8");t.add(a?F(c,a):c),r.add(s)}catch{}},i=d(n),o=0;for(;i!==d(i)&&o<5&&(e(l(i,".gitignore"),""),!f(l(i,".git")));)i=d(i),o++;return y(n,"",t,e),r.size>0}function y(n,t,r,e){let i=t?l(n,t):n;e(l(i,".gitignore"),t);let o;try{o=b(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;g(r,n,`${a}/`)||y(n,a,r,e)}}function F(n,t){let r=t.replaceAll("\\","/").replace(/\/+$/,"");return n.split(/\r?\n/).map(e=>T(e,r)).join(`
2
- `)}function T(n,t){let r=n.trimStart();if(!r||r.startsWith("#"))return n;let e=n.slice(0,n.length-r.length),i=r.startsWith("!"),o=i?r.slice(1):r;if(!o||o.startsWith("#"))return n;let s=o.startsWith("/"),a=s?o.slice(1):o,h=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${t}/${a}`:`${t}/**/${a}`;return`${e}${i?"!":""}${h}`}var _=`
3
- # Dependencies
4
- node_modules/
5
- vendor/
6
- .bundle/
7
-
8
- # Build output
9
- dist/
10
- build/
11
- out/
12
- target/
13
- bin/
14
- obj/
15
-
16
- # Python
17
- __pycache__/
18
- *.pyc
19
- *.pyo
20
- .venv/
21
- venv/
22
- .env/
23
- env/
24
- *.egg-info/
25
-
26
- # Rust
27
- target/
28
-
29
- # Java / Kotlin / Scala
30
- *.class
31
- .gradle/
32
- .mvn/
33
-
34
- # C# / .NET
35
- bin/
36
- obj/
37
- packages/
38
-
39
- # Go
40
- vendor/
41
-
42
- # Dart
43
- .dart_tool/
44
- build/
45
-
46
- # PHP
47
- vendor/
48
-
49
- # IDE / OS
50
- .idea/
51
- .vscode/
52
- *.swp
53
- *.swo
54
- .DS_Store
55
- Thumbs.db
56
-
57
- # Type definitions (often noise in queries)
58
- *.d.ts
59
- `;function g(n,t,r){let e=G(t,r);if(!e)return!1;try{return n.ignores(e)}catch{return!1}}function G(n,t){if(!t||t===".")return null;if(!u(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=u(t)?t:$(n,t),e=v(n,r).replaceAll("\\","/");return!e||e==="."||e.startsWith("..")?null:e}export{A as a};
60
- //# sourceMappingURL=chunk-DGAGY7RJ.js.map
@@ -1,5 +0,0 @@
1
- import{a as G}from"./chunk-QOKYJ33H.js";import{a as _}from"./chunk-GBQ5NYPR.js";import{a as U}from"./chunk-QZ4JVECJ.js";import{h as F,o as O,p as L,q as H,s as $,v as K,x as z,y as X}from"./chunk-L7SPDE73.js";import{existsSync as Y,readFileSync as P,statSync as St}from"fs";import{join as T}from"path";function I(t,n){let e=it(t,n)??rt(t,n)??ot(t,n)??st(t,n);return ct(t,e,n)}function it(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=j(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(j(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function j(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function rt(t,n){if(!v(t[n]??""))return null;let e=n;for(;e>0&&v(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&v(t[i]??"");)i+=1;return{start:e,end:i}}function v(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function ot(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(w(o)!==null)break;if(N(o)!==null)return null;e-=1}if(e<0)return null;let i=w(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",s=w(o);if(s!==null){if(s<=i)break;r+=1;continue}if(N(o)!==null)break;r+=1}return{start:e,end:r}}function w(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function st(t,n){let e=t[n]??"";if(V(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&q(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&q(t[r]??"");)r+=1;return{start:i,end:r}}function q(t){return N(t)===null}function N(t){return t.trim().length===0?"blank":V(t)?"heading":j(t)?"fence":v(t)?"table":w(t)!==null?"list":null}function V(t){return/^#{1,6}\s+/.test(t.trim())}function ct(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 R(t,n){return n.filter(e=>t.includes(e))}import{existsSync as at,readFileSync as W}from"fs";var lt=/<!--\s*scip-query:\s*snapshot\s*-->/i;function Z(t,n){if((t.config.docs?.snapshotPaths??[]).some(r=>U(r,n)))return!0;let i=X(t,n);return i.length>0&&lt.test(i)}var J={classifyCitation:ut,citationContexts:ft,citationKindLabel:ht,citationRemediation:mt,referenceTargets:pt,hasLineAnchoredCitation:dt};function dt(t){return t.some(n=>(n.lineReferences?.length??0)>0)}function ut(t){let n=t.join(`
3
- `).toLowerCase(),e=[],i=R(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=R(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=R(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 ft(t,n,e){let i;try{i=W(`${t.config.projectRoot}/${n}`,"utf-8").split(/\r?\n/)}catch{return[]}let r=e.flatMap(gt),o=[];for(let s=0;s<i.length;s+=1){let c=i[s]??"";r.some(a=>c.includes(a))&&o.push(I(i,s))}return o}function gt(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 ht(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 mt(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=G(e),r=new Set;for(let o of n)yt(t,o,i.get(o)??[])&&r.add(o);return r}function yt(t,n,e){if(!Ct.test(n))return!0;let i=`${t.config.projectRoot}/${n}`;if(!at(i))return!0;if(e.length===0)return!1;let r=W(i,"utf-8").split(/\r?\n/),o=bt(r);for(let s of e)for(let c=s.startLine;c<=s.endLine;c+=1)if((r[c]??"").trim()!==""&&!o.has(c))return!0;return!1}var Ct=/\.(?:[cm]?[jt]sx?)$/i;function bt(t){let n=new Set,e=!1;for(let i=0;i<t.length;i+=1){let r=t[i].trim();!e&&Dt(r)&&(e=!0),e&&(n.add(i),r.endsWith(";")&&(e=!1))}return n}function Dt(t){return/^import(?:\s|$)/.test(t)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(t)}var Q=K({kind:"doc-path-evidence",invalidation:z("doc-path-evidence"),serialize:Nt,deserialize:Bt}),M=/\.(?:md|mdx|rst|txt)$/i;function xt(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var Rt=3,Tt=/([A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6})(?::([1-9][0-9]*))?\b/g;function sn(t,n={}){let{doc:e,limit:i=20,minCoupling:r=Rt,includeSnapshotExcluded:o=!1}=n,s=wt(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&&!tt(t,a)||e!==void 0&&!Y(T(t.config.projectRoot,a)))continue;let d=Z(t,a);if(d&&!o)continue;let{value:p,estimated:y}=At(t,a,s.changeTimes.get(a)),g=Mt(t,a),u=new Map,{resolved:l,broken:h,citations:D}=kt(t,a,s.tracked,s.trackedBySuffix,s.everSeenInHistory),S=new Map(D.map(f=>[f.file,f]));for(let f of l){if(f===a||M.test(f))continue;let C=(s.changeTimes.get(f)??[]).filter(b=>b>p).length;if(C===0)continue;let m=S.get(f);u.set(f,{file:f,evidence:"reference",coChanges:0,changesSinceDocUpdate:C,...B("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(A=>A>p).length;if(m===0)continue;let b=u.get(f);b?(b.evidence="both",b.coChanges=C,Object.assign(b,B("both",g,b.citationContexts))):u.set(f,{file:f,evidence:"co-change",coChanges:C,changesSinceDocUpdate:m,...B("co-change",g)})}if(u.size===0&&h.length===0)continue;let x=[...u.values()].sort((f,C)=>C.changesSinceDocUpdate-f.changesSinceDocUpdate);c.push({doc:a,docLastChangedAt:p,staleness:x.reduce((f,C)=>f+C.changesSinceDocUpdate,0)+h.length*10,subjects:x.slice(0,8),brokenReferences:h,...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 At(t,n,e){if(e&&e.length>0)return{value:Math.max(...e),estimated:!1};try{return{value:Math.floor(St(T(t.config.projectRoot,n)).mtimeMs/1e3),estimated:!0}}catch{return{value:0,estimated:!1}}}function Mt(t,n){let e;try{e=P(T(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
4
- ${e}`.toLowerCase(),r=R(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=R(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 B(t,n,e=[]){let i=t==="co-change"||e.length===0?null:J.classifyCitation(e);return{actionTier:vt(t,n.docIntent,i?.actionTier),docIntent:n.docIntent,docIntentReasons:n.reasons,...i?{citationKind:i.citationKind,citationKindReasons:i.reasons}:{}}}function vt(t,n,e){return n==="historical-note"?"support":e||(t==="co-change"?"signal":"direct")}function wt(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)],p=d.filter(g=>M.test(g)),y=d.filter(g=>!M.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 p){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=>M.test(a)),everSeenInHistory:c,historyCommitCount:i.commits.length,tracked:r,trackedBySuffix:nt(r)}}function cn(t,n){if(n.size===0)return[];let e=H(),i=0,r=0,o=0,s=0,c=0,a=0;return $("doc-reference.docs-citing-files",()=>{let d=_(t).trackedFiles()??new Set;i=d.size;let p=nt(d),y=It(n,p),g=[];for(let u of d){if(!tt(t,u))continue;e&&(r+=1);let l;try{l=P(T(t.config.projectRoot,u),"utf-8")}catch{e&&(o+=1);continue}if(!_t(l,y)){e&&(s+=1);continue}let h=et(t,u,l);if(!h)continue;e&&(c+=1);let D=Et(h.candidates,n,y,d,p);if(D.size===0)continue;let S=[...new Set([...D.values()].flatMap(m=>[...m]))],x=Lt(h.contextsByCandidate,S),f=[...D].map(([m,b])=>({file:m,contexts:E([...b].flatMap(A=>x.get(A)??[])).slice(0,3),lineReferences:k([...b].flatMap(A=>h.lineReferencesByCandidate.get(A)??[]))})).filter(m=>m.contexts.length>0),C=[...D.keys()];if(C.length>0){e&&(a+=1);let m=C.sort();g.push({doc:u,cited:m,citations:f,citedClaims:E(f.flatMap(b=>b.contexts)).slice(0,3)})}}return g},()=>({targets:n.size,trackedFiles:i,livingDocs:r,unreadableDocs:o,candidateMisses:s,evidenceDocs:c,citedDocs:a}))}function tt(t,n){return M.test(n)&&!xt(n)&&Y(T(t.config.projectRoot,n))}function nt(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 It(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 Et(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 kt(t,n,e,i,r){let o=new Set,s=new Set,c=et(t,n);if(!c)return{resolved:o,broken:[],citations:[]};let a=c.candidates,d=c.contextsByCandidate,p=c.lineReferencesByCandidate,y=new Map,g=new Map,u=(l,h)=>{let D=d.get(h);if(D&&D.length>0){let x=y.get(l)??[];x.push(...D),y.set(l,E(x).slice(0,3))}let S=p.get(h);S&&S.length>0&&g.set(l,k([...g.get(l)??[],...S]))};for(let l of a){if(e.has(l)){o.add(l),u(l,l);continue}let h=i.get(l);if(h&&h.length===1){o.add(h[0]),u(h[0],l);continue}h&&h.length>1||r.has(l)&&s.add(l)}return{resolved:o,broken:[...s],citations:[...y].map(([l,h])=>({file:l,contexts:h,lineReferences:g.get(l)}))}}function Lt(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 et(t,n,e){let i=e;if(i===void 0)try{i=P(T(t.config.projectRoot,n),"utf-8")}catch{return null}let r=F(t,n,i),o=Q.read(t,n,r);if(o)return o;let s=jt(i);return Q.write(t,n,r,s),s}function _t(t,n){for(let e of n)if(t.includes(e))return!0;return!1}function jt(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(Tt)){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,k([...r.get(a)??[],d]));let p=I(n,o);if(p.length===0)continue;let y=i.get(a)??[];y.push(p),i.set(a,E(y).slice(0,3))}}return{candidates:[...e],contextsByCandidate:i,lineReferencesByCandidate:r}}function Nt(t){let n={candidates:t.candidates,contextsByCandidate:[...t.contextsByCandidate.entries()],lineReferencesByCandidate:[...t.lineReferencesByCandidate.entries()]};return JSON.stringify(n)}function Bt(t){try{let n=JSON.parse(t);if(!O(n))return null;let e=L(n.candidates),i=Ft(n.contextsByCandidate),r=Pt(n.lineReferencesByCandidate);return!e||!i?null:{candidates:e,contextsByCandidate:new Map(i),lineReferencesByCandidate:new Map(r??[])}}catch{return null}}function Pt(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],k(i)])}return n}function Ft(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 E(t){let n=[];for(let e of new Set(t))n.some(i=>Ot(i,e))||n.push(e);return n}function k(t){return[...new Set(t)].sort((n,e)=>n-e)}function Ot(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,xt as c,sn as d,cn as e};
5
- //# sourceMappingURL=chunk-DLWR3NUU.js.map
@@ -1,3 +0,0 @@
1
- import{a as le}from"./chunk-4SALD7RU.js";import{c as T}from"./chunk-NH5ALKPW.js";import{b as Q,e as ee,f as te,g as ne}from"./chunk-Q3AFUTGB.js";import{b as ce}from"./chunk-B75HZHUP.js";import{b as P}from"./chunk-UOAV44HR.js";import{h as oe,n as N}from"./chunk-LBMJEAEW.js";import{a as ie,b as re,c as se,m as ae}from"./chunk-U7DSEKOM.js";import{B as E,d as $,e as J,g as K,h as q,i as G,j as V,k as X,w as Y}from"./chunk-XYADIZHU.js";import{p as Z}from"./chunk-X6D5IC6I.js";import{B as H,E as x,c as w}from"./chunk-YGAGTIDK.js";import{b as L,h as U,s as b,v as j,x as W,y as I,z}from"./chunk-L7SPDE73.js";import{a as S}from"./chunk-64MNV6AB.js";var _=new WeakMap,ue=j({kind:"definition-exclusions",invalidation:W("definition-exclusions"),serialize:e=>JSON.stringify(e),deserialize:Ie});function fe(e,t){let n=H(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let r=I(e,t);if(!r)return[];let o=U(e,t,r),c=ue.read(e,t,o);if(c)return c;let u=n==="rust"?Oe(e,t):ke(e,t);return ue.write(e,t,o,u),u}function Ie(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.map(Pe);return n.some(i=>i===null)?null:n}catch{return null}}function Pe(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"||t.containerName!==void 0&&typeof t.containerName!="string")return null;let n=t.disposition===void 0?Ge(t.reason):t.disposition;return n!=="exclude"&&n!=="implicit-usage"?null:{startLine:t.startLine,endLine:t.endLine,reason:t.reason,disposition:n,...t.containerName?{containerName:t.containerName}:{}}}var me=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),Ne=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,Te=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function ke(e,t){let n=I(e,t);if(!n||!Ae(n))return[];let i=x(e,t);if(!i)return[];let r=_.get(i);if(r)return r;let o=!1,c=i.rootNode;for(let l of c.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let s=d.namedChild(0);if(!s)continue;let a=s.type==="member_expression"?s.namedChild(s.namedChildCount-1)?.text:s.text;if(a&&me.has(a)){o=!0;break}}let u=[];o&&u.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)",disposition:"exclude"});for(let l of c.namedChildren){let d=null,s=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,s=l;else if(l.type==="export_statement"){let a=l.namedChild(0);a?.type==="function_declaration"&&(d=a.namedChild(0)?.text??null,s=a)}else if(l.type==="lexical_declaration"){let a=l.namedChild(0);if(a?.type==="variable_declarator"){let m=a.namedChild(0)?.text,p=a.namedChild(1);m&&(p?.type==="arrow_function"||p?.type==="function_expression")&&(d=m,s=a)}}d&&/^use[A-Z]/.test(d)&&s&&u.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:"React custom hook (use*)",disposition:"exclude"})}return u.push(...pe(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),_.set(i,u),u}function Ae(e){if(e.includes("scip-query"))return!0;let t=!1;for(let n of me)if(e.includes(n)){t=!0;break}return t&&Ne.test(e)?!0:e.includes("use")&&Te.test(e)}var Fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function Me(e){return Fe.test(e)}function pe(e,t,n){let i=[],r=o=>{if(t.has(o.type)&&o.parent){let u=o.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===o.startIndex&&u[d].type===o.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let s=u[d];if(n.has(s.type)){if(Me(s.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment",disposition:"exclude"});break}continue}if(!(s.type==="attribute_item"||s.type==="inner_attribute_item"))break}}for(let c of o.namedChildren)r(c)};return r(e.rootNode),i}function Oe(e,t){let n=x(e,t);if(!n)return[];let i=_.get(n);if(i)return i;let r=[],o=Be(n);return o?(_.set(n,o),o):(ye(n.rootNode,r,!1,!1),r.push(...pe(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...Ke(n.rootNode)),_.set(n,r),r)}function Be(e){return Ve(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)",disposition:"exclude"}]:null}function ye(e,t,n,i){let r=n,o=i;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)",disposition:"implicit-usage"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)",disposition:"implicit-usage"})),e.type==="function_item"||e.type==="function_signature_item"?Ue(e,t,n,i):i&&Je(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)",disposition:"implicit-usage"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?je(e,t,n):e.type==="mod_item"&&k(e).some(c=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(c))&&(r=!0);for(let c of e.namedChildren)ye(c,t,r,o)}function Ue(e,t,n,i){let r=k(e),o=null;i?o={reason:"trait impl method (dynamic dispatch)",disposition:"implicit-usage"}:n&&(o={reason:"inside #[cfg(test)] mod",disposition:"exclude"});for(let c of r){if(be(c)){o={reason:"#[allow(dead_code)]",disposition:"exclude"};break}let u=Ze(c);if(u){o=u;break}}o&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o.reason,disposition:o.disposition})}function je(e,t,n){let i=k(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some($e)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(...)] - generated impl may access fields",disposition:"implicit-usage",containerName:r}),i.some(be)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",disposition:"exclude",containerName:r}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",disposition:"exclude",containerName:r})}function k(e){let t=e.parent;if(!t)return[];let n=t.children,i=-1;for(let o=0;o<n.length;o+=1)if(n[o].startIndex===e.startIndex&&n[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let c=n[o];if(c.type==="attribute_item"||c.type==="inner_attribute_item")r.push(c.text);else{if(c.type==="line_comment"||c.type==="block_comment")continue;break}}return r}var We=new Set(["test","bench","tokio::test","async_std::test"]),ze=new Set(["no_mangle","export_name","link_name","used","macro_export","proc_macro","proc_macro_derive","proc_macro_attribute"]),He=new Set(["allow","warn","deny","forbid","cfg","cfg_attr","doc","inline","cold","must_use","deprecated","repr","derive","automatically_derived","non_exhaustive","path","link","link_section","global_allocator","panic_handler"]);function Ze(e){if(/#\[\s*cfg\s*\(\s*test\s*\)/.test(e))return{reason:"#[cfg(test)]",disposition:"exclude"};let t=qe(e);return t?We.has(t)?{reason:`#[${t}]`,disposition:"exclude"}:ze.has(t)?{reason:`Rust ABI/export attribute #[${t}]`,disposition:"implicit-usage"}:He.has(t)?null:{reason:`Rust attribute macro #[${t}]`,disposition:"implicit-usage"}:null}function $e(e){return/#\[\s*derive\s*\(/.test(e)}function be(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function Je(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ke(e){let t=Xe(e);if(t.size===0)return[];let n=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&t.has(r)&&n.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'attribute `with = "..."` module - body may be invoked via reflection',disposition:"implicit-usage",containerName:r})}return n}function qe(e){let t=/^#!?\[\s*([A-Za-z_][A-Za-z0-9_]*(?:\s*::\s*[A-Za-z_][A-Za-z0-9_]*)*)/.exec(e);return t?t[1].replace(/\s+/g,""):null}function Ge(e){return e==="#[tauri::command]"||e==="#[command]"||e==="#[wasm_bindgen]"||e==="#[no_mangle]"||e==="#[napi]"||e==="#[pyfunction]"||e==="#[pymethod]"||e==="#[pyo3]"||e==="#[doc(hidden)]"||e.startsWith("trait ")||e.startsWith("#[derive(<reflective>)]")||e.startsWith("#[derive(...)]")||e.startsWith('serde `with = "')||e.startsWith('attribute `with = "')||e.startsWith("Rust attribute macro #[")||e.startsWith("Rust ABI/export attribute #[")?"implicit-usage":"exclude"}function Ve(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var de=/\bwith\s*=\s*"([^"]+)"/g;function Xe(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){de.lastIndex=0;let i;for(;(i=de.exec(n.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&t.add(o)}}return t}function ge(e){let t=A(e);return(n,i,r,o)=>t(n,i,r,o)?.disposition==="exclude"}function A(e){let t=new Map,n=i=>{let r=t.get(i);if(r)return r;let o=fe(e,i),c=new Map;for(let u of o){if(!u.containerName)continue;let l=c.get(u.containerName)??[];l.push(u),c.set(u.containerName,l)}return r={ranges:o,containers:c},t.set(i,r),r};return(i,r,o,c)=>{let u=n(i),l=[];for(let s of u.ranges)r>=s.startLine&&r<=s.endLine&&l.push(s);let d=new Set;c&&d.add(c);for(let s of E(o))d.add(s);for(let s of d){let a=u.containers.get(s);a&&l.push(...a)}return Ye(l)}}function Ye(e){if(e.length===0)return null;let n=e.find(i=>i.disposition==="exclude")??e[0];return{disposition:n.disposition,reason:n.reason}}function vt(e,t={}){L(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function he(e,t,n={}){L(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function xe(e,t){if(t.isIgnoredPath(e.relativePath))return y("ignored-file");if(G(e.symbol))return y("module-like-symbol");if(!R(e.symbol))return y("non-value-symbol");if(!e.isFunctionLike&&e.enclosingSymbol&&R(e.enclosingSymbol))return y("nested-non-callable-value");if(!t.includeTests&&!Qe(e.relativePath))return y("test-file");if(!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName))return y("excluded-file-region");let n=J(e.symbol);if(n==="<constructor>")return y("implicit-constructor");if(e.symbol.startsWith("scip-python ")){if(n==="__all__")return y("python-runtime-metadata");if(/^__[^_].*__$/.test(n))return y("python-protocol-member")}return t.isDeclarationOnlyCallable()?y("declaration-only-callable"):t.isFrameworkContractCallable()?y("framework-contract-member"):V(e.symbol)?y("rust-trait-impl-member"):X(e.symbol)?y("rust-test-module"):!t.includeMembers&&!et(e)?y("member"):e.endLine-e.startLine+1<t.minLoc?y("below-min-loc"):{accepted:!0}}function Qe(e){return Q(e)!=="test"}function y(e){return{accepted:!1,rejectionReason:e}}function R(e){return q(e)||e.endsWith("().")||e.endsWith(".")}function et(e){return K(e.symbol)||E(e.symbol).length===0}function _e(){return new Map}function Se(e,t,n){let i=new Map;for(let r of ie(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||v(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function Ee(e,t,n,i={}){let r=new Set;if(i.conservative||n.size===0){for(let o of se(e,t))r.add(o.symbol_id);return r}for(let o of re(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||r.add(o.symbol_id);return r}function F(e,t){let n=e.get(t);if(!n)return!1;for(let i of n.values())if(i.occurrences>0)return!0;return!1}function C(e,t,n){let i=e.get(t);if(!i)return!1;for(let[r,o]of i)if(r!==n&&o.occurrences>0)return!0;return!1}function Re(e){return e?.occurrences??0}function v(e,t,n,i,r="source-fallback"){if(i<=0)return;let o=ve(e,t,n);o.occurrences+=i,o.sources.add(r)}function Ce(e,t,n,i,r){if(i<=0)return;let o=ve(e,t,n);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function ve(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));let r=i.get(n);return r||(r={occurrences:0,sources:new Set},i.set(n,r)),r}var tt=1e3,nt=300;function Qt(e,t={}){let{scope:n,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:c=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,s=0,a=b("dead.candidates",()=>{let f=ce(it(e,{scope:n,minLoc:i,includeTests:r,includeMembers:c}),l);return s=f.length,f},()=>({definitions:s})),m=0,p=o?b("dead.inactive-barrels",()=>{let f=new Set(ee(e));return m=f.size,f},()=>({paths:m})):new Set,M=0,g=u?_e():b("dead.mention-reference-counts",()=>{let f=Se(e,p,a.map(D=>D.symbolId));return M=f.size,f},()=>({definitions:a.length,symbolsWithReferences:M})),O=0,Le=u?b("dead.mentioned-symbol-ids",()=>{let f=Ee(e,a.map(D=>D.symbolId),p,{conservative:p.size===0});return O=f.size,f},()=>({definitions:a.length,referencedSymbols:O})):new Set,h=u?a.filter(f=>!Le.has(f.symbolId)):a.filter(f=>!C(g,f.symbolId,f.relativePath));u?b("dead.source-fallback.dead-code-only",()=>ut(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0})):b("dead.source-fallback.ast",()=>lt(e,h,g,{inactiveBarrelPaths:p}),()=>({definitions:h.length,testReferencesIncluded:!0}));let B=u?h.filter(f=>!F(g,f.symbolId)):h.filter(f=>!C(g,f.symbolId,f.relativePath));b("dead.caller-map-supplement",()=>yt(e,B,g,{inactiveBarrelPaths:p,includeSemantic:!u&&d}),()=>({definitions:B.length,semantic:!u&&d}));let we=u?h.filter(f=>!F(g,f.symbolId)):a;return ct(e,ot(we,g))}function it(e,t){let n=ge(e),i=[];for(let r of Y(e,{scope:t.scope,symbolMatches:R,sqlPrefilter:"function-like"}))xe(r,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:n,isDeclarationOnlyCallable:()=>st(e,r),isFrameworkContractCallable:()=>le(e,r)}).accepted&&i.push(r);return i}var rt=["method_signature","abstract_method_signature","call_signature","construct_signature"];function st(e,t){if(!t.parentTypeName||!/\.[cm]?[jt]sx?$/.test(t.relativePath))return!1;let n=x(e,t.relativePath);if(n)return n.rootNode.descendantsOfType([...rt]).some(r=>r.startPosition.row<=t.startLine&&r.endPosition.row>=t.endLine);let i=z(e,t.relativePath).slice(t.startLine,t.endLine+1).join(`
2
- `).trim();return i.endsWith(";")&&!i.includes("=>")&&!i.includes("{")}function ot(e,t){return e.map(n=>at(n,t)).filter(n=>n.cross_file_refs===0).sort((n,i)=>i.loc-n.loc||n.relative_path.localeCompare(i.relative_path)||n.start_line-i.start_line)}function at(e,t){let n=t.get(e.symbolId)??new Map,i=Re(n.get(e.relativePath)),r=0;for(let[o,c]of n)o!==e.relativePath&&(r+=c.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,parent_type_name:e.parentTypeName,same_file_refs:i,cross_file_refs:r}}function ct(e,t){let n=A(e),i=[],r=0,o=0,c=0,u=0,l=0,d=0;for(let s of t){if(e.isIgnored(s.relative_path))continue;if(te(e,s.relative_path)){u++;continue}if(ne(e,s.symbol,s.relative_path)){l++;continue}let a=n(s.relative_path,s.start_line,s.symbol,s.parent_type_name),m=a?.disposition==="implicit-usage"?a.reason:void 0,p=m?"implicit-usage":s.same_file_refs===0?"dead-code":"file-internal";p==="dead-code"?r++:p==="file-internal"?o++:c++,d+=s.loc,i.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:$(s.symbol),sameFileRefs:s.same_file_refs,kind:p,...m?{implicitUsageReason:m}:{}})}return{symbols:i,counts:{total:i.length,deadCode:r,fileInternal:o,implicitUsage:c,loc:d},applicability:{entrySurfaceExcluded:u,externalRootExcluded:l,implicitUsageSignals:c},totalCount:i.length,deadCodeCount:r,fileInternalCount:o,implicitUsageCount:c,totalLoc:d}}function lt(e,t,n,i){if(t.length===0)return;let r=new T(e),o=new Set(t.map(l=>l.symbolId)),c=new Set(t.map(l=>l.leaf).filter(Boolean)),u=new Set(r.sourceFiles());for(let l of S(e))u.add(l);r.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:l=>i.inactiveBarrelPaths.has(l)},l=>{o.has(l.target.symbolId)&&(mt(e,l)||v(n,l.target.symbolId,l.sourceFile,pt(l),"source-fallback"))})}function ut(e,t,n,i){if(t.length===0)return;let r=new T(e),o=dt(t),c=new Set(r.sourceFiles());for(let s of S(e))c.add(s);let u=new Set(o.keys()),l=new Map,d=s=>{let a=l.get(s);return a||(a=oe(e,s),l.set(s,a)),a};r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:s=>i.inactiveBarrelPaths.has(s),resolveTargets:({sourceFile:s,name:a,kind:m})=>{let p=o.get(a);return p?ft(s,a,p,()=>d(s),{permissive:m!=="cross-language-dispatch"}):[]},afterPath:s=>{l.delete(s),he(e,s)}},s=>{let a=s.kind==="identifier"&&s.sourceFile===s.target.relativePath?Math.max(0,s.occurrences-1):s.occurrences;s.kind==="identifier"&&De(e,{sourceFile:s.sourceFile,name:s.name,target:s.target,occurrences:a})||v(n,s.target.symbolId,s.sourceFile,a,"source-fallback")})}function dt(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let i=t.get(n.leaf)??[];i.push(n),t.set(n.leaf,i)}return t}function ft(e,t,n,i,r){let o=n.filter(d=>d.relativePath===e);if(o.length>0)return o;if(!r.permissive&&n.length===1)return[...n];let c=i(),u=c.get(t);if(u)for(let d of u){let s=n.filter(a=>w(d,a.relativePath));if(s.length>0)return s}let l=new Set;for(let d of c.values())for(let s of d)l.add(s);for(let d of l){let s=n.filter(a=>w(d,a.relativePath));if(s.length>0&&s.length===n.length)return s}return r.permissive?[...n]:[]}function mt(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&De(e,t)}function pt(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function De(e,t){return t.occurrences>1?!1:Z(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function yt(e,t,n,i){let r=i.includeSemantic!==!1,o=r&&t.length>=tt&&S(e).length>=nt,c=(s,a)=>{a===s.relativePath||e.isIgnored(a)||i.inactiveBarrelPaths.has(a)||Ce(n,s.symbolId,a,1,"caller-map")};if(o?b("dead.caller-map.per-symbol-non-semantic",()=>{for(let s of t){let a=P(e,s,{semantic:!1,semanticEvidence:N});for(let m of a)c(s,m.file)}},()=>({definitions:t.length,semantic:!1})):b("dead.caller-map.per-symbol",()=>{for(let s of t){let a=P(e,s,{semantic:r,semanticEvidence:N});if(a.length!==0)for(let m of a)c(s,m.file)}},()=>({definitions:t.length,semantic:r})),!o)return;let u=0,l=b("dead.caller-map.semantic-candidates",()=>{let s=t.filter(a=>!C(n,a.symbolId,a.relativePath));return u=s.length,s},()=>({definitions:t.length,semanticCandidates:u}));if(l.length===0)return;let d=ae(e,l);for(let s of l){let a=d.get(s.symbolId);if(a)for(let m of a)c(s,m)}}export{vt as a,Qt as b};
3
- //# sourceMappingURL=chunk-K2ERX4UT.js.map
@@ -1,3 +0,0 @@
1
- function m(e){try{return process.kill(e,0),!0}catch(n){return typeof n=="object"&&n!==null&&"code"in n&&n.code==="EPERM"}}import{mkdirSync as t,renameSync as c,writeFileSync as s}from"fs";import{dirname as l}from"path";function d(e,n,r={}){t(l(e),{recursive:!0});let o=`${e}.${process.pid}.${Date.now()}.tmp`,i=JSON.stringify(n,null,r.spacing);s(o,r.trailingNewline?`${i}
2
- `:i),c(o,e)}export{m as a,d as b};
3
- //# sourceMappingURL=chunk-KHE7J5ZN.js.map
@@ -1,84 +0,0 @@
1
- var k=[];function _(e){e.groups.length>0&&k.push(e)}function Ie(e,t){let n=new Set(t.groups);for(let i of k)i.groups.some(r=>n.has(r))&&(t.file!==void 0&&i.clearFile?i.clearFile(e,t.file):i.clearAll(e))}function A(){let e=new WeakMap;return{cache:e,ensure(t){let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}}}function E(e,t){let{cache:n,ensure:i}=A(),r={get(a,s,o){let c=i(a);if(c.has(s))return c.get(s);let d=o();return c.set(s,d),d},invalidate(a,s){n.get(a)?.delete(s)},invalidateAll(a){n.delete(a)},size(a){return n.get(a)?.size??0}};return _({name:e,groups:t.clearGroups,clearAll:a=>r.invalidateAll(a),clearFile:(a,s)=>r.invalidate(a,s)}),r}function xe(e,t){let n=new WeakMap,i={get(r,a){let s=n.get(r);if(s)return s.value;let o=a();return n.set(r,{value:o}),o},invalidate(r){n.delete(r)},has(r){return n.has(r)}};return _({name:e,groups:t.clearGroups,clearAll:r=>i.invalidate(r)}),i}var ie={clearGroups:["whole-project","source-file"]};function Me(e){return ae(e,ie)}function ae(e,t){let{cache:n,ensure:i}=A(),r={get(a,s,o,c){let d=i(a),C=d.get(s);if(C&&C.source===o)return C.value;let I=c();return d.set(s,{source:o,value:I}),I},invalidate(a,s){n.get(a)?.delete(s)},invalidateAll(a){n.delete(a)}};return _({name:e,groups:t.clearGroups,clearAll:a=>r.invalidateAll(a),clearFile:(a,s)=>r.invalidate(a,s)}),r}import{createHash as se}from"crypto";import{existsSync as Ue,mkdirSync as oe,readFileSync as ce}from"fs";import{dirname as R,join as x}from"path";import M from"better-sqlite3";var de="evidence.db";var le=["source-facts","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],b=new Set(le);var Ye=512*1024*1024;var T=new WeakMap,pe=E("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),ue=E("evidence-project-fingerprint",{clearGroups:["whole-project"]}),p="evidence-v1",h="version NOT LIKE 'evidence-%'";function j(e){return se("sha256").update(e).digest("hex")}function Be(e,t,n){return pe.get(e,t,()=>j(n))}function V(e){return ue.get(e,"current",()=>{try{let t=JSON.parse(ce(x(R(e.config.dbPath),"meta.json"),"utf-8"));if(t.version!==2&&t.version!==3||t.status!=="complete"&&t.status!=="partial"||t.fingerprint===void 0)return null;let n=Array.isArray(t.indexedLanguages)?[...t.indexedLanguages].sort():[];return j(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:n,status:t.status}))}catch(t){return m("project fingerprint unavailable",t),null}})}function m(e,t){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${e}: ${t instanceof Error?t.message:String(t)}`)}function u(e){if(T.has(e))return T.get(e)??null;let t=null;try{let n=new M(x(R(e.config.dbPath),de));n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 5000"),n.pragma("synchronous = NORMAL"),n.exec(`
2
- CREATE TABLE IF NOT EXISTS file_evidence (
3
- kind TEXT NOT NULL,
4
- relative_path TEXT NOT NULL,
5
- content_hash TEXT NOT NULL,
6
- version TEXT NOT NULL,
7
- payload TEXT NOT NULL,
8
- PRIMARY KEY (kind, relative_path)
9
- );
10
- CREATE TABLE IF NOT EXISTS project_evidence (
11
- kind TEXT NOT NULL,
12
- cache_key TEXT NOT NULL,
13
- project_fingerprint TEXT NOT NULL,
14
- version TEXT NOT NULL,
15
- payload TEXT NOT NULL,
16
- PRIMARY KEY (kind, cache_key)
17
- );
18
- CREATE TABLE IF NOT EXISTS semantic_callees (
19
- relative_path TEXT NOT NULL,
20
- symbol TEXT NOT NULL,
21
- content_hash TEXT NOT NULL,
22
- deps_digest TEXT NOT NULL,
23
- version TEXT NOT NULL,
24
- payload TEXT NOT NULL,
25
- PRIMARY KEY (relative_path, symbol)
26
- );
27
- CREATE TABLE IF NOT EXISTS semantic_references (
28
- relative_path TEXT NOT NULL,
29
- symbol TEXT NOT NULL,
30
- project_fingerprint TEXT NOT NULL,
31
- version TEXT NOT NULL,
32
- payload TEXT NOT NULL,
33
- PRIMARY KEY (relative_path, symbol)
34
- );
35
- CREATE TABLE IF NOT EXISTS finding_outcome_ledger (
36
- check_name TEXT NOT NULL,
37
- finding_id TEXT NOT NULL,
38
- first_seen INTEGER NOT NULL,
39
- last_seen INTEGER NOT NULL,
40
- times_shown INTEGER NOT NULL,
41
- outcome TEXT NOT NULL,
42
- PRIMARY KEY (check_name, finding_id)
43
- );
44
- `),t={evidence:n,shared:ge(e.config.sharedEvidenceDbPath),readFileEvidence:n.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:n.prepare(`SELECT payload FROM file_evidence
45
- WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${h}
46
- ORDER BY version DESC
47
- LIMIT 1`),writeFileEvidence:n.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readProjectEvidence:n.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:n.prepare(`SELECT payload FROM project_evidence
48
- WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${h}
49
- ORDER BY version DESC
50
- LIMIT 1`),writeProjectEvidence:n.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:n.prepare(`SELECT payload FROM semantic_callees
51
- WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:n.prepare(`SELECT payload FROM semantic_callees
52
- WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${h}
53
- ORDER BY version DESC
54
- LIMIT 1`),readCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
55
- WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:n.prepare(`SELECT symbol, payload FROM semantic_callees
56
- WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${h}
57
- ORDER BY symbol, version DESC`),writeCallees:n.prepare(`INSERT OR REPLACE INTO semantic_callees
58
- (relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:n.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:n.prepare(`SELECT payload FROM semantic_references
59
- WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:n.prepare(`SELECT payload FROM semantic_references
60
- WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${h}
61
- ORDER BY version DESC
62
- LIMIT 1`),readReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
63
- WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:n.prepare(`SELECT symbol, payload FROM semantic_references
64
- WHERE relative_path = ? AND project_fingerprint = ? AND ${h}
65
- ORDER BY symbol, version DESC`),writeReferences:n.prepare(`INSERT OR REPLACE INTO semantic_references
66
- (relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:n.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?"),readFindingOutcomeLedger:n.prepare("SELECT check_name, finding_id, first_seen, last_seen, times_shown, outcome FROM finding_outcome_ledger"),deleteFindingOutcomeLedgerForCheck:n.prepare("DELETE FROM finding_outcome_ledger WHERE check_name = ?"),writeFindingOutcomeLedgerRow:n.prepare(`INSERT INTO finding_outcome_ledger
67
- (check_name, finding_id, first_seen, last_seen, times_shown, outcome) VALUES (?, ?, ?, ?, ?, ?)`)}}catch(n){m("disabled (open failed)",n)}return T.set(e,t),t}function g(e,t,n){m(`disabled (${t})`,n),T.set(e,null)}function ge(e){if(!e)return null;try{oe(R(e),{recursive:!0});let t=new M(e);return t.pragma("journal_mode = WAL"),t.pragma("busy_timeout = 250"),t.pragma("synchronous = NORMAL"),t.exec(`
68
- CREATE TABLE IF NOT EXISTS file_evidence (
69
- kind TEXT NOT NULL,
70
- relative_path TEXT NOT NULL,
71
- content_hash TEXT NOT NULL,
72
- version TEXT NOT NULL,
73
- payload TEXT NOT NULL,
74
- last_accessed_at INTEGER NOT NULL,
75
- PRIMARY KEY (kind, relative_path, content_hash, version)
76
- );
77
- `),{evidence:t,readFileEvidence:t.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:t.prepare(`INSERT INTO file_evidence (kind, relative_path, content_hash, version, payload, last_accessed_at)
78
- VALUES (?, ?, ?, ?, ?, ?)
79
- ON CONFLICT(kind, relative_path, content_hash, version)
80
- DO UPDATE SET payload = excluded.payload, last_accessed_at = excluded.last_accessed_at`)}}catch(t){return m("shared cache disabled (open failed)",t),null}}function P(e,t,n){m(`shared cache disabled (${t})`,n);try{e.shared?.evidence.close()}catch{}e.shared=null}function K(e,t,n,i){let r=u(e);if(!r)return null;try{let a=r.readFileEvidence.get(t,n,i,p)??r.readLegacyFileEvidence.get(t,n,i);if(a?.payload!==void 0)return a.payload;if(!b.has(t)||!r.shared)return null;try{return r.shared.readFileEvidence.get(t,n,i,p)?.payload??null}catch(s){return P(r,"file_evidence read",s),null}}catch(a){return g(e,"file_evidence read",a),null}}function U(e,t,n,i,r){let a=u(e);if(a)try{if(a.writeFileEvidence.run(t,n,i,p,r),b.has(t)&&a.shared)try{a.shared.writeFileEvidence.run(t,n,i,p,r,Date.now())}catch(s){P(a,"file_evidence write",s)}}catch(s){g(e,"file_evidence write",s)}}function H(e,t){if(t.length===0)return;let n=u(e);if(n)try{n.evidence.transaction(()=>{for(let r of t)n.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,p,r.payload)})();let i=t.filter(r=>b.has(r.kind));if(i.length>0&&n.shared)try{n.shared.evidence.transaction(()=>{for(let r of i)n.shared.writeFileEvidence.run(r.kind,r.relativePath,r.contentHash,p,r.payload,Date.now())})()}catch(r){P(n,"file_evidence batch write",r)}}catch(i){g(e,"file_evidence batch write",i)}}function W(e,t,n,i){let r=u(e);if(!r)return null;try{return(r.readProjectEvidence.get(t,n,i,p)??r.readLegacyProjectEvidence.get(t,n,i))?.payload??null}catch(a){return g(e,"project_evidence read",a),null}}function X(e,t,n,i,r){let a=u(e);if(a)try{a.writeProjectEvidence.run(t,n,i,p,r)}catch(s){g(e,"project_evidence write",s)}}function $e(e,t,n,i){let r=u(e);if(!r)return new Map;try{let a=r.readCalleesForFile.all(t,n,i,p),s=r.readLegacyCalleesForFile.all(t,n,i);return Y([...s,...a])}catch(a){return g(e,"semantic_callees bulk read",a),new Map}}function Ge(e,t,n){let i=u(e);if(!i)return new Map;try{let r=i.readReferencesForFile.all(t,n,p),a=i.readLegacyReferencesForFile.all(t,n);return Y([...a,...r])}catch(r){return g(e,"semantic_references bulk read",r),new Map}}function Y(e){let t=new Map;for(let n of e)t.set(n.symbol,n.payload);return t}function ze(e,t){if(t.length===0)return;let n=u(e);if(n)try{n.evidence.transaction(()=>{let i=new Set;for(let r of t){let a=`${r.relativePath}\0${r.contentHash}`;i.has(a)||(i.add(a),n.dropStaleCallees.run(r.relativePath,r.contentHash)),n.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,p,r.payload)}})()}catch(i){g(e,"semantic_callees write",i)}}function Je(e,t){if(t.length===0)return;let n=u(e);if(n)try{n.evidence.transaction(()=>{let i=new Set;for(let r of t){let a=`${r.relativePath}\0${r.projectFingerprint}`;i.has(a)||(i.add(a),n.dropStaleReferences.run(r.relativePath,r.projectFingerprint)),n.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,p,r.payload)}})()}catch(i){g(e,"semantic_references write",i)}}function Qe(e){let t=u(e);if(!t)return[];try{return t.readFindingOutcomeLedger.all().map(i=>({check:i.check_name,findingId:i.finding_id,firstSeen:i.first_seen,lastSeen:i.last_seen,timesShown:i.times_shown,outcome:i.outcome}))}catch(n){return g(e,"finding_outcome_ledger read",n),[]}}function Ze(e){return typeof e=="object"&&e!==null}function et(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}import{appendFileSync as fe,mkdirSync as Ee}from"fs";import{createHash as he,randomUUID as ve}from"crypto";import{dirname as me}from"path";import{performance as v}from"perf_hooks";var z="SCIP_QUERY_PROFILE",J="SCIP_QUERY_PROFILE_OUT",Q="SCIP_QUERY_PROFILE_COMMAND",q="SCIP_QUERY_PROFILE_CACHE_STATE",O="SCIP_QUERY_PROFILE_RUN_ID",w="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY",L="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND",Z=[z,J,Q,q,O,w,L],st=new Set(Z),B=new Set,$=new Map,G=!1;function f(){let e=process.env[z];return e==="1"||e==="true"}function ye(){return process.env[J]}function ee(){return process.env[Q]}function _e(){return process.env[q]}function te(){let e=process.env[O];if(e)return e;if(!f())return;let t=ve();return process.env[O]=t,t}function ne(){return process.env[w]}function Te(e){let t=ne();if(t)return t;if(!f())return;let n=te();if(!n)return;let i=e.projectFingerprint?"published-project":"run-only",r=y(["profile-workload-v1",e.toolVersion,e.command,e.projectFingerprint??n]);return process.env[w]=r,process.env[L]=i,r}function y(e){return he("sha256").update(JSON.stringify(e)).digest("hex").slice(0,24)}function ot(){return Object.fromEntries(Z.flatMap(e=>{let t=process.env[e];return t===void 0?[]:[[e,t]]}))}function F(e,t,n){if(!f())return t();let i=v.now();try{let r=t();return S({type:"span",name:e,durationMs:Math.round(v.now()-i),ok:!0,...D(n)??{}}),r}catch(r){throw S({type:"span",name:e,durationMs:Math.round(v.now()-i),ok:!1,error:r instanceof Error?r.message:String(r),...D(n)??{}}),r}}async function ct(e,t,n){if(!f())return t();let i=v.now();try{let r=await t();return S({type:"span",name:e,durationMs:Math.round(v.now()-i),ok:!0,...D(n)??{}}),r}catch(r){throw S({type:"span",name:e,durationMs:Math.round(v.now()-i),ok:!1,error:r instanceof Error?r.message:String(r),...D(n)??{}}),r}}function S(e,t=ye()){let n=Se(e),i={timestamp:new Date().toISOString(),pid:process.pid,runId:te(),command:ee(),cacheState:_e(),...n,...e},r=`${JSON.stringify(i)}
81
- `;if(t)try{let a=me(t);B.has(a)||(Ee(a,{recursive:!0}),B.add(a)),fe(t,r);return}catch(a){G||(G=!0,process.stderr.write(`[profile] failed to write ${t}: ${a instanceof Error?a.message:String(a)}
82
- `));return}f()&&process.stderr.write(r)}function Se(e){let t=ne()??Te({command:ee()??"unknown",toolVersion:"unknown",projectFingerprint:null});if(!t)return{};let n=process.env[L],i=typeof e.name=="string"?e.name:void 0;if(!i)return{workloadIdentity:t,workloadIdentityKind:n};let r=i.split(/[.:]/,1)[0]??i,a=`${t}\0${i}`,s=$.get(a);return s||(s=y(["profile-subsystem-v1",t,i]),$.set(a,s)),{workloadIdentity:t,workloadIdentityKind:n,subsystem:r,subsystemWorkIdentity:s}}function D(e){return typeof e=="function"?e():e}var De=[l("source-facts",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/source-facts.ts"}),l("file-definitions",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/symbols/definition-catalog.ts"}),l("definition-exclusions",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/framework-patterns.ts"}),l("doc-path-tokens",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-products.test.ts",owner:"tests/storage/evidence-cache.test.ts"}),l("doc-path-evidence",{dependsOn:["content-hash","git-history","git-head","tool-version"],keyParts:["kind","relativePath","contentHash","trackedFiles","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/cleanup/doc-drift.ts"}),l("source-imports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),l("source-reexports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),l("source-fingerprints",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/definition-catalog.test.ts",owner:"src/queries/cleanup/similar.ts"}),l("consumer-file-usage",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/internal/consumer-evidence.ts"}),l("react-component-behavior-profiles",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/react-profile.ts"}),l("git-file-adds",{dependsOn:["git-head","git-history","tool-version"],keyParts:["kind","cacheKey","head","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/git-history.ts"}),l("typescript-reference-fragments",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-reference-fragments.test.ts",owner:"src/semantic/typescript/reference-fragment-shadow.ts"}),l("typescript-import-usage",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),l("typescript-signatures",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),N("file-dependency-graph",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","scope","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/file-dep-graph.test.ts",owner:"src/symbols/graph/file-dep-graph.ts"}),N("semantic-import-usage",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","relativePath","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),N("semantic-signatures",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","symbol","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),N("health-semantic-prewarm",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","scope","cliVersion","projectFingerprint","payloadVersion"],stalenessTest:"tests/runtime/cli-support.test.ts",owner:"src/runtime/cli-support.ts"})];function ft(e){let t=new Map;return{kind:e.kind,read(n,i,r){let a=!1,s=0,o;if(f()){let c=V(n);if(c){let d=`${c}\0${i}\0${r}`;o=t.get(d),o||(o=y(["evidence-product-file-read-v1",e.kind,c,i,r]),t.set(d,o))}}return F("evidence-product.file.read",()=>{let c=K(n,e.kind,i,r);if(c===null)return null;s=c.length;try{let d=e.deserialize(c);return a=d!==null,d}catch{return null}},()=>({...o?{workIdentity:o,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:a,payloadBytes:s}))},write(n,i,r,a){U(n,e.kind,i,r,e.serialize(a))},writeBatch(n,i){H(n,i.map(r=>({kind:e.kind,relativePath:r.relativePath,contentHash:r.contentHash,payload:e.serialize(r.value)})))}}}function Et(e){let t=new Map;return{kind:e.kind,read(n,i,r){let a=!1,s=0,o;if(f()){let c=`${r}\0${i}`;o=t.get(c),o||(o=y(["evidence-product-project-read-v1",e.kind,r,i]),t.set(c,o))}return F("evidence-product.project.read",()=>{let c=W(n,e.kind,i,r);if(c===null)return null;s=c.length;try{let d=e.deserialize(c);return a=d!==null,d}catch{return null}},()=>({...o?{workIdentity:o,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:a,payloadBytes:s}))},write(n,i,r,a){X(n,e.kind,i,r,e.serialize(a))}}}function ht(e){let t=De.find(n=>n.kind===e);if(!t)throw new Error(`missing evidence product manifest entry for ${e}`);return t.invalidation}function l(e,t){return{scope:"file",kind:e,invalidation:{scope:"file",...t}}}function N(e,t){return{scope:"project",kind:e,invalidation:{scope:"project",...t}}}import{readFileSync as Ne}from"fs";import{join as Ce}from"path";var Re=E("source-text",{clearGroups:["whole-project","source-file"]}),be=E("source-lines",{clearGroups:["whole-project","source-file"]});function Pe(e,t){let n=t.replace(/\\/g,"/");return Re.get(e,n,()=>{let i=Ce(e.config.projectRoot,n);try{return Ne(i,"utf-8")}catch(r){if(Oe(r))return"";throw r}})}function Oe(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function we(e,t){let n=t.replace(/\\/g,"/");return be.get(e,n,()=>{let i=Pe(e,n);return i?i.split(`
83
- `):[]})}var Le=/^\s*(?:\/\/|#|\/\*+|\*)\s*scip-query[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar|twin))?\b/i;function Fe(e){let t=Le.exec(e);return t?t[1]??"":null}function Tt(e,t,n){return re(e,t,n).length>0}function St(e,t,n,i){let r=i.toLowerCase();return re(e,t,n).some(a=>a.toLowerCase()===r)}function re(e,t,n){if(n<=0)return[];let i=we(e,t);if(i.length===0)return[];let r=[];for(let a=n-1;a>=0&&a>=n-5;a-=1){let s=(i[a]??"").trim();if(s==="")continue;let o=Fe(s);if(o!==null){r.push(o);continue}if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return r}return r}export{_ as a,Ie as b,E as c,xe as d,Me as e,ae as f,j as g,Be as h,V as i,$e as j,Ge as k,ze as l,Je as m,Qe as n,Ze as o,et as p,f as q,ot as r,F as s,ct as t,S as u,ft as v,Et as w,ht as x,Pe as y,we as z,Fe as A,Tt as B,St as C};
84
- //# sourceMappingURL=chunk-L7SPDE73.js.map
@@ -1,3 +0,0 @@
1
- import{a as xe}from"./chunk-VXQNNXJE.js";import{a as Ae}from"./chunk-M7AIS73L.js";import{a as le,b as F,e as de}from"./chunk-DLWR3NUU.js";import{a as pe,c as me,d as ge,e as D}from"./chunk-2YU7I3QO.js";import{a as Te}from"./chunk-QVWS2VWZ.js";import{a as Fe}from"./chunk-QDV6RDCP.js";import{a as Re}from"./chunk-C2QSK7E7.js";import{a as ke}from"./chunk-ZGZUZ7XE.js";import{a as we}from"./chunk-H7UKLTWJ.js";import{a as Se}from"./chunk-NRCXJDHL.js";import{a as $e}from"./chunk-ZXJYMGD3.js";import{a as be}from"./chunk-NSS46APD.js";import{b as he}from"./chunk-M7MTH5NR.js";import{a as fe,b as ue}from"./chunk-4333ETTV.js";import{a as se,b as ae,c as ce,g as O,h as U}from"./chunk-NPKYOIFM.js";import{b as Ce}from"./chunk-K2ERX4UT.js";import{a as z,c as ne,d as re,e as oe}from"./chunk-QRGV2F7L.js";import{a as ie}from"./chunk-GBQ5NYPR.js";import{a as De,e as ve}from"./chunk-CNKAGUPL.js";import{a as I,c as B,d as N,e as ye}from"./chunk-52ZYCAEO.js";import{c as te}from"./chunk-NH5ALKPW.js";import{f as x,g as G}from"./chunk-Q3AFUTGB.js";import{e as ee}from"./chunk-LBMJEAEW.js";import{d as _,e as R,f as Q,g as H}from"./chunk-XYADIZHU.js";import{a as Z}from"./chunk-X6D5IC6I.js";import{e as Y}from"./chunk-YGAGTIDK.js";import{s as X}from"./chunk-L7SPDE73.js";import{createHash as lt}from"crypto";import{existsSync as L}from"fs";function q(e){let[t,i]=T(e,":"),r=t||"unknown",n=(a={})=>{let s=a.actionTier??qe(r);return{sourceAnalyzer:r,actionTier:s,rootCauseKey:a.rootCauseKey??(i||e),label:a.label??`${r} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??We(s,r),file:a.file}};if(!i)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(r)){let[a,s]=T(i,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:i,label:`${r} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(r==="cycle"){let a=i.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:i,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(r==="similar"){let a=i.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:i,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(r==="architecture"){let[a,s]=T(i,":");if(a==="forbidden-edge"){let[c,l]=T(s,":"),o=K(c),f=K(l);return n({actionTier:"direct",rootCauseKey:i,label:"architecture boundary violation",why:[`Declared boundary rule rejects ${o} -> ${f}.`],remediation:`Move the dependency behind an allowed boundary, or deliberately update the ${o} dependency rule and baseline.`})}if(a==="cycle"){let c=s.split("|").filter(Boolean).map(K);return n({actionTier:"direct",rootCauseKey:i,label:"forbidden architecture cycle",why:[`requireAcyclic rejects the connected boundary group: ${c.join(", ")}.`],remediation:"Break the boundary cycle, or deliberately revise the acyclicity rule and baseline."})}if(a==="missing-policy-row"){let c=K(s);return n({actionTier:"direct",rootCauseKey:i,label:"incomplete architecture policy",why:[`requireCompletePolicy rejects the missing outgoing dependency row for ${c}.`],remediation:`Declare the allowed outgoing dependencies for ${c}, including an empty row when it must depend on nothing.`})}}if(r==="drift"){let[a,s]=T(i,":"),[c,l]=T(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,l].filter(Boolean))],rootCauseKey:i,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...l?[`Related dependency: ${l}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function qe(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":case"architecture":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function We(e,t){return e==="direct"?`Fix the new ${t} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${t} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function T(e,t){let i=e.indexOf(t);return i<0?[e,""]:[e.slice(0,i),e.slice(i+t.length)]}function K(e){try{return decodeURIComponent(e)}catch{return e}}import{writeFileSync as Qe}from"fs";import{existsSync as Ve,readFileSync as Je}from"fs";import{isAbsolute as Ye,join as Xe}from"path";var Ze=".scipquery-baseline.json";function W(e){if(e.startsWith("similar:")){let t=e.slice(8).split("|");return t.length!==2?e:`similar:${t.map(_).sort().join("|")}`}if(e.startsWith("duplicate-bodies:")){let t=e.slice(17),i=t.indexOf(":");if(i<0)return e;let r=t.slice(0,i),n=t.slice(i+1).split("|");return n.length<2?e:`duplicate-bodies:${r}:${n.map(_).sort().join("|")}`}return e}function A(e,t){return t&&Ye(t)?t:Xe(e.config.projectRoot,t??Ze)}function M(e,t,i={}){let r=A(e,i.path);if(!Ve(r))throw new Error(`No baseline found at ${r}. Create one with: scip-query health --write-baseline`);let a=(JSON.parse(Je(r,"utf-8")).findings??[]).map(W),s=new Set(i.accept?a.filter(i.accept):a),c=new Set(t);return{baselinePath:r,baselineCount:s.size,current:[...t],newFindings:t.filter(l=>!s.has(l)),fixedFindings:[...s].filter(l=>!c.has(l))}}var et=25e3,tt=2500,it=2500;function nt(e){let t=Re(e);return t.symbols>=et||t.documents>=tt?it:void 0}function Ge(e,t={}){let{scope:i}=t,r=nt(e),n=[],a=Ce(e,{scope:i,...D.dead,scanLimit:r});for(let s of a.symbols)x(e,s.relativePath)||G(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of we(e,{scope:i,...D.isolated,scanLimit:r}))x(e,s.relativePath)||G(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of be(e,{scope:i}))s.kind==="real"&&n.push(`cycle:${rt(s.path)}`);for(let s of ve(e,{scope:i,...D.similar,scanLimit:r}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of fe(e,{scope:i,...D.duplicateBodies,scanLimit:r}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(c=>c.symbol).sort().join("|")}`);for(let s of $e(e,{scope:i,...D.extract,scanLimit:r}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of Te(e,{scope:i,...D.wrappers,scanLimit:r}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of ke(e,{scope:i,...D.passthroughs,scanLimit:r}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of Fe(e,{scope:i,...D.stale,scanLimit:r}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of Se(e,{scope:i,...D.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)s.kind!=="architecture-violation"&&n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return n.push(...N(B(e,{scope:i}))),[...new Set(n.map(W))].sort()}function rt(e){if(e.length===0)return"";let t=0;for(let i=1;i<e.length;i++)e[i]<e[t]&&(t=i);return[...e.slice(t),...e.slice(0,t)].join(">")}function ai(e,t={}){let i=Ge(e,{scope:t.scope}),r=A(e,t.path);return Qe(r,JSON.stringify({version:1,findings:i},null,2)+`
2
- `),{path:r,findingCount:i.length}}function Ee(e,t={}){return M(e,Ge(e,{scope:t.scope}),{path:t.path})}function je(e,t={}){let i=N(B(e,{scope:t.scope}));return M(e,i,{path:t.path,accept:r=>r.startsWith(I)})}import{existsSync as ot,mkdirSync as hi,readdirSync as st,readFileSync as at,writeFileSync as pi}from"fs";import{createHash as gi}from"crypto";import{join as V}from"path";var E=V(".scipquery","suppressions");function ct(e){return V(e,E)}function Ie(e){let t=ct(e);if(!ot(t))return{suppressions:[],warnings:[]};let i=[],r=[];for(let n of st(t).sort()){if(!n.endsWith(".json"))continue;let a=V(t,n),s;try{s=JSON.parse(at(a,"utf-8"))}catch{r.push(`${E}/${n}: malformed JSON \u2014 ignored`);continue}if(typeof s!="object"||s===null||Array.isArray(s)){r.push(`${E}/${n}: not a suppression object \u2014 ignored`);continue}let c=s;if(typeof c.reason!="string"||c.reason.trim()===""){r.push(`${E}/${n}: missing reason \u2014 ignored`);continue}if(!c.id&&!c.check){r.push(`${E}/${n}: needs an id or a check \u2014 ignored`);continue}i.push(c)}return{suppressions:i,warnings:r}}var Ui=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","architecture","doc-reference","unused-params","new-dead","baseline"];function qi(e,t={}){let i=t.base??"HEAD",{minTogether:r=6,minConfidence:n=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:s=Number.POSITIVE_INFINITY,minSimilarity:c=.8,includeBaseline:l=!1,scanLimit:o}=t,f=t.semantic!==!1,m=t.historyMode??"bounded",u=new Set(t.skip??[]),h=ce(e,{base:i}),g=ae(e,{base:i,plan:h}),y=g.changedFiles,S=new Set(y),d=new Set(h.changedFileLines),w=new Set([...S,...d]),$=O(e.config.projectRoot,i,U(h,y)),C=Nt(e.config.projectRoot,i,h,$),p={base:i,changedFiles:y,changedSymbols:g.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:g.attributionNotes,rootCauseGroups:[],note:g.summary.note};if(y.length===0)return p;let k=(j,He)=>{if(u.has(j)){p.skipped.push({check:j,reason:"skipped via --skip"});return}let ze=p.findings.length,Oe=p.skipped.length,Ue=p.checksRun.length;X(`diff-gate.check.${j}`,He,()=>({check:j,changedFiles:y.length,changedSymbols:g.changedSymbols.length,findingsAdded:p.findings.length-ze,skippedAdded:p.skipped.length-Oe,checksRunAdded:p.checksRun.length-Ue}))};return k("echo",()=>ht(e,g.changedSymbols,S,C,a,c,o,f,p)),k("incomplete-migration",()=>Ct(e,i,h,s,o,f,$,p)),k("co-change-partner",()=>St(e,w,r,n,m,p)),k("twin-partner",()=>$t(e,g.changedSymbols,S,o,p)),k("coverage-contract",()=>wt(e,w,p)),k("architecture",()=>Pt(e,p)),k("doc-reference",()=>Rt(e,S,d,h.changedRanges,h.renamedFiles,p)),k("unused-params",()=>Gt(e,y,p)),k("new-dead",()=>Et(e,g.changedSymbols,C,p)),l&&k("baseline",()=>Mt(e,p)),ft(p,[...e.config.suppressions??[],...Ie(e.config.projectRoot).suppressions]),p.rootCauseGroups=dt(p.findings),p}function Wi(e){return e.checksRun.length===0&&e.note===se}function Vi(e){return e.filter(t=>!t.advisory)}function dt(e){let t=new Map;for(let i of e){let r=i.groupKey??`${i.check}:${i.id}`,n=t.get(r);n||(n={groupKey:r,check:i.check,severity:i.severity,actionTier:i.actionTier,sourceAnalyzer:i.sourceAnalyzer,rootCauseKey:i.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:i.message,remediation:i.remediation},t.set(r,n)),n.count+=1,n.findingIds.push(i.id),n.severity=Le(n.severity,i.severity),n.actionTier=_e(n.actionTier,i.actionTier),i.file&&n.files.add(i.file);for(let a of i.relatedFiles??[])n.relatedFiles.add(a)}return[...t.values()].map(i=>({...i,files:[...i.files].sort(),relatedFiles:[...i.relatedFiles].sort()})).sort((i,r)=>r.count-i.count||P(r.severity)-P(i.severity)||i.groupKey.localeCompare(r.groupKey))}function Le(e,t){return P(t)>P(e)?t:e}function P(e){return e==="error"?2:e==="warning"?1:0}function _e(e,t){return e?t&&Be(t)>Be(e)?t:e:t}function Be(e){return e==="direct"?2:e==="signal"?1:0}function ft(e,t){if(t.length===0||e.findings.length===0)return;let i=[];for(let r of e.findings){let n=t.find(a=>ut(a,r));n?e.suppressed.push({finding:r,suppression:n}):i.push(r)}e.findings=i}function ut(e,t){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==t.id&&!t.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==t.check||e.file&&e.file!==t.file?!1:!!(e.id||e.check)}function v(e,t){e.findings.push({...t,suppressionHint:`scip-query: ignore ${t.check} ${t.id} -- <reason>`})}function ht(e,t,i,r,n,a,s,c,l){l.checksRun.push("echo");for(let o of t.slice(0,n)){if(!H(o.symbol)||r(o))continue;let f=ue(e,o.symbol,{maxLoc:15,scanLimit:s}).filter(d=>!i.has(d.file)).slice(0,5).map(d=>({otherFile:d.file,otherShort:d.shortName,otherSymbol:d.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${d.loc} LOC)`]}));if(f.length>0){let d=b("echo",o.symbol,o.file),w=b("echo",o.symbol,o.file,...f.map(C=>`${C.otherSymbol}|${C.otherFile}`).sort()),$=f[0];v(l,{id:d,legacySuppressionIds:w===d?void 0:[w],groupKey:d,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:o.file,symbol:o.symbol,relatedFiles:[...new Set(f.map(C=>C.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${o.symbol}:${$.otherSymbol}`,message:Ke(o,f),why:Me(o,f),remediation:Pe("direct",o.shortName,$.otherShort)});continue}let m=De(e,o.symbol,{minSimilarity:a,limit:5,scanLimit:s,semantic:c,sourceCandidateMode:"target-pruned"}),u=[];for(let d of m){let w=d.fileA===o.file?d.fileB:d.fileA,$=d.fileA===o.file?d.shortNameB:d.shortNameA,C=d.fileA===o.file?d.symbolB:d.symbolA;i.has(w)||u.push({otherFile:w,otherShort:$,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(u.length===0)continue;let h=u[0],g=b("echo",o.symbol,o.file,...u.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),y=b("echo",o.symbol,o.file),S=pt(o,u);v(l,{id:y,legacySuppressionIds:g===y?void 0:[g],groupKey:y,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:h.similarity,file:o.file,symbol:o.symbol,relatedFiles:[...new Set(u.map(d=>d.otherFile))].sort(),message:Ke(o,u),why:Me(o,u),remediation:Pe(S,o.shortName,h.otherShort)})}t.length>n&&l.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${t.length} changed symbols`})}function pt(e,t){return t.some(r=>mt(e.symbol,r))?"direct":"signal"}function mt(e,t){if(t.similarityBasis==="exact-body")return!0;if(t.similarityBasis!=="source-tokens"||t.similarity<.98||t.sharedEvidence.length>8)return!1;let i=R(e),r=R(t.otherSymbol);return!i||!r?!1:i===r?!0:bt(t.sharedEvidence)?!1:gt(i,r)}function gt(e,t){let i=Ne(e),r=Ne(t);if(i.length===0||r.length===0)return!1;let n=new Set(r),a=i.filter(s=>n.has(s)).length;return a>=2&&a/Math.min(i.length,r.length)>=.5}function Ne(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}var yt=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function bt(e){return e.length>=3&&e.every(t=>yt.has(t.toLowerCase()))}function Ke(e,t){let i=t[0],r=Math.round(i.similarity*100);return t.length===1?`${e.shortName} (${e.file}) is ${r}% similar to established ${i.otherShort} (${i.otherFile})`:`${e.shortName} (${e.file}) resembles ${t.length} established symbol(s); strongest is ${r}% similar to ${i.otherShort} (${i.otherFile})`}function Me(e,t){let i=[`${e.shortName} was changed in this diff.`];for(let r of t.slice(0,3))i.push(`${r.otherShort} is outside this diff and scored ${Math.round(r.similarity*100)}% similar by ${r.similarityBasis} evidence.`),i.push(`Shared evidence: ${r.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return t.length>3&&i.push(`${t.length-3} additional similar match(es) grouped into this finding.`),i}function Pe(e,t,i){return e==="direct"?`Extract or reuse the shared behavior with ${i}, or keep the duplicate with a suppression reason.`:`Review whether ${t} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function Ct(e,t,i,r,n,a,s,c){let l=Ae(e,{base:t,maxHelpers:r,diffPlan:i,scanLimit:n,semantic:a,baseContentAt:s});if(!l.available){c.skipped.push({check:"incomplete-migration",reason:"no git history"});return}c.checksRun.push("incomplete-migration"),l.note&&c.skipped.push({check:"incomplete-migration",reason:l.note});for(let o of l.findings){let f=o.leftovers.map(d=>`${d.shortName} (${d.file}, ${Math.round(d.containment*100)}% helper / ${Math.round(d.siteCoverage*100)}% site, ${d.migrationScope})`).join(", "),m=o.leftovers.map(d=>`${d.shortName}: ${d.migrationScope} (${d.migrationScopeReasons[0]})`).join("; "),u=[...o.migratedFiles,...o.leftovers.map(d=>d.file)],h=o.leftovers.length===0?void 0:Math.max(...o.leftovers.map(d=>Math.min(d.containment,d.siteCoverage))),g=o.leftovers.some(d=>d.migrationScope==="possible-subtype"),y=b("incomplete-migration",o.helperSymbol,o.helperFile,u.join("|")),S=b("incomplete-migration",o.helperSymbol,o.helperFile);v(c,{id:S,legacySuppressionIds:y===S?void 0:[y],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:h,file:o.helperFile,symbol:o.helperSymbol,relatedFiles:u,message:`new helper ${o.helperShortName} (${o.helperFile}) is wired into ${o.migratedFiles.length} file(s), but ${o.leftovers.length} similar un-migrated site(s) remain: ${f}`,why:[`${o.helperShortName} is new in this diff and already referenced by ${o.migratedFiles.join(", ")}.`,`Helper shape: ${o.helperShape}; ${o.specificHelperCalleeCount}/${o.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${f}.`,`Migration scope hints: ${m}.`],remediation:g?`Migrate same-scope sites to ${o.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${o.helperShortName}, or confirm they are intentionally different.`})}}function St(e,t,i,r,n,a){let s=ie(e,{historyMode:n}).directionalCoChangePairsForFiles(t,{minTogether:i,minConfidence:0,maxFilesPerCommit:20});if(!s){a.skipped.push({check:"co-change-partner",reason:"no git history"});return}a.checksRun.push("co-change-partner");let c=new Set,l;for(let o of s){let f=t.has(o.fileA),m=t.has(o.fileB);if(f===m)continue;let u=f?o.fileA:o.fileB,h=f?o.fileB:o.fileA,g=f?o.changesA:o.changesB,y=g>0?o.together/g:0;if(y<r||z(h)||z(u)||!L(`${e.config.projectRoot}/${h}`))continue;let S=`${u}|${h}`;if(c.has(S))continue;c.add(S);let d=b("co-change-partner",u,h,String(o.together)),w=b("co-change-partner",u,h),$=ne(u,h),C=re({fileA:u,fileB:h,together:o.together,confidence:y,commitScope:o.commitScope,recency:o.recency,subjectContext:o.subjectContext},$,(l??=oe(e))(u,h)),p=[u,h].sort().join("|");a.findings.push({id:w,legacySuppressionIds:d===w?void 0:[d],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${p}`,confidence:y,file:u,relatedFiles:[h],sourceAnalyzer:"co-change",rootCauseKey:p,partnerClass:$.partnerClass,partnerClassReasons:$.reasons,commitScope:o.commitScope,recency:o.recency,focusedTogether:o.focusedTogether,broadTogether:o.broadTogether,broadCommitRatio:o.broadCommitRatio,lastTogetherAt:o.lastTogetherAt,recentTogether:o.recentTogether,subjectContext:o.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${h} did not \u2014 they change together ${o.together}x (${Math.round(y*100)}% of the time)`,why:[`${u} is in this diff and ${h} is not.`,`Git history shows ${o.together} co-change(s), which is ${Math.round(y*100)}% of changes to the edited side.`,`History context: ${kt(o)}.`,`Subject context: ${Dt(o.subjectContext)}.`,...vt(o),`Partner class: ${$.partnerClass} (${$.reasons.join("; ")}).`],remediation:C?`Update ${h} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${h} alongside this change, or confirm the coupling no longer holds.`})}}function $t(e,t,i,r,n){n.checksRun.push("twin-partner");let a=he(e,{scanLimit:r}).filter(l=>l.relationship==="divergent"||l.relationship==="identical");if(a.length===0)return;let s=new Map;for(let l of a)for(let o of l.members)s.set(o.symbol,l);let c=new Set;for(let l of t){if(!H(l.symbol))continue;let o=s.get(l.symbol);if(!o)continue;let f=o.members.filter(g=>g.symbol!==l.symbol&&!i.has(g.file));if(f.length===0)continue;let m=[l.symbol,...f.map(g=>g.symbol)].sort().join("|");if(c.has(m))continue;c.add(m);let u=f[0],h=b("twin-partner",l.symbol,l.file,u.symbol);v(n,{id:h,groupKey:`twin-partner:${m}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:o.relationship==="identical"?1:Math.max(0,1-o.maxDivergence),file:l.file,symbol:l.symbol,relatedFiles:f.map(g=>g.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:m,message:`${l.shortName} (${l.file}) changed but its same-name twin ${u.shortName} (${u.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${l.symbol} is in this diff.`,`${u.symbol} shares its (near-)name and is classified '${o.relationship}' with it, but ${u.file} is not in this diff.`,o.relationship==="divergent"?`The two bodies already diverge (~${Math.round(o.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${u.file} alongside this change, consolidate ${l.shortName}/${u.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function wt(e,t,i){i.checksRun.push("coverage-contract");let r=e.config.coverageContracts??[];for(let n of r){if(!me(n,t))continue;let a=pe(e,n);if(a.status==="ok")continue;let s=b("coverage-contract",n.name,n.file);v(i,{id:s,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:a.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:ge(a),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,a.status==="unavailable"?`The declared side could not be evaluated: ${a.unavailableReason}.`:`Missing: ${a.missing.join(", ")||"none"}. Extra: ${a.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:a.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function kt(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${Ft(e.lastTogetherAt)}`}function Dt(e){let t=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",i=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",r=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${t}; refs ${i}; samples ${r}; external issue/PR labels ${e.externalIssueLabelStatus}`}function vt(e){let t=[];return e.commitScope==="broad-sweep"&&t.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&t.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),t}function Ft(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var J=3;function Rt(e,t,i,r,n,a){a.checksRun.push("doc-reference");let s=F.referenceTargets(e,t,r);if(s.size===0)return;let c=new Set(n.map(o=>o.from)),l=[];for(let o of de(e,s))i.has(o.doc)||le(e,o.doc)||l.push(Tt(e,o,c));for(let o of At(l))v(a,o)}function Tt(e,t,i){let r=t.citedClaims.length>0?t.citedClaims:F.citationContexts(e,t.doc,t.cited),n=F.classifyCitation(r),a=F.hasLineAnchoredCitation(t.citations),s=t.cited.some(m=>i.has(m)||!L(`${e.config.projectRoot}/${m}`)),c=!(a||s),l=t.cited[0]??"",o=b("doc-reference",t.doc,t.cited.join("|")),f=b("doc-reference",t.doc,l);return{id:f,legacySuppressionIds:o===f?void 0:[o],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${l}`,rootCauseKey:l,confidence:1,file:t.doc,relatedFiles:t.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:r,...c?{advisory:!0}:{},message:`${t.doc} cites ${t.cited.join(", ")} as ${F.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${t.cited.join(", ")} changed in this diff.`,`${t.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(m=>`Citation kind evidence: ${m}`),c?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":a?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:F.citationRemediation(n.citationKind,t.doc)}}function At(e){let t=new Map;for(let r of e){let n=r.rootCauseKey??"",a=t.get(n);a?a.push(r):t.set(n,[r])}let i=[];for(let[r,n]of t)n.length<=J?i.push(...n):i.push(xt(r,n));return i}function xt(e,t){let i=[...t].sort((f,m)=>(f.file??"").localeCompare(m.file??"")),r=i.slice(0,J).map(f=>({doc:f.file??"",citedClaims:f.citedClaims??[]})),n=i.length-r.length,a=i.every(f=>f.advisory===!0),s=i.reduce((f,m)=>Le(f,m.severity),"info"),c=i.reduce((f,m)=>_e(f,m.actionTier),void 0),l=i.map(f=>f.file??"").filter(f=>f.length>0),o=[...new Set(i.flatMap(f=>[f.id,...f.legacySuppressionIds??[]]))];return{id:b("doc-reference","hub-cluster",e),memberFindingIds:o,check:"doc-reference",severity:s,evidence:"change-graph",actionTier:c,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:r[0]?.doc,relatedFiles:[e],citationCount:i.length,citationExemplars:r,suppressedCount:n,...a?{advisory:!0}:{},message:`${e} is cited by ${i.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${r.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${i.length} doc(s) cite it but were not updated in the same diff: ${l.join(", ")}.`,...r.map(f=>`Example \u2014 ${f.doc}: ${f.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${J}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,a?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${r.length} example doc(s) above; ${i.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function Gt(e,t,i){i.checksRun.push("unused-params");for(let r of xe(e,{files:t,limit:50})){let n=b("unused-params",r.symbol,r.file,r.unusedTrailing.join("|")),a=b("unused-params",r.symbol,r.file);v(i,{id:a,legacySuppressionIds:n===a?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:r.file,startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,message:`${r.shortName} (${r.file}) has trailing unused parameter(s): ${r.unusedTrailing.join(", ")}`,why:[`${r.shortName} is in a changed file.`,`The trailing parameter(s) ${r.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function Et(e,t,i,r){r.checksRun.push("new-dead");let n=new te(e),a=Y(e.config.projectRoot),s=a.length>1;for(let c of t){if(i(c)||c.fanIn>0||n.fileKind(c.file)==="test"||x(e,c.file)||G(e,c.symbol,c.file)||Bt(c.symbol))continue;let l=b("new-dead",c.symbol,c.file),o=s&&jt(a,c.file)&&It(e,c.symbol);v(r,{id:l,check:"new-dead",severity:"warning",evidence:o?"heuristic":"graph-fact",confidence:o?.4:.9,file:c.file,symbol:c.symbol,message:o?`${c.shortName} (${c.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${c.shortName} (${c.file}) was changed but has zero indexed consumers`,why:o?[`${c.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${c.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:o?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function jt(e,t){return e.some(i=>t===i.relativeDir||t.startsWith(`${i.relativeDir}/`))}function It(e,t){let i=R(t);return i?(ee(e).get(i)?.length??0)>1:!1}function Bt(e){if(Q(e)!=="type")return!1;let t=R(e);return t.startsWith("_Assert")||t.startsWith("Assert")}function Nt(e,t,i,r){let n=new Map(i.renamedFiles.map(s=>[s.to,s.from])),a=r??O(e,t,U(i));return s=>{let c=n.get(s.file)??s.file,l=R(s.symbol);if(!l)return!1;let o=a(c);return o!==null&&Kt(o,l)}}function Kt(e,t){return new RegExp(`\\b${Z(t)}\\b`).test(e)}function Mt(e,t){if(!L(A(e))){t.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("baseline");let i=Ee(e);for(let r of i.newFindings.filter(n=>!n.startsWith(I))){let n=q(r),a=b("baseline",r);v(t,{id:a,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${r}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function Pt(e,t){if(!ye(e.config.architecture)){t.skipped.push({check:"architecture",reason:"no closed architecture dependency rows, requireCompletePolicy rule, or requireAcyclic rule configured"});return}if(!L(A(e))){t.skipped.push({check:"architecture",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("architecture");let i=je(e);for(let r of i.newFindings){let n=q(r),a=b("architecture",r);v(t,{id:a,groupKey:`architecture:${n.rootCauseKey}`,check:"architecture",severity:"error",evidence:"baseline",actionTier:"direct",confidence:1,sourceAnalyzer:"architecture",rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${r}`,why:["The project declares an enforceable architecture rule.","The current boundary graph contains a violation not present in the committed baseline.",...n.why],remediation:n.remediation})}}function b(e,...t){return`SQ${lt("sha256").update([e,...t].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{Ge as a,ai as b,Ee as c,je as d,Ui as e,qi as f,Wi as g,Vi as h,Nt as i};
3
- //# sourceMappingURL=chunk-LHMNRHGV.js.map
@@ -1,3 +0,0 @@
1
- import{execFileSync as k,spawnSync as H}from"child_process";import{platform as C}from"os";var y=C()==="win32";function j(t){let e=y?"where":"which";try{return k(e,[t],{stdio:"pipe"}),!0}catch{return!1}}var R=/\.(?:c|m)?js$/i,b=/\.(?:exe|com)$/i;function z(t,e){return R.test(t)?{binary:process.execPath,args:[t,...e]}:{binary:t,args:[...e]}}function w(t,e){return k(t,e,{stdio:["ignore","pipe","ignore"],encoding:"utf8"})}function F(t,e={}){let r=e.isWindows??y,i=e.lookup??w,n;try{n=i(r?"where":"which",[t])}catch{return null}let o=n.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);return r?o.find(s=>b.test(s))??null:o[0]??null}import{spawnSync as v}from"child_process";import{createHash as W}from"crypto";import{existsSync as E,lstatSync as D,realpathSync as I}from"fs";import{dirname as O,isAbsolute as S,join as A,resolve as c}from"path";var p={run(t,e){let r=h(t,e);return r.kind==="success"?r.output:void 0},runResult:h},T=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],G=/^[0-9a-f]{40,64}$/;function q(t,e=p){let r=e.runResult(t,T);if(r.kind==="success"){let i=_(r.output);if(i)return N(i,e)}return P(t,e)}function _(t){let e=t.split(`
2
- `).map(l=>l.trim());if(e.length!==5)return;let[r,i,n,o,s]=e;if(!r||!i||!n||!o||!s||!G.test(o)||!G.test(s))return;let d=u(r);return{root:d,gitDir:u(a(d,i)),commonDir:u(a(d,n)),headCommit:o,treeOid:s}}function N(t,e){let r=e.run(t.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...x(t.root,t.gitDir),commonDir:t.commonDir,repositoryId:g("repository",t.commonDir),headCommit:t.headCommit,treeOid:t.treeOid,clean:r.length===0}}function P(t,e){let r=B(t,e);if(r.kind!=="worktree")return;let i=r.identity,n=i.projectRoot,o=e.run(n,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=u(a(n,o)),d=f(e.run(n,["rev-parse","--verify","HEAD"])),l=f(e.run(n,["rev-parse","--verify","HEAD^{tree}"])),m=e.run(n,["status","--porcelain=v1","-z","--untracked-files=all"]);if(m!==void 0)return{...i,commonDir:s,repositoryId:g("repository",s),headCommit:d,treeOid:l,clean:m.length===0}}function B(t,e=p){let r=e.runResult(t,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let i=r.output.trim();if(!i)return{kind:"error",message:"Git returned an empty worktree root."};let n=u(i),o=e.run(n,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=u(a(n,o));return{kind:"worktree",identity:x(n,s)}}function x(t,e){return{projectRoot:t,gitDir:e,worktreeId:g("worktree",`${t}\0${e}`)}}function Q(t,e,r=p){return f(r.run(t,e))}function a(t,e){return S(e)?e:c(t,e)}function u(t){try{return I(t)}catch{return c(t)}}function g(t,e){return W("sha256").update(`${t}\0${e}`).digest("hex").slice(0,24)}function f(t){return t?.trim()||void 0}function h(t,e){let r=v("git",["-C",t,...e],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"]});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let n=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,o=r.error?.code;return(/not a git repository/i.test(n)||o==="ENOENT"&&E(c(t)))&&!M(t)?{kind:"not-repository"}:{kind:"error",message:n}}function M(t){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let e=c(t);for(;;){try{return D(A(e,".git")),!0}catch(i){let n=i.code;if(n!=="ENOENT"&&n!=="ENOTDIR")return!0}let r=O(e);if(r===e)return!1;e=r}}export{j as a,z as b,F as c,q as d,Q as e,a as f,u as g};
3
- //# sourceMappingURL=chunk-LM72NQ7T.js.map