scip-query 0.5.0 → 0.6.1

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 (203) hide show
  1. package/README.md +14 -7
  2. package/dist/chunk-2DSS2NGF.js +10 -0
  3. package/dist/chunk-2RLP74AO.js +2 -0
  4. package/dist/chunk-4QJ7LVW5.js +2 -0
  5. package/dist/chunk-4TYGGOLO.js +5 -0
  6. package/dist/chunk-5IADAU5B.js +7 -0
  7. package/dist/chunk-7754WFFV.js +18 -0
  8. package/dist/chunk-7VOF4ZG6.js +2 -0
  9. package/dist/chunk-7Z4COVMC.js +2 -0
  10. package/dist/chunk-AJ5PWKD4.js +2 -0
  11. package/dist/chunk-BDBRZPX3.js +7 -0
  12. package/dist/chunk-BE6EQIWY.js +2 -0
  13. package/dist/chunk-BQ3INTYT.js +8 -0
  14. package/dist/chunk-D7KLLMPB.js +2 -0
  15. package/dist/chunk-D7YBWSON.js +29 -0
  16. package/dist/chunk-DE5ZBHMK.js +39 -0
  17. package/dist/chunk-DHYIJHXZ.js +33 -0
  18. package/dist/chunk-EEF3YEHW.js +2 -0
  19. package/dist/chunk-F2LLHRRZ.js +2 -0
  20. package/dist/chunk-FCC3XJTI.js +2 -0
  21. package/dist/chunk-GNXRLK5G.js +2 -0
  22. package/dist/chunk-GXVB36TG.js +62 -0
  23. package/dist/chunk-HMKJTAZD.js +2 -0
  24. package/dist/chunk-IBGBI3VU.js +2 -0
  25. package/dist/chunk-IYFZS4PV.js +84 -0
  26. package/dist/chunk-JH3A7HTU.js +2 -0
  27. package/dist/chunk-JS2RNIC7.js +2 -0
  28. package/dist/chunk-K5FQFCSN.js +41 -0
  29. package/dist/chunk-K6GBKEQE.js +6 -0
  30. package/dist/chunk-KO7YJRWP.js +12 -0
  31. package/dist/chunk-KYT47WU2.js +4 -0
  32. package/dist/chunk-LORWXBOO.js +2 -0
  33. package/dist/chunk-LX4H4LLG.js +89 -0
  34. package/dist/chunk-N3Z2SJCR.js +2 -0
  35. package/dist/chunk-NTDA4A2D.js +25 -0
  36. package/dist/chunk-NXMYYHDO.js +24 -0
  37. package/dist/chunk-PZ6ESKRH.js +7 -0
  38. package/dist/chunk-QXE6EDY2.js +6 -0
  39. package/dist/chunk-RJ7SPBJ5.js +5 -0
  40. package/dist/chunk-RWE6FHG3.js +3 -0
  41. package/dist/chunk-SDX6MDBL.js +2 -0
  42. package/dist/chunk-SG35Y7J2.js +2 -0
  43. package/dist/chunk-STOGKRJH.js +4 -0
  44. package/dist/chunk-TINPMWJK.js +2 -0
  45. package/dist/chunk-UJB62HV3.js +2 -0
  46. package/dist/chunk-VEUMRDHW.js +2 -0
  47. package/dist/chunk-WCDXJGYT.js +65 -0
  48. package/dist/chunk-WTSTDJZ7.js +6 -0
  49. package/dist/chunk-XAZTIDST.js +2 -0
  50. package/dist/chunk-XVDASCN7.js +35 -0
  51. package/dist/chunk-Y7H6D2EV.js +2 -0
  52. package/dist/chunk-Y7LOQSWY.js +2 -0
  53. package/dist/chunk-YIPCV7M7.js +70 -0
  54. package/dist/chunk-ZSRXMNMK.js +5 -0
  55. package/dist/chunk-ZXKURFVB.js +56 -0
  56. package/dist/cli.js +509 -8758
  57. package/dist/{db-6F9R9e_t.d.ts → db-BSTtBG_H.d.ts} +146 -1
  58. package/dist/index.d.ts +11 -2
  59. package/dist/index.js +13 -1616
  60. package/dist/postinstall.js +4 -100
  61. package/dist/queries/affected.d.ts +1 -1
  62. package/dist/queries/affected.js +1 -8
  63. package/dist/queries/bottlenecks.d.ts +1 -1
  64. package/dist/queries/bottlenecks.js +1 -8
  65. package/dist/queries/by-kind.d.ts +1 -4
  66. package/dist/queries/by-kind.js +1 -10
  67. package/dist/queries/call-graph.d.ts +1 -1
  68. package/dist/queries/call-graph.js +1 -8
  69. package/dist/queries/change-surface.d.ts +1 -1
  70. package/dist/queries/change-surface.js +1 -8
  71. package/dist/queries/code.d.ts +1 -1
  72. package/dist/queries/code.js +1 -8
  73. package/dist/queries/complexity-hotspots.d.ts +5 -10
  74. package/dist/queries/complexity-hotspots.js +1 -8
  75. package/dist/queries/complexity.d.ts +1 -1
  76. package/dist/queries/complexity.js +1 -8
  77. package/dist/queries/convergence.d.ts +1 -1
  78. package/dist/queries/convergence.js +1 -8
  79. package/dist/queries/coupling.d.ts +1 -1
  80. package/dist/queries/coupling.js +1 -10
  81. package/dist/queries/cycles.d.ts +1 -1
  82. package/dist/queries/cycles.js +1 -8
  83. package/dist/queries/dataflow.d.ts +1 -1
  84. package/dist/queries/dataflow.js +1 -8
  85. package/dist/queries/dead.d.ts +1 -1
  86. package/dist/queries/dead.js +1 -9
  87. package/dist/queries/deep-chains.d.ts +9 -1
  88. package/dist/queries/deep-chains.js +1 -8
  89. package/dist/queries/deps.d.ts +1 -1
  90. package/dist/queries/deps.js +1 -10
  91. package/dist/queries/diff-impact.d.ts +1 -1
  92. package/dist/queries/diff-impact.js +1 -7
  93. package/dist/queries/drift.d.ts +1 -1
  94. package/dist/queries/drift.js +1 -8
  95. package/dist/queries/extract-candidates.d.ts +1 -1
  96. package/dist/queries/extract-candidates.js +1 -8
  97. package/dist/queries/fan.d.ts +1 -1
  98. package/dist/queries/fan.js +1 -14
  99. package/dist/queries/files.d.ts +1 -1
  100. package/dist/queries/files.js +1 -6
  101. package/dist/queries/health.d.ts +1 -1
  102. package/dist/queries/health.js +1 -20
  103. package/dist/queries/hierarchy.d.ts +1 -1
  104. package/dist/queries/hierarchy.js +1 -8
  105. package/dist/queries/hotspots.d.ts +1 -1
  106. package/dist/queries/hotspots.js +1 -8
  107. package/dist/queries/imports.d.ts +1 -1
  108. package/dist/queries/imports.js +1 -12
  109. package/dist/queries/index.d.ts +1 -1
  110. package/dist/queries/index.js +1 -197
  111. package/dist/queries/isolated.d.ts +1 -1
  112. package/dist/queries/isolated.js +1 -9
  113. package/dist/queries/members.d.ts +1 -1
  114. package/dist/queries/members.js +1 -8
  115. package/dist/queries/methods.d.ts +1 -1
  116. package/dist/queries/methods.js +1 -8
  117. package/dist/queries/outline.d.ts +1 -1
  118. package/dist/queries/outline.js +1 -8
  119. package/dist/queries/passthrough-candidates.d.ts +1 -1
  120. package/dist/queries/passthrough-candidates.js +1 -8
  121. package/dist/queries/redundant-reexports.d.ts +1 -1
  122. package/dist/queries/redundant-reexports.js +1 -9
  123. package/dist/queries/refs.d.ts +1 -1
  124. package/dist/queries/refs.js +1 -8
  125. package/dist/queries/similar-chains.d.ts +1 -1
  126. package/dist/queries/similar-chains.js +1 -8
  127. package/dist/queries/similar-files.d.ts +1 -1
  128. package/dist/queries/similar-files.js +1 -8
  129. package/dist/queries/similar-signatures.d.ts +1 -1
  130. package/dist/queries/similar-signatures.js +1 -8
  131. package/dist/queries/similar.d.ts +1 -1
  132. package/dist/queries/similar.js +1 -10
  133. package/dist/queries/slice.d.ts +1 -1
  134. package/dist/queries/slice.js +1 -8
  135. package/dist/queries/stale-abstractions.d.ts +15 -5
  136. package/dist/queries/stale-abstractions.js +1 -8
  137. package/dist/queries/stats.d.ts +1 -1
  138. package/dist/queries/stats.js +1 -6
  139. package/dist/queries/surface.d.ts +1 -1
  140. package/dist/queries/surface.js +1 -8
  141. package/dist/queries/symbols.d.ts +1 -1
  142. package/dist/queries/symbols.js +1 -9
  143. package/dist/queries/system.d.ts +1 -1
  144. package/dist/queries/system.js +1 -9
  145. package/dist/queries/trace.d.ts +1 -1
  146. package/dist/queries/trace.js +1 -9
  147. package/dist/queries/wrapper-candidates.d.ts +1 -1
  148. package/dist/queries/wrapper-candidates.js +1 -8
  149. package/dist/reindex-worker.js +7 -672
  150. package/package.json +20 -2
  151. package/skills/concrete-plan/SKILL.md +3 -3
  152. package/skills/scip-debloat/SKILL.md +3 -6
  153. package/skills/scip-language-playbook/SKILL.md +2 -0
  154. package/dist/chunk-2MQ5DPY6.js +0 -61
  155. package/dist/chunk-2QTYIOJ5.js +0 -165
  156. package/dist/chunk-3VI4YXCL.js +0 -172
  157. package/dist/chunk-3VV2G6U7.js +0 -34
  158. package/dist/chunk-44PFXVXG.js +0 -76
  159. package/dist/chunk-6SLFQR36.js +0 -64
  160. package/dist/chunk-74RFWB5T.js +0 -24
  161. package/dist/chunk-7DBPRGMS.js +0 -221
  162. package/dist/chunk-DTB724R3.js +0 -110
  163. package/dist/chunk-FLOYI6I4.js +0 -185
  164. package/dist/chunk-FO2CBB7U.js +0 -23
  165. package/dist/chunk-GJT3MO2T.js +0 -17
  166. package/dist/chunk-HAP4LJKX.js +0 -66
  167. package/dist/chunk-JCOJQ4I6.js +0 -93
  168. package/dist/chunk-JGQMOS4V.js +0 -59
  169. package/dist/chunk-JMD4WJ2Q.js +0 -213
  170. package/dist/chunk-JSQPZOPO.js +0 -64
  171. package/dist/chunk-JSXGC2EH.js +0 -151
  172. package/dist/chunk-JZN3DRCT.js +0 -59
  173. package/dist/chunk-KMWYB3CX.js +0 -71
  174. package/dist/chunk-MRM755FU.js +0 -37
  175. package/dist/chunk-N2XO3Z5F.js +0 -69
  176. package/dist/chunk-OLW5UL36.js +0 -76
  177. package/dist/chunk-OMCRXXDX.js +0 -2600
  178. package/dist/chunk-OWJOHUZE.js +0 -44
  179. package/dist/chunk-P3VCDYMJ.js +0 -269
  180. package/dist/chunk-PEDH3D4G.js +0 -53
  181. package/dist/chunk-POAN4SCR.js +0 -46
  182. package/dist/chunk-PTMGEBU3.js +0 -101
  183. package/dist/chunk-PU44HK7P.js +0 -87
  184. package/dist/chunk-QJI7EECA.js +0 -327
  185. package/dist/chunk-R5HICGMB.js +0 -110
  186. package/dist/chunk-RJ2D6YWQ.js +0 -49
  187. package/dist/chunk-RZ5GYPBP.js +0 -79
  188. package/dist/chunk-SRLQNO6O.js +0 -101
  189. package/dist/chunk-UGS7HJI4.js +0 -84
  190. package/dist/chunk-VKUUXOE7.js +0 -105
  191. package/dist/chunk-VPUJSJCI.js +0 -84
  192. package/dist/chunk-VRWVV3EP.js +0 -72
  193. package/dist/chunk-WJWQEU4A.js +0 -162
  194. package/dist/chunk-WJZHDUSB.js +0 -40
  195. package/dist/chunk-WWOCQ5W4.js +0 -34
  196. package/dist/chunk-X3Q2OVRL.js +0 -77
  197. package/dist/chunk-Y3P7QKKN.js +0 -27
  198. package/dist/chunk-Y6FAHY4N.js +0 -81
  199. package/dist/chunk-YMSJCSRG.js +0 -213
  200. package/dist/chunk-ZDL3U4W2.js +0 -124
  201. package/dist/chunk-ZXNX5JRE.js +0 -216
  202. package/dist/queries/clean-signature.d.ts +0 -17
  203. package/dist/queries/clean-signature.js +0 -9
