scip-query 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/{chunk-GD7XRHSV.js → chunk-2BMFRBV6.js} +2 -2
  2. package/dist/{chunk-3YQO3S5D.js → chunk-2WEH5QHC.js} +2 -2
  3. package/dist/{chunk-PE4EJOLN.js → chunk-4DAPXOWD.js} +2 -2
  4. package/dist/{chunk-EKP7XJ6L.js → chunk-4HTJZC6G.js} +2 -2
  5. package/dist/{chunk-RCRK4E7E.js → chunk-4JQFTUKD.js} +2 -2
  6. package/dist/{chunk-7I6KNKE3.js → chunk-4MHT7LKP.js} +2 -2
  7. package/dist/chunk-5OHZEO3U.js +3 -0
  8. package/dist/chunk-5QJIEYFB.js +34 -0
  9. package/dist/{chunk-Z2AJQ7VA.js → chunk-6DEX3XP6.js} +2 -2
  10. package/dist/{chunk-OMNT7E2T.js → chunk-6IGXZZQ4.js} +2 -2
  11. package/dist/{chunk-TA4DDU7J.js → chunk-6K2JQ2VI.js} +2 -2
  12. package/dist/{chunk-YO6DU7QZ.js → chunk-6QVCPUK6.js} +2 -2
  13. package/dist/chunk-6VL4AIEO.js +8 -0
  14. package/dist/{chunk-VHENVDS2.js → chunk-772YYL6I.js} +2 -2
  15. package/dist/{chunk-VTF5EH22.js → chunk-A2VTV2QB.js} +2 -2
  16. package/dist/{chunk-YSSTUCNS.js → chunk-ADRYSISR.js} +2 -2
  17. package/dist/{chunk-NM3BZXHA.js → chunk-AI2ECT7L.js} +2 -2
  18. package/dist/{chunk-TR5AU6A5.js → chunk-AP5GTKSG.js} +2 -2
  19. package/dist/{chunk-TCCUWKH4.js → chunk-BGRPMGTD.js} +2 -2
  20. package/dist/{chunk-7TYJD45F.js → chunk-BNW3Q24R.js} +2 -2
  21. package/dist/{chunk-K3V6XUTL.js → chunk-BUAC4Q4G.js} +2 -2
  22. package/dist/{chunk-SEZZ24IG.js → chunk-BZ6LCGE6.js} +2 -2
  23. package/dist/{chunk-ZJ737ZMD.js → chunk-CMXFASVD.js} +2 -2
  24. package/dist/{chunk-L6TOEQ2M.js → chunk-CO3AL7NZ.js} +2 -2
  25. package/dist/{chunk-ITUU3VE3.js → chunk-FVIKFWUL.js} +2 -2
  26. package/dist/{chunk-APLCSDXL.js → chunk-FVVT7GV6.js} +2 -2
  27. package/dist/chunk-HXXRN77A.js +2 -0
  28. package/dist/{chunk-NK7TQQG4.js → chunk-IC3RC3KJ.js} +2 -2
  29. package/dist/chunk-ISCKLDSS.js +22 -0
  30. package/dist/chunk-ITHQJZTG.js +2 -0
  31. package/dist/{chunk-RIXOMSOR.js → chunk-IVAIPXNO.js} +2 -2
  32. package/dist/{chunk-NO2TPMCQ.js → chunk-IW7ASGVF.js} +2 -2
  33. package/dist/{chunk-I66MQD5U.js → chunk-JODYQDE4.js} +2 -2
  34. package/dist/{chunk-HDA2V5DC.js → chunk-L2KFPRMA.js} +2 -2
  35. package/dist/{chunk-U254PV4S.js → chunk-MCW36F2D.js} +2 -2
  36. package/dist/{chunk-SDGCKEB7.js → chunk-MN75T4UB.js} +2 -2
  37. package/dist/{chunk-AGW2MVIO.js → chunk-NC4IUW25.js} +2 -2
  38. package/dist/{chunk-2DVVHNC3.js → chunk-NGI4V4AB.js} +2 -2
  39. package/dist/{chunk-SOGLYIJ4.js → chunk-O6KCZPJQ.js} +2 -2
  40. package/dist/chunk-OAI5GEIN.js +6 -0
  41. package/dist/chunk-OH5HIAID.js +4 -0
  42. package/dist/{chunk-NGLRXEWN.js → chunk-OLCKSG3Y.js} +2 -2
  43. package/dist/{chunk-JTCEWV7Q.js → chunk-OXKEUWMJ.js} +2 -2
  44. package/dist/{chunk-LBAMALDV.js → chunk-PRVDXGSK.js} +2 -2
  45. package/dist/{chunk-46ILZVMX.js → chunk-QJWN6LA5.js} +2 -2
  46. package/dist/{chunk-BCFED24F.js → chunk-QKO474FG.js} +2 -2
  47. package/dist/{chunk-TQTVM27C.js → chunk-QYKKTYBN.js} +2 -2
  48. package/dist/{chunk-UUDYI3FF.js → chunk-R6XDPWJA.js} +2 -2
  49. package/dist/{chunk-D43L5PQF.js → chunk-SCEMECW7.js} +2 -2
  50. package/dist/{chunk-2Y2WIJI4.js → chunk-SJR4SB7B.js} +2 -2
  51. package/dist/chunk-SYKCO25G.js +16 -0
  52. package/dist/{chunk-FYT2PE7C.js → chunk-T22X7WT6.js} +2 -2
  53. package/dist/{chunk-Y3RUPPIU.js → chunk-VDY4HYNK.js} +2 -2
  54. package/dist/{chunk-EAU4RDFG.js → chunk-VDZIEDJB.js} +2 -2
  55. package/dist/{chunk-6ZFKI5EP.js → chunk-VGBSY6N7.js} +2 -2
  56. package/dist/{chunk-VN6B6HFB.js → chunk-VZRILF2Z.js} +2 -2
  57. package/dist/{chunk-CVRXOP6M.js → chunk-WJIS6BNI.js} +2 -2
  58. package/dist/{chunk-SLX5XBCD.js → chunk-WN5Z3UVT.js} +2 -2
  59. package/dist/{chunk-6G76D2YM.js → chunk-XCW7DYHM.js} +2 -2
  60. package/dist/{chunk-6HP3BKIP.js → chunk-Y5H7TBVE.js} +2 -2
  61. package/dist/{chunk-I7OTKWNY.js → chunk-YWZBKYLS.js} +2 -2
  62. package/dist/{chunk-64UY7VTR.js → chunk-ZF6P2NAT.js} +3 -3
  63. package/dist/{chunk-VQGQHIAT.js → chunk-ZGIK464P.js} +2 -2
  64. package/dist/{chunk-WC43FMAB.js → chunk-ZOT3WUZW.js} +2 -2
  65. package/dist/{chunk-TFO4OMJZ.js → chunk-ZZ2W5P3D.js} +2 -2
  66. package/dist/cli.js +171 -151
  67. package/dist/index.js +1 -1
  68. package/dist/queries/affected.js +1 -1
  69. package/dist/queries/bottlenecks.js +1 -1
  70. package/dist/queries/by-kind.js +1 -1
  71. package/dist/queries/call-graph.js +1 -1
  72. package/dist/queries/change-surface.js +1 -1
  73. package/dist/queries/cleanup-plan.js +1 -1
  74. package/dist/queries/co-change.js +1 -1
  75. package/dist/queries/code.js +1 -1
  76. package/dist/queries/complexity-hotspots.js +1 -1
  77. package/dist/queries/complexity.js +1 -1
  78. package/dist/queries/convergence.js +1 -1
  79. package/dist/queries/coupling.js +1 -1
  80. package/dist/queries/cycles.js +1 -1
  81. package/dist/queries/dataflow.js +1 -1
  82. package/dist/queries/dead.js +1 -1
  83. package/dist/queries/deep-chains.js +1 -1
  84. package/dist/queries/deps.js +1 -1
  85. package/dist/queries/diff-gate.d.ts +5 -1
  86. package/dist/queries/diff-gate.js +1 -1
  87. package/dist/queries/diff-impact.js +1 -1
  88. package/dist/queries/doc-drift.js +1 -1
  89. package/dist/queries/drift.js +1 -1
  90. package/dist/queries/extract-candidates.js +1 -1
  91. package/dist/queries/fan.js +1 -1
  92. package/dist/queries/health.js +1 -1
  93. package/dist/queries/hierarchy.js +1 -1
  94. package/dist/queries/hotspots.js +1 -1
  95. package/dist/queries/imports.js +1 -1
  96. package/dist/queries/incomplete-migration.js +1 -1
  97. package/dist/queries/index.d.ts +1 -1
  98. package/dist/queries/index.js +1 -1
  99. package/dist/queries/isolated.js +1 -1
  100. package/dist/queries/members.js +1 -1
  101. package/dist/queries/methods.js +1 -1
  102. package/dist/queries/outline.js +1 -1
  103. package/dist/queries/passthrough-candidates.js +1 -1
  104. package/dist/queries/plan-context.js +1 -1
  105. package/dist/queries/recent-duplicates.js +1 -1
  106. package/dist/queries/redundant-reexports.js +1 -1
  107. package/dist/queries/refs.js +1 -1
  108. package/dist/queries/self-audit.js +1 -1
  109. package/dist/queries/similar-chains.js +1 -1
  110. package/dist/queries/similar-files.js +1 -1
  111. package/dist/queries/similar-signatures.js +1 -1
  112. package/dist/queries/similar.js +1 -1
  113. package/dist/queries/slice.js +1 -1
  114. package/dist/queries/stale-abstractions.js +1 -1
  115. package/dist/queries/surface.js +1 -1
  116. package/dist/queries/symbols.js +1 -1
  117. package/dist/queries/system.js +1 -1
  118. package/dist/queries/trace.js +1 -1
  119. package/dist/queries/unused-params.js +1 -1
  120. package/dist/queries/wrapper-candidates.js +1 -1
  121. package/package.json +1 -1
  122. package/dist/chunk-44G4P3GJ.js +0 -2
  123. package/dist/chunk-IBM6FXOQ.js +0 -3
  124. package/dist/chunk-LR7E2ATW.js +0 -8
  125. package/dist/chunk-PCMVXWDC.js +0 -34
  126. package/dist/chunk-PLFYFZX3.js +0 -2
  127. package/dist/chunk-SQ6VENQY.js +0 -6
  128. package/dist/chunk-T4AK46CM.js +0 -16
  129. package/dist/chunk-WQFOZIID.js +0 -4
