scip-query 0.6.7 → 0.7.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 (219) hide show
  1. package/README.md +3 -1
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/chunk-23YIGCYF.js +25 -0
  4. package/dist/{chunk-KQWFRAQI.js → chunk-2IYEIFPP.js} +6 -6
  5. package/dist/chunk-2JEFS2YJ.js +2 -0
  6. package/dist/chunk-33SSUPCB.js +7 -0
  7. package/dist/chunk-3GNFUVFA.js +2 -0
  8. package/dist/{chunk-ZNNCDAYX.js → chunk-3OUC276S.js} +2 -2
  9. package/dist/{chunk-PQTGBYXV.js → chunk-4STLJYHI.js} +4 -4
  10. package/dist/chunk-563HLCDW.js +35 -0
  11. package/dist/chunk-5TT47UMX.js +44 -0
  12. package/dist/chunk-6H2XIIPY.js +71 -0
  13. package/dist/{chunk-HTJ5BOYP.js → chunk-72JOIFXL.js} +3 -3
  14. package/dist/chunk-7H4RJ4MC.js +2 -0
  15. package/dist/chunk-7O4MJYIW.js +63 -0
  16. package/dist/chunk-7OX2O53H.js +62 -0
  17. package/dist/chunk-A2AVLALL.js +2 -0
  18. package/dist/chunk-AQYBOORI.js +2 -0
  19. package/dist/chunk-ARBZM2NF.js +34 -0
  20. package/dist/{chunk-2CC7RA6B.js → chunk-BI4F6GXI.js} +2 -2
  21. package/dist/chunk-BOVNTAKQ.js +3 -0
  22. package/dist/chunk-CKIO6SVS.js +2 -0
  23. package/dist/chunk-D6Z67MZL.js +2 -0
  24. package/dist/chunk-DFK54IRN.js +2 -0
  25. package/dist/chunk-FD37DBTD.js +2 -0
  26. package/dist/chunk-FOQQDXE7.js +2 -0
  27. package/dist/chunk-GAQGJ52J.js +11 -0
  28. package/dist/chunk-IODTPF5H.js +20 -0
  29. package/dist/chunk-J6Z5YKGQ.js +4 -0
  30. package/dist/chunk-JB4PUN5S.js +40 -0
  31. package/dist/chunk-JTXKS5GK.js +3 -0
  32. package/dist/chunk-KJ3ZJIE5.js +2 -0
  33. package/dist/chunk-KJ6CW6EK.js +2 -0
  34. package/dist/{chunk-2R7OKZE5.js → chunk-KNA6Z7JB.js} +3 -3
  35. package/dist/{chunk-FYO3FPFH.js → chunk-LDV2B7ET.js} +8 -8
  36. package/dist/chunk-LWYIGRHR.js +5 -0
  37. package/dist/chunk-MDAYGS6T.js +2 -0
  38. package/dist/chunk-MX6F756F.js +2 -0
  39. package/dist/chunk-NHDPYW7O.js +2 -0
  40. package/dist/{chunk-TYRPQE6R.js → chunk-NKJKI6SE.js} +2 -2
  41. package/dist/chunk-NN3O7TPH.js +8 -0
  42. package/dist/chunk-NSTZMBAB.js +18 -0
  43. package/dist/chunk-NYEMZHUC.js +6 -0
  44. package/dist/chunk-OHEIZWIA.js +4 -0
  45. package/dist/chunk-PG3ZI5IH.js +2 -0
  46. package/dist/chunk-QAEDNTY7.js +2 -0
  47. package/dist/chunk-QE6MGGUY.js +2 -0
  48. package/dist/chunk-QPRIYXH4.js +2 -0
  49. package/dist/chunk-QWJBIBE6.js +3 -0
  50. package/dist/chunk-RCJEFQOK.js +4 -0
  51. package/dist/chunk-ROOHENEP.js +61 -0
  52. package/dist/{chunk-2YA36CXK.js → chunk-ROZNBWIF.js} +2 -2
  53. package/dist/chunk-TGK5DFBJ.js +2 -0
  54. package/dist/chunk-TKDJQ2WD.js +59 -0
  55. package/dist/chunk-TRNAQABL.js +7 -0
  56. package/dist/chunk-U75WH4XG.js +2 -0
  57. package/dist/chunk-V53J46BX.js +2 -0
  58. package/dist/chunk-V76FCF5F.js +2 -0
  59. package/dist/chunk-VUBQBW7H.js +16 -0
  60. package/dist/chunk-WJQY2LGT.js +2 -0
  61. package/dist/{chunk-ILQSK2KJ.js → chunk-WODJHE6Z.js} +3 -3
  62. package/dist/{chunk-RRWPHKZA.js → chunk-WPLKHAH7.js} +4 -4
  63. package/dist/chunk-XO6R3X5J.js +2 -0
  64. package/dist/chunk-YSZNAG4G.js +2 -0
  65. package/dist/chunk-ZNUPGRPR.js +3 -0
  66. package/dist/{chunk-OCQN6WF4.js → chunk-ZXFTC5ET.js} +4 -4
  67. package/dist/cli.js +361 -505
  68. package/dist/config-types-CGIeLEpY.d.ts +108 -0
  69. package/dist/db-DdTPetj5.d.ts +69 -0
  70. package/dist/health-x7B4Xu_6.d.ts +119 -0
  71. package/dist/index.d.ts +109 -336
  72. package/dist/index.js +3 -131
  73. package/dist/postinstall.js +1 -1
  74. package/dist/queries/affected.d.ts +9 -2
  75. package/dist/queries/affected.js +1 -1
  76. package/dist/queries/bottlenecks.d.ts +14 -2
  77. package/dist/queries/bottlenecks.js +1 -1
  78. package/dist/queries/by-kind.d.ts +12 -2
  79. package/dist/queries/by-kind.js +1 -1
  80. package/dist/queries/call-graph.d.ts +22 -3
  81. package/dist/queries/call-graph.js +1 -1
  82. package/dist/queries/change-surface.d.ts +19 -3
  83. package/dist/queries/change-surface.js +1 -1
  84. package/dist/queries/code.d.ts +12 -2
  85. package/dist/queries/code.js +1 -1
  86. package/dist/queries/complexity-hotspots.d.ts +16 -2
  87. package/dist/queries/complexity-hotspots.js +1 -1
  88. package/dist/queries/complexity.d.ts +22 -3
  89. package/dist/queries/complexity.js +1 -1
  90. package/dist/queries/convergence.d.ts +25 -3
  91. package/dist/queries/convergence.js +1 -1
  92. package/dist/queries/coupling.d.ts +8 -2
  93. package/dist/queries/coupling.js +1 -1
  94. package/dist/queries/cycles.d.ts +16 -2
  95. package/dist/queries/cycles.js +1 -1
  96. package/dist/queries/dataflow.d.ts +35 -3
  97. package/dist/queries/dataflow.js +1 -1
  98. package/dist/queries/dead.d.ts +34 -2
  99. package/dist/queries/dead.js +1 -1
  100. package/dist/queries/deep-chains.d.ts +8 -2
  101. package/dist/queries/deep-chains.js +1 -1
  102. package/dist/queries/deps.d.ts +6 -2
  103. package/dist/queries/deps.js +1 -1
  104. package/dist/queries/diff-impact.d.ts +22 -2
  105. package/dist/queries/diff-impact.js +1 -1
  106. package/dist/queries/drift.d.ts +19 -2
  107. package/dist/queries/drift.js +1 -1
  108. package/dist/queries/extract-candidates.d.ts +20 -2
  109. package/dist/queries/extract-candidates.js +1 -1
  110. package/dist/queries/fan.d.ts +7 -2
  111. package/dist/queries/fan.js +1 -1
  112. package/dist/queries/files.d.ts +6 -2
  113. package/dist/queries/files.js +1 -1
  114. package/dist/queries/health.d.ts +4 -81
  115. package/dist/queries/health.js +1 -1
  116. package/dist/queries/hierarchy.d.ts +8 -2
  117. package/dist/queries/hierarchy.js +1 -1
  118. package/dist/queries/hotspots.d.ts +10 -2
  119. package/dist/queries/hotspots.js +1 -1
  120. package/dist/queries/imports.d.ts +19 -4
  121. package/dist/queries/imports.js +1 -1
  122. package/dist/queries/index.d.ts +45 -44
  123. package/dist/queries/index.js +1 -1
  124. package/dist/queries/isolated.d.ts +13 -2
  125. package/dist/queries/isolated.js +1 -1
  126. package/dist/queries/members.d.ts +10 -2
  127. package/dist/queries/members.js +1 -1
  128. package/dist/queries/methods.d.ts +8 -2
  129. package/dist/queries/methods.js +1 -1
  130. package/dist/queries/outline.d.ts +10 -2
  131. package/dist/queries/outline.js +1 -1
  132. package/dist/queries/passthrough-candidates.d.ts +15 -2
  133. package/dist/queries/passthrough-candidates.js +1 -1
  134. package/dist/queries/redundant-reexports.d.ts +13 -2
  135. package/dist/queries/redundant-reexports.js +1 -1
  136. package/dist/queries/refs.d.ts +10 -3
  137. package/dist/queries/refs.js +1 -1
  138. package/dist/queries/similar-chains.d.ts +21 -2
  139. package/dist/queries/similar-chains.js +1 -1
  140. package/dist/queries/similar-files.d.ts +12 -2
  141. package/dist/queries/similar-files.js +1 -1
  142. package/dist/queries/similar-signatures.d.ts +18 -2
  143. package/dist/queries/similar-signatures.js +1 -1
  144. package/dist/queries/similar.d.ts +24 -2
  145. package/dist/queries/similar.js +1 -1
  146. package/dist/queries/slice.d.ts +17 -2
  147. package/dist/queries/slice.js +1 -1
  148. package/dist/queries/stale-abstractions.d.ts +37 -3
  149. package/dist/queries/stale-abstractions.js +1 -1
  150. package/dist/queries/stats.d.ts +11 -2
  151. package/dist/queries/stats.js +1 -1
  152. package/dist/queries/surface.d.ts +8 -2
  153. package/dist/queries/surface.js +1 -1
  154. package/dist/queries/symbols.d.ts +10 -2
  155. package/dist/queries/symbols.js +1 -1
  156. package/dist/queries/system.d.ts +10 -2
  157. package/dist/queries/system.js +1 -1
  158. package/dist/queries/trace.d.ts +21 -3
  159. package/dist/queries/trace.js +1 -1
  160. package/dist/queries/wrapper-candidates.d.ts +15 -2
  161. package/dist/queries/wrapper-candidates.js +1 -1
  162. package/dist/reindex-worker.js +10 -10
  163. package/dist/reindex.d.ts +153 -0
  164. package/dist/reindex.js +69 -0
  165. package/dist/runtime.d.ts +108 -0
  166. package/dist/runtime.js +3 -0
  167. package/dist/scip-cli-a-xOztiK.d.ts +20 -0
  168. package/package.json +184 -4
  169. package/dist/chunk-2AUZ3PLO.js +0 -2
  170. package/dist/chunk-3A2M7AF3.js +0 -4
  171. package/dist/chunk-3EJRPTTB.js +0 -2
  172. package/dist/chunk-3SWWYJPB.js +0 -6
  173. package/dist/chunk-4M4FEWBL.js +0 -7
  174. package/dist/chunk-4Y6KUJDO.js +0 -39
  175. package/dist/chunk-55ZJ2FCW.js +0 -6
  176. package/dist/chunk-6FLGPRBR.js +0 -5
  177. package/dist/chunk-6XRB6ATD.js +0 -16
  178. package/dist/chunk-7EQ4J66C.js +0 -2
  179. package/dist/chunk-7TGEXAN5.js +0 -25
  180. package/dist/chunk-ABLXPGAZ.js +0 -2
  181. package/dist/chunk-BG7YU4DJ.js +0 -2
  182. package/dist/chunk-D2R6IIEO.js +0 -2
  183. package/dist/chunk-E47WMJ5F.js +0 -2
  184. package/dist/chunk-EEA3R37V.js +0 -11
  185. package/dist/chunk-FAN2CVZT.js +0 -2
  186. package/dist/chunk-FVH3Y44U.js +0 -1
  187. package/dist/chunk-G47V5V3U.js +0 -90
  188. package/dist/chunk-GS55K4WJ.js +0 -85
  189. package/dist/chunk-H4DXD2FB.js +0 -5
  190. package/dist/chunk-HADDFTMU.js +0 -2
  191. package/dist/chunk-IARIBTCL.js +0 -2
  192. package/dist/chunk-IBWYWAWE.js +0 -70
  193. package/dist/chunk-JVMXNDRU.js +0 -2
  194. package/dist/chunk-K345WFTU.js +0 -2
  195. package/dist/chunk-K6ULLR7M.js +0 -19
  196. package/dist/chunk-KAM4C6ZD.js +0 -4
  197. package/dist/chunk-KCC3GMCX.js +0 -2
  198. package/dist/chunk-KRVRD6KZ.js +0 -5
  199. package/dist/chunk-KYGNCIJ6.js +0 -84
  200. package/dist/chunk-LHLXHH43.js +0 -2
  201. package/dist/chunk-LJ2YWNQF.js +0 -2
  202. package/dist/chunk-M7GBLQG4.js +0 -7
  203. package/dist/chunk-MEVK6R7N.js +0 -2
  204. package/dist/chunk-QRYEOK3M.js +0 -2
  205. package/dist/chunk-QYWGC7JV.js +0 -114
  206. package/dist/chunk-R373SHXM.js +0 -2
  207. package/dist/chunk-RUAJV3TN.js +0 -2
  208. package/dist/chunk-S57GUI2T.js +0 -7
  209. package/dist/chunk-SVUVC5VS.js +0 -2
  210. package/dist/chunk-T426XELO.js +0 -12
  211. package/dist/chunk-TBJDUS4E.js +0 -71
  212. package/dist/chunk-TX7BHRMT.js +0 -2
  213. package/dist/chunk-WPY46NIL.js +0 -5
  214. package/dist/chunk-X3Z4KZNX.js +0 -2
  215. package/dist/db-DdlToIC-.d.ts +0 -835
  216. package/dist/queries/drift-policy.d.ts +0 -6
  217. package/dist/queries/drift-policy.js +0 -2
  218. package/dist/queries/health-cache-control.d.ts +0 -15
  219. package/dist/queries/health-cache-control.js +0 -2