@@ -0,0 +1,84 @@
1
+ import{a as D,b as v,c as k,d as A,f as M}from"./chunk-TINPMWJK.js";function b(a){let n=new WeakMap,e=t=>{let r=n.get(t);return r||(r=new Map,n.set(t,r)),r};return{get(t,r,i){let o=e(t);if(o.has(r))return o.get(r);let l=i();return o.set(r,l),l},invalidate(t,r){n.get(t)?.delete(r)},invalidateAll(t){n.delete(t)},size(t){return n.get(t)?.size??0}}}function he(a){let n=new WeakMap;return{get(e,t){let r=n.get(e);if(r)return r.value;let i=t();return n.set(e,{value:i}),i},invalidate(e){n.delete(e)},has(e){return n.has(e)}}}function I(a){let n=new WeakMap,e=t=>{let r=n.get(t);return r||(r=new Map,n.set(t,r)),r};return{get(t,r,i,o){let l=e(t),s=l.get(r);if(s&&s.source===i)return s.value;let u=o();return l.set(r,{source:i,value:u}),u},invalidate(t,r){n.get(t)?.delete(r)},invalidateAll(t){n.delete(t)}}}import{existsSync as H,readFileSync as Y}from"fs";import{join as K}from"path";var U=b("source-text");function m(a,n){let e=n.replace(/\\/g,"/");return U.get(a,e,()=>{let t=K(a.config.projectRoot,e);return H(t)?Y(t,"utf-8"):""})}var z=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale|wrapper|passthrough|drift)?/i;function Ce(a,n,e){if(e<=0)return!1;let t=m(a,n);if(!t)return!1;let r=t.split(`
2
+ `);for(let i=e-1;i>=0&&i>=e-5;i-=1){let o=(r[i]??"").trim();if(o!==""){if(z.test(o))return!0;if(!o.startsWith("//")&&!o.startsWith("*")&&!o.startsWith("/*")&&!o.startsWith("@")&&!o.startsWith("#"))return!1}}return!1}import{extname as R}from"path";import{createRequire as G}from"module";var p=G(import.meta.url),y=null,N=!1;function P(){if(N)return null;if(y)return y;try{return y=p("tree-sitter"),y}catch{return N=!0,null}}var q={".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"},w=new Map,x=new Set;function O(a){if(x.has(a))return null;let n=w.get(a);if(n)return n;let e;try{switch(a){case"rust":e=p("tree-sitter-rust");break;case"typescript":e=p("tree-sitter-typescript").typescript;break;case"tsx":e=p("tree-sitter-typescript").tsx;break;case"javascript":e=p("tree-sitter-javascript");break;case"python":e=p("tree-sitter-python");break;case"java":e=p("tree-sitter-java");break;case"kotlin":e=p("tree-sitter-kotlin");break;case"scala":e=p("tree-sitter-scala");break;case"ruby":e=p("tree-sitter-ruby");break;case"c":e=p("tree-sitter-c");break;case"cpp":e=p("tree-sitter-cpp");break;case"csharp":e=p("tree-sitter-c-sharp");break;case"php":e=p("tree-sitter-php").php;break;case"vb":{let t=p("tree-sitter-vb-dotnet");e=t.language??t;break}}}catch{return x.add(a),null}return w.set(a,e),e}var T=new Map;function V(a){let n=T.get(a);if(n)return n;let e=O(a);if(!e)return null;let t=P();if(!t)return null;let r=new t;try{r.setLanguage(e)}catch{return x.add(a),null}return T.set(a,r),r}function h(a){return q[R(a).toLowerCase()]??null}function J(a){return R(a).toLowerCase()===".vue"}var j=I("ast-trees");function L(a,n){if(J(n))return Z(a,n);let e=h(n);if(!e)return null;let t=m(a,n);return t?j.get(a,n,t,()=>{let r=V(e);return r?r.parse(t):null}):null}function Z(a,n){let e=m(a,n);return e?j.get(a,n,e,()=>{let t=X(e);if(!t)return null;let r=V(t.language);if(!r)return null;let i=`
3
+ `.repeat(t.startLine)+t.body;return r.parse(i)}):null}function X(a){let n=[],e=/<script\b([^>]*)>([\s\S]*?)<\/script>/g;for(let s of a.matchAll(e))typeof s.index=="number"&&n.push({tagOpen:s[1]??"",body:s[2]??"",openIdx:s.index+(s[0].length-(s[2]?.length??0)-9)});if(n.length===0)return null;let t=n.find(s=>/\bsetup\b/.test(s.tagOpen))??n[0],i=t.tagOpen.match(/\blang\s*=\s*["']?([\w-]+)/)?.[1]?.toLowerCase(),o=i==="ts"||i==="typescript"?"typescript":i==="tsx"?"tsx":"javascript",l=ee(a,t.openIdx);return{body:t.body,startLine:l,language:o}}function ee(a,n){let e=0;for(let t=0;t<n&&t<a.length;t++)a.charCodeAt(t)===10&&e++;return e}var g=new Map;function te(a,n){let e=`${a}::${n}`;if(g.has(e))return g.get(e)??null;let t=O(a);if(!t)return g.set(e,null),null;let r=P();if(!r)return g.set(e,null),null;let i=null;try{i=new r.Query(t,n)}catch{i=null}return g.set(e,i),i}var ne={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
+ `},re=new WeakMap;function F(a,n){return Q(a,n,re,ne,e=>{let t=[];for(let r of e){let i=null,o=null;for(let l of r.captures)l.name==="name"?i=l.node.text:l.name==="def"&&(o={startLine:l.node.startPosition.row,endLine:l.node.endPosition.row});i&&o&&t.push({name:i,startLine:o.startLine,endLine:o.endLine})}return t})}var ae={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
+ `},ie=new WeakMap;function Ie(a,n){return Q(a,n,ie,ae,e=>{let t=[];for(let r of e){let i=null,o=null;for(let s of r.captures)s.name==="target"?i=s.node:s.name==="call"&&(o=s.node);if(!i||!o)continue;let l=S(i);l&&t.push({calleeLeaf:l,line:o.startPosition.row})}return t})}function Ne(a,n){return se(a,n,oe,()=>new Map,(e,t,r)=>{let i=(s,u)=>{if(s===u)return;let c=r.get(s);c||(c=new Set,r.set(s,c)),c.add(u)},o=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),l=(s,u)=>{let c=d=>{o.has(d.type)&&d.text!==u&&i(d.text,u);for(let f of d.children)c(f)};for(let d of s.children)c(d)};if(t==="rust")for(let s of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let u=s.namedChildren.find(d=>d.type==="type_identifier")?.text;if(!u)continue;let c=s.namedChildren.find(d=>d.type==="field_declaration_list"||d.type==="enum_variant_list"||d.type==="ordered_field_declaration_list");c&&l(c,u),s.type==="type_item"&&l(s,u)}else if(t==="python")for(let s of e.rootNode.descendantsOfType("class_definition")){let u=s.namedChildren.find(d=>d.type==="identifier")?.text;if(!u)continue;let c=s.namedChildren.find(d=>d.type==="block");if(c)for(let d of c.descendantsOfType("type"))for(let f of d.descendantsOfType("identifier"))f.text!==u&&i(f.text,u)}else for(let s of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let u=s.namedChildren.find(c=>c.type==="type_identifier")?.text;u&&l(s,u)}})??new Map}function se(a,n,e,t,r){let i=h(n);if(!i)return null;let o=L(a,n);if(!o)return null;let l=e.get(o);if(l)return l;let s=t();return r(o,i,s),e.set(o,s),s}function Q(a,n,e,t,r){let i=h(n);if(!i)return null;let o=t[i];if(!o)return null;let l=L(a,n);if(!l)return null;let s=e.get(l);if(s)return s;let u=te(i,o);if(!u)return null;let c=r(u.matches(l.rootNode));return e.set(l,c),c}var oe=new WeakMap,E=new WeakMap;function we(a,n,e,t){let r=h(n);if(!r)return null;let i=L(a,n);if(!i)return null;let o=E.get(i);return o||(o=le(i,r),E.set(i,o)),o.get(`${e}:${t}`)??null}function le(a,n){let e=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"]),t=new Map,r=i=>{if(e.has(i.type)){let o=i.namedChildren.find(s=>s.type==="parameters"||s.type==="formal_parameters"),l=0;if(o)for(let s of o.namedChildren)s.type==="comment"||s.type==="line_comment"||s.type==="block_comment"||(l+=1);t.set(`${i.startPosition.row}:${i.endPosition.row}`,{paramCount:l})}for(let o of i.children)r(o)};return r(a.rootNode),t}function S(a){switch(a.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return a.text;case"field_expression":case"member_expression":case"attribute":{let n=a.namedChild(a.namedChildCount-1);return n?S(n):null}case"scoped_identifier":{let n=a.childForFieldName("name")??a.namedChild(a.namedChildCount-1);return n?S(n):null}case"super":case"self":case"this":return null;default:return null}}function $(a){return!a||!a.trim()?null:a.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 W(a){if(!a)return null;let n=a.indexOf("|");return n===-1?a.replace(/\n/g," "):a.slice(n+1).replace(/\n/g," ")}var ce=b("file-definitions");function C(a,n){return ce.get(a,n,()=>{let e=a.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
+ ${a.symbolNoiseFor("gs")}
59
+ ORDER BY der.start_line, der.end_line`,n),t=e.length>0?[]:a.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
+ ${a.symbolNoiseFor("gs")}
77
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
78
+ ORDER BY start_line, end_line`,n);return de(a,n,(e.length>0?e:t).map(r=>({symbolId:r.id,symbol:r.symbol,documentId:r.document_id,startLine:r.start_line,endLine:r.end_line,relativePath:r.relative_path,leaf:k(r.symbol),parentTypeName:ye(r.symbol),isFunctionLike:M(r.symbol),isTypeLike:A(r.symbol)==="type",kind:r.kind??null,documentation:r.documentation??null,enclosingSymbol:r.enclosing_symbol??null})))})}function Fe(a,n={}){return ue(a,n.scope)}function ue(a,n){let e=n?`AND relative_path LIKE '%${n}%'`:"";return a.all(`SELECT relative_path
79
+ FROM documents
80
+ WHERE 1 = 1
81
+ ${a.pathExclusionsFor("documents")}
82
+ ${e}
83
+ ORDER BY relative_path`).flatMap(t=>C(a,t.relative_path)).filter(t=>!a.isIgnored(t.relativePath))}function Qe(a,n,e={}){if(n.length===0)return[];let t=n.flatMap(r=>C(a,r)).filter(r=>!a.isIgnored(r.relativePath));return e.onlyDocumented&&(t=t.filter(r=>r.documentation!==null&&r.documentation!=="")),e.sort&&(t=t.sort((r,i)=>r.relativePath.localeCompare(i.relativePath)||r.startLine-i.startLine||r.endLine-i.endLine)),t.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:v(r.symbol),signature:$(W(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function $e(a,n){let e=null;for(let t of a)t.startLine>n||t.endLine<n||(!e||t.endLine-t.startLine<e.endLine-e.startLine)&&(e=t);return e}function We(a,n){let e=C(a,n.relative_path).find(t=>t.symbolId===n.id);return e?{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,endLine:e.endLine,relativePath:e.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function de(a,n,e){let t=F(a,n);if(t)return pe(e,t);let r=m(a,n);if(!r)return e;let i=r.split(/\r?\n/),o=e.some(c=>_(c.symbol))?me(i):null,l=new Map;for(let c of e)l.set(c.symbolId,fe(i,o,c));let s=new Map,u=e.filter(c=>_(c.symbol)).map(c=>({definition:c,startLine:l.get(c.symbolId)??c.startLine})).sort((c,d)=>c.startLine-d.startLine||c.definition.startLine-d.definition.startLine||c.definition.symbol.localeCompare(d.definition.symbol));for(let c=0;c<u.length;c+=1){let d=u[c],f=u[c+1],B=f?Math.max(d.startLine,f.startLine-1):i.length-1;s.set(d.definition.symbolId,{startLine:d.startLine,endLine:ge(i,d.definition,d.startLine,B)})}return e.map(c=>{let d=s.get(c.symbolId);return d?{...c,startLine:d.startLine,endLine:d.endLine}:c})}function pe(a,n){let e=new Map;for(let t of n){let r=e.get(t.name);r?r.push(t):e.set(t.name,[t])}return a.map(t=>{if(!_(t.symbol)||!t.leaf)return t;let r=e.get(t.leaf);if(!r||r.length===0)return t;let i=r[0],o=Math.abs(i.startLine-t.startLine);for(let l=1;l<r.length;l+=1){let s=r[l],u=Math.abs(s.startLine-t.startLine);u<o&&(i=s,o=u)}return{...t,startLine:i.startLine,endLine:i.endLine}})}function fe(a,n,e){if(!_(e.symbol))return e.startLine;let t=Math.max(0,Math.min(e.startLine,a.length-1));if(!n)return t;let r=n.get(e.leaf);if(!r||r.length===0)return t;let i=null;for(let o of r){let l=Math.abs(o-e.startLine);(!i||l<i.distance)&&(i={line:o,distance:l})}return i?.line??t}function me(a){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,e=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,t=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,i=new Map,o=(l,s)=>{let u=i.get(l);if(!u){i.set(l,[s]);return}u[u.length-1]!==s&&u.push(s)};for(let l=0;l<a.length;l+=1){let s=a[l]??"";for(let c of s.matchAll(n))c[1]&&o(c[1],l);for(let c of s.matchAll(e))c[1]&&o(c[1],l);let u=s.match(t);u?.[1]&&o(u[1],l);for(let c of s.matchAll(r))c[1]&&o(c[1],l)}return i}function ge(a,n,e,t){let r=Math.max(e,Math.min(a.length-1,t)),i=Math.max(e,Math.min(r,n.endLine)),o=0,l=0,s=!1;for(let u=e;u<=r;u+=1){let c=be(a[u]??"");for(let d of c)d==="{"?(o+=1,s=!0):d==="}"?o=Math.max(0,o-1):d==="("?l+=1:d===")"&&(l=Math.max(0,l-1));if(s&&o===0||!s&&l===0&&u>=i)return u}return i}function be(a){let n="",e=null,t=!1;for(let r=0;r<a.length;r+=1){let i=a[r],o=a[r+1];if(!e&&i==="/"&&o==="/"){n+=" ".repeat(a.length-r);break}if(e){if(t){t=!1,n+=" ";continue}if(i==="\\"){t=!0,n+=" ";continue}i===e&&(e=null),n+=" ";continue}if(i==='"'||i==="'"||i==="`"){e=i,n+=" ";continue}n+=i}return n}function _(a){return a.includes("().")}function ye(a){let n=D(a);if("kind"in n)return null;for(let e=n.descriptors.length-2;e>=0;e--){let t=n.descriptors[e];if(t?.suffix==="type")return t.name}return null}export{b as a,he as b,I as c,m as d,Ce as e,h as f,J as g,L as h,Ie as i,Ne as j,se as k,we as l,S as m,$ as n,W as o,C as p,Fe as q,ue as r,Qe as s,$e as t,We as u};
84
+ //# sourceMappingURL=chunk-IYFZS4PV.js.map
@@ -0,0 +1,2 @@
1
+ import{b as e}from"./chunk-WTSTDJZ7.js";import{s as o}from"./chunk-IYFZS4PV.js";function l(t,r){let s=e(t,r);return o(t,s).map(({relativePath:a,...m})=>m)}export{l as a};
2
+ //# sourceMappingURL=chunk-JH3A7HTU.js.map
@@ -0,0 +1,2 @@
1
+ import{a as m}from"./chunk-LX4H4LLG.js";import{p as l}from"./chunk-IYFZS4PV.js";import{c as r,e as a}from"./chunk-TINPMWJK.js";import{basename as p}from"path";function M(t,c){let o=m(t,c);if(!o)return[];let s=r(o.symbol),i=l(t,o.relativePath).filter(e=>a(e.symbol)),n=i.filter(e=>e.parentTypeName===s||e.symbol.includes(s));return(n.length>0?n:f(p(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 f(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
2
+ //# sourceMappingURL=chunk-JS2RNIC7.js.map
@@ -0,0 +1,41 @@
1
+ import{e as a,f as c}from"./chunk-WCDXJGYT.js";import{q as d}from"./chunk-IYFZS4PV.js";import{b as l}from"./chunk-TINPMWJK.js";function E(e,t={}){let{limit:m=20,scope:s,minFanIn:n=2,minFanOut:f=2}=t,_=s?`AND def_d.relative_path LIKE '%${s}%'`:"",r=e.all(`SELECT * FROM (
2
+ SELECT
3
+ gs.symbol,
4
+ def_d.relative_path AS defined_in,
5
+ (SELECT COUNT(DISTINCT ref_c.document_id)
6
+ FROM mentions ref_m
7
+ JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
8
+ WHERE ref_m.symbol_id = gs.id AND ref_m.role != 1
9
+ ) AS fan_in,
10
+ (SELECT COUNT(DISTINCT ref_gs.id)
11
+ FROM mentions ref_m
12
+ JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
13
+ JOIN global_symbols ref_gs ON ref_m.symbol_id = ref_gs.id
14
+ JOIN (
15
+ SELECT m3.symbol_id, c3.document_id
16
+ FROM mentions m3
17
+ JOIN chunks c3 ON m3.chunk_id = c3.id
18
+ WHERE m3.role = 1
19
+ GROUP BY m3.symbol_id
20
+ ) ref_sym_def ON ref_sym_def.symbol_id = ref_gs.id
21
+ WHERE ref_c.document_id = def_d.id
22
+ AND ref_m.role != 1
23
+ AND ref_sym_def.document_id != def_d.id
24
+ ) AS fan_out
25
+ FROM global_symbols gs
26
+ JOIN (
27
+ SELECT m2.symbol_id, c2.document_id
28
+ FROM mentions m2
29
+ JOIN chunks c2 ON m2.chunk_id = c2.id
30
+ WHERE m2.role = 1
31
+ GROUP BY m2.symbol_id
32
+ ) sym_def ON sym_def.symbol_id = gs.id
33
+ JOIN documents def_d ON sym_def.document_id = def_d.id
34
+ WHERE 1 = 1
35
+ ${e.pathExclusionsFor("def_d")}
36
+ ${e.symbolNoiseFor("gs")}
37
+ ${_}
38
+ ) WHERE fan_in >= ? AND fan_out >= ?
39
+ ORDER BY (fan_in * fan_out) DESC
40
+ LIMIT ?`,n,f,m).filter(o=>!e.isIgnored(o.defined_in)).map(o=>({symbol:o.symbol,shortName:l(o.symbol),fanIn:o.fan_in,fanOut:o.fan_out,score:o.fan_in*o.fan_out,definedIn:o.defined_in}));return r.length>0?r:u(e,s,{minFanIn:n,minFanOut:f,limit:m})}function u(e,t,m){let{minFanIn:s,minFanOut:n,limit:f}=m;return d(e,{scope:t}).filter(i=>!e.isIgnored(i.relativePath)).map(i=>b(e,i)).filter(i=>i.fanIn>=s&&i.fanOut>=n).sort((i,r)=>r.score-i.score||r.fanIn-i.fanIn).slice(0,f)}function b(e,t){let m=new Set(c(e,t,{limit:500}).map(n=>n.file)).size,s=new Set(a(e,t,{limit:500}).filter(n=>n.file!==t.relativePath).map(n=>`${n.symbol}|${n.file}`)).size;return{symbol:t.symbol,shortName:l(t.symbol),fanIn:m,fanOut:s,score:m*s,definedIn:t.relativePath}}export{E as a};
41
+ //# sourceMappingURL=chunk-K5FQFCSN.js.map
@@ -0,0 +1,6 @@
1
+ import{a as w,b as h,d as A,e as j}from"./chunk-LORWXBOO.js";import{e as $,h as B}from"./chunk-WCDXJGYT.js";import{a as z}from"./chunk-LX4H4LLG.js";import{d as v,e as M,l as x,q as D,r as L}from"./chunk-IYFZS4PV.js";import{b,c as q,f as F}from"./chunk-TINPMWJK.js";function se(t,e,r={}){let{minSimilarity:s=.4,limit:l=20}=r,o=W(t,e);if(!o)return[];if(!F(o.symbol))return[];let n=_(t,o,s);return n.length>0?n.slice(0,l):K(t,e,{minSimilarity:s,limit:l})}function _(t,e,r){let s=T(t,{minCallees:3,excludeSymbol:e.symbol}),l=A([e,...s].map(n=>n.callees)),o=[];for(let n of s){if(n.callees.size<3)continue;let i=N(e,n,l,{minSimilarity:r,requireSignificantShared:1,requireSharedCount:0});i&&o.push(i)}return o.sort((n,i)=>i.similarity-n.similarity),o}function N(t,e,r,s){let{similarity:l,significantShared:o}=j(t.callees,e.callees,r);if(l<s.minSimilarity)return null;let n=w(t.callees,e.callees).size;if(o.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let i=o.length>0?o:[...w(t.callees,e.callees)];return{symbolA:t.symbol,shortNameA:b(t.symbol),fileA:t.file,symbolB:e.symbol,shortNameB:b(e.symbol),fileB:e.file,similarity:l,sharedCallees:i.map(b),uniqueToA:[...h(t.callees,e.callees)].map(b),uniqueToB:[...h(e.callees,t.callees)].map(b)}}function le(t,e={}){let{minSimilarity:r=.5,limit:s=20,scope:l,minCallees:o=4,crossFileOnly:n=!1}=e,i=T(t,{minCallees:o,scope:l}),c=A(i.map(a=>a.callees)),u=new Map;for(let a of i)for(let m of a.callees)u.set(m,(u.get(m)??0)+1);let f=Math.max(8,Math.ceil(Math.sqrt(i.length))),S=new Map;for(let a=0;a<i.length;a+=1)for(let m of i[a].callees){if((u.get(m)??0)>f)continue;let g=S.get(m);g||(g=[],S.set(m,g)),g.push(a)}let C=[],R=new Set;e:for(let a=0;a<i.length;a+=1){let m=i[a],g=new Set;for(let k of m.callees){let y=S.get(k);if(y)for(let p of y)p>a&&g.add(p)}for(let k of g){let y=`${a}|${k}`;if(R.has(y))continue;R.add(y);let p=i[k];if(n&&m.file===p.file)continue;if(m.paramCount>=0&&p.paramCount>=0){let O=Math.abs(m.paramCount-p.paramCount),Z=Math.max(2,Math.ceil(Math.max(m.paramCount,p.paramCount)*.5));if(O>Z)continue}let P=N(m,p,c,{minSimilarity:r,requireSignificantShared:2,requireSharedCount:4});if(P&&(C.push(P),C.length>s*5))break e}}return C.sort((a,m)=>m.similarity-a.similarity),C.slice(0,s)}function W(t,e){let r=z(t,e);if(!r)return null;let s=$(t,r);return{symbol:r.symbol,file:r.relativePath,callees:new Set(s.map(l=>l.symbol)),paramCount:x(t,r.relativePath,r.startLine,r.endLine)?.paramCount??-1}}function T(t,e){let{minCallees:r,scope:s,excludeSymbol:l}=e,o=L(t,s).filter(i=>!t.isIgnored(i.relativePath)).filter(i=>i.isFunctionLike).filter(i=>l===void 0||i.symbol!==l).filter(i=>i.endLine-i.startLine+1>=5).filter(i=>!M(t,i.relativePath,i.startLine)),n=B(t,o);return o.map(i=>({symbol:i.symbol,file:i.relativePath,callees:new Set((n.get(i.symbolId)??[]).map(c=>c.symbol)),paramCount:x(t,i.relativePath,i.startLine,i.endLine)?.paramCount??-1})).filter(i=>i.callees.size>=r)}function K(t,e,r){let s=U(t,e);if(!s||s.tokens.size<3)return[];let l=r.minSimilarity>=.5?r.minSimilarity:.3,o=[];for(let n of H(t)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let i=w(s.tokens,n.tokens);if(i.size<2)continue;let c=new Set([...s.tokens,...n.tokens]),u=c.size>0?i.size/c.size:0;u<l||o.push({symbolA:s.symbol,shortNameA:b(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:b(n.symbol),fileB:n.file,similarity:u,sharedCallees:[...i].sort(),uniqueToA:[...h(s.tokens,n.tokens)].sort(),uniqueToB:[...h(n.tokens,s.tokens)].sort()})}return o.sort((n,i)=>i.similarity-n.similarity||n.shortNameB.localeCompare(i.shortNameB)),o.slice(0,r.limit)}function U(t,e){let r=z(t,e);if(!r||!F(r.symbol))return null;let s=G(t,r);return s?{symbol:r.symbol,file:r.relativePath,tokens:s}:null}function G(t,e){let r=q(e.symbol),s=E(t,e.relativePath,e.startLine,e.endLine,r),l=I(s,r);return l.size>0?l:null}function H(t){return D(t).filter(e=>e.isFunctionLike).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:I(E(t,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function E(t,e,r,s,l){let o=v(t,e);if(!o)return"";let n=o.split(`
2
+ `);if(s>=r&&s-r<=12)return n.slice(r,s+1).join(`
3
+ `);let i=[new RegExp(`\\bdef\\s+${d(l)}\\b`),new RegExp(`\\bfun\\s+${d(l)}\\b`),new RegExp(`\\bfn\\s+${d(l)}\\b`),new RegExp(`\\bfunction\\s+${d(l)}\\b`),new RegExp(`\\b${d(l)}\\s*\\(`)],c=n.findIndex(u=>i.some(f=>f.test(u)));if(c>=0){let u=c;for(let f=c+1;f<n.length&&f<=c+8;f++){let S=n[f]??"";if(f>c&&Q(S)||(u=f,S.trim()===""&&f>c+1))break}return n.slice(c,u+1).join(`
4
+ `)}return n.slice(r,Math.min(n.length,r+8)).join(`
5
+ `)}function I(t,e){if(!t)return new Set;let r=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),s=J(e),o=t.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!r.has(n)).filter(n=>!s.has(n));return new Set(o)}function J(t){return new Set(t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(e=>e.toLowerCase()).filter(e=>e.length>1))}function Q(t){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(t)}function d(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{se as a,le as b};
6
+ //# sourceMappingURL=chunk-K6GBKEQE.js.map
@@ -0,0 +1,12 @@
1
+ import{c as M,d as O,e as T,f as j}from"./chunk-GNXRLK5G.js";import{a as L}from"./chunk-VEUMRDHW.js";import{a as I}from"./chunk-ZSRXMNMK.js";import{c as F}from"./chunk-WCDXJGYT.js";import{f as b,g as P,h as x,k,m as A,q as D}from"./chunk-IYFZS4PV.js";import{b as C,f as N,g as R}from"./chunk-TINPMWJK.js";var S=new WeakMap;function $(n,u){let r=b(u);return r==="rust"?G(n,u):r==="typescript"||r==="tsx"||r==="javascript"?J(n,u):[]}var U=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function J(n,u){let r=x(n,u);if(!r)return[];let d=S.get(r);if(d)return d;let o=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(u)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(u),c=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(u),f=!1,s=r.rootNode;for(let i of s.namedChildren){if(i.type!=="expression_statement")continue;let e=i.namedChild(0);if(!e||e.type!=="call_expression")continue;let a=e.namedChild(0);if(!a)continue;let l=a.type==="member_expression"?a.namedChild(a.namedChildCount-1)?.text:a.text;if(l&&U.has(l)){f=!0;break}}let m=[];f&&m.push({startLine:0,endLine:s.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(o||c)&&m.push({startLine:0,endLine:s.endPosition.row,reason:o?"Next.js / Remix route file":"Vite/Vue route component"});for(let i of s.namedChildren){let e=null,a=null;if(i.type==="function_declaration")e=i.namedChild(0)?.text??null,a=i;else if(i.type==="export_statement"){let l=i.namedChild(0);l?.type==="function_declaration"&&(e=l.namedChild(0)?.text??null,a=l)}else if(i.type==="lexical_declaration"){let l=i.namedChild(0);if(l?.type==="variable_declarator"){let h=l.namedChild(0)?.text,y=l.namedChild(1);h&&(y?.type==="arrow_function"||y?.type==="function_expression")&&(e=h,a=l)}}e&&/^use[A-Z]/.test(e)&&a&&m.push({startLine:a.startPosition.row,endLine:a.endPosition.row,reason:"React custom hook (use*)"})}return m.push(...W(r,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),S.set(r,m),m}var q=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function z(n){return q.test(n)}function W(n,u,r){let d=[],o=c=>{if(u.has(c.type)&&c.parent){let s=c.parent.children,m=-1;for(let i=0;i<s.length;i+=1)if(s[i].startIndex===c.startIndex&&s[i].type===c.type){m=i;break}if(m>0)for(let i=m-1;i>=0;i-=1){let e=s[i];if(r.has(e.type)){if(z(e.text)){d.push({startLine:c.startPosition.row,endLine:c.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(e.type==="attribute_item"||e.type==="inner_attribute_item"))break}}for(let f of c.namedChildren)o(f)};return o(n.rootNode),d}function G(n,u){let r=x(n,u);if(!r)return[];let d=S.get(r);if(d)return d;let o=[],c=e=>{let a=e.parent;if(!a)return[];let l=a.children,h=-1;for(let p=0;p<l.length;p+=1)if(l[p].startIndex===e.startIndex&&l[p].type===e.type){h=p;break}if(h<=0)return[];let y=[];for(let p=h-1;p>=0;p-=1){let g=l[p];if(g.type==="attribute_item"||g.type==="inner_attribute_item")y.push(g.text);else{if(g.type==="line_comment"||g.type==="block_comment")continue;break}}return y},f=e=>/#\[\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,s=e=>/#\[\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):!1,m=e=>/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e),i=(e,a,l)=>{let h=a,y=l;if(e.type==="impl_item"&&e.namedChildren.filter(g=>g.type==="type_identifier").length>=2&&(y=!0),e.type==="function_item"||e.type==="function_signature_item"){let p=c(e),g=null;l?g="trait impl method (dynamic dispatch)":a&&(g="inside #[cfg(test)] mod");for(let t of p){let _=f(t);if(_){g=_;break}if(m(t)){g="#[allow(dead_code)]";break}}g&&o.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:g})}else if(e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"){let p=c(e),g=p.some(s),t=p.some(m),_=e.namedChildren.find(E=>E.type==="type_identifier")?.text;g&&o.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:_}),t&&o.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:_}),a&&o.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:_})}else e.type==="mod_item"&&c(e).some(g=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(g))&&(h=!0);for(let p of e.namedChildren)i(p,h,y)};return i(r.rootNode,!1,!1),o.push(...W(r,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"]))),S.set(r,o),o}var K=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function H(n,u){return k(n,u,X,()=>new Set,(r,d,o)=>{if(!(d!=="typescript"&&d!=="tsx"&&d!=="javascript"))for(let c of r.rootNode.descendantsOfType("call_expression")){let f=c.namedChild(0);if(!f)continue;let s=A(f);if(!s||!K.has(s))continue;let m=c.namedChildren.find(a=>a.type==="arguments");if(!m)continue;let i=m.namedChild(0);if(!i||i.type!=="string")continue;let e=i.namedChildren.find(a=>a.type==="string_fragment");e&&o.add(e.text)}})??new Set}var X=new WeakMap;function fe(n,u={}){let{scope:r,minLoc:d=1,includeTests:o=!1,skipBarrels:c=!1,includeMembers:f=!1}=u,s=c?new Set(M(n)):new Set,m=n.all(`SELECT
2
+ m.symbol_id,
3
+ d.relative_path,
4
+ COUNT(*) AS ref_count
5
+ FROM mentions m
6
+ JOIN chunks c ON m.chunk_id = c.id
7
+ JOIN documents d ON c.document_id = d.id
8
+ WHERE m.role != 1
9
+ ${n.pathExclusionsFor("d")}
10
+ GROUP BY m.symbol_id, d.relative_path`),i=new Map;for(let t of m){if(n.isIgnored(t.relative_path)||s.has(t.relative_path))continue;let _=i.get(t.symbol_id);_||(_=new Map,i.set(t.symbol_id,_)),_.set(t.relative_path,t.ref_count)}Y(n,i,s);let e=Z(n),l=D(n,{scope:r}).filter(t=>!n.isIgnored(t.relativePath)).filter(t=>!R(t.symbol)).filter(t=>w(t.symbol)).filter(t=>t.isFunctionLike||!t.enclosingSymbol||!w(t.enclosingSymbol)).filter(t=>o||Q(t.relativePath)).filter(t=>o||!e(t.relativePath,t.startLine,t.parentTypeName)).filter(t=>f||w(t.symbol)).filter(t=>t.endLine-t.startLine+1>=d).map(t=>{let _=i.get(t.symbolId)??new Map,E=_.get(t.relativePath)??0,v=0;for(let[B,V]of _)B!==t.relativePath&&(v+=V);return{relative_path:t.relativePath,start_line:t.startLine,end_line:t.endLine,loc:t.endLine-t.startLine+1,symbol:t.symbol,same_file_refs:E,cross_file_refs:v}}).filter(t=>t.cross_file_refs===0).sort((t,_)=>_.loc-t.loc||t.relative_path.localeCompare(_.relative_path)||t.start_line-_.start_line),h=0,y=0,p=0,g=l.filter(t=>!n.isIgnored(t.relative_path)).filter(t=>!O(n,t.relative_path)).map(t=>{let _=t.same_file_refs===0?"dead-code":"file-internal";return _==="dead-code"?h++:y++,p+=t.loc,{relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line,loc:t.loc,symbol:t.symbol,shortName:C(t.symbol),sameFileRefs:t.same_file_refs,kind:_}});return{symbols:g,totalCount:g.length,deadCodeCount:h,fileInternalCount:y,totalLoc:p}}function Y(n,u,r){let d=n.all(`SELECT relative_path FROM documents
11
+ WHERE 1 = 1 ${n.pathExclusionsFor("documents")}`),o=new Set(d.map(s=>s.relative_path)),c=new Set(I(n));for(let s of o)c.add(s);let f=(s,m,i)=>{if(i<=0)return;let e=u.get(s);e||(e=new Map,u.set(s,e)),e.set(m,(e.get(m)??0)+i)};for(let s of c){if(!b(s)&&!P(s)||n.isIgnored(s)||r.has(s))continue;let m=F(n,s);for(let[e,a]of m){let l=L(n,s,e);if(l.length!==0)for(let h of l){let y=h.relativePath===s?Math.max(0,a.length-1):a.length;f(h.symbolId,s,y)}}let i=H(n,s);for(let e of i){let a=L(n,s,e);for(let l of a)l.relativePath!==s&&f(l.symbolId,s,1)}}}function Z(n){let u=new Map,r=d=>{let o=u.get(d);if(o)return o;let c=$(n,d);return o={ranges:c.map(f=>({startLine:f.startLine,endLine:f.endLine})),containers:new Set(c.map(f=>f.containerName).filter(f=>!!f))},u.set(d,o),o};return(d,o,c)=>{let f=r(d);for(let s of f.ranges)if(o>=s.startLine&&o<=s.endLine)return!0;return!!(c&&f.containers.has(c))}}function Q(n){return[...new Set([...T,...j])].every(r=>!ee(n,r))}function ee(n,u){return new RegExp(`^${u.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/%/g,".*").replace(/_/g,".")}$`).test(n)}function w(n){return N(n)||n.endsWith("().")||n.endsWith(".")}export{fe as a};
12
+ //# sourceMappingURL=chunk-KO7YJRWP.js.map
@@ -0,0 +1,4 @@
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-KYT47WU2.js.map
@@ -0,0 +1,2 @@
1
+ function m(n,e){let t=new Set;for(let r of n)e.has(r)&&t.add(r);return t}function M(n,e){let t=new Set;for(let r of n)e.has(r)||t.add(r);return t}function w(n,e){if(n.size===0&&e.size===0)return 0;let t=0;for(let o of n)e.has(o)&&(t+=1);let r=n.size+e.size-t;return r===0?0:t/r}function x(n){let e=n.length;if(e===0)return new Map;let t=new Map;for(let o of n)for(let s of o)t.set(s,(t.get(s)??0)+1);let r=new Map;for(let[o,s]of t)r.set(o,Math.log(e/s));return r}function p(n){let e=[...n.values()].sort((r,o)=>r-o);if(e.length===0)return 0;let t=Math.floor(e.length/2);return e.length%2===0?(e[t-1]+e[t])/2:e[t]}function v(n,e,t){let r=m(n,e);if(r.size===0)return{similarity:0,significantShared:[],trivialShared:[]};let o=0,s=0,T=0,l=new Set([...n,...e]);for(let i of l){let a=t.get(i)??0,f=n.has(i)?a:0,u=e.has(i)?a:0;o+=f*u,s+=f*f,T+=u*u}let h=Math.sqrt(s)*Math.sqrt(T),g=h>0?o/h:0,S=p(t),c=[],d=[];for(let i of r)(t.get(i)??0)>=S?c.push(i):d.push(i);return c.sort((i,a)=>(t.get(a)??0)-(t.get(i)??0)),{similarity:g,significantShared:c,trivialShared:d}}export{m as a,M as b,w as c,x as d,v as e};
2
+ //# sourceMappingURL=chunk-LORWXBOO.js.map
@@ -0,0 +1,89 @@
1
+ import{u as p}from"./chunk-IYFZS4PV.js";import{b as N,c as E,f as R,g as I}from"./chunk-TINPMWJK.js";function T(e,t){let n=v(e,t.trim());if(n)return n;let i=t.match(/^(.+):(\d+)-(\d+)$/);if(i){let[,c,_,h]=i,u=Math.max(0,parseInt(_,10)-1),f=Math.max(u,parseInt(h,10)-1),m=e.get(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path
2
+ FROM global_symbols gs
3
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
+ JOIN documents d ON der.document_id = d.id
5
+ WHERE d.relative_path LIKE ?
6
+ AND der.start_line <= ? AND der.end_line >= ?
7
+ ${e.pathExclusionsFor("d")}
8
+ ORDER BY (der.end_line - der.start_line) ASC
9
+ LIMIT 1`,`%${c}%`,u,f);if(m||(m=e.get(`SELECT gs.id, gs.symbol, c.document_id, MIN(c.start_line) AS start_line, MAX(c.end_line) AS end_line, d.relative_path
10
+ FROM global_symbols gs
11
+ JOIN mentions m ON m.symbol_id = gs.id
12
+ JOIN chunks c ON m.chunk_id = c.id
13
+ JOIN documents d ON c.document_id = d.id
14
+ WHERE m.role = 1
15
+ AND d.relative_path LIKE ?
16
+ AND c.start_line <= ? AND c.end_line >= ?
17
+ ${e.pathExclusionsFor("d")}
18
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
19
+ ORDER BY (MAX(c.end_line) - MIN(c.start_line)) ASC
20
+ LIMIT 1`,`%${c}%`,u,f)),m&&!e.isIgnored(m.relative_path))return p(e,m)}let d=M(t),o=w(t),l=$(e,o),a=x(l,t,d);if(a&&!e.isIgnored(a.relative_path))return p(e,a);let r=null;for(let c of l){if(e.isIgnored(c.relative_path))continue;let _=D(c,t,d,o);_<=0||(!r||_>r.score)&&(r={row:c,score:_})}return r?p(e,r.row):null}function v(e,t){let i=e.get(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path
21
+ FROM global_symbols gs
22
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
23
+ JOIN documents d ON der.document_id = d.id
24
+ WHERE gs.symbol = ?
25
+ ${e.pathExclusionsFor("d")}
26
+ ORDER BY d.relative_path, der.start_line
27
+ LIMIT 1`,t)??e.get(`SELECT
28
+ gs.id,
29
+ gs.symbol,
30
+ c.document_id,
31
+ MIN(c.start_line) AS start_line,
32
+ MAX(c.end_line) AS end_line,
33
+ d.relative_path
34
+ FROM global_symbols gs
35
+ JOIN mentions m ON m.symbol_id = gs.id
36
+ JOIN chunks c ON m.chunk_id = c.id
37
+ JOIN documents d ON c.document_id = d.id
38
+ WHERE gs.symbol = ?
39
+ AND m.role = 1
40
+ ${e.pathExclusionsFor("d")}
41
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
42
+ ORDER BY d.relative_path, start_line
43
+ LIMIT 1`,t);return!i||e.isIgnored(i.relative_path)?null:p(e,i)}function W(e,t){if("symbol"in t&&"relativePath"in t)return t;let n=A(e,t.symbolId)[0];return n?p(e,n):null}function A(e,t){let n=e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name
44
+ FROM global_symbols gs
45
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
46
+ JOIN documents d ON der.document_id = d.id
47
+ WHERE gs.id = ?
48
+ ORDER BY der.start_line, der.end_line`,t);return n.length>0?n:e.all(`SELECT
49
+ gs.id,
50
+ gs.symbol,
51
+ c.document_id,
52
+ MIN(c.start_line) AS start_line,
53
+ MAX(c.end_line) AS end_line,
54
+ d.relative_path,
55
+ gs.display_name
56
+ FROM global_symbols gs
57
+ JOIN mentions m ON m.symbol_id = gs.id
58
+ JOIN chunks c ON m.chunk_id = c.id
59
+ JOIN documents d ON c.document_id = d.id
60
+ WHERE gs.id = ?
61
+ AND m.role = 1
62
+ ${e.pathExclusionsFor("d")}
63
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name
64
+ ORDER BY start_line, end_line`,t)}function $(e,t){let n=t.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=t.flatMap(o=>{let l=`%${o}%`;return[l,l,l]}),d=e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name
65
+ FROM global_symbols gs
66
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
67
+ JOIN documents d ON der.document_id = d.id
68
+ WHERE ${n.join(`
69
+ AND `)}
70
+ ${e.pathExclusionsFor("d")}
71
+ LIMIT 200`,...i);return d.length>0?d:e.all(`SELECT
72
+ gs.id,
73
+ gs.symbol,
74
+ c.document_id,
75
+ MIN(c.start_line) AS start_line,
76
+ MAX(c.end_line) AS end_line,
77
+ d.relative_path,
78
+ gs.display_name
79
+ FROM global_symbols gs
80
+ JOIN mentions m ON m.symbol_id = gs.id
81
+ JOIN chunks c ON m.chunk_id = c.id
82
+ JOIN documents d ON c.document_id = d.id
83
+ WHERE m.role = 1
84
+ AND ${n.join(`
85
+ AND `)}
86
+ ${e.pathExclusionsFor("d")}
87
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name
88
+ LIMIT 200`,...i)}function D(e,t,n,i){let d=t.trim(),o=n,l=o.replace(/\(\)$/,""),a=t.toLowerCase(),r=n.toLowerCase(),c=r.replace(/\(\)$/,""),_=e.symbol,h=N(e.symbol),u=E(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),y=h.toLowerCase(),S=u.toLowerCase(),O=f.toLowerCase(),g=e.relative_path.toLowerCase(),L=/[/:.]/.test(n),s=0;return(_===d||_===o)&&(s+=1150),(h===d||h===o)&&(s+=1100),f===l&&(s+=980),u===l&&(s+=960),(`${u}()`===d||`${u}()`===o)&&(s+=955),(m===a||m===r)&&(s+=1e3),(y===a||y===r)&&(s+=950),(g===a||g===r)&&(s+=925),(g.endsWith(`/${r}`)||g.endsWith(`/${a}`))&&(s+=875),O===c&&(s+=850),S===c&&(s+=825),(`${S}()`===a||`${S}()`===r)&&(s+=820),(y.endsWith(`:${r}`)||y.endsWith(`:${c}`)||y.endsWith(`:${c}()`))&&(s+=800),m.includes(r)&&(s+=120),y.includes(r)&&(s+=140),g.includes(r)&&(s+=140),O.includes(r)&&(s+=110),i.every(C=>{let b=C.toLowerCase();return m.includes(b)||y.includes(b)||g.includes(b)||O.includes(b)})&&(s+=100+i.length*15),R(e.symbol)&&S===c&&(s+=60),!L&&I(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function M(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function w(e){let t=M(e),n=t.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return n.length>0?[...new Set(n)]:[t]}function x(e,t,n){let i=t.trim(),d=e.filter(o=>{let l=N(o.symbol),a=(o.display_name??"").trim();return o.symbol===i||l===i||l===n||a===i||a===n||`${a}()`===i||o.relative_path===i});return d.length===0?null:(d.sort((o,l)=>o.end_line-o.start_line-(l.end_line-l.start_line)||o.relative_path.localeCompare(l.relative_path)||o.symbol.localeCompare(l.symbol)),d[0]??null)}export{T as a,v as b,W as c};
89
+ //# sourceMappingURL=chunk-LX4H4LLG.js.map
@@ -0,0 +1,2 @@
1
+ function o(t){let e=t.get("SELECT COUNT(*) as c FROM documents").c,s=t.get("SELECT COUNT(*) as c FROM global_symbols").c,c=t.get("SELECT COUNT(*) as c FROM mentions WHERE role = 1").c,n=t.get("SELECT COUNT(*) as c FROM mentions WHERE role != 1").c;return{documents:e,symbols:s,definitions:c,references:n,indexSizeBytes:t.sizeBytes(),lastBuilt:t.lastModified()}}export{o as a};
2
+ //# sourceMappingURL=chunk-N3Z2SJCR.js.map
@@ -0,0 +1,25 @@
1
+ import{f as d}from"./chunk-WCDXJGYT.js";import{q as l}from"./chunk-IYFZS4PV.js";import{b as r}from"./chunk-TINPMWJK.js";function y(o,t={}){let{limit:s=30,scope:e}=t,n=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
2
+ gs.symbol,
3
+ COUNT(*) AS ref_count,
4
+ COUNT(DISTINCT ref_d.id) AS file_count,
5
+ def_d.relative_path AS defined_in
6
+ FROM mentions m
7
+ JOIN chunks c ON m.chunk_id = c.id
8
+ JOIN documents ref_d ON c.document_id = ref_d.id
9
+ JOIN global_symbols gs ON m.symbol_id = gs.id
10
+ JOIN (
11
+ SELECT m2.symbol_id, c2.document_id
12
+ FROM mentions m2
13
+ JOIN chunks c2 ON m2.chunk_id = c2.id
14
+ WHERE m2.role = 1
15
+ GROUP BY m2.symbol_id
16
+ ) sym_def ON sym_def.symbol_id = gs.id
17
+ JOIN documents def_d ON sym_def.document_id = def_d.id
18
+ WHERE m.role != 1
19
+ ${o.pathExclusionsFor("def_d")}
20
+ ${o.symbolNoiseFor("gs")}
21
+ ${n}
22
+ GROUP BY gs.id
23
+ ORDER BY ref_count DESC
24
+ LIMIT ?`,s).filter(i=>!o.isIgnored(i.defined_in)).map(i=>({symbol:i.symbol,shortName:r(i.symbol),refCount:i.ref_count,fileCount:i.file_count,definedIn:i.defined_in}));return m.length>0?m:f(o,e,s)}function f(o,t,s){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,n)=>n.refCount-e.refCount||n.fileCount-e.fileCount).slice(0,s)}function u(o,t){let s=d(o,t,{limit:500});return{symbol:t.symbol,shortName:r(t.symbol),refCount:s.length,fileCount:new Set(s.map(e=>e.file)).size,definedIn:t.relativePath}}export{y as a};
25
+ //# sourceMappingURL=chunk-NTDA4A2D.js.map
@@ -0,0 +1,24 @@
1
+ import{b as g}from"./chunk-TINPMWJK.js";import{execFileSync as r}from"child_process";function N(e,a={}){let{base:m="HEAD"}=a,o;try{o=b(e.config.projectRoot,m)}catch{return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:"Unable to compute git diff."}}}if(o.length===0)return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:"No changed files found."}};let i=[],n=[];for(let t of o){let s=e.get(`SELECT id, relative_path FROM documents
2
+ WHERE relative_path LIKE ?
3
+ LIMIT 1`,`%${t}`);s&&!e.isIgnored(s.relative_path)&&(i.push(s.relative_path),n.push(s.id))}if(n.length===0)return{changedFiles:o,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:o.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}};let u=n.map(()=>"?").join(","),p=e.all(`SELECT DISTINCT gs.id AS symbol_id, gs.symbol, d.relative_path
4
+ FROM mentions m
5
+ JOIN chunks c ON m.chunk_id = c.id
6
+ JOIN global_symbols gs ON m.symbol_id = gs.id
7
+ JOIN documents d ON c.document_id = d.id
8
+ WHERE m.role = 1
9
+ AND c.document_id IN (${u})
10
+ ${e.symbolNoiseFor("gs")}
11
+ ORDER BY d.relative_path`,...n),d=[],l=new Map;for(let t of p){let _=e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
12
+ FROM mentions m
13
+ JOIN chunks c ON m.chunk_id = c.id
14
+ WHERE m.symbol_id = ?
15
+ AND m.role != 1`,t.symbol_id)?.fan_in??0,h=g(t.symbol);d.push({symbol:t.symbol,shortName:h,file:t.relative_path,fanIn:_});let y=e.all(`SELECT DISTINCT ref_d.relative_path
16
+ FROM mentions m
17
+ JOIN chunks c ON m.chunk_id = c.id
18
+ JOIN documents ref_d ON c.document_id = ref_d.id
19
+ WHERE m.symbol_id = ?
20
+ AND m.role != 1
21
+ AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
22
+ ${e.pathExclusionsFor("ref_d")}`,t.symbol_id,...i);for(let c of y)e.isIgnored(c.relative_path)||(l.has(c.relative_path)||l.set(c.relative_path,new Set),l.get(c.relative_path).add(h))}let f=[...l.entries()].map(([t,s])=>({file:t,consumedSymbols:s.size})).sort((t,s)=>s.consumedSymbols-t.consumedSymbols);return{changedFiles:i,changedSymbols:d,affectedConsumers:f,summary:{totalChangedFiles:i.length,totalChangedSymbols:d.length,totalAffectedFiles:f.length}}}function b(e,a){let m=r("git",["diff","--name-only",a],{encoding:"utf-8",cwd:e,timeout:1e4}),o=r("git",["diff","--name-only","--cached",a],{encoding:"utf-8",cwd:e,timeout:1e4}),i=r("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([m,o,i].flatMap(n=>n.split(`
23
+ `)).map(n=>n.trim()).filter(n=>n.length>0))]}export{N as a};
24
+ //# sourceMappingURL=chunk-NXMYYHDO.js.map
@@ -0,0 +1,7 @@
1
+ import{b as m}from"./chunk-VEUMRDHW.js";import{g}from"./chunk-WCDXJGYT.js";import{a as R}from"./chunk-LX4H4LLG.js";import{d as h}from"./chunk-IYFZS4PV.js";import{f as u}from"./chunk-TINPMWJK.js";function $(t,a){let e=R(t,a);if(!e)return[];let i=!u(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),o=new Set,f=[];for(let n of[...i,...l,...c]){let p=`${n.relativePath}:${n.line}`;o.has(p)||(o.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 s=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 s){if(t.isIgnored(r.relative_path))continue;let l=h(t,r.relative_path);if(!l)continue;let c=l.split(`
6
+ `);for(let o=0;o<c.length;o++){let f=c[o]??"";e.some(n=>new RegExp(`@${n}\\b|\\b${n}:`).test(f))&&i.push({relativePath:r.relative_path,line:o})}}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,""),s=e.split("_").filter(Boolean),i=new Set;return e&&i.add(e),s.length>=1&&i.add(s[s.length-1]),s.length>=2&&i.add(s.slice(-2).join("_")),[...i]}export{$ as a};
7
+ //# sourceMappingURL=chunk-PZ6ESKRH.js.map
@@ -0,0 +1,6 @@
1
+ import{a as f}from"./chunk-WTSTDJZ7.js";import{a as p}from"./chunk-LX4H4LLG.js";import{b as g}from"./chunk-TINPMWJK.js";import{readFileSync as v}from"fs";import{join as d}from"path";function _(e,u,l={}){let{context:a=0}=l,r=u.match(/^(.+\.\w+):(\d+)-(\d+)$/);if(r)return y(e,r[1],parseInt(r[2],10),parseInt(r[3],10),a);let t=p(e,u);if(!t)return null;let n=e.get("SELECT language FROM documents WHERE relative_path = ?",t.relativePath),m=d(e.config.projectRoot,t.relativePath),o;try{o=v(m,"utf-8")}catch{return null}let i=o.split(`
2
+ `),s=Math.max(0,t.startLine-a),c=Math.min(i.length-1,t.endLine+a),h=i.slice(s,c+1).join(`
3
+ `);return{symbol:t.symbol,shortName:g(t.symbol),relativePath:t.relativePath,startLine:s,endLine:c,language:n?.language??null,source:h}}function y(e,u,l,a,r){let t=f(e,u);if(!t)return null;let n=e.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",t);if(!n)return null;let m=d(e.config.projectRoot,n.relative_path),o;try{o=v(m,"utf-8")}catch{return null}let i=o.split(`
4
+ `),s=Math.max(0,l-1-r),c=Math.min(i.length-1,a-1+r),h=i.slice(s,c+1).join(`
5
+ `);return{symbol:`${n.relative_path}:${l}-${a}`,shortName:`${n.relative_path}:${l}-${a}`,relativePath:n.relative_path,startLine:s,endLine:c,language:n.language,source:h}}export{_ as a};
6
+ //# sourceMappingURL=chunk-QXE6EDY2.js.map
@@ -0,0 +1,5 @@
1
+ import{c as I}from"./chunk-VEUMRDHW.js";import{j as A}from"./chunk-WCDXJGYT.js";import{d as M}from"./chunk-BQ3INTYT.js";import{a as P,d,e as x,f as F,h as w,j as D,r as C}from"./chunk-IYFZS4PV.js";import{b as L,c as b}from"./chunk-TINPMWJK.js";function te(t,n){let{scope:s,minLoc:i=3,limit:o=30,includeLowConfidence:a=!1}=n??{},c=k(t,s),r=C(t,s).filter(e=>e.isTypeLike&&T(e)>=i).filter(e=>!t.isIgnored(e.relativePath)).filter(e=>!x(t,e.relativePath,e.startLine)),l=A(t,r),u=I(t,r),f=G(l,u),g=new Map;for(let e of r){let m=g.get(e.relativePath);m||(m=new Map,g.set(e.relativePath,m));let p=b(e.symbol);p&&m.set(p,e)}return r.map(e=>{let p=[...f.get(e.symbolId)??new Set].filter(v=>v!==e.relativePath&&!t.isIgnored(v)),{realConsumers:h,barrelConsumers:S}=E(t,e.relativePath,e.symbol,p),_=$(t,e,f,g);return{definition:e,realConsumers:h,barrelConsumers:S,transitivelyReachable:_}}).filter(e=>!e.transitivelyReachable).filter(e=>e.realConsumers.length<=1).filter(e=>!(e.realConsumers.length===0&&e.barrelConsumers>0)).filter(e=>R(e.definition,e.realConsumers.length,c)).map(e=>{let m=B(t,e.definition.relativePath,e.definition.startLine),p=W(t,e.definition),{confidence:h,reason:S}=z(e.realConsumers.length,m,p);return{symbol:e.definition.symbol,shortName:L(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:T(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:m,definerUsesType:p,confidence:h,reason:S}}).filter(e=>a||e.confidence!=="low").sort((e,m)=>{let p={high:0,medium:1,low:2};return p[e.confidence]-p[m.confidence]||m.loc-e.loc||e.file.localeCompare(m.file)||e.startLine-m.startLine}).slice(0,o)}function k(t,n){return new Set(C(t,n).filter(s=>s.isFunctionLike).map(s=>s.relativePath))}function R(t,n,s){return!(((t.relativePath.split("/").pop()??"").includes("types")||t.relativePath.includes("/types/"))&&n>0||n===0&&s.has(t.relativePath))}function E(t,n,s,i){let o=[],a=0,c=b(s);for(let r of i)j(t,r,n,c)||U(t,r,c)?a++:o.push(r);return{realConsumers:o,barrelConsumers:a}}function $(t,n,s,i){let o=D(t,n.relativePath),a=b(n.symbol);if(!a)return!1;let c=o.get(a);if(!c||c.size===0)return!1;let r=i.get(n.relativePath);if(!r)return!1;for(let l of c){let u=r.get(l);if(!u)continue;let f=s.get(u.symbolId);if(f){for(let g of f)if(g!==n.relativePath&&!t.isIgnored(g))return!0}}return!1}var N=P("stale-abs-file-usage");function U(t,n,s){if(!s)return!1;let i=F(n);if(!i)return!1;let o=N.get(t,n,()=>O(t,n,i));return o.importedLeaves.has(s)&&!o.usedLeaves.has(s)}function O(t,n,s){let i=new Set,o=new Set,a=w(t,n);if(!a)return{importedLeaves:i,usedLeaves:o};let c=s==="rust"?new Set(["use_declaration"]):s==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),r=(l,u)=>{let f=u||c.has(l.type);(l.type==="identifier"||l.type==="type_identifier"||l.type==="property_identifier"||l.type==="field_identifier")&&(f?i.add(l.text):o.add(l.text));for(let g of l.children)r(g,f)};return r(a.rootNode,!1),{importedLeaves:i,usedLeaves:o}}function j(t,n,s,i){if(!i)return!1;let o=d(t,n);if(!o)return!1;let a=M(t,n);if(a.length===0)return!1;let c=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${c}\\b`),l=o.split(`
2
+ `),u=0;for(let f=0;f<l.length;f++){if(!r.test(l[f]??""))continue;if(u++,!a.find(y=>y.startLine<=f&&f<=y.endLine))return!1}return u>0}function B(t,n,s){let i=d(t,n);if(!i)return"other";let o=i.split(`
3
+ `),a=Math.max(0,s-2),c=Math.min(o.length-1,s+2);for(let r=a;r<=c;r++){let u=(o[r]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(u))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(u))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(u))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(u))return"enum"}return"other"}function W(t,n){let s=d(t,n.relativePath);if(!s)return!1;let i=b(n.symbol);if(!i)return!1;let o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${o}\\b`),c=s.split(`
4
+ `);for(let r=0;r<c.length;r++)if(!(r>=n.startLine&&r<=n.endLine)&&a.test(c[r]??""))return!0;return!1}function z(t,n,s){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&n==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!s?{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 T(t){return t.endLine-t.startLine+1}function G(...t){let n=new Map;for(let s of t)for(let[i,o]of s){let a=n.get(i);a||(a=new Set,n.set(i,a));for(let c of o)a.add(c)}return n}export{te as a};
5
+ //# sourceMappingURL=chunk-RJ7SPBJ5.js.map
@@ -0,0 +1,3 @@
1
+ import{a as f}from"./chunk-LX4H4LLG.js";import{a as g,b as m}from"./chunk-TINPMWJK.js";function S(n,d){let c=f(n,d);if(!c)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
2
+ WHERE id = ? LIMIT 1`,c.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,a=new Set([t.symbol]);for(;e&&!a.has(e)&&r<20;){a.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,p=1;s>=0;s--,p++){let h=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:h,shortName:h,depth:p})}return b}export{S as a};
3
+ //# sourceMappingURL=chunk-RWE6FHG3.js.map
@@ -0,0 +1,2 @@
1
+ import{q as p}from"./chunk-IYFZS4PV.js";import{a as d,b as f,d as u}from"./chunk-TINPMWJK.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function g(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function N(e,i,s={}){let{scope:n,limit:r=100}=s,o=g(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:y(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=y(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function y(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):M(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function M(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{N as a,P as b};
2
+ //# sourceMappingURL=chunk-SDX6MDBL.js.map
@@ -0,0 +1,2 @@
1
+ import{b as g}from"./chunk-VEUMRDHW.js";import{e as c,f as y,g as S}from"./chunk-WCDXJGYT.js";import{a}from"./chunk-LX4H4LLG.js";import{b as r}from"./chunk-TINPMWJK.js";function v(l,i){let o=a(l,i);if(!o)return null;let n=[{file:o.relativePath,line:o.startLine}],t=g(l,o),s=(t.length>0?t:S(l,o)).filter(e=>!l.isIgnored(e.file)).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?r(e.enclosingSymbol):"(top-level)"})),{producers:u,consumers:b}=p(l,o,s);return{symbol:o.symbol,shortName:r(o.symbol),relativePath:o.relativePath,definitionSites:n.filter(e=>!l.isIgnored(e.file)),usageSites:s,producers:u.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:r(e.symbol),file:e.file})),consumers:b.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":r(e.symbol),file:e.file}))}}function p(l,i,o){let n=m(c(l,i,{limit:30}).map(s=>({symbol:s.symbol,file:s.file}))),t=m(y(l,i,{limit:30})),f=t.length>0?t:m(o.map(s=>({symbol:s.enclosingSymbol==="(top-level)"?s.file:s.enclosingSymbol,file:s.file})));return{producers:n,consumers:f}}function m(l){let i=new Set,o=[];for(let n of l){let t=`${n.symbol}|${n.file}`;i.has(t)||(i.add(t),o.push(n))}return o}export{v as a};
2
+ //# sourceMappingURL=chunk-SG35Y7J2.js.map
@@ -0,0 +1,4 @@
1
+ import{b as S}from"./chunk-VEUMRDHW.js";import{g as d}from"./chunk-WCDXJGYT.js";import{a as g}from"./chunk-LX4H4LLG.js";import{d as u,n as m,o as f}from"./chunk-IYFZS4PV.js";import{b as s,f as a}from"./chunk-TINPMWJK.js";function _(n,o){let e=g(n,o);if(!e)return{definitions:[],referencedBy:[]};let i=n.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",e.symbolId),t=f(i?.documentation??null),c=n.isIgnored(e.relativePath)?[]:[{relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,signature:b(t,i?.display_name??null,e.symbol),source:y(n,e.relativePath,e.startLine,e.endLine)}],l=S(n,e),p=(l.length>0?l:d(n,e)).filter(r=>!n.isIgnored(r.file)).map(r=>({relativePath:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol,enclosingShort:r.enclosingSymbol?s(r.enclosingSymbol):"(top-level)"}));return{definitions:c,referencedBy:p}}function y(n,o,e,i){let t=u(n,o);if(!t)return null;let l=t.split(`
2
+ `).slice(e,i+1).join(`
3
+ `).trimEnd();return l.length>0?l:null}function b(n,o,e){let i=m(n);if(i&&!h(i))return i;let t=(o??"").trim();return t?a(e)&&!t.endsWith("()")?`${t}()`:t:s(e)}function h(n){return n.startsWith("undefined")||n.includes("|")||n.includes("```")}export{_ as a};
4
+ //# sourceMappingURL=chunk-STOGKRJH.js.map
@@ -0,0 +1,2 @@
1
+ var m={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function f(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let r=e.split(" ");if(r.length<4)return{scheme:r[0]??"",manager:r[1]??"",packageName:r[2]??"",version:"",descriptors:[],raw:e};let s=r[0],i=r[1],n=e.slice(s.length+1+i.length+1),t;if(n.startsWith("`")){let a=n.indexOf("`",1);a===-1?(t=n.slice(1),n=""):(t=n.slice(1,a),n=n.slice(a+2))}else{let a=n.indexOf(" ");a===-1?(t=n,n=""):(t=n.slice(0,a),n=n.slice(a+1))}let c,o=n.indexOf(" ");o===-1?(c=n,n=""):(c=n.slice(0,o),n=n.slice(o+1));let l=u(n);return{scheme:s,manager:i,packageName:t,version:c,descriptors:l,raw:e}}function u(e){let r=[],s=0;for(;s<e.length;){if(e[s]==="["){let t=e.indexOf("]",s+1);if(t===-1){r.push({name:e.slice(s+1),suffix:"type-param"});break}r.push({name:e.slice(s+1,t),suffix:"type-param"}),s=t+1;continue}if(e[s]==="("&&(r.length===0||s===0||d(e[s-1]))){let t=e.indexOf(")",s+1);if(t!==-1&&e[t+1]!=="."){r.push({name:e.slice(s+1,t),suffix:"parameter"}),s=t+1;continue}}let i;if(e[s]==="`"){let t=e.indexOf("`",s+1);if(t===-1){i=e.slice(s+1),r.push({name:i,suffix:"term"});break}i=e.slice(s+1,t),s=t+1}else{let t=s;for(;s<e.length&&!d(e[s]);)s++;i=e.slice(t,s)}if(s>=e.length){i&&r.push({name:i,suffix:"term"});break}let n=e[s];if(n==="("){let t=e.indexOf(")",s+1);t!==-1&&e[t+1]==="."?(r.push({name:i,suffix:"method"}),s=t+2):t!==-1?(r.push({name:i,suffix:"method"}),s=t+1):(r.push({name:i,suffix:"term"}),s++)}else{let t=m[n];t&&r.push({name:i,suffix:t}),s+=1}}return r}function d(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function h(e){let r=f(e);if("kind"in r&&r.kind==="local")return`local:${r.id}`;let s=r;if(s.descriptors.length===0)return s.raw;let i=[];for(let n of s.descriptors){let t=n.name;n.suffix==="namespace"&&(t=t.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)$/,"")),t&&(n.suffix==="method"?i.push(`${t}()`):i.push(t))}return i.join(":")}function g(e){let r=f(e);if("kind"in r&&r.kind==="local")return r.id;let s=r;return s.descriptors.length===0?"":s.descriptors[s.descriptors.length-1].name}function p(e){let r=f(e);if("kind"in r&&r.kind==="local")return null;let s=r;return s.descriptors[s.descriptors.length-1]?.suffix??null}function x(e){return e.endsWith("().")||p(e)==="method"}function S(e){let r=p(e);return r==="method"||r==="term"}function b(e){return p(e)==="namespace"}function y(e,r){let s=f(e),i=f(r);if("kind"in s||"kind"in i)return!1;let n=s.descriptors,t=i.descriptors;if(t.length!==n.length+1)return!1;for(let c=0;c<n.length;c++){let o=n[c],l=t[c];if(o.name!==l.name||o.suffix!==l.suffix)return!1}return!0}function k(e,r){let s=f(e),i=f(r);if("kind"in s||"kind"in i)return!1;let n=s.descriptors,t=i.descriptors;if(t.length<=n.length)return!1;for(let c=0;c<n.length;c++){let o=n[c],l=t[c];if(o.name!==l.name||o.suffix!==l.suffix)return!1}return!0}export{f as a,h as b,g as c,p as d,x as e,S as f,b as g,y as h,k as i};
2
+ //# sourceMappingURL=chunk-TINPMWJK.js.map
@@ -0,0 +1,2 @@
1
+ import{a as z}from"./chunk-5IADAU5B.js";import{b as B}from"./chunk-K6GBKEQE.js";import{a as E}from"./chunk-RJ7SPBJ5.js";import{a as H}from"./chunk-N3Z2SJCR.js";import{a as A}from"./chunk-7Z4COVMC.js";import{a as W}from"./chunk-7VOF4ZG6.js";import{a as V}from"./chunk-7754WFFV.js";import{a as I}from"./chunk-F2LLHRRZ.js";import{a as k}from"./chunk-EEF3YEHW.js";import{a as j}from"./chunk-KO7YJRWP.js";import{d as y}from"./chunk-GNXRLK5G.js";import{a as q}from"./chunk-Y7H6D2EV.js";function ut(e,F={}){let{scope:r}=F,a=H(e),N=j(e,{scope:r,minLoc:3,skipBarrels:!0}),x=A(e,{scope:r,minLoc:3}),b=k(e,{scope:r}),T=B(e,{scope:r,minSimilarity:.6,limit:50,minCallees:4}),m=I(e,{scope:r,minLoc:15,minCallees:5,limit:50}),c=z(e,{scope:r,maxLoc:15,limit:50}),l=W(e,{scope:r,maxLoc:15,limit:50}),R=E(e,{scope:r,minLoc:3,limit:50}),n=V(e,{scope:r}),v=q(e,{scope:r,minLoc:10,limit:10}),S=N.symbols.filter(t=>!y(e,t.relativePath)&&t.kind==="dead-code"),u=S.length,$=S.reduce((t,o)=>t+o.loc,0),h=x.filter(t=>!y(e,t.relativePath)).length,p=R.length,M=n.results.length,d=T.length,s=[];u>0&&s.push({category:"Dead code",description:`${u} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:u,locRecoverable:$}),h>0&&s.push({category:"Isolated symbols",description:`${h} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:h,locRecoverable:x.filter(t=>!y(e,t.relativePath)).reduce((t,o)=>t+o.loc,0)});let C=b.filter(t=>t.kind==="real");if(C.length>0&&s.push({category:"Circular dependencies",description:`${C.length} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:C.length,locRecoverable:0}),d>0&&s.push({category:"Similar functions",description:`${d} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:d,locRecoverable:0}),m.length>0&&s.push({category:"Extraction candidates",description:`${m.length} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:m.length,locRecoverable:0}),c.length>0&&s.push({category:"Wrapper functions",description:`${c.length} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:c.length,locRecoverable:c.reduce((t,o)=>t+o.loc,0)}),l.length>0&&s.push({category:"Passthrough functions",description:`${l.length} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:l.length,locRecoverable:l.reduce((t,o)=>t+o.loc,0)}),p>0){let t=R.filter(w=>w.consumers===0).length,o=p-t,g=[];t>0&&g.push(`${t} unused`),o>0&&g.push(`${o} single-consumer (not in types file)`),s.push({category:"Stale abstractions",description:`${g.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:p,locRecoverable:R.reduce((w,Z)=>w+Z.loc,0)})}if(M>0){let t=[];n.unusedImports>0&&t.push(`${n.unusedImports} unused imports`),n.layerViolations>0&&t.push(`${n.layerViolations} layer violations`),n.patternDeviations>0&&t.push(`${n.patternDeviations} unique deps`),s.push({category:"Structural drift",description:t.join(", "),effort:n.layerViolations>0?"medium":"low",impact:n.layerViolations>0?"medium":"low",count:M,locRecoverable:0})}let P={high:3,medium:2,low:1},L={low:3,medium:2,high:1};s.sort((t,o)=>{let g=P[t.impact]*L[t.effort];return P[o.impact]*L[o.effort]-g});let U=Math.max(a.documents,1),f=Math.max(a.symbols,1),i=100,G=u/f;i-=Math.min(20,Math.round(G*200));let J=h/f;i-=Math.min(10,Math.round(J*200));let D=b.filter(t=>t.kind==="real").length;i-=Math.min(15,D*5);let K=d/f*1e3;i-=Math.min(10,Math.round(K));let O=m.length/f*1e3;i-=Math.min(5,Math.round(O/2)),i-=Math.min(3,c.length),i-=Math.min(3,l.length);let Q=p/Math.max(f*.1,1);i-=Math.min(8,Math.round(Q*10));let X=M/U;i-=Math.min(5,Math.round(X*50));let Y=v.filter(t=>t.score>50).length;return i-=Math.min(5,Y*2),i=Math.max(0,Math.min(100,i)),{score:i,overview:{documents:a.documents,symbols:a.symbols,indexSizeBytes:a.indexSizeBytes},findings:{deadSymbols:u,deadLoc:$,isolatedSymbols:h,isolatedLoc:x.filter(t=>!y(e,t.relativePath)).reduce((t,o)=>t+o.loc,0),cycles:D,similarPairs:d,extractionCandidates:m.length,wrappers:c.length,passthroughs:l.length,staleTypes:p,driftedFiles:M,complexityHotspotCount:v.length},actions:s,topComplexity:v.slice(0,5).map(t=>({symbol:t.shortName,score:t.score}))}}export{ut as a};
2
+ //# sourceMappingURL=chunk-UJB62HV3.js.map
@@ -0,0 +1,2 @@
1
+ import{a as u}from"./chunk-ZSRXMNMK.js";import{a as y,b as h,i as x}from"./chunk-WCDXJGYT.js";import{e as I}from"./chunk-BQ3INTYT.js";import{c as S}from"./chunk-LX4H4LLG.js";import{d,p as g,t as b}from"./chunk-IYFZS4PV.js";import{c as p}from"./chunk-TINPMWJK.js";function w(o,c,n){let t=x(o).get(n);if(!t||t.length===0)return[];if(t.length===1)return[l(t[0])];let s=t.find(f=>f.file===c);if(s)return[l(s)];let e=D(o,c),i=e.get(n);if(i)for(let f of i){let r=t.filter(m=>R(f,m.file));if(r.length>0)return r.map(l)}let a=new Set;for(let f of e.values())for(let r of f)a.add(r);for(let f of a){let r=t.filter(m=>R(f,m.file));if(r.length>0&&r.length===t.length)return r.map(l)}return[]}function j(o,c){let n=S(o,c);if(!n)return[];let t=p(n.symbol);if(!t)return[];let s=new Map;for(let e of u(o)){let i=d(o,e);if(!i||i.indexOf(t)===-1||e!==n.relativePath&&!w(o,e,t).some(r=>r.symbolId===n.symbolId))continue;let a=y(o,e,t,e===n.relativePath?{excludeStartLine:n.startLine,excludeEndLine:n.endLine}:{});a.length>0&&s.set(e,a)}return F(o,s)}function C(o,c){let n=new Map;for(let e of c){if(!e.leaf)continue;let i=n.get(e.leaf)??[];i.push(e),n.set(e.leaf,i)}if(n.size===0)return new Map;let t=new Set(c.map(e=>e.symbolId)),s=new Map;for(let e of u(o)){let i=h(o,e);if(i.size!==0){for(let a of i)if(n.has(a))for(let f of w(o,e,a)){if(!t.has(f.symbolId)||e===f.relativePath)continue;let r=s.get(f.symbolId);r||(r=new Set,s.set(f.symbolId,r)),r.add(e)}}}return s}function D(o,c){let n=new Map;for(let t of I(o,c)){if(!t.sourcePath)continue;let s=t.localName??t.importedName;if(s){let e=n.get(s);e||(e=new Set,n.set(s,e)),e.add(t.sourcePath)}if(t.kind==="namespace")for(let e of t.usedMembers){let i=n.get(e);i||(i=new Set,n.set(e,i)),i.add(t.sourcePath)}}return n}function R(o,c){let n=t=>t.replace(/\\/g,"/").replace(/^\.\//,"");return n(o)===n(c)}function l(o){return{symbolId:o.symbolId,symbol:o.symbol,relativePath:o.file}}function F(o,c){let n=[],t=new Set;for(let[s,e]of c){let i=g(o,s);for(let a of e){let f=b(i,a),r=`${s}|${a}|${f?.symbol??""}`;t.has(r)||(t.add(r),n.push({file:s,line:a,enclosingSymbol:f?.symbol??null}))}}return n}export{w as a,j as b,C as c};
2
+ //# sourceMappingURL=chunk-VEUMRDHW.js.map
@@ -0,0 +1,65 @@
1
+ import{a as v,b as D,c as F,e as T}from"./chunk-BQ3INTYT.js";import{c as C}from"./chunk-LX4H4LLG.js";import{a as h,b as R,d as M,f as _,h as k,i as L,p as N,q as A,t as x}from"./chunk-IYFZS4PV.js";import{c as I}from"./chunk-TINPMWJK.js";function J(n,i,o,a={}){if(!o)return[];let l=M(n,i);if(!l)return[];if(l.indexOf(o)===-1)return[];if(_(i))return(w(n,i).get(o)??[]).filter(d=>!$(d,a));let s=D(n,i,l),r=new RegExp(`\\b${F(o)}\\b`),e=[];for(let c=0;c<s.length;c++)$(c,a)||r.test(s[c]??"")&&e.push(c);return e}function $(n,i){return typeof i.excludeStartLine=="number"&&typeof i.excludeEndLine=="number"&&n>=i.excludeStartLine&&n<=i.excludeEndLine}var G=h("file-identifiers");function re(n,i){return G.get(n,i,()=>new Set(w(n,i).keys()))}var Y=h("file-ident-lines");function w(n,i){return Y.get(n,i,()=>z(n,i))}var j=h("file-idents-by-line");function H(n,i){return j.get(n,i,()=>{let o=w(n,i),a=0;for(let s of o.values()){let r=s[s.length-1];r!==void 0&&r>a&&(a=r)}let l=new Array(a+1);for(let s=0;s<=a;s+=1)l[s]=new Set;for(let[s,r]of o)for(let e of r)l[e].add(s);return l})}function z(n,i){let o=new Map,a=(e,c)=>{let t=o.get(e);if(!t){o.set(e,[c]);return}t[t.length-1]!==c&&t.push(c)};if(_(i)){let e=k(n,i);if(e){let c=_(i),t=c==="rust"?new Set(["identifier","type_identifier","field_identifier"]):c==="python"?new Set(["identifier"]):new Set(["identifier","property_identifier","type_identifier"]),d=new Set(["rust","python"]),g=/\{(?:\?\s*)?([A-Za-z_][\w]*)/g,u=m=>{if(t.has(m.type)&&a(m.text,m.startPosition.row),c&&d.has(c)&&m.type==="string_content"){let b=m.startPosition.row;for(let f of m.text.matchAll(g))f[1]&&a(f[1],b)}for(let b of m.children)u(b)};return u(e.rootNode),o}}let l=M(n,i);if(!l)return o;let s=v(l).split(/\r?\n/),r=/\b([A-Za-z_$][\w$]*)\b/g;for(let e=0;e<s.length;e+=1){let c=s[e]??"";for(let t of c.matchAll(r))t[1]&&a(t[1],e)}return o}var K=h("file-dep-graph");function be(n,i){return K.get(n,i??"",()=>{let o=i?`AND d1.relative_path LIKE '%${i}%'`:"",a=n.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
+ ${n.pathExclusionsFor("d1","d2")}
19
+ ${o}`),l=new Map,s=new Set(n.all(`SELECT relative_path
20
+ FROM documents
21
+ WHERE 1 = 1
22
+ ${n.pathExclusionsFor("documents")}
23
+ ORDER BY relative_path`).map(e=>e.relative_path).filter(e=>!n.isIgnored(e))),r=(e,c)=>{e!==c&&(n.isIgnored(e)||n.isIgnored(c)||s.has(c)&&(l.has(e)||l.set(e,new Set),l.get(e).add(c)))};for(let e of a)r(e.from_file,e.to_file);for(let e of s)if(!(i&&!e.includes(i)))for(let c of T(n,e))c.sourcePath&&r(e,c.sourcePath);return l})}function pe(n,i,o={}){let l=P(n,[i]).get(i.symbolId)??[];return typeof o.limit=="number"?l.slice(0,o.limit):l}function _e(n,i,o={}){let l=Z(n).get(i.symbolId)??[];return typeof o.limit=="number"?l.slice(0,o.limit):l}var U=R("caller-rows");function Z(n){return U.get(n,()=>{let i=A(n),o=P(n,i),a=new Map;for(let r of i)a.set(r.symbol,r.symbolId);let l=new Map,s=new Map;for(let r of i){let e=o.get(r.symbolId);if(!(!e||e.length===0))for(let c of e){let t=a.get(c.symbol);if(t===void 0||t===r.symbolId)continue;let d=l.get(t);d||(d=[],l.set(t,d),s.set(t,new Set));let g=`${r.symbol}|${r.relativePath}`;s.get(t).has(g)||(s.get(t).add(g),d.push({symbol:r.symbol,file:r.relativePath}))}}return l})}function ye(n,i){let o=X(n,i);return o?q(n,V(n,o.match,o.identifier)):[]}function V(n,i,o){let a=n.all(`SELECT DISTINCT d.relative_path, c.start_line, c.end_line
24
+ FROM mentions m
25
+ JOIN chunks c ON m.chunk_id = c.id
26
+ JOIN documents d ON c.document_id = d.id
27
+ WHERE m.symbol_id = ?
28
+ AND m.role != 1
29
+ ${n.pathExclusionsFor("d")}
30
+ ORDER BY d.relative_path, c.start_line`,i.symbolId),l=new Map;for(let r of a){if(n.isIgnored(r.relative_path))continue;let e=l.get(r.relative_path);e||(e=[],l.set(r.relative_path,e)),e.push({start_line:r.start_line,end_line:r.end_line})}let s=new Map;for(let[r,e]of l){let c=r===i.relativePath?{excludeStartLine:i.startLine,excludeEndLine:i.endLine}:{},t=o?J(n,r,o,c):[],d=[];for(let g of e){let u=t.filter(b=>b>=g.start_line&&b<=g.end_line),m=u.length>0?u:[g.start_line];for(let b of m)d.push(b)}s.set(r,d)}return s}function X(n,i){let o=C(n,i);return o?{match:o,identifier:I(o.symbol)||null}:null}function q(n,i){let o=[],a=new Set;for(let[l,s]of i){let r=N(n,l);for(let e of s){let c=x(r,e),t=`${l}|${e}|${c?.symbol??""}`;a.has(t)||(a.add(t),o.push({file:l,line:e,enclosingSymbol:c?.symbol??null}))}}return o}function P(n,i,o={}){if(i.length===0)return new Map;let a=o.additive??!1,l=[],s=[];for(let t of i)_(t.relativePath)&&L(n,t.relativePath)!==null?l.push(t):s.push(t);let r=new Map,e=t=>{for(let[d,g]of t){let u=r.get(d);u||(u=[],r.set(d,u));let m=new Set(u.map(b=>`${b.symbol}|${b.chunkId}`));for(let b of g){let f=`${b.symbol}|${b.chunkId}`;m.has(f)||(m.add(f),u.push(b))}}};l.length>0&&e(Q(n,l));let c=a?i:s;return c.length>0&&e(ne(n,c)),r}function Q(n,i){let o=new Map,a=new Map;for(let s of i){let r=a.get(s.relativePath);r?r.push(s):a.set(s.relativePath,[s]),o.set(s.symbolId,[])}let l=B(n);for(let[s,r]of a){let e=L(n,s);if(!e)continue;let c=[...r].sort((t,d)=>{let g=t.endLine-t.startLine,u=d.endLine-d.startLine;return g-u});for(let t of e){let d=null;for(let f of c)if(t.line>=f.startLine&&t.line<=f.endLine){d=f;break}if(!d)continue;let g=l.get(t.calleeLeaf);if(!g||g.length===0)continue;let u=null,m=g.find(f=>f.file===s);if(m?u=m:g.length===1&&(u=g[0]),!u||u.symbol===d.symbol)continue;o.get(d.symbolId).push({symbol:u.symbol,file:u.file,chunkId:t.line})}}return o}var ee=R("global-leaf-index");function B(n){return ee.get(n,()=>{let i=n.all(`SELECT gs.id, gs.symbol,
31
+ COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
32
+ FROM global_symbols gs
33
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
34
+ LEFT JOIN documents der_doc ON der_doc.id = der.document_id
35
+ LEFT JOIN (
36
+ SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
37
+ FROM mentions m
38
+ JOIN chunks c ON m.chunk_id = c.id
39
+ JOIN documents d ON c.document_id = d.id
40
+ WHERE m.role = 1
41
+ GROUP BY m.symbol_id
42
+ ) mention_doc ON mention_doc.symbol_id = gs.id
43
+ WHERE 1 = 1
44
+ ${n.symbolNoiseFor("gs")}`),o=new Map;for(let a of i){if(!a.relative_path||n.isIgnored(a.relative_path))continue;let l=I(a.symbol);if(!l)continue;let s=o.get(l);s||(s=[],o.set(l,s)),s.some(r=>r.symbolId===a.id)||s.push({symbol:a.symbol,symbolId:a.id,file:a.relative_path})}return o})}function ne(n,i){if(i.length===0)return new Map;let o=n.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
45
+ FROM mentions m
46
+ JOIN chunks c ON m.chunk_id = c.id
47
+ WHERE m.role != 1`),a=new Map;for(let t of o)a.has(t.document_id)||a.set(t.document_id,[]),a.get(t.document_id).push(t);let l=new Map(n.all("SELECT id, relative_path FROM documents").map(t=>[t.id,t.relative_path])),s=new Map,r=n.all(`SELECT gs.id AS symbol_id, gs.symbol,
48
+ COALESCE(der.document_id, def_chunk.document_id) AS document_id
49
+ FROM global_symbols gs
50
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
51
+ LEFT JOIN (
52
+ SELECT m.symbol_id, MIN(c.document_id) AS document_id
53
+ FROM mentions m
54
+ JOIN chunks c ON m.chunk_id = c.id
55
+ WHERE m.role = 1
56
+ GROUP BY m.symbol_id
57
+ ) def_chunk ON def_chunk.symbol_id = gs.id`);for(let t of r)s.has(t.symbol_id)||s.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?l.get(t.document_id)??"":""});let e=new Map,c=l;for(let t of i){let d=a.get(t.documentId)??[],g=new Set,u=[],m=null,b=()=>{if(m)return m;let f=c.get(t.documentId)??"",p=new Set;if(f){let E=H(n,f),S=Math.max(0,t.startLine),O=Math.min(E.length-1,t.endLine);for(let y=S;y<=O;y+=1)for(let W of E[y])p.add(W)}return m=p,p};for(let f of d){if(f.symbol_id===t.symbolId)continue;let p=s.get(f.symbol_id);if(!p)continue;if(!(f.start_line>=t.startLine&&f.end_line<=t.endLine)){if(!(f.start_line<=t.endLine&&f.end_line>=t.startLine))continue;let y=I(p.symbol);if(!y||!b().has(y))continue}let S=`${p.symbol}|${f.chunk_id}`;g.has(S)||(g.add(S),u.push({...p,chunkId:f.chunk_id}))}e.set(t.symbolId,u)}return e}function he(n,i){let o=new Map,a=n.all(`SELECT relative_path FROM documents
58
+ WHERE 1 = 1 ${n.pathExclusionsFor("documents")}`),l=B(n);for(let e of a){if(!_(e.relative_path)||n.isIgnored(e.relative_path))continue;let c=L(n,e.relative_path);if(c)for(let t of c){let d=l.get(t.calleeLeaf);if(!d||d.length===0)continue;let u=d.find(b=>b.file===e.relative_path)??(d.length===1?d[0]:null);if(!u||u.file===e.relative_path)continue;let m=o.get(u.symbolId);m||(m=new Set,o.set(u.symbolId,m)),m.add(e.relative_path)}}let s=n.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
59
+ c.start_line AS chunk_start, c.end_line AS chunk_end
60
+ FROM mentions m
61
+ JOIN chunks c ON m.chunk_id = c.id
62
+ JOIN documents d ON c.document_id = d.id
63
+ WHERE m.role != 1
64
+ ${n.pathExclusionsFor("d")}`),r=new Map;if(i)for(let e of i)r.set(e.symbolId,{docId:e.documentId,startLine:e.startLine,endLine:e.endLine});for(let e of s){if(n.isIgnored(e.relative_path))continue;let c=r.get(e.symbol_id);if(c&&c.docId===e.document_id&&e.chunk_start>=c.startLine&&e.chunk_end<=c.endLine)continue;let t=o.get(e.symbol_id);t||(t=new Set,o.set(e.symbol_id,t)),t.add(e.relative_path)}return o}export{J as a,re as b,w as c,be as d,pe as e,_e as f,ye as g,P as h,B as i,he as j};
65
+ //# sourceMappingURL=chunk-WCDXJGYT.js.map
@@ -0,0 +1,6 @@
1
+ import{a as c}from"./chunk-LX4H4LLG.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as f,join as g}from"path";function S(e,r){let t=u(e,r,{allowMultiple:!1})[0]?.relativePath;return t||v(e,r)}function M(e,r){return u(e,r,{allowMultiple:!0}).map(t=>t.relativePath)}function v(e,r){if(!r)return null;let t=r.replace(/\\/g,"/").replace(/^\.\//,""),a=f(t)&&t.startsWith(e.config.projectRoot)?t.slice(e.config.projectRoot.length).replace(/^\/+/,""):t,n=g(e.config.projectRoot,a);return m(n)?a:null}function u(e,r,t){let a=h(r);if(!a)return[];let i=e.all(`SELECT relative_path
2
+ FROM documents
3
+ WHERE 1 = 1
4
+ ${e.pathExclusionsFor("documents")}
5
+ ORDER BY relative_path`).filter(o=>!e.isIgnored(o.relative_path)).map(o=>({relativePath:o.relative_path,score:d(o.relative_path,a)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=c(e,r);return!o||e.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let s=i.filter(o=>o.score>=800);return s.length>0?t.allowMultiple?s:[s[0]]:t.allowMultiple?i:[i[0]]}function d(e,r){let t=h(e),a=p(t),n=p(r),i=0;return t===r&&(i+=1200),t.endsWith(`/${r}`)&&(i+=1100),a===n&&(i+=900),t.startsWith(`${r}/`)&&(i+=850),t.includes(r)&&(i+=250),i}function h(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,M as b};
6
+ //# sourceMappingURL=chunk-WTSTDJZ7.js.map
@@ -0,0 +1,2 @@
1
+ import{d,q as b}from"./chunk-IYFZS4PV.js";import{b as g}from"./chunk-TINPMWJK.js";function I(n,e={}){let{scope:i,minLoc:u=1,limit:l}=e,p=new Map;for(let t of b(n,{scope:i})){if(!t.isFunctionLike||n.isIgnored(t.relativePath))continue;let s=t.endLine-t.startLine+1;if(s<u)continue;let f=x(n,t);if(!f)continue;let a={symbol:t.symbol,shortName:g(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s},r=p.get(f);r?r.push(a):p.set(f,[a])}let c=[];for(let[t,s]of p)s.length<2||c.push({signature:t,functions:s});return c.sort((t,s)=>{let f=s.functions.length-t.functions.length;if(f!==0)return f;let a=t.functions.reduce((o,m)=>o+m.loc,0);return s.functions.reduce((o,m)=>o+m.loc,0)-a}),l?c.slice(0,l):c}function x(n,e){let i=S(e.documentation),u=i?L(i):null;return u||D($(n,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)}function S(n){if(!n||!n.includes("|"))return null;let e=n.slice(n.indexOf("|")+1).replace(/\n/g," ").trim();return e.length>0?e:null}function $(n,e,i,u,l){let p=d(n,e);if(!p)return null;let c=p.split(/\r?\n/),t=v(c,i,u,l);for(let s of t){let f=Math.min(c.length-1,Math.max(s,s+4)),a="";for(let r=s;r<=f;r+=1){let o=c[r]?.trim();if(o&&(a=a?`${a} ${o}`:o,y(a)))return a}if(a&&a.includes("("))return a}return null}function y(n){let e=n.replace(/\s+/g," ").trim();return!e.includes("(")||w(e)>0?!1:/[;{]$/.test(e)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(e)||/\)\s*As\s+.+$/i.test(e)}function L(n){if(!n||!n.trim())return null;let e=n.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(),i=e.indexOf("(");return i===-1||(e=e.slice(i),e=e.replace(/\s+/g,"").toLowerCase(),e.length<3)?null:e}function D(n,e){if(!n||!n.trim())return null;let i=n.replace(/\s+/g," ").trim(),u=i.indexOf("(");if(u===-1)return null;let l=i.slice(0,u),c=new RegExp(`\\b${h(e)}\\b`,"i").exec(l);c&&typeof c.index=="number"&&(l=l.slice(0,c.index)),l=l.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let t=i.slice(u).replace(/\s*\{[\s\S]*$/,"").replace(/\s*=>[\s\S]*$/,"").replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!t.startsWith("("))return null;let s=`${l?`${l} `:""}${t}`.replace(/\s+/g,"").toLowerCase();return s.length>=3?s:null}function v(n,e,i,u){let l=h(u),p=new RegExp(`\\b${l}\\b\\s*\\(`,"i"),c=new RegExp(`\\bdef\\s+${l}\\b`,"i"),t=[],s=new Set,f=Math.max(0,Math.min(e,n.length-1)),a=Math.max(f,Math.min(n.length-1,Math.max(i,e+4)));for(let r=f;r<=a;r+=1){let o=n[r]??"";(p.test(o)||c.test(o))&&!s.has(r)&&(s.add(r),t.push(r))}for(let r=0;r<n.length;r+=1){let o=n[r]??"";(p.test(o)||c.test(o))&&!s.has(r)&&(s.add(r),t.push(r))}return t}function w(n){let e=0;for(let i of n)i==="("&&(e+=1),i===")"&&(e-=1);return e}function h(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{I as a};
2
+ //# sourceMappingURL=chunk-XAZTIDST.js.map