@@ -1,34 +0,0 @@
1
- import{b as k,g as v,h as O,i as D,n as F}from"./chunk-6ZFKI5EP.js";import{c as N,e as T}from"./chunk-64UY7VTR.js";import{d as M,f as w,r as L,s as I,v as A}from"./chunk-SOGLYIJ4.js";import{c as E,i as C}from"./chunk-WQFOZIID.js";import{d as R}from"./chunk-VDZL45XI.js";function le(e,n,o={}){let l=x(e,[n],{additive:o.additive,semantic:o.semantic}),i=o.callableOnly?(l.get(n.symbolId)??[]).filter(a=>w(a.symbol)):l.get(n.symbolId)??[];return typeof o.limit=="number"?i.slice(0,o.limit):i}function ie(e,n,o={}){let l=G(e)?W(e,n,{semantic:o.semantic!==!1}):J(e).get(n.symbolId)??[];return typeof o.limit=="number"?l.slice(0,o.limit):l}var H=R("caller-rows",{clearGroups:["whole-project"]}),$=2e4;function G(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>$}function J(e){return H.get(e,()=>{let n=I(e),o=x(e,n),l=new Map;for(let c of n)l.set(c.symbol,c.symbolId);let i=new Map,a=new Map;for(let c of n){let s=o.get(c.symbolId);if(!(!s||s.length===0))for(let d of s){let t=l.get(d.symbol);if(t===void 0||t===c.symbolId)continue;let r=i.get(t);r||(r=[],i.set(t,r),a.set(t,new Set));let f=`${c.symbol}|${c.relativePath}`;a.get(t).has(f)||(a.get(t).add(f),r.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion"}))}}return i})}function W(e,n,o){let l=[],i=new Set,a=s=>{if(s.symbol===n.symbol)return;let d=`${s.symbol}|${s.file}`;i.has(d)||(i.add(d),l.push(s))};for(let s of F(e,n))s.file!==n.relativePath&&a({symbol:s.enclosingSymbol??s.file,file:s.file,source:"resolved-reference"});let c=o.semantic?B(e,n):null;if(c)for(let s of N(e,c)){if(s.file===n.relativePath||e.isIgnored(s.file))continue;let d=A(L(e,s.file),s.line);a({symbol:d?.symbol??s.file,file:s.file,source:"semantic-reference"})}return l}function B(e,n){return e.get(`SELECT
2
- d.id AS documentId,
3
- gs.id AS symbolId,
4
- gs.symbol,
5
- d.relative_path AS relativePath,
6
- COALESCE(der.start_line, c.start_line) AS startLine,
7
- COALESCE(der.end_line, c.end_line) AS endLine,
8
- COALESCE(gs.display_name, '') AS leaf,
9
- NULL AS parentTypeName,
10
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
11
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
12
- gs.kind AS kind,
13
- gs.documentation AS documentation,
14
- gs.enclosing_symbol AS enclosingSymbol
15
- FROM global_symbols gs
16
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
17
- LEFT JOIN chunks c ON c.document_id = der.document_id
18
- JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
19
- WHERE gs.id = ?
20
- LIMIT 1`,n.symbolId)??null}function x(e,n,o={}){if(n.length===0)return new Map;let l=o.additive??!1,i=[],a=[];for(let r of n)E(r.relativePath)&&C(e,r.relativePath)!==null?i.push(r):a.push(r);let c=new Map,s=new Map,d=r=>{for(let[f,p]of r){let b=c.get(f);b||(b=[],c.set(f,b));let y=s.get(f);y||(y=new Set,s.set(f,y));for(let m of p){let u=`${m.symbol}|${m.chunkId}`;y.has(u)||(y.add(u),b.push(m))}}};i.length>0&&d(j(e,i)),o.semantic!==!1&&d(q(T(e,n)));let t=l?n:a;return t.length>0&&d(Y(e,t)),c}function j(e,n){let o=new Map,l=U(n,o),i=D(e);for(let[a,c]of l){let s=C(e,a);if(s)for(let d of s){let t=K(c,d.line);if(!t)continue;let r=V(e,a,i,d.calleeLeaf,d.memberAccess);r&&r.symbol!==t.symbol&&o.get(t.symbolId).push({symbol:r.symbol,file:r.file,chunkId:d.line,source:"ast-callsite"})}}return o}function U(e,n){let o=new Map;for(let l of e){let i=o.get(l.relativePath);i?i.push(l):o.set(l.relativePath,[l]),n.set(l.symbolId,[])}for(let l of o.values())l.sort((i,a)=>i.endLine-i.startLine-(a.endLine-a.startLine));return o}function K(e,n){return e.find(o=>n>=o.startLine&&n<=o.endLine)??null}function V(e,n,o,l,i){let a=v(n,o.get(l)??[]);return a.length===0?null:O(e,n,a,i)}function Y(e,n){if(n.length===0)return new Map;let o=e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
21
- FROM mentions m
22
- JOIN chunks c ON m.chunk_id = c.id
23
- WHERE m.role != 1`),l=new Map;for(let t of o)l.has(t.document_id)||l.set(t.document_id,[]),l.get(t.document_id).push(t);let i=new Map(e.all("SELECT id, relative_path FROM documents").map(t=>[t.id,t.relative_path])),a=new Map,c=e.all(`SELECT gs.id AS symbol_id, gs.symbol,
24
- COALESCE(der.document_id, def_chunk.document_id) AS document_id
25
- FROM global_symbols gs
26
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
27
- LEFT JOIN (
28
- SELECT m.symbol_id, MIN(c.document_id) AS document_id
29
- FROM mentions m
30
- JOIN chunks c ON m.chunk_id = c.id
31
- WHERE m.role = 1
32
- GROUP BY m.symbol_id
33
- ) def_chunk ON def_chunk.symbol_id = gs.id`);for(let t of c)a.has(t.symbol_id)||a.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?i.get(t.document_id)??"":""});let s=new Map,d=i;for(let t of n){let r=l.get(t.documentId)??[],f=new Set,p=[],b=null,y=()=>{if(b)return b;let m=d.get(t.documentId)??"",u=new Set;if(m){let h=k(e,m),S=Math.max(0,t.startLine),_=Math.min(h.length-1,t.endLine);for(let g=S;g<=_;g+=1)for(let P of h[g])u.add(P)}return b=u,u};for(let m of r){if(m.symbol_id===t.symbolId)continue;let u=a.get(m.symbol_id);if(!u)continue;if(!(m.start_line>=t.startLine&&m.end_line<=t.endLine)){if(!(m.start_line<=t.endLine&&m.end_line>=t.startLine))continue;let g=M(u.symbol);if(!g||!y().has(g))continue}let S=`${u.symbol}|${m.chunk_id}`;f.has(S)||(f.add(S),p.push({...u,chunkId:m.chunk_id,source:"scip-chunk"}))}s.set(t.symbolId,p)}return s}function q(e){let n=new Map;for(let[o,l]of e){let i=[];for(let a of l)i.push({symbol:a.symbol,file:a.file,chunkId:-1,source:"semantic-callee"});n.set(o,i)}return n}export{le as a,ie as b,x as c};
34
- //# sourceMappingURL=chunk-PCMVXWDC.js.map
@@ -1,2 +0,0 @@
1
- import{b as r}from"./chunk-WC43FMAB.js";import{u as e}from"./chunk-SOGLYIJ4.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
- //# sourceMappingURL=chunk-PLFYFZX3.js.map
@@ -1,6 +0,0 @@
1
- import{a as k,b as y,e as R,f as N}from"./chunk-UIWAZ2NT.js";import{c as M}from"./chunk-MX6F756F.js";import{a as x}from"./chunk-NO2TPMCQ.js";import{a as P}from"./chunk-PCMVXWDC.js";import{a as A}from"./chunk-7I6KNKE3.js";import{c as p,d as q,g as w}from"./chunk-SOGLYIJ4.js";import{a as z}from"./chunk-WQFOZIID.js";function re(e,i,t={}){let{minSimilarity:s=.4,limit:r=20}=t,a=Z(e,i,{semantic:t.semantic!==!1});if(!a)return[];if(!w(a.symbol))return[];let n=O(e,a,s,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return n.length>0?n.slice(0,r):W(e,i,{minSimilarity:s,limit:r})}function O(e,i,t,s){let r=$(e,{minCallees:3,excludeSymbol:i.symbol,scanLimit:s.scanLimit,semantic:s.semantic}),a=R([i,...r].map(o=>o.callees)),n=[];for(let o of r){if(o.callees.size<3)continue;let l=T(i,o,a,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0});l&&n.push(l)}return n.sort((o,l)=>l.similarity-o.similarity),n}function T(e,i,t,s){let{similarity:r,significantShared:a}=N(e.callees,i.callees,t);if(r<s.minSimilarity)return null;let n=k(e.callees,i.callees).size;if(a.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let o=a.length>0?a:[...k(e.callees,i.callees)];return{symbolA:e.symbol,shortNameA:p(e.symbol),fileA:e.file,symbolB:i.symbol,shortNameB:p(i.symbol),fileB:i.file,similarity:r,similarityBasis:"callees",sharedCallees:o.map(p),uniqueToA:[...y(e.callees,i.callees)].map(p),uniqueToB:[...y(i.callees,e.callees)].map(p)}}function ae(e,i={}){let{minSimilarity:t=.5,limit:s=20,scope:r,minCallees:a=4,crossFileOnly:n=!1,scanLimit:o}=i,l=$(e,{minCallees:a,scope:r,scanLimit:o,semantic:i.semantic!==!1}),c=R(l.map(m=>m.callees)),u=new Map;for(let m of l)for(let b of m.callees)u.set(b,(u.get(b)??0)+1);let h=Math.max(8,Math.ceil(Math.sqrt(l.length))),F=new Map;for(let m=0;m<l.length;m+=1)for(let b of l[m].callees){if((u.get(b)??0)>h)continue;let g=F.get(b);g||(g=[],F.set(b,g)),g.push(m)}let C=[],B=new Set;e:for(let m=0;m<l.length;m+=1){let b=l[m],g=new Set;for(let D of b.callees){let S=F.get(D);if(S)for(let f of S)f>m&&g.add(f)}for(let D of g){let S=`${m}|${D}`;if(B.has(S))continue;B.add(S);let f=l[D];if(n&&b.file===f.file)continue;if(b.paramCount>=0&&f.paramCount>=0){let j=Math.abs(b.paramCount-f.paramCount),_=Math.max(2,Math.ceil(Math.max(b.paramCount,f.paramCount)*.5));if(j>_)continue}let L=T(b,f,c,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4});if(L&&(C.push(L),C.length>s*5))break e}}return C.sort((m,b)=>b.similarity-m.similarity),C.slice(0,s)}var V=["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 Z(e,i,t){let s=A(e,i),r=new x(e);if(!s)return null;let a=P(e,s,{semantic:t.semantic});return{symbol:s.symbol,file:s.relativePath,callees:E(a.map(n=>n.symbol)),paramCount:r.callableSignature(s)?.paramCount??-1}}function $(e,i){let{minCallees:t,scope:s,excludeSymbol:r,scanLimit:a}=i,n=new x(e),o=M(n.productionCallableDefinitions({scope:s,minLoc:5,excludeSymbol:r,sortByLocDesc:typeof a=="number"&&a>0}),a),l=n.calleeMap(o,{semantic:i.semantic!==!1});return o.map(c=>({symbol:c.symbol,file:c.relativePath,callees:E((l.get(c.symbolId)??[]).map(u=>u.symbol)),paramCount:n.callableSignature(c)?.paramCount??-1})).filter(c=>c.callees.size>=t)}function E(e){return new Set([...e].filter(i=>!U(i)))}function U(e){return V.some(i=>e.includes(i))}function W(e,i,t){let s=G(e,i);if(!s||s.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,a=[];for(let n of H(e)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let o=k(s.tokens,n.tokens);if(o.size<2)continue;let l=new Set([...s.tokens,...n.tokens]),c=l.size>0?o.size/l.size:0;c<r||a.push({symbolA:s.symbol,shortNameA:p(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:c,similarityBasis:"source-tokens",sharedCallees:[...o].sort(),uniqueToA:[...y(s.tokens,n.tokens)].sort(),uniqueToB:[...y(n.tokens,s.tokens)].sort()})}return a.sort((n,o)=>o.similarity-n.similarity||n.shortNameB.localeCompare(o.shortNameB)),a.slice(0,t.limit)}function G(e,i){let t=A(e,i);if(!t||!w(t.symbol))return null;let s=K(e,t);return s?{symbol:t.symbol,file:t.relativePath,tokens:s}:null}function K(e,i){let t=q(i.symbol),s=v(e,i.relativePath,i.startLine,i.endLine,t),r=I(s,t);return r.size>0?r:null}function H(e){return new x(e).productionCallableDefinitions().map(t=>({symbol:t.symbol,file:t.relativePath,tokens:I(v(e,t.relativePath,t.startLine,t.endLine,t.leaf),t.leaf)})).filter(t=>t.tokens.size>0)}function v(e,i,t,s,r){let a=z(e,i);if(!a)return"";let n=a.split(`
2
- `);if(s>=t&&s-t<=12)return n.slice(t,s+1).join(`
3
- `);let o=[new RegExp(`\\bdef\\s+${d(r)}\\b`),new RegExp(`\\bfun\\s+${d(r)}\\b`),new RegExp(`\\bfn\\s+${d(r)}\\b`),new RegExp(`\\bfunction\\s+${d(r)}\\b`),new RegExp(`\\b${d(r)}\\s*\\(`)],l=n.findIndex(c=>o.some(u=>u.test(c)));if(l>=0){let c=l;for(let u=l+1;u<n.length&&u<=l+8;u++){let h=n[u]??"";if(u>l&&Q(h)||(c=u,h.trim()===""&&u>l+1))break}return n.slice(l,c+1).join(`
4
- `)}return n.slice(t,Math.min(n.length,t+8)).join(`
5
- `)}function I(e,i){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"]),s=J(i),a=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(n=>n.trim()).filter(n=>n.length>1).filter(n=>!t.has(n)).filter(n=>!s.has(n));return new Set(a)}function J(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(i=>i.toLowerCase()).filter(i=>i.length>1))}function Q(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{re as a,ae as b,$ as c,E as d};
6
- //# sourceMappingURL=chunk-SQ6VENQY.js.map
@@ -1,16 +0,0 @@
1
- import{a as h}from"./chunk-NO2TPMCQ.js";import{d as p}from"./chunk-64UY7VTR.js";import{c as u,f,h as g}from"./chunk-SOGLYIJ4.js";import{execFileSync as d}from"child_process";var b="Unable to compute git diff.";function O(e,n={}){let t=S(e,n);return t.note?D(t.note,t.changedFileLines):t.changedFiles.length===0?F(t.changedFileLines):C(t.changedFiles,[I(e,t.changedFiles,t.changedFiles)])}function S(e,n={}){let{base:t="HEAD"}=n;try{let s=_(e.config.projectRoot,t);return{changedFileLines:s,changedFiles:x(e,s),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],note:b}}}function I(e,n,t){let s=new h(e),r=new Set(t),a=[],l=new Map,i=n.flatMap(o=>s.definitionsForFile(o)).filter(L).sort((o,m)=>o.relativePath.localeCompare(m.relativePath)||o.startLine-m.startLine),c=p(e,i);for(let o of i)N(e,o,t,r,a,l,c.get(o.symbolId)??new Set);return{changedSymbols:a,consumerEntries:[...l.entries()].map(([o,m])=>({file:o,symbols:[...m].sort()}))}}function C(e,n){let t=new Map,s=n.flatMap(a=>a.changedSymbols);for(let a of n)for(let l of a.consumerEntries){let i=t.get(l.file);i||(i=new Set,t.set(l.file,i));for(let c of l.symbols)i.add(c)}let r=M(t);return{changedFiles:[...e],changedSymbols:s,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:s.length,totalAffectedFiles:r.length}}}function D(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function F(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function _(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),s=d("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4}),r=d("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([t,s,r].flatMap(a=>a.split(`
2
- `)).map(a=>a.trim()).filter(a=>a.length>0))]}function x(e,n){let t=[];for(let s of n){let r=e.get(`SELECT relative_path FROM documents
3
- WHERE relative_path LIKE ?
4
- LIMIT 1`,`%${s}`);r&&!e.isIgnored(r.relative_path)&&t.push(r.relative_path)}return t}function N(e,n,t,s,r,a,l){let i=Math.max(E(e,n.symbolId),l.size);if(!A(n,i))return;let c=u(n.symbol);r.push({symbol:n.symbol,shortName:c,file:n.relativePath,fanIn:i});for(let o of R(e,n.symbolId,t))y(e,s,a,o,c);for(let o of l)y(e,s,a,o,c)}function E(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
5
- FROM mentions m
6
- JOIN chunks c ON m.chunk_id = c.id
7
- WHERE m.symbol_id = ?
8
- AND m.role != 1`,n)?.fan_in??0}function R(e,n,t){return t.length===0?[]:e.all(`SELECT DISTINCT ref_d.relative_path
9
- FROM mentions m
10
- JOIN chunks c ON m.chunk_id = c.id
11
- JOIN documents ref_d ON c.document_id = ref_d.id
12
- WHERE m.symbol_id = ?
13
- AND m.role != 1
14
- AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
15
- ${e.pathExclusionsFor("ref_d")}`,n,...t).map(r=>r.relative_path)}function y(e,n,t,s,r){if(e.isIgnored(s)||n.has(s))return;let a=t.get(s);a||(a=new Set,t.set(s,a)),a.add(r)}function M(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function L(e){return!(g(e.symbol)||e.parentTypeName!==null&&!f(e.symbol))}function A(e,n){return f(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{b as a,O as b,S as c,I as d,C as e};
16
- //# sourceMappingURL=chunk-T4AK46CM.js.map
@@ -1,4 +0,0 @@
1
- import{c as L,e as A}from"./chunk-VDZL45XI.js";import{existsSync as q,readFileSync as X}from"fs";import{join as $}from"path";var J=L("source-text",{clearGroups:["whole-project","source-file"]});function S(e,t){let r=t.replace(/\\/g,"/");return J.get(e,r,()=>{let n=$(e.config.projectRoot,r);return q(n)?X(n,"utf-8"):""})}var Z=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale|wrapper|passthrough|drift|extract)?/i;function Pe(e,t,r){if(r<=0)return!1;let n=S(e,t);if(!n)return!1;let s=n.split(`
2
- `);for(let a=r-1;a>=0&&a>=r-5;a-=1){let i=(s[a]??"").trim();if(i!==""){if(Z.test(i))return!0;if(!i.startsWith("//")&&!i.startsWith("*")&&!i.startsWith("/*")&&!i.startsWith("@")&&!i.startsWith("#"))return!1}}return!1}import{extname as w}from"path";var ee={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb"};function y(e){return ee[w(e).toLowerCase()]??null}function x(e){return w(e).toLowerCase()===".vue"}import{createRequire as te}from"module";var f=te(import.meta.url),b=null,F=!1;function re(){if(F)return null;if(b)return b;try{return b=f("tree-sitter"),b}catch{return F=!0,null}}var k=new Map,_=new Set;function ne(e){if(_.has(e))return null;let t=k.get(e);if(t)return t;let r;try{switch(e){case"rust":r=f("tree-sitter-rust");break;case"typescript":r=f("tree-sitter-typescript").typescript;break;case"tsx":r=f("tree-sitter-typescript").tsx;break;case"javascript":r=f("tree-sitter-javascript");break;case"python":r=f("tree-sitter-python");break;case"java":r=f("tree-sitter-java");break;case"kotlin":r=f("tree-sitter-kotlin");break;case"scala":r=f("tree-sitter-scala");break;case"ruby":r=f("tree-sitter-ruby");break;case"c":r=f("tree-sitter-c");break;case"cpp":r=f("tree-sitter-cpp");break;case"csharp":r=f("tree-sitter-c-sharp");break;case"php":r=f("tree-sitter-php").php;break;case"vb":{let n=f("tree-sitter-vb-dotnet");r=n.language??n;break}}}catch{return _.add(e),null}return k.set(e,r),r}var R=new Map;function se(e){let t=R.get(e);if(t)return t;let r=ne(e);if(!r)return null;let n=re();if(!n)return null;let s=new n;try{s.setLanguage(r)}catch{return _.add(e),null}return R.set(e,s),s}function ae(e,t){return e.parse(n=>n>=t.length?null:t.slice(n,Math.min(t.length,n+16384)))}function C(e,t){let r=se(e);if(!r)return null;try{return ae(r,t)}catch{return null}}function T(e){let t=[],r=/<script\b([^>]*)>([\s\S]*?)<\/script>/g;for(let o of e.matchAll(r))typeof o.index=="number"&&t.push({tagOpen:o[1]??"",body:o[2]??"",openIdx:o.index+(o[0].length-(o[2]?.length??0)-9)});if(t.length===0)return null;let n=t.find(o=>/\bsetup\b/.test(o.tagOpen))??t[0],a=n.tagOpen.match(/\blang\s*=\s*["']?([\w-]+)/)?.[1]?.toLowerCase(),i=a==="ts"||a==="typescript"?"typescript":a==="tsx"?"tsx":"javascript";return{body:n.body,startLine:ie(e,n.openIdx),language:i}}function ie(e,t){let r=0;for(let n=0;n<t&&n<e.length;n++)e.charCodeAt(n)===10&&r++;return r}var j=A("ast-trees",{clearGroups:["whole-project","source-file"]});function N(e,t){if(x(t))return oe(e,t);let r=y(t);if(!r)return null;let n=S(e,t);return n?j.get(e,t,n,()=>C(r,n)):null}function oe(e,t){let r=S(e,t);return r?j.get(e,t,r,()=>{let n=T(r);if(!n)return null;let s=`
3
- `.repeat(n.startLine)+n.body;return C(n.language,s)}):null}function h(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var ce=new Set(["function_declaration","method_definition","method_signature","function_signature"]);function D(e,t){let r=le(e,t);if(r)return{name:r.name,startLine:r.definitionNode.startPosition.row,endLine:r.definitionNode.endPosition.row,paramCount:I(r.functionNode),params:E(r.functionNode),paramsEndLine:v(r.functionNode),isLiteralPassthrough:P(r.functionNode,t)};if(!ue(e.type,t))return null;let n=e.childForFieldName("name")??e.namedChildren.find(s=>s.type==="identifier"||s.type==="property_identifier");return n?{name:n.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:I(e),params:E(e),paramsEndLine:v(e),isLiteralPassthrough:P(e,t)}:null}function M(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function E(e){let t=M(e);if(!t)return[];let r=[];for(let n of t.namedChildren){if(h(n))continue;if(n.type==="identifier"){r.push({name:n.text,simple:!0});continue}let s=n.namedChildren.some(o=>o.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(n.text),a=n.childForFieldName("pattern");if(!s&&a&&a.type==="identifier"){r.push({name:a.text,simple:!0});continue}let i=n.namedChildren.find(o=>o.type==="identifier");r.push({name:a?.type==="identifier"?a.text:i?.text??"",simple:!1})}return r}function v(e){let t=M(e);return t?t.endPosition.row:e.startPosition.row}function ue(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?ce.has(e):!1}function le(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let r=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1);return!r||!n||n.type!=="arrow_function"&&n.type!=="function_expression"?null:{name:r.text,definitionNode:e,functionNode:n}}if(e.type==="public_field_definition"){let r=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1);return!r||!n||n.type!=="arrow_function"&&n.type!=="function_expression"?null:{name:r.text,definitionNode:e,functionNode:n}}return null}function I(e){let t=e.namedChildren.find(n=>n.type==="parameters"||n.type==="formal_parameters");if(!t)return 0;let r=0;for(let n of t.namedChildren)h(n)||(r+=1);return r}function P(e,t){let r=e.namedChildren.find(l=>l.type==="block"||l.type==="statement_block");if(!r)return!1;let n=r.namedChildren.filter(l=>!h(l));if(n.length!==1)return!1;let s=n[0],a=null;if(s.type==="return_statement"||s.type==="expression_statement"?a=s.namedChild(0)??null:t==="rust"&&(s.type==="call_expression"||s.type==="macro_invocation")&&(a=s),!a)return!1;let i=t==="python"?"call":"call_expression";if(a.type!==i)return!1;let o=a.namedChildren.find(l=>l.type==="arguments"||l.type==="argument_list");if(!o)return!1;let u=o.namedChildren.filter(l=>!h(l)),c=e.namedChildren.find(l=>l.type==="parameters"||l.type==="formal_parameters");if(!c)return!1;let p=[];for(let l of c.namedChildren){if(l.type==="identifier"){p.push(l.text);continue}let d=l.namedChildren.find(K=>K.type==="identifier");d&&p.push(d.text)}if(u.length!==p.length)return!1;for(let l=0;l<p.length;l+=1){let d=u[l];if(d.type!=="identifier"||d.text!==p[l])return!1}return!0}function O(e,t){let r=pe(e,t);if(!r)return null;let n=g(r);return n?{calleeLeaf:n,memberAccess:fe(r),line:e.startPosition.row}:null}function pe(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function fe(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function g(e){switch(e.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return e.text;case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?g(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?g(t):null}case"super":case"self":case"this":return null;default:return null}}var me=new Set(["identifier","type_identifier","field_identifier"]),de=new Set(["identifier"]),ge=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),ye=new Set(["rust","python"]),he=/\{([^{}]*)\}/g,Se=/\b([A-Za-z_][\w]*)\b/g;function B(e,t){return be(t).has(e.type)}function Q(e,t){return ye.has(t)&&e.type==="string_content"}function H(e){let t=0;for(let n of e.values()){let s=n[n.length-1];s!==void 0&&s>t&&(t=s)}let r=new Array(t+1);for(let n=0;n<=t;n+=1)r[n]=new Set;for(let[n,s]of e)for(let a of s)r[a].add(n);return r}function be(e){return e==="rust"?me:e==="python"?de:ge}function V(e,t){let r=e.startPosition.row;for(let n of e.text.matchAll(he)){let s=n[1]??"";for(let a of s.matchAll(Se))a[1]&&t(a[1],r)}}var xe=[/\bdefault\s*=\s*"([^"]+)"/g,/\bwith\s*=\s*"([^"]+)"/g,/\bserialize_with\s*=\s*"([^"]+)"/g,/\bdeserialize_with\s*=\s*"([^"]+)"/g,/\bskip_serializing_if\s*=\s*"([^"]+)"/g,/\bgetter\s*=\s*"([^"]+)"/g,/\brename_all_with\s*=\s*"([^"]+)"/g,/\bschema_with\s*=\s*"([^"]+)"/g],_e=/^#!?\[\s*serde\s*\(/,Ce=/^#!?\[\s*schemars\s*\(/,Ne=/^#!?\[\s*validate\s*\(/,Le=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function G(e,t,r){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript"||e.type!=="call_expression")return;let n=e.childForFieldName("function")??e.namedChild(0);if(!n)return;let s=g(n);if(!s||!Le.has(s))return;let a=e.namedChildren.find(u=>u.type==="arguments");if(!a)return;let i=a.namedChild(0);if(!i||i.type!=="string")return;let o=i.namedChildren.find(u=>u.type==="string_fragment");o&&r.add(o.text)}function U(e,t){let r=_e.test(e),n=Ce.test(e),s=Ne.test(e);if(!(!r&&!n&&!s))for(let a of xe){a.lastIndex=0;let i;for(;(i=a.exec(e))!==null;){let o=i[1],u=o.split("::").pop()??o;u==="is_none"&&/\bOption\b/.test(o)||u==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(o)||u&&t.add(u)}}}function z(e,t){let r=new Map,n=(i,o)=>{if(i===o)return;let u=r.get(i);u||(u=new Set,r.set(i,u)),u.add(o)},s=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),a=(i,o)=>{let u=c=>{s.has(c.type)&&c.text!==o&&n(c.text,o);for(let p of c.children)u(p)};for(let c of i.children)u(c)};if(t==="rust")for(let i of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let o=i.namedChildren.find(c=>c.type==="type_identifier")?.text;if(!o)continue;let u=i.namedChildren.find(c=>c.type==="field_declaration_list"||c.type==="enum_variant_list"||c.type==="ordered_field_declaration_list");u&&a(u,o),i.type==="type_item"&&a(i,o)}else if(t==="python")for(let i of e.rootNode.descendantsOfType("class_definition")){let o=i.namedChildren.find(c=>c.type==="identifier")?.text;if(!o)continue;let u=i.namedChildren.find(c=>c.type==="block");if(u)for(let c of u.descendantsOfType("type"))for(let p of c.descendantsOfType("identifier"))p.text!==o&&n(p.text,o)}else for(let i of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let o=i.namedChildren.find(u=>u.type==="type_identifier")?.text;o&&a(i,o)}return r}var W=new WeakMap;function m(e,t){let r=y(t);if(!r)return null;let n=N(e,t);if(!n)return null;let s=W.get(n);if(s)return s;let a=Fe(n,r);return W.set(n,a),a}function Ae(e,t,r,n){let s=m(e,t);return s?we(s,r,n)?.isLiteralPassthrough??!0:!0}function we(e,t,r){return e.callables.find(n=>n.startLine===t&&n.endLine===r)??null}function Fe(e,t){let r=[],n=[],s=new Set,a=new Set,i=new Map,o=(c,p)=>{let l=i.get(c);if(!l){i.set(c,[p]);return}l[l.length-1]!==p&&l.push(p)},u=c=>{let p=D(c,t);p&&r.push(p);let l=O(c,t);l&&n.push(l),G(c,t,a),t==="rust"&&(c.type==="attribute_item"||c.type==="inner_attribute_item")&&U(c.text,s),B(c,t)&&o(c.text,c.startPosition.row),Q(c,t)&&V(c,o);for(let d of c.children)u(d)};return u(e.rootNode),{language:t,callables:r,callSites:n,typeContainerMap:z(e,t),identifierLineMap:i,identifiersByLine:H(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:s,crossLanguageDispatchNames:a}}var Y=new Set(["rust","typescript","tsx","javascript","python"]);function ke(e,t){let r=m(e,t);return!r||!Y.has(r.language)?null:r.callables.map(n=>({name:n.name,startLine:n.startLine,endLine:n.endLine}))}function Re(e,t){let r=m(e,t);return!r||!Y.has(r.language)?null:r.callSites}function Te(e,t){return m(e,t)?.typeContainerMap??new Map}function je(e,t,r={}){let n=m(e,t);if(!n)return[];let s=[];if(r.includeCrossLanguageDispatchNames)for(let a of n.crossLanguageDispatchNames)s.push({name:a,kind:"cross-language-dispatch",occurrences:1});if(r.includeRustAttributeNames&&n.language==="rust")for(let a of n.rustAttrReferencedNames)s.push({name:a,kind:"rust-attribute",occurrences:1});return s}export{S as a,Pe as b,y as c,x as d,N as e,m as f,Ae as g,ke as h,Re as i,Te as j,je as k};
4
- //# sourceMappingURL=chunk-WQFOZIID.js.map