@@ -1,2 +0,0 @@
1
- import{a as b}from"./chunk-SVUVC5VS.js";import{g as y,j as g,q as m,u as p}from"./chunk-KYGNCIJ6.js";function C(n,t,s,o){let r=y(t);if(!r)return!0;let i=g(n,t);if(!i)return!0;let l=x.get(i);return l||(l=L(i,r),x.set(i,l)),l.get(`${s}:${o}`)??!0}var x=new WeakMap;function L(n,t){let s=t==="rust"?new Set(["function_item","function_signature_item"]):t==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),o=new Map,r=i=>{s.has(i.type)&&o.set(`${i.startPosition.row}:${i.endPosition.row}`,_(i,t));for(let l of i.children)r(l)};return r(n.rootNode),o}function _(n,t){let s=n.namedChildren.find(e=>e.type==="block"||e.type==="statement_block");if(!s)return!1;let o=s.namedChildren.filter(e=>e.type!=="comment"&&e.type!=="line_comment"&&e.type!=="block_comment");if(o.length!==1)return!1;let r=o[0],i=null;if(r.type==="return_statement"||r.type==="expression_statement"?i=r.namedChild(0)??null:t==="rust"&&(r.type==="call_expression"||r.type==="macro_invocation")&&(i=r),!i)return!1;let l=t==="python"?"call":"call_expression";if(i.type!==l)return!1;let u=i.namedChildren.find(e=>e.type==="arguments"||e.type==="argument_list");if(!u)return!1;let d=u.namedChildren.filter(e=>e.type!=="comment"),c=n.namedChildren.find(e=>e.type==="parameters"||e.type==="formal_parameters");if(!c)return!1;let a=[];for(let e of c.namedChildren)if(e.type==="identifier")a.push(e.text);else{let f=e.namedChildren.find(S=>S.type==="identifier");f&&a.push(f.text)}if(d.length!==a.length)return!1;for(let e=0;e<a.length;e+=1){let f=d[e];if(f.type!=="identifier"||f.text!==a[e])return!1}return!0}function j(n,t){let{scope:s,maxLoc:o=15,limit:r=30,scanLimit:i}=t??{},l=new b(n),u=D(w(l,s,o).sort((a,e)=>h(a)-h(e)||a.relativePath.localeCompare(e.relativePath)),i),d=l.calleeMap(u),c=[];for(let a of u){let e=P(n,a,d.get(a.symbolId)??[]);e&&c.push(e)}return c.sort((a,e)=>a.loc-e.loc||a.file.localeCompare(e.file)),c.slice(0,r)}function P(n,t,s){let o=T(s);if(o.size!==1||!C(n,t.relativePath,t.startLine,t.endLine))return null;let[,r]=[...o.entries()][0];return{symbol:t.symbol,shortName:m(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:h(t),forwardsTo:r.symbol,forwardsToShort:m(r.symbol),forwardsToFile:r.file}}function T(n){let t=n.some(o=>p(o.symbol))?n.filter(o=>p(o.symbol)):n,s=new Map;for(let o of t)s.has(o.symbol)||s.set(o.symbol,o);return s}function w(n,t,s){return n.productionCallableDefinitions({scope:t,minLoc:3,maxLoc:s,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0})}function h(n){return n.endLine-n.startLine+1}function D(n,t){return typeof t!="number"||t<=0||n.length<=t?n:n.slice(0,t)}export{j as a};
2
- //# sourceMappingURL=chunk-FAN2CVZT.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-FVH3Y44U.js.map
@@ -1,90 +0,0 @@
1
- import{C as F,b as Y,r as C}from"./chunk-KYGNCIJ6.js";import g from"path";import{createRequire as Ye}from"module";import{existsSync as T,readdirSync as Ge,readFileSync as pe}from"fs";import{existsSync as R}from"fs";import{basename as he,dirname as y,extname as S,join as p,relative as E,resolve as f}from"path";var ye=Y("indexed-paths"),N=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],G=[".py",".pyi"],q=[".java",".scala",".kt",".kts"],Q=[".rs"],Z=[".rb"],ee=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],te=[".cs",".vb"],ne=[".dart"],re=[".php"],Ie=new Set(N),O=new Set(G),ie=new Set(q),P=new Set(Q),A=new Set(Z),oe=new Set(ee),se=new Set(te),j=new Set(ne),ae=new Set(re),xe=[{extensions:N,lookup:Ie},{extensions:G,lookup:O},{extensions:q,lookup:ie},{extensions:Q,lookup:P},{extensions:Z,lookup:A},{extensions:ee,lookup:oe},{extensions:te,lookup:se},{extensions:ne,lookup:j},{extensions:re,lookup:ae}];function I(t,e){return e.has(S(t).toLowerCase())}function Ee(t){return I(t,O)}function Ne(t){return I(t,ie)}function be(t){return I(t,P)}function ve(t){return I(t,A)}function ke(t){return I(t,oe)}function De(t){return I(t,se)}function Dt(t){return S(t).toLowerCase()===".vb"}function Re(t){return I(t,j)}function Te(t){return I(t,ae)}function Le(t){let e=S(t).toLowerCase();for(let n of xe)if(n.lookup.has(e))return n.extensions;return N}function _e(t){return Ne(t)||De(t)||Te(t)}function w(t,e,n){return Ee(e)?Ce(t,e,n):be(e)?Fe(t,e,n):ve(e)?Oe(t,e,n):ke(e)?Pe(t,e,n):_e(e)?Ae(t,n.replace(/\\/g,"."),Le(e)):Re(e)?je(t,e,n):Me(t,e,n)}function Me(t,e,n){if(!n.startsWith(".")&&!n.startsWith("/"))return null;let r=y(p(t.config.projectRoot,e)),i=f(r,n),o=b(t);for(let s of Ke(i)){let a=x(E(t.config.projectRoot,s));if(o.has(a)||R(s))return a}return x(E(t.config.projectRoot,i))}function Ce(t,e,n){let r=b(t),i;if(n.startsWith(".")){let o=n.match(/^(\.+)(.*)$/);if(!o)return null;let s=o[1].length,a=o[2].replace(/^\./,""),c=y(p(t.config.projectRoot,e));for(let l=1;l<s;l++)c=y(c);i=a?f(c,a.replace(/\./g,"/")):c}else i=f(t.config.projectRoot,n.replace(/\./g,"/"));for(let o of we(i)){let s=x(E(t.config.projectRoot,o));if(r.has(s)||R(o))return s}return null}function Fe(t,e,n){if(!n)return null;let r=n.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let i=y(p(t.config.projectRoot,e)),o;return r.startsWith("crate::")?o=f(t.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?o=f(i,r.slice(6).replace(/::/g,"/")):o=f(y(i),r.slice(7).replace(/::/g,"/")),W(t,We(o))}function Oe(t,e,n){let r=y(p(t.config.projectRoot,e)),i=f(r,n);return W(t,$e(i))}function Pe(t,e,n){let r=y(p(t.config.projectRoot,e)),i=[f(r,n),f(t.config.projectRoot,n),f(t.config.projectRoot,"include",n),f(t.config.projectRoot,"src",n)];return W(t,i)}function Ae(t,e,n){let r=b(t),i=e.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=i.replace(/\./g,"/"),s=i.split(".").pop()??i;for(let c of n){let l=`${o}${c}`,d=[...r].find(m=>m.endsWith(l));if(d)return d}for(let c of n){let l=[...r].find(d=>he(d)===`${s}${c}`);if(l)return l}let a=[...r].filter(c=>n.includes(S(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${s}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function je(t,e,n){let r=b(t);if(n.startsWith("package:")){let s=n.slice(8),a=s.indexOf("/");if(a<0)return null;let c=s.slice(a+1),l=x(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let i=y(p(t.config.projectRoot,e)),o=f(i,n);for(let s of Ue(o)){let a=x(E(t.config.projectRoot,s));if(r.has(a)||R(s))return a}return null}function we(t){let e=S(t);return O.has(e)?[t]:[`${t}.py`,`${t}.pyi`,p(t,"__init__.py"),p(t,"__init__.pyi")]}function W(t,e){let n=b(t);for(let r of e){let i=x(E(t.config.projectRoot,r));if(n.has(i)||R(r))return i}return null}function We(t){let e=S(t);return P.has(e)?[t]:[`${t}.rs`,p(t,"mod.rs")]}function $e(t){let e=S(t);return A.has(e)?[t]:[`${t}.rb`,p(t,"index.rb")]}function Ue(t){let e=S(t);return j.has(e)?[t]:[`${t}.dart`,t]}function Ke(t){let e=S(t),n=new Set;if(e){n.add(t);for(let r of N)n.add(t.slice(0,-e.length)+r)}else for(let r of N)n.add(`${t}${r}`),n.add(p(t,`index${r}`));return[...n]}function b(t){return ye.get(t,()=>new Set(t.all(`SELECT relative_path
2
- FROM documents
3
- WHERE 1 = 1
4
- ${t.pathExclusionsFor("documents")}`).map(e=>x(e.relative_path)).filter(e=>!t.isIgnored(e))))}function x(t){return t.replace(/\\/g,"/")}import{existsSync as v,readFileSync as He,readdirSync as Xe,statSync as Je}from"fs";import u from"path";var U=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function K(t,e){let r=e?u.dirname(u.join(t,e)):t,i=u.resolve(t);for(;r.startsWith(i);){for(let s of U){let a=u.join(r,s);if(v(a))return a}let o=u.dirname(r);if(o===r)break;r=o}for(let o of U){let s=u.join(t,o);if(v(s))return s}return null}function ce(t){let e=t.config.projectRoot,n=new Set(Be(e,t.config.semantic?.typescript?.tsconfigs)),r=t.all(`SELECT relative_path
5
- FROM documents
6
- WHERE (
7
- relative_path LIKE '%.ts'
8
- OR relative_path LIKE '%.tsx'
9
- OR relative_path LIKE '%.mts'
10
- OR relative_path LIKE '%.cts'
11
- OR relative_path LIKE '%.js'
12
- OR relative_path LIKE '%.jsx'
13
- OR relative_path LIKE '%.mjs'
14
- OR relative_path LIKE '%.cjs'
15
- )
16
- ${t.pathExclusionsFor("documents")}`);for(let i of r){if(t.isIgnored(i.relative_path))continue;let o=K(e,i.relative_path);o&&n.add(u.resolve(o))}if(n.size===0){let i=K(e);i&&n.add(u.resolve(i))}return[...n].filter(i=>!le(e,i)).sort((i,o)=>i.localeCompare(o))}function Be(t,e=[]){let n=new Set;for(let r of e){let i=u.isAbsolute(r)?r:u.join(t,r);v(i)&&n.add(u.resolve(i))}for(let r of Ve(t))for(let i of U){let o=u.join(r,i);v(o)&&n.add(u.resolve(o))}if(n.size===0){let r=K(t);r&&n.add(u.resolve(r))}return[...n].filter(r=>!le(t,r)).sort((r,i)=>r.localeCompare(i))}function Ve(t){let e=u.join(t,"package.json");if(!v(e))return[];let n;try{n=JSON.parse(He(e,"utf8"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(i=>ze(t,i))}function ze(t,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=u.join(t,e);return $(s)?[s]:[]}let n=e.indexOf("*"),r=e.slice(0,n).replace(/\/$/,""),i=e.slice(n+1).replace(/^\//,""),o=u.join(t,r||".");return $(o)?Xe(o).map(s=>u.join(o,s,i)).filter($):[]}function $(t){try{return Je(t).isDirectory()}catch{return!1}}function le(t,e){let n=u.relative(t,e).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}var qe=Ye(import.meta.url),k;function ge(t,e){let n=Qe();if(!n)return H("ts-morph is not installed");let r=ce(t);if(r.length===0)return H("no tsconfig found");try{let i=r.map(o=>({tsconfigPath:o,project:new n.Project({tsConfigFilePath:o,skipFileDependencyResolution:!1})}));return new X(t,n,i)}catch(i){return H(i instanceof Error?i.message:String(i),r[0],r)}}function Qe(){if(k!==void 0)return k;try{k=qe("ts-morph")}catch{k=null}return k}function H(t,e,n){return{language:"typescript",availability:()=>({available:!1,reason:t,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var X=class{constructor(e,n,r){this.db=e;this.tsMorph=n;this.projects=r;this.workspacePackages=rt(e.config.projectRoot)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;sourceFileCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return h(this.importUsageCache,e,()=>{let n=this.sourceFile(e);if(!n)return[];let r=[];for(let i of n.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,i))r.push(o);return r})}referencesFor(e){return h(this.referencesCache,e.symbolId,()=>{let n=this.nodeForDefinition(e),r=this.packageImportReferencesForDefinition(e);return n?ut(n,e,r,this.db.config.projectRoot):r})}calleesFor(e){return h(this.calleesCache,e.symbolId,()=>h(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return h(this.signatureCache,e.symbolId,()=>{let n=this.nodeForDefinition(e);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let r=n.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return fe(c)}),o=r.getReturnType().getText(n);return`(${i.join(",")})=>${fe(o)}`})}importUsageForDeclaration(e,n){let r=w(this.db,e,n.getModuleSpecifierValue()),i=ue(n);return n.getImportClause()?.isTypeOnly()?i.map(o=>tt(e,r,o)):i.map(o=>this.valueImportUsageForEntry(e,r,o))}valueImportUsageForEntry(e,n,r){let i=r.identifier?r.identifier.findReferences():[],o=[];for(let l of i)for(let d of dt(l,e,r.identifier,this.db.config.projectRoot))o.push(d);let s=o.some(l=>!de(l.node)),a=o.some(l=>de(l.node)),c=r.isTypeOnly;return{importer:e,sourcePath:n,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:c,isUsed:c||o.length>0,isTypeUsed:c||a,isValueUsed:s,references:o.map(l=>l.location)}}sourceFile(e){return this.sourceFileMatch(e)?.sourceFile??null}sourceFileMatch(e){return It(e)?h(this.sourceFileCache,e,()=>{let n=g.join(this.db.config.projectRoot,e);for(let{project:r}of this.projects){let i=r.getSourceFile(n)??r.addSourceFileAtPathIfExists(n)??null;if(i)return{project:r,sourceFile:i}}return null}):null}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,n=this.packageExports();for(let r of this.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,n,r);for(let[r,i]of e)e.set(r,J(i));return this.packageImportReferenceIndex=e,e}indexedTypeScriptLikeDocuments(){return this.db.all(`SELECT relative_path
17
- FROM documents
18
- WHERE (
19
- relative_path LIKE '%.ts'
20
- OR relative_path LIKE '%.tsx'
21
- OR relative_path LIKE '%.mts'
22
- OR relative_path LIKE '%.cts'
23
- OR relative_path LIKE '%.js'
24
- OR relative_path LIKE '%.jsx'
25
- OR relative_path LIKE '%.mjs'
26
- OR relative_path LIKE '%.cjs'
27
- )
28
- ${this.db.pathExclusionsFor("documents")}`).map(e=>e.relative_path)}addPackageImportReferencesForDocument(e,n,r){if(this.db.isIgnored(r))return;let i=this.sourceFileMatch(r);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,n,r,o)}addPackageImportReferencesForDeclaration(e,n,r,i){let o=st(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=n.get(o);if(s)for(let a of ue(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=ft(a.identifier,r,this.db.config.projectRoot);l.length>0&&ht(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let n of this.workspacePackages){let r=new Map;for(let i of at(n))this.collectPackageExports(n,i,r,new Set);r.size>0&&e.set(n.name,r)}return this.packageExportIndex=e,e}collectPackageExports(e,n,r,i){if(i.has(n))return;i.add(n);let o=this.sourceFile(n);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?w(this.db,n,a):n;if(!c||!c.startsWith(`${e.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,r,i);continue}for(let d of l){let m=d.getNameNode().getText(),V=d.getAliasNode()?.getText()??m,z=this.indexedDefinitionByLeaf(c,m);if(!z)continue;let D=r.get(V);D||(D=new Set,r.set(V,D)),D.add(z.symbolId)}}}indexedDefinitionByLeaf(e,n){return h(this.indexedDefinitionLeafCache,e,()=>mt(this.db,e)).get(n)??null}nodeForDefinition(e){return h(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return h(this.fileDefinitionNodeCache,e,()=>{let n=this.sourceFile(e);if(!n)return new Map;let r=Ze(this.db,e);return r.size===0?new Map:et(this.tsMorph,n,r)})}definitionFromSymbol(e){let n=e.getDeclarations();for(let r of n){let i=r.getSourceFile(),o=_(this.db.config.projectRoot,i.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=L(i,r),a=gt(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let n=this.sourceFile(e);if(!n)return new Map;let r=F(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(r.length===0)return new Map;let i=new Map;n.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(n,r,o);s&&nt(i,s.callerId,s.target)});for(let[o,s]of i)i.set(o,yt(s));return i}semanticCalleeForCallNode(e,n,r){let i=St(n,L(e,r));if(!i)return null;let o=r.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:i.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function ue(t){let e=[],n=t.getDefaultImport();n&&e.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:t.getImportClause()?.isTypeOnly()??!1});let r=t.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:t.getImportClause()?.isTypeOnly()??!1});for(let i of t.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(t.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Ze(t,e){let n=new Map;for(let r of F(t,e)){let i=C(r.symbol)??r.leaf;if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.push(r)}return n}function et(t,e,n){let r=new Map,i=new Map;return e.forEachDescendant(o=>{for(let s of pt(t,o)){let a=n.get(s);if(!a)continue;let c=L(e,o);for(let l of a){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),m=i.get(l.symbolId);m!==void 0&&m<=d||(i.set(l.symbolId,d),r.set(l.symbolId,o))}}}),r}function tt(t,e,n){return{importer:t,sourcePath:e,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function nt(t,e,n){let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}function rt(t){let e=g.join(t,"package.json");if(!T(e))return[];let n;try{n=JSON.parse(pe(e,"utf8"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(i=>it(t,i)).flatMap(i=>ot(t,i))}function it(t,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=g.join(t,e);return T(g.join(s,"package.json"))?[s]:[]}let n=e.indexOf("*"),r=e.slice(0,n).replace(/\/$/,""),i=e.slice(n+1).replace(/^\//,""),o=g.join(t,r||".");if(!T(o))return[];try{return Ge(o).map(s=>g.join(o,s,i)).filter(s=>T(g.join(s,"package.json")))}catch{return[]}}function ot(t,e){try{let n=JSON.parse(pe(g.join(e,"package.json"),"utf8"));if(!n.name)return[];let r=g.relative(t,e).replace(/\\/g,"/");return[{name:n.name,rootRelative:r,sourceRootRelative:`${r}/src`}]}catch{return[]}}function st(t,e){for(let n of t)if(e===n.name||e.startsWith(`${n.name}/`))return n.name;return null}function at(t){return[`${t.sourceRootRelative}/index.ts`,`${t.sourceRootRelative}/index.tsx`,`${t.sourceRootRelative}/index.mts`,`${t.sourceRootRelative}/index.cts`]}function ct(t,e){return t.getReferences().map(n=>{let r=n.getNode();return me(r,e)})}function lt(t){let e=t;return typeof e.findReferences=="function"?e.findReferences():[]}function ut(t,e,n,r){let i=[];for(let o of lt(t))for(let s of ct(o,r))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||i.push(s);for(let o of n)i.push(o);return J(i)}function dt(t,e,n,r){let i=[],o=n?.getStart();for(let s of t.getReferences()){let a=s.getNode();_(r,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||i.push({location:me(a,r),node:a}))}return i}function me(t,e){let n=t.getSourceFile(),r=n.getLineAndColumnAtPos(t.getStart());return{file:_(e,n.getFilePath())??n.getBaseName(),line:r.line-1,column:r.column-1}}function ft(t,e,n){let r=t.getSourceFile(),i=L(r,t),o=t.getText(),s=new RegExp(`\\b${xt(o)}\\b`,"g"),a=r.getFullText().split(`
29
- `),c=[];for(let l=0;l<a.length;l++){if(l===i)continue;let d=a[l]??"";s.lastIndex=0;let m;for(;(m=s.exec(d))!==null;)c.push({file:e,line:l,column:m.index})}return J(c.filter(l=>_(n,g.join(n,l.file))===e))}function de(t){for(let e=t;e;e=e.getParent()){let n=e.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function pt(t,e){let n=[],r=i=>{i&&!n.includes(i)&&n.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();r(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();r(i)}return t.Node.isIdentifier(e)&&r(e.getText()),n}function gt(t,e,n,r){return t.all(`SELECT
30
- gs.id AS symbolId,
31
- gs.symbol,
32
- d.relative_path AS relativePath,
33
- COALESCE(der.start_line, c.start_line) AS startLine,
34
- COALESCE(der.end_line, c.end_line) AS endLine,
35
- COALESCE(gs.display_name, '') AS leaf,
36
- NULL AS parentTypeName,
37
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
38
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
39
- gs.kind AS kind,
40
- gs.documentation AS documentation,
41
- gs.enclosing_symbol AS enclosingSymbol
42
- FROM global_symbols gs
43
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
44
- LEFT JOIN chunks c ON c.document_id = der.document_id
45
- JOIN documents d ON d.id = der.document_id
46
- WHERE d.relative_path = ?
47
- AND COALESCE(gs.display_name, gs.symbol) LIKE ?
48
- ORDER BY ABS(COALESCE(der.start_line, c.start_line) - ?)
49
- LIMIT 5`,e,`%${r}%`,n)[0]??null}function mt(t,e){let n=t.all(`SELECT
50
- d.id AS documentId,
51
- gs.id AS symbolId,
52
- gs.symbol,
53
- d.relative_path AS relativePath,
54
- der.start_line AS startLine,
55
- der.end_line AS endLine,
56
- COALESCE(gs.display_name, '') AS leaf,
57
- NULL AS parentTypeName,
58
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
59
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
60
- gs.kind AS kind,
61
- gs.documentation AS documentation,
62
- gs.enclosing_symbol AS enclosingSymbol
63
- FROM global_symbols gs
64
- JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
65
- JOIN documents d ON d.id = der.document_id
66
- WHERE d.relative_path = ?
67
- UNION ALL
68
- SELECT
69
- d.id AS documentId,
70
- gs.id AS symbolId,
71
- gs.symbol,
72
- d.relative_path AS relativePath,
73
- MIN(c.start_line) AS startLine,
74
- MAX(c.end_line) AS endLine,
75
- COALESCE(gs.display_name, '') AS leaf,
76
- NULL AS parentTypeName,
77
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
78
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
79
- gs.kind AS kind,
80
- gs.documentation AS documentation,
81
- gs.enclosing_symbol AS enclosingSymbol
82
- FROM global_symbols gs
83
- JOIN mentions m ON m.symbol_id = gs.id
84
- JOIN chunks c ON c.id = m.chunk_id
85
- JOIN documents d ON d.id = c.document_id
86
- WHERE d.relative_path = ?
87
- AND m.role = 1
88
- GROUP BY gs.id, gs.symbol, d.id, d.relative_path, gs.display_name, gs.kind, gs.documentation, gs.enclosing_symbol
89
- ORDER BY startLine, endLine`,e,e),r=new Set,i=new Map;for(let o of n){if(r.has(o.symbolId))continue;r.add(o.symbolId);let s=o.leaf||C(o.symbol);!s||i.has(s)||i.set(s,{...o,leaf:s})}return i}function St(t,e){let n=null;for(let r of t)e<r.startLine||e>r.endLine||(!n||r.startLine>=n.startLine)&&(n=r);return n}function L(t,e){return t.getLineAndColumnAtPos(e.getStart()).line-1}function J(t){let e=new Set,n=[];for(let r of t){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),n.push(r))}return n}function ht(t,e,n){for(let r of e){let i=t.get(r)??[];i.push(...n),t.set(r,i)}}function yt(t){let e=new Set,n=[];for(let r of t){let i=`${r.symbol}|${r.file}|${r.line}`;e.has(i)||(e.add(i),n.push(r))}return n}function h(t,e,n){if(t.has(e))return t.get(e);let r=n();return t.set(e,r),r}function _(t,e){let n=g.relative(t||process.cwd(),e).replace(/\\/g,"/");return!n||n.startsWith("..")?null:n}function It(t){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(t)}function fe(t){return t.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}function xt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var B=new WeakMap;function Se(t,e){let n=`${t.config.projectRoot}:typescript-workspace`,r=B.get(t);r||(r=new Map,B.set(t,r));let i=r.get(n);if(i)return i;let o=ge(t,e);return r.set(n,o),o}function $t(t){B.delete(t)}function Ht(t,e){let n=M(t,e);return n?n.importUsage(e):[]}function Et(t,e){let n=M(t,e.relativePath);return n?n.referencesFor(e):[]}function Xt(t,e){let n=new Map;for(let r of e)for(let i of Et(t,r)){if(i.file===r.relativePath||t.isIgnored(i.file))continue;let o=n.get(r.symbolId);o||(o=new Set,n.set(r.symbolId,o)),o.add(i.file)}return n}function Jt(t,e){let n=new Map;for(let r of e){let i=M(t,r.relativePath);if(!i)continue;let o=i.calleesFor(r);o.length>0&&n.set(r.symbolId,o)}return n}function Bt(t,e){let n=M(t,e.relativePath);return n?n.signatureFor(e):null}function M(t,e){if(!Nt(e))return null;let n=Se(t,e);return n.availability().available?n:null}function Nt(t){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(t)}export{q as a,te as b,re as c,Dt as d,Le as e,w as f,Ce as g,Fe as h,Oe as i,Pe as j,Ae as k,je as l,x as m,$t as n,Ht as o,Et as p,Xt as q,Jt as r,Bt as s};
90
- //# sourceMappingURL=chunk-G47V5V3U.js.map
@@ -1,85 +0,0 @@
1
- import{a as H,b as $,d as J,f as N}from"./chunk-6FLGPRBR.js";import{p as B,q as j,r as z}from"./chunk-G47V5V3U.js";import{c as W}from"./chunk-QYWGC7JV.js";import{C as M,D as k,G as v,a as h,b as w,d as A,g as y,j as S,k as C,m as x,o as P,r as L,t as G}from"./chunk-KYGNCIJ6.js";var E=new WeakMap;function St(e,t){let n=y(t);return n==="rust"?Se(e,t):n==="typescript"||n==="tsx"||n==="javascript"?ye(e,t):[]}var be=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function ye(e,t){let n=S(e,t);if(!n)return[];let s=E.get(n);if(s)return s;let o=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(t)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(t),i=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(t),r=!1,l=n.rootNode;for(let a of l.namedChildren){if(a.type!=="expression_statement")continue;let u=a.namedChild(0);if(!u||u.type!=="call_expression")continue;let d=u.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&be.has(f)){r=!0;break}}let c=[];r&&c.push({startLine:0,endLine:l.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(o||i)&&c.push({startLine:0,endLine:l.endPosition.row,reason:o?"Next.js / Remix route file":"Vite/Vue route component"});for(let a of l.namedChildren){let u=null,d=null;if(a.type==="function_declaration")u=a.namedChild(0)?.text??null,d=a;else if(a.type==="export_statement"){let f=a.namedChild(0);f?.type==="function_declaration"&&(u=f.namedChild(0)?.text??null,d=f)}else if(a.type==="lexical_declaration"){let f=a.namedChild(0);if(f?.type==="variable_declarator"){let p=f.namedChild(0)?.text,g=f.namedChild(1);p&&(g?.type==="arrow_function"||g?.type==="function_expression")&&(u=p,d=f)}}u&&/^use[A-Z]/.test(u)&&d&&c.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return c.push(...V(n,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),E.set(n,c),c}var _e=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function he(e){return _e.test(e)}function V(e,t,n){let s=[],o=i=>{if(t.has(i.type)&&i.parent){let l=i.parent.children,c=-1;for(let a=0;a<l.length;a+=1)if(l[a].startIndex===i.startIndex&&l[a].type===i.type){c=a;break}if(c>0)for(let a=c-1;a>=0;a-=1){let u=l[a];if(n.has(u.type)){if(he(u.text)){s.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(u.type==="attribute_item"||u.type==="inner_attribute_item"))break}}for(let r of i.namedChildren)o(r)};return o(e.rootNode),s}function Se(e,t){let n=S(e,t);if(!n)return[];let s=E.get(n);if(s)return s;let o=[],i=Ee(n);return i?(E.set(n,i),i):(K(n.rootNode,o,!1,!1),o.push(...V(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),o.push(...Ae(n.rootNode)),E.set(n,o),o)}function Ee(e){return xe(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function K(e,t,n,s){let o=n,i=s;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(i=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?Re(e,t,n,s):s&&we(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?Ce(e,t,n):e.type==="mod_item"&&D(e).some(r=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(r))&&(o=!0);for(let r of e.namedChildren)K(r,t,o,i)}function Re(e,t,n,s){let o=D(e),i=null;s?i="trait impl method (dynamic dispatch)":n&&(i="inside #[cfg(test)] mod");for(let r of o){let l=Le(r);if(l){i=l;break}if(Z(r)){i="#[allow(dead_code)]";break}}i&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:i})}function Ce(e,t,n){let s=D(e),o=e.namedChildren.find(i=>i.type==="type_identifier")?.text;s.some(Ie)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:o}),s.some(Z)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:o}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:o})}function D(e){let t=e.parent;if(!t)return[];let n=t.children,s=-1;for(let i=0;i<n.length;i+=1)if(n[i].startIndex===e.startIndex&&n[i].type===e.type){s=i;break}if(s<=0)return[];let o=[];for(let i=s-1;i>=0;i-=1){let r=n[i];if(r.type==="attribute_item"||r.type==="inner_attribute_item")o.push(r.text);else{if(r.type==="line_comment"||r.type==="block_comment")continue;break}}return o}function Le(e){return/#\[\s*tauri::command\b/.test(e)?"#[tauri::command]":/#\[\s*command\b/.test(e)?"#[command]":/#\[\s*test\b/.test(e)?"#[test]":/#\[\s*bench\b/.test(e)?"#[bench]":/#\[\s*tokio::test\b/.test(e)?"#[tokio::test]":/#\[\s*async_std::test\b/.test(e)?"#[async_std::test]":/#\[\s*wasm_bindgen\b/.test(e)?"#[wasm_bindgen]":/#\[\s*no_mangle\b/.test(e)?"#[no_mangle]":/#\[\s*napi\b/.test(e)?"#[napi]":/#\[\s*pyfunction\b/.test(e)?"#[pyfunction]":/#\[\s*pymethod\b/.test(e)?"#[pymethod]":/#\[\s*pyo3\b/.test(e)?"#[pyo3]":/#\[\s*cfg\s*\(\s*test\s*\)/.test(e)?"#[cfg(test)]":/#\[\s*doc\s*\(\s*hidden\s*\)/.test(e)?"#[doc(hidden)]":null}function Ie(e){return/#\[\s*derive\s*\(/.test(e)?/\bSerialize\b/.test(e)||/\bDeserialize\b/.test(e)||/\bFromRow\b/.test(e)||/\bDeriveEntityModel\b/.test(e)||/\bIntoSchema\b/.test(e)||/\bToSchema\b/.test(e)||/\bDeriveValueType\b/.test(e)||/\bsqlx::FromRow\b/.test(e)||/\bError\b/.test(e)||/\bthiserror::Error\b/.test(e):!1}function Z(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function we(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ae(e){let t=De(e);if(t.size===0)return[];let n=[];for(let s of e.descendantsOfType("mod_item")){let o=s.childForFieldName("name")?.text;o&&t.has(o)&&n.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:o})}return n}function xe(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var Ne=[{key:"default",re:/\bdefault\s*=\s*"([^"]+)"/g},{key:"with",re:/\bwith\s*=\s*"([^"]+)"/g},{key:"serialize_with",re:/\bserialize_with\s*=\s*"([^"]+)"/g},{key:"deserialize_with",re:/\bdeserialize_with\s*=\s*"([^"]+)"/g},{key:"skip_serializing_if",re:/\bskip_serializing_if\s*=\s*"([^"]+)"/g},{key:"getter",re:/\bgetter\s*=\s*"([^"]+)"/g},{key:"rename_all_with",re:/\brename_all_with\s*=\s*"([^"]+)"/g},{key:"schema_with",re:/\bschema_with\s*=\s*"([^"]+)"/g}],q=/^#!?\[\s*serde\s*\(/,Me=/^#!?\[\s*schemars\s*\(/,ke=/^#!?\[\s*validate\s*\(/,U=/\bwith\s*=\s*"([^"]+)"/g;function X(e,t){return x(e,t,ve,()=>new Set,(n,s,o)=>{if(s==="rust"){for(let i of n.rootNode.descendantsOfType("attribute_item"))Y(i.text,o);for(let i of n.rootNode.descendantsOfType("inner_attribute_item"))Y(i.text,o)}})??new Set}var ve=new WeakMap;function Y(e,t){let n=q.test(e),s=Me.test(e),o=ke.test(e);if(!(!n&&!s&&!o))for(let{re:i}of Ne){i.lastIndex=0;let r;for(;(r=i.exec(e))!==null;){let l=r[1],c=l.split("::").pop()??l;c==="is_none"&&/\bOption\b/.test(l)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(l)||c&&t.add(c)}}}function De(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){if(!q.test(n.text))continue;U.lastIndex=0;let s;for(;(s=U.exec(n.text))!==null;){let o=s[1],i=o.split("::").pop()??o;i&&t.add(i)}}return t}var Oe=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function Et(e,t){return x(e,t,Te,()=>new Set,(n,s,o)=>{if(!(s!=="typescript"&&s!=="tsx"&&s!=="javascript"))for(let i of n.rootNode.descendantsOfType("call_expression")){let r=i.namedChild(0);if(!r)continue;let l=P(r);if(!l||!Oe.has(l))continue;let c=i.namedChildren.find(d=>d.type==="arguments");if(!c)continue;let a=c.namedChild(0);if(!a||a.type!=="string")continue;let u=a.namedChildren.find(d=>d.type==="string_fragment");u&&o.add(u.text)}})??new Set}var Te=new WeakMap;var Fe=new Set(["identifier","type_identifier","field_identifier"]),Pe=new Set(["identifier"]),He=new Set(["identifier","property_identifier","type_identifier"]),$e=new Set(["rust","python"]),Je=/\{([^{}]*)\}/g,Ge=/\b([A-Za-z_][\w]*)\b/g;function ee(e,t,n,s={}){if(!n)return[];let o=A(e,t);if(!o)return[];if(o.indexOf(n)===-1)return[];if(y(t))return(O(e,t).get(n)??[]).filter(u=>!Q(u,s));let i=$(e,t,o),r=new RegExp(`\\b${J(n)}\\b`),l=[];for(let c=0;c<i.length;c++)Q(c,s)||r.test(i[c]??"")&&l.push(c);return l}function Q(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var te=h("file-identifiers");function At(e,t){return te.get(e,t,()=>new Set(O(e,t).keys()))}var ne=h("file-ident-lines");function O(e,t){return ne.get(e,t,()=>We(e,t))}var ie=h("file-idents-by-line");function se(e,t){return ie.get(e,t,()=>{let n=O(e,t),s=0;for(let i of n.values()){let r=i[i.length-1];r!==void 0&&r>s&&(s=r)}let o=new Array(s+1);for(let i=0;i<=s;i+=1)o[i]=new Set;for(let[i,r]of n)for(let l of r)o[l].add(i);return o})}function xt(e){te.invalidateAll(e),ne.invalidateAll(e),ie.invalidateAll(e)}function We(e,t){let n=new Map,s=(l,c)=>{let a=n.get(l);if(!a){n.set(l,[c]);return}a[a.length-1]!==c&&a.push(c)};if(y(t)){let l=S(e,t);if(l){let c=y(t),a=c==="rust"?Fe:c==="python"?Pe:He,u=d=>{if(a.has(d.type)&&s(d.text,d.startPosition.row),c&&$e.has(c)&&d.type==="string_content"){let f=d.startPosition.row;for(let p of d.text.matchAll(Je)){let g=p[1]??"";for(let m of g.matchAll(Ge))m[1]&&s(m[1],f)}}for(let f of d.children)u(f)};return u(l.rootNode),n}}let o=A(e,t);if(!o)return n;let i=H(o).split(/\r?\n/),r=/\b([A-Za-z_$][\w$]*)\b/g;for(let l=0;l<i.length;l+=1){let c=i[l]??"";for(let a of c.matchAll(r))a[1]&&s(a[1],l)}return n}var le=h("file-dep-graph");function $t(e){le.invalidateAll(e),ce.invalidate(e),me.invalidate(e)}function Jt(e,t){return le.get(e,t??"",()=>{let n=new Map,s=je(e),o=(i,r)=>ze(e,n,s,i,r);for(let i of Be(e,t))o(i.from_file,i.to_file);for(let i of s)if(!(t&&!i.includes(t)))for(let r of N(e,i))r.sourcePath&&o(i,r.sourcePath);return n})}function Be(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT
2
- d1.relative_path AS from_file,
3
- d2.relative_path AS to_file
4
- FROM mentions m
5
- JOIN chunks c ON m.chunk_id = c.id
6
- JOIN documents d1 ON c.document_id = d1.id
7
- JOIN global_symbols gs ON m.symbol_id = gs.id
8
- JOIN (
9
- SELECT m2.symbol_id, c2.document_id
10
- FROM mentions m2
11
- JOIN chunks c2 ON m2.chunk_id = c2.id
12
- WHERE m2.role = 1
13
- GROUP BY m2.symbol_id
14
- ) sym_def ON sym_def.symbol_id = gs.id
15
- JOIN documents d2 ON sym_def.document_id = d2.id
16
- WHERE d1.id != d2.id
17
- AND m.role != 1
18
- ${e.pathExclusionsFor("d1","d2")}
19
- ${n}`)}function je(e){return new Set(e.all(`SELECT relative_path
20
- FROM documents
21
- WHERE 1 = 1
22
- ${e.pathExclusionsFor("documents")}
23
- ORDER BY relative_path`).map(t=>t.relative_path).filter(t=>!e.isIgnored(t)))}function ze(e,t,n,s,o){if(s===o||e.isIgnored(s)||e.isIgnored(o)||!n.has(o))return;let i=t.get(s);i||(i=new Set,t.set(s,i)),i.add(o)}function Gt(e,t,n={}){let s=ue(e,[t],{additive:n.additive}),o=n.callableOnly?(s.get(t.symbolId)??[]).filter(i=>G(i.symbol)):s.get(t.symbolId)??[];return typeof n.limit=="number"?o.slice(0,n.limit):o}function Wt(e,t,n={}){let s=Ye(e)?Ke(e,t):Ve(e).get(t.symbolId)??[];return typeof n.limit=="number"?s.slice(0,n.limit):s}var ce=w("caller-rows"),Ue=2e4;function Ye(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>Ue}function Ve(e){return ce.get(e,()=>{let t=k(e),n=ue(e,t),s=new Map;for(let r of t)s.set(r.symbol,r.symbolId);let o=new Map,i=new Map;for(let r of t){let l=n.get(r.symbolId);if(!(!l||l.length===0))for(let c of l){let a=s.get(c.symbol);if(a===void 0||a===r.symbolId)continue;let u=o.get(a);u||(u=[],o.set(a,u),i.set(a,new Set));let d=`${r.symbol}|${r.relativePath}`;i.get(a).has(d)||(i.get(a).add(d),u.push({symbol:r.symbol,file:r.relativePath}))}}return o})}function Ke(e,t){let n=[],s=new Set,o=r=>{if(r.symbol===t.symbol)return;let l=`${r.symbol}|${r.file}`;s.has(l)||(s.add(l),n.push(r))};for(let r of qe(e,t))r.file!==t.relativePath&&o({symbol:r.enclosingSymbol??r.file,file:r.file});let i=Ze(e,t);if(i)for(let r of B(e,i)){if(r.file===t.relativePath||e.isIgnored(r.file))continue;let l=v(M(e,r.file),r.line);o({symbol:l?.symbol??r.file,file:r.file})}return n}function Ze(e,t){return e.get(`SELECT
24
- d.id AS documentId,
25
- gs.id AS symbolId,
26
- gs.symbol,
27
- d.relative_path AS relativePath,
28
- COALESCE(der.start_line, c.start_line) AS startLine,
29
- COALESCE(der.end_line, c.end_line) AS endLine,
30
- COALESCE(gs.display_name, '') AS leaf,
31
- NULL AS parentTypeName,
32
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
33
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
34
- gs.kind AS kind,
35
- gs.documentation AS documentation,
36
- gs.enclosing_symbol AS enclosingSymbol
37
- FROM global_symbols gs
38
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
39
- LEFT JOIN chunks c ON c.document_id = der.document_id
40
- JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
41
- WHERE gs.id = ?
42
- LIMIT 1`,t.symbolId)??null}function qe(e,t){let n=nt(e,t);return n?it(e,Xe(e,n.match,n.identifier)):[]}function Xe(e,t,n){let s=new Map;for(let[o,i]of Qe(e,t.symbolId))s.set(o,et(e,o,i,t,n));return s}function Qe(e,t){let n=new Map,s=e.all(`SELECT DISTINCT d.relative_path, c.start_line, c.end_line
43
- FROM mentions m
44
- JOIN chunks c ON m.chunk_id = c.id
45
- JOIN documents d ON c.document_id = d.id
46
- WHERE m.symbol_id = ?
47
- AND m.role != 1
48
- ${e.pathExclusionsFor("d")}
49
- ORDER BY d.relative_path, c.start_line`,t);for(let o of s){if(e.isIgnored(o.relative_path))continue;let i=n.get(o.relative_path);i||(i=[],n.set(o.relative_path,i)),i.push({start_line:o.start_line,end_line:o.end_line})}return n}function et(e,t,n,s,o){let i=t===s.relativePath?{excludeStartLine:s.startLine,excludeEndLine:s.endLine}:{},r=o?ee(e,t,o,i):[];return n.flatMap(l=>tt(r,l))}function tt(e,t){let n=e.filter(s=>s>=t.start_line&&s<=t.end_line);return n.length>0?n:[t.start_line]}function nt(e,t){let n=W(e,t);return n?{match:n,identifier:L(n.symbol)||null}:null}function it(e,t){let n=[],s=new Set;for(let[o,i]of t){let r=M(e,o);for(let l of i){let c=v(r,l),a=`${o}|${l}|${c?.symbol??""}`;s.has(a)||(s.add(a),n.push({file:o,line:l,enclosingSymbol:c?.symbol??null}))}}return n}function ue(e,t,n={}){if(t.length===0)return new Map;let s=n.additive??!1,o=[],i=[];for(let u of t)y(u.relativePath)&&C(e,u.relativePath)!==null?o.push(u):i.push(u);let r=new Map,l=new Map,c=u=>{for(let[d,f]of u){let p=r.get(d);p||(p=[],r.set(d,p));let g=l.get(d);g||(g=new Set,l.set(d,g));for(let m of f){let b=`${m.symbol}|${m.chunkId}`;g.has(b)||(g.add(b),p.push(m))}}};o.length>0&&c(st(e,o)),c(yt(z(e,t)));let a=s?t:i;return a.length>0&&c(ct(e,a)),r}function st(e,t){let n=new Map,s=ot(t,n),o=pe(e);for(let[i,r]of s){let l=C(e,i);if(l)for(let c of l){let a=rt(r,c.line);if(!a)continue;let u=at(e,i,o,c.calleeLeaf,c.memberAccess);u&&u.symbol!==a.symbol&&n.get(a.symbolId).push({symbol:u.symbol,file:u.file,chunkId:c.line})}}return n}function ot(e,t){let n=new Map;for(let s of e){let o=n.get(s.relativePath);o?o.push(s):n.set(s.relativePath,[s]),t.set(s.symbolId,[])}for(let s of n.values())s.sort((o,i)=>o.endLine-o.startLine-(i.endLine-i.startLine));return n}function rt(e,t){return e.find(n=>t>=n.startLine&&t<=n.endLine)??null}function at(e,t,n,s,o){let i=de(t,n.get(s)??[]);return i.length===0?null:fe(e,t,i,o)}function de(e,t){let n=oe(e);return n?t.filter(s=>oe(s.file)===n):t}function fe(e,t,n,s){let o=n.find(i=>i.file===t);if(o)return o;if(s){let i=new Set(N(e,t).map(r=>r.sourcePath).filter(r=>!!r));for(let r of n)for(let l of i)if(lt(l,r.file))return r;return null}return n.length===1?n[0]:null}function lt(e,t){let n=s=>s.replace(/\\/g,"/").replace(/^\.\//,"");return n(e)===n(t)}function oe(e){let t=y(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var me=w("global-leaf-index");function pe(e){return me.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
50
- COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
51
- FROM global_symbols gs
52
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
53
- LEFT JOIN documents der_doc ON der_doc.id = der.document_id
54
- LEFT JOIN (
55
- SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
56
- FROM mentions m
57
- JOIN chunks c ON m.chunk_id = c.id
58
- JOIN documents d ON c.document_id = d.id
59
- WHERE m.role = 1
60
- GROUP BY m.symbol_id
61
- ) mention_doc ON mention_doc.symbol_id = gs.id
62
- WHERE 1 = 1
63
- ${e.symbolNoiseFor("gs")}`),n=new Map;for(let s of t){if(!s.relative_path||e.isIgnored(s.relative_path))continue;let o=L(s.symbol);if(!o)continue;let i=n.get(o);i||(i=[],n.set(o,i)),i.some(r=>r.symbolId===s.id)||i.push({symbol:s.symbol,symbolId:s.id,file:s.relative_path})}return n})}function ct(e,t){if(t.length===0)return new Map;let n=e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
64
- FROM mentions m
65
- JOIN chunks c ON m.chunk_id = c.id
66
- WHERE m.role != 1`),s=new Map;for(let a of n)s.has(a.document_id)||s.set(a.document_id,[]),s.get(a.document_id).push(a);let o=new Map(e.all("SELECT id, relative_path FROM documents").map(a=>[a.id,a.relative_path])),i=new Map,r=e.all(`SELECT gs.id AS symbol_id, gs.symbol,
67
- COALESCE(der.document_id, def_chunk.document_id) AS document_id
68
- FROM global_symbols gs
69
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
70
- LEFT JOIN (
71
- SELECT m.symbol_id, MIN(c.document_id) AS document_id
72
- FROM mentions m
73
- JOIN chunks c ON m.chunk_id = c.id
74
- WHERE m.role = 1
75
- GROUP BY m.symbol_id
76
- ) def_chunk ON def_chunk.symbol_id = gs.id`);for(let a of r)i.has(a.symbol_id)||i.set(a.symbol_id,{symbol:a.symbol,file:a.document_id!==null?o.get(a.document_id)??"":""});let l=new Map,c=o;for(let a of t){let u=s.get(a.documentId)??[],d=new Set,f=[],p=null,g=()=>{if(p)return p;let m=c.get(a.documentId)??"",b=new Set;if(m){let I=se(e,m),R=Math.max(0,a.startLine),F=Math.min(I.length-1,a.endLine);for(let _=R;_<=F;_+=1)for(let ge of I[_])b.add(ge)}return p=b,b};for(let m of u){if(m.symbol_id===a.symbolId)continue;let b=i.get(m.symbol_id);if(!b)continue;if(!(m.start_line>=a.startLine&&m.end_line<=a.endLine)){if(!(m.start_line<=a.endLine&&m.end_line>=a.startLine))continue;let _=L(b.symbol);if(!_||!g().has(_))continue}let R=`${b.symbol}|${m.chunk_id}`;d.has(R)||(d.add(R),f.push({...b,chunkId:m.chunk_id}))}l.set(a.symbolId,f)}return l}function Bt(e,t){let n=new Map;if(t&&t.length===0)return n;let s=e.all(`SELECT relative_path FROM documents
77
- WHERE 1 = 1 ${e.pathExclusionsFor("documents")}`),o=pe(e),i=t??k(e),r=new Set(i.map(l=>l.symbolId));return ut(e,n,s,o,r),dt(e,n,i,r),gt(e,n,s,o,r),_t(n,j(e,bt(i))),n}function ut(e,t,n,s,o){for(let i of n){if(!y(i.relative_path)||e.isIgnored(i.relative_path))continue;let r=C(e,i.relative_path);if(r)for(let l of r){let c=de(i.relative_path,s.get(l.calleeLeaf)??[]);if(!c||c.length===0)continue;let a=fe(e,i.relative_path,c,l.memberAccess);a&&o.has(a.symbolId)&&a.file!==i.relative_path&&T(t,a.symbolId,i.relative_path)}}}function dt(e,t,n,s){let o=mt(n);for(let i of ft(e,s))e.isIgnored(i.relative_path)||pt(i,o.get(i.symbol_id))||T(t,i.symbol_id,i.relative_path)}function ft(e,t){if(!t)return ae(e);let n=[...t];if(n.length===0)return[];let s=[];for(let o=0;o<n.length;o+=re)s.push(...ae(e,n.slice(o,o+re)));return s}var re=750;function ae(e,t){let n=t&&t.length>0?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
78
- c.start_line AS chunk_start, c.end_line AS chunk_end
79
- FROM mentions m
80
- JOIN chunks c ON m.chunk_id = c.id
81
- JOIN documents d ON c.document_id = d.id
82
- WHERE m.role != 1
83
- ${n}
84
- ${e.pathExclusionsFor("d")}`,...t??[])}function mt(e){let t=new Map;for(let n of e)t.set(n.symbolId,{docId:n.documentId,startLine:n.startLine,endLine:n.endLine});return t}function pt(e,t){return!!t&&t.docId===e.document_id&&e.chunk_start>=t.startLine&&e.chunk_end<=t.endLine}function gt(e,t,n,s,o){for(let i of n){if(e.isIgnored(i.relative_path)||y(i.relative_path)!=="rust")continue;let r=X(e,i.relative_path);if(r.size!==0)for(let l of r){let c=s.get(l);if(c)for(let a of c)o.has(a.symbolId)&&a.file!==i.relative_path&&T(t,a.symbolId,i.relative_path)}}}function T(e,t,n){let s=e.get(t);s||(s=new Set,e.set(t,s)),s.add(n)}function bt(e){return e.filter(t=>"relativePath"in t&&"symbol"in t&&"leaf"in t)}function yt(e){let t=new Map;for(let[n,s]of e){let o=[];for(let i of s)o.push({symbol:i.symbol,file:i.file,chunkId:-1});t.set(n,o)}return t}function _t(e,t){for(let[n,s]of t){let o=e.get(n);o||(o=new Set,e.set(n,o));for(let i of s)o.add(i)}}export{St as a,X as b,Et as c,ee as d,At as e,O as f,xt as g,$t as h,Jt as i,Gt as j,Wt as k,qe as l,ue as m,pe as n,Bt as o};
85
- //# sourceMappingURL=chunk-GS55K4WJ.js.map
@@ -1,5 +0,0 @@
1
- import{execFileSync as n}from"child_process";import{platform as o,arch as p}from"os";var a=o()==="win32",u="v0.7.0";function t(e){let r=a?"where":"which";try{return n(r,[e],{stdio:"pipe"}),!0}catch{return!1}}function h(){try{return n(a?"where":"which",["scip"],{stdio:"pipe"}),!0}catch{return!1}}function w(){try{return n("scip",["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function g(){let e=o(),r=p(),i,l,s;switch(e){case"darwin":i="darwin",s="tar.gz";break;case"linux":i="linux",s="tar.gz";break;case"win32":i="windows",s="zip";break;default:return null}switch(r){case"arm64":l="arm64";break;case"x64":l="amd64";break;default:return null}let c=`scip-${i}-${l}.${s}`;return{url:`https://github.com/sourcegraph/scip/releases/download/${u}/${c}`,filename:c}}function b(){let e=g();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),o()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
2
- `),console.log("Or download manually:")):console.log("Download from:"),console.log(e?` ${e.url}
3
- `:` https://github.com/sourcegraph/scip/releases/tag/${u}
4
- `),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function I(e){if(o()==="darwin"&&t("brew")){e("Installing scip CLI via Homebrew...");try{if(n("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`Homebrew install failed: ${i}`)}}if(t("go")){e("Installing scip CLI via go install...");try{if(n("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`go install failed: ${i}`)}}return e("Could not auto-install scip CLI."),e("Install manually from: https://github.com/sourcegraph/scip/releases"),!1}export{h as a,w as b,b as c,I as d};
5
- //# sourceMappingURL=chunk-H4DXD2FB.js.map
@@ -1,2 +0,0 @@
1
- import{a as g}from"./chunk-SVUVC5VS.js";import{c as h}from"./chunk-7EQ4J66C.js";import{j as u,l as p}from"./chunk-GS55K4WJ.js";import{a as d,b as y}from"./chunk-QYWGC7JV.js";import{G as S,q as f}from"./chunk-KYGNCIJ6.js";function j(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,t=d(e,o);return t?c==="backward"?w(e,t,s):R(e,t):null}function w(e,o,r){let c=[],s=new Set([o.symbol]),t=[o];for(let a=1;a<=r&&t.length!==0;a++){let n=[];for(let l of t){let i=u(e,l);for(let m of i){if(s.has(m.symbol))continue;s.add(m.symbol),c.push({symbol:m.symbol,shortName:f(m.symbol),file:m.file,relationship:a===1?"referenced within definition (callee)":`depth ${a} callee`});let b=y(e,m.symbol);b&&!e.isIgnored(b.relativePath)&&n.push(b)}}t=n}return{symbol:o.symbol,shortName:f(o.symbol),direction:"backward",connectedSymbols:c}}function R(e,o){let r=h(e,o),c=r.length>0?r:p(e,o),s=new Set,t=[],a=new g(e);for(let n of c){if(t.length>=30)break;if(e.isIgnored(n.file))continue;let l=n.enclosingSymbol??S(a.definitionsForFile(n.file),n.line)?.symbol??null;if(!l||l===o.symbol)continue;let i=y(e,l);!i||e.isIgnored(i.relativePath)||s.has(i.symbol)||(s.add(i.symbol),t.push({symbol:i.symbol,shortName:f(i.symbol),file:i.relativePath,relationship:`references target at ${n.file}:${n.line+1}`}))}return t.sort((n,l)=>n.file.localeCompare(l.file)),{symbol:o.symbol,shortName:f(o.symbol),direction:"forward",connectedSymbols:t}}export{j as a};
2
- //# sourceMappingURL=chunk-HADDFTMU.js.map
@@ -1,2 +0,0 @@
1
- import{a as v}from"./chunk-SVUVC5VS.js";import{b as I}from"./chunk-GS55K4WJ.js";import{g as y,q as h,r as L}from"./chunk-KYGNCIJ6.js";function j(o,l={}){let{scope:c,minLoc:d=3}=l,a=new v(o),t=a.productionCallableDefinitions({scope:c,minLoc:d,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0}),m=a.crossFileCallerMap(t),n=new Set(m.keys()),r=new Map;for(let e of t){let s=L(e.symbol);if(!s)continue;let i=r.get(s)??[];i.push(e.symbolId),r.set(s,i)}let S=o.all(`SELECT relative_path FROM documents WHERE 1 = 1 ${o.pathExclusionsFor("documents")}`);for(let e of S){if(o.isIgnored(e.relative_path)||y(e.relative_path)!=="rust")continue;let s=I(o,e.relative_path);for(let i of s){let f=r.get(i);if(f)for(let x of f)n.add(x)}}let p=C(a,t,{additive:!1}),u=t.filter(e=>!n.has(e.symbolId)).filter(e=>!p.has(e.symbolId)),g=a.sourceFallbackCallerFiles(u);for(let e of g.keys())n.add(e);let b=u.filter(e=>!n.has(e.symbolId)),M=C(a,b,{additive:!0});for(let e of M)p.add(e);return b.filter(e=>!p.has(e.symbolId)).sort((e,s)=>s.endLine-s.startLine-(e.endLine-e.startLine)||e.relativePath.localeCompare(s.relativePath)||e.startLine-s.startLine).map(e=>({symbol:e.symbol,shortName:h(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1}))}function C(o,l,c){if(l.length===0)return new Set;let d=new Map(l.map(t=>[t.symbolId,t.symbol])),a=o.calleeMap(l,{additive:c.additive});return new Set([...a.entries()].filter(([t,m])=>{let n=d.get(t);return m.some(r=>r.symbol!==n)}).map(([t])=>t))}export{j as a};
2
- //# sourceMappingURL=chunk-IARIBTCL.js.map
@@ -1,70 +0,0 @@
1
- import{a as m}from"./chunk-SVUVC5VS.js";import{c as u}from"./chunk-TYRPQE6R.js";import{f as l,g as a}from"./chunk-6FLGPRBR.js";import{q as d,s as c}from"./chunk-KYGNCIJ6.js";function C(e,t={}){let{scope:o,limit:r}=t,n=new m(e),i=x([...p(e,o),...f(e,n,o)]);return N(i),r?i.slice(0,r):i}function p(e,t){let o=[];for(let r of R(e,t)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||u(e,r.barrel_path))continue;let n=b(e,r),i=n?.barrel_consumers??0,s=n?.direct_consumers??0;i!==0||s!==0||o.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:d(r.symbol),originalFile:r.original_path,barrelConsumers:i,directConsumers:s})}return o}function R(e,t){let o=t?`AND barrel_d.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT
2
- barrel_d.id AS barrel_doc_id,
3
- barrel_d.relative_path AS barrel_path,
4
- gs.id AS symbol_id,
5
- gs.symbol AS symbol,
6
- orig_d.id AS original_doc_id,
7
- orig_d.relative_path AS original_path
8
- FROM mentions m
9
- JOIN chunks c ON m.chunk_id = c.id
10
- JOIN documents barrel_d ON c.document_id = barrel_d.id
11
- JOIN global_symbols gs ON m.symbol_id = gs.id
12
- JOIN (
13
- SELECT m2.symbol_id, c2.document_id
14
- FROM mentions m2
15
- JOIN chunks c2 ON m2.chunk_id = c2.id
16
- WHERE m2.role = 1
17
- GROUP BY m2.symbol_id
18
- ) sym_def ON sym_def.symbol_id = gs.id
19
- JOIN documents orig_d ON sym_def.document_id = orig_d.id
20
- WHERE m.role != 1
21
- AND (barrel_d.relative_path LIKE '%/index.ts'
22
- OR barrel_d.relative_path LIKE '%/index.js'
23
- OR barrel_d.relative_path = 'index.ts'
24
- OR barrel_d.relative_path = 'index.js')
25
- AND orig_d.id != barrel_d.id
26
- ${e.pathExclusionsFor("barrel_d","orig_d")}
27
- ${e.symbolNoiseFor("gs")}
28
- -- Only function-level symbols (ending with ().), not module-level
29
- AND gs.symbol LIKE '%().'
30
- ${o}
31
- ORDER BY barrel_d.relative_path, gs.symbol`)}function b(e,t){return e.get(`SELECT
32
- SUM(CASE WHEN uses_barrel = 1 THEN 1 ELSE 0 END) AS barrel_consumers,
33
- SUM(CASE WHEN uses_barrel = 0 THEN 1 ELSE 0 END) AS direct_consumers
34
- FROM (
35
- SELECT
36
- consumer_d.id AS consumer_doc_id,
37
- MAX(CASE WHEN EXISTS (
38
- SELECT 1
39
- FROM mentions barrel_m
40
- JOIN chunks barrel_c ON barrel_m.chunk_id = barrel_c.id
41
- WHERE barrel_c.document_id = consumer_d.id
42
- AND barrel_m.role != 1
43
- AND barrel_m.symbol_id IN (
44
- SELECT m2.symbol_id
45
- FROM mentions m2
46
- JOIN chunks c2 ON m2.chunk_id = c2.id
47
- WHERE c2.document_id = ?
48
- AND m2.role != 1
49
- )
50
- ) THEN 1 ELSE 0 END) AS uses_barrel
51
- FROM mentions ref_m
52
- JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
53
- JOIN documents consumer_d ON ref_c.document_id = consumer_d.id
54
- WHERE ref_m.symbol_id = ?
55
- AND ref_m.role != 1
56
- AND consumer_d.id != ?
57
- AND consumer_d.id != ?
58
- ${e.pathExclusionsFor("consumer_d")}
59
- GROUP BY consumer_d.id
60
- )`,t.barrel_doc_id,t.symbol_id,t.barrel_doc_id,t.original_doc_id)}function f(e,t,o){let r=[];for(let n of E(e,o))_(e,n,n)>0||r.push(...h(e,t,n));return r}function E(e,t){return e.all(`SELECT relative_path
61
- FROM documents
62
- WHERE 1 = 1
63
- ${t?"AND relative_path LIKE ?":""}
64
- ${e.pathExclusionsFor("documents")}
65
- ORDER BY relative_path`,...t?[`%${t}%`]:[]).map(r=>r.relative_path).filter(r=>!e.isIgnored(r)).filter(r=>a(e,r).length>0)}function h(e,t,o){return a(e,o).filter(r=>r.sourcePath&&!e.isIgnored(r.sourcePath)).flatMap(r=>g(e,t,o,r.sourcePath))}function g(e,t,o,r){let n=S(t,r);return n?[{barrelFile:o,symbol:n.symbol,shortName:d(n.symbol),originalFile:r,barrelConsumers:0,directConsumers:_(e,r,o)}]:[]}function _(e,t,o){let r=e.all(`SELECT relative_path
66
- FROM documents
67
- WHERE 1 = 1
68
- ${e.pathExclusionsFor("documents")}
69
- ORDER BY relative_path`),n=new Set;for(let i of r)if(!(e.isIgnored(i.relative_path)||i.relative_path===o))for(let s of l(e,i.relative_path))s.sourcePath===t&&n.add(i.relative_path);return n.size}function S(e,t){let o=e.definitionsForFile(t);return o.find(r=>c(r.symbol)==="method")??o[0]??null}function x(e){let t=new Set,o=[];for(let r of e){let n=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;t.has(n)||(t.add(n),o.push(r))}return o}function N(e){e.sort((t,o)=>o.directConsumers-t.directConsumers||t.barrelFile.localeCompare(o.barrelFile)||t.shortName.localeCompare(o.shortName))}export{C as a};
70
- //# sourceMappingURL=chunk-IBWYWAWE.js.map
@@ -1,2 +0,0 @@
1
- import{c as d}from"./chunk-RKTDEIHF.js";import{i as a}from"./chunk-GS55K4WJ.js";function F(t,i={}){let{minSimilarity:f=.5,limit:n=20,scope:o,filePattern:s}=i,u=i.minDeps??(s?1:3),e=g(t,{scope:o,minDeps:u}),p=[];if(s){let r=e.find(l=>l.file.includes(s));if(!r)return[];for(let l of e){if(l.file===r.file)continue;let c=m(r,l,f);c&&p.push(c)}}else for(let r=0;r<e.length;r++){for(let l=r+1;l<e.length;l++){let c=m(e[r],e[l],f);c&&p.push(c)}if(p.length>n*5)break}return p.sort((r,l)=>l.similarity-r.similarity),p.slice(0,n)}function g(t,i){let{scope:f,minDeps:n}=i,o=a(t,f),s=h(o),u=[];for(let[e,p]of o)p.size>=n&&u.push({file:e,deps:new Set([...p].filter(r=>!s.has(r)))});return u}function h(t){let i=new Set,f=t.size;if(f===0)return i;let n=new Map;for(let o of t.values())for(let s of o)n.set(s,(n.get(s)??0)+1);for(let[o,s]of n)s>=5&&s/f>.3&&i.add(o);return i}function m(t,i,f){let n=new Set;for(let e of t.deps)i.deps.has(e)&&n.add(e);if(n.size<3||t.deps.size<4||i.deps.size<4)return null;let o=d(t.deps,i.deps);if(o<f)return null;let s=[];for(let e of t.deps)i.deps.has(e)||s.push(e);let u=[];for(let e of i.deps)t.deps.has(e)||u.push(e);return{fileA:t.file,fileB:i.file,similarity:o,sharedDeps:[...n],uniqueToA:s,uniqueToB:u}}export{F as a};
2
- //# sourceMappingURL=chunk-JVMXNDRU.js.map
@@ -1,2 +0,0 @@
1
- import{i as y}from"./chunk-GS55K4WJ.js";function L(D,k={}){let{limit:x=10,scope:M,minDepth:j=3}=k,a=y(D,M),u=new Map,o=[],l=new Map,r=new Map,g=new Set,f=[],d=0;for(let t of a.keys()){if(l.has(t))continue;let n=[],s=(a.get(t)??new Set).values();for(l.set(t,d),r.set(t,d),d+=1,f.push(t),g.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let h=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(h)))}let c=e.iter.next();if(c.done){if(r.get(e.node)===l.get(e.node)){let h=[];for(;;){let p=f.pop();if(g.delete(p),h.push(p),u.set(p,o.length),p===e.node)break}o.push(h)}n.pop();continue}let i=c.value;if(l.has(i))g.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,d),r.set(i,d),d+=1,f.push(i),g.add(i);let h=(a.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:h,pendingChild:null})}}}let m=new Map,b=new Array(o.length);for(let t=0;t<o.length;t++)b[t]=o[t].length,m.set(t,new Set);for(let[t,n]of a){let s=u.get(t);for(let e of n){let c=u.get(e);c!==s&&m.get(s).add(c)}}let S=new Array(o.length),I=new Array(o.length);for(let t=0;t<o.length;t++){let n=[],s=0;for(let e of m.get(t)){let c=I[e];c>s&&(s=c,n=S[e])}S[t]=[t,...n],I[t]=b[t]+s}function v(t){return S[t]}let A=o.map(t=>[...t].sort()),C=new Set,w=[];for(let t=0;t<o.length;t++){let n=v(t),s=[];for(let c of n)s.push(...A[c]);if(s.length<j)continue;let e=s.join(" ");C.has(e)||(C.add(e),w.push({chain:s,depth:s.length}))}return w.sort((t,n)=>n.depth-t.depth),w.slice(0,x)}export{L as a};
2
- //# sourceMappingURL=chunk-K345WFTU.js.map
@@ -1,19 +0,0 @@
1
- import{a as u,b as g,c as S}from"./chunk-LJ2YWNQF.js";import{a as p}from"./chunk-SVUVC5VS.js";import{a as y}from"./chunk-TYRPQE6R.js";import{f as d}from"./chunk-6FLGPRBR.js";import{o as m}from"./chunk-G47V5V3U.js";import l from"path";function q(t,n){let{scope:r,minDeviation:i=5}=n??{},s=new p(t).fileDependencyGraph(r),c=M(t,r);return R([...D(t,s,c),...v(s),...b(s,i)])}function D(t,n,r){let i=[];for(let[e,s]of n){if(a(e))continue;let c=r.get(e)??new Set;for(let o of s)if(!a(o)&&!c.has(o)){if(F(t,e,o)||w(t,e,o)||L(t,e,o)||$(o)||x(t,e,o)||P(o))continue;i.push({file:e,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o})}}return i}function v(t){let n=[],r=N(t);for(let[i,e]of t){if(a(i))continue;let s=u(i);for(let c of e){if(a(c))continue;let o=u(c);if(s===o)continue;(g(s,o)??r.get(`${s}->${o}`))==="violation"&&n.push({file:i,kind:"layer-violation",description:`Imports from ${o}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${o}/`})}}return n}function b(t,n){let r=[];for(let[i,e]of _(t)){let s=e.filter(o=>!a(o));if(s.length<n)continue;let c=k(t,s);for(let o of s)for(let f of t.get(o)??[])a(f)||(c.get(f)??0)===1&&l.dirname(f)!==i&&l.dirname(f)!==l.dirname(i)&&(S(o,f)||r.push({file:o,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${f}`,dep:f}))}return r}function R(t){return{results:t,unusedImports:t.filter(n=>n.kind==="unused-import").length,layerViolations:t.filter(n=>n.kind==="layer-violation").length,patternDeviations:t.filter(n=>n.kind==="pattern-deviation").length}}function _(t){let n=new Map;for(let r of t.keys()){let i=l.dirname(r),e=n.get(i);e||(e=[],n.set(i,e)),e.push(r)}return n}function k(t,n){let r=new Map;for(let i of n)for(let e of t.get(i)??[])a(e)||r.set(e,(r.get(e)??0)+1);return r}function M(t,n){let r=new Map;return E(t,r,n),O(t,r),r}function E(t,n,r){for(let i of I(t,r))h(t,n,i.from_file,i.to_file)}function I(t,n){let r=n?`AND d1.relative_path LIKE '%${n}%'`:"";return t.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
2
- FROM mentions m
3
- JOIN chunks c ON m.chunk_id = c.id
4
- JOIN documents d1 ON c.document_id = d1.id
5
- JOIN global_symbols gs ON m.symbol_id = gs.id
6
- JOIN (
7
- SELECT m2.symbol_id, c2.document_id
8
- FROM mentions m2
9
- JOIN chunks c2 ON m2.chunk_id = c2.id
10
- WHERE m2.role = 1
11
- GROUP BY m2.symbol_id
12
- ) sym_def ON sym_def.symbol_id = gs.id
13
- JOIN documents d2 ON sym_def.document_id = d2.id
14
- WHERE d1.id != d2.id
15
- AND m.role != 1
16
- ${t.pathExclusionsFor("d1","d2")}
17
- ${r}`)}function O(t,n){let r=new p(t),i=t.all(`SELECT relative_path FROM documents
18
- WHERE 1 = 1 ${t.pathExclusionsFor("documents")}`);r.scanSourceReferences({paths:i.map(e=>e.relative_path),includeRustAttributeNames:!0,identifierResolution:"permissive"},e=>{e.target.relativePath!==e.sourceFile&&(t.isIgnored(e.target.relativePath)||h(t,n,e.sourceFile,e.target.relativePath))})}function h(t,n,r,i){if(t.isIgnored(r)||t.isIgnored(i))return;let e=n.get(r);e||(e=new Set,n.set(r,e)),e.add(i)}function N(t){let n=new Map;for(let[i,e]of t){if(a(i))continue;let s=u(i);for(let c of e){if(a(c))continue;let o=u(c);if(s===o||g(s,o))continue;let f=`${s}->${o}`;n.set(f,(n.get(f)??0)+1)}}let r=new Map;for(let[i,e]of n)r.set(i,e<=2?"violation":"ok");return r}function $(t){return t.includes("types")||t.endsWith(".d.ts")}function F(t,n,r){let i=m(t,n).filter(e=>e.sourcePath===r);return i.length>0&&i.some(e=>e.isUsed)}function w(t,n,r){let i=d(t,n).filter(e=>e.sourcePath===r);return i.length>0&&i.some(e=>e.used)}function L(t,n,r){let i=d(t,n).filter(e=>e.sourcePath===r);return i.length>0&&i.every(e=>e.isTypeOnly===!0)}function P(t){return t.endsWith(".vue")}function x(t,n,r){let i=d(t,n).filter(e=>e.sourcePath===r);return i.length===0?!1:i.every(e=>e.kind==="side-effect"||e.kind==="namespace"&&e.usedMembers.length===0&&!e.used)}function a(t){let n=y(t);return!!(n==="entry"||n==="barrel"||n==="test"||n==="worker"||T(l.basename(t)))}function T(t){return!!(t==="index.ts"||t==="index.js"||t==="cli.ts"||t==="main.ts"||t==="main.rs"||t.includes("worker.")||t.includes("postinstall.")||t==="health.ts"||t==="health.js")}export{q as a};
19
- //# sourceMappingURL=chunk-K6ULLR7M.js.map
@@ -1,4 +0,0 @@
1
- function i(e){return/[*?]/.test(e)?e.replace(/\*\*/g,"%").replace(/\*/g,"%").replace(/\?/g,"_"):`%${e}%`}function l(e,r){let a=i(r);return e.all(`SELECT relative_path FROM documents
2
- WHERE relative_path LIKE ?
3
- ORDER BY relative_path`,a).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path}))}export{l as a};
4
- //# sourceMappingURL=chunk-KAM4C6ZD.js.map
@@ -1,2 +0,0 @@
1
- import{a as c}from"./chunk-SVUVC5VS.js";import{j as a,k as i}from"./chunk-GS55K4WJ.js";import{q as m}from"./chunk-KYGNCIJ6.js";function d(o,e={}){let{limit:r=20,scope:s,minFanIn:t=2,minFanOut:p=2}=e;return new c(o).productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0}).map(n=>u(o,n)).filter(n=>n.fanIn>=t&&n.fanOut>=p).sort((n,l)=>l.score-n.score||l.fanIn-n.fanIn).slice(0,r)}function u(o,e){let r=new Set(i(o,e,{limit:500}).map(t=>t.file)).size,s=new Set(a(o,e,{limit:500}).filter(t=>t.file!==e.relativePath).map(t=>`${t.symbol}|${t.file}`)).size;return{symbol:e.symbol,shortName:m(e.symbol),fanIn:r,fanOut:s,score:r*s,definedIn:e.relativePath}}export{d as a};
2
- //# sourceMappingURL=chunk-KCC3GMCX.js.map
@@ -1,5 +0,0 @@
1
- import{a as P}from"./chunk-SVUVC5VS.js";import{e as D}from"./chunk-6FLGPRBR.js";import{a as S,d as g,g as C,j as x,l as I,p as L,q as v,r as m}from"./chunk-KYGNCIJ6.js";function fe(n,e){let{scope:t,minLoc:r=3,maxLoc:s=80,limit:i=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},a=new P(n),f=a.scopedDefinitions(t),u=W(a,t),d=X(_(n,a,f,{minLoc:r,maxLoc:s}).sort((c,p)=>b(p)-b(c)||c.relativePath.localeCompare(p.relativePath)),o),y=B(a,d),A=O(n,a,f,d),$=N(d);return E(n,d,y,$).filter(c=>!A.has(c.definition.symbolId)).filter(c=>!c.transitivelyReachable).filter(c=>c.realConsumers.length<=1).filter(c=>!(c.realConsumers.length===0&&c.barrelConsumers>0)).filter(c=>Z(c.definition,c.realConsumers.length,u)).map(c=>j(n,c)).filter(c=>l||c.confidence!=="low").sort((c,p)=>{let h={high:0,medium:1,low:2};return h[c.confidence]-h[p.confidence]||p.loc-c.loc||c.file.localeCompare(p.file)||c.startLine-p.startLine}).slice(0,i)}function _(n,e,t,r){return t.filter(s=>s.isTypeLike&&b(s)>=r.minLoc).filter(s=>b(s)<=r.maxLoc).filter(s=>!n.isIgnored(s.relativePath)).filter(s=>!G(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function B(n,e){return R(n.crossFileCallerMap(e),n.sourceFallbackCallerFiles(e))}function N(n){let e=new Map;for(let t of n){let r=e.get(t.relativePath);r||(r=new Map,e.set(t.relativePath,r));let s=m(t.symbol);s&&r.set(s,t)}return e}function E(n,e,t,r){return e.map(s=>{let l=[...t.get(s.symbolId)??new Set].filter(u=>u!==s.relativePath&&!n.isIgnored(u)),{realConsumers:o,barrelConsumers:a}=q(n,s.relativePath,s.symbol,l),f=J(n,s,t,r);return{definition:s,realConsumers:o,barrelConsumers:a,transitivelyReachable:f}})}function j(n,e){let t=k(n,e.definition.relativePath,e.definition.startLine),r=M(e.definition.relativePath)?!0:ee(n,e.definition),{confidence:s,reason:i}=ne(e.realConsumers.length,t,r);return{symbol:e.definition.symbol,shortName:v(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:b(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:t,definerUsesType:r,confidence:s,reason:i}}function O(n,e,t,r){let s=z(n,U(t),r),i=s.map(a=>a.singleton);if(s.length===0)return new Set;let l=R(e.crossFileCallerMap(i),e.sourceFallbackCallerFiles(i)),o=new Set;for(let{singleton:a,classId:f}of s)K(n,a,l)&&o.add(f);return o}function U(n){let e=new Map;for(let t of n){let r=m(t.symbol);r&&e.set(w(t.relativePath,r),t)}return e}function z(n,e,t){let r=[];for(let s of t){let i=H(n,e,s);i&&r.push({singleton:i,classId:s.symbolId})}return r}function H(n,e,t){if(k(n,t.relativePath,t.startLine)!=="class")return null;let r=m(t.symbol);if(!r)return null;let s=V(n,t.relativePath,r);return s?e.get(w(t.relativePath,s))??null:null}function K(n,e,t){let r=m(e.symbol),s=t.get(e.symbolId);return!r||!s?!1:[...s].some(i=>i!==e.relativePath&&!n.isIgnored(i)&&!T(n,i,r))}function w(n,e){return`${n}\0${e}`}function V(n,e,t){let r=g(n,e);if(!r)return null;let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return r.match(i)?.[1]??null}function W(n,e){return new Set(n.scopedDefinitions(e).filter(t=>t.isFunctionLike).map(t=>t.relativePath))}function G(n){let e=L(n);if("kind"in e)return!1;let t=e.descriptors;if(t.length<2)return!1;let r=t[t.length-1],s=t[t.length-2];return r?.suffix==="type"&&s?.suffix==="type"}function M(n){let t=(n.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(t==="types"||t==="models"||t==="schema"||t==="common"||t==="protocol"||t==="proto"||t==="dto"||t==="mod"||/(^|\/)types(\/|\.)/.test(n)||/(^|\/)models?(\/|\.)/.test(n)||/(^|\/)proto(?:col)?(\/|\.)/.test(n)||/(^|\/)schema(\/|\.)/.test(n))}function Z(n,e,t){return!(M(n.relativePath)&&e>0||e===0&&t.has(n.relativePath))}function q(n,e,t,r){let s=[],i=0,l=m(t);for(let o of r)Y(n,o,e,l)||T(n,o,l)?i++:s.push(o);return{realConsumers:s,barrelConsumers:i}}function J(n,e,t,r){let s=I(n,e.relativePath),i=m(e.symbol);if(!i)return!1;let l=s.get(i);if(!l||l.size===0)return!1;let o=r.get(e.relativePath);if(!o)return!1;for(let a of l){let f=o.get(a);if(!f)continue;let u=t.get(f.symbolId);if(u){for(let d of u)if(d!==e.relativePath&&!n.isIgnored(d))return!0}}return!1}var F=S("stale-abs-file-usage");function T(n,e,t){if(!t)return!1;let r=C(e);if(!r)return!1;let s=F.get(n,e,()=>Q(n,e,r));return s.importedLeaves.has(t)&&!s.usedLeaves.has(t)}function Q(n,e,t){let r=new Set,s=new Set,i=x(n,e);if(!i)return{importedLeaves:r,usedLeaves:s};let l=t==="rust"?new Set(["use_declaration"]):t==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),o=(a,f)=>{let u=f||l.has(a.type);(a.type==="identifier"||a.type==="type_identifier"||a.type==="property_identifier"||a.type==="field_identifier")&&(u?r.add(a.text):s.add(a.text));for(let d of a.children)o(d,u)};return o(i.rootNode,!1),{importedLeaves:r,usedLeaves:s}}function X(n,e){return typeof e!="number"||e<=0||n.length<=e?n:n.slice(0,e)}function ue(n){F.invalidateAll(n)}function Y(n,e,t,r){if(!r)return!1;let s=g(n,e);if(!s)return!1;let i=D(n,e);if(i.length===0)return!1;let l=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`\\b${l}\\b`),a=s.split(`
2
- `),f=0;for(let u=0;u<a.length;u++){if(!o.test(a[u]??""))continue;if(f++,!i.find(y=>y.startLine<=u&&u<=y.endLine))return!1}return f>0}function k(n,e,t){let r=g(n,e);if(!r)return"other";let s=r.split(`
3
- `),i=Math.max(0,t-2),l=Math.min(s.length-1,t+2);for(let o=i;o<=l;o++){let f=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(f))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(f))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(f))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(f))return"enum"}return"other"}function ee(n,e){let t=g(n,e.relativePath);if(!t)return!1;let r=m(e.symbol);if(!r)return!1;let s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\b${s}\\b`),l=t.split(`
4
- `);for(let o=0;o<l.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&i.test(l[o]??""))return!0;return!1}function ne(n,e,t){return n===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:n===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:n===1&&!t?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}function b(n){return n.endLine-n.startLine+1}function R(...n){let e=new Map;for(let t of n)for(let[r,s]of t){let i=e.get(r);i||(i=new Set,e.set(r,i));for(let l of s)i.add(l)}return e}export{fe as a,ue as b};
5
- //# sourceMappingURL=chunk-KRVRD6KZ.js.map
@@ -1,84 +0,0 @@
1
- function h(e){let n=new WeakMap,t=r=>{let i=n.get(r);return i||(i=new Map,n.set(r,i)),i};return{get(r,i,a){let s=t(r);if(s.has(i))return s.get(i);let c=a();return s.set(i,c),c},invalidate(r,i){n.get(r)?.delete(i)},invalidateAll(r){n.delete(r)},size(r){return n.get(r)?.size??0}}}function Fe(e){let n=new WeakMap;return{get(t,r){let i=n.get(t);if(i)return i.value;let a=r();return n.set(t,{value:a}),a},invalidate(t){n.delete(t)},has(t){return n.has(t)}}}function A(e){let n=new WeakMap,t=r=>{let i=n.get(r);return i||(i=new Map,n.set(r,i)),i};return{get(r,i,a,s){let c=t(r),o=c.get(i);if(o&&o.source===a)return o.value;let l=s();return c.set(i,{source:a,value:l}),l},invalidate(r,i){n.get(r)?.delete(i)},invalidateAll(r){n.delete(r)}}}import{existsSync as G,readFileSync as q}from"fs";import{join as J}from"path";var M=h("source-text");function m(e,n){let t=n.replace(/\\/g,"/");return M.get(e,t,()=>{let r=J(e.config.projectRoot,t);return G(r)?q(r,"utf-8"):""})}function Be(e){M.invalidateAll(e)}var X=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale|wrapper|passthrough|drift|extract)?/i;function He(e,n,t){if(t<=0)return!1;let r=m(e,n);if(!r)return!1;let i=r.split(`
2
- `);for(let a=t-1;a>=0&&a>=t-5;a-=1){let s=(i[a]??"").trim();if(s!==""){if(X.test(s))return!0;if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return!1}}return!1}import{extname as E}from"path";import{createRequire as Z}from"module";var f=Z(import.meta.url),x=null,w=!1;function P(){if(w)return null;if(x)return x;try{return x=f("tree-sitter"),x}catch{return w=!0,null}}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"},R=new Map,L=new Set;function O(e){if(L.has(e))return null;let n=R.get(e);if(n)return n;let t;try{switch(e){case"rust":t=f("tree-sitter-rust");break;case"typescript":t=f("tree-sitter-typescript").typescript;break;case"tsx":t=f("tree-sitter-typescript").tsx;break;case"javascript":t=f("tree-sitter-javascript");break;case"python":t=f("tree-sitter-python");break;case"java":t=f("tree-sitter-java");break;case"kotlin":t=f("tree-sitter-kotlin");break;case"scala":t=f("tree-sitter-scala");break;case"ruby":t=f("tree-sitter-ruby");break;case"c":t=f("tree-sitter-c");break;case"cpp":t=f("tree-sitter-cpp");break;case"csharp":t=f("tree-sitter-c-sharp");break;case"php":t=f("tree-sitter-php").php;break;case"vb":{let r=f("tree-sitter-vb-dotnet");t=r.language??r;break}}}catch{return L.add(e),null}return R.set(e,t),t}var N=new Map;function $(e){let n=N.get(e);if(n)return n;let t=O(e);if(!t)return null;let r=P();if(!r)return null;let i=new r;try{i.setLanguage(t)}catch{return L.add(e),null}return N.set(e,i),i}function S(e){return ee[E(e).toLowerCase()]??null}function te(e){return E(e).toLowerCase()===".vue"}var C=A("ast-trees");function qe(e){C.invalidateAll(e)}function k(e,n){if(te(n))return ne(e,n);let t=S(n);if(!t)return null;let r=m(e,n);return r?C.get(e,n,r,()=>{let i=$(t);if(!i)return null;try{return F(i,r)}catch{return null}}):null}function ne(e,n){let t=m(e,n);return t?C.get(e,n,t,()=>{let r=re(t);if(!r)return null;let i=$(r.language);if(!i)return null;let a=`
3
- `.repeat(r.startLine)+r.body;try{return F(i,a)}catch{return null}}):null}function F(e,n){return e.parse(r=>r>=n.length?null:n.slice(r,Math.min(n.length,r+16384)))}function re(e){let n=[],t=/<script\b([^>]*)>([\s\S]*?)<\/script>/g;for(let o of e.matchAll(t))typeof o.index=="number"&&n.push({tagOpen:o[1]??"",body:o[2]??"",openIdx:o.index+(o[0].length-(o[2]?.length??0)-9)});if(n.length===0)return null;let r=n.find(o=>/\bsetup\b/.test(o.tagOpen))??n[0],a=r.tagOpen.match(/\blang\s*=\s*["']?([\w-]+)/)?.[1]?.toLowerCase(),s=a==="ts"||a==="typescript"?"typescript":a==="tsx"?"tsx":"javascript",c=ie(e,r.openIdx);return{body:r.body,startLine:c,language:s}}function ie(e,n){let t=0;for(let r=0;r<n&&r<e.length;r++)e.charCodeAt(r)===10&&t++;return t}var g=new Map;function ae(e,n){let t=`${e}::${n}`;if(g.has(t))return g.get(t)??null;let r=O(e);if(!r)return g.set(t,null),null;let i=P();if(!i)return g.set(t,null),null;try{let a=new i.Query(r,n);return g.set(t,a),a}catch{return g.set(t,null),null}}var se={rust:`
4
- (function_item name: (identifier) @name) @def
5
- (function_signature_item name: (identifier) @name) @def
6
- `,typescript:`
7
- (function_declaration name: (identifier) @name) @def
8
- (method_definition name: (property_identifier) @name) @def
9
- (method_signature name: (property_identifier) @name) @def
10
- (function_signature name: (identifier) @name) @def
11
- (variable_declarator name: (identifier) @name value: (arrow_function)) @def
12
- (variable_declarator name: (identifier) @name value: (function_expression)) @def
13
- (public_field_definition name: (property_identifier) @name value: (arrow_function)) @def
14
- `,tsx:`
15
- (function_declaration name: (identifier) @name) @def
16
- (method_definition name: (property_identifier) @name) @def
17
- (method_signature name: (property_identifier) @name) @def
18
- (function_signature name: (identifier) @name) @def
19
- (variable_declarator name: (identifier) @name value: (arrow_function)) @def
20
- (variable_declarator name: (identifier) @name value: (function_expression)) @def
21
- (public_field_definition name: (property_identifier) @name value: (arrow_function)) @def
22
- `,javascript:`
23
- (function_declaration name: (identifier) @name) @def
24
- (method_definition name: (property_identifier) @name) @def
25
- (variable_declarator name: (identifier) @name value: (arrow_function)) @def
26
- (variable_declarator name: (identifier) @name value: (function_expression)) @def
27
- `,python:`
28
- (function_definition name: (identifier) @name) @def
29
- `},oe=new WeakMap;function j(e,n){return Q(e,n,oe,se,t=>{let r=[];for(let i of t){let a=null,s=null;for(let c of i.captures)c.name==="name"?a=c.node.text:c.name==="def"&&(s={startLine:c.node.startPosition.row,endLine:c.node.endPosition.row});a&&s&&r.push({name:a,startLine:s.startLine,endLine:s.endLine})}return r})}var ce={rust:`
30
- (call_expression function: (_) @target) @call
31
- (macro_invocation macro: (_) @target) @call
32
- `,typescript:`
33
- (call_expression function: (_) @target) @call
34
- (new_expression constructor: (_) @target) @call
35
- `,tsx:`
36
- (call_expression function: (_) @target) @call
37
- (new_expression constructor: (_) @target) @call
38
- `,javascript:`
39
- (call_expression function: (_) @target) @call
40
- (new_expression constructor: (_) @target) @call
41
- `,python:`
42
- (call function: (_) @target) @call
43
- `},le=new WeakMap;function Je(e,n){return Q(e,n,le,ce,t=>{let r=[];for(let i of t){let a=null,s=null;for(let o of i.captures)o.name==="target"?a=o.node:o.name==="call"&&(s=o.node);if(!a||!s)continue;let c=D(a);c&&r.push({calleeLeaf:c,memberAccess:ue(a),line:s.startPosition.row})}return r})}function ue(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function Xe(e,n){return de(e,n,fe,()=>new Map,(t,r,i)=>{let a=(o,l)=>{if(o===l)return;let u=i.get(o);u||(u=new Set,i.set(o,u)),u.add(l)},s=r==="python"?new Set(["identifier"]):new Set(["type_identifier"]),c=(o,l)=>{let u=d=>{s.has(d.type)&&d.text!==l&&a(d.text,l);for(let y of d.children)u(y)};for(let d of o.children)u(d)};if(r==="rust")for(let o of t.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let l=o.namedChildren.find(d=>d.type==="type_identifier")?.text;if(!l)continue;let u=o.namedChildren.find(d=>d.type==="field_declaration_list"||d.type==="enum_variant_list"||d.type==="ordered_field_declaration_list");u&&c(u,l),o.type==="type_item"&&c(o,l)}else if(r==="python")for(let o of t.rootNode.descendantsOfType("class_definition")){let l=o.namedChildren.find(d=>d.type==="identifier")?.text;if(!l)continue;let u=o.namedChildren.find(d=>d.type==="block");if(u)for(let d of u.descendantsOfType("type"))for(let y of d.descendantsOfType("identifier"))y.text!==l&&a(y.text,l)}else for(let o of t.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let l=o.namedChildren.find(u=>u.type==="type_identifier")?.text;l&&c(o,l)}})??new Map}function de(e,n,t,r,i){let a=S(n);if(!a)return null;let s=k(e,n);if(!s)return null;let c=t.get(s);if(c)return c;let o=r();return i(s,a,o),t.set(s,o),o}function Q(e,n,t,r,i){let a=S(n);if(!a)return null;let s=r[a];if(!s)return null;let c=k(e,n);if(!c)return null;let o=t.get(c);if(o)return o;let l=ae(a,s);if(!l)return null;let u=i(l.matches(c.rootNode));return t.set(c,u),u}var fe=new WeakMap,T=new WeakMap;function Ze(e,n,t,r){let i=S(n);if(!i)return null;let a=k(e,n);if(!a)return null;let s=T.get(a);return s||(s=pe(a,i),T.set(a,s)),s.get(`${t}:${r}`)??null}function pe(e,n){let t=n==="rust"?new Set(["function_item","function_signature_item"]):n==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),r=new Map,i=a=>{if(t.has(a.type)){let s=a.namedChildren.find(o=>o.type==="parameters"||o.type==="formal_parameters"),c=0;if(s)for(let o of s.namedChildren)o.type==="comment"||o.type==="line_comment"||o.type==="block_comment"||(c+=1);r.set(`${a.startPosition.row}:${a.endPosition.row}`,{paramCount:c})}for(let s of a.children)i(s)};return i(e.rootNode),r}function D(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 n=e.namedChild(e.namedChildCount-1);return n?D(n):null}case"scoped_identifier":{let n=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return n?D(n):null}case"super":case"self":case"this":return null;default:return null}}var me={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function p(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],r=n[1],i=e.slice(t.length+1+r.length+1),a;if(i.startsWith("`")){let l=i.indexOf("`",1);l===-1?(a=i.slice(1),i=""):(a=i.slice(1,l),i=i.slice(l+2))}else{let l=i.indexOf(" ");l===-1?(a=i,i=""):(a=i.slice(0,l),i=i.slice(l+1))}let s,c=i.indexOf(" ");c===-1?(s=i,i=""):(s=i.slice(0,c),i=i.slice(c+1));let o=ge(i);return{scheme:t,manager:r,packageName:a,version:s,descriptors:o,raw:e}}function ge(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let a=e.indexOf("]",t+1);if(a===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,a),suffix:"type-param"}),t=a+1;continue}if(e[t]==="("&&(n.length===0||t===0||V(e[t-1]))){let a=e.indexOf(")",t+1);if(a!==-1&&e[a+1]!=="."){n.push({name:e.slice(t+1,a),suffix:"parameter"}),t=a+1;continue}}let r;if(e[t]==="`"){let a=e.indexOf("`",t+1);if(a===-1){r=e.slice(t+1),n.push({name:r,suffix:"term"});break}r=e.slice(t+1,a),t=a+1}else{let a=t;for(;t<e.length&&!V(e[t]);)t++;r=e.slice(a,t)}if(t>=e.length){r&&n.push({name:r,suffix:"term"});break}let i=e[t];if(i==="("){let a=e.indexOf(")",t+1);a!==-1&&e[a+1]==="."?(n.push({name:r,suffix:"method"}),t=a+2):a!==-1?(n.push({name:r,suffix:"method"}),t=a+1):(n.push({name:r,suffix:"term"}),t++)}else{let a=me[i];a&&n.push({name:r,suffix:a}),t+=1}}return n}function V(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function W(e){let n=p(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let r=[];for(let i of t.descriptors){let a=be(i);a&&r.push(a)}return r.join(":")}function be(e){let n=e.suffix==="namespace"?ye(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function ye(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function B(e){let n=p(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function b(e){let n=p(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function tt(e){return e.endsWith("().")||b(e)==="method"}function H(e){let n=b(e);return n==="method"||n==="term"}function nt(e){return b(e)==="namespace"}var he=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function rt(e){return he.test(e)}var xe=new Set(["test","tests","_tests"]);function it(e){let n=p(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let r=n.descriptors[t];if(r?.suffix==="namespace"&&r.name&&xe.has(r.name))return!0}return!1}function at(e,n){let t=p(e),r=p(n);if("kind"in t||"kind"in r)return!1;let i=t.descriptors,a=r.descriptors;if(a.length!==i.length+1)return!1;for(let s=0;s<i.length;s++){let c=i[s],o=a[s];if(c.name!==o.name||c.suffix!==o.suffix)return!1}return!0}function st(e,n){let t=p(e),r=p(n);if("kind"in t||"kind"in r)return!1;let i=t.descriptors,a=r.descriptors;if(a.length<=i.length)return!1;for(let s=0;s<i.length;s++){let c=i[s],o=a[s];if(c.name!==o.name||c.suffix!==o.suffix)return!1}return!0}function U(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function Y(e){if(!e)return null;let n=z(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let r=e.slice(t+1);return(z(r)??r).replace(/\n/g," ")}function z(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}var Se=h("file-definitions");function v(e,n){return Se.get(e,n,()=>{let t=Ce(_e(e,n),Le(e,n));return Ie(e,n,t.map(De))})}function _e(e,n){return e.all(`SELECT
44
- gs.id,
45
- gs.symbol,
46
- der.document_id,
47
- der.start_line,
48
- der.end_line,
49
- d.relative_path,
50
- gs.display_name,
51
- gs.kind,
52
- gs.documentation,
53
- gs.enclosing_symbol
54
- FROM global_symbols gs
55
- JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
56
- JOIN documents d ON der.document_id = d.id
57
- WHERE d.relative_path = ?
58
- ${e.symbolNoiseFor("gs")}
59
- ORDER BY der.start_line, der.end_line`,n)}function Le(e,n){return e.all(`SELECT
60
- gs.id,
61
- gs.symbol,
62
- c.document_id,
63
- MIN(c.start_line) AS start_line,
64
- MAX(c.end_line) AS end_line,
65
- d.relative_path,
66
- gs.display_name,
67
- gs.kind,
68
- gs.documentation,
69
- gs.enclosing_symbol
70
- FROM global_symbols gs
71
- JOIN mentions m ON m.symbol_id = gs.id
72
- JOIN chunks c ON m.chunk_id = c.id
73
- JOIN documents d ON c.document_id = d.id
74
- WHERE d.relative_path = ?
75
- AND m.role = 1
76
- ${e.symbolNoiseFor("gs")}
77
- GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
78
- ORDER BY start_line, end_line`,n)}function De(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:B(e.symbol),parentTypeName:I(e.symbol),isFunctionLike:H(e.symbol),isTypeLike:b(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function Ce(e,n){let t=new Map;for(let r of n)e.length>0&&!ke(r)||t.set(r.id,r);for(let r of e)t.set(r.id,r);return[...t.values()].sort((r,i)=>r.start_line-i.start_line||r.end_line-i.end_line||r.symbol.localeCompare(i.symbol))}function ke(e){if(I(e.symbol)!==null)return!1;let t=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(t)}function mt(e,n={}){return ve(e,n.scope)}function ve(e,n){let t=n?`AND relative_path LIKE '%${n}%'`:"";return e.all(`SELECT relative_path
79
- FROM documents
80
- WHERE 1 = 1
81
- ${e.pathExclusionsFor("documents")}
82
- ${t}
83
- ORDER BY relative_path`).flatMap(r=>v(e,r.relative_path)).filter(r=>!e.isIgnored(r.relativePath))}function gt(e,n,t={}){if(n.length===0)return[];let r=n.flatMap(i=>v(e,i)).filter(i=>!e.isIgnored(i.relativePath));return t.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),t.sort&&(r=r.sort((i,a)=>i.relativePath.localeCompare(a.relativePath)||i.startLine-a.startLine||i.endLine-a.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:W(i.symbol),signature:U(Y(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function bt(e,n){let t=null;for(let r of e)r.startLine>n||r.endLine<n||(!t||r.endLine-r.startLine<t.endLine-t.startLine)&&(t=r);return t}function yt(e,n){let t=v(e,n.relative_path).find(r=>r.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function Ie(e,n,t){let r=m(e,n),i=j(e,n);return i?Te(t,i,r):r?Ae(t,r):t}function Ae(e,n){let t=n.split(/\r?\n/),r=Me(e,t),i=we(e,r),a=Re(i,t);return Ne(e,a)}function Me(e,n){let t=e.some(i=>_(i.symbol))?Pe(n):null,r=new Map;for(let i of e)r.set(i.symbolId,Ee(n,t,i));return r}function we(e,n){return e.filter(t=>_(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,r)=>t.startLine-r.startLine||t.definition.startLine-r.definition.startLine||t.definition.symbol.localeCompare(r.definition.symbol))}function Re(e,n){let t=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],a=e[r+1],s=a?Math.max(i.startLine,a.startLine-1):n.length-1;t.set(i.definition.symbolId,{startLine:i.startLine,endLine:Oe(n,i.definition,i.startLine,s)})}return t}function Ne(e,n){return e.map(t=>{let r=n.get(t.symbolId);return r?{...t,startLine:r.startLine,endLine:r.endLine}:t})}function Te(e,n,t=null){let r=new Map;for(let i of n){let a=r.get(i.name);a?a.push(i):r.set(i.name,[i])}return e.map(i=>{if(!_(i.symbol)||!i.leaf)return K(i,t);let a=r.get(i.leaf);if(!a||a.length===0)return K(i,t);let s=a[0],c=Math.abs(s.startLine-i.startLine);for(let o=1;o<a.length;o+=1){let l=a[o],u=Math.abs(l.startLine-i.startLine);u<c&&(s=l,c=u)}return{...i,startLine:s.startLine,endLine:s.endLine}})}function K(e,n){if(!n||!e.leaf||b(e.symbol)!=="term"||I(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),a=n.split(/\r?\n/).findIndex(s=>r.test(s));return a>=0?{...e,startLine:a,endLine:a}:e}function Ee(e,n,t){if(!_(t.symbol))return t.startLine;let r=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return r;let i=n.get(t.leaf);if(!i||i.length===0)return r;let a=null;for(let s of i){let c=Math.abs(s-t.startLine);(!a||c<a.distance)&&(a={line:s,distance:c})}return a?.line??r}function Pe(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,a=new Map,s=(c,o)=>{let l=a.get(c);if(!l){a.set(c,[o]);return}l[l.length-1]!==o&&l.push(o)};for(let c=0;c<e.length;c+=1){let o=e[c]??"";for(let u of o.matchAll(n))u[1]&&s(u[1],c);for(let u of o.matchAll(t))u[1]&&s(u[1],c);let l=o.match(r);l?.[1]&&s(l[1],c);for(let u of o.matchAll(i))u[1]&&s(u[1],c)}return a}function Oe(e,n,t,r){let i=Math.max(t,Math.min(e.length-1,r)),a=Math.max(t,Math.min(i,n.endLine)),s=0,c=0,o=!1;for(let l=t;l<=i;l+=1){let u=$e(e[l]??"");for(let d of u)d==="{"?(s+=1,o=!0):d==="}"?s=Math.max(0,s-1):d==="("?c+=1:d===")"&&(c=Math.max(0,c-1));if(o&&s===0||!o&&c===0&&l>=a)return l}return a}function $e(e){let n="",t=null,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i],s=e[i+1];if(!t&&a==="/"&&s==="/"){n+=" ".repeat(e.length-i);break}if(t){if(r){r=!1,n+=" ";continue}if(a==="\\"){r=!0,n+=" ";continue}a===t&&(t=null),n+=" ";continue}if(a==='"'||a==="'"||a==="`"){t=a,n+=" ";continue}n+=a}return n}function _(e){return e.includes("().")}function I(e){let n=p(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let r=n.descriptors[t];if(r?.suffix==="type")return r.name}return null}function ht(e){let n=p(e);if("kind"in n)return[];let t=[];for(let r=n.descriptors.length-2;r>=0;r-=1){let i=n.descriptors[r];i?.suffix==="type"&&i.name&&t.push(i.name)}return t}export{h as a,Fe as b,A as c,m as d,Be as e,He as f,S as g,te as h,qe as i,k as j,Je as k,Xe as l,de as m,Ze as n,D as o,p,W as q,B as r,b as s,tt as t,H as u,nt as v,rt as w,it as x,at as y,st as z,U as A,Y as B,v as C,mt as D,ve as E,gt as F,bt as G,yt as H,I,ht as J};
84
- //# sourceMappingURL=chunk-KYGNCIJ6.js.map
@@ -1,2 +0,0 @@
1
- import{a as m}from"./chunk-SVUVC5VS.js";import{a as l}from"./chunk-QYWGC7JV.js";import{r,t as a}from"./chunk-KYGNCIJ6.js";import{basename as d}from"path";function g(t,c){let o=l(t,c);if(!o)return[];let s=r(o.symbol),i=new m(t).definitionsForFile(o.relativePath).filter(e=>a(e.symbol)),n=i.filter(e=>e.parentTypeName===s||e.symbol.includes(s));return(n.length>0?n:p(d(o.relativePath))===s?i.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:r(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{g as a};
2
- //# sourceMappingURL=chunk-LHLXHH43.js.map
@@ -1,2 +0,0 @@
1
- function t(e){let r=e.replace(/\\/g,"/").split("/").filter(Boolean);return r.length<=1?"(root)":r.length>=3&&["src","lib","app","server","client"].includes(r[0])?`${r[0]}/${r[1]}`:r[0]}function l(e,n){if(e===n)return"ok";let r=s(e),o=s(n);return r&&o?i(r,o)?"ok":"violation":a(e,n)}function c(e,n){let r=s(t(e)),o=s(t(n));return!!r&&!!o}function s(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function i(e,n){return n==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(n)??!1}function a(e,n){if(n==="shared")return"ok";let r={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return r[e]?r[e].has(n)?"ok":"violation":null}export{t as a,l as b,c};
2
- //# sourceMappingURL=chunk-LJ2YWNQF.js.map
@@ -1,7 +0,0 @@
1
- import{c as m}from"./chunk-7EQ4J66C.js";import{l as g}from"./chunk-GS55K4WJ.js";import{a as R}from"./chunk-QYWGC7JV.js";import{d as u,u as h}from"./chunk-KYGNCIJ6.js";function $(t,a){let e=R(t,a);if(!e)return[];let i=!h(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],r=m(t,e),l=(r.length>0?r:g(t,e)).filter(n=>!t.isIgnored(n.file)).map(n=>({relativePath:n.file,line:n.line})),c=S(t,e),s=new Set,f=[];for(let n of[...i,...l,...c]){let p=`${n.relativePath}:${n.line}`;s.has(p)||(s.add(p),f.push(n))}return f}function S(t,a){if(!a.relativePath.endsWith(".rb"))return[];let e=d(a.symbol);if(e.length===0)return[];let o=t.all(`SELECT relative_path
2
- FROM documents
3
- WHERE relative_path LIKE '%.rb'
4
- ${t.pathExclusionsFor("documents")}
5
- ORDER BY relative_path`),i=[];for(let r of o){if(t.isIgnored(r.relative_path))continue;let l=u(t,r.relative_path);if(!l)continue;let c=l.split(`
6
- `);for(let s=0;s<c.length;s++){let f=c[s]??"";e.some(n=>new RegExp(`@${n}\\b|\\b${n}:`).test(f))&&i.push({relativePath:r.relative_path,line:s})}}return i}function d(t){let e=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),o=e.split("_").filter(Boolean),i=new Set;return e&&i.add(e),o.length>=1&&i.add(o[o.length-1]),o.length>=2&&i.add(o.slice(-2).join("_")),[...i]}export{$ as a};
7
- //# sourceMappingURL=chunk-M7GBLQG4.js.map