scip-query 0.19.0 → 0.19.3

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 (184) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +17 -1
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-YHYTDWFT.js → chunk-24ET4VLC.js} +2 -2
  5. package/dist/{chunk-GBB2RUDN.js → chunk-26JI77AY.js} +130 -130
  6. package/dist/{chunk-MFBXBLHA.js → chunk-2E7QY4B5.js} +2 -2
  7. package/dist/{chunk-PXJIEMND.js → chunk-2ROSOG2I.js} +2 -2
  8. package/dist/{chunk-XKWEMFHP.js → chunk-2WCXKANA.js} +2 -2
  9. package/dist/{chunk-EZGT3NJX.js → chunk-33RLKB6L.js} +2 -2
  10. package/dist/{chunk-GJ3FR5WG.js → chunk-34MLC6UI.js} +2 -2
  11. package/dist/{chunk-G6RQVDTI.js → chunk-4BUMNEYQ.js} +2 -2
  12. package/dist/{chunk-XTSVYYAL.js → chunk-4CZJ4YJB.js} +2 -2
  13. package/dist/{chunk-TCVRJ56J.js → chunk-4FMT4HPC.js} +2 -2
  14. package/dist/{chunk-7FG5M53V.js → chunk-53SUJOJA.js} +2 -2
  15. package/dist/{chunk-AEDB4WXE.js → chunk-5FUAFNMP.js} +2 -2
  16. package/dist/chunk-5GCAM4JE.js +122 -0
  17. package/dist/{chunk-YBAC3RON.js → chunk-5GOBZI34.js} +2 -2
  18. package/dist/{chunk-LJD7V7UO.js → chunk-5OR4QRPR.js} +2 -2
  19. package/dist/{chunk-X36LKKVG.js → chunk-5OZCNAVM.js} +2 -2
  20. package/dist/{chunk-7EI4MU5A.js → chunk-5TZ2MQBG.js} +2 -2
  21. package/dist/{chunk-GNJHHPZE.js → chunk-64QITTX7.js} +2 -2
  22. package/dist/{chunk-HOXI4F5I.js → chunk-6EWBPAA3.js} +2 -2
  23. package/dist/{chunk-EZHARAL4.js → chunk-6FIA5BEB.js} +2 -2
  24. package/dist/{chunk-4ZCNFENR.js → chunk-77IOFJVY.js} +2 -2
  25. package/dist/{chunk-T5CSWYAZ.js → chunk-AD7WUFFT.js} +2 -2
  26. package/dist/{chunk-OGHGTD6Z.js → chunk-AEM24WSF.js} +2 -2
  27. package/dist/{chunk-S65OEY2G.js → chunk-AFVU2GB2.js} +2 -2
  28. package/dist/{chunk-SATRCB5O.js → chunk-AOSFSYEA.js} +2 -2
  29. package/dist/{chunk-3OSRXJKK.js → chunk-APLNTJPJ.js} +2 -2
  30. package/dist/{chunk-TDGCALH6.js → chunk-AYRHVJXW.js} +2 -2
  31. package/dist/{chunk-MDDF67O2.js → chunk-B26UX7ZD.js} +2 -2
  32. package/dist/{chunk-JFGUBZWE.js → chunk-C3KCSAQ4.js} +2 -2
  33. package/dist/{chunk-XESK6725.js → chunk-C3VQZFP2.js} +2 -2
  34. package/dist/{chunk-FLIF3JWA.js → chunk-CAKPEQZB.js} +2 -2
  35. package/dist/{chunk-PKAPOFF5.js → chunk-CIYUFF24.js} +2 -2
  36. package/dist/{chunk-J3U47L4Q.js → chunk-DO775SYA.js} +2 -2
  37. package/dist/{chunk-AM2LGOEX.js → chunk-EGKWRX5I.js} +2 -2
  38. package/dist/{chunk-PAZFJMXB.js → chunk-EHU4TZJJ.js} +2 -2
  39. package/dist/{chunk-YYR7ADNB.js → chunk-EII5ZHL2.js} +2 -2
  40. package/dist/{chunk-F5L7WEZF.js → chunk-EYF5HOUZ.js} +2 -2
  41. package/dist/{chunk-RIGY5DDE.js → chunk-FB6IKAKZ.js} +2 -2
  42. package/dist/{chunk-BGUYAA3Q.js → chunk-FBUNGRKI.js} +2 -2
  43. package/dist/{chunk-M2TRDR25.js → chunk-FC5K7T35.js} +1 -1
  44. package/dist/{chunk-KWBA6FDD.js → chunk-FRXB74RQ.js} +2 -2
  45. package/dist/{chunk-BYPVNKJT.js → chunk-FTRNGQGR.js} +2 -2
  46. package/dist/{chunk-54UYBTZW.js → chunk-FUFNRZFJ.js} +2 -2
  47. package/dist/{chunk-TDZXQAH7.js → chunk-FYE4PWWP.js} +2 -2
  48. package/dist/{chunk-QNMOZ3CJ.js → chunk-GAE7WCBK.js} +2 -2
  49. package/dist/{chunk-2ZNZSNVW.js → chunk-HAC5EI2T.js} +2 -2
  50. package/dist/{chunk-WT7TOU2C.js → chunk-HCSTQGQE.js} +2 -2
  51. package/dist/{chunk-UXOVHGT6.js → chunk-HFBNIIZX.js} +2 -2
  52. package/dist/{chunk-JHK2DMUQ.js → chunk-HGFDYOVB.js} +1 -1
  53. package/dist/{chunk-UJL3N6TC.js → chunk-HHOJH3RJ.js} +2 -2
  54. package/dist/{chunk-X65VYV2S.js → chunk-HNTLCR4F.js} +2 -2
  55. package/dist/{chunk-RJLU7IMR.js → chunk-IICQP2DY.js} +2 -2
  56. package/dist/{chunk-J65FQLDL.js → chunk-IXAALOUP.js} +2 -2
  57. package/dist/{chunk-XDVT7QPG.js → chunk-J4MYRIYT.js} +2 -2
  58. package/dist/{chunk-TAB7AWKO.js → chunk-J5XJWCB3.js} +2 -2
  59. package/dist/{chunk-DWN7QDTV.js → chunk-JFO2UVQP.js} +2 -2
  60. package/dist/{chunk-FMC3BI4I.js → chunk-JRCJEHRG.js} +2 -2
  61. package/dist/{chunk-4XTPZ5CR.js → chunk-KMOMNTB4.js} +2 -2
  62. package/dist/{chunk-ZL5Y23AJ.js → chunk-LM72NQ7T.js} +1 -1
  63. package/dist/{chunk-4ZHJAHLE.js → chunk-LSJDKJIB.js} +2 -2
  64. package/dist/{chunk-VV5WJLRO.js → chunk-MP43RX4O.js} +1 -1
  65. package/dist/{chunk-D5OXYOJP.js → chunk-MQ2B33LQ.js} +1 -1
  66. package/dist/{chunk-MTFHE7ZO.js → chunk-MRYPDVOS.js} +2 -2
  67. package/dist/{chunk-GMZYT44R.js → chunk-NLNZK7RL.js} +5 -5
  68. package/dist/{chunk-ZXWFN7CK.js → chunk-OAM22BCR.js} +2 -2
  69. package/dist/{chunk-TOYQTO44.js → chunk-OLG2YPLS.js} +2 -2
  70. package/dist/{chunk-PBADFBRR.js → chunk-OQ6TCHBB.js} +2 -2
  71. package/dist/{chunk-3KQOIXLO.js → chunk-PCIFZHWS.js} +2 -2
  72. package/dist/{chunk-KD6TPIXM.js → chunk-PJENL245.js} +2 -2
  73. package/dist/{chunk-F334Z5UA.js → chunk-PLDIXTKR.js} +2 -2
  74. package/dist/{chunk-BOXAKNN6.js → chunk-PNESKY2Z.js} +2 -2
  75. package/dist/{chunk-QHOUNTDZ.js → chunk-PTYQQHZM.js} +2 -2
  76. package/dist/{chunk-2FAJTZSX.js → chunk-QKW7ISEW.js} +2 -2
  77. package/dist/{chunk-AWSRND4W.js → chunk-QNO3QIMN.js} +2 -2
  78. package/dist/{chunk-DV6B262O.js → chunk-SJ6XSCG7.js} +2 -2
  79. package/dist/{chunk-XPYXEEDO.js → chunk-SOS256TP.js} +2 -2
  80. package/dist/{chunk-DQIJMKNE.js → chunk-TDUU63FC.js} +2 -2
  81. package/dist/chunk-TOIS2VAI.js +4 -0
  82. package/dist/{chunk-TC3X33N6.js → chunk-TYEGFDOP.js} +2 -2
  83. package/dist/chunk-UJKZQLDB.js +2 -0
  84. package/dist/chunk-V27BEQJN.js +7 -0
  85. package/dist/{chunk-J6BR4MD6.js → chunk-VIKEPD4D.js} +2 -2
  86. package/dist/{chunk-XDSB47KO.js → chunk-WAU7HVDI.js} +2 -2
  87. package/dist/chunk-WFWQWQK6.js +3 -0
  88. package/dist/chunk-WWCZCH7W.js +3 -0
  89. package/dist/{chunk-QB5WSOTY.js → chunk-XAMVIPE2.js} +2 -2
  90. package/dist/{chunk-A45K6VUK.js → chunk-XWE7PZQH.js} +2 -2
  91. package/dist/{chunk-547VY366.js → chunk-XWJ3JYRG.js} +2 -2
  92. package/dist/{chunk-QN67MWDU.js → chunk-XYBNOILR.js} +2 -2
  93. package/dist/{chunk-IWK562KR.js → chunk-XYNWAZ6J.js} +2 -2
  94. package/dist/{chunk-UVMME4FI.js → chunk-YGBHQOB2.js} +2 -2
  95. package/dist/{chunk-ZNSLF5AC.js → chunk-YGQBJUS6.js} +2 -2
  96. package/dist/{chunk-6DHPQS72.js → chunk-YILKXTIY.js} +2 -2
  97. package/dist/{chunk-X3OOU7CF.js → chunk-Z7M7X3ZG.js} +2 -2
  98. package/dist/{chunk-G6QQCX45.js → chunk-ZJGZCBYT.js} +2 -2
  99. package/dist/cli.js +1 -1
  100. package/dist/{command-descriptors-SWFWGIFK.js → command-descriptors-QJEYYND2.js} +168 -166
  101. package/dist/direct-navigation-TT23TDBS.js +3 -0
  102. package/dist/index.js +1 -1
  103. package/dist/queries/affected.js +1 -1
  104. package/dist/queries/architecture.js +1 -1
  105. package/dist/queries/bottlenecks.js +1 -1
  106. package/dist/queries/by-kind.js +1 -1
  107. package/dist/queries/call-graph.js +1 -1
  108. package/dist/queries/change-surface.js +1 -1
  109. package/dist/queries/cleanup-plan.js +1 -1
  110. package/dist/queries/co-change.js +1 -1
  111. package/dist/queries/code.js +1 -1
  112. package/dist/queries/complexity-hotspots.js +1 -1
  113. package/dist/queries/complexity.js +1 -1
  114. package/dist/queries/convergence.js +1 -1
  115. package/dist/queries/coupling.js +1 -1
  116. package/dist/queries/cycles.js +1 -1
  117. package/dist/queries/dataflow.js +1 -1
  118. package/dist/queries/dead.js +1 -1
  119. package/dist/queries/decorative-checkers.js +1 -1
  120. package/dist/queries/deep-chains.js +1 -1
  121. package/dist/queries/deps.js +1 -1
  122. package/dist/queries/diff-gate.js +1 -1
  123. package/dist/queries/diff-impact.js +1 -1
  124. package/dist/queries/doc-drift.js +1 -1
  125. package/dist/queries/drift.js +1 -1
  126. package/dist/queries/duplicate-bodies.js +1 -1
  127. package/dist/queries/extract-candidates.js +1 -1
  128. package/dist/queries/fan.js +1 -1
  129. package/dist/queries/health.js +1 -1
  130. package/dist/queries/hierarchy.js +1 -1
  131. package/dist/queries/hotspots.js +1 -1
  132. package/dist/queries/imports.js +1 -1
  133. package/dist/queries/incomplete-migration.js +1 -1
  134. package/dist/queries/index.js +1 -1
  135. package/dist/queries/isolated.js +1 -1
  136. package/dist/queries/locality-candidates.js +1 -1
  137. package/dist/queries/members.js +1 -1
  138. package/dist/queries/methods.js +1 -1
  139. package/dist/queries/not-implemented.js +1 -1
  140. package/dist/queries/outline.js +1 -1
  141. package/dist/queries/passthrough-candidates.js +1 -1
  142. package/dist/queries/plan-context.js +1 -1
  143. package/dist/queries/react-component-duplicates.js +1 -1
  144. package/dist/queries/react-hook-candidates.js +1 -1
  145. package/dist/queries/react-large-component-pressure.js +1 -1
  146. package/dist/queries/recent-duplicates.js +1 -1
  147. package/dist/queries/redundant-reexports.js +1 -1
  148. package/dist/queries/refs.js +1 -1
  149. package/dist/queries/self-audit.js +1 -1
  150. package/dist/queries/similar-chains.js +1 -1
  151. package/dist/queries/similar-files.js +1 -1
  152. package/dist/queries/similar-signatures.js +1 -1
  153. package/dist/queries/similar.js +1 -1
  154. package/dist/queries/slice.js +1 -1
  155. package/dist/queries/stale-abstractions.js +1 -1
  156. package/dist/queries/surface.js +1 -1
  157. package/dist/queries/symbols.js +1 -1
  158. package/dist/queries/system.js +1 -1
  159. package/dist/queries/test-quality.js +1 -1
  160. package/dist/queries/trace.js +1 -1
  161. package/dist/queries/twin-ab.js +1 -1
  162. package/dist/queries/twin-drift.js +1 -1
  163. package/dist/queries/unused-imports.js +1 -1
  164. package/dist/queries/unused-params.js +1 -1
  165. package/dist/queries/vue-component-duplicates.js +1 -1
  166. package/dist/queries/vue-composable-candidates.js +1 -1
  167. package/dist/queries/vue-large-view-pressure.js +1 -1
  168. package/dist/queries/wrapper-candidates.js +1 -1
  169. package/dist/reindex-worker.js +24 -24
  170. package/dist/reindex.js +38 -38
  171. package/dist/runtime.d.ts +6 -1
  172. package/dist/runtime.js +2 -2
  173. package/dist/rust-semantic-session-server.js +1 -1
  174. package/dist/rust-semantic-session-worker.js +1 -1
  175. package/dist/rust-semantic-worker.js +1 -1
  176. package/dist/watch-server.js +5 -5
  177. package/package.json +1 -1
  178. package/dist/chunk-42QYU6FD.js +0 -3
  179. package/dist/chunk-6SHX42QQ.js +0 -6
  180. package/dist/chunk-AERYQJ52.js +0 -3
  181. package/dist/chunk-IXORBCMR.js +0 -120
  182. package/dist/chunk-NEG77KKH.js +0 -4
  183. package/dist/chunk-OYYZLJVT.js +0 -2
  184. package/dist/direct-navigation-RKMPBXMI.js +0 -3
