scip-query 0.10.7 → 0.10.10

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 (236) hide show
  1. package/README.md +4 -2
  2. package/dist/{chunk-OFO7BIRK.js → chunk-2UYQLFVC.js} +2 -2
  3. package/dist/chunk-2VM46FC5.js +8 -0
  4. package/dist/{chunk-WVRTGVHJ.js → chunk-3DGD6NKW.js} +2 -2
  5. package/dist/chunk-3Q77KKEY.js +2 -0
  6. package/dist/chunk-3VD3JMK2.js +2 -0
  7. package/dist/{chunk-U73YFD3P.js → chunk-4KTOV4QN.js} +2 -2
  8. package/dist/chunk-4N4WONI4.js +102 -0
  9. package/dist/{chunk-GOWLZ4NA.js → chunk-56P7PDST.js} +2 -2
  10. package/dist/{chunk-UBDFQBSE.js → chunk-5NVUWIAN.js} +2 -2
  11. package/dist/{chunk-S7DNZ6IW.js → chunk-5VG7RKEF.js} +2 -2
  12. package/dist/{chunk-MHATKJ3J.js → chunk-65AU3HFZ.js} +2 -2
  13. package/dist/{chunk-GKRRO3WC.js → chunk-6LNQOOTB.js} +2 -2
  14. package/dist/{chunk-OZUJ3VZS.js → chunk-72KY2ZFO.js} +2 -2
  15. package/dist/{chunk-QR337MAA.js → chunk-736BLPHR.js} +2 -2
  16. package/dist/chunk-7JRRXGVZ.js +2 -0
  17. package/dist/{chunk-XBIF45WK.js → chunk-7UQWUVRG.js} +2 -2
  18. package/dist/chunk-A6IDHNMC.js +4 -0
  19. package/dist/chunk-A6TANQNV.js +2 -0
  20. package/dist/{chunk-EOUTP32Q.js → chunk-AW2QHPLL.js} +2 -2
  21. package/dist/chunk-BSN22NRK.js +9 -0
  22. package/dist/{chunk-EW64FEJL.js → chunk-BVRS7RKQ.js} +2 -2
  23. package/dist/{chunk-FXWV2V7K.js → chunk-BZ53S4ZN.js} +2 -2
  24. package/dist/{chunk-MJXJ56LG.js → chunk-C5CTSJ6X.js} +2 -2
  25. package/dist/{chunk-OMGE3V2Q.js → chunk-CCKPYPDI.js} +2 -2
  26. package/dist/chunk-CZ425R2B.js +18 -0
  27. package/dist/{chunk-FPYQA7JK.js → chunk-DQVKIG3D.js} +2 -2
  28. package/dist/chunk-F6ICF7HL.js +40 -0
  29. package/dist/chunk-FAYI6KZ5.js +2 -0
  30. package/dist/{chunk-5JXH6VGF.js → chunk-FDEQIPPK.js} +2 -2
  31. package/dist/chunk-FRPEPTYJ.js +5 -0
  32. package/dist/chunk-GBEYTDY5.js +2 -0
  33. package/dist/{chunk-FXI3AAKO.js → chunk-GRJY65YT.js} +2 -2
  34. package/dist/chunk-HF25DFSC.js +3 -0
  35. package/dist/chunk-HHN2B5KA.js +2 -0
  36. package/dist/{chunk-H6RLM7D7.js → chunk-I46WR7MT.js} +2 -2
  37. package/dist/{chunk-GRZRMELG.js → chunk-IPQTC36U.js} +2 -2
  38. package/dist/{chunk-72QDTW5U.js → chunk-J7RWXLUL.js} +2 -2
  39. package/dist/{chunk-XYI7XRZC.js → chunk-KX5PLFZ5.js} +2 -2
  40. package/dist/{chunk-5LM7RJMQ.js → chunk-LPL4MA6R.js} +2 -2
  41. package/dist/chunk-LZHUWKGD.js +2 -0
  42. package/dist/{chunk-OT6CDRKC.js → chunk-MMLZEGMS.js} +2 -2
  43. package/dist/{chunk-LQSLW7K7.js → chunk-NZ4UDB5N.js} +2 -2
  44. package/dist/{chunk-3LQFMQPY.js → chunk-OBGRLXWF.js} +2 -2
  45. package/dist/chunk-P5RYBRIO.js +4 -0
  46. package/dist/chunk-PKMZCDQD.js +4 -0
  47. package/dist/{chunk-733EF5FD.js → chunk-PTQVNJ4Q.js} +2 -2
  48. package/dist/{chunk-EPPCGQUI.js → chunk-QPU7EXAW.js} +2 -2
  49. package/dist/chunk-QVI3NR7E.js +7 -0
  50. package/dist/{chunk-PTKQNPWX.js → chunk-QX7LLCGB.js} +2 -2
  51. package/dist/{chunk-27FU2KX7.js → chunk-QYB5P7GL.js} +2 -2
  52. package/dist/chunk-RVWSAMTT.js +2 -0
  53. package/dist/{chunk-GIOT3O6P.js → chunk-RXRLZFUL.js} +2 -2
  54. package/dist/{chunk-KT2ZO3CE.js → chunk-RYXW3KRC.js} +2 -2
  55. package/dist/{chunk-OWXN6ZS5.js → chunk-SGLLBSCV.js} +2 -2
  56. package/dist/{chunk-XAYARHNF.js → chunk-SULEXAHO.js} +2 -2
  57. package/dist/{chunk-IL2EVPYP.js → chunk-TH2N6QHW.js} +2 -2
  58. package/dist/{chunk-J43GIAVM.js → chunk-TL6QPNF5.js} +2 -2
  59. package/dist/{chunk-PQ6QG3EX.js → chunk-UDGXK2WA.js} +2 -2
  60. package/dist/{chunk-WMIQMXSK.js → chunk-UFX7EPBA.js} +2 -2
  61. package/dist/chunk-UQLFQLAF.js +2 -0
  62. package/dist/{chunk-WXMVK53S.js → chunk-UWYJDBDW.js} +2 -2
  63. package/dist/{chunk-VA3FJ3AY.js → chunk-UYD7FJ3K.js} +2 -2
  64. package/dist/{chunk-RISLKTKQ.js → chunk-VUKC6F77.js} +2 -2
  65. package/dist/{chunk-FRIASDLG.js → chunk-WG6KRH5F.js} +2 -2
  66. package/dist/{chunk-QMH2D6S5.js → chunk-XIVO4SDZ.js} +2 -2
  67. package/dist/{chunk-QPTVFG4O.js → chunk-XSNRACLV.js} +2 -2
  68. package/dist/chunk-XUGQU7PM.js +41 -0
  69. package/dist/{chunk-SXESPZUX.js → chunk-XXZXDXTD.js} +2 -2
  70. package/dist/chunk-Y6E3JHC4.js +2 -0
  71. package/dist/{chunk-DBTL56LR.js → chunk-YBEEVDJQ.js} +2 -2
  72. package/dist/chunk-YGHUVQLR.js +2 -0
  73. package/dist/chunk-YWDVDAD7.js +2 -0
  74. package/dist/chunk-YWOOQ4FF.js +2 -0
  75. package/dist/{chunk-NIGHS7UP.js → chunk-Z4I7BVIU.js} +2 -2
  76. package/dist/{chunk-TDBTVMHY.js → chunk-ZQO43G2T.js} +2 -2
  77. package/dist/{chunk-YNLK3G63.js → chunk-ZU6PROUY.js} +2 -2
  78. package/dist/cli.js +256 -205
  79. package/dist/{db-BAVwb4Pb.d.ts → db-Djj3Nqrb.d.ts} +2 -0
  80. package/dist/{health-B17sVFYf.d.ts → health-D5J42g4D.d.ts} +1 -1
  81. package/dist/index.d.ts +3 -2
  82. package/dist/index.js +3 -3
  83. package/dist/postinstall.js +1 -1
  84. package/dist/queries/affected.d.ts +1 -1
  85. package/dist/queries/affected.js +1 -1
  86. package/dist/queries/bottlenecks.d.ts +1 -1
  87. package/dist/queries/bottlenecks.js +1 -1
  88. package/dist/queries/by-kind.d.ts +1 -1
  89. package/dist/queries/by-kind.js +1 -1
  90. package/dist/queries/call-graph.d.ts +1 -1
  91. package/dist/queries/call-graph.js +1 -1
  92. package/dist/queries/change-surface.d.ts +1 -1
  93. package/dist/queries/change-surface.js +1 -1
  94. package/dist/queries/cleanup-plan.d.ts +1 -1
  95. package/dist/queries/cleanup-plan.js +1 -1
  96. package/dist/queries/co-change.d.ts +1 -1
  97. package/dist/queries/co-change.js +1 -1
  98. package/dist/queries/code.d.ts +1 -1
  99. package/dist/queries/code.js +1 -1
  100. package/dist/queries/complexity-hotspots.d.ts +1 -1
  101. package/dist/queries/complexity-hotspots.js +1 -1
  102. package/dist/queries/complexity.d.ts +1 -1
  103. package/dist/queries/complexity.js +1 -1
  104. package/dist/queries/convergence.d.ts +1 -1
  105. package/dist/queries/convergence.js +1 -1
  106. package/dist/queries/coupling.d.ts +1 -1
  107. package/dist/queries/coupling.js +1 -1
  108. package/dist/queries/cycles.d.ts +1 -1
  109. package/dist/queries/cycles.js +1 -1
  110. package/dist/queries/dataflow.d.ts +1 -1
  111. package/dist/queries/dataflow.js +1 -1
  112. package/dist/queries/dead.d.ts +1 -1
  113. package/dist/queries/dead.js +1 -1
  114. package/dist/queries/deep-chains.d.ts +1 -1
  115. package/dist/queries/deep-chains.js +1 -1
  116. package/dist/queries/deps.d.ts +1 -1
  117. package/dist/queries/deps.js +1 -1
  118. package/dist/queries/diff-gate.d.ts +1 -1
  119. package/dist/queries/diff-gate.js +1 -1
  120. package/dist/queries/diff-impact.d.ts +1 -1
  121. package/dist/queries/diff-impact.js +1 -1
  122. package/dist/queries/doc-drift.d.ts +1 -1
  123. package/dist/queries/doc-drift.js +1 -1
  124. package/dist/queries/drift.d.ts +2 -1
  125. package/dist/queries/drift.js +1 -1
  126. package/dist/queries/extract-candidates.d.ts +1 -1
  127. package/dist/queries/extract-candidates.js +1 -1
  128. package/dist/queries/fan.d.ts +1 -1
  129. package/dist/queries/fan.js +1 -1
  130. package/dist/queries/files.d.ts +1 -1
  131. package/dist/queries/health.d.ts +2 -2
  132. package/dist/queries/health.js +1 -1
  133. package/dist/queries/hierarchy.d.ts +1 -1
  134. package/dist/queries/hierarchy.js +1 -1
  135. package/dist/queries/hotspots.d.ts +1 -1
  136. package/dist/queries/hotspots.js +1 -1
  137. package/dist/queries/imports.d.ts +1 -1
  138. package/dist/queries/imports.js +1 -1
  139. package/dist/queries/incomplete-migration.d.ts +1 -1
  140. package/dist/queries/incomplete-migration.js +1 -1
  141. package/dist/queries/index.d.ts +2 -2
  142. package/dist/queries/index.js +1 -1
  143. package/dist/queries/isolated.d.ts +1 -1
  144. package/dist/queries/isolated.js +1 -1
  145. package/dist/queries/locality-candidates.d.ts +1 -1
  146. package/dist/queries/locality-candidates.js +1 -1
  147. package/dist/queries/members.d.ts +1 -1
  148. package/dist/queries/members.js +1 -1
  149. package/dist/queries/methods.d.ts +1 -1
  150. package/dist/queries/methods.js +1 -1
  151. package/dist/queries/outline.d.ts +1 -1
  152. package/dist/queries/outline.js +1 -1
  153. package/dist/queries/passthrough-candidates.d.ts +1 -1
  154. package/dist/queries/passthrough-candidates.js +1 -1
  155. package/dist/queries/plan-context.d.ts +1 -1
  156. package/dist/queries/plan-context.js +1 -1
  157. package/dist/queries/react-component-duplicates.d.ts +2 -1
  158. package/dist/queries/react-component-duplicates.js +1 -1
  159. package/dist/queries/react-hook-candidates.d.ts +2 -1
  160. package/dist/queries/react-hook-candidates.js +1 -1
  161. package/dist/queries/react-large-component-pressure.d.ts +1 -1
  162. package/dist/queries/react-large-component-pressure.js +1 -1
  163. package/dist/queries/recent-duplicates.d.ts +1 -1
  164. package/dist/queries/recent-duplicates.js +1 -1
  165. package/dist/queries/redundant-reexports.d.ts +1 -1
  166. package/dist/queries/redundant-reexports.js +1 -1
  167. package/dist/queries/refs.d.ts +1 -1
  168. package/dist/queries/refs.js +1 -1
  169. package/dist/queries/self-audit.d.ts +1 -1
  170. package/dist/queries/self-audit.js +1 -1
  171. package/dist/queries/similar-chains.d.ts +1 -1
  172. package/dist/queries/similar-chains.js +1 -1
  173. package/dist/queries/similar-files.d.ts +1 -1
  174. package/dist/queries/similar-files.js +1 -1
  175. package/dist/queries/similar-signatures.d.ts +1 -1
  176. package/dist/queries/similar-signatures.js +1 -1
  177. package/dist/queries/similar.d.ts +11 -2
  178. package/dist/queries/similar.js +1 -1
  179. package/dist/queries/slice.d.ts +1 -1
  180. package/dist/queries/slice.js +1 -1
  181. package/dist/queries/stale-abstractions.d.ts +1 -1
  182. package/dist/queries/stale-abstractions.js +1 -1
  183. package/dist/queries/stats.d.ts +1 -1
  184. package/dist/queries/surface.d.ts +1 -1
  185. package/dist/queries/surface.js +1 -1
  186. package/dist/queries/symbols.d.ts +1 -1
  187. package/dist/queries/symbols.js +1 -1
  188. package/dist/queries/system.d.ts +1 -1
  189. package/dist/queries/system.js +1 -1
  190. package/dist/queries/trace.d.ts +1 -1
  191. package/dist/queries/trace.js +1 -1
  192. package/dist/queries/unused-imports.d.ts +1 -1
  193. package/dist/queries/unused-imports.js +1 -1
  194. package/dist/queries/unused-params.d.ts +1 -1
  195. package/dist/queries/unused-params.js +1 -1
  196. package/dist/queries/vue-component-duplicates.d.ts +2 -1
  197. package/dist/queries/vue-component-duplicates.js +1 -1
  198. package/dist/queries/vue-composable-candidates.d.ts +2 -1
  199. package/dist/queries/vue-composable-candidates.js +1 -1
  200. package/dist/queries/vue-large-view-pressure.d.ts +1 -1
  201. package/dist/queries/wrapper-candidates.d.ts +1 -1
  202. package/dist/queries/wrapper-candidates.js +1 -1
  203. package/dist/runtime.js +1 -1
  204. package/docs/COMMAND_REFERENCE.md +1 -1
  205. package/docs/analyzer-inventory.md +29 -0
  206. package/docs/analyzer-validation-ledger.md +32 -1
  207. package/package.json +1 -1
  208. package/skills/scip-hyper-optimization/SKILL.md +97 -0
  209. package/skills/scip-hyper-optimization/agents/openai.yaml +4 -0
  210. package/skills/scip-query/SKILL.md +4 -0
  211. package/dist/chunk-3C4NIBY5.js +0 -2
  212. package/dist/chunk-5MHQI4RR.js +0 -3
  213. package/dist/chunk-7AOMEMOA.js +0 -4
  214. package/dist/chunk-BZ2RRK7Y.js +0 -8
  215. package/dist/chunk-C6ROZBJA.js +0 -32
  216. package/dist/chunk-CMXD5VC4.js +0 -2
  217. package/dist/chunk-CQEJU32R.js +0 -2
  218. package/dist/chunk-DOZ2X6TS.js +0 -2
  219. package/dist/chunk-FKYPOK7P.js +0 -5
  220. package/dist/chunk-G2CGUNQU.js +0 -4
  221. package/dist/chunk-HDBQHJNY.js +0 -2
  222. package/dist/chunk-IA7Q6HVP.js +0 -18
  223. package/dist/chunk-JOGZKF5W.js +0 -2
  224. package/dist/chunk-KRGBLZT2.js +0 -7
  225. package/dist/chunk-KUIIQPDA.js +0 -2
  226. package/dist/chunk-LONIY5FF.js +0 -2
  227. package/dist/chunk-M3YEHOCD.js +0 -2
  228. package/dist/chunk-MFWAZFYD.js +0 -2
  229. package/dist/chunk-P3K7LX7M.js +0 -4
  230. package/dist/chunk-PVZMPG5I.js +0 -2
  231. package/dist/chunk-QVS4SYAX.js +0 -7
  232. package/dist/chunk-TJXOD4IK.js +0 -62
  233. package/dist/chunk-UJEVABIR.js +0 -2
  234. package/dist/chunk-W2TIXAGN.js +0 -40
  235. package/dist/chunk-YOCYR7KJ.js +0 -2
  236. package/dist/chunk-ZUTV7DDX.js +0 -2
@@ -1,4 +1,4 @@
1
- import { S as ScipDatabase } from '../db-BAVwb4Pb.js';
1
+ import { S as ScipDatabase } from '../db-Djj3Nqrb.js';
2
2
  import 'better-sqlite3';
3
3
  import '../config-types-BDIWAYzr.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as ScipDatabase } from '../db-BAVwb4Pb.js';
1
+ import { S as ScipDatabase } from '../db-Djj3Nqrb.js';
2
2
  import 'better-sqlite3';
3
3
  import '../config-types-BDIWAYzr.js';
4
4
 
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-QVS4SYAX.js";import"../chunk-FXI3AAKO.js";import"../chunk-LM5SHAN4.js";import"../chunk-PFOCOG57.js";import"../chunk-B75HZHUP.js";import"../chunk-LONIY5FF.js";import"../chunk-MJXJ56LG.js";import"../chunk-BGBBVSH4.js";import"../chunk-MFWAZFYD.js";import"../chunk-XAYARHNF.js";import"../chunk-W2TIXAGN.js";import"../chunk-U73YFD3P.js";import"../chunk-733EF5FD.js";import"../chunk-RISLKTKQ.js";import"../chunk-G2CGUNQU.js";import"../chunk-3LQFMQPY.js";import"../chunk-TJXOD4IK.js";import"../chunk-JM72FNGA.js";import"../chunk-OZUJ3VZS.js";import"../chunk-YZA6PPZL.js";import"../chunk-5MHQI4RR.js";import"../chunk-DS6QEB3G.js";import"../chunk-C6ROZBJA.js";import"../chunk-A536TEU4.js";import"../chunk-64MNV6AB.js";import"../chunk-7S5E7KWT.js";export{a as wrapperCandidates};
1
+ import{a}from"../chunk-QVI3NR7E.js";import"../chunk-GRJY65YT.js";import"../chunk-LM5SHAN4.js";import"../chunk-PFOCOG57.js";import"../chunk-B75HZHUP.js";import"../chunk-GBEYTDY5.js";import"../chunk-C5CTSJ6X.js";import"../chunk-BGBBVSH4.js";import"../chunk-UQLFQLAF.js";import"../chunk-SULEXAHO.js";import"../chunk-F6ICF7HL.js";import"../chunk-4KTOV4QN.js";import"../chunk-PTQVNJ4Q.js";import"../chunk-VUKC6F77.js";import"../chunk-P5RYBRIO.js";import"../chunk-OBGRLXWF.js";import"../chunk-4N4WONI4.js";import"../chunk-JM72FNGA.js";import"../chunk-72KY2ZFO.js";import"../chunk-YZA6PPZL.js";import"../chunk-HF25DFSC.js";import"../chunk-DS6QEB3G.js";import"../chunk-XUGQU7PM.js";import"../chunk-A536TEU4.js";import"../chunk-64MNV6AB.js";import"../chunk-7S5E7KWT.js";export{a as wrapperCandidates};
2
2
  //# sourceMappingURL=wrapper-candidates.js.map