@@ -1,5 +1,5 @@
1
- import{a as te,b as N,e as V,f as j,g as E,h as re,i as se}from"./chunk-KMVGRIO2.js";import{a as q}from"./chunk-ZXWFN7CK.js";import{b as _}from"./chunk-B75HZHUP.js";import{a as ne}from"./chunk-F334Z5UA.js";import{n as ie}from"./chunk-UVMME4FI.js";import{a as D}from"./chunk-UXOVHGT6.js";import{d as I,e as K,h as $}from"./chunk-TDGCALH6.js";import{a as B}from"./chunk-QNMOZ3CJ.js";import{d as z,h as J,q as A,s as y,v as Q,x as ee,y as U,z as H}from"./chunk-M2TRDR25.js";import{a as Y}from"./chunk-64MNV6AB.js";function ve(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=ze(e,n,{semantic:t.semantic!==!1});if(!s)return[];if(!$(s.symbol))return[];if(s.callees.size===0)return ae(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"});let a=Me(e,s,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,r):ae(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"})}function Mn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=ve(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let l=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:I(r.symbol),file:r.relativePath,loc:l},symbolB:{symbol:s.symbol,shortName:I(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:we(a)}}function we(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function Me(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=je(n,r.corpus),a=Oe(s,r),l=Te(s,r),c=j(l),m=E(s.callees,l),g=[];for(let f of a){if(f.callees.size<3)continue;let o=E(f.callees,l),u=ue(s,f,l,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:o});u&&g.push(u)}return g.sort((f,o)=>o.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ue(e,n,t,i){let r=Re(e,n,t,i);if(!Ae(r,i))return null;let{similarity:s,significantShared:a,trivialShared:l}=r,c=a.length>0?a:l,m=Se(c,"callees");return{symbolA:e.symbol,shortNameA:I(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:I(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(I),uniqueToA:[...N(e.callees,n.callees)].map(I),uniqueToB:[...N(n.callees,e.callees)].map(I),...m}}function Le(e,n,t,i){let r=i.magnitudeA??E(e.callees,t),s=i.magnitudeB??E(n.callees,t),a=0,l=0,c=0,m=i.medianIdf??j(t);for(let o of e.callees){if(!n.callees.has(o))continue;let u=t.get(o)??0;a+=u*u,c+=1,u>=m&&(l+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:l>=i.requireSignificantShared||c>=i.requireSharedCount}function Re(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Ae(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Tn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:l}=n,c=n.semantic!==!1,m=A(),g=0,f=0,o=0,u=0,d=0,p=0,S=0;return y("similar.all",()=>{let b=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:l,semantic:c}),C=b.corpus;g=C.length;let v=n.focusFiles,k=[],P=0;return y("similar.all.pair-scan",()=>{for(let x=0;x<C.length;x+=1){let F=C[x],T=v?.has(F.file)??!1,w=b.weightedMagnitudes[x],M=new Set;for(let O of F.callees){let L=b.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=x||v&&!T&&!v.has(C[R].file)||M.add(R)}m&&(o+=M.size,M.size>0&&(f+=1));for(let O of M){let L=C[O];if(a&&F.file===L.file){m&&(d+=1);continue}if(me(F,L)){m&&(p+=1);continue}m&&(u+=1);let R=ue(F,L,b.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:b.medianIdf,magnitudeA:w,magnitudeB:b.weightedMagnitudes[O]});R&&(Be(k,R,i,P),m&&(S+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S,topResults:k.length})),y("similar.all.sort-project",()=>(k.sort((x,F)=>F.result.similarity-x.result.similarity||x.order-F.order),k.map(x=>x.result)),()=>({topResults:k.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:l,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,l=n.semantic!==!1,c=A(),m=0,g=0,f=0,o=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let h=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:l}),b=h.corpus;m=b.length;let C=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let v=0;v<b.length;v+=1){let k=b[v],P=C?.has(k.file)??!1,x=h.weightedMagnitudes[v],F=new Set;for(let T of k.callees){let w=h.candidateIndexesByCallee.get(T);if(w)for(let M of w)M<=v||C&&!P&&!C.has(b[M].file)||F.add(M)}c&&(f+=F.size,F.size>0&&(g+=1));for(let T of F){let w=b[T];if(s&&k.file===w.file){c&&(u+=1);continue}if(me(k,w)){c&&(d+=1);continue}c&&(o+=1),Le(k,w,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:x,magnitudeB:h.weightedMagnitudes[T]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:l,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function me(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var de=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Be(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let l=e[a],c=e[r];(l.result.similarity<c.result.similarity||l.result.similarity===c.result.similarity&&l.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["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 ze(e,n,t){let i=D(e,n);if(!i||!$(i.symbol))return null;let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return{symbol:i.symbol,file:i.relativePath,callees:pe(s.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}var De=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),qe=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function fe(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,l=De.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let o=l.get(c);if(m=o!==void 0,o||(o=$e(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),l.set(c,o)),g=o.length,r===void 0)return o;let u=o.filter(d=>d.symbol!==r);return f=o.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function Ne(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=qe.get(e,()=>new Map),l=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let o=a.get(l);return c=o!==void 0,o||(o=Pe(fe(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(l,o)),m=o.corpus.length,g=o.docFreq.size,f=o.candidateIndexesByCallee.size,o},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>fe(e,n),calleeIndex:n=>Ne(e,n),sourceCorpus:(n={})=>Fe(e,n),sourceIndex:(n={})=>ce(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,ce(e,{scanLimit:t.scanLimit}))}}function Pe(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let o=new Map;for(let u of e)for(let d of u.callees)o.set(d,(o.get(d)??0)+1);return t=o.size,o},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(o=>E(o.callees,s)),()=>({corpusSize:e.length})),l=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let o=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let S=o.get(p);S||(S=[],o.set(p,S)),S.push(u),n&&(l+=1)}}return n&&(m=o.size),o},()=>({corpusSize:e.length,buckets:m,candidateRefs:l,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Oe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function $e(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),l=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(l.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=l.calleeMap(m,{semantic:s});if(a)for(let S of p.values())g+=S.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),o=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let p=m.map(b=>({symbol:b.symbol,file:b.relativePath,callees:pe((f.get(b.symbolId)??[]).map(C=>C.symbol)),paramCount:l.callableSignature(b)?.paramCount??-1})),S=_e(p);a&&(d=S.filter((b,C)=>b.callees.size!==p[C].callees.size).length);let h=S.filter(b=>b.callees.size>=t);return o=h.length,a&&(u=h.reduce((b,C)=>b+C.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:o,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var ge=5;function _e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=ge);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function je(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=ge);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function pe(e){return new Set([...e].filter(n=>!Ge(n)))}function Ge(e){return Ee.some(n=>e.includes(n))}function ae(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",l=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let o=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});l=o.length;for(let u of o){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),S=p.size>0?d.size/p.size:0;if(S<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:I(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:I(u.symbol),fileB:u.file,similarity:S,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...Se([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:l,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function Se(e,n){let t=e.flatMap(W),i=e.flatMap(S=>oe(S,n)),r=Z(t,be),s=Z(t,ye),a=Z(i,X),l=[...new Set(i.filter(le))],c=e.filter(S=>{let h=oe(S,n);return h.some(b=>X.has(b))&&h.some(le)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&l.length>0&&m.push(`domain-specific terms: ${l.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(S=>he.has(S));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&l.length>0,o=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&l.length>=4&&c>=2,d=u?"domain-behavior":f?o?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}function Ue(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 Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function oe(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function le(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!ye.has(e)&&!he.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),ye=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"]),he=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=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 Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=Ie(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function Ce(e){return`${e.scanLimit??""}`}function Fe(e,n={}){let t=We.get(e,()=>new Map),i=Ce(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function ce(e,n={}){let t=Xe.get(e,()=>new Map),i=Ce(n),r=t.get(i);return r||(r=Je(Fe(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,l=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let S of Y(e,{includeIgnored:!1})){a+=1;let h=U(e,S);h&&(l+=1,nn(h,d,s)&&p.push(S))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:l,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),o=0;return y("similar.source-shape.target-fingerprints",()=>{let d=xe(e,f);return i&&(o=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:o})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return xe(e,r)}function xe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let l=J(e,r,a),c=on(e,r,l),m=!1,g=null;for(let f of s){let o=an(f),u=c.get(o),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=Ie(ke(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(o,{key:o,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,l,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":ke(s,t,i,r)}function ke(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
1
+ import{a as te,b as N,e as V,f as j,g as E,h as re,i as se}from"./chunk-KMVGRIO2.js";import{a as q}from"./chunk-OAM22BCR.js";import{b as _}from"./chunk-B75HZHUP.js";import{a as ne}from"./chunk-PLDIXTKR.js";import{n as ie}from"./chunk-YGBHQOB2.js";import{a as D}from"./chunk-HFBNIIZX.js";import{d as I,e as K,h as $}from"./chunk-AYRHVJXW.js";import{a as B}from"./chunk-GAE7WCBK.js";import{d as z,h as J,q as A,s as y,v as Q,x as ee,y as U,z as H}from"./chunk-FC5K7T35.js";import{a as Y}from"./chunk-64MNV6AB.js";function ve(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=ze(e,n,{semantic:t.semantic!==!1});if(!s)return[];if(!$(s.symbol))return[];if(s.callees.size===0)return ae(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"});let a=Me(e,s,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,r):ae(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"})}function Mn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=ve(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let l=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:I(r.symbol),file:r.relativePath,loc:l},symbolB:{symbol:s.symbol,shortName:I(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:we(a)}}function we(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function Me(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=je(n,r.corpus),a=Oe(s,r),l=Te(s,r),c=j(l),m=E(s.callees,l),g=[];for(let f of a){if(f.callees.size<3)continue;let o=E(f.callees,l),u=ue(s,f,l,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:o});u&&g.push(u)}return g.sort((f,o)=>o.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ue(e,n,t,i){let r=Re(e,n,t,i);if(!Ae(r,i))return null;let{similarity:s,significantShared:a,trivialShared:l}=r,c=a.length>0?a:l,m=Se(c,"callees");return{symbolA:e.symbol,shortNameA:I(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:I(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(I),uniqueToA:[...N(e.callees,n.callees)].map(I),uniqueToB:[...N(n.callees,e.callees)].map(I),...m}}function Le(e,n,t,i){let r=i.magnitudeA??E(e.callees,t),s=i.magnitudeB??E(n.callees,t),a=0,l=0,c=0,m=i.medianIdf??j(t);for(let o of e.callees){if(!n.callees.has(o))continue;let u=t.get(o)??0;a+=u*u,c+=1,u>=m&&(l+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:l>=i.requireSignificantShared||c>=i.requireSharedCount}function Re(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Ae(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Tn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:l}=n,c=n.semantic!==!1,m=A(),g=0,f=0,o=0,u=0,d=0,p=0,S=0;return y("similar.all",()=>{let b=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:l,semantic:c}),C=b.corpus;g=C.length;let v=n.focusFiles,k=[],P=0;return y("similar.all.pair-scan",()=>{for(let x=0;x<C.length;x+=1){let F=C[x],T=v?.has(F.file)??!1,w=b.weightedMagnitudes[x],M=new Set;for(let O of F.callees){let L=b.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=x||v&&!T&&!v.has(C[R].file)||M.add(R)}m&&(o+=M.size,M.size>0&&(f+=1));for(let O of M){let L=C[O];if(a&&F.file===L.file){m&&(d+=1);continue}if(me(F,L)){m&&(p+=1);continue}m&&(u+=1);let R=ue(F,L,b.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:b.medianIdf,magnitudeA:w,magnitudeB:b.weightedMagnitudes[O]});R&&(Be(k,R,i,P),m&&(S+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S,topResults:k.length})),y("similar.all.sort-project",()=>(k.sort((x,F)=>F.result.similarity-x.result.similarity||x.order-F.order),k.map(x=>x.result)),()=>({topResults:k.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:l,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,l=n.semantic!==!1,c=A(),m=0,g=0,f=0,o=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let h=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:l}),b=h.corpus;m=b.length;let C=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let v=0;v<b.length;v+=1){let k=b[v],P=C?.has(k.file)??!1,x=h.weightedMagnitudes[v],F=new Set;for(let T of k.callees){let w=h.candidateIndexesByCallee.get(T);if(w)for(let M of w)M<=v||C&&!P&&!C.has(b[M].file)||F.add(M)}c&&(f+=F.size,F.size>0&&(g+=1));for(let T of F){let w=b[T];if(s&&k.file===w.file){c&&(u+=1);continue}if(me(k,w)){c&&(d+=1);continue}c&&(o+=1),Le(k,w,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:x,magnitudeB:h.weightedMagnitudes[T]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:l,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function me(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var de=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Be(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let l=e[a],c=e[r];(l.result.similarity<c.result.similarity||l.result.similarity===c.result.similarity&&l.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["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 ze(e,n,t){let i=D(e,n);if(!i||!$(i.symbol))return null;let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return{symbol:i.symbol,file:i.relativePath,callees:pe(s.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}var De=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),qe=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function fe(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,l=De.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let o=l.get(c);if(m=o!==void 0,o||(o=$e(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),l.set(c,o)),g=o.length,r===void 0)return o;let u=o.filter(d=>d.symbol!==r);return f=o.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function Ne(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=qe.get(e,()=>new Map),l=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let o=a.get(l);return c=o!==void 0,o||(o=Pe(fe(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(l,o)),m=o.corpus.length,g=o.docFreq.size,f=o.candidateIndexesByCallee.size,o},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>fe(e,n),calleeIndex:n=>Ne(e,n),sourceCorpus:(n={})=>Fe(e,n),sourceIndex:(n={})=>ce(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,ce(e,{scanLimit:t.scanLimit}))}}function Pe(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let o=new Map;for(let u of e)for(let d of u.callees)o.set(d,(o.get(d)??0)+1);return t=o.size,o},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(o=>E(o.callees,s)),()=>({corpusSize:e.length})),l=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let o=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let S=o.get(p);S||(S=[],o.set(p,S)),S.push(u),n&&(l+=1)}}return n&&(m=o.size),o},()=>({corpusSize:e.length,buckets:m,candidateRefs:l,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Oe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function $e(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),l=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(l.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=l.calleeMap(m,{semantic:s});if(a)for(let S of p.values())g+=S.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),o=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let p=m.map(b=>({symbol:b.symbol,file:b.relativePath,callees:pe((f.get(b.symbolId)??[]).map(C=>C.symbol)),paramCount:l.callableSignature(b)?.paramCount??-1})),S=_e(p);a&&(d=S.filter((b,C)=>b.callees.size!==p[C].callees.size).length);let h=S.filter(b=>b.callees.size>=t);return o=h.length,a&&(u=h.reduce((b,C)=>b+C.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:o,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var ge=5;function _e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=ge);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function je(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=ge);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function pe(e){return new Set([...e].filter(n=>!Ge(n)))}function Ge(e){return Ee.some(n=>e.includes(n))}function ae(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",l=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let o=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});l=o.length;for(let u of o){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),S=p.size>0?d.size/p.size:0;if(S<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:I(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:I(u.symbol),fileB:u.file,similarity:S,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...Se([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:l,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function Se(e,n){let t=e.flatMap(W),i=e.flatMap(S=>oe(S,n)),r=Z(t,be),s=Z(t,ye),a=Z(i,X),l=[...new Set(i.filter(le))],c=e.filter(S=>{let h=oe(S,n);return h.some(b=>X.has(b))&&h.some(le)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&l.length>0&&m.push(`domain-specific terms: ${l.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(S=>he.has(S));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&l.length>0,o=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&l.length>=4&&c>=2,d=u?"domain-behavior":f?o?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}function Ue(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 Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function oe(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function le(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!ye.has(e)&&!he.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),ye=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"]),he=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=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 Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=Ie(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function Ce(e){return`${e.scanLimit??""}`}function Fe(e,n={}){let t=We.get(e,()=>new Map),i=Ce(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function ce(e,n={}){let t=Xe.get(e,()=>new Map),i=Ce(n),r=t.get(i);return r||(r=Je(Fe(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,l=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let S of Y(e,{includeIgnored:!1})){a+=1;let h=U(e,S);h&&(l+=1,nn(h,d,s)&&p.push(S))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:l,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),o=0;return y("similar.source-shape.target-fingerprints",()=>{let d=xe(e,f);return i&&(o=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:o})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return xe(e,r)}function xe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let l=J(e,r,a),c=on(e,r,l),m=!1,g=null;for(let f of s){let o=an(f),u=c.get(o),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=Ie(ke(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(o,{key:o,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,l,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":ke(s,t,i,r)}function ke(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
2
2
  `);let r=[new RegExp(`\\bdef\\s+${B(i)}\\b`),new RegExp(`\\bfun\\s+${B(i)}\\b`),new RegExp(`\\bfn\\s+${B(i)}\\b`),new RegExp(`\\bfunction\\s+${B(i)}\\b`),new RegExp(`\\b${B(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(l=>l.test(a)));if(s>=0){let a=s;for(let l=s+1;l<e.length&&l<=s+8;l++){let c=e[l]??"";if(l>s&&dn(c)||(a=l,c.trim()===""&&l>s+1))break}return e.slice(s,a+1).join(`
3
3
  `)}return e.slice(n,Math.min(e.length,n+8)).join(`
4
4
  `)}function an(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function on(e,n,t){return de.read(e,n,t)??new Map}function ln(e){try{let n=JSON.parse(e);if(!Array.isArray(n.entries))return null;let t=new Map;for(let i of n.entries){if(!i||typeof i.key!="string"||typeof i.symbol!="string"||typeof i.startLine!="number"||typeof i.endLine!="number"||typeof i.leaf!="string"||!Array.isArray(i.tokens)||!i.tokens.every(r=>typeof r=="string"))return null;t.set(i.key,i)}return t}catch{return null}}function cn(e){let n={entries:[...e.values()].sort((t,i)=>t.key.localeCompare(i.key))};return JSON.stringify(n)}function un(e,n,t,i){de.write(e,n,t,new Map(i))}function Ie(e,n){if(!e)return new Set;let t=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"]),i=mn(n),s=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(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function mn(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 dn(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}export{ve as a,Mn as b,Te as c,ue as d,Tn as e,Ln as f,Be as g,fe as h,Ne as i,G as j,Pe as k,Oe as l,ge as m,_e as n,pe as o,Se as p};
5
- //# sourceMappingURL=chunk-UJL3N6TC.js.map
5
+ //# sourceMappingURL=chunk-HHOJH3RJ.js.map
@@ -1,2 +1,2 @@
1
- import{a as p}from"./chunk-ZXWFN7CK.js";import{a as u}from"./chunk-F334Z5UA.js";import{m as h,n as y}from"./chunk-UVMME4FI.js";import{a as S,c as b}from"./chunk-UXOVHGT6.js";import{d as m,z as d}from"./chunk-TDGCALH6.js";function P(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=S(e,o);return r?c==="backward"?M(e,r,s,{semantic:l.semantic!==!1}):k(e,r,{semantic:l.semantic!==!1}):null}function M(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let g of t){let w=u(e,g,{semantic:c.semantic,semanticEvidence:y});for(let a of w){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function k(e,o,l){let c=new Set,s=[],r=new p(e);for(let t of h(e,o,{semantic:l.semantic,semanticEvidence:y})){if(s.length>=30)break;let n=t.enclosingSymbol??d(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{P as a};
2
- //# sourceMappingURL=chunk-X65VYV2S.js.map
1
+ import{a as p}from"./chunk-OAM22BCR.js";import{a as u}from"./chunk-PLDIXTKR.js";import{m as h,n as y}from"./chunk-YGBHQOB2.js";import{a as S,c as b}from"./chunk-HFBNIIZX.js";import{d as m,z as d}from"./chunk-AYRHVJXW.js";function P(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=S(e,o);return r?c==="backward"?M(e,r,s,{semantic:l.semantic!==!1}):k(e,r,{semantic:l.semantic!==!1}):null}function M(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let g of t){let w=u(e,g,{semantic:c.semantic,semanticEvidence:y});for(let a of w){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function k(e,o,l){let c=new Set,s=[],r=new p(e);for(let t of h(e,o,{semantic:l.semantic,semanticEvidence:y})){if(s.length>=30)break;let n=t.enclosingSymbol??d(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{P as a};
2
+ //# sourceMappingURL=chunk-HNTLCR4F.js.map
@@ -1,4 +1,4 @@
1
- import{d as D}from"./chunk-F334Z5UA.js";import{n as R}from"./chunk-UVMME4FI.js";import{a as M,c as N}from"./chunk-UXOVHGT6.js";import{d as b,f as g,s as S,z as I}from"./chunk-TDGCALH6.js";import{B as p}from"./chunk-XDSB47KO.js";function O(o,n,l={}){let{maxDepth:u=5,scope:m}=l,i=M(o,n);if(!i)return[];let c=[],d=new Set([i.symbolId]),a=new Set,r=[i];for(let e=1;e<=u&&r.length!==0;e++){let t=[],f=D(o,r,{limit:500,semanticEvidence:R});for(let y of r)for(let s of w(o,y,m,f.get(y.symbolId)??[])){let h=`${s.file}|${s.shortName}`;if(s.symbolId!==null){if(d.has(s.symbolId))continue;d.add(s.symbolId)}else if(a.has(h))continue;a.add(h),c.push({symbol:s.symbol,shortName:s.shortName,file:s.file,depth:e}),s.symbolId!==null&&s.symbolMatch&&t.push(s.symbolMatch)}r=t}return c.sort((e,t)=>e.depth-t.depth||e.file.localeCompare(t.file)),c}function w(o,n,l,u){let m=u.filter(e=>!o.isIgnored(e.file)).filter(e=>!l||e.file.includes(l)),i=new Set(m.map(e=>e.file)),c=[];for(let e of A(o,n,l)){if(i.has(e))continue;let t=S(o,e),f=t.length>0?I(t,t[0].startLine):null;c.push({symbol:f?.symbol??e,file:e})}let d=[...m,...c],a=[],r=new Set;for(let e of d){let t=N(o,e.symbol);if(!t){let y=`${e.file}|${e.symbol}`;if(r.has(y))continue;r.add(y),a.push({symbolId:null,symbol:e.symbol,shortName:b(e.symbol),file:e.file,symbolMatch:null});continue}if(t.symbolId===n.symbolId||o.isIgnored(t.relativePath)||!_(t))continue;let f=`${t.symbolId}|${t.relativePath}`;r.has(f)||(r.add(f),a.push({symbolId:t.symbolId,symbol:t.symbol,shortName:b(t.symbol),file:t.relativePath,symbolMatch:t}))}return a}function A(o,n,l){let u=l?"AND consumer_d.relative_path LIKE ?":"",m=[n.symbolId,n.documentId];return l&&m.push(`%${l}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
1
+ import{d as D}from"./chunk-PLDIXTKR.js";import{n as R}from"./chunk-YGBHQOB2.js";import{a as M,c as N}from"./chunk-HFBNIIZX.js";import{d as b,f as g,s as S,z as I}from"./chunk-AYRHVJXW.js";import{B as p}from"./chunk-WAU7HVDI.js";function O(o,n,l={}){let{maxDepth:u=5,scope:m}=l,i=M(o,n);if(!i)return[];let c=[],d=new Set([i.symbolId]),a=new Set,r=[i];for(let e=1;e<=u&&r.length!==0;e++){let t=[],f=D(o,r,{limit:500,semanticEvidence:R});for(let y of r)for(let s of w(o,y,m,f.get(y.symbolId)??[])){let h=`${s.file}|${s.shortName}`;if(s.symbolId!==null){if(d.has(s.symbolId))continue;d.add(s.symbolId)}else if(a.has(h))continue;a.add(h),c.push({symbol:s.symbol,shortName:s.shortName,file:s.file,depth:e}),s.symbolId!==null&&s.symbolMatch&&t.push(s.symbolMatch)}r=t}return c.sort((e,t)=>e.depth-t.depth||e.file.localeCompare(t.file)),c}function w(o,n,l,u){let m=u.filter(e=>!o.isIgnored(e.file)).filter(e=>!l||e.file.includes(l)),i=new Set(m.map(e=>e.file)),c=[];for(let e of A(o,n,l)){if(i.has(e))continue;let t=S(o,e),f=t.length>0?I(t,t[0].startLine):null;c.push({symbol:f?.symbol??e,file:e})}let d=[...m,...c],a=[],r=new Set;for(let e of d){let t=N(o,e.symbol);if(!t){let y=`${e.file}|${e.symbol}`;if(r.has(y))continue;r.add(y),a.push({symbolId:null,symbol:e.symbol,shortName:b(e.symbol),file:e.file,symbolMatch:null});continue}if(t.symbolId===n.symbolId||o.isIgnored(t.relativePath)||!_(t))continue;let f=`${t.symbolId}|${t.relativePath}`;r.has(f)||(r.add(f),a.push({symbolId:t.symbolId,symbol:t.symbol,shortName:b(t.symbol),file:t.relativePath,symbolMatch:t}))}return a}function A(o,n,l){let u=l?"AND consumer_d.relative_path LIKE ?":"",m=[n.symbolId,n.documentId];return l&&m.push(`%${l}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents consumer_d ON consumer_d.id = c.document_id
@@ -7,4 +7,4 @@ import{d as D}from"./chunk-F334Z5UA.js";import{n as R}from"./chunk-UVMME4FI.js";
7
7
  AND c.document_id != ?
8
8
  ${o.pathExclusionsFor("consumer_d")}
9
9
  ${u}`,...m).map(i=>i.relative_path).filter(i=>!o.isIgnored(i)))}function _(o){if(o.symbol.startsWith("scip-clojure ")||p(o.relativePath)==="clojure")return!0;let n=g(o.symbol);return n==="method"||n==="type"||o.symbol.endsWith("().")}export{O as a};
10
- //# sourceMappingURL=chunk-RJLU7IMR.js.map
10
+ //# sourceMappingURL=chunk-IICQP2DY.js.map
@@ -1,2 +1,2 @@
1
- import{a as x}from"./chunk-PKAPOFF5.js";import{a as k}from"./chunk-ZXWFN7CK.js";import{b as L}from"./chunk-FLIF3JWA.js";import{b as g}from"./chunk-B75HZHUP.js";import{a as n}from"./chunk-BGBBVSH4.js";import{j as v}from"./chunk-QB5WSOTY.js";import{d as S}from"./chunk-TDGCALH6.js";import{s as a}from"./chunk-M2TRDR25.js";function E(c,f={}){let{scope:P,minLoc:F=3,scanLimit:d}=f,l=new k(c),b=f.semantic!==!1,y=0,m=a("isolated.candidates",()=>{let s=g(l.productionCallableDefinitions({scope:P,minLoc:F,excludeEntrySurfaces:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:typeof d=="number"&&d>0}),d).filter(R=>!x(c,R));return y=s.length,s},()=>({definitions:y})),p=0,i=a("isolated.strict-callees",()=>{let e=l.symbolsWithNonSelfCallees(m,{additive:!1,semantic:!1});return p=e.size,e},()=>({definitions:m.length,symbols:p})),r=m.filter(e=>!i.has(e.symbolId)),C=0,N=a("isolated.scip-callers",()=>{let e=l.crossFileCallerMap(r,{semantic:!1});return C=e.size,e},()=>({definitions:r.length,symbols:C})),o=new Set(N.keys());for(let e of l.frameworkReferencedSymbolIds(r))o.add(e);let t=r.filter(e=>!o.has(e.symbolId));if(b&&t.length>0){for(let e of v(c,t).keys())o.add(e);for(let e of l.symbolsWithNonSelfCallees(t,{additive:!1,semantic:!0}))i.add(e);t=t.filter(e=>!o.has(e.symbolId)).filter(e=>!i.has(e.symbolId))}let h=0,W=a("isolated.source-fallback-callers",()=>{let e=l.sourceFallbackCallerFiles(t,{skipPath:s=>L(s)==="test"});return h=e.size,e},()=>({definitions:t.length,symbols:h}));for(let e of W.keys())o.add(e);let u=t.filter(e=>!o.has(e.symbolId)),I=0,M=a("isolated.additive-callees",()=>{let e=l.symbolsWithNonSelfCallees(u,{additive:!0,semantic:b});return I=e.size,e},()=>({definitions:u.length,symbols:I}));for(let e of M)i.add(e);return u.filter(e=>!i.has(e.symbolId)).sort((e,s)=>n(s)-n(e)||e.relativePath.localeCompare(s.relativePath)||e.startLine-s.startLine).map(e=>({symbol:e.symbol,shortName:S(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:n(e)}))}export{E as a};
2
- //# sourceMappingURL=chunk-J65FQLDL.js.map
1
+ import{a as x}from"./chunk-CIYUFF24.js";import{a as k}from"./chunk-OAM22BCR.js";import{b as L}from"./chunk-CAKPEQZB.js";import{b as g}from"./chunk-B75HZHUP.js";import{a as n}from"./chunk-BGBBVSH4.js";import{j as v}from"./chunk-XAMVIPE2.js";import{d as S}from"./chunk-AYRHVJXW.js";import{s as a}from"./chunk-FC5K7T35.js";function E(c,f={}){let{scope:P,minLoc:F=3,scanLimit:d}=f,l=new k(c),b=f.semantic!==!1,y=0,m=a("isolated.candidates",()=>{let s=g(l.productionCallableDefinitions({scope:P,minLoc:F,excludeEntrySurfaces:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:typeof d=="number"&&d>0}),d).filter(R=>!x(c,R));return y=s.length,s},()=>({definitions:y})),p=0,i=a("isolated.strict-callees",()=>{let e=l.symbolsWithNonSelfCallees(m,{additive:!1,semantic:!1});return p=e.size,e},()=>({definitions:m.length,symbols:p})),r=m.filter(e=>!i.has(e.symbolId)),C=0,N=a("isolated.scip-callers",()=>{let e=l.crossFileCallerMap(r,{semantic:!1});return C=e.size,e},()=>({definitions:r.length,symbols:C})),o=new Set(N.keys());for(let e of l.frameworkReferencedSymbolIds(r))o.add(e);let t=r.filter(e=>!o.has(e.symbolId));if(b&&t.length>0){for(let e of v(c,t).keys())o.add(e);for(let e of l.symbolsWithNonSelfCallees(t,{additive:!1,semantic:!0}))i.add(e);t=t.filter(e=>!o.has(e.symbolId)).filter(e=>!i.has(e.symbolId))}let h=0,W=a("isolated.source-fallback-callers",()=>{let e=l.sourceFallbackCallerFiles(t,{skipPath:s=>L(s)==="test"});return h=e.size,e},()=>({definitions:t.length,symbols:h}));for(let e of W.keys())o.add(e);let u=t.filter(e=>!o.has(e.symbolId)),I=0,M=a("isolated.additive-callees",()=>{let e=l.symbolsWithNonSelfCallees(u,{additive:!0,semantic:b});return I=e.size,e},()=>({definitions:u.length,symbols:I}));for(let e of M)i.add(e);return u.filter(e=>!i.has(e.symbolId)).sort((e,s)=>n(s)-n(e)||e.relativePath.localeCompare(s.relativePath)||e.startLine-s.startLine).map(e=>({symbol:e.symbol,shortName:S(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:n(e)}))}export{E as a};
2
+ //# sourceMappingURL=chunk-IXAALOUP.js.map
@@ -1,4 +1,4 @@
1
- import{h as x,m as k}from"./chunk-VV5WJLRO.js";import he from"better-sqlite3";import{existsSync as bn}from"fs";import{dirname as yn,join as xn,resolve as ye}from"path";import G from"better-sqlite3";import{execFileSync as K}from"child_process";import{existsSync as X,readdirSync as J,readFileSync as B}from"fs";import{extname as m,join as I}from"path";import{readdirSync as we}from"fs";import{execFileSync as Ae}from"child_process";import{extname as De,join as _e}from"path";var H=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],v=[".vue"],V=[".tsx",".jsx"],E=[".vue"],je=[...V,...E],$e=new Set(V),Ue=new Set(E),W=new Set(H.map(e=>e.toLowerCase())),He=[...W].sort().join(","),C=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var We=x("source-files",{clearGroups:[]});function ze(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:n=>q({projectRoot:n.projectRoot,dbPath:n.dbPath,extensions:e.extensions,onStatus:n.onStatus})}}function q(e){let n=new Set((e.extensions??v).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!X(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=k(e.projectRoot),t=Y(e.projectRoot,n).filter(i=>!r.isIgnored(i)),o=new G(e.dbPath);try{let i=Q(o,t),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
1
+ import{h as x,m as k}from"./chunk-MP43RX4O.js";import he from"better-sqlite3";import{existsSync as bn}from"fs";import{dirname as yn,join as xn,resolve as ye}from"path";import G from"better-sqlite3";import{execFileSync as K}from"child_process";import{existsSync as X,readdirSync as J,readFileSync as B}from"fs";import{extname as m,join as I}from"path";import{readdirSync as we}from"fs";import{execFileSync as Ae}from"child_process";import{extname as De,join as _e}from"path";var H=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],v=[".vue"],V=[".tsx",".jsx"],E=[".vue"],je=[...V,...E],$e=new Set(V),Ue=new Set(E),W=new Set(H.map(e=>e.toLowerCase())),He=[...W].sort().join(","),C=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var We=x("source-files",{clearGroups:[]});function ze(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:n=>q({projectRoot:n.projectRoot,dbPath:n.dbPath,extensions:e.extensions,onStatus:n.onStatus})}}function q(e){let n=new Set((e.extensions??v).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!X(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=k(e.projectRoot),t=Y(e.projectRoot,n).filter(i=>!r.isIgnored(i)),o=new G(e.dbPath);try{let i=Q(o,t),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
2
2
  VALUES (?, ?, NULL, ?)`),u=o.transaction(l=>{let d=0;for(let f of l){if(i.has(f))continue;let p=B(I(e.projectRoot,f),"utf-8"),U=s.run(Z(f),f,p);d+=Number(U.changes)}return d})(t),c={scanned:t.length,inserted:u,existing:t.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function Y(e,n){let r=z(e,n);if(r)return r;let t=[],o=i=>{let s=i?I(e,i):e,a;try{a=J(s,{withFileTypes:!0})}catch{return}for(let u of a){if(C.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}n.has(m(u.name).toLowerCase())&&t.push(c)}};return o(""),t.sort()}function z(e,n){try{return K("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
3
3
  `).filter(t=>t&&n.has(m(t).toLowerCase())).sort()}catch{return null}}function Q(e,n){let r=new Set,t=500;for(let o=0;o<n.length;o+=t){let i=n.slice(o,o+t),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function Z(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{readFileSync as en,writeFileSync as nn}from"fs";function tn(e,n){let r=Date.now(),t=e.run(n);return{stageId:e.id,facts:e.facts,durationMs:Date.now()-r,result:t}}function ee(){return{"missing-source-file":0,"missing-service-script":0,"no-definition":0,"same-file-definition":0,"unindexed-definition":0}}function S(){return{skippedReferences:0,skippedReferenceReasons:ee(),skippedReferenceSamples:[]}}function T(e,n){e.skippedReferences+=n.skippedReferences;for(let r of Object.keys(e.skippedReferenceReasons)){e.skippedReferenceReasons[r]+=n.skippedReferenceReasons[r];for(let t of n.skippedReferenceSamples.filter(o=>o.reason===r))e.skippedReferenceSamples.filter(i=>i.reason===r&&i.sourceFile===t.sourceFile).length<2&&e.skippedReferenceSamples.push(t)}}import{createRequire as ne}from"module";import{existsSync as te,readFileSync as b}from"fs";import{dirname as L,extname as re,join as F,relative as oe,resolve as cn}from"path";import{pathToFileURL as ie}from"url";function O(e,n){let{vueCore:r,ts:t,volarTs:o}=se(e),{parsed:i,vueOptions:s}=ae(r,t,n),a=L(n),u=r.createVueLanguagePlugin(t,i.options,s,p=>p),c=ue(r,t,u),l=ce(a,i),{languageServiceHost:d}=o.createLanguageServiceHost(t,t.sys,c,p=>p,l),f=t.createLanguageService(d);return{ts:t,language:c,languageService:f,fileNames:i.fileNames,configDir:a}}function se(e){let n=ne(ie(F(e,"package.json")).href);return{vueCore:R(n,"@vue/language-core",e),ts:R(n,"typescript",e),volarTs:R(n,"@volar/typescript",e)}}function ae(e,n,r){let t=n.readConfigFile(r,n.sys.readFile);if(t.error||!t.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(n,n.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,n.sys.writeFile)),{parsed:n.parseJsonConfigFileContent(t.config,n.sys,L(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:n.ScriptKind.Deferred}))),vueOptions:i}}function ue(e,n,r){let t={},o=e.createLanguage([r],new Map,i=>{if(!te(i))return;let s=b(i,"utf-8");t.current?.scripts.set(i,n.ScriptSnapshot.fromString(s),r.getLanguageId(i)??fe(i))});return t.current=o,o}function ce(e,n){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>n.options,getScriptFileNames:()=>n.fileNames,getProjectReferences:()=>n.projectReferences,getProjectVersion:()=>"0"}}function R(e,n,r){try{return e(n)}catch(t){throw(typeof t=="object"&&t!==null&&"code"in t?t.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${n} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:t}):t}}function w(e,n,r){let t=le(e);return o=>{if(!o.name)return null;let i=g(n,o.fileName),s=r.get(o.fileName);if(!s)return null;let a=r.positionAt(s,o.textSpan.start),u=t.get(i);if(!u)return null;let c=u.starts.find(d=>d.line===a.line&&d.displayName===o.name);if(c)return c.symbolId;let l=u.containingByLine.get(a.line);return l&&l.displayName===o.name?l.symbolId:de(u.starts,a.line,2,o.name)}}function le(e){let n=e.prepare(`
4
4
  SELECT
@@ -13,4 +13,4 @@ import{h as x,m as k}from"./chunk-VV5WJLRO.js";import he from"better-sqlite3";im
13
13
  ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
14
14
  `).all(),r=new Map;for(let t of n){let o=r.get(t.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(t.relativePath,o)),o.starts.push({line:t.startLine,symbolId:t.symbolId,displayName:t.displayName});for(let i=t.startLine;i<=t.endLine;i++)o.containingByLine.set(i,{symbolId:t.symbolId,displayName:t.displayName})}for(let t of r.values())t.starts.sort((o,i)=>o.line-i.line);return r}function de(e,n,r,t){let o=0,i=e.length-1;for(;o<=i;){let a=Math.floor((o+i)/2);e[a].line<n?o=a+1:i=a-1}let s=null;for(let a of[i,o]){let u=e[a];if(!u||u.displayName!==t)continue;let c=Math.abs(u.line-n);c>r||(!s||c<s.distance)&&(s={distance:c,symbolId:u.symbolId})}return s?.symbolId??null}function N(e,n){let r=me(n),t=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=Se(t,r,n,i);return o.set(i,s),s}}}function A(e,n,r,t,o){if(e.fileName.endsWith(".vue")){let i=t.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=t.language.maps.get(s,i);if(h(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return n(e)}function*P(e){let n=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),t;for(;t=n.exec(e);){let o=t[0];r.has(o)||(yield{text:o,start:t.index,end:t.index+o.length})}}function D(e,n){for(let[r]of e.toGeneratedLocation(n,t=>!!t.navigation))return r;return null}function h(e,n){let r=e;for(let[t]of r.toSourceLocation(n,o=>!!o.navigation))return t;return null}function ge(e,n){let r=0,t=e.lineStarts.length-1;for(;r<=t;){let i=Math.floor((r+t)/2);e.lineStarts[i]<=n?r=i+1:t=i-1}let o=Math.max(0,t);return{line:o,character:n-e.lineStarts[o]}}function _(e,n){return g(e,n).startsWith("node_modules/")}function g(e,n){return oe(e,n).replaceAll("\\","/")}function fe(e){switch(re(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function M(){let e=new Map;return{get(n){if(e.has(n))return e.get(n)??null;try{let r=b(n,"utf-8"),t={text:r,lineStarts:pe(r)};return e.set(n,t),t}catch{return e.set(n,null),null}},positionAt:ge}}function pe(e){let n=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&n.push(r+1);return n}function me(e){try{let n=JSON.parse(b(F(e,"package.json"),"utf-8"));return{name:n.name??"workspace",version:n.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Se(e,n,r,t){let o=g(r,t),i=Re(n.name,n.version,o);return e.get(i)?.id??null}function Re(e,n,r){let t=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${n} ${t}/default.`}function Vn(e){let n=ye(e.projectRoot,e.tsconfig),r=new he(e.dbPath,{readonly:!0});try{let t=xe({db:r,projectRoot:e.projectRoot,configPath:n,vueSymbolLookup:N(r,e.projectRoot)});return ke({vueFiles:e.vueFiles??[],tasks:e.tasks,...t})}finally{r.close()}}function xe(e){let n=M();return{projectRoot:e.projectRoot,context:O(e.projectRoot,e.configPath),symbolLookup:w(e.db,e.projectRoot,n),vueSymbolLookup:e.vueSymbolLookup,sourceReader:n}}function ke(e){let n=[],r=S(),t=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of t){let i=ve(e,o);n.push(...i.occurrences),T(r,i)}return{occurrences:n,...r}}function ve(e,n){let r=e.sourceReader.get(n.fileName);if(!r)return j(e.projectRoot,n,"missing-source-file");let t=e.context.language.scripts.get(n.fileName),o=t?.generated?.languagePlugin.typescript?.getServiceScript(t.generated.root)?.code;if(!t||!o)return j(e.projectRoot,n,"missing-service-script");let i=e.context.language.maps.get(o,t),s=g(e.projectRoot,n.fileName),a=[...P(r.text)],u={tokens:a.filter(c=>c.start>=n.startOffset&&c.start<n.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:Te(a),processedStarts:new Set};return Ve({...e,fileName:n.fileName,sourceInfo:r,sourceFile:s,map:i,tokenContext:u})}function Ve(e){let n=[],r=S();for(let t of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(t.start)||Ee(e.sourceInfo.text,t.start))continue;let o=D(e.map,t.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(l=>!_(e.projectRoot,l.fileName));if(!s){y(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,"no-definition");continue}let a=g(e.projectRoot,s.fileName),u=Ce(e.sourceFile,t.text,a);if(u){y(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,u);continue}let c=A(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(c===null){y(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,"unindexed-definition");continue}$(n,e.sourceReader,e.sourceInfo,e.sourceFile,t,a,c),e.tokenContext.processedStarts.add(t.start),Ie(n,e,t,o,a,c)}return{occurrences:n,...r}}function Ee(e,n){let r=e.lastIndexOf(`
15
15
  `,n-1)+1,t=e.slice(r,n);return/\bfrom\s+['"][^'"]*$/.test(t)||/\bimport\s*\(\s*['"][^'"]*$/.test(t)}function Ce(e,n,r){return r===e?"same-file-definition":r.endsWith(".vue")&&n!==r.split("/").at(-1)?.replace(/\.vue$/,"")?"unindexed-definition":null}function j(e,n,r){let t=S();return n.countFileSkip&&(t.skippedReferences=1,t.skippedReferenceReasons[r]=1,t.skippedReferenceSamples.push({sourceFile:g(e,n.fileName),sourceLine:0,sourceStartChar:0,sourceEndChar:0,token:"",reason:r})),{occurrences:[],...t}}function y(e,n,r,t,o,i){if(e.skippedReferences++,e.skippedReferenceReasons[i]++,e.skippedReferenceSamples.filter(a=>a.reason===i&&a.sourceFile===t).length>=2)return;let s=n.positionAt(r,o.start);e.skippedReferenceSamples.push({sourceFile:t,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,token:o.text,reason:i})}function Ie(e,n,r,t,o,i){if(!((n.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let s of Le(n.context.languageService,n.fileName,t+1,n.map,r,n.tokenContext.tokenByStart)){if(n.tokenContext.processedStarts.has(s))continue;let a=n.tokenContext.tokenByStart.get(s);a&&($(e,n.sourceReader,n.sourceInfo,n.sourceFile,a,o,i),n.tokenContext.processedStarts.add(s))}}function $(e,n,r,t,o,i,s){let a=n.positionAt(r,o.start);e.push({sourceFile:t,sourceLine:a.line,sourceStartChar:a.character,sourceEndChar:a.character+o.text.length,sourceToken:o.text,definitionFile:i,symbolId:s})}function Te(e){let n=new Map;for(let r of e)n.set(r.text,(n.get(r.text)??0)+1);return n}function Le(e,n,r,t,o,i){let s=e.getDocumentHighlights?.(n,r,[n])??[],a=[];for(let u of s)if(u.fileName===n)for(let c of u.highlightSpans){let l=Fe(t,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function Fe(e,n,r,t){let o=r.get(n);if(o?.text===t)return o.start;let i=h(e,n);if(i===null)return null;let s=r.get(i);return s?.text===t?s.start:null}export{ze as a,tn as b,Vn as c};
16
- //# sourceMappingURL=chunk-XDVT7QPG.js.map
16
+ //# sourceMappingURL=chunk-J4MYRIYT.js.map
@@ -1,2 +1,2 @@
1
- import{A as l,z as c}from"./chunk-M2TRDR25.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
2
- //# sourceMappingURL=chunk-TAB7AWKO.js.map
1
+ import{A as l,z as c}from"./chunk-FC5K7T35.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
2
+ //# sourceMappingURL=chunk-J5XJWCB3.js.map
@@ -1,4 +1,4 @@
1
- import{c as d}from"./chunk-F334Z5UA.js";import{n as f}from"./chunk-UVMME4FI.js";import{d as r,t as m}from"./chunk-TDGCALH6.js";function g(o,t={}){let{limit:n=30,scope:e}=t,s=e?"AND def_d.relative_path LIKE ?":"",c=e?[`%${e}%`]:[],l=o.all(`SELECT
1
+ import{c as d}from"./chunk-PLDIXTKR.js";import{n as f}from"./chunk-YGBHQOB2.js";import{d as r,t as m}from"./chunk-AYRHVJXW.js";function g(o,t={}){let{limit:n=30,scope:e}=t,s=e?"AND def_d.relative_path LIKE ?":"",c=e?[`%${e}%`]:[],l=o.all(`SELECT
2
2
  gs.symbol,
3
3
  COUNT(*) AS ref_count,
4
4
  COUNT(DISTINCT ref_d.id) AS file_count,
@@ -23,4 +23,4 @@ import{c as d}from"./chunk-F334Z5UA.js";import{n as f}from"./chunk-UVMME4FI.js";
23
23
  GROUP BY gs.id
24
24
  ORDER BY ref_count DESC
25
25
  LIMIT ?`,...c,n).filter(i=>!o.isIgnored(i.defined_in)).map(i=>({symbol:i.symbol,shortName:r(i.symbol),refCount:i.ref_count,fileCount:i.file_count,definedIn:i.defined_in}));return l.length>0?l:u(o,e,n)}function u(o,t,n){return m(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>a(o,e)).filter(e=>e.refCount>0).sort((e,s)=>s.refCount-e.refCount||s.fileCount-e.fileCount).slice(0,n)}function a(o,t){let e=d(o,t,{limit:500,semanticEvidence:f}).filter(s=>s.file!==t.relativePath);return{symbol:t.symbol,shortName:r(t.symbol),refCount:e.length,fileCount:new Set(e.map(s=>s.file)).size,definedIn:t.relativePath}}export{g as a};
26
- //# sourceMappingURL=chunk-DWN7QDTV.js.map
26
+ //# sourceMappingURL=chunk-JFO2UVQP.js.map
@@ -1,2 +1,2 @@
1
- import{c as a}from"./chunk-B75HZHUP.js";import{a as g,c as S}from"./chunk-F334Z5UA.js";import{m as b,n as m}from"./chunk-UVMME4FI.js";import{a as y}from"./chunk-UXOVHGT6.js";import{d as n}from"./chunk-TDGCALH6.js";function N(i,t,r={}){let o=y(i,t);if(!o)return null;let c=[{file:o.relativePath,line:o.startLine}],s=b(i,o,{semantic:r.semantic,semanticEvidence:m}).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?n(e.enclosingSymbol):"(top-level)"})),{producers:f,consumers:l}=p(i,o,s,{semantic:r.semantic!==!1});return{symbol:o.symbol,shortName:n(o.symbol),relativePath:o.relativePath,definitionSites:c.filter(e=>!i.isIgnored(e.file)),usageSites:s,producers:f.filter(e=>!i.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:n(e.symbol),file:e.file})),consumers:l.filter(e=>!i.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":n(e.symbol),file:e.file}))}}function p(i,t,r,o){let c=a(g(i,t,{limit:30,semantic:o.semantic,semanticEvidence:m}).map(l=>({symbol:l.symbol,file:l.file}))),s=a(S(i,t,{limit:30,semantic:o.semantic,semanticEvidence:m})),f=s.length>0?s:a(r.map(l=>({symbol:l.enclosingSymbol==="(top-level)"?l.file:l.enclosingSymbol,file:l.file})));return{producers:c,consumers:f}}export{N as a};
2
- //# sourceMappingURL=chunk-FMC3BI4I.js.map
1
+ import{c as a}from"./chunk-B75HZHUP.js";import{a as g,c as S}from"./chunk-PLDIXTKR.js";import{m as b,n as m}from"./chunk-YGBHQOB2.js";import{a as y}from"./chunk-HFBNIIZX.js";import{d as n}from"./chunk-AYRHVJXW.js";function N(i,t,r={}){let o=y(i,t);if(!o)return null;let c=[{file:o.relativePath,line:o.startLine}],s=b(i,o,{semantic:r.semantic,semanticEvidence:m}).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?n(e.enclosingSymbol):"(top-level)"})),{producers:f,consumers:l}=p(i,o,s,{semantic:r.semantic!==!1});return{symbol:o.symbol,shortName:n(o.symbol),relativePath:o.relativePath,definitionSites:c.filter(e=>!i.isIgnored(e.file)),usageSites:s,producers:f.filter(e=>!i.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:n(e.symbol),file:e.file})),consumers:l.filter(e=>!i.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":n(e.symbol),file:e.file}))}}function p(i,t,r,o){let c=a(g(i,t,{limit:30,semantic:o.semantic,semanticEvidence:m}).map(l=>({symbol:l.symbol,file:l.file}))),s=a(S(i,t,{limit:30,semantic:o.semantic,semanticEvidence:m})),f=s.length>0?s:a(r.map(l=>({symbol:l.enclosingSymbol==="(top-level)"?l.file:l.enclosingSymbol,file:l.file})));return{producers:c,consumers:f}}export{N as a};
2
+ //# sourceMappingURL=chunk-JRCJEHRG.js.map
@@ -1,4 +1,4 @@
1
- import{a as O}from"./chunk-P5XHIJHI.js";import{d as P,v as E,x as M}from"./chunk-M2TRDR25.js";import{execFileSync as U}from"child_process";var j=2e3,S=50,J=64,Y=8,V=3,W=2160*60*60,X=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,Z=3,Q=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,q=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function tt(t){let e=P(t,{clearGroups:["whole-project"]});return(i,n,r)=>{let o=r??H(i.config.projectRoot);if(!o)return null;let s=e.has(i)?e.get(i,()=>({head:"",value:null})):null;return s&&s.head===o?s.value:(e.invalidate(i),e.get(i,()=>({head:o,value:n(i.config.projectRoot,o)})).value)}}function F(t){let e=P(t,{clearGroups:["whole-project"]});return(i,n,r,o)=>{let s=o??H(i.config.projectRoot);if(!s)return null;let c=e.has(i)?e.get(i,()=>({head:"",values:new Map})):null;(!c||c.head!==s)&&e.invalidate(i);let l=e.get(i,()=>({head:s,values:new Map}));if(l.values.has(n))return l.values.get(n)??null;let d=r(i.config.projectRoot,s);return l.values.set(n,d),d}}var et=F("git-commit-history");function nt(t,e={}){let i=e.historyMode??"bounded",n=e.head;return{capability:r=>it(t,r,n),commitHistory:()=>x(t,i,n),fileChurn:()=>st(t,i,n),changeAmplification:()=>at(t,i,n),trackedFiles:()=>lt(t,n),fileAddRecords:()=>dt(t,i,n),coChangePairs:(r={})=>bt(t,r,i,n),coChangePairsForFiles:(r,o={})=>L(t,r,o,i,n),directionalCoChangePairsForFiles:(r,o={})=>yt(t,r,o,i,n)}}function x(t,e="bounded",i){return et(t,y(e),(n,r)=>rt(n,r,e),i)}function it(t,e,i){let n=i??H(t.config.projectRoot);return n?{slot:e,available:!0,head:n}:{slot:e,available:!1,head:null,reason:"git history is unavailable for this project"}}function H(t){try{return C(t,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(t,e){return U("git",["-C",t,...e],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function rt(t,e,i){let n;try{n=C(t,["log","--no-merges","--name-only",...R(i),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:e,...w(n,S)}}function ot(t){return X.test(t.subject)}function st(t,e,i){let n=x(t,e,i);if(!n)return null;let r=new Map;for(let o of n.commits){let s=ot(o);for(let c of o.files){let l=r.get(c)??{changes:0,fixChanges:0,lastChangedAt:0};l.changes+=1,s&&(l.fixChanges+=1),o.timestamp>l.lastChangedAt&&(l.lastChangedAt=o.timestamp),r.set(c,l)}}return r}function at(t,e,i){let n=x(t,e,i);if(!n||n.commits.length===0)return null;let r=n.commits.map(o=>o.files.length).filter(o=>o>0).sort((o,s)=>o-s);return r.length===0?null:{medianFilesPerCommit:_(r,.5),p90FilesPerCommit:_(r,.9),commitsAnalyzed:r.length}}function _(t,e){let i=Math.min(t.length-1,Math.floor(t.length*e));return t[i]}var ct=tt("git-tracked-files");function lt(t,e){return ct(t,i=>{try{let n=C(i,["ls-files"]);return new Set(n.split(`
1
+ import{a as O}from"./chunk-P5XHIJHI.js";import{d as P,v as E,x as M}from"./chunk-FC5K7T35.js";import{execFileSync as U}from"child_process";var j=2e3,S=50,J=64,Y=8,V=3,W=2160*60*60,X=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,Z=3,Q=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,q=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function tt(t){let e=P(t,{clearGroups:["whole-project"]});return(i,n,r)=>{let o=r??H(i.config.projectRoot);if(!o)return null;let s=e.has(i)?e.get(i,()=>({head:"",value:null})):null;return s&&s.head===o?s.value:(e.invalidate(i),e.get(i,()=>({head:o,value:n(i.config.projectRoot,o)})).value)}}function F(t){let e=P(t,{clearGroups:["whole-project"]});return(i,n,r,o)=>{let s=o??H(i.config.projectRoot);if(!s)return null;let c=e.has(i)?e.get(i,()=>({head:"",values:new Map})):null;(!c||c.head!==s)&&e.invalidate(i);let l=e.get(i,()=>({head:s,values:new Map}));if(l.values.has(n))return l.values.get(n)??null;let d=r(i.config.projectRoot,s);return l.values.set(n,d),d}}var et=F("git-commit-history");function nt(t,e={}){let i=e.historyMode??"bounded",n=e.head;return{capability:r=>it(t,r,n),commitHistory:()=>x(t,i,n),fileChurn:()=>st(t,i,n),changeAmplification:()=>at(t,i,n),trackedFiles:()=>lt(t,n),fileAddRecords:()=>dt(t,i,n),coChangePairs:(r={})=>bt(t,r,i,n),coChangePairsForFiles:(r,o={})=>L(t,r,o,i,n),directionalCoChangePairsForFiles:(r,o={})=>yt(t,r,o,i,n)}}function x(t,e="bounded",i){return et(t,y(e),(n,r)=>rt(n,r,e),i)}function it(t,e,i){let n=i??H(t.config.projectRoot);return n?{slot:e,available:!0,head:n}:{slot:e,available:!1,head:null,reason:"git history is unavailable for this project"}}function H(t){try{return C(t,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(t,e){return U("git",["-C",t,...e],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function rt(t,e,i){let n;try{n=C(t,["log","--no-merges","--name-only",...R(i),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:e,...w(n,S)}}function ot(t){return X.test(t.subject)}function st(t,e,i){let n=x(t,e,i);if(!n)return null;let r=new Map;for(let o of n.commits){let s=ot(o);for(let c of o.files){let l=r.get(c)??{changes:0,fixChanges:0,lastChangedAt:0};l.changes+=1,s&&(l.fixChanges+=1),o.timestamp>l.lastChangedAt&&(l.lastChangedAt=o.timestamp),r.set(c,l)}}return r}function at(t,e,i){let n=x(t,e,i);if(!n||n.commits.length===0)return null;let r=n.commits.map(o=>o.files.length).filter(o=>o>0).sort((o,s)=>o-s);return r.length===0?null:{medianFilesPerCommit:_(r,.5),p90FilesPerCommit:_(r,.9),commitsAnalyzed:r.length}}function _(t,e){let i=Math.min(t.length-1,Math.floor(t.length*e));return t[i]}var ct=tt("git-tracked-files");function lt(t,e){return ct(t,i=>{try{let n=C(i,["ls-files"]);return new Set(n.split(`
2
2
  `).map(r=>r.trim()).filter(r=>r!==""))}catch{return null}},e)}var ut=F("git-file-adds"),D="__git__/file-adds",k=E({kind:"git-file-adds",invalidation:M("git-file-adds"),serialize:gt,deserialize:ft});function Ot(t){return nt(t).fileAddRecords()}function dt(t,e,i){let n=y(e);return ut(t,n,(r,o)=>mt(t,r,o,e),i)}function mt(t,e,i,n){let r=k.read(t,I(n),i);if(r)return r;let o=ht(e,n);return o&&k.write(t,I(n),i,o),o}function gt(t){return JSON.stringify([...t.entries()])}function ft(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let i=new Map;for(let n of e){if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string")return null;let r=n[1];if(!r||typeof r.commitsAgo!="number"||!Number.isFinite(r.commitsAgo)||typeof r.addedAt!="number"||!Number.isFinite(r.addedAt))return null;i.set(n[0],{commitsAgo:r.commitsAgo,addedAt:r.addedAt})}return i}catch{return null}}function ht(t,e){let i;try{i=C(t,["log","--no-merges","--find-renames","--name-status",...R(e),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,r=new Map,o=-1;for(let s of i.split("")){if(s.trim()==="")continue;o+=1;let c=s.indexOf(`
3
3
  `),l=c>=0?s.slice(0,c):s,[,d]=l.split("\0"),f=Number(d)||0;if(!(c<0))for(let u of s.slice(c+1).split(`
4
4
  `)){let a=pt(u);if(!a)continue;if(a.status==="R"&&a.from&&a.to){let p=r.get(a.to)??new Set([a.to]);r.set(a.from,p);continue}if(a.status!=="A"||!a.to)continue;let m={commitsAgo:o,addedAt:f};n.set(a.to,m);for(let p of r.get(a.to)??[])n.set(p,m)}}return n}function pt(t){let e=t.trim().split(" "),i=e[0]??"";if(!i)return null;let n=i[0]??"";if(n==="R"){let o=e[1],s=e[2];return o&&s?{status:n,from:o,to:s}:null}let r=e[1];return r?{status:n,to:r}:null}var z=F("git-co-change-pairs"),Ct=F("git-directional-co-change-pairs");function bt(t,e,i,n){let r=`all\0${y(i)}\0${T(e)}`,o=z(t,r,()=>{let s=x(t,i,n);return s?G(s,e):null},n);return o&&[...o]}function L(t,e,i,n,r){if(e.size===0)return[];let o=`files\0${y(n)}\0${N(e)}\0${T(i)}`,s=z(t,o,()=>{let c=x(t,n,r);return c?G(c,i,e):null},r);return s&&[...s]}function yt(t,e,i,n,r){if(e.size===0)return[];let o=i.maxFilesPerCommit??S;if(e.size>J)return L(t,e,i,n,r);let s=`directional\0${y(n)}\0${N(e)}\0${T({...i,maxFilesPerCommit:o})}`,c=Ct(t,s,(l,d)=>{let f=At(l,d,e,o,n);return f?G(f,i,e):null},r);return c&&[...c]}function T(t){let e=t.minTogether??4,i=t.minConfidence??.6,n=t.maxFilesPerCommit??S;return`${e}\0${i}\0${n}`}function N(t){return[...t].sort().join("\0")}function G(t,e,i){let{minTogether:n=4,minConfidence:r=.6,maxFilesPerCommit:o=S}=e,s=new Map,c=new Map,l=t.newestAnalyzedAt??0;for(let u of t.commits){let a=[...new Set(u.files)].sort();if(a.length>o)continue;t.newestAnalyzedAt===void 0&&u.timestamp>l&&(l=u.timestamp);let m=Ft(a),p=i===void 0||a.some(g=>i.has(g));for(let g of a)s.set(g,(s.get(g)??0)+1);if(p)for(let g=0;g<a.length;g++)for(let b=g+1;b<a.length;b++){if(i&&!i.has(a[g])&&!i.has(a[b]))continue;let A=`${a[g]}\0${a[b]}`,h=c.get(A)??{together:0,focusedTogether:0,broadTogether:0,lastTogetherAt:0,timestamps:[],subjects:[]};h.together+=1,m?h.broadTogether+=1:h.focusedTogether+=1,u.timestamp>h.lastTogetherAt&&(h.lastTogetherAt=u.timestamp),h.timestamps.push(u.timestamp),h.subjects.push(u.subject),c.set(A,h)}}let d=[],f=l-W;for(let[u,a]of c){let m=a.together;if(m<n)continue;let[p,g]=u.split("\0"),b=s.get(p)??m,A=s.get(g)??m,h=Math.max(m/b,m/A);if(h<r)continue;let $=a.broadTogether/m,v=a.timestamps.filter(K=>K>=f).length;d.push({fileA:p,fileB:g,together:m,confidence:h,changesA:b,changesB:A,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:$,lastTogetherAt:a.lastTogetherAt,recentTogether:v,commitScope:Pt(a.broadTogether,m),recency:v>0?"recent":"stale",subjectContext:Ht(a.subjects)})}return d.sort((u,a)=>a.together-u.together||a.confidence-u.confidence||u.fileA.localeCompare(a.fileA)),d}function At(t,e,i,n,r){let o;try{o=xt(t,r)}catch{return null}if(o.length===0)return{head:e,commits:[],skippedBulkCommits:0,newestAnalyzedAt:0};let s;try{s=C(t,["log","--no-merges","--format=%H",...R(r),"--",...[...i].sort()])}catch{return null}let c=new Set(o.map(a=>a.hash)),l=s.split(`
@@ -6,4 +6,4 @@ import{a as O}from"./chunk-P5XHIJHI.js";import{d as P,v as E,x as M}from"./chunk
6
6
  `).map(n=>n.trim()).filter(n=>n!=="").map(n=>{let[r,o]=n.split("\0");return{hash:r??"",timestamp:Number(o)||0}}).filter(n=>n.hash!=="")}function R(t){return t==="full"?[]:["-n",String(B())]}function B(){return O(process.env.SCIP_QUERY_GIT_HISTORY_MAX_COMMITS)??j}function y(t){return t==="full"?"full":`bounded:${B()}`}function I(t){let e=y(t);return e===`bounded:${j}`?D:`${D}:${e}`}function St(t,e,i){for(let r=0;r<e.length;r+=20){let o=e.slice(r,r+20),s;try{s=C(t,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...o.map(l=>l.hash)])}catch{return e[0]?.timestamp??0}let c=w(s,i);if(c.commits.length>0)return c.commits[0].timestamp}return 0}function w(t,e){let i=[],n=0;for(let r of t.split("")){if(r.trim()==="")continue;let o=r.indexOf(`
7
7
  `),s=o>=0?r.slice(0,o):r,[c,l,d]=s.split("\0");if(!c||!l)continue;let f=o>=0?r.slice(o+1).split(`
8
8
  `).map(u=>u.trim()).filter(u=>u!==""):[];if(f.length>e){n+=1;continue}i.push({hash:c,timestamp:Number(l)||0,subject:d??"",files:f})}return{commits:i,skippedBulkCommits:n}}function Ft(t){return t.length>=Y?!0:Rt(t).size>=V}function Rt(t){let e=new Set;for(let i of t){let n=i.indexOf("/");e.add(n>=0?i.slice(0,n):".")}return e}function Pt(t,e){return t===0?"focused":t/e>=.5?"broad-sweep":"mixed"}function Ht(t){let e=new Set,i=[],n=[];for(let r of t){!n.includes(r)&&n.length<Z&&n.push(r);for(let o of Tt(r))e.add(o);for(let o of r.match(Q)??[])i.includes(o)||i.push(o)}return{subjectLabels:[...e].sort(),issueRefs:i,sampleSubjects:n,externalIssueLabelStatus:"unavailable"}}function Tt(t){let e=new Set,i=q.exec(t)?.[1]?.toLowerCase();return i&&e.add(Gt(i)),/\b(?:feat|feature)\b/i.test(t)&&e.add("feature"),/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i.test(t)&&e.add("fix"),/\b(?:docs?|documentation|guide|readme)\b/i.test(t)&&e.add("docs"),/\brefactor(?:ing|ed)?\b/i.test(t)&&e.add("refactor"),/\btests?\b/i.test(t)&&e.add("test"),/\b(?:release|version|v\d+\.\d+)\b/i.test(t)&&e.add("release"),/\bchore\b/i.test(t)&&e.add("chore"),/\bbuild\b/i.test(t)&&e.add("build"),/\bci\b/i.test(t)&&e.add("ci"),/\bperf(?:ormance)?\b/i.test(t)&&e.add("perf"),[...e]}function Gt(t){return t==="feat"?"feature":t}export{nt as a,C as b,Ot as c};
9
- //# sourceMappingURL=chunk-4XTPZ5CR.js.map
9
+ //# sourceMappingURL=chunk-KMOMNTB4.js.map
@@ -1,3 +1,3 @@
1
1
  import{execFileSync as k,spawnSync as H}from"child_process";import{platform as C}from"os";var y=C()==="win32";function j(t){let e=y?"where":"which";try{return k(e,[t],{stdio:"pipe"}),!0}catch{return!1}}var R=/\.(?:c|m)?js$/i,b=/\.(?:exe|com)$/i;function z(t,e){return R.test(t)?{binary:process.execPath,args:[t,...e]}:{binary:t,args:[...e]}}function w(t,e){return k(t,e,{stdio:["ignore","pipe","ignore"],encoding:"utf8"})}function F(t,e={}){let r=e.isWindows??y,i=e.lookup??w,n;try{n=i(r?"where":"which",[t])}catch{return null}let o=n.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);return r?o.find(s=>b.test(s))??null:o[0]??null}import{spawnSync as v}from"child_process";import{createHash as W}from"crypto";import{existsSync as E,lstatSync as D,realpathSync as I}from"fs";import{dirname as O,isAbsolute as S,join as A,resolve as c}from"path";var p={run(t,e){let r=h(t,e);return r.kind==="success"?r.output:void 0},runResult:h},T=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],G=/^[0-9a-f]{40,64}$/;function q(t,e=p){let r=e.runResult(t,T);if(r.kind==="success"){let i=_(r.output);if(i)return N(i,e)}return P(t,e)}function _(t){let e=t.split(`
2
2
  `).map(l=>l.trim());if(e.length!==5)return;let[r,i,n,o,s]=e;if(!r||!i||!n||!o||!s||!G.test(o)||!G.test(s))return;let d=u(r);return{root:d,gitDir:u(a(d,i)),commonDir:u(a(d,n)),headCommit:o,treeOid:s}}function N(t,e){let r=e.run(t.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...x(t.root,t.gitDir),commonDir:t.commonDir,repositoryId:g("repository",t.commonDir),headCommit:t.headCommit,treeOid:t.treeOid,clean:r.length===0}}function P(t,e){let r=B(t,e);if(r.kind!=="worktree")return;let i=r.identity,n=i.projectRoot,o=e.run(n,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=u(a(n,o)),d=f(e.run(n,["rev-parse","--verify","HEAD"])),l=f(e.run(n,["rev-parse","--verify","HEAD^{tree}"])),m=e.run(n,["status","--porcelain=v1","-z","--untracked-files=all"]);if(m!==void 0)return{...i,commonDir:s,repositoryId:g("repository",s),headCommit:d,treeOid:l,clean:m.length===0}}function B(t,e=p){let r=e.runResult(t,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let i=r.output.trim();if(!i)return{kind:"error",message:"Git returned an empty worktree root."};let n=u(i),o=e.run(n,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=u(a(n,o));return{kind:"worktree",identity:x(n,s)}}function x(t,e){return{projectRoot:t,gitDir:e,worktreeId:g("worktree",`${t}\0${e}`)}}function Q(t,e,r=p){return f(r.run(t,e))}function a(t,e){return S(e)?e:c(t,e)}function u(t){try{return I(t)}catch{return c(t)}}function g(t,e){return W("sha256").update(`${t}\0${e}`).digest("hex").slice(0,24)}function f(t){return t?.trim()||void 0}function h(t,e){let r=v("git",["-C",t,...e],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"]});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let n=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,o=r.error?.code;return(/not a git repository/i.test(n)||o==="ENOENT"&&E(c(t)))&&!M(t)?{kind:"not-repository"}:{kind:"error",message:n}}function M(t){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let e=c(t);for(;;){try{return D(A(e,".git")),!0}catch(i){let n=i.code;if(n!=="ENOENT"&&n!=="ENOTDIR")return!0}let r=O(e);if(r===e)return!1;e=r}}export{j as a,z as b,F as c,q as d,Q as e,a as f,u as g};
3
- //# sourceMappingURL=chunk-ZL5Y23AJ.js.map
3
+ //# sourceMappingURL=chunk-LM72NQ7T.js.map
@@ -1,4 +1,4 @@
1
- import{b as l}from"./chunk-DV6B262O.js";import{a}from"./chunk-ZXWFN7CK.js";import{d as i,g as n}from"./chunk-TDGCALH6.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
1
+ import{b as l}from"./chunk-SJ6XSCG7.js";import{a}from"./chunk-OAM22BCR.js";import{d as i,g as n}from"./chunk-AYRHVJXW.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-DV6B262O.js";import{a}from"./chunk-ZXWFN7CK.js";impor
26
26
  AND ${e.localSymbolPredicate}
27
27
  ${e.pathExclusionsFor("d1")}
28
28
  ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
29
- //# sourceMappingURL=chunk-4ZHJAHLE.js.map
29
+ //# sourceMappingURL=chunk-LSJDKJIB.js.map
@@ -64,4 +64,4 @@ Thumbs.db
64
64
  ${n}
65
65
  ${o}
66
66
  ORDER BY relative_path`,...i).map(a=>a.relative_path),s=t.extensions?r.filter(a=>t.extensions.some(c=>a.toLowerCase().endsWith(c.toLowerCase()))):r;return t.includeIgnored===!1?s.filter(a=>!e.isIgnored(a)):s}export{V as a,ce as b,le as c,R as d,B as e,ye as f,d as g,ke as h,ve as i,De as j,ae as k,we as l,Ce as m};
67
- //# sourceMappingURL=chunk-VV5WJLRO.js.map
67
+ //# sourceMappingURL=chunk-MP43RX4O.js.map
@@ -4,4 +4,4 @@ import d from"process";import{existsSync as J,readFileSync as Re}from"fs";import
4
4
  \r
5
5
  ${e}`}function oe(t){let e=JSON.parse(t);if(!e||typeof e!="object")throw new Error("rust-analyzer LSP response was not a JSON object");return e}function ae(t,e){return`rust-analyzer LSP transport closed${e?` by ${e}`:t===null?"":` with code ${t}`}`}async function j(t,e,r,n=Date.now){let i=r-n();if(i<=0)throw new l("rust-analyzer readiness deadline expired before quiescence");try{let s=await t.waitForQuiescence(e,i);if(w(r,n,"during quiescence"),s.health==="error")throw new l("rust-analyzer reported error health before reaching readiness");if(!s.quiescent)throw new l("rust-analyzer did not report quiescence before reaching readiness");return s}catch(s){throw s instanceof l?s:new l(s instanceof Error?s.message:String(s))}}async function Ge(t,e,r,n,i,s=Date.now,u=x){let a=await j(t,e,n,s);if(r===0)return a;let c=t.serverStatusSnapshot();if(!c)throw new l("rust-analyzer status is unavailable after initial document open");return await ue(t,c,r,n,i,s,u)??a}async function ue(t,e,r,n,i,s=Date.now,u=x){if(r===0)return null;if(!e)throw new l("rust-analyzer status is unavailable before document open");E(e.status,"before document open");try{await t.readinessBarrier({deadlineMs:n}),w(n,s,"during post-open synchronization")}catch(f){throw f instanceof l?f:new l(f instanceof Error?f.message:String(f))}let a=t.serverStatusSnapshot();if(!a||a.generation<e.generation)throw new l("rust-analyzer status is unavailable after document open");let c;return a.generation===e.generation?(E(a.status,"after document open"),c=a.status):c=await j(t,e.generation,n,s),await P(i,n,s,u),c}async function Qe(t,e,r,n=Date.now){let i=R(e,r,n);await t(i.timeoutMs),w(r,n,"during diagnostics")}async function P(t,e,r=Date.now,n=x){if(t<=0)return;if(R(t,e,r).deadlineLimited)throw new l("rust-analyzer readiness deadline cannot accommodate delay");await n(t),w(e,r,"during delay")}async function Ke(t,e){try{return await t()}catch(r){throw r instanceof l&&await e(),r}}function Ve(t){return t instanceof l?{ok:!1,error:t.message}:null}function w(t,e,r){if(t-e()<=0)throw new l(`rust-analyzer readiness deadline expired ${r}`)}function E(t,e){if(t.health==="error")throw new l(`rust-analyzer reported error health ${e}`);if(!t.quiescent)throw new l(`rust-analyzer did not report quiescence ${e}`)}function x(t){return new Promise(e=>setTimeout(e,t))}import{existsSync as le,readFileSync as ce}from"fs";import{relative as fe,resolve as H,sep as de}from"path";import{fileURLToPath as pe,pathToFileURL as me}from"url";function b(t,e){return me(H(t,e)).href}function C(t,e){let r=pe(e);return fe(t,r).split(de).join("/")}function S(t,e,r){return{textDocument:{uri:b(t,e.relativePath)},position:ye(t,e),context:{includeDeclaration:r}}}function ye(t,e){let r={line:e.startLine,character:e.startChar??0},n=H(t,e.relativePath);if(!le(n))return r;try{return he(ce(n,"utf8"),e,r)}catch{return r}}function he(t,e,r={line:e.startLine,character:e.startChar??0}){let n=t.split(/\r?\n/),i=n[e.startLine];if(i===void 0||e.leaf.length===0)return r;let s=Math.max(0,Math.min(r.character,i.length)),u=i.indexOf(e.leaf,s);if(u>=0)return{line:e.startLine,character:A(u,e.leaf)};let a=i.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:A(a,e.leaf)};let c=ge(n,e.startLine,e.leaf);return c||r}function A(t,e){return t+Math.max(0,e.length-2)}function ge(t,e,r){for(let n of[-1,1,-2,2]){let i=e+n;if(i<0||i>=t.length)continue;let s=t[i].indexOf(r);if(s>=0)return{line:i,character:A(s,r)}}return null}function F(t,e){return e.map(r=>({file:C(t,r.uri),line:r.range.start.line,column:r.range.start.character}))}function $(t){let e=new Map;for(let r of t)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,n)=>{let i=r.file.localeCompare(n.file);return i!==0?i:r.line!==n.line?r.line-n.line:r.column-n.column})}async function ve(t){let e=t.includeReferences!==!1,r=t.includeCallees===!0,n=t.includeSignatures===!0,i={timeoutMs:t.requestTimeoutMs},s=Le(t),u=B(t),a=U(t),c=N(t),f=ke(t.projectRoot,s),y=Me(t.projectRoot,f),k=De(f),p=new g(W(t.rustAnalyzerBinary,y),{requestTimeoutMs:t.requestTimeoutMs,configuration:k});try{let L=await p.initialize({processId:d.pid,rootUri:b(y,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:k});if(e&&!L.capabilities.referencesProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/references support.",references:u.map(o=>[o.symbolId,[]]),...r?{callees:a.map(o=>[o.symbolId,[]])}:{}};if(r&&!L.capabilities.callHierarchyProvider)return{available:!1,reason:"rust-analyzer initialized without call hierarchy support.",references:u.map(o=>[o.symbolId,[]]),callees:a.map(o=>[o.symbolId,[]]),...n?{signatures:c.map(o=>[o.symbolId,null])}:{}};if(n&&!L.capabilities.hoverProvider)return{available:!1,reason:"rust-analyzer initialized without hover support.",references:u.map(o=>[o.symbolId,[]]),...r?{callees:a.map(o=>[o.symbolId,[]])}:{},signatures:c.map(o=>[o.symbolId,null])};let V=Ie(p,t.projectRoot,s);await Oe(p,V,t.diagnosticsTimeoutMs??1e4),await K(t.settleDelayMs??5e3);let I=e?await T(u,t.concurrency??8,async o=>{let O=await _(p,S(t.projectRoot,o,!1),{requestTimeoutMs:t.requestTimeoutMs,retryTimeoutMs:t.referenceRetryTimeoutMs});return{symbolId:o.symbolId,references:$(F(t.projectRoot,O.locations)),complete:O.complete}}):u.map(o=>({symbolId:o.symbolId,references:[],complete:!0})),X=r?await T(a,t.concurrency??8,async o=>({symbolId:o.symbolId,callees:await We(p,t.projectRoot,o,i)})):[],Y=n?await T(c,t.concurrency??8,async o=>({symbolId:o.symbolId,signature:await ze(p,t.projectRoot,o,i)})):[];return{available:!0,references:I.filter(o=>o.complete).map(o=>[o.symbolId,o.references]),incompleteReferenceSymbolIds:I.filter(o=>!o.complete).map(o=>o.symbolId),...r?{callees:X.map(o=>[o.symbolId,o.callees])}:{},...n?{signatures:Y.map(o=>[o.symbolId,o.signature])}:{}}}finally{await p.shutdown().catch(()=>{})}}function B(t){return t.referenceDefinitions??t.definitions}function U(t){return t.calleeDefinitions??t.definitions}function N(t){return t.signatureDefinitions??t.definitions}function Le(t){return[...t.includeReferences!==!1?B(t):[],...t.includeCallees===!0?U(t):[],...t.includeSignatures===!0?N(t):[]]}async function ze(t,e,r,n={}){let i=S(e,r,!1),s=await Pe(t,{textDocument:i.textDocument,position:i.position},n);return xe(s)}async function Pe(t,e,r={}){try{return await t.hover(e,r)}catch(n){if(m(n),!(n instanceof Error?n.message:String(n)).includes("content modified"))return null;await Q(r.deadlineMs);try{return await t.hover(e,r)}catch(s){return m(s),null}}}function xe(t){if(!t)return null;let e=Ae(t.contents),r=/```(?:rust)?\s*([\s\S]*?)```/i.exec(e),n=r?r[1]:e;for(let i of n.split(/\r?\n/)){let s=i.replace(/^`+|`+$/g,"").trim();if(s&&Te(s))return s}return null}function Ae(t){return typeof t=="string"?t:Array.isArray(t)?t.map(Ce).join(`
6
6
  `):"value"in t?t.value:""}function Ce(t){return typeof t=="string"?t:t.value}function Te(t){return/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?(?:unsafe\s+)?(?:extern\s+(?:"[^"]+"\s+)?)?(?:fn|struct|enum|trait|type|const|static|mod)\b/.test(t)}function De(t){return{...t.length>0?{linkedProjects:t}:{},references:{excludeImports:!1,excludeTests:!1}}}function Me(t,e){return e.length===1?D(e[0]):v(t)}function ke(t,e){let r=v(t),n=[],i=new Set;for(let s of e){let u=D(v(r,s.relativePath));for(;$e(r,u);){let a=we(u,"Cargo.toml");if(J(a)){i.has(a)||(i.add(a),n.push(a));break}let c=D(u);if(c===u)break;u=c}}return n}function Ie(t,e,r){let n=new Set,i=[];for(let s of r){if(n.has(s.relativePath))continue;n.add(s.relativePath);let u=v(e,s.relativePath);if(!J(u))continue;let a=b(e,s.relativePath);t.didOpenTextDocument({uri:a,languageId:"rust",version:1,text:Re(u,"utf8")}),i.push(a)}return i}async function Oe(t,e,r){await Promise.all(e.map(n=>t.waitForDiagnostics(n,r).catch(()=>!1)))}async function lt(t,e){return(await _(t,e)).locations}async function _(t,e,r={}){try{return{locations:await t.references(e,{timeoutMs:r.requestTimeoutMs,deadlineMs:r.deadlineMs}),complete:!0}}catch(n){m(n);let i=n instanceof Error?n.message:String(n);if(M(n))return qe(t,e,r);if(!i.includes("content modified"))return{locations:[],complete:!0};await Q(r.deadlineMs);try{return{locations:await t.references(e,G(r)),complete:!0}}catch(s){return m(s),{locations:[],complete:!M(s)}}}}async function qe(t,e,r){if(!r.retryTimeoutMs||r.retryTimeoutMs<=0)return{locations:[],complete:!1};let n=G(r);try{return{locations:await t.references(e,n),complete:!0}}catch(i){return m(i),{locations:[],complete:!M(i)}}}function G(t){return{...t.retryTimeoutMs&&t.retryTimeoutMs>0?{timeoutMs:t.retryTimeoutMs}:{},...t.deadlineMs!==void 0?{deadlineMs:t.deadlineMs}:{}}}function M(t){let e=t instanceof Error?t.message:String(t);return e.includes("rust-analyzer LSP request")&&e.includes("timed out after")}async function We(t,e,r,n={}){let i=S(e,r,!1),s=await Ee(t,{textDocument:i.textDocument,position:i.position},n),u=(await Promise.all(s.map(a=>je(t,a,n)))).flat();return Fe(He(e,u))}async function Ee(t,e,r={}){try{return await t.prepareCallHierarchy(e,r)}catch(n){return m(n),[]}}async function je(t,e,r={}){try{return await t.outgoingCalls(e,r)}catch(n){return m(n),[]}}async function Q(t){if(t===void 0){await K(1e3);return}await P(1e3,t)}function m(t){if(t instanceof l)throw t}function He(t,e){return e.map(r=>({symbol:r.to.name,file:C(t,r.to.uri),line:r.to.selectionRange.start.line}))}function Fe(t){let e=new Set,r=[];for(let n of t){let i=`${n.symbol}\0${n.file}\0${n.line}`;e.has(i)||(e.add(i),r.push(n))}return r.sort((n,i)=>n.file.localeCompare(i.file)||n.line-i.line||n.symbol.localeCompare(i.symbol))}function K(t){return t<=0?Promise.resolve():new Promise(e=>setTimeout(e,t))}function $e(t,e){return e===t||e.startsWith(`${t}${be}`)}async function T(t,e,r){let n=new Array(t.length),i=0,s=Math.max(1,Math.min(t.length,Math.floor(e)));return await Promise.all(Array.from({length:s},async()=>{for(;i<t.length;){let u=i++;n[u]=await r(t[u])}})),n}async function Je(){return new Promise((t,e)=>{let r=[];d.stdin.on("data",n=>r.push(n)),d.stdin.on("error",e),d.stdin.on("end",()=>t(Buffer.concat(r).toString("utf8")))})}async function Be(){try{let t=JSON.parse(await Je()),e=await ve(t);d.stdout.write(JSON.stringify(e))}catch(t){let e={available:!1,reason:t instanceof Error?t.message:String(t),references:[]};d.stdout.write(JSON.stringify(e)),d.exitCode=1}}d.argv[1]&&Se(import.meta.url)===d.argv[1]&&Be();export{b as a,C as b,S as c,F as d,$ as e,g as f,W as g,Ge as h,ue as i,Qe as j,Ke as k,Ve as l,ve as m,B as n,U as o,N as p,Le as q,ze as r,Pe as s,xe as t,De as u,Me as v,ke as w,Ie as x,Oe as y,lt as z,_ as A,We as B,K as C,T as D};
7
- //# sourceMappingURL=chunk-D5OXYOJP.js.map
7
+ //# sourceMappingURL=chunk-MQ2B33LQ.js.map
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{Ba as R,E as p,F as g,Fd as D,Gd as a,Kd as u,Ma as w,Md as j,Pd as y,cd as P,ec as C,fd as c,gd as O,hd as L,jd as h,ud as b,z as f}from"./chunk-GBB2RUDN.js";var _=P,J=(o=>parseInt(o,10)),z=(o=>{let e=parseInt(o,10);if(!Number.isFinite(e)||e<1)throw new Error(`Expected a positive integer, got ${o}`);return e}),H=parseFloat,K=parseInt;function l(o,e,t,...n){return n.length>0?{flags:o,description:e,parser:t,defaultValue:n[0]}:{flags:o,description:e,parser:t}}function F(){return l("--json","Output as JSON for programmatic consumption")}function N(o=[]){return o.some(e=>e.flags==="--json")?o:[...o,F()]}function d(o,e=[]){return{category:o,examples:e}}function x(o,e){let t=p(o,e),n=A(t);for(let r of n)console.log(r)}function S(o,e,t="No results found for resolved symbol."){return p(o,e).match?t:k(e,g(o,e,5))}function v(o,e,t,n){return{...T(o,e),[n]:t}}function T(o,e){let t=p(o,e);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:f(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(n=>({shortName:n.shortName,relativePath:n.relativePath,startLine:n.startLine})),totalMatches:t.total}:{matched:!1,suggestions:g(o,e,5)}}function k(o,e){let t=`No definition matched '${o}'.`;return e.length>0?`${t} Suggestions: ${e.join(", ")}`:t}function A(o){if(!o.match||o.total<=1)return[];let e=o.match,t=Math.max(0,o.total-1),n=[`Resolved: ${f(e.symbol)} (${e.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=o.candidates.slice(0,3);return r.length>0&&n.push(`Alternates: ${r.map(s=>`${s.shortName} (${s.relativePath}:${c(s.startLine)})`).join("; ")}`),n.push(""),n}var B=b(({db:o,args:e,opts:t})=>{let n=a(e,0),r=u(t,"signatures"),s=w(o,n);if(u(t,"json")){y("outline",e,t,s);return}if(s.length===0)return h.empty(`No symbols found for "${n}".`);function i(M,$){for(let m of M){let I=" ".repeat($),E=r&&m.signature?` - ${V(m.signature)}`:"";console.log(`${I}${O(m.startLine,m.endLine)} ${m.shortName}${E}`),i(m.children,$+1)}}i(s,0)});function V(o){return o.length>120?`${o.slice(0,117)}...`:o}var q=D("refs",{query:({db:o,args:e,budget:t})=>R(o,a(e,0),{semantic:t.semantic}),format:o=>` line ${c(o.line)}`,before:(o,{db:e,args:t})=>x(e,a(t,0)),emptyMessage:({db:o,args:e})=>S(o,a(e,0),"No references found."),toJson:(o,{db:e,args:t})=>v(e,a(t,0),o,"references")}),G=b(({db:o,args:e,opts:t})=>{let n=a(e,0),r=C(o,n,{context:j(t,"context",0)});if(u(t,"json")){y("code",e,t,v(o,n,r,"code"));return}if(!r)return h.empty(S(o,n,"Symbol found, but source was unreadable."));x(o,n),console.log(`${L(r.relativePath,r.startLine,r.endLine)} ${r.shortName} [${r.language??"unknown"}]
2
+ import{Ba as R,E as p,F as g,Fd as D,Gd as a,Kd as u,Ma as w,Md as j,Pd as y,cd as P,ec as C,fd as c,gd as O,hd as L,jd as h,ud as b,z as f}from"./chunk-26JI77AY.js";var _=P,J=(o=>parseInt(o,10)),z=(o=>{let e=parseInt(o,10);if(!Number.isFinite(e)||e<1)throw new Error(`Expected a positive integer, got ${o}`);return e}),H=parseFloat,K=parseInt;function l(o,e,t,...n){return n.length>0?{flags:o,description:e,parser:t,defaultValue:n[0]}:{flags:o,description:e,parser:t}}function F(){return l("--json","Output as JSON for programmatic consumption")}function N(o=[]){return o.some(e=>e.flags==="--json")?o:[...o,F()]}function d(o,e=[]){return{category:o,examples:e}}function x(o,e){let t=p(o,e),n=A(t);for(let r of n)console.log(r)}function S(o,e,t="No results found for resolved symbol."){return p(o,e).match?t:k(e,g(o,e,5))}function v(o,e,t,n){return{...T(o,e),[n]:t}}function T(o,e){let t=p(o,e);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:f(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(n=>({shortName:n.shortName,relativePath:n.relativePath,startLine:n.startLine})),totalMatches:t.total}:{matched:!1,suggestions:g(o,e,5)}}function k(o,e){let t=`No definition matched '${o}'.`;return e.length>0?`${t} Suggestions: ${e.join(", ")}`:t}function A(o){if(!o.match||o.total<=1)return[];let e=o.match,t=Math.max(0,o.total-1),n=[`Resolved: ${f(e.symbol)} (${e.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=o.candidates.slice(0,3);return r.length>0&&n.push(`Alternates: ${r.map(s=>`${s.shortName} (${s.relativePath}:${c(s.startLine)})`).join("; ")}`),n.push(""),n}var B=b(({db:o,args:e,opts:t})=>{let n=a(e,0),r=u(t,"signatures"),s=w(o,n);if(u(t,"json")){y("outline",e,t,s);return}if(s.length===0)return h.empty(`No symbols found for "${n}".`);function i(M,$){for(let m of M){let I=" ".repeat($),E=r&&m.signature?` - ${V(m.signature)}`:"";console.log(`${I}${O(m.startLine,m.endLine)} ${m.shortName}${E}`),i(m.children,$+1)}}i(s,0)});function V(o){return o.length>120?`${o.slice(0,117)}...`:o}var q=D("refs",{query:({db:o,args:e,budget:t})=>R(o,a(e,0),{semantic:t.semantic}),format:o=>` line ${c(o.line)}`,before:(o,{db:e,args:t})=>x(e,a(t,0)),emptyMessage:({db:o,args:e})=>S(o,a(e,0),"No references found."),toJson:(o,{db:e,args:t})=>v(e,a(t,0),o,"references")}),G=b(({db:o,args:e,opts:t})=>{let n=a(e,0),r=C(o,n,{context:j(t,"context",0)});if(u(t,"json")){y("code",e,t,v(o,n,r,"code"));return}if(!r)return h.empty(S(o,n,"Symbol found, but source was unreadable."));x(o,n),console.log(`${L(r.relativePath,r.startLine,r.endLine)} ${r.shortName} [${r.language??"unknown"}]
3
3
  `);let s=r.source.split(`
4
4
  `);for(let i=0;i<s.length;i++)console.log(` ${String(c(r.startLine+i)).padStart(4)} ${s[i]}`)}),ao=[{id:"refs",command:"refs <symbol>",description:"Find all files referencing a symbol",options:[l("--full","Run unbounded semantic analysis on large indexes"),l("--json","Output as JSON for programmatic consumption")],budget:"semantic",renderShape:"grouped-by-file",docs:d("Navigation",["scip-query refs login"]),handler:q},{id:"outline",command:"outline <file>",description:"Tree view of symbols in a file, with line ranges",options:N([l("--signatures","Show trimmed symbol signatures")]),renderShape:"custom",docs:d("Navigation"),handler:B},{id:"code",command:"code <symbol>",description:"Read the source code for a symbol (bounded to its definition range)",options:N([l("-C, --context <n>","Extra lines of context above/below",J,0)]),renderShape:"custom",docs:d("Navigation"),handler:G}];export{_ as a,J as b,z as c,H as d,K as e,l as f,F as g,N as h,d as i,x as j,S as k,v as l,T as m,ao as n};
5
- //# sourceMappingURL=chunk-MTFHE7ZO.js.map
5
+ //# sourceMappingURL=chunk-MRYPDVOS.js.map