package/dist/runtime.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import{c as I,d as M,e as E}from"./chunk-ONPCQ2PM.js";import{a as C}from"./chunk-UUBMFL3F.js";import{readFileSync as $,writeFileSync as D,existsSync as R,mkdirSync as _}from"fs";import{isAbsolute as oe,join as c,relative as ae,resolve as P}from"path";import{createHash as A}from"crypto";import{homedir as N}from"os";var g=".scipquery.json",W={enabled:!1,debounceMs:3e4,cooldownMs:6e4,gitPollMs:2e3,autoRefresh:!0,ignore:[]};function m(i){let e=c(i,g);if(!R(e))return{};try{let t=$(e,"utf-8");return JSON.parse(t)}catch(t){let r=t instanceof Error?t.message:String(t);throw t instanceof SyntaxError?new Error(`invalid ${g} at ${e}: ${r}`,{cause:t}):new Error(`unable to read ${g} at ${e}: ${r}`,{cause:t})}}function j(i){return{...W,...i.watch}}function G(i,e){let t=process.env.SCIP_QUERY_CACHE_DIR;if(t)return f(t);if(e?.dbPath)return f(P(i,e.dbPath));let s=process.env.XDG_CACHE_HOME||c(N(),".cache"),n=A("sha256").update(P(i)).digest("hex").slice(0,12),a=c(s,"scip-query","projects",n);return f(a)}function y(i,e){let t=G(i,e);return{cacheDir:t,dbPath:c(t,"index.db"),indexPath:c(t,"index.scip"),metaPath:c(t,"meta.json")}}function F(i,e){let t=c(i,g);return R(t)||D(t,JSON.stringify({languages:e,watch:{enabled:!1,debounceMs:3e4,cooldownMs:6e4,gitPollMs:2e3,autoRefresh:!0}},null,2)+`
2
- `),t}function f(i){return _(i,{recursive:!0}),i}import{execFileSync as O,fork as L}from"child_process";import{statSync as U,watch as H}from"fs";import{join as q,relative as X}from"path";import B from"ignore";var x=class{projectRoot;config;watchConfig;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;indexerConcurrency;onStatus;onReindexComplete;onError;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=j(e.config),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onError=e.onError??(t=>console.error(t.message)),this.gitignoreFilter=C(e.projectRoot),this.extraIgnore=B(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{let e=H(this.projectRoot,{recursive:!0},(t,r)=>{r&&!this.stopped&&this.handleFileChange(r)});this.fsWatchers.push(e)}catch{this.onError(new Error("Failed to start file watcher. On Linux, you may need to increase inotify limits: sysctl -w fs.inotify.max_user_watches=524288"))}}stop(){this.stopped=!0;for(let e of this.fsWatchers)e.close();this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearGitPollTimer(),this.setStatus({state:"idle"})}handleFileChange(e){let t=X(this.projectRoot,q(this.projectRoot,e));t===".git"||t.startsWith(".git/")||this.gitignoreFilter.isIgnored(t)||this.extraIgnore.ignores(t)||e.endsWith("index.db")||e.endsWith("index.scip")||e.endsWith("index.db.tmp")||this.scheduleReindex({kind:"watch-source",detail:t})}scheduleReindex(e){if(this.pendingTrigger=z(this.pendingTrigger,e),this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}this.clearDebounceTimer();let t=Date.now()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:t}),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=Date.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&e<this.watchConfig.cooldownMs){let s=this.watchConfig.cooldownMs-e;this.dirty=!0;let n=Date.now()+s;this.setStatus({state:"cooldown",until:n,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},s);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let t=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let r=Date.now();this.setStatus({state:"indexing",startedAt:r}),this.runReindex(t).then(s=>{if(this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onReindexComplete(s),this.dirty&&!this.stopped){let n=Date.now()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:n,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(s=>{this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onError(s instanceof Error?s:new Error(String(s))),this.setStatus({state:"idle"})})}runReindex(e){return new Promise((t,r)=>{let s=Date.now(),n=m(this.projectRoot),a=Object.keys(n).length>0?n:this.config,h=y(this.projectRoot,a),l=a.indexer?.typescript,o=L(new URL("./reindex-worker.js",import.meta.url).pathname,[],{detached:!0,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:this.projectRoot,SCIP_REINDEX_OUTPUT_SCIP:h.indexPath,SCIP_REINDEX_OUTPUT_DB:h.dbPath,SCIP_REINDEX_LANGUAGES:(a.languages??this.languages)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(a.indexerConcurrency??this.indexerConcurrency??""),SCIP_REINDEX_PNPM_WORKSPACES:l?.pnpmWorkspaces??this.pnpmWorkspaces?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:l?.projectMode??this.typescriptProjectMode,projects:l?.projects??this.typescriptProjects??[]}),SCIP_REINDEX_TRIGGER_KIND:e.kind,SCIP_REINDEX_TRIGGER_DETAIL:e.detail??""},stdio:"pipe"});o.on("exit",p=>{p===0?t(Date.now()-s):r(new Error(`Reindex worker exited with code ${p}`))}),o.on("error",r)})}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(this.gitPollTimer=setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}pollGitState(){let e=this.lastGitState,t=this.readGitState();if(!e||!t||this.stopped){this.lastGitState=t;return}this.lastGitState=t;let r=e.head!==t.head,s=e.indexPath!==t.indexPath||e.indexMtimeMs!==t.indexMtimeMs||e.indexSize!==t.indexSize;r&&s?this.scheduleReindex({kind:"watch-git-state",detail:"HEAD and index changed"}):r?this.scheduleReindex({kind:"watch-git-head",detail:"HEAD changed"}):s&&this.scheduleReindex({kind:"watch-git-index",detail:t.indexPath??"index changed"})}readGitState(){let e=T(this.projectRoot,["rev-parse","--git-path","index"]);if(!e)return null;let t={head:T(this.projectRoot,["rev-parse","--verify","HEAD"]),indexPath:e};try{let r=U(e);t.indexMtimeMs=r.mtimeMs,t.indexSize=r.size}catch{t.indexMtimeMs=void 0,t.indexSize=void 0}return t}clearGitPollTimer(){this.gitPollTimer&&(clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};function T(i,e){try{return O("git",["-C",i,...e],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function z(i,e){return i?i.kind===e.kind?i.detail===e.detail?i:{kind:i.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${i.kind}, ${e.kind}`}:e}import{existsSync as S,mkdirSync as J,symlinkSync as K,readlinkSync as V,unlinkSync as Y}from"fs";import{join as d,dirname as k,resolve as v}from"path";import{homedir as w,platform as Q}from"os";import{fileURLToPath as Z}from"url";var ee=Q()==="win32",te=["scip-query","scip-query-setup","scip-adoption","scip-health-audit","scip-health-improve","scip-api-impact","concrete-plan","scip-ai-cleanup","scip-debug","scip-explore","scip-triage-issue","scip-diagram","scip-debloat","scip-doc-reconcile","scip-directory-architecture","scip-maintainability","scip-react-maintainability","scip-vue-maintainability","scip-verify","scip-language-playbook"];function ie(i={}){let e=i.quiet?()=>{}:console.log,t=Z(import.meta.url),r=v(k(t),"..","skills"),s=[d(w(),".claude","skills"),d(w(),".codex","skills"),d(w(),".agents","skills")],n={installed:[],skipped:[],alreadyLinked:[]};for(let a of s){let h=k(a);if(!S(h))continue;J(a,{recursive:!0});let l=re(a);for(let o of te){let p=d(r,o),u=d(a,o);if(!S(p)){n.skipped.push(`${l}/${o}`);continue}if(S(u)){try{let b=V(u);if(v(b)===v(p)){n.alreadyLinked.push(`${l}/${o}`),e(` ok: ${o} \u2192 ${l} (already linked)`);continue}}catch{n.skipped.push(`${l}/${o}`),e(` skip: ${o} \u2192 ${l} (exists, not a symlink)`);continue}Y(u)}K(p,u,ee?"junction":"dir"),n.installed.push(`${l}/${o}`),e(` done: ${o} \u2192 ${l}`)}}return n}function re(i){return i.includes(".codex")?"Codex":i.includes(".agents")?"Agents":"Claude"}export{x as Watcher,M as getScipVersion,F as initProjectConfig,ie as installSkills,I as isScipInstalled,m as loadProjectConfig,E as printScipInstallInstructions,y as resolveIndexPaths};
2
+ `),t}function f(i){return _(i,{recursive:!0}),i}import{execFileSync as O,fork as L}from"child_process";import{statSync as U,watch as H}from"fs";import{join as q,relative as X}from"path";import B from"ignore";var x=class{projectRoot;config;watchConfig;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;indexerConcurrency;onStatus;onReindexComplete;onError;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=j(e.config),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onError=e.onError??(t=>console.error(t.message)),this.gitignoreFilter=C(e.projectRoot),this.extraIgnore=B(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{let e=H(this.projectRoot,{recursive:!0},(t,r)=>{r&&!this.stopped&&this.handleFileChange(r)});this.fsWatchers.push(e)}catch{this.onError(new Error("Failed to start file watcher. On Linux, you may need to increase inotify limits: sysctl -w fs.inotify.max_user_watches=524288"))}}stop(){this.stopped=!0;for(let e of this.fsWatchers)e.close();this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearGitPollTimer(),this.setStatus({state:"idle"})}handleFileChange(e){let t=X(this.projectRoot,q(this.projectRoot,e));t===".git"||t.startsWith(".git/")||this.gitignoreFilter.isIgnored(t)||this.extraIgnore.ignores(t)||e.endsWith("index.db")||e.endsWith("index.scip")||e.endsWith("index.db.tmp")||this.scheduleReindex({kind:"watch-source",detail:t})}scheduleReindex(e){if(this.pendingTrigger=z(this.pendingTrigger,e),this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}this.clearDebounceTimer();let t=Date.now()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:t}),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=Date.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&e<this.watchConfig.cooldownMs){let s=this.watchConfig.cooldownMs-e;this.dirty=!0;let n=Date.now()+s;this.setStatus({state:"cooldown",until:n,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},s);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let t=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let r=Date.now();this.setStatus({state:"indexing",startedAt:r}),this.runReindex(t).then(s=>{if(this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onReindexComplete(s),this.dirty&&!this.stopped){let n=Date.now()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:n,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(s=>{this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onError(s instanceof Error?s:new Error(String(s))),this.setStatus({state:"idle"})})}runReindex(e){return new Promise((t,r)=>{let s=Date.now(),n=m(this.projectRoot),a=Object.keys(n).length>0?n:this.config,h=y(this.projectRoot,a),l=a.indexer?.typescript,o=L(new URL("./reindex-worker.js",import.meta.url).pathname,[],{detached:!0,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:this.projectRoot,SCIP_REINDEX_OUTPUT_SCIP:h.indexPath,SCIP_REINDEX_OUTPUT_DB:h.dbPath,SCIP_REINDEX_LANGUAGES:(a.languages??this.languages)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(a.indexerConcurrency??this.indexerConcurrency??""),SCIP_REINDEX_PNPM_WORKSPACES:l?.pnpmWorkspaces??this.pnpmWorkspaces?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:l?.projectMode??this.typescriptProjectMode,projects:l?.projects??this.typescriptProjects??[]}),SCIP_REINDEX_TRIGGER_KIND:e.kind,SCIP_REINDEX_TRIGGER_DETAIL:e.detail??""},stdio:"pipe"});o.on("exit",p=>{p===0?t(Date.now()-s):r(new Error(`Reindex worker exited with code ${p}`))}),o.on("error",r)})}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(this.gitPollTimer=setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}pollGitState(){let e=this.lastGitState,t=this.readGitState();if(!e||!t||this.stopped){this.lastGitState=t;return}this.lastGitState=t;let r=e.head!==t.head,s=e.indexPath!==t.indexPath||e.indexMtimeMs!==t.indexMtimeMs||e.indexSize!==t.indexSize;r&&s?this.scheduleReindex({kind:"watch-git-state",detail:"HEAD and index changed"}):r?this.scheduleReindex({kind:"watch-git-head",detail:"HEAD changed"}):s&&this.scheduleReindex({kind:"watch-git-index",detail:t.indexPath??"index changed"})}readGitState(){let e=T(this.projectRoot,["rev-parse","--git-path","index"]);if(!e)return null;let t={head:T(this.projectRoot,["rev-parse","--verify","HEAD"]),indexPath:e};try{let r=U(e);t.indexMtimeMs=r.mtimeMs,t.indexSize=r.size}catch{t.indexMtimeMs=void 0,t.indexSize=void 0}return t}clearGitPollTimer(){this.gitPollTimer&&(clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};function T(i,e){try{return O("git",["-C",i,...e],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function z(i,e){return i?i.kind===e.kind?i.detail===e.detail?i:{kind:i.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${i.kind}, ${e.kind}`}:e}import{existsSync as S,mkdirSync as J,symlinkSync as K,readlinkSync as V,unlinkSync as Y}from"fs";import{join as d,dirname as k,resolve as v}from"path";import{homedir as w,platform as Q}from"os";import{fileURLToPath as Z}from"url";var ee=Q()==="win32",te=["scip-query","scip-query-setup","scip-adoption","scip-health-audit","scip-health-improve","scip-hyper-optimization","scip-api-impact","concrete-plan","scip-ai-cleanup","scip-debug","scip-explore","scip-triage-issue","scip-diagram","scip-debloat","scip-doc-reconcile","scip-directory-architecture","scip-maintainability","scip-react-maintainability","scip-vue-maintainability","scip-verify","scip-language-playbook"];function ie(i={}){let e=i.quiet?()=>{}:console.log,t=Z(import.meta.url),r=v(k(t),"..","skills"),s=[d(w(),".claude","skills"),d(w(),".codex","skills"),d(w(),".agents","skills")],n={installed:[],skipped:[],alreadyLinked:[]};for(let a of s){let h=k(a);if(!S(h))continue;J(a,{recursive:!0});let l=re(a);for(let o of te){let p=d(r,o),u=d(a,o);if(!S(p)){n.skipped.push(`${l}/${o}`);continue}if(S(u)){try{let b=V(u);if(v(b)===v(p)){n.alreadyLinked.push(`${l}/${o}`),e(` ok: ${o} \u2192 ${l} (already linked)`);continue}}catch{n.skipped.push(`${l}/${o}`),e(` skip: ${o} \u2192 ${l} (exists, not a symlink)`);continue}Y(u)}K(p,u,ee?"junction":"dir"),n.installed.push(`${l}/${o}`),e(` done: ${o} \u2192 ${l}`)}}return n}function re(i){return i.includes(".codex")?"Codex":i.includes(".agents")?"Agents":"Claude"}export{x as Watcher,M as getScipVersion,F as initProjectConfig,ie as installSkills,I as isScipInstalled,m as loadProjectConfig,E as printScipInstallInstructions,y as resolveIndexPaths};
3
3
  //# sourceMappingURL=runtime.js.map
@@ -116,7 +116,7 @@ This syntax summary is generated from the CLI command descriptors. Keep workflow
116
116
  | Command | Description | Options |
117
117
  |---|---|---|
118
118
  | `bench` | Benchmark indexing and command runtimes for this repository | `--json`<br>`--cold-index`<br>`--include-heavy`<br>`--command <cmd>`<br>`--timeout-ms <n>` |
119
- | `install-skills` | Install skills (scip-query, scip-query-setup, scip-adoption, scip-health-audit, scip-health-improve, scip-api-impact, concrete-plan, scip-ai-cleanup, scip-debug, scip-explore, scip-triage-issue, scip-diagram, scip-debloat, scip-doc-reconcile, scip-directory-architecture, scip-maintainability, scip-react-maintainability, scip-vue-maintainability, scip-verify, scip-language-playbook) into Claude Code, Codex, and shared agent roots | - |
119
+ | `install-skills` | Install skills (scip-query, scip-query-setup, scip-adoption, scip-health-audit, scip-health-improve, scip-hyper-optimization, scip-api-impact, concrete-plan, scip-ai-cleanup, scip-debug, scip-explore, scip-triage-issue, scip-diagram, scip-debloat, scip-doc-reconcile, scip-directory-architecture, scip-maintainability, scip-react-maintainability, scip-vue-maintainability, scip-verify, scip-language-playbook) into Claude Code, Codex, and shared agent roots | - |
120
120
  | `setup-hooks` | Install or refresh project-local Codex and Claude Code lifecycle hooks | `--json` |
121
121
  | `check-deps` | Check whether scip-query and the detected language indexers are actually runnable | - |
122
122
  | `capabilities` | Report which evidence and verification capabilities are available in this project | `--json` |
@@ -164,3 +164,32 @@ This should pair with `react-large-component-pressure`, `vue-large-view-pressure
164
164
  ## 2026-06-23 Citation Refresh
165
165
 
166
166
  The maintainability-register completion slice rechecked the command and diff-gate guide references above. `src/runtime/commands/query-command-specs.ts` still owns the public query order, now also exporting `orderedQueryCommandDescriptors` so CLI registration can derive from that order. `src/queries/impact/diff-gate.ts` still owns `DIFF_GATE_CHECKS`; the slice only centralized finding emission through a local recorder and did not change the listed check family.
167
+
168
+ ## 2026-06-28 Diff-Gate Echo Follow-Up
169
+
170
+ The diff-gate implementation still owns `DIFF_GATE_CHECKS` and the default
171
+ diff-scoped check family in `src/queries/impact/diff-gate.ts`. The
172
+ hyper-optimization follow-up only adds a callable-symbol prefilter before the
173
+ echo check invokes similarity, so the command surface and check inventory
174
+ described above are unchanged.
175
+
176
+ ## 2026-06-28 Health Drift Performance Follow-Up
177
+
178
+ The `src/queries/health/health.ts` citation remains accurate. The
179
+ hyper-optimization follow-up only skips advisory drift `pattern-deviation` rows
180
+ for health and baseline paths that already hide those rows; health scoring,
181
+ phase inventory, and public `drift` output are unchanged.
182
+
183
+ ## 2026-06-28 Diff-Gate Co-Change Follow-Up
184
+
185
+ The `src/queries/impact/diff-gate.ts` citation remains accurate. Diff-gate
186
+ still owns `DIFF_GATE_CHECKS`; the co-change partner check now compares against
187
+ the raw git changed-path set so changed docs and config files count as present
188
+ even when they are not indexed code files.
189
+
190
+ ## 2026-06-28 Focused Co-Change History Follow-Up
191
+
192
+ The `src/queries/impact/diff-gate.ts` citation remains accurate after the
193
+ focused co-change history optimization. Diff-gate still owns the check list and
194
+ co-change partner gate; the latest change only narrows the git-history read for
195
+ that gate to commits in the bounded analysis window that touched changed files.
@@ -15,7 +15,7 @@ The ledger is anchored to the current tool surface, not memory.
15
15
  | Surface | Source | Why it anchors the ledger |
16
16
  | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------- |
17
17
  | Repo-wide health analysis | `scip-query code health --json` reported `src/queries/health/health.ts:194`, where `health()` runs `runHealthAnalyses()` and `buildHealthReport()`. | Every repo-wide analyzer validation must eventually reconcile with health output and scoring. |
18
- | Change-time gate analysis | `scip-query code diffGate --json` reported `src/queries/impact/diff-gate.ts:94`, where `diffGate()` runs the default diff-scoped checks: `echo`, `incomplete-migration`, `co-change-partner`, `doc-reference`, `unused-params`, and `new-dead`. The baseline ratchet is explicit because it is repo-wide. | Every diff-only analyzer needs a separate validation path from repo-wide health. |
18
+ | Change-time gate analysis | `scip-query code diffGate --json` reported `src/queries/impact/diff-gate.ts:94`, where `diffGate()` runs the default diff-scoped checks: `echo`, `incomplete-migration`, `co-change-partner`, `doc-reference`, `unused-params`, and `new-dead`. The baseline ratchet is explicit because it is repo-wide. | Every diff-only analyzer needs a separate validation path from repo-wide health. |
19
19
  | Public command registry | `scip-query trace queryCommandOrder --json` reported `src/runtime/commands/query-command-specs.ts:10`, where the public query command order starts. `scip-query code queryCommandDescriptor --json` reported `src/runtime/commands/query-command-specs.ts:94`, where command descriptors are resolved by id. | The ledger must not silently miss a public analyzer command. |
20
20
  | Diff-gate check list | `scip-query trace DIFF_GATE_CHECKS --json` reported `src/queries/impact/diff-gate.ts:27`, where the canonical diff-gate check list is exported. | The ledger must cover every change-time check that can block a diff. |
21
21
 
@@ -268,3 +268,34 @@ The maintainability-register completion slice rechecked the ledger's command-sur
268
268
  ## 2026-06-23 Current Sweep Citation Refresh
269
269
 
270
270
  The current maintainability sweep rechecked the `diff-gate.ts` citation again after doc-reference and baseline policy helpers moved into private query modules. The ledger remains accurate because `diffGate()` and `DIFF_GATE_CHECKS` still live in `src/queries/impact/diff-gate.ts`; the baseline policy body remains behind the same entry point, but the repo-wide baseline ratchet is explicit rather than part of default diff-gate execution.
271
+
272
+ ## 2026-06-28 Diff-Gate Echo Follow-Up
273
+
274
+ The `diffGate()` citation remains accurate: default diff-gate execution still
275
+ runs echo, incomplete migration, co-change partner, doc-reference,
276
+ unused-params, and new-dead checks through `src/queries/impact/diff-gate.ts`.
277
+ The performance follow-up only skips non-callable changed symbols before echo
278
+ similarity scoring; baseline ratchet behavior and check configuration remain
279
+ unchanged.
280
+
281
+ ## 2026-06-28 Health Drift Performance Follow-Up
282
+
283
+ The `src/queries/health/health.ts` reference remains accurate after the health
284
+ drift optimization. Health and the baseline ratchet now ask `drift()` to skip
285
+ advisory `pattern-deviation` rows they already exclude from visible output and
286
+ stable finding identities; the repo-wide health score contract is unchanged.
287
+
288
+ ## 2026-06-28 Diff-Gate Co-Change Follow-Up
289
+
290
+ The `diffGate()` citation remains accurate. Default diff-gate still runs the
291
+ same check family; the co-change partner check now uses the raw git changed
292
+ paths when deciding whether a historical partner is already present in the
293
+ diff.
294
+
295
+ ## 2026-06-28 Focused Co-Change History Follow-Up
296
+
297
+ The `diffGate()` citation remains accurate after the focused co-change history
298
+ optimization. Default diff-gate still runs the same check family; the
299
+ co-change partner check now reads only changed-file commits from the same
300
+ bounded git-history window instead of parsing the whole name-only history
301
+ payload.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scip-query",
3
- "version": "0.10.7",
3
+ "version": "0.10.10",
4
4
  "description": "Evidence and verification for AI coding agents: map code, reuse concepts, finish migrations, and gate diffs.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: scip-hyper-optimization
3
+ description: Run scientific performance optimization campaigns with scip-query evidence, command ledgers, and benchmark corpora. Use when the user asks to hyper optimize, make commands blazing fast, speed up a CLI/tool/app, benchmark regressions, or compare targeted tuning against radically different implementations.
4
+ ---
5
+
6
+ # SCIP Hyper Optimization
7
+ Use this skill to make a command, workflow, service, page, or tool as fast as
8
+ feasibly possible without changing its observable result. Hyper optimization is
9
+ a bounded campaign that improves runtime, memory use, or computational cost
10
+ against objective measurements; every accepted change is proven by a repeatable
11
+ benchmark and unchanged output.
12
+
13
+ A measurement harness is the repeatable set of commands, fixtures, corpora,
14
+ environment notes, and result documents used to decide whether performance
15
+ changed. A command ledger is the living document for one target: what it
16
+ returns, what code runs, where time is spent, what was tried, and what evidence
17
+ accepted or rejected each idea.
18
+
19
+ ## Rules
20
+
21
+ 1. Do not optimize until a measurement harness exists or has been created.
22
+ 2. Use scip-query for code understanding: `status`, `plan-context`, `trace`,
23
+ `call-graph`, `code`, `dataflow`, `complexity`, `diff-impact`, `diff-gate`.
24
+ 3. Capture representative inputs, required output behavior, and correctness
25
+ checks before editing.
26
+ 4. Measure cold and warm paths when both matter; record exact commands, corpus,
27
+ elapsed time, repetitions, and outliers.
28
+ 5. Work both tracks: tune the current pipeline and evaluate radically different
29
+ algorithms or data models that preserve the same result.
30
+ 6. Keep only changes that improve real workloads without reducing accuracy,
31
+ diagnostics, safety checks, or supported inputs.
32
+
33
+ ## Phase 0: Measurement Harness
34
+ If the target repository is not already a reliable scip-query workspace, invoke
35
+ `scip-query-setup` first. Do not run setup-ci in this workflow.
36
+
37
+ Create or update a benchmark note before code changes. Prefer the repo's
38
+ existing convention; otherwise use
39
+ `docs/benchmarks/YYYY-MM-DD-<target>-baseline.md`. Include target, machine/date
40
+ context, corpus or fixture list, cold/warm/correctness commands, baseline
41
+ timings, output-contract evidence, and slowest stages.
42
+
43
+ Choose the measurement mechanism from the target's real workload. For app
44
+ paths, use the app's benchmark, test, route smoke, build, profiler, load test,
45
+ or timing script; if none exists, create the smallest repeatable timing command.
46
+ For scip-query command, detector, or indexer targets, benchmark the relevant
47
+ command matrix:
48
+
49
+ ```bash
50
+ scip-query bench --json
51
+ scip-query bench --json --cold-index --include-heavy --timeout-ms 600000
52
+ ```
53
+
54
+ ## Phase 1: Command Ledger
55
+ Create one ledger per target:
56
+ `docs/benchmarks/YYYY-MM-DD-<target>-ledger.md`. Include Output Contract,
57
+ Current Pipeline, Measurements, Current-Pipeline Optimizations, Alternative
58
+ Designs, and Decisions.
59
+
60
+ ## Phase 2: Trace Current Behavior
61
+ Trace the target end to end and write the actual path into the ledger:
62
+
63
+ ```bash
64
+ scip-query status --capabilities
65
+ # If stale, missing, or unknown: scip-query reindex
66
+ scip-query plan-context <entry-symbol-or-file>
67
+ scip-query trace <entry-symbol>
68
+ scip-query call-graph <entry-symbol>
69
+ scip-query code <entry-symbol>
70
+ scip-query dataflow <entry-symbol>
71
+ scip-query complexity <hot-symbol>
72
+ scip-query change-surface <touched-file> --json --full
73
+ ```
74
+
75
+ Record input parsing, lookups, database queries, graph traversal, source scans,
76
+ semantic calls, cache reads/writes, rendering, and verification.
77
+
78
+ ## Phase 3: Find Speedups
79
+ For the current pipeline, look for repeated work, broad scans, N+1 lookups,
80
+ uncached pure work, avoidable source or semantic reads, large arrays, late
81
+ filters, batchable per-file work, and safe parallelism.
82
+
83
+ For alternative designs, restate the output contract first. Ask whether SQLite
84
+ can answer directly, an index/cache/precomputed table can move work out of the
85
+ hot path, batch queries can replace loops, a cheap pruning stage can precede
86
+ exact work, or workers can run independent phases safely.
87
+
88
+ ## Phase 4: Implement and Verify
89
+ Make the smallest reversible change that tests one performance hypothesis.
90
+ Update the ledger with hypothesis, changed files/symbols, before/after timings,
91
+ output comparison, tests, and gates.
92
+
93
+ Run the narrow correctness check, benchmark cases, `scip-query diff-impact
94
+ --json`, and `scip-query diff-gate --json`; reindex first if freshness is not
95
+ proven. Also run postchecks matching the change type. End with starting time,
96
+ final time, percentage change, accepted changes, rejected ideas, remaining
97
+ bottlenecks, and the next target.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "SCIP Hyper Optimization"
3
+ short_description: "Scientific benchmark-driven optimization"
4
+ default_prompt: "Use $scip-hyper-optimization to set up objective benchmarks, trace the target end to end, and optimize it without changing output."
@@ -41,6 +41,7 @@ When the user asks you to build, change, or fix something non-trivial:
41
41
  | Assess a public API, route, CLI, config, schema, or boundary change | `scip-api-impact` | `scip-query surface <module>`, `scip-query affected <symbol>`, `scip-query co-change <file>` |
42
42
  | Pick high-signal commands for an unfamiliar language | `scip-language-playbook` | — |
43
43
  | Benchmark indexing, command runtime, or detector performance | `scip-query` | `scip-query bench --json`, `scip-query bench --cold-index --include-heavy` |
44
+ | Hyper-optimize a command, workflow, indexer, detector, or app path with benchmark ledgers and alternative designs | `scip-hyper-optimization` | `scip-query bench --json`, `scip-query plan-context <target>`, command-specific correctness checks |
44
45
  | Adopt or bootstrap scip-query in a repository | `scip-adoption` | `scip-query setup --json`, `scip-query check-deps`, `scip-query capability-matrix --json` |
45
46
  | Verify work you just finished (any implementation, refactor, or extraction) | `scip-verify` | `scip-query status --capabilities`, `scip-query diff-gate --json` |
46
47
  | Confirm post-setup health signals before cleanup | `scip-health-audit` | `scip-query health --json --full`, `scip-query diff-gate --json` |
@@ -63,6 +64,9 @@ Use these boundaries before loading a specialist skill:
63
64
  - `scip-health-improve` is the autonomous campaign. Use it when the user asks
64
65
  to raise/maximize the health score, keep working with minimal interaction, or
65
66
  get the repo as clean as reasonably possible.
67
+ - `scip-hyper-optimization` is the benchmark-led performance campaign. Use it
68
+ when the user asks to make a command, detector, indexer, workflow, or app path
69
+ as fast as possible while preserving output.
66
70
  - `scip-debloat` is a bloat audit and cleanup plan. Use it when the user wants
67
71
  dead code, duplication, unnecessary abstractions, wrappers, or structural
68
72
  waste found and prioritized, but has not asked for a score-maxing campaign.
@@ -1,2 +0,0 @@
1
- import{b as r}from"./chunk-KT2ZO3CE.js";import{i as e}from"./chunk-TJXOD4IK.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
- //# sourceMappingURL=chunk-3C4NIBY5.js.map
@@ -1,3 +0,0 @@
1
- import{a as f,b as h,e as m,g as x,i as N}from"./chunk-DS6QEB3G.js";import{c as y}from"./chunk-A536TEU4.js";import{f as g}from"./chunk-7S5E7KWT.js";import{extname as S}from"path";var R={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb"};function p(e){return R[S(e).toLowerCase()]??null}function k(e){return S(e).toLowerCase()===".vue"}import{extname as B}from"path";import{parse as $}from"@vue/compiler-sfc";function v(e){let t=$(e),n=t.descriptor.scriptSetup??t.descriptor.script;if(!n||n.src)return null;let s=x(n.lang??null);return s?{body:n.content,startLine:Math.max(0,n.loc.start.line-1),language:s}:null}var b=g("ast-trees",{clearGroups:["whole-project","source-file"]});function _(e,t){if(k(t))return E(e,t);let n=p(t);if(!n)return null;let s=f(e,t);return s?b.get(e,t,s,()=>m(n,s)):null}function E(e,t){let n=f(e,t);return n?b.get(e,t,n,()=>{let s=v(n);if(!s)return null;let r=`
2
- `.repeat(s.startLine)+s.body;return m(s.language,r)}):null}var O=[".tsx",".jsx"],C=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),J=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),P=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),D=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),V=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),q=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),I=new Set(["children","className","false","key","null","style","true","undefined"]),Z=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]);function Le(e,t={}){let n=y(e,{extensions:O}).filter(r=>!t.scope||r.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(r=>z(e,r)).filter(r=>(t.minJsxTokens===void 0||r.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||r.behaviorTokens.size>=t.minBehaviorTokens))}function z(e,t){let n=t.replace(/\\/g,"/"),s=H(n);if(!s)return[];let r=_(e,n);if(!r)return[];let o=h(e,n).length;return M(r.rootNode,s).filter(a=>a.kind==="hook"||A(a.bodyNode)).map(a=>{let l=Q(a.bodyNode),u=ne(a.bodyNode,s);return{file:n,name:a.name,kind:a.kind,startLine:a.node.startPosition.row,endLine:a.node.endPosition.row,loc:Math.max(1,a.node.endPosition.row-a.node.startPosition.row+1),fileLines:o,jsxTokens:l.tokens,behaviorTokens:u.tokens,componentNames:c(l.componentNames),nativeTags:c(l.nativeTags),propNames:c(l.propNames),eventNames:c(l.eventNames),hookNames:c(u.hookNames),requestNames:c(u.requestNames),stateNames:c(u.stateNames),effectNames:c(u.effectNames),handlerNames:c(u.handlerNames)}})}function H(e){let t=B(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:p(e)}function M(e,t){let n=[],s=new Set,r=o=>{let i=K(o);if(i&&!U(o)){let a=`${i.name}:${i.node.startIndex}:${i.node.endIndex}`;s.has(a)||(s.add(a),n.push(i));return}for(let a of o.namedChildren)r(a)};return(t==="tsx"||t==="javascript")&&r(e),n}function K(e){if(e.type==="function_declaration"){let o=j(e);return!o||!L(o)?null:{name:o,kind:w(o),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),s=d(t);if(!s||!n||!L(s))return null;let r=W(n);return r?{name:s,kind:w(s),node:e,bodyNode:r}:null}function L(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function w(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function W(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=G(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(r=>r.type==="arguments")?.namedChildren.find(r=>r.type==="arrow_function"||r.type==="function_expression")??null}function U(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function j(e){return d(e.childForFieldName("name")??e.namedChild(0))}function G(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function A(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(A)}function Q(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=s=>{s.type==="jsx_opening_element"||s.type==="jsx_self_closing_element"?X(s,t):s.type==="jsx_expression"?Y(s,t):s.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let r of s.namedChildren)n(r)};return n(e),t}function X(e,t){let n=ee(e),s=!1;if(n){let r=T(n);s=ie(r),s?(t.componentNames.add(r),t.tokens.add(`component:${r}`)):(t.nativeTags.add(r),t.tokens.add(`native:${r}`))}for(let r of e.namedChildren)if(r.type==="jsx_attribute"){let o=te(r);if(!o)continue;let i=T(o);if(i.startsWith("on")&&i.length>2){let a=i.slice(2).replace(/^[A-Z]/,l=>l.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else Z.has(i)||(t.propNames.add(i),t.tokens.add(`${s?"prop":"native-prop"}:${i}`))}else r.type==="jsx_spread_attribute"&&t.tokens.add("prop:spread")}function Y(e,t){let n=e.text;(n.includes("&&")||n.includes("?"))&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let s of ce(n))I.has(s)||t.tokens.add(`binding:${s}`)}function ee(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function te(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function ne(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},s=r=>{if(r.type==="call_expression"){let o=N(r,t);o&&se(o.calleeLeaf,n)}else if(r.type==="variable_declarator")oe(r,n);else if(r.type==="function_declaration"){let o=j(r);o&&F(o,n)}for(let o of r.namedChildren)s(o)};return s(e),n}function se(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!C.has(e)&&!D.has(e)&&t.tokens.add(`hook:${e}`)),C.has(e)&&t.tokens.add(`react-hook:${e}`),J.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),P.has(e)&&t.tokens.add(`state-hook:${e}`),re(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function re(e){if(V.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function oe(e,t){let n=e.childForFieldName("name")??e.namedChild(0),s=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&s?.text.includes("useState")){let o=n.namedChildren.find(a=>d(a)),i=d(o);i&&(t.stateNames.add(i),t.tokens.add(`state:${i}`))}let r=d(n);r&&F(r,t)}function F(e,t){let n=ae(e);!n||!q.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function ae(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function ie(e){return/^[A-Z]/.test(e)||e.includes(".")}function T(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function d(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function ce(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let s=n[0];t.includes(s)||t.push(s)}return t}function c(e){return[...e].sort()}export{p as a,k as b,v as c,_ as d,Le as e};
3
- //# sourceMappingURL=chunk-5MHQI4RR.js.map
@@ -1,4 +0,0 @@
1
- import{a as re}from"./chunk-YOCYR7KJ.js";import{a as oe}from"./chunk-BZ2RRK7Y.js";import{a as S}from"./chunk-B32FX5KB.js";import{a as ne}from"./chunk-QVS4SYAX.js";import{a as te}from"./chunk-EOUTP32Q.js";import{a as ie}from"./chunk-C2QSK7E7.js";import{a as X,b as ee}from"./chunk-FKYPOK7P.js";import{a as Z}from"./chunk-UJEVABIR.js";import{a as Q}from"./chunk-XYI7XRZC.js";import{a as J}from"./chunk-YNLK3G63.js";import{a as _,c as z,d as O,h as E,i as L}from"./chunk-FPYQA7JK.js";import{a as U,b as v,e as V}from"./chunk-P3K7LX7M.js";import{a as Y}from"./chunk-IA7Q6HVP.js";import{b as W}from"./chunk-CMXD5VC4.js";import{a as j,c as M,d as P,e as H}from"./chunk-MHATKJ3J.js";import{g as I}from"./chunk-KRGBLZT2.js";import{a as q}from"./chunk-27FU2KX7.js";import{a as N}from"./chunk-LONIY5FF.js";import{f as T,g as F}from"./chunk-MJXJ56LG.js";import{d as R,e as K}from"./chunk-JM72FNGA.js";import{createHash as Ie}from"crypto";import{existsSync as ue}from"fs";function se(e){let[i,t]=x(e,":"),n=i||"unknown",o=(s={})=>{let r=s.actionTier??ge(n);return{sourceAnalyzer:n,actionTier:r,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${n} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??me(r,n),file:s.file}};if(!t)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(n)){let[s,r]=x(t,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:r?`${s}:${r}`:t,label:`${n} finding`,why:r?[`Baseline subject: ${r}.`]:[]})}if(n==="cycle"){let s=t.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(n==="similar"){let s=t.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(n==="drift"){let[s,r]=x(t,":"),[l,a]=x(r,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,a].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function ge(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function me(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function x(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as pe,readFileSync as ae}from"fs";var w={classifyCitation:ye,citationContexts:be,citationKindLabel:Se,citationRemediation:$e,referenceTargets:De};function ye(e){let i=e.join(`
2
- `).toLowerCase(),t=[],n=v(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(n.length>0)return t.push(`configuration/example terms near citation: ${n.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:t};let o=v(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return t.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:t};let s=v(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(t.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:t}):(t.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:t})}function be(e,i,t){let n;try{n=ae(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=t.flatMap(Ce),s=[];for(let r=0;r<n.length;r+=1){let l=n[r]??"";o.some(a=>l.includes(a))&&s.push(U(n,r))}return s}function Ce(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((t,n,o)=>t.length>0&&o.indexOf(t)===n)}function Se(e){switch(e){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 $e(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function De(e,i,t){let n=_(t),o=new Set;for(let s of i)we(e,s,n.get(s)??[])&&o.add(s);return o}function we(e,i,t){if(t.length===0)return!1;if(!ke.test(i))return!0;let n=`${e.config.projectRoot}/${i}`;if(!pe(n))return!0;let o=ae(n,"utf-8").split(/\r?\n/),s=Re(o);for(let r of t)for(let l=r.startLine;l<=r.endLine;l+=1)if((o[l]??"").trim()!==""&&!s.has(l))return!0;return!1}var ke=/\.(?:[cm]?[jt]sx?)$/i;function Re(e){let i=new Set,t=!1;for(let n=0;n<e.length;n+=1){let o=e[n].trim();!t&&Te(o)&&(t=!0),t&&(i.add(n),o.endsWith(";")&&(t=!1))}return i}function Te(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}import{existsSync as Fe,readFileSync as ve,writeFileSync as xe}from"fs";import{isAbsolute as Ae,join as Ge}from"path";var je=75e3,Ee=5e3,Le=2500;function Be(e){let i=ie(e);return i.symbols>=je||i.documents>=Ee?Le:void 0}var Ke=".scipquery-baseline.json";function A(e,i){return i&&Ae(i)?i:Ge(e.config.projectRoot,i??Ke)}function ce(e,i={}){let{scope:t}=i,n=Be(e),o=[],s=W(e,{scope:t,...S.dead,scanLimit:n});for(let r of s.symbols)T(e,r.relativePath)||F(e,r.symbol,r.relativePath)||r.kind==="dead-code"&&o.push(`dead:${r.relativePath}:${r.shortName}`);for(let r of Z(e,{scope:t,...S.isolated,scanLimit:n}))T(e,r.relativePath)||F(e,r.symbol,r.relativePath)||o.push(`isolated:${r.relativePath}:${r.shortName}`);for(let r of q(e,{scope:t}))r.kind==="real"&&o.push(`cycle:${Ne(r.path)}`);for(let r of ee(e,{scope:t,...S.similar,scanLimit:n}))o.push(`similar:${[r.symbolA,r.symbolB].sort().join("|")}`);for(let r of J(e,{scope:t,...S.extract,scanLimit:n}))o.push(`extract:${r.relativePath}:${r.shortName}`);for(let r of ne(e,{scope:t,...S.wrappers,scanLimit:n}))o.push(`wrapper:${r.file}:${r.shortName}`);for(let r of Q(e,{scope:t,...S.passthroughs,scanLimit:n}))o.push(`passthrough:${r.file}:${r.shortName}`);for(let r of te(e,{scope:t,...S.stale,scanLimit:n}))o.push(`stale:${r.file}:${r.shortName}`);for(let r of Y(e,{scope:t,...S.drift}).results)r.kind!=="pattern-deviation"&&o.push(`drift:${r.kind}:${r.file}:${r.dep}`);return[...new Set(o)].sort()}function Ne(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function Et(e,i={}){let t=ce(e,{scope:i.scope}),n=A(e,i.path);return xe(n,JSON.stringify({version:1,findings:t},null,2)+`
3
- `),{path:n,findingCount:t.length}}function le(e,i={}){let t=A(e,i.path);if(!Fe(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let n=JSON.parse(ve(t,"utf-8")),o=new Set(n.findings??[]),s=ce(e,{scope:i.scope}),r=new Set(s);return{baselinePath:t,baselineCount:o.size,current:s,newFindings:s.filter(l=>!o.has(l)),fixedFindings:[...o].filter(l=>!r.has(l))}}var Jt=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function Zt(e,i={}){let t=i.base??"HEAD",{minTogether:n=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:r=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:a=!1,scanLimit:c}=i,y=i.semantic!==!1,u=new Set(i.skip??[]),f=O(e,{base:t}),p=z(e,{base:t,plan:f}),g=p.changedFiles,d=new Set(g),h=new Set(f.changedFileLines),b=E(e.config.projectRoot,t,L(f,g)),C=lt(e.config.projectRoot,t,f,b),m={base:t,changedFiles:g,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:p.summary.note};if(g.length===0)return m;let $=(B,he)=>{if(u.has(B)){m.skipped.push({check:B,reason:"skipped via --skip"});return}he()};return $("echo",()=>Oe(e,p.changedSymbols,d,C,s,l,c,y,m)),$("incomplete-migration",()=>Xe(e,t,f,r,c,y,b,m)),$("co-change-partner",()=>et(e,d,n,o,m)),$("doc-reference",()=>rt(e,d,h,f.changedRanges,m)),$("unused-params",()=>st(e,g,m)),$("new-dead",()=>at(e,p.changedSymbols,C,m)),a&&$("baseline",()=>ut(e,m)),_e(m,e.config.suppressions??[]),m.rootCauseGroups=Me(m.findings),m}function Me(e){let i=new Map;for(let t of e){let n=t.groupKey??`${t.check}:${t.id}`,o=i.get(n);o||(o={groupKey:n,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(n,o)),o.count+=1,o.findingIds.push(t.id),o.severity=Pe(o.severity,t.severity),o.actionTier=He(o.actionTier,t.actionTier),t.file&&o.files.add(t.file);for(let s of t.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,n)=>n.count-t.count||G(n.severity)-G(t.severity)||t.groupKey.localeCompare(n.groupKey))}function Pe(e,i){return G(i)>G(e)?i:e}function G(e){return e==="error"?2:e==="warning"?1:0}function He(e,i){return e?i&&fe(i)>fe(e)?i:e:i}function fe(e){return e==="direct"?2:e==="signal"?1:0}function _e(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let n of e.findings){let o=i.find(s=>ze(s,n));o?e.suppressed.push({finding:n,suppression:o}):t.push(n)}e.findings=t}function ze(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function k(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Oe(e,i,t,n,o,s,r,l,a){a.checksRun.push("echo");for(let c of i.slice(0,o)){if(n(c))continue;let y=X(e,c.symbol,{minSimilarity:s,limit:5,scanLimit:r,semantic:l}),u=[];for(let d of y){let h=d.fileA===c.file?d.fileB:d.fileA,b=d.fileA===c.file?d.shortNameB:d.shortNameA,C=d.fileA===c.file?d.symbolB:d.symbolA;t.has(h)||u.push({otherFile:h,otherShort:b,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(u.length===0)continue;let f=u[0],p=D("echo",c.symbol,c.file,...u.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),g=Ue(c,u);k(a,{id:p,groupKey:p,actionTier:g,check:"echo",severity:"warning",evidence:"heuristic",confidence:f.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(u.map(d=>d.otherFile))].sort(),message:Je(c,u),why:Ze(c,u),remediation:Qe(g,c.shortName,f.otherShort)})}i.length>o&&a.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function Ue(e,i){return i.some(n=>Ve(e.symbol,n))?"direct":"signal"}function Ve(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=R(e),n=R(i.otherSymbol);return!t||!n?!1:t===n?!0:Ye(i.sharedEvidence)?!1:qe(t,n)}function qe(e,i){let t=de(e),n=de(i);if(t.length===0||n.length===0)return!1;let o=new Set(n),s=t.filter(r=>o.has(r)).length;return s>=2&&s/Math.min(t.length,n.length)>=.5}function de(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var We=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function Ye(e){return e.length>=3&&e.every(i=>We.has(i.toLowerCase()))}function Je(e,i){let t=i[0],n=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${n}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${n}% similar to ${t.otherShort} (${t.otherFile})`}function Ze(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let n of i.slice(0,3))t.push(`${n.otherShort} is outside this diff and scored ${Math.round(n.similarity*100)}% similar by ${n.similarityBasis} evidence.`),t.push(`Shared evidence: ${n.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function Qe(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function Xe(e,i,t,n,o,s,r,l){let a=oe(e,{base:i,maxHelpers:n,diffPlan:t,scanLimit:o,semantic:s,baseContentAt:r});if(!a.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),a.note&&l.skipped.push({check:"incomplete-migration",reason:a.note});for(let c of a.findings){let y=c.leftovers.map(h=>`${h.shortName} (${h.file}, ${Math.round(h.containment*100)}% helper / ${Math.round(h.siteCoverage*100)}% site, ${h.migrationScope})`).join(", "),u=c.leftovers.map(h=>`${h.shortName}: ${h.migrationScope} (${h.migrationScopeReasons[0]})`).join("; "),f=[...c.migratedFiles,...c.leftovers.map(h=>h.file)],p=c.leftovers.length===0?void 0:Math.max(...c.leftovers.map(h=>Math.min(h.containment,h.siteCoverage))),g=c.leftovers.some(h=>h.migrationScope==="possible-subtype"),d=D("incomplete-migration",c.helperSymbol,c.helperFile,f.join("|"));k(l,{id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:c.helperFile,symbol:c.helperSymbol,relatedFiles:f,message:`new helper ${c.helperShortName} (${c.helperFile}) is wired into ${c.migratedFiles.length} file(s), but ${c.leftovers.length} similar un-migrated site(s) remain: ${y}`,why:[`${c.helperShortName} is new in this diff and already referenced by ${c.migratedFiles.join(", ")}.`,`Helper shape: ${c.helperShape}; ${c.specificHelperCalleeCount}/${c.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${y}.`,`Migration scope hints: ${u}.`],remediation:g?`Migrate same-scope sites to ${c.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${c.helperShortName}, or confirm they are intentionally different.`})}}function et(e,i,t,n,o){let s=I(e,i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let r=new Set,l;for(let a of s){let c=i.has(a.fileA),y=i.has(a.fileB);if(c===y)continue;let u=c?a.fileA:a.fileB,f=c?a.fileB:a.fileA,p=c?a.changesA:a.changesB,g=p>0?a.together/p:0;if(g<n||j(f)||j(u)||!ue(`${e.config.projectRoot}/${f}`))continue;let d=`${u}|${f}`;if(r.has(d))continue;r.add(d);let h=D("co-change-partner",u,f,String(a.together)),b=M(u,f),C=P({fileA:u,fileB:f,together:a.together,confidence:g,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(l??=H(e))(u,f)),m=[u,f].sort().join("|");o.findings.push({id:h,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${m}`,confidence:g,file:u,relatedFiles:[f],sourceAnalyzer:"co-change",rootCauseKey:m,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${f} did not \u2014 they change together ${a.together}x (${Math.round(g*100)}% of the time)`,why:[`${u} is in this diff and ${f} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(g*100)}% of changes to the edited side.`,`History context: ${tt(a)}.`,`Subject context: ${it(a.subjectContext)}.`,...nt(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:C?`Update ${f} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${f} alongside this change, or confirm the coupling no longer holds.`})}}function tt(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${ot(e.lastTogetherAt)}`}function it(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",n=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${n}; external issue/PR labels ${e.externalIssueLabelStatus}`}function nt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function ot(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function rt(e,i,t,n,o){o.checksRun.push("doc-reference");let s=w.referenceTargets(e,i,n);if(s.size!==0)for(let r of V(e,s)){if(t.has(r.doc))continue;let l=r.citedClaims.length>0?r.citedClaims:w.citationContexts(e,r.doc,r.cited),a=w.classifyCitation(l),c=D("doc-reference",r.doc,r.cited.join("|"));k(o,{id:c,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:r.doc,relatedFiles:r.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:l,message:`${r.doc} cites ${r.cited.join(", ")} as ${w.citationKindLabel(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${r.cited.join(", ")} changed in this diff.`,`${r.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(y=>`Citation kind evidence: ${y}`)],remediation:w.citationRemediation(a.citationKind,r.doc)})}}function st(e,i,t){t.checksRun.push("unused-params");for(let n of re(e,{files:i,limit:50})){let o=D("unused-params",n.symbol,n.file,n.unusedTrailing.join("|"));k(t,{id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:n.file,startLine:n.startLine,endLine:n.endLine,symbol:n.symbol,message:`${n.shortName} (${n.file}) has trailing unused parameter(s): ${n.unusedTrailing.join(", ")}`,why:[`${n.shortName} is in a changed file.`,`The trailing parameter(s) ${n.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function at(e,i,t,n){n.checksRun.push("new-dead");let o=new N(e);for(let s of i){if(t(s)||s.fanIn>0||o.fileKind(s.file)==="test"||T(e,s.file)||F(e,s.symbol,s.file)||ct(s.symbol))continue;let r=D("new-dead",s.symbol,s.file);k(n,{id:r,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.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:"Wire it up, or remove it before it becomes permanent dead code."})}}function ct(e){if(K(e)!=="type")return!1;let i=R(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function lt(e,i,t,n){let o=new Map(t.renamedFiles.map(r=>[r.to,r.from])),s=n??E(e,i,L(t));return r=>{let l=o.get(r.file)??r.file,a=R(r.symbol);if(!a)return!1;let c=s(l);return c!==null&&ft(c,a)}}function ft(e,i){return new RegExp(`\\b${dt(i)}\\b`).test(e)}function dt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ut(e,i){if(!ue(A(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=le(e);for(let n of t.newFindings){let o=se(n),s=D("baseline",n);k(i,{id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${n}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation})}}function D(e,...i){return`SQ${Ie("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{ce as a,Et as b,le as c,Jt as d,Zt as e,lt as f};
4
- //# sourceMappingURL=chunk-7AOMEMOA.js.map
@@ -1,8 +0,0 @@
1
- import{d as D,e as A,g as H}from"./chunk-FKYPOK7P.js";import{d as L}from"./chunk-HDBQHJNY.js";import{b as w,d as _,h as T,i as E}from"./chunk-FPYQA7JK.js";import{a as N}from"./chunk-LONIY5FF.js";import{c as b,d as F}from"./chunk-JM72FNGA.js";var V=5;function re(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??_(e,{base:a}),l={available:s.note!==w,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new N(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),z=t.baseContentAt??T(e.config.projectRoot,a,E(s)),h=X(x,k,$,z);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let j=D(e,{minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M=A(j),q=x.calleeMap(R,{semantic:f}),B=R.map(i=>({def:i,callees:H((q.get(i.symbolId)??[]).map(p=>p.symbol))}));for(let{def:i,callees:p}of B){let d=b(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=W(p,M);if(P===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let C=Y(e,i.symbolId);if(C.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=G({candidateIndex:M,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:C});I.length!==0&&(I.sort((u,S)=>O(S.migrationScope)-O(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:P,migratedFiles:C.sort(),leftovers:I.slice(0,V)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function G(e){let t=[],a=J(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=L(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=K(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:b(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(b).sort()})}return t}function O(e){return e==="same-scope"?2:e==="unknown"?1:0}function J(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function K(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var U=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!U.has(t))}function W(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function X(e,t,a,o){return e.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${Z(r.leaf)}\\b`).test(c)})}function Y(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
2
- FROM mentions m
3
- JOIN chunks c ON m.chunk_id = c.id
4
- JOIN documents ref_d ON c.document_id = ref_d.id
5
- WHERE m.symbol_id = ?
6
- AND m.role != 1
7
- ${e.pathExclusionsFor("ref_d")}`,t).map(o=>o.relative_path)}function Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{re as a};
8
- //# sourceMappingURL=chunk-BZ2RRK7Y.js.map
@@ -1,32 +0,0 @@
1
- import{c as d}from"./chunk-7S5E7KWT.js";import{createHash as h}from"crypto";import{readFileSync as T}from"fs";import{createRequire as m}from"module";import{dirname as E,join as g}from"path";import v from"better-sqlite3";var N=m(import.meta.url),S="evidence.db",p=new WeakMap,y=d("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),_=d("evidence-project-fingerprint",{clearGroups:["whole-project"]});function L(){for(let n of["../package.json","../../package.json"])try{return N(n).version}catch{}return"0.0.0"}var s=L();function f(n){return h("sha256").update(n).digest("hex")}function w(n,t,e){return y.get(n,t,()=>f(e))}function F(n){return _.get(n,"current",()=>{try{let t=JSON.parse(T(g(E(n.config.dbPath),"meta.json"),"utf-8"));if(t.version!==2&&t.version!==3||t.status!=="complete"||t.fingerprint===void 0)return null;let e=Array.isArray(t.indexedLanguages)?[...t.indexedLanguages].sort():[];return f(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:e}))}catch(t){return u("project fingerprint unavailable",t),null}})}function u(n,t){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${n}: ${t instanceof Error?t.message:String(t)}`)}function c(n){if(p.has(n))return p.get(n)??null;let t=null;try{let e=new v(g(E(n.config.dbPath),S));e.pragma("journal_mode = WAL"),e.pragma("busy_timeout = 5000"),e.pragma("synchronous = NORMAL"),e.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 semantic_callees (
11
- relative_path TEXT NOT NULL,
12
- symbol TEXT NOT NULL,
13
- content_hash TEXT NOT NULL,
14
- deps_digest TEXT NOT NULL,
15
- version TEXT NOT NULL,
16
- payload TEXT NOT NULL,
17
- PRIMARY KEY (relative_path, symbol)
18
- );
19
- CREATE TABLE IF NOT EXISTS semantic_references (
20
- relative_path TEXT NOT NULL,
21
- symbol TEXT NOT NULL,
22
- project_fingerprint TEXT NOT NULL,
23
- version TEXT NOT NULL,
24
- payload TEXT NOT NULL,
25
- PRIMARY KEY (relative_path, symbol)
26
- );
27
- `),t={evidence:e,readFileEvidence:e.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:e.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:e.prepare(`SELECT payload FROM semantic_callees
28
- WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),writeCallees:e.prepare(`INSERT OR REPLACE INTO semantic_callees
29
- (relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:e.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:e.prepare(`SELECT payload FROM semantic_references
30
- WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),writeReferences:e.prepare(`INSERT OR REPLACE INTO semantic_references
31
- (relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:e.prepare("DELETE FROM semantic_references WHERE project_fingerprint != ?")}}catch(e){u("disabled (open failed)",e)}return p.set(n,t),t}function o(n,t,e){u(`disabled (${t})`,e),p.set(n,null)}function x(n,t,e,a){let r=c(n);if(!r)return null;try{return r.readFileEvidence.get(t,e,a,s)?.payload??null}catch(i){return o(n,"file_evidence read",i),null}}function I(n,t,e,a,r){let i=c(n);if(i)try{i.writeFileEvidence.run(t,e,a,s,r)}catch(l){o(n,"file_evidence write",l)}}function U(n,t,e,a,r){let i=c(n);if(!i)return null;try{return i.readCallees.get(t,e,a,r,s)?.payload??null}catch(l){return o(n,"semantic_callees read",l),null}}function j(n,t,e,a){let r=c(n);if(!r)return null;try{return r.readReferences.get(t,e,a,s)?.payload??null}catch(i){return o(n,"semantic_references read",i),null}}function X(n,t){if(t.length===0)return;let e=c(n);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let r of t){let i=`${r.relativePath}\0${r.contentHash}`;a.has(i)||(a.add(i),e.dropStaleCallees.run(r.relativePath,r.contentHash)),e.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,s,r.payload)}})()}catch(a){o(n,"semantic_callees write",a)}}function P(n,t){if(t.length===0)return;let e=c(n);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let r of t)a.has(r.projectFingerprint)||(a.add(r.projectFingerprint),e.dropStaleReferences.run(r.projectFingerprint)),e.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,s,r.payload)})()}catch(a){o(n,"semantic_references write",a)}}export{f as a,w as b,F as c,x as d,I as e,U as f,j as g,X as h,P as i};
32
- //# sourceMappingURL=chunk-C6ROZBJA.js.map
@@ -1,2 +0,0 @@
1
- import{b as Z}from"./chunk-B75HZHUP.js";import{a as v}from"./chunk-LONIY5FF.js";import{b as B,e as W,f as U,g as H}from"./chunk-MJXJ56LG.js";import{a as J}from"./chunk-MFWAZFYD.js";import{c as V,d as q,f as E,k as G}from"./chunk-W2TIXAGN.js";import{e as z}from"./chunk-U73YFD3P.js";import{b as F}from"./chunk-G2CGUNQU.js";import{f as K,m as x}from"./chunk-TJXOD4IK.js";import{c as k,f as T,g as M,h as A,i as O,j}from"./chunk-JM72FNGA.js";import{a as N,d as _}from"./chunk-5MHQI4RR.js";import{a as P}from"./chunk-DS6QEB3G.js";import{a as g}from"./chunk-64MNV6AB.js";import{b as S}from"./chunk-7S5E7KWT.js";var h=new WeakMap;function $(e,t){let n=N(t);return n==="rust"?Re(e,t):n==="typescript"||n==="tsx"||n==="javascript"?ye(e,t):[]}var me=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),pe=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,be=/\buse[A-Z][A-Za-z0-9_$]*/;function ye(e,t){let n=P(e,t);if(!n||!ge(n))return[];let r=_(e,t);if(!r)return[];let o=h.get(r);if(o)return o;let i=!1,s=r.rootNode;for(let c of s.namedChildren){if(c.type!=="expression_statement")continue;let l=c.namedChild(0);if(!l||l.type!=="call_expression")continue;let a=l.namedChild(0);if(!a)continue;let d=a.type==="member_expression"?a.namedChild(a.namedChildCount-1)?.text:a.text;if(d&&me.has(d)){i=!0;break}}let u=[];i&&u.push({startLine:0,endLine:s.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"});for(let c of s.namedChildren){let l=null,a=null;if(c.type==="function_declaration")l=c.namedChild(0)?.text??null,a=c;else if(c.type==="export_statement"){let d=c.namedChild(0);d?.type==="function_declaration"&&(l=d.namedChild(0)?.text??null,a=d)}else if(c.type==="lexical_declaration"){let d=c.namedChild(0);if(d?.type==="variable_declarator"){let m=d.namedChild(0)?.text,b=d.namedChild(1);m&&(b?.type==="arrow_function"||b?.type==="function_expression")&&(l=m,a=d)}}l&&/^use[A-Z]/.test(l)&&a&&u.push({startLine:a.startPosition.row,endLine:a.endPosition.row,reason:"React custom hook (use*)"})}return u.push(...Q(r,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),h.set(r,u),u}function ge(e){return e.includes("scip-query")||pe.test(e)||be.test(e)}var he=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function xe(e){return he.test(e)}function Q(e,t,n){let r=[],o=i=>{if(t.has(i.type)&&i.parent){let u=i.parent.children,c=-1;for(let l=0;l<u.length;l+=1)if(u[l].startIndex===i.startIndex&&u[l].type===i.type){c=l;break}if(c>0)for(let l=c-1;l>=0;l-=1){let a=u[l];if(n.has(a.type)){if(xe(a.text)){r.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of i.namedChildren)o(s)};return o(e.rootNode),r}function Re(e,t){let n=_(e,t);if(!n)return[];let r=h.get(n);if(r)return r;let o=[],i=Se(n);return i?(h.set(n,i),i):(Y(n.rootNode,o,!1,!1),o.push(...Q(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"]))),o.push(...Ie(n.rootNode)),h.set(n,o),o)}function Se(e){return Pe(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function Y(e,t,n,r){let o=n,i=r;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(i=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?_e(e,t,n,r):r&&we(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?Ee(e,t,n):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(o=!0);for(let s of e.namedChildren)Y(s,t,o,i)}function _e(e,t,n,r){let o=C(e),i=null;r?i="trait impl method (dynamic dispatch)":n&&(i="inside #[cfg(test)] mod");for(let s of o){let u=Ce(s);if(u){i=u;break}if(ee(s)){i="#[allow(dead_code)]";break}}i&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:i})}function Ee(e,t,n){let r=C(e),o=e.namedChildren.find(i=>i.type==="type_identifier")?.text;r.some(Le)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:o}),r.some(ee)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:o}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:o})}function C(e){let t=e.parent;if(!t)return[];let n=t.children,r=-1;for(let i=0;i<n.length;i+=1)if(n[i].startIndex===e.startIndex&&n[i].type===e.type){r=i;break}if(r<=0)return[];let o=[];for(let i=r-1;i>=0;i-=1){let s=n[i];if(s.type==="attribute_item"||s.type==="inner_attribute_item")o.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return o}var ve=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function Ce(e){return ve.find(({re:t})=>t.test(e))?.reason??null}var De=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Le(e){return/#\[\s*derive\s*\(/.test(e)?De.some(t=>t.test(e)):!1}function ee(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function we(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ie(e){let t=Fe(e);if(t.size===0)return[];let n=[];for(let r of e.descendantsOfType("mod_item")){let o=r.childForFieldName("name")?.text;o&&t.has(o)&&n.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:o})}return n}function Pe(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 Ne=/^#!?\[\s*serde\s*\(/,X=/\bwith\s*=\s*"([^"]+)"/g;function Fe(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){if(!Ne.test(n.text))continue;X.lastIndex=0;let r;for(;(r=X.exec(n.text))!==null;){let o=r[1],i=o.split("::").pop()??o;i&&t.add(i)}}return t}function te(e){let t=new Map,n=r=>{let o=t.get(r);if(o)return o;let i=$(e,r);return o={ranges:i.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(i.map(s=>s.containerName).filter(s=>!!s))},t.set(r,o),o};return(r,o,i,s)=>{let u=n(r);for(let c of u.ranges)if(o>=c.startLine&&o<=c.endLine)return!0;if(s&&u.containers.has(s))return!0;for(let c of x(i))if(u.containers.has(c))return!0;return!1}}function et(e,t={}){S(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,t,n={}){S(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function re(e,t){return t.isIgnoredPath(e.relativePath)?p("ignored-file"):A(e.symbol)?p("module-like-symbol"):ne(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&ne(e.enclosingSymbol)?p("nested-non-callable-value"):!t.includeTests&&!L(e.relativePath)?p("test-file"):!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?p("excluded-file-region"):O(e.symbol)?p("rust-trait-impl-member"):j(e.symbol)?p("rust-test-module"):!t.includeMembers&&!ke(e)?p("member"):e.endLine-e.startLine+1<t.minLoc?p("below-min-loc"):{accepted:!0}:p("non-value-symbol")}function L(e){return B(e)!=="test"}function p(e){return{accepted:!1,rejectionReason:e}}function ne(e){return M(e)||e.endsWith("().")||e.endsWith(".")}function ke(e){return T(e.symbol)||x(e.symbol).length===0}function oe(){return new Map}function ie(e,t,n){let r=new Map;for(let o of V(e,n))e.isIgnored(o.relative_path)||t.has(o.relative_path)||R(r,o.symbol_id,o.relative_path,o.ref_count,"scip-mention");return r}function se(e,t,n){let r=new Set;for(let o of q(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||r.add(o.symbol_id);return r}function w(e,t){let n=e.get(t);if(!n)return!1;for(let r of n.values())if(r.occurrences>0)return!0;return!1}function I(e,t,n){let r=e.get(t);if(!r)return!1;for(let[o,i]of r)if(o!==n&&i.occurrences>0)return!0;return!1}function ae(e){return e?.occurrences??0}function R(e,t,n,r,o="source-fallback"){if(r<=0)return;let i=le(e,t,n);i.occurrences+=r,i.sources.add(o)}function ce(e,t,n,r,o){if(r<=0)return;let i=le(e,t,n);i.occurrences=Math.max(r,i.occurrences),i.sources.add(o)}function le(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let o=r.get(n);return o||(o={occurrences:0,sources:new Set},r.set(n,o)),o}var Te=3e3,Me=1e3;function Et(e,t={}){let{scope:n,minLoc:r=1,includeTests:o=!1,skipBarrels:i=!1,includeMembers:s=!1,deadCodeOnly:u=!1,scanLimit:c,semantic:l=!0}=t,a=Z(Ae(e,{scope:n,minLoc:r,includeTests:o,includeMembers:s}),c),d=i?new Set(W(e)):new Set,m=u?oe():ie(e,d,a.map(f=>f.symbolId)),b=u?se(e,a.map(f=>f.symbolId),d):new Set,y=u?a.filter(f=>!b.has(f.symbolId)):a.filter(f=>!I(m,f.symbolId,f.relativePath));u?Ue(e,y,m,d):We(e,y,m,d);let de=u?y.filter(f=>!w(m,f.symbolId)):y.filter(f=>!I(m,f.symbolId,f.relativePath));ze(e,de,m,{includeTests:o,inactiveBarrelPaths:d,includeSemantic:!u&&l});let fe=u?y.filter(f=>!w(m,f.symbolId)):a;return Be(e,Oe(fe,m))}function Ae(e,t){let n=te(e),r=[];for(let o of g(e,{scope:t.scope}))try{for(let i of K(e,o))re(i,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:u=>e.isIgnored(u),isExcludedRegion:n}).accepted&&r.push(i)}finally{D(e,o,{definitions:!0})}return r}function Oe(e,t){return e.map(n=>je(n,t)).filter(n=>n.cross_file_refs===0).sort((n,r)=>r.loc-n.loc||n.relative_path.localeCompare(r.relative_path)||n.start_line-r.start_line)}function je(e,t){let n=t.get(e.symbolId)??new Map,r=ae(n.get(e.relativePath)),o=0;for(let[i,s]of n)i!==e.relativePath&&(o+=s.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:r,cross_file_refs:o}}function Be(e,t){let n=[],r=0,o=0,i=0;for(let s of t){if(e.isIgnored(s.relative_path)||U(e,s.relative_path)||H(e,s.symbol,s.relative_path))continue;let u=s.same_file_refs===0?"dead-code":"file-internal";u==="dead-code"?r++:o++,i+=s.loc,n.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:k(s.symbol),sameFileRefs:s.same_file_refs,kind:u})}return{symbols:n,counts:{total:n.length,deadCode:r,fileInternal:o,loc:i},totalCount:n.length,deadCodeCount:r,fileInternalCount:o,totalLoc:i}}function We(e,t,n,r){if(t.length===0)return;let o=new v(e),i=new Set(t.map(c=>c.symbolId)),s=new Set(t.map(c=>c.leaf).filter(Boolean)),u=new Set(o.sourceFiles());for(let c of g(e))u.add(c);o.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:c=>r.has(c)},c=>{i.has(c.target.symbolId)&&(Ve(e,c)||R(n,c.target.symbolId,c.sourceFile,qe(c),"source-fallback"))})}function Ue(e,t,n,r){if(t.length===0)return;let o=new v(e),i=He(t),s=new Set(o.sourceFiles());for(let a of g(e))s.add(a);let u=new Set(i.keys()),c=new Map,l=a=>{let d=c.get(a);return d||(d=G(e,a),c.set(a,d)),d};o.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:a=>r.has(a),resolveTargets:({sourceFile:a,name:d,kind:m})=>{let b=i.get(d);return b?Ke(a,d,b,l(a),{permissive:m!=="cross-language-dispatch"}):[]},afterPath:a=>{c.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ue(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(n,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function He(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let r=t.get(n.leaf)??[];r.push(n),t.set(n.leaf,r)}return t}function Ke(e,t,n,r,o){let i=n.filter(c=>c.relativePath===e);if(i.length>0)return i;if(!o.permissive&&n.length===1)return[...n];let s=r.get(t);if(s)for(let c of s){let l=n.filter(a=>E(c,a.relativePath));if(l.length>0)return l}let u=new Set;for(let c of r.values())for(let l of c)u.add(l);for(let c of u){let l=n.filter(a=>E(c,a.relativePath));if(l.length>0&&l.length===n.length)return l}return o.permissive?[...n]:[]}function Ve(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&ue(e,t)}function qe(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ue(e,t){return t.occurrences>1?!1:F(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function ze(e,t,n,r){let o=r.includeSemantic!==!1,i=o&&t.length>=Te&&g(e).length>=Me,s=(c,l)=>{l===c.relativePath||e.isIgnored(l)||r.inactiveBarrelPaths.has(l)||!r.includeTests&&!L(l)||ce(n,c.symbolId,l,1,"caller-map")};for(let c of t){let l=J(e,c,{semantic:o&&!i});if(l.length!==0)for(let a of l)s(c,a.file)}if(!i)return;let u=z(e,t);for(let c of t){let l=u.get(c.symbolId);if(l)for(let a of l)s(c,a)}}export{et as a,Et as b};
2
- //# sourceMappingURL=chunk-CMXD5VC4.js.map
@@ -1,2 +0,0 @@
1
- import{c as o,d as a}from"./chunk-FXWV2V7K.js";import{a as p}from"./chunk-PVZMPG5I.js";import{a as c,b as m,c as f}from"./chunk-HDBQHJNY.js";import{c as u}from"./chunk-YZA6PPZL.js";function D(n,i={}){let{minSimilarity:t=.62,minTokens:e=8,limit:l=20,scope:d,scanLimit:h,filePattern:k}=i,P=g(n,{scope:d,minTokens:e,scanLimit:h});return p({profiles:P,limit:l,filePattern:k,compare:(r,s)=>v(r,s,t),sort:(r,s)=>s.similarity-r.similarity||r.fileA.localeCompare(s.fileA)||r.fileB.localeCompare(s.fileB)})}function g(n,i){return u(n,{scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(t=>({file:t.file,tokens:t.templateTokens,loc:C(t)}))}function C(n){return n.totalLines}function v(n,i,t){let e=c(n.tokens,i.tokens);if(e.size<6||!T(e))return null;let l=f(n.tokens,i.tokens);return l<t?null:{fileA:n.file,fileB:i.file,similarity:l,sharedTokens:a(e),sharedComponents:o(e,"component:"),sharedProps:o(e,"prop:"),sharedEvents:o(e,"event:"),sharedDirectives:o(e,"directive:"),sharedSlots:o(e,"slot:"),sharedIdentifiers:o(e,"id:"),uniqueToA:a(m(n.tokens,i.tokens)).slice(0,25),uniqueToB:a(m(i.tokens,n.tokens)).slice(0,25),locA:n.loc,locB:i.loc}}function T(n){let i=0,t=0;for(let e of n)e.startsWith("component:")&&(i+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("directive:")||e.startsWith("slot:"))&&(t+=1);return i>=1||t>=3}export{D as a};
2
- //# sourceMappingURL=chunk-CQEJU32R.js.map
@@ -1,2 +0,0 @@
1
- import{a as C}from"./chunk-ZUTV7DDX.js";import{a as D}from"./chunk-CQEJU32R.js";import{a as f}from"./chunk-M3YEHOCD.js";import{a as g}from"./chunk-JOGZKF5W.js";import{b as y}from"./chunk-FKYPOK7P.js";import{e as h}from"./chunk-KRGBLZT2.js";import{d as p}from"./chunk-A536TEU4.js";var F=.7,S=.62,R=.45;function $(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=h(i);if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic}).map(r=>I(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(w);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:T(b)}}function A(i,t){let e=K(t.limit),n=[...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??F,limit:e,scanLimit:t.scanLimit,semantic:t.semantic})],a=p(i,{scope:t.scope});return a.react&&n.push(...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit})),a.vue&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit})),n}function B(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function k(i,t){return u(i,t,{query:f,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:P(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:g,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function E(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function x(i,t){return u(i,t,{query:C,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function I(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let l=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function w(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function T(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:N(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function N(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function P(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{$ as a};
2
- //# sourceMappingURL=chunk-DOZ2X6TS.js.map
@@ -1,5 +0,0 @@
1
- import{a as L,b as C,e as q,f as B,g as v,h as z}from"./chunk-HDBQHJNY.js";import{b as M}from"./chunk-B75HZHUP.js";import{a as x}from"./chunk-LONIY5FF.js";import{a as A}from"./chunk-XAYARHNF.js";import{a as I}from"./chunk-733EF5FD.js";import{c as p,d as w,g as R}from"./chunk-JM72FNGA.js";import{b as N}from"./chunk-DS6QEB3G.js";import{d as h}from"./chunk-7S5E7KWT.js";function Te(e,n,i={}){let{minSimilarity:t=.4,limit:s=20}=i,r=J(e,n,{semantic:i.semantic!==!1});if(!r)return[];if(!R(r.symbol))return[];let o=X(e,r,t,{scanLimit:i.scanLimit,semantic:i.semantic!==!1});return o.length>0?o.slice(0,s):ae(e,n,{minSimilarity:t,limit:s})}function X(e,n,i,t){let s=P(e,{minCallees:3,scanLimit:t.scanLimit,semantic:t.semantic}),r=re(n,s),o=q([n,...s.corpus].map(l=>l.callees)),a=v(o),c=[];for(let l of r){if(l.callees.size<3)continue;let m=O(n,l,o,{minSimilarity:i,requireSignificantShared:1,requireSharedCount:0,medianIdf:a});m&&c.push(m)}return c.sort((l,m)=>m.similarity-l.similarity),c}function O(e,n,i,t){let{similarity:s,significantShared:r,trivialShared:o}=z(e.callees,n.callees,i,{medianIdf:t.medianIdf});if(s<t.minSimilarity)return null;let a=r.length+o.length;if(r.length<t.requireSignificantShared&&a<t.requireSharedCount)return null;let c=r.length>0?r:o,l=G(c,"callees");return{symbolA:e.symbol,shortNameA:p(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(p),uniqueToA:[...C(e.callees,n.callees)].map(p),uniqueToB:[...C(n.callees,e.callees)].map(p),...l}}function Ne(e,n={}){let{minSimilarity:i=.5,limit:t=20,scope:s,minCallees:r=4,crossFileOnly:o=!1,scanLimit:a}=n,c=P(e,{minCallees:r,scope:s,scanLimit:a,semantic:n.semantic!==!1}),l=c.corpus,m=[],y=0;for(let d=0;d<l.length;d+=1){let f=l[d],b=new Set;for(let S of f.callees){let u=c.candidateIndexesByCallee.get(S);if(u)for(let g of u)g>d&&b.add(g)}for(let S of b){let u=l[S];if(o&&f.file===u.file)continue;if(f.paramCount>=0&&u.paramCount>=0){let k=Math.abs(f.paramCount-u.paramCount),H=Math.max(2,Math.ceil(Math.max(f.paramCount,u.paramCount)*.5));if(k>H)continue}let g=O(f,u,c.idfWeights,{minSimilarity:i,requireSignificantShared:2,requireSharedCount:4,medianIdf:c.medianIdf});g&&(Q(m,g,t,y),y+=1)}}return m.sort((d,f)=>f.result.similarity-d.result.similarity||d.order-f.order),m.map(d=>d.result)}function Q(e,n,i,t){if(i<=0)return;if(e.length<i){e.push({result:n,order:t});return}let s=0;for(let o=1;o<e.length;o+=1){let a=e[o],c=e[s];(a.result.similarity<c.result.similarity||a.result.similarity===c.result.similarity&&a.order>c.order)&&(s=o)}let r=e[s];n.similarity<=r.result.similarity||(e[s]={result:n,order:t})}var Y=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function J(e,n,i){let t=I(e,n),s=new x(e);if(!t)return null;let r=A(e,t,{semantic:i.semantic});return{symbol:t.symbol,file:t.relativePath,callees:j(r.map(o=>o.symbol)),paramCount:s.callableSignature(t)?.paramCount??-1}}var ee=h("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),ne=h("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function ie(e,n){let{minCallees:i,scope:t,excludeSymbol:s,scanLimit:r}=n,o=n.semantic!==!1,a=ee.get(e,()=>new Map),c=`${i}|${t??""}|${r??""}|${o}`,l=a.get(c);return l||(l=se(e,{minCallees:i,scope:t,scanLimit:r,semantic:o}),a.set(c,l)),s===void 0?l:l.filter(m=>m.symbol!==s)}function P(e,n){let{minCallees:i,scope:t,scanLimit:s}=n,r=n.semantic!==!1,o=ne.get(e,()=>new Map),a=`${i}|${t??""}|${s??""}|${r}`,c=o.get(a);return c||(c=te(ie(e,{minCallees:i,scope:t,scanLimit:s,semantic:r})),o.set(a,c)),c}function te(e){let n=new Map;for(let r of e)for(let o of r.callees)n.set(o,(n.get(o)??0)+1);let i=Math.max(8,Math.ceil(Math.sqrt(e.length))),t=B(n,e.length),s=new Map;for(let r=0;r<e.length;r+=1){let o=e[r];for(let a of o.callees){if((n.get(a)??0)>i)continue;let c=s.get(a);c||(c=[],s.set(a,c)),c.push(r)}}return{corpus:e,candidateIndexesByCallee:s,docFreq:n,idfWeights:t,medianIdf:v(t),ubiquityThreshold:i}}function re(e,n){let i=new Map;for(let t of e.callees)for(let s of n.candidateIndexesByCallee.get(t)??[]){let r=n.corpus[s];r.symbol!==e.symbol&&i.set(r.symbol,r)}return i.size>0?[...i.values()]:n.corpus.filter(t=>t.symbol!==e.symbol)}function se(e,n){let{minCallees:i,scope:t,scanLimit:s,semantic:r}=n,o=new x(e),a=M(o.productionCallableDefinitions({scope:t,minLoc:5,sortByLocDesc:typeof s=="number"&&s>0}),s),c=o.calleeMap(a,{semantic:r});return a.map(l=>({symbol:l.symbol,file:l.relativePath,callees:j((c.get(l.symbolId)??[]).map(m=>m.symbol)),paramCount:o.callableSignature(l)?.paramCount??-1})).filter(l=>l.callees.size>=i)}function j(e){return new Set([...e].filter(n=>!oe(n)))}function oe(e){return Y.some(n=>e.includes(n))}function ae(e,n,i){let t=ue(e,n);if(!t||t.tokens.size<3)return[];let s=i.minSimilarity>=.5?i.minSimilarity:.3,r=[],o=ye(t,be(e));for(let a of o){if(a.symbol===t.symbol||a.tokens.size<3)continue;let c=L(t.tokens,a.tokens);if(c.size<2)continue;let l=new Set([...t.tokens,...a.tokens]),m=l.size>0?c.size/l.size:0;m<s||r.push({symbolA:t.symbol,shortNameA:p(t.symbol),fileA:t.file,symbolB:a.symbol,shortNameB:p(a.symbol),fileB:a.file,similarity:m,similarityBasis:"source-tokens",sharedCallees:[...c].sort(),uniqueToA:[...C(t.tokens,a.tokens)].sort(),uniqueToB:[...C(a.tokens,t.tokens)].sort(),...G([...c],"source-tokens")})}return r.sort((a,c)=>c.similarity-a.similarity||a.shortNameB.localeCompare(c.shortNameB)),r.slice(0,i.limit)}function G(e,n){let i=e.flatMap(E),t=e.flatMap(u=>$(u,n)),s=D(i,U),r=D(i,V),o=D(t,T),a=[...new Set(t.filter(_))],c=e.filter(u=>{let g=$(u,n);return g.some(k=>T.has(k))&&g.some(_)}).length,l=[];s.length>0&&l.push(`access/query scaffolding: ${s.slice(0,5).join(", ")}`),r.length>0&&l.push(`framework/generic scaffolding: ${r.slice(0,5).join(", ")}`),o.length>0&&l.push(`domain behavior verbs: ${o.slice(0,5).join(", ")}`),o.length>0&&a.length>0&&l.push(`domain-specific terms: ${a.slice(0,5).join(", ")}`);let m=n==="source-tokens"&&i.length>0&&i.every(u=>K.has(u));m&&l.push("shared source tokens are generic scaffolding");let y=o.length>0&&a.length>0,d=s.length+r.length>0,f=n==="callees"&&y&&e.length>=4&&a.length>=4&&c>=2,b=f?"domain-behavior":y?d?"mixed":"domain-behavior":s.length>0?"access-query-scaffolding":r.length>0||m?"framework-scaffolding":"structural-overlap";b==="structural-overlap"&&e.length>0&&l.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let S=b==="domain-behavior"&&(e.length>=3||f)?"direct":"signal";return{evidenceClass:b,actionTier:S,evidenceClassReasons:l,recommendation:le(b,S)}}function le(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function D(e,n){return[...new Set(e.filter(i=>n.has(i)))]}function E(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function $(e,n){if(n==="source-tokens")return E(e);let i=w(e);return E(i.length>0?i:ce(e))}function ce(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(t=>t.trim()).filter(t=>/[A-Za-z]/.test(t)).at(-1)?.replace(/\.$/,"")??e}function _(e){return e.length>3&&!T.has(e)&&!U.has(e)&&!V.has(e)&&!K.has(e)&&!me.has(e)}var T=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),U=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),V=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),K=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),me=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function ue(e,n){let i=I(e,n);if(!i||!R(i.symbol))return null;let t=fe(e,i);return t?{symbol:i.symbol,file:i.relativePath,tokens:t}:null}function fe(e,n){let i=w(n.symbol),t=W(e,n.relativePath,n.startLine,n.endLine,i),s=Z(t,i);return s.size>0?s:null}var de=h("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),ge=h("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function pe(e){return de.get(e,()=>he(e))}function be(e){return ge.get(e,()=>Se(pe(e)))}function Se(e){let n=new Map;for(let s of e)for(let r of s.tokens)n.set(r,(n.get(r)??0)+1);let i=Math.max(8,Math.ceil(Math.sqrt(e.length))),t=new Map;for(let s of e)for(let r of s.tokens){if((n.get(r)??0)>i)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(s)}return{corpus:e,candidateByToken:t,docFreq:n,ubiquityThreshold:i}}function ye(e,n){let i=new Map;for(let t of e.tokens)for(let s of n.candidateByToken.get(t)??[])s.symbol!==e.symbol&&i.set(s.symbol,s);return i.size>0?[...i.values()]:n.corpus.filter(t=>t.symbol!==e.symbol)}function he(e){return new x(e).productionCallableDefinitions().map(i=>({symbol:i.symbol,file:i.relativePath,tokens:Z(W(e,i.relativePath,i.startLine,i.endLine,i.leaf),i.leaf)})).filter(i=>i.tokens.size>0)}function W(e,n,i,t,s){let r=N(e,n);if(r.length===0)return"";if(t>=i&&t-i<=12)return r.slice(i,t+1).join(`
2
- `);let o=[new RegExp(`\\bdef\\s+${F(s)}\\b`),new RegExp(`\\bfun\\s+${F(s)}\\b`),new RegExp(`\\bfn\\s+${F(s)}\\b`),new RegExp(`\\bfunction\\s+${F(s)}\\b`),new RegExp(`\\b${F(s)}\\s*\\(`)],a=r.findIndex(c=>o.some(l=>l.test(c)));if(a>=0){let c=a;for(let l=a+1;l<r.length&&l<=a+8;l++){let m=r[l]??"";if(l>a&&Fe(m)||(c=l,m.trim()===""&&l>a+1))break}return r.slice(a,c+1).join(`
3
- `)}return r.slice(i,Math.min(r.length,i+8)).join(`
4
- `)}function Z(e,n){if(!e)return new Set;let i=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),t=Ce(n),r=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(o=>o.trim()).filter(o=>o.length>1).filter(o=>!i.has(o)).filter(o=>!t.has(o));return new Set(r)}function Ce(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function Fe(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function F(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{Te as a,Ne as b,Q as c,ie as d,te as e,re as f,j as g,G as h};
5
- //# sourceMappingURL=chunk-FKYPOK7P.js.map