scip-query 0.6.4 → 0.6.5

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 (196) hide show
  1. package/README.md +31 -29
  2. package/dist/augment-vue-worker.js +2 -0
  3. package/dist/chunk-2ZGHRI2A.js +5 -0
  4. package/dist/chunk-32R4VYYA.js +2 -0
  5. package/dist/chunk-3UB2DPLP.js +2 -0
  6. package/dist/chunk-4X7C236P.js +84 -0
  7. package/dist/chunk-5LQ6CVX3.js +2 -0
  8. package/dist/chunk-5YYMKE3G.js +70 -0
  9. package/dist/chunk-7LSCW7NF.js +6 -0
  10. package/dist/chunk-7X7FLQC5.js +2 -0
  11. package/dist/chunk-A5UNS4DR.js +4 -0
  12. package/dist/chunk-BNCTPTVX.js +2 -0
  13. package/dist/{chunk-CGAO6FHN.js → chunk-C5BFS23M.js} +2 -2
  14. package/dist/{chunk-OOMAS234.js → chunk-DRLWW74T.js} +2 -2
  15. package/dist/chunk-EB5IVUNU.js +2 -0
  16. package/dist/{chunk-ZE3BTHTS.js → chunk-ERRUE5G4.js} +4 -4
  17. package/dist/chunk-F4KR22Z2.js +2 -0
  18. package/dist/chunk-FG6A6ZUP.js +2 -0
  19. package/dist/chunk-FHSD5RKF.js +19 -0
  20. package/dist/chunk-FVVEIGP3.js +5 -0
  21. package/dist/chunk-GBDZY73J.js +2 -0
  22. package/dist/{chunk-4TYGGOLO.js → chunk-H4DXD2FB.js} +1 -1
  23. package/dist/chunk-HUASU3AD.js +71 -0
  24. package/dist/chunk-IJWIYZO5.js +2 -0
  25. package/dist/chunk-K6H3XJQW.js +7 -0
  26. package/dist/{chunk-KYT47WU2.js → chunk-KAM4C6ZD.js} +1 -1
  27. package/dist/{chunk-IDCWMWWP.js → chunk-KTCODJNQ.js} +3 -3
  28. package/dist/chunk-LJ2YWNQF.js +2 -0
  29. package/dist/chunk-LT2CPEQ4.js +2 -0
  30. package/dist/chunk-M5QTG55L.js +2 -0
  31. package/dist/chunk-MKFH7QJG.js +7 -0
  32. package/dist/chunk-MO32JMOD.js +12 -0
  33. package/dist/chunk-MO65UK5V.js +6 -0
  34. package/dist/chunk-MTK3JAJT.js +2 -0
  35. package/dist/{chunk-6UJ5PXER.js → chunk-MXWC53GJ.js} +4 -4
  36. package/dist/{chunk-IVT2U2BV.js → chunk-OQZF2DQJ.js} +3 -3
  37. package/dist/chunk-PBFMZKXE.js +6 -0
  38. package/dist/{chunk-LAXFZ3UW.js → chunk-PFMGJ4BR.js} +4 -4
  39. package/dist/{chunk-QID23O53.js → chunk-PK4U6NWP.js} +2 -2
  40. package/dist/{chunk-GALIM3IE.js → chunk-Q2ALKKSE.js} +4 -4
  41. package/dist/chunk-QFCK6WV2.js +39 -0
  42. package/dist/chunk-QFZE73XF.js +84 -0
  43. package/dist/chunk-QRYEOK3M.js +2 -0
  44. package/dist/{chunk-LORWXBOO.js → chunk-RKTDEIHF.js} +1 -1
  45. package/dist/chunk-ROWAEEOD.js +2 -0
  46. package/dist/chunk-RT5PV5JQ.js +7 -0
  47. package/dist/chunk-TLRA5TR6.js +2 -0
  48. package/dist/chunk-U5MVUPOO.js +2 -0
  49. package/dist/chunk-URUVLDM7.js +29 -0
  50. package/dist/chunk-WHGCGENP.js +16 -0
  51. package/dist/chunk-WIIZF5FP.js +2 -0
  52. package/dist/chunk-WNMAH3P7.js +2 -0
  53. package/dist/chunk-XV3XUZ3X.js +11 -0
  54. package/dist/chunk-YDKWDTAW.js +2 -0
  55. package/dist/{chunk-5OVBASGY.js → chunk-YDNCX5PF.js} +2 -2
  56. package/dist/chunk-YU25IHJX.js +90 -0
  57. package/dist/{chunk-AW3QJT4O.js → chunk-Z5CTXSWT.js} +3 -3
  58. package/dist/chunk-ZFCQQ4B5.js +2 -0
  59. package/dist/chunk-ZHHMG4UC.js +114 -0
  60. package/dist/cli.js +487 -388
  61. package/dist/{db-DKhNQ75l.d.ts → db-BZPa7dzJ.d.ts} +19 -9
  62. package/dist/index.d.ts +221 -13
  63. package/dist/index.js +45 -31
  64. package/dist/postinstall.js +1 -1
  65. package/dist/queries/affected.d.ts +1 -1
  66. package/dist/queries/affected.js +1 -1
  67. package/dist/queries/bottlenecks.d.ts +1 -1
  68. package/dist/queries/bottlenecks.js +1 -1
  69. package/dist/queries/by-kind.d.ts +1 -1
  70. package/dist/queries/by-kind.js +1 -1
  71. package/dist/queries/call-graph.d.ts +1 -1
  72. package/dist/queries/call-graph.js +1 -1
  73. package/dist/queries/change-surface.d.ts +1 -1
  74. package/dist/queries/change-surface.js +1 -1
  75. package/dist/queries/code.d.ts +1 -1
  76. package/dist/queries/code.js +1 -1
  77. package/dist/queries/complexity-hotspots.d.ts +1 -1
  78. package/dist/queries/complexity-hotspots.js +1 -1
  79. package/dist/queries/complexity.d.ts +1 -1
  80. package/dist/queries/complexity.js +1 -1
  81. package/dist/queries/convergence.d.ts +1 -1
  82. package/dist/queries/convergence.js +1 -1
  83. package/dist/queries/coupling.d.ts +1 -1
  84. package/dist/queries/coupling.js +1 -1
  85. package/dist/queries/cycles.d.ts +1 -1
  86. package/dist/queries/cycles.js +1 -1
  87. package/dist/queries/dataflow.d.ts +1 -1
  88. package/dist/queries/dataflow.js +1 -1
  89. package/dist/queries/dead.d.ts +1 -1
  90. package/dist/queries/dead.js +1 -1
  91. package/dist/queries/deep-chains.d.ts +1 -1
  92. package/dist/queries/deep-chains.js +1 -1
  93. package/dist/queries/deps.d.ts +1 -1
  94. package/dist/queries/deps.js +1 -1
  95. package/dist/queries/diff-impact.d.ts +1 -1
  96. package/dist/queries/diff-impact.js +1 -1
  97. package/dist/queries/drift-policy.d.ts +6 -0
  98. package/dist/queries/drift-policy.js +2 -0
  99. package/dist/queries/drift.d.ts +1 -1
  100. package/dist/queries/drift.js +1 -1
  101. package/dist/queries/extract-candidates.d.ts +1 -1
  102. package/dist/queries/extract-candidates.js +1 -1
  103. package/dist/queries/fan.d.ts +1 -1
  104. package/dist/queries/fan.js +1 -1
  105. package/dist/queries/files.d.ts +1 -1
  106. package/dist/queries/files.js +1 -1
  107. package/dist/queries/health.d.ts +1 -1
  108. package/dist/queries/health.js +1 -1
  109. package/dist/queries/hierarchy.d.ts +1 -1
  110. package/dist/queries/hierarchy.js +1 -1
  111. package/dist/queries/hotspots.d.ts +1 -1
  112. package/dist/queries/hotspots.js +1 -1
  113. package/dist/queries/imports.d.ts +1 -1
  114. package/dist/queries/imports.js +1 -1
  115. package/dist/queries/index.d.ts +1 -1
  116. package/dist/queries/index.js +1 -1
  117. package/dist/queries/isolated.d.ts +1 -1
  118. package/dist/queries/isolated.js +1 -1
  119. package/dist/queries/members.d.ts +1 -1
  120. package/dist/queries/members.js +1 -1
  121. package/dist/queries/methods.d.ts +1 -1
  122. package/dist/queries/methods.js +1 -1
  123. package/dist/queries/outline.d.ts +1 -1
  124. package/dist/queries/outline.js +1 -1
  125. package/dist/queries/passthrough-candidates.d.ts +1 -1
  126. package/dist/queries/passthrough-candidates.js +1 -1
  127. package/dist/queries/redundant-reexports.d.ts +1 -1
  128. package/dist/queries/redundant-reexports.js +1 -1
  129. package/dist/queries/refs.d.ts +1 -1
  130. package/dist/queries/refs.js +1 -1
  131. package/dist/queries/similar-chains.d.ts +1 -1
  132. package/dist/queries/similar-chains.js +1 -1
  133. package/dist/queries/similar-files.d.ts +1 -1
  134. package/dist/queries/similar-files.js +1 -1
  135. package/dist/queries/similar-signatures.d.ts +1 -1
  136. package/dist/queries/similar-signatures.js +1 -1
  137. package/dist/queries/similar.d.ts +1 -1
  138. package/dist/queries/similar.js +1 -1
  139. package/dist/queries/slice.d.ts +1 -1
  140. package/dist/queries/slice.js +1 -1
  141. package/dist/queries/stale-abstractions.d.ts +1 -1
  142. package/dist/queries/stale-abstractions.js +1 -1
  143. package/dist/queries/stats.d.ts +1 -1
  144. package/dist/queries/stats.js +1 -1
  145. package/dist/queries/surface.d.ts +1 -1
  146. package/dist/queries/surface.js +1 -1
  147. package/dist/queries/symbols.d.ts +1 -1
  148. package/dist/queries/symbols.js +1 -1
  149. package/dist/queries/system.d.ts +1 -1
  150. package/dist/queries/system.js +1 -1
  151. package/dist/queries/trace.d.ts +1 -1
  152. package/dist/queries/trace.js +1 -1
  153. package/dist/queries/wrapper-candidates.d.ts +1 -1
  154. package/dist/queries/wrapper-candidates.js +1 -1
  155. package/dist/reindex-worker.js +10 -63
  156. package/package.json +4 -2
  157. package/dist/chunk-2DQK2IDZ.js +0 -19
  158. package/dist/chunk-4HCKXL7T.js +0 -6
  159. package/dist/chunk-4Q2D5BMS.js +0 -2
  160. package/dist/chunk-5IM4IQ6N.js +0 -2
  161. package/dist/chunk-5NSYCQWM.js +0 -6
  162. package/dist/chunk-6QKHOBC6.js +0 -2
  163. package/dist/chunk-6U5UHIRD.js +0 -5
  164. package/dist/chunk-AQFXC7CF.js +0 -2
  165. package/dist/chunk-BSONDC3H.js +0 -7
  166. package/dist/chunk-ECT6SOBO.js +0 -2
  167. package/dist/chunk-FFE3RZ65.js +0 -2
  168. package/dist/chunk-FT4WPAEX.js +0 -65
  169. package/dist/chunk-G6HYVVRV.js +0 -2
  170. package/dist/chunk-GVVKLMXG.js +0 -10
  171. package/dist/chunk-HVM6SQPQ.js +0 -2
  172. package/dist/chunk-IJO2HZFL.js +0 -2
  173. package/dist/chunk-INPQVQ6O.js +0 -12
  174. package/dist/chunk-JSBWVSES.js +0 -39
  175. package/dist/chunk-MFVPKCS5.js +0 -2
  176. package/dist/chunk-MWCN46ZX.js +0 -89
  177. package/dist/chunk-N3Z2SJCR.js +0 -2
  178. package/dist/chunk-NKU7Z242.js +0 -8
  179. package/dist/chunk-P6IUCZA3.js +0 -24
  180. package/dist/chunk-PM3GTZ4I.js +0 -2
  181. package/dist/chunk-QL5MJOVA.js +0 -84
  182. package/dist/chunk-QWFK4QOQ.js +0 -2
  183. package/dist/chunk-RBYC6PHE.js +0 -2
  184. package/dist/chunk-TS7E5XBZ.js +0 -29
  185. package/dist/chunk-TUC6IWTY.js +0 -2
  186. package/dist/chunk-USMVRM6F.js +0 -2
  187. package/dist/chunk-VTZPTRKS.js +0 -7
  188. package/dist/chunk-WUYKGQSK.js +0 -2
  189. package/dist/chunk-X7LOLGYY.js +0 -2
  190. package/dist/chunk-XGOEZVMA.js +0 -7
  191. package/dist/chunk-Y6NOLG4X.js +0 -70
  192. package/dist/chunk-YVQ7CIKO.js +0 -6
  193. package/dist/chunk-ZIFKQQW2.js +0 -4
  194. package/dist/chunk-ZOR6FW74.js +0 -2
  195. package/dist/chunk-ZPZLVFJQ.js +0 -41
  196. package/dist/chunk-ZZ3F6P3X.js +0 -2
@@ -0,0 +1,5 @@
1
+ import{a as w}from"./chunk-32R4VYYA.js";import{d as D}from"./chunk-2ZGHRI2A.js";import{a as S,d as p,f as C,h as x,j as I,n as L,o as v,p as d}from"./chunk-QFZE73XF.js";function le(n,e){let{scope:t,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:a=!1}=e??{},o=new w(n),l=o.scopedDefinitions(t),u=K(o,t),f=A(n,o,l,{minLoc:i,maxLoc:s}),m=$(o,f),g=E(n,o,l,f),T=_(f);return B(n,f,m,T).filter(c=>!g.has(c.definition.symbolId)).filter(c=>!c.transitivelyReachable).filter(c=>c.realConsumers.length<=1).filter(c=>!(c.realConsumers.length===0&&c.barrelConsumers>0)).filter(c=>W(c.definition,c.realConsumers.length,u)).map(c=>N(n,c)).filter(c=>a||c.confidence!=="low").sort((c,b)=>{let h={high:0,medium:1,low:2};return h[c.confidence]-h[b.confidence]||b.loc-c.loc||c.file.localeCompare(b.file)||c.startLine-b.startLine}).slice(0,r)}function A(n,e,t,i){return t.filter(s=>s.isTypeLike&&y(s)>=i.minLoc).filter(s=>y(s)<=i.maxLoc).filter(s=>!n.isIgnored(s.relativePath)).filter(s=>!V(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function $(n,e){return R(n.crossFileCallerMap(e),n.sourceFallbackCallerFiles(e))}function _(n){let e=new Map;for(let t of n){let i=e.get(t.relativePath);i||(i=new Map,e.set(t.relativePath,i));let s=d(t.symbol);s&&i.set(s,t)}return e}function B(n,e,t,i){return e.map(s=>{let a=[...t.get(s.symbolId)??new Set].filter(f=>f!==s.relativePath&&!n.isIgnored(f)),{realConsumers:o,barrelConsumers:l}=G(n,s.relativePath,s.symbol,a),u=Z(n,s,t,i);return{definition:s,realConsumers:o,barrelConsumers:l,transitivelyReachable:u}})}function N(n,e){let t=k(n,e.definition.relativePath,e.definition.startLine),i=P(e.definition.relativePath)?!0:X(n,e.definition),{confidence:s,reason:r}=Y(e.realConsumers.length,t,i);return{symbol:e.definition.symbol,shortName:v(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:y(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:t,definerUsesType:i,confidence:s,reason:r}}function E(n,e,t,i){let s=O(n,j(t),i),r=s.map(l=>l.singleton);if(s.length===0)return new Set;let a=R(e.crossFileCallerMap(r),e.sourceFallbackCallerFiles(r)),o=new Set;for(let{singleton:l,classId:u}of s)z(n,l,a)&&o.add(u);return o}function j(n){let e=new Map;for(let t of n){let i=d(t.symbol);i&&e.set(M(t.relativePath,i),t)}return e}function O(n,e,t){let i=[];for(let s of t){let r=U(n,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function U(n,e,t){if(k(n,t.relativePath,t.startLine)!=="class")return null;let i=d(t.symbol);if(!i)return null;let s=H(n,t.relativePath,i);return s?e.get(M(t.relativePath,s))??null:null}function z(n,e,t){let i=d(e.symbol),s=t.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!n.isIgnored(r)&&!F(n,r,i))}function M(n,e){return`${n}\0${e}`}function H(n,e,t){let i=p(n,e);if(!i)return null;let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function K(n,e){return new Set(n.scopedDefinitions(e).filter(t=>t.isFunctionLike).map(t=>t.relativePath))}function V(n){let e=L(n);if("kind"in e)return!1;let t=e.descriptors;if(t.length<2)return!1;let i=t[t.length-1],s=t[t.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function P(n){let t=(n.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(t==="types"||t==="models"||t==="schema"||t==="common"||t==="protocol"||t==="proto"||t==="dto"||t==="mod"||/(^|\/)types(\/|\.)/.test(n)||/(^|\/)models?(\/|\.)/.test(n)||/(^|\/)proto(?:col)?(\/|\.)/.test(n)||/(^|\/)schema(\/|\.)/.test(n))}function W(n,e,t){return!(P(n.relativePath)&&e>0||e===0&&t.has(n.relativePath))}function G(n,e,t,i){let s=[],r=0,a=d(t);for(let o of i)Q(n,o,e,a)||F(n,o,a)?r++:s.push(o);return{realConsumers:s,barrelConsumers:r}}function Z(n,e,t,i){let s=I(n,e.relativePath),r=d(e.symbol);if(!r)return!1;let a=s.get(r);if(!a||a.size===0)return!1;let o=i.get(e.relativePath);if(!o)return!1;for(let l of a){let u=o.get(l);if(!u)continue;let f=t.get(u.symbolId);if(f){for(let m of f)if(m!==e.relativePath&&!n.isIgnored(m))return!0}}return!1}var q=S("stale-abs-file-usage");function F(n,e,t){if(!t)return!1;let i=C(e);if(!i)return!1;let s=q.get(n,e,()=>J(n,e,i));return s.importedLeaves.has(t)&&!s.usedLeaves.has(t)}function J(n,e,t){let i=new Set,s=new Set,r=x(n,e);if(!r)return{importedLeaves:i,usedLeaves:s};let a=t==="rust"?new Set(["use_declaration"]):t==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),o=(l,u)=>{let f=u||a.has(l.type);(l.type==="identifier"||l.type==="type_identifier"||l.type==="property_identifier"||l.type==="field_identifier")&&(f?i.add(l.text):s.add(l.text));for(let m of l.children)o(m,f)};return o(r.rootNode,!1),{importedLeaves:i,usedLeaves:s}}function Q(n,e,t,i){if(!i)return!1;let s=p(n,e);if(!s)return!1;let r=D(n,e);if(r.length===0)return!1;let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`\\b${a}\\b`),l=s.split(`
2
+ `),u=0;for(let f=0;f<l.length;f++){if(!o.test(l[f]??""))continue;if(u++,!r.find(g=>g.startLine<=f&&f<=g.endLine))return!1}return u>0}function k(n,e,t){let i=p(n,e);if(!i)return"other";let s=i.split(`
3
+ `),r=Math.max(0,t-2),a=Math.min(s.length-1,t+2);for(let o=r;o<=a;o++){let u=(s[o]??"").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 X(n,e){let t=p(n,e.relativePath);if(!t)return!1;let i=d(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),a=t.split(`
4
+ `);for(let o=0;o<a.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(a[o]??""))return!0;return!1}function Y(n,e,t){return n===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:n===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:n===1&&!t?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}function y(n){return n.endLine-n.startLine+1}function R(...n){let e=new Map;for(let t of n)for(let[i,s]of t){let r=e.get(i);r||(r=new Set,e.set(i,r));for(let a of s)r.add(a)}return e}export{le as a};
5
+ //# sourceMappingURL=chunk-FVVEIGP3.js.map
@@ -0,0 +1,2 @@
1
+ import{b as e}from"./chunk-MO65UK5V.js";import{D as o}from"./chunk-QFZE73XF.js";function l(t,r){let s=e(t,r);return o(t,s).map(({relativePath:m,...a})=>a)}export{l as a};
2
+ //# sourceMappingURL=chunk-GBDZY73J.js.map
@@ -2,4 +2,4 @@ import{execFileSync as n}from"child_process";import{platform as o,arch as p}from
2
2
  `),console.log("Or download manually:")):console.log("Download from:"),console.log(e?` ${e.url}
3
3
  `:` https://github.com/sourcegraph/scip/releases/tag/${u}
4
4
  `),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function I(e){if(o()==="darwin"&&t("brew")){e("Installing scip CLI via Homebrew...");try{if(n("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`Homebrew install failed: ${i}`)}}if(t("go")){e("Installing scip CLI via go install...");try{if(n("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`go install failed: ${i}`)}}return e("Could not auto-install scip CLI."),e("Install manually from: https://github.com/sourcegraph/scip/releases"),!1}export{h as a,w as b,b as c,I as d};
5
- //# sourceMappingURL=chunk-4TYGGOLO.js.map
5
+ //# sourceMappingURL=chunk-H4DXD2FB.js.map
@@ -0,0 +1,71 @@
1
+ import se from"better-sqlite3";import{createRequire as ae}from"module";import{existsSync as ue,mkdtempSync as pn,readFileSync as v,rmSync as hn,statSync as bn,writeFileSync as Sn}from"fs";import{cpus as vn,tmpdir as Rn}from"os";import{dirname as F,extname as ce,join as O,relative as le,resolve as ge}from"path";import{pathToFileURL as fe}from"url";import{Worker as wn}from"worker_threads";import H from"better-sqlite3";import{execFileSync as G}from"child_process";import{existsSync as K,readdirSync as B,readFileSync as J}from"fs";import{extname as m,join as I}from"path";import _ from"ignore";import{readFileSync as A,existsSync as h}from"fs";import{dirname as b,isAbsolute as R,join as S,relative as P,resolve as j}from"path";function V(e){let n=_(),r=!1,t=W(e);for(let o of t)try{let i=A(o,"utf-8");n.add(i),r=!0}catch{}return r||n.add($),{isIgnored:o=>k(n,e,o),filter:o=>o.filter(i=>!k(n,e,i))}}function W(e){let n=[],r=S(e,".gitignore");h(r)&&n.push(r);let t=b(e),o=0;for(;t!==b(t)&&o<5;){let i=S(t,".gitignore");if(h(i)&&n.push(i),h(S(t,".git")))break;t=b(t),o++}return n}var $=`
2
+ # Dependencies
3
+ node_modules/
4
+ vendor/
5
+ .bundle/
6
+
7
+ # Build output
8
+ dist/
9
+ build/
10
+ out/
11
+ target/
12
+ bin/
13
+ obj/
14
+
15
+ # Python
16
+ __pycache__/
17
+ *.pyc
18
+ *.pyo
19
+ .venv/
20
+ venv/
21
+ .env/
22
+ env/
23
+ *.egg-info/
24
+
25
+ # Rust
26
+ target/
27
+
28
+ # Java / Kotlin / Scala
29
+ *.class
30
+ .gradle/
31
+ .mvn/
32
+
33
+ # C# / .NET
34
+ bin/
35
+ obj/
36
+ packages/
37
+
38
+ # Go
39
+ vendor/
40
+
41
+ # Dart
42
+ .dart_tool/
43
+ build/
44
+
45
+ # PHP
46
+ vendor/
47
+
48
+ # IDE / OS
49
+ .idea/
50
+ .vscode/
51
+ *.swp
52
+ *.swo
53
+ .DS_Store
54
+ Thumbs.db
55
+
56
+ # Type definitions (often noise in queries)
57
+ *.d.ts
58
+ `;function k(e,n,r){let t=U(n,r);if(!t)return!1;try{return e.ignores(t)}catch{return!1}}function U(e,n){if(!n||n===".")return null;if(!R(n)&&!n.startsWith(".."))return n.replaceAll("\\","/");let r=R(n)?n:j(e,n),t=P(e,r).replaceAll("\\","/");return!t||t==="."||t.startsWith("..")?null:t}import{readdirSync as Ge}from"fs";import{extname as Be,join as Je}from"path";function x(e){let n=new WeakMap,r=t=>{let o=n.get(t);return o||(o=new Map,n.set(t,o)),o};return{get(t,o,i){let s=r(t);if(s.has(o))return s.get(o);let a=i();return s.set(o,a),a},invalidate(t,o){n.get(t)?.delete(o)},invalidateAll(t){n.delete(t)},size(t){return n.get(t)?.size??0}}}var w=[".vue"],T=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var qe=x("source-files");function rn(e){let n=new Set((e.extensions??w).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!K(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=V(e.projectRoot),t=z(e.projectRoot,n).filter(i=>!r.isIgnored(i)),o=new H(e.dbPath);try{let i=X(o,t),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
59
+ VALUES (?, ?, NULL, ?)`),u=o.transaction(l=>{let d=0;for(let g of l){if(i.has(g))continue;let f=J(I(e.projectRoot,g),"utf-8"),M=s.run(Y(g),g,f);d+=Number(M.changes)}return d})(t),c={scanned:t.length,inserted:u,existing:t.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function z(e,n){let r=q(e,n);if(r)return r;let t=[],o=i=>{let s=i?I(e,i):e,a;try{a=B(s,{withFileTypes:!0})}catch{return}for(let u of a){if(T.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}n.has(m(u.name).toLowerCase())&&t.push(c)}};return o(""),t.sort()}function q(e,n){try{return G("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
60
+ `).filter(t=>t&&n.has(m(t).toLowerCase())).sort()}catch{return null}}function X(e,n){let r=new Set,t=500;for(let o=0;o<n.length;o+=t){let i=n.slice(o,o+t),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function Y(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as Q}from"child_process";import{createHash as Z}from"crypto";import{readdirSync as ee,readFileSync as ne}from"fs";import{join as C}from"path";function te(e){return(re(e)??oe(e)).filter(n=>n&&!E(n)).sort()}function ln(e){return te(e).map(n=>{let r=C(e,n);try{let t=ne(r);return{path:n,size:t.byteLength,hash:Z("sha256").update(t).digest("hex")}}catch{return{path:n,size:-1,hash:"unreadable"}}})}function re(e){try{return Q("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
61
+ `).filter(Boolean)}catch{return null}}function oe(e){let n=[],r=[""];for(;r.length>0;){let t=r.pop(),o=t?C(e,t):e,i;try{i=ee(o,{withFileTypes:!0})}catch{continue}for(let s of i){let a=t?`${t}/${s.name}`:s.name;if(s.isDirectory()){E(a)||r.push(a);continue}n.push(a)}}return n}function E(e){return e.split("/").some(r=>ie.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var ie=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);function Tn(e){let n=ge(e.projectRoot,e.tsconfig),r=ve(e.projectRoot,n),t=new se(e.dbPath,{readonly:!0});try{let o=Ne();return de({projectRoot:e.projectRoot,vueFiles:e.vueFiles??[],tasks:e.tasks,context:r,symbolLookup:we(t,e.projectRoot,o),vueSymbolLookup:Ce(t,e.projectRoot),sourceCache:o})}finally{t.close()}}function de(e){let n=[],r=0,t=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of t){let i=me(e,o);n.push(...i.occurrences),r+=i.skippedReferences}return{occurrences:n,skippedReferences:r}}function me(e,n){let r=e.context.language.scripts.get(n.fileName),t=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!t)return{occurrences:[],skippedReferences:n.countFileSkip?1:0};let o=e.sourceCache(n.fileName);if(!o)return{occurrences:[],skippedReferences:n.countFileSkip?1:0};let i=e.context.language.maps.get(t,r),s=p(e.projectRoot,n.fileName),a=[...Fe(o.text)],u={tokens:a.filter(c=>c.start>=n.startOffset&&c.start<n.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:be(a),processedStarts:new Set};return pe({...e,fileName:n.fileName,sourceInfo:o,sourceFile:s,map:i,tokenContext:u})}function pe(e){let n=[],r=0;for(let t of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(t.start))continue;let o=Oe(e.map,t.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(u=>!Le(e.projectRoot,u.fileName));if(!s){r++;continue}let a=Ee(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}L(n,e.sourceInfo,e.sourceFile,t,a),e.tokenContext.processedStarts.add(t.start),he(n,e,t,o,a)}return{occurrences:n,skippedReferences:r}}function he(e,n,r,t,o){if(!((n.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let i of Se(n.context.languageService,n.fileName,t+1,n.map,r,n.tokenContext.tokenByStart)){if(n.tokenContext.processedStarts.has(i))continue;let s=n.tokenContext.tokenByStart.get(i);s&&(L(e,n.sourceInfo,n.sourceFile,s,o),n.tokenContext.processedStarts.add(i))}}function L(e,n,r,t,o){let i=N(n,t.start);e.push({sourceFile:r,sourceLine:i.line,sourceStartChar:i.character,sourceEndChar:i.character+t.text.length,symbolId:o})}function be(e){let n=new Map;for(let r of e)n.set(r.text,(n.get(r.text)??0)+1);return n}function Se(e,n,r,t,o,i){let s=e.getDocumentHighlights?.(n,r,[n])??[],a=[];for(let u of s)if(u.fileName===n)for(let c of u.highlightSpans){let l=ye(t,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function ye(e,n,r,t){let o=r.get(n);if(o?.text===t)return o.start;let i=D(e,n);if(i===null)return null;let s=r.get(i);return s?.text===t?s.start:null}function ve(e,n){let{vueCore:r,ts:t,volarTs:o}=Re(e),{parsed:i,vueOptions:s}=ke(r,t,n),a=F(n),u=r.createVueLanguagePlugin(t,i.options,s,f=>f),c=Ve(r,t,u),l=xe(a,i),{languageServiceHost:d}=o.createLanguageServiceHost(t,t.sys,c,f=>f,l),g=t.createLanguageService(d);return{ts:t,language:c,languageService:g,fileNames:i.fileNames,configDir:a}}function Re(e){let n=ae(fe(O(e,"package.json")).href);return{vueCore:y(n,"@vue/language-core",e),ts:y(n,"typescript",e),volarTs:y(n,"@volar/typescript",e)}}function ke(e,n,r){let t=n.readConfigFile(r,n.sys.readFile);if(t.error||!t.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(n,n.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,n.sys.writeFile)),{parsed:n.parseJsonConfigFileContent(t.config,n.sys,F(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:n.ScriptKind.Deferred}))),vueOptions:i}}function Ve(e,n,r){let t={},o=e.createLanguage([r],new Map,i=>{if(!ue(i))return;let s=v(i,"utf-8");t.current?.scripts.set(i,n.ScriptSnapshot.fromString(s),r.getLanguageId(i)??De(i))});return t.current=o,o}function xe(e,n){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>n.options,getScriptFileNames:()=>n.fileNames,getProjectReferences:()=>n.projectReferences,getProjectVersion:()=>"0"}}function y(e,n,r){try{return e(n)}catch(t){throw(typeof t=="object"&&t!==null&&"code"in t?t.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${n} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:t}):t}}function we(e,n,r){let t=Te(e);return o=>{let i=p(n,o.fileName),s=r(o.fileName);if(!s)return null;let a=N(s,o.textSpan.start),u=t.get(i);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Ie(u.starts,a.line,2)}}function Te(e){let n=e.prepare(`
62
+ SELECT
63
+ d.relative_path AS relativePath,
64
+ der.start_line AS startLine,
65
+ der.end_line AS endLine,
66
+ der.symbol_id AS symbolId
67
+ FROM defn_enclosing_ranges der
68
+ JOIN documents d ON d.id = der.document_id
69
+ ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
70
+ `).all(),r=new Map;for(let t of n){let o=r.get(t.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(t.relativePath,o)),o.starts.push({line:t.startLine,symbolId:t.symbolId});for(let i=t.startLine;i<=t.endLine;i++)o.containingByLine.set(i,t.symbolId)}for(let t of r.values())t.starts.sort((o,i)=>o.line-i.line);return r}function Ie(e,n,r){let t=0,o=e.length-1;for(;t<=o;){let s=Math.floor((t+o)/2);e[s].line<n?t=s+1:o=s-1}let i=null;for(let s of[o,t]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-n);u>r||(!i||u<i.distance)&&(i={distance:u,symbolId:a.symbolId})}return i?.symbolId??null}function Ce(e,n){let r=_e(n),t=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=p(n,i),a=Ae(r.name,r.version,s),c=t.get(a)?.id??null;return o.set(i,c),c}}}function Ee(e,n,r,t,o){if(e.fileName.endsWith(".vue")){let i=t.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=t.language.maps.get(s,i);if(D(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return n(e)}function*Fe(e){let n=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),t;for(;t=n.exec(e);){let o=t[0];r.has(o)||(yield{text:o,start:t.index,end:t.index+o.length})}}function Oe(e,n){for(let[r]of e.toGeneratedLocation(n,t=>!!t.navigation))return r;return null}function D(e,n){let r=e;for(let[t]of r.toSourceLocation(n,o=>!!o.navigation))return t;return null}function N(e,n){let r=0,t=e.lineStarts.length-1;for(;r<=t;){let i=Math.floor((r+t)/2);e.lineStarts[i]<=n?r=i+1:t=i-1}let o=Math.max(0,t);return{line:o,character:n-e.lineStarts[o]}}function Le(e,n){return p(e,n).startsWith("node_modules/")}function p(e,n){return le(e,n).replaceAll("\\","/")}function De(e){switch(ce(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function Ne(){let e=new Map;return n=>{if(e.has(n))return e.get(n)??null;try{let r=v(n,"utf-8"),t={text:r,lineStarts:Me(r)};return e.set(n,t),t}catch{return e.set(n,null),null}}}function Me(e){let n=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&n.push(r+1);return n}function _e(e){try{let n=JSON.parse(v(O(e,"package.json"),"utf-8"));return{name:n.name??"workspace",version:n.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Ae(e,n,r){let t=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${n} ${t}/default.`}export{rn as a,ln as b,Tn as c};
71
+ //# sourceMappingURL=chunk-HUASU3AD.js.map
@@ -0,0 +1,2 @@
1
+ import{a as g}from"./chunk-32R4VYYA.js";import{o as f}from"./chunk-QFZE73XF.js";function L(e,i={}){let{scope:t,minLoc:o=10,minCallees:r=6,limit:n=20}=i,l=new g(e),s=l.productionCallableDefinitions({scope:t,minLoc:o,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),c=l.calleeMap(s),d=[];for(let a of s){let u=m(a,c.get(a.symbolId)??[],r);u&&d.push(u)}return d.sort((a,u)=>u.clusters.length-a.clusters.length||u.loc-a.loc),d.slice(0,n)}function m(e,i,t){let o=new Set(i.map(s=>s.symbol));if(o.size<t)return null;let r=p(o,i),n=h(o,r);if(n.length<2)return null;let l=C(n,r);return l.length===0?null:{symbol:e.symbol,shortName:f(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:b(e),totalCallees:o.size,clusters:l}}function p(e,i){let t=new Map;for(let r of e)t.set(r,new Set);let o=new Map;for(let r of i){let n=o.get(r.chunkId);n||(n=new Set,o.set(r.chunkId,n)),n.add(r.symbol)}for(let r of o.values()){let n=[...r];for(let l=0;l<n.length;l++)for(let s=l+1;s<n.length;s++)t.get(n[l]).add(n[s]),t.get(n[s]).add(n[l])}return t}function h(e,i){let t=new Set,o=[];for(let r of e){if(t.has(r))continue;let n=new Set,l=[r];for(;l.length>0;){let s=l.pop();if(!t.has(s)){t.add(s),n.add(s);for(let c of i.get(s)??[])t.has(c)||l.push(c)}}o.push(n)}return o}function C(e,i){return e.filter(t=>t.size>=3).map(t=>S(t,e,i)).filter(t=>t.isolation>.5).sort((t,o)=>o.isolation-t.isolation)}function S(e,i,t){let o=new Set;for(let s of i)if(s!==e)for(let c of s)o.add(c);let r=0;for(let s of e)for(let c of t.get(s)??[])o.has(c)&&r++;let n=e.size*o.size,l=n>0?1-r/n:1;return{callees:[...e].map(f),isolation:l}}function b(e){return e.endLine-e.startLine+1}export{L as a};
2
+ //# sourceMappingURL=chunk-IJWIYZO5.js.map
@@ -0,0 +1,7 @@
1
+ import{a as M}from"./chunk-32R4VYYA.js";import{f as b}from"./chunk-4X7C236P.js";import{E as C,o as p,p as g,v as I}from"./chunk-QFZE73XF.js";import{basename as c,extname as d}from"path";function R(i,e){let{scope:n,maxLoc:o=15,limit:r=30}=e??{},t=new M(i),a=P(t.fileDependencyGraph(n)),s=x(t,n,o),u=v(t.crossFileCallerMap(s),t.sourceFallbackCallerFiles(s)),m=[];for(let f of s){let l=F(i,t,f,{callerFileMap:u,reverseFanIn:a});l&&m.push(l)}return m.sort((f,l)=>l.callerFanIn-f.callerFanIn||l.loc-f.loc),m.slice(0,r)}function F(i,e,n,o){let r=D(e,n,o.callerFileMap);if(r.length!==1)return null;let t=r[0],a=S(i,n.symbolId,t);if(!a)return null;let s=L(e,i,t,n.symbol,a);if(s&&I(s.symbol))return null;let u=y(o.callerFileMap,o.reverseFanIn,t,s);return u<=3?null:{symbol:n.symbol,shortName:p(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:h(n),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?p(s.symbol):c(t),callerFanIn:u}}function h(i){return i.endLine-i.startLine+1}function x(i,e,n){return i.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:n,requireFunctionLikeSymbol:!0})}function D(i,e,n){let o=c(e.relativePath,d(e.relativePath));return[...n.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>c(r,d(r))!==o).filter(r=>{let t=i.fileKind(r);return t!=="barrel"&&t!=="entry"&&t!=="test"})}function S(i,e,n){return i.get(`SELECT c.start_line, c.end_line
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d ON c.document_id = d.id
5
+ WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
+ LIMIT 1`,e,n)}function L(i,e,n,o,r){let t=i.definitionsForFile(n),a=k(e,n,o,r.start_line,r.end_line);return C(t,a)}function y(i,e,n,o){if(o?.isFunctionLike){let r=[...i.get(o.symbolId)??[]].filter(t=>t!==o.relativePath);if(r.length>0)return r.length}return _(e,n)}function k(i,e,n,o,r){let t=g(n);if(!t)return o;let a=b(i,e).get(t);if(!a||a.length===0)return o;for(let s of a)if(s>=o&&s<=r)return s;return o}function v(...i){let e=new Map;for(let n of i)for(let[o,r]of n){let t=e.get(o);t||(t=new Set,e.set(o,t));for(let a of r)t.add(a)}return e}function P(i){let e=new Map;for(let[n,o]of i){e.has(n)||e.set(n,e.get(n)??0);for(let r of o)e.set(r,(e.get(r)??0)+1)}return e}function _(i,e){let n=i.get(e)??0;if(n>0)return n;let o=c(e,d(e)),r=0;for(let[t,a]of i)t!==e&&c(t,d(t))===o&&a>r&&(r=a);return r}export{R as a};
7
+ //# sourceMappingURL=chunk-K6H3XJQW.js.map
@@ -1,4 +1,4 @@
1
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
2
  WHERE relative_path LIKE ?
3
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
4
+ //# sourceMappingURL=chunk-KAM4C6ZD.js.map
@@ -1,5 +1,5 @@
1
- import{a as u}from"./chunk-QL5MJOVA.js";import{readdirSync as l}from"fs";import{extname as d,join as p}from"path";var x=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],v=[".vue"],S=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function _(o,i={}){let s=i.includeIndexed??!0,r=i.includeAuxiliary??!0,t=i.extensions?new Set(i.extensions.map(n=>n.toLowerCase())):new Set(x.map(n=>n.toLowerCase())),c=`${s?"1":"0"}|${r?"1":"0"}|${[...t].sort().join(",")}`;return f.get(o,c,()=>{let n=new Set;if(s){let e=o.all(`SELECT relative_path
1
+ import{a as u}from"./chunk-QFZE73XF.js";import{readdirSync as l}from"fs";import{extname as d,join as p}from"path";var x=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],v=[".vue"],S=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function _(o,s={}){let i=s.includeIndexed??!0,r=s.includeAuxiliary??!0,t=s.extensions?new Set(s.extensions.map(n=>n.toLowerCase())):new Set(x.map(n=>n.toLowerCase())),c=`${i?"1":"0"}|${r?"1":"0"}|${[...t].sort().join(",")}`;return f.get(o,c,()=>{let n=new Set;if(i){let e=o.all(`SELECT relative_path
2
2
  FROM documents
3
3
  WHERE 1 = 1
4
- ${o.pathExclusionsFor("documents")}`);for(let a of e)o.isIgnored(a.relative_path)||t.has(d(a.relative_path).toLowerCase())&&n.add(a.relative_path)}if(r)for(let e of g(o.config.projectRoot,t))o.isIgnored(e)||n.add(e);return[...n].sort()})}var f=u("source-files");function g(o,i){let s=new Set,r=t=>{let c=t?p(o,t):o,n=[];try{n=l(c,{withFileTypes:!0})}catch{return}for(let e of n)if(!S.has(e.name)){if(e.isDirectory()){r(t?`${t}/${e.name}`:e.name);continue}i.has(d(e.name).toLowerCase())&&s.add(t?`${t}/${e.name}`:e.name)}};return r(""),s}export{v as a,S as b,_ as c};
5
- //# sourceMappingURL=chunk-IDCWMWWP.js.map
4
+ ${o.pathExclusionsFor("documents")}`);for(let a of e)o.isIgnored(a.relative_path)||t.has(d(a.relative_path).toLowerCase())&&n.add(a.relative_path)}if(r)for(let e of g(o.config.projectRoot,t))o.isIgnored(e)||n.add(e);return[...n].sort()})}var f=u("source-files");function g(o,s){let i=new Set,r=t=>{let c=t?p(o,t):o,n;try{n=l(c,{withFileTypes:!0})}catch{return}for(let e of n)if(!S.has(e.name)){if(e.isDirectory()){r(t?`${t}/${e.name}`:e.name);continue}s.has(d(e.name).toLowerCase())&&i.add(t?`${t}/${e.name}`:e.name)}};return r(""),i}export{v as a,S as b,_ as c};
5
+ //# sourceMappingURL=chunk-KTCODJNQ.js.map
@@ -0,0 +1,2 @@
1
+ function t(e){let r=e.replace(/\\/g,"/").split("/").filter(Boolean);return r.length<=1?"(root)":r.length>=3&&["src","lib","app","server","client"].includes(r[0])?`${r[0]}/${r[1]}`:r[0]}function l(e,n){if(e===n)return"ok";let r=s(e),o=s(n);return r&&o?i(r,o)?"ok":"violation":a(e,n)}function c(e,n){let r=s(t(e)),o=s(t(n));return!!r&&!!o}function s(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function i(e,n){return n==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(n)??!1}function a(e,n){if(n==="shared")return"ok";let r={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return r[e]?r[e].has(n)?"ok":"violation":null}export{t as a,l as b,c};
2
+ //# sourceMappingURL=chunk-LJ2YWNQF.js.map
@@ -0,0 +1,2 @@
1
+ import{h as a,i as n}from"./chunk-4X7C236P.js";import{a as m}from"./chunk-ZHHMG4UC.js";import{o as i}from"./chunk-QFZE73XF.js";function p(e,s){let o=m(e,s);if(!o)return null;let t=n(e,o,{limit:50}),r=y(a(e,o,{limit:50,additive:!0,callableOnly:!0}));return{symbol:o.symbol,shortName:i(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:i(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:i(l.symbol),file:l.file}))}}function y(e){let s=new Set,o=[];for(let t of e){let r=`${t.symbol}|${t.file}`;s.has(r)||(s.add(r),o.push(t))}return o}export{p as a};
2
+ //# sourceMappingURL=chunk-LT2CPEQ4.js.map
@@ -0,0 +1,2 @@
1
+ import{a as w}from"./chunk-32R4VYYA.js";import{i as S}from"./chunk-4X7C236P.js";import{a as g,b as I}from"./chunk-ZHHMG4UC.js";import{E as p,o as h,q as d}from"./chunk-QFZE73XF.js";function $(s,l,r={}){let{maxDepth:y=5,scope:b}=r,m=g(s,l);if(!m)return[];let f=[],c=new Set([m.symbolId]),u=new Set,i=[m];for(let n=1;n<=y&&i.length!==0;n++){let e=[];for(let t of i)for(let o of M(s,t,b)){let a=`${o.file}|${o.shortName}`;if(o.symbolId!==null){if(c.has(o.symbolId))continue;c.add(o.symbolId)}else if(u.has(a))continue;u.add(a),f.push({symbol:o.symbol,shortName:o.shortName,file:o.file,depth:n}),o.symbolId!==null&&o.symbolMatch&&e.push(o.symbolMatch)}i=e}return f.sort((n,e)=>n.depth-e.depth||n.file.localeCompare(e.file)),f}function M(s,l,r){let y=new w(s),b=S(s,l,{limit:500}).filter(e=>!s.isIgnored(e.file)).filter(e=>!r||e.file.includes(r)),m=new Set(b.map(e=>e.file)),f=y.crossFileCallerMap().get(l.symbolId)??new Set,c=[];for(let e of f){if(m.has(e)||s.isIgnored(e)||r&&!e.includes(r))continue;let t=y.definitionsForFile(e),o=t.length>0?p(t,t[0].startLine):null;c.push({symbol:o?.symbol??e,file:e})}let u=[...b,...c],i=[],n=new Set;for(let e of u){let t=I(s,e.symbol);if(!t){let a=`${e.file}|${e.symbol}`;if(n.has(a))continue;n.add(a),i.push({symbolId:null,symbol:e.symbol,shortName:h(e.symbol),file:e.file,symbolMatch:null});continue}if(t.symbolId===l.symbolId||s.isIgnored(t.relativePath)||!R(t.symbol))continue;let o=`${t.symbolId}|${t.relativePath}`;n.has(o)||(n.add(o),i.push({symbolId:t.symbolId,symbol:t.symbol,shortName:h(t.symbol),file:t.relativePath,symbolMatch:t}))}return i}function R(s){let l=d(s);return l==="method"||l==="type"||s.endsWith("().")}export{$ as a};
2
+ //# sourceMappingURL=chunk-M5QTG55L.js.map
@@ -0,0 +1,7 @@
1
+ import{a as m}from"./chunk-32R4VYYA.js";import{a as l}from"./chunk-ZHHMG4UC.js";import{o as a}from"./chunk-QFZE73XF.js";import{readFileSync as f}from"fs";import{join as u}from"path";function I(e,n){let t=l(e,n);if(!t)return null;let i=new m(e),c=S(h(e,t.relativePath,t.startLine,t.endLine),p(e,t.relativePath)),o=t.endLine-t.startLine+1,r=i.calleeMap([t],{additive:!0}).get(t.symbolId)??[],b=new Set(r.map(g=>g.symbol));return{symbol:t.symbol,shortName:a(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:o,branches:c,cyclomaticEstimate:c+1,calleeCount:b.size,fanIn:y(e,t.symbolId),fanOut:d(r,t.relativePath)}}function p(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function h(e,n,t,i){try{return f(u(e.config.projectRoot,n),"utf-8").split(`
2
+ `).slice(t,i+1).join(`
3
+ `)}catch{return""}}function y(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
4
+ FROM mentions m
5
+ JOIN chunks c ON m.chunk_id = c.id
6
+ WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function d(e,n){return new Set(e.filter(t=>t.file!==n).map(t=>t.symbol)).size}function S(e,n){let t=P(e),i=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=t.match(o);s&&(i+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let r=t.match(s);r&&(i+=r.length)}}return i}function P(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*/g,"").replace(/#.*/g,"").replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/`(?:[^`\\]|\\.)*`/g,"``")}export{I as a};
7
+ //# sourceMappingURL=chunk-MKFH7QJG.js.map
@@ -0,0 +1,12 @@
1
+ import{a as P}from"./chunk-32R4VYYA.js";import{d as R,e as v,f as D,g as F,h as L}from"./chunk-PK4U6NWP.js";import{a as m,i as S}from"./chunk-4X7C236P.js";import{e as f}from"./chunk-2ZGHRI2A.js";import{B as h,H as c,o as d,r as p,s as g,t as b,u as y,v as _}from"./chunk-QFZE73XF.js";function Q(e,n={}){let{scope:r,minLoc:t=1,includeTests:s=!1,skipBarrels:a=!1,includeMembers:i=!1}=n,l=a?new Set(R(e)):new Set,o=w(e,l);k(e,o,l);let u=x(e,{scope:r,minLoc:t,includeTests:s,includeMembers:i});return H(e,u,o,{includeTests:s,inactiveBarrelPaths:l}),M(e,E(u,o))}function w(e,n){let r=e.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
+ ${e.pathExclusionsFor("d")}
10
+ GROUP BY m.symbol_id, d.relative_path`),t=new Map;for(let s of r){if(e.isIgnored(s.relative_path)||n.has(s.relative_path))continue;let a=t.get(s.symbol_id);a||(a=new Map,t.set(s.symbol_id,a)),a.set(s.relative_path,s.ref_count)}return t}function x(e,n){let r=U(e);return h(e,{scope:n.scope}).filter(t=>!e.isIgnored(t.relativePath)).filter(t=>!b(t.symbol)).filter(t=>T(t.symbol)).filter(t=>t.isFunctionLike||!t.enclosingSymbol||!T(t.enclosingSymbol)).filter(t=>n.includeTests||C(t.relativePath)).filter(t=>n.includeTests||!r(t.relativePath,t.startLine,t.symbol,t.parentTypeName)).filter(t=>!y(t.symbol)).filter(t=>!_(t.symbol)).filter(t=>n.includeMembers||j(t)).filter(t=>t.endLine-t.startLine+1>=n.minLoc)}function E(e,n){return e.map(r=>I(r,n)).filter(r=>r.cross_file_refs===0).sort((r,t)=>t.loc-r.loc||r.relative_path.localeCompare(t.relative_path)||r.start_line-t.start_line)}function I(e,n){let r=n.get(e.symbolId)??new Map,t=r.get(e.relativePath)??0,s=0;for(let[a,i]of r)a!==e.relativePath&&(s+=i);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:t,cross_file_refs:s}}function M(e,n){let r=[],t=0,s=0,a=0;for(let i of n){if(e.isIgnored(i.relative_path)||v(e,i.relative_path)||D(e,i.symbol,i.relative_path))continue;let l=i.same_file_refs===0?"dead-code":"file-internal";l==="dead-code"?t++:s++,a+=i.loc,r.push({relativePath:i.relative_path,startLine:i.start_line,endLine:i.end_line,loc:i.loc,symbol:i.symbol,shortName:d(i.symbol),sameFileRefs:i.same_file_refs,kind:l})}return{symbols:r,totalCount:r.length,deadCodeCount:t,fileInternalCount:s,totalLoc:a}}function k(e,n,r){let t=new P(e),s=new Set(t.sourceFiles());for(let a of N(e))s.add(a);t.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",skipPath:a=>r.has(a)},a=>{O(e,a)||B(n,a.target.symbolId,a.sourceFile,A(a))})}function N(e){let n=e.all(`SELECT relative_path FROM documents
11
+ WHERE 1 = 1 ${e.pathExclusionsFor("documents")}`);return new Set(n.map(r=>r.relative_path))}function O(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&$(e,n)}function A(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function B(e,n,r,t){if(t<=0)return;let s=e.get(n);s||(s=new Map,e.set(n,s)),s.set(r,(s.get(r)??0)+t)}function $(e,n){return n.occurrences>1?!1:f(e,n.sourceFile).some(r=>r.used||r.sourcePath!==n.target.relativePath?!1:r.importedName===n.name||r.localName===n.name)}function H(e,n,r,t){for(let s of n){let a=S(e,s);if(a.length===0)continue;let i=r.get(s.symbolId);i||(i=new Map,r.set(s.symbolId,i));for(let l of a){let o=l.file;o===s.relativePath||e.isIgnored(o)||t.inactiveBarrelPaths.has(o)||!t.includeTests&&!C(o)||i.set(o,Math.max(1,i.get(o)??0))}}}function U(e){let n=new Map,r=t=>{let s=n.get(t);if(s)return s;let a=m(e,t);return s={ranges:a.map(i=>({startLine:i.startLine,endLine:i.endLine})),containers:new Set(a.map(i=>i.containerName).filter(i=>!!i))},n.set(t,s),s};return(t,s,a,i)=>{let l=r(t);for(let o of l.ranges)if(s>=o.startLine&&s<=o.endLine)return!0;if(i&&l.containers.has(i))return!0;for(let o of c(a))if(l.containers.has(o))return!0;return!1}}function C(e){return[...new Set([...F,...L])].every(r=>!W(e,r))}function W(e,n){return new RegExp(`^${n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/%/g,".*").replace(/_/g,".")}$`).test(e)}function T(e){return g(e)||e.endsWith("().")||e.endsWith(".")}function j(e){return p(e.symbol)||c(e.symbol).length===0}export{Q as a};
12
+ //# sourceMappingURL=chunk-MO32JMOD.js.map
@@ -0,0 +1,6 @@
1
+ import{a as p}from"./chunk-ZHHMG4UC.js";import{existsSync as f}from"fs";import{basename as u,isAbsolute as g,join as d}from"path";function S(t,o){let e=h(t,o,{allowMultiple:!1})[0]?.relativePath;return e||v(t,o)}function b(t,o){return h(t,o,{allowMultiple:!0}).map(e=>e.relativePath)}function v(t,o){if(!o)return null;let e=o.replace(/\\/g,"/").replace(/^\.\//,""),i=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,n=d(t.config.projectRoot,i);return f(n)?i:null}function h(t,o,e){let i=m(o);if(!i)return[];let a=t.all(`SELECT relative_path
2
+ FROM documents
3
+ WHERE 1 = 1
4
+ ${t.pathExclusionsFor("documents")}
5
+ ORDER BY relative_path`).filter(r=>!t.isIgnored(r.relative_path)).map(r=>({relativePath:r.relative_path,score:x(r.relative_path,i)})).filter(r=>r.score>0).sort((r,c)=>c.score-r.score||r.relativePath.localeCompare(c.relativePath));if(a.length===0){let r=p(t,o);return!r||t.isIgnored(r.relativePath)?[]:[{relativePath:r.relativePath,score:700}]}let s=a.filter(r=>r.score>=1100);if(s.length>0)return e.allowMultiple?s:[s[0]];let l=a.filter(r=>r.score>=800);return l.length>0?e.allowMultiple?l:[l[0]]:e.allowMultiple?a:[a[0]]}function x(t,o){let e=m(t),i=u(e),n=u(o),a=0;return e===o&&(a+=1200),e.endsWith(`/${o}`)&&(a+=1100),i===n&&(a+=900),e.startsWith(`${o}/`)&&(a+=850),e.includes(o)&&(a+=250),a}function m(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,b};
6
+ //# sourceMappingURL=chunk-MO65UK5V.js.map
@@ -0,0 +1,2 @@
1
+ import{a as d}from"./chunk-32R4VYYA.js";import{b as m}from"./chunk-4X7C236P.js";import{f as i,o as p,p as u}from"./chunk-QFZE73XF.js";function E(a,y={}){let{scope:b,minLoc:f=3}=y,r=new d(a),s=r.productionCallableDefinitions({scope:b,minLoc:f,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0}),L=r.crossFileCallerMap(s),h=r.sourceFallbackCallerFiles(s),c=new Set([...L.keys(),...h.keys()]),l=new Map;for(let e of s){let t=u(e.symbol);if(!t)continue;let o=l.get(t)??[];o.push(e.symbolId),l.set(t,o)}let v=a.all(`SELECT relative_path FROM documents WHERE 1 = 1 ${a.pathExclusionsFor("documents")}`);for(let e of v){if(a.isIgnored(e.relative_path)||i(e.relative_path)!=="rust")continue;let t=m(a,e.relative_path);for(let o of t){let n=l.get(o);if(n)for(let M of n)c.add(M)}}let I=new Map(s.map(e=>[e.symbolId,e.symbol])),S=r.calleeMap(s,{additive:!0}),C=new Set([...S.entries()].filter(([e,t])=>{let o=I.get(e);return t.some(n=>n.symbol!==o)}).map(([e])=>e));return s.filter(e=>!c.has(e.symbolId)).filter(e=>!C.has(e.symbolId)).sort((e,t)=>t.endLine-t.startLine-(e.endLine-e.startLine)||e.relativePath.localeCompare(t.relativePath)||e.startLine-t.startLine).map(e=>({symbol:e.symbol,shortName:p(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1}))}export{E as a};
2
+ //# sourceMappingURL=chunk-MTK3JAJT.js.map
@@ -1,6 +1,6 @@
1
- import{b as o}from"./chunk-4HCKXL7T.js";import{s as m}from"./chunk-QL5MJOVA.js";function y(t,l){let s=o(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
1
+ import{b as m}from"./chunk-MO65UK5V.js";import{D as o}from"./chunk-QFZE73XF.js";function y(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
2
2
  WHERE relative_path IN (${d})
3
- ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=m(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
3
+ ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),a=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),n=t.all(`SELECT DISTINCT d2.relative_path
4
4
  FROM mentions m
5
5
  JOIN chunks c ON m.chunk_id = c.id
6
6
  JOIN documents d1 ON c.document_id = d1.id
@@ -31,5 +31,5 @@ import{b as o}from"./chunk-4HCKXL7T.js";import{s as m}from"./chunk-QL5MJOVA.js";
31
31
  JOIN documents d2 ON sym_def.document_id = d2.id
32
32
  WHERE d2.relative_path IN (${d})
33
33
  AND d1.relative_path NOT IN (${d})
34
- ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{y as a};
35
- //# sourceMappingURL=chunk-6UJ5PXER.js.map
34
+ ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:a,dependsOn:n,dependedOnBy:r}}export{y as a};
35
+ //# sourceMappingURL=chunk-MXWC53GJ.js.map
@@ -1,3 +1,3 @@
1
- import{a as f}from"./chunk-MWCN46ZX.js";import{a as g,b as m}from"./chunk-5IM4IQ6N.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-IVT2U2BV.js.map
1
+ import{a as d}from"./chunk-ZHHMG4UC.js";import{n as g,o as m}from"./chunk-QFZE73XF.js";function S(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
2
+ WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.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-OQZF2DQJ.js.map
@@ -0,0 +1,6 @@
1
+ import{a as F,b as d,d as R,e as $}from"./chunk-RKTDEIHF.js";import{a as k}from"./chunk-32R4VYYA.js";import{h as B}from"./chunk-4X7C236P.js";import{a as x}from"./chunk-ZHHMG4UC.js";import{d as P,o as p,p as M,s as w,v as q}from"./chunk-QFZE73XF.js";function ne(t,i,e={}){let{minSimilarity:r=.4,limit:a=20}=e,s=V(t,i);if(!s)return[];if(!w(s.symbol))return[];let n=_(t,s,r);return n.length>0?n.slice(0,a):U(t,i,{minSimilarity:r,limit:a})}function _(t,i,e){let r=E(t,{minCallees:3,excludeSymbol:i.symbol}),a=R([i,...r].map(n=>n.callees)),s=[];for(let n of r){if(n.callees.size<3)continue;let l=v(i,n,a,{minSimilarity:e,requireSignificantShared:1,requireSharedCount:0});l&&s.push(l)}return s.sort((n,l)=>l.similarity-n.similarity),s}function v(t,i,e,r){let{similarity:a,significantShared:s}=$(t.callees,i.callees,e);if(a<r.minSimilarity)return null;let n=F(t.callees,i.callees).size;if(s.length<r.requireSignificantShared&&n<r.requireSharedCount)return null;let l=s.length>0?s:[...F(t.callees,i.callees)];return{symbolA:t.symbol,shortNameA:p(t.symbol),fileA:t.file,symbolB:i.symbol,shortNameB:p(i.symbol),fileB:i.file,similarity:a,similarityBasis:"callees",sharedCallees:l.map(p),uniqueToA:[...d(t.callees,i.callees)].map(p),uniqueToB:[...d(i.callees,t.callees)].map(p)}}function re(t,i={}){let{minSimilarity:e=.5,limit:r=20,scope:a,minCallees:s=4,crossFileOnly:n=!1}=i,l=E(t,{minCallees:s,scope:a}),o=R(l.map(c=>c.callees)),u=new Map;for(let c of l)for(let m of c.callees)u.set(m,(u.get(m)??0)+1);let f=Math.max(8,Math.ceil(Math.sqrt(l.length))),S=new Map;for(let c=0;c<l.length;c+=1)for(let m of l[c].callees){if((u.get(m)??0)>f)continue;let g=S.get(m);g||(g=[],S.set(m,g)),g.push(c)}let C=[],A=new Set;e:for(let c=0;c<l.length;c+=1){let m=l[c],g=new Set;for(let D of m.callees){let y=S.get(D);if(y)for(let b of y)b>c&&g.add(b)}for(let D of g){let y=`${c}|${D}`;if(A.has(y))continue;A.add(y);let b=l[D];if(n&&m.file===b.file)continue;if(m.paramCount>=0&&b.paramCount>=0){let j=Math.abs(m.paramCount-b.paramCount),L=Math.max(2,Math.ceil(Math.max(m.paramCount,b.paramCount)*.5));if(j>L)continue}let z=v(m,b,o,{minSimilarity:e,requireSignificantShared:2,requireSharedCount:4});if(z&&(C.push(z),C.length>r*5))break e}}return C.sort((c,m)=>m.similarity-c.similarity),C.slice(0,r)}var O=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function V(t,i){let e=x(t,i),r=new k(t);if(!e)return null;let a=B(t,e);return{symbol:e.symbol,file:e.relativePath,callees:I(a.map(s=>s.symbol)),paramCount:r.callableSignature(e)?.paramCount??-1}}function E(t,i){let{minCallees:e,scope:r,excludeSymbol:a}=i,s=new k(t),n=s.productionCallableDefinitions({scope:r,minLoc:5,excludeSymbol:a}),l=s.calleeMap(n);return n.map(o=>({symbol:o.symbol,file:o.relativePath,callees:I((l.get(o.symbolId)??[]).map(u=>u.symbol)),paramCount:s.callableSignature(o)?.paramCount??-1})).filter(o=>o.callees.size>=e)}function I(t){return new Set([...t].filter(i=>!Z(i)))}function Z(t){return O.some(i=>t.includes(i))}function U(t,i,e){let r=W(t,i);if(!r||r.tokens.size<3)return[];let a=e.minSimilarity>=.5?e.minSimilarity:.3,s=[];for(let n of G(t)){if(n.symbol===r.symbol||n.tokens.size<3)continue;let l=F(r.tokens,n.tokens);if(l.size<2)continue;let o=new Set([...r.tokens,...n.tokens]),u=o.size>0?l.size/o.size:0;u<a||s.push({symbolA:r.symbol,shortNameA:p(r.symbol),fileA:r.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:u,similarityBasis:"source-tokens",sharedCallees:[...l].sort(),uniqueToA:[...d(r.tokens,n.tokens)].sort(),uniqueToB:[...d(n.tokens,r.tokens)].sort()})}return s.sort((n,l)=>l.similarity-n.similarity||n.shortNameB.localeCompare(l.shortNameB)),s.slice(0,e.limit)}function W(t,i){let e=x(t,i);if(!e||!w(e.symbol))return null;let r=K(t,e);return r?{symbol:e.symbol,file:e.relativePath,tokens:r}:null}function K(t,i){let e=M(i.symbol),r=N(t,i.relativePath,i.startLine,i.endLine,e),a=T(r,e);return a.size>0?a:null}function G(t){let i=new k(t);return i.scopedDefinitions().filter(e=>e.isFunctionLike).filter(e=>i.fileKind(e.relativePath)!=="test").filter(e=>!q(e.symbol)).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:T(N(t,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function N(t,i,e,r,a){let s=P(t,i);if(!s)return"";let n=s.split(`
2
+ `);if(r>=e&&r-e<=12)return n.slice(e,r+1).join(`
3
+ `);let l=[new RegExp(`\\bdef\\s+${h(a)}\\b`),new RegExp(`\\bfun\\s+${h(a)}\\b`),new RegExp(`\\bfn\\s+${h(a)}\\b`),new RegExp(`\\bfunction\\s+${h(a)}\\b`),new RegExp(`\\b${h(a)}\\s*\\(`)],o=n.findIndex(u=>l.some(f=>f.test(u)));if(o>=0){let u=o;for(let f=o+1;f<n.length&&f<=o+8;f++){let S=n[f]??"";if(f>o&&J(S)||(u=f,S.trim()===""&&f>o+1))break}return n.slice(o,u+1).join(`
4
+ `)}return n.slice(e,Math.min(n.length,e+8)).join(`
5
+ `)}function T(t,i){if(!t)return new Set;let e=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"]),r=H(i),s=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=>!e.has(n)).filter(n=>!r.has(n));return new Set(s)}function H(t){return new Set(t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(i=>i.toLowerCase()).filter(i=>i.length>1))}function J(t){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(t)}function h(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ne as a,re as b};
6
+ //# sourceMappingURL=chunk-PBFMZKXE.js.map
@@ -1,8 +1,8 @@
1
- import{a as l}from"./chunk-4HCKXL7T.js";import{g as r}from"./chunk-FT4WPAEX.js";import{a as c}from"./chunk-MWCN46ZX.js";import{b as d}from"./chunk-5IM4IQ6N.js";function f(e,t){let o=c(e,t);if(!o)return[];let i=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
1
+ import{a as r}from"./chunk-MO65UK5V.js";import{g as l}from"./chunk-4X7C236P.js";import{a as c}from"./chunk-ZHHMG4UC.js";import{o as d}from"./chunk-QFZE73XF.js";function f(e,t){let o=c(e,t);if(!o)return[];let i=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  WHERE m.symbol_id = ?
5
- AND m.role != 1`,o.symbolId);return[{name:d(o.symbol),count:i?.file_count??0}]}function y(e,t){let o=l(e,t);if(!o)return[];let n=e.all(`SELECT d.relative_path, COUNT(DISTINCT gs.id) AS symbol_count
5
+ AND m.role != 1`,o.symbolId);return[{name:d(o.symbol),count:i?.file_count??0}]}function y(e,t){let o=r(e,t);if(!o)return[];let n=e.all(`SELECT d.relative_path, COUNT(DISTINCT gs.id) AS symbol_count
6
6
  FROM mentions m
7
7
  JOIN chunks c ON m.chunk_id = c.id
8
8
  JOIN documents d ON c.document_id = d.id
@@ -19,7 +19,7 @@ import{a as l}from"./chunk-4HCKXL7T.js";import{g as r}from"./chunk-FT4WPAEX.js";
19
19
  AND m.role != 1
20
20
  AND def_d.id != d.id
21
21
  GROUP BY d.id
22
- ORDER BY symbol_count DESC`,o).filter(m=>!e.isIgnored(m.relative_path)).map(m=>({name:m.relative_path,count:m.symbol_count}));if(n.length>0)return n;let s=r(e).get(o);return!s||s.size===0?[]:[{name:o,count:s.size}]}function b(e,t={}){return _(e,t).map(o=>({name:d(o.symbol),count:o.file_count}))}function _(e,t){let{limit:o=30,scope:i}=t,n=i?`AND def_d.relative_path LIKE '%${i}%'`:"";return e.all(`SELECT gs.symbol, COUNT(DISTINCT c.document_id) AS file_count
22
+ ORDER BY symbol_count DESC`,o).filter(m=>!e.isIgnored(m.relative_path)).map(m=>({name:m.relative_path,count:m.symbol_count}));if(n.length>0)return n;let s=l(e).get(o);return!s||s.size===0?[]:[{name:o,count:s.size}]}function b(e,t={}){return _(e,t).map(o=>({name:d(o.symbol),count:o.file_count}))}function _(e,t){let{limit:o=30,scope:i}=t,n=i?`AND def_d.relative_path LIKE '%${i}%'`:"";return e.all(`SELECT gs.symbol, COUNT(DISTINCT c.document_id) AS file_count
23
23
  FROM mentions m
24
24
  JOIN chunks c ON m.chunk_id = c.id
25
25
  JOIN global_symbols gs ON m.symbol_id = gs.id
@@ -59,4 +59,4 @@ import{a as l}from"./chunk-4HCKXL7T.js";import{g as r}from"./chunk-FT4WPAEX.js";
59
59
  GROUP BY d.id
60
60
  ORDER BY symbol_count DESC
61
61
  LIMIT ?`,o).filter(s=>!e.isIgnored(s.relative_path)).map(s=>({name:s.relative_path,count:s.symbol_count}))}export{f as a,y as b,b as c,I as d};
62
- //# sourceMappingURL=chunk-LAXFZ3UW.js.map
62
+ //# sourceMappingURL=chunk-PFMGJ4BR.js.map
@@ -1,2 +1,2 @@
1
- import{c as a}from"./chunk-IDCWMWWP.js";import{g as p}from"./chunk-FT4WPAEX.js";import{b as f}from"./chunk-QL5MJOVA.js";function c(t){let r=o(t);return x(r)?"test":S(r)?"worker":y(r)?"entry":P(r)?"barrel":"source"}function _(t){return c(t)==="barrel"}function g(t){return h.get(t,()=>{let r=p(t),e=a(t).filter(s=>{let u=c(s);return u==="entry"||u==="worker"}),n=new Set,i=new Set;for(;e.length>0;){let s=e.shift();if(!n.has(s)){n.add(s),c(s)==="barrel"&&i.add(s);for(let u of r.get(s)??[])n.has(u)||e.push(u)}}return i})}var h=f("live-barrels");function b(t,r){return g(t).has(o(r))}function w(t){let r=g(t);return a(t).filter(e=>_(e)&&!r.has(e))}function D(t,r){let e=c(r);return e==="entry"||e==="worker"||b(t,r)}function E(t,r,e){let n=t.config.entryRoots;if(!n)return!1;let i=o(e);return!!(n.files?.some(s=>o(s)===i)||n.pathPrefixes?.some(s=>i.startsWith(o(s)))||n.qualifiedVars?.some(s=>$(r,s))||n.symbolPatterns?.some(s=>{try{return new RegExp(s).test(r)}catch{return!1}}))}var m=["%/__tests__/%","%.test.%","%.spec.%","%/test/%","%/tests/%","%_test.%","%_spec.%","%/test_%.%","%/spec_%.%"],B=["%/test-utils/%"];function x(t){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(t)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(t)||/(?:^|\/)spec_[^/]+$/i.test(t)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(t)||/(?:^|\/)[^/]+_tests\.rs$/i.test(t)||/(?:^|\/)tests\.rs$/i.test(t)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(t)||/(?:^|\/)__tests__\//i.test(t)||/(?:^|\/)test\//i.test(t)||/(?:^|\/)tests\//i.test(t)||/(?:^|\/)__fixtures__\//i.test(t)||/(?:^|\/)__mocks__\//i.test(t)||/(?:^|\/)test-support\//i.test(t)||/(?:^|\/)test-utils\//i.test(t)||/(?:^|\/)testing\//i.test(t))}function S(t){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(t)}function y(t){let r=t.split("/"),e=r[r.length-1]??t;return e==="cli.ts"||e==="cli.js"||e==="postinstall.ts"||e==="postinstall.js"||e==="main.ts"||e==="main.js"||e==="main.rs"||e==="main.go"||e==="main.py"||e==="build.rs"||e==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(t)||/(?:^|\/)examples\/[^/]+\.rs$/.test(t)||/(?:^|\/)tests\/[^/]+\.rs$/.test(t)||/(?:^|\/)benches\/[^/]+\.rs$/.test(t)?!0:e==="index.ts"||e==="index.js"?r.length<=2:!1}function P(t){return t==="index.ts"||t==="index.js"||t.endsWith("/index.ts")||t.endsWith("/index.js")||t.endsWith("/mod.rs")||t.endsWith("/__init__.py")}function o(t){return t.replace(/\\/g,"/")}function $(t,r){let e=r.lastIndexOf("/");if(e<0)return!1;let n=r.slice(0,e),i=r.slice(e+1);return t.includes(l(n)+"/")&&t.includes(l(i)+".")}function l(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}export{c as a,_ as b,b as c,w as d,D as e,E as f,m as g,B as h};
2
- //# sourceMappingURL=chunk-QID23O53.js.map
1
+ import{c as a}from"./chunk-KTCODJNQ.js";import{g as p}from"./chunk-4X7C236P.js";import{b as f}from"./chunk-QFZE73XF.js";function c(t){let r=o(t);return x(r)?"test":S(r)?"worker":y(r)?"entry":P(r)?"barrel":"source"}function _(t){return c(t)==="barrel"}function g(t){return h.get(t,()=>{let r=p(t),e=a(t).filter(s=>{let u=c(s);return u==="entry"||u==="worker"}),n=new Set,i=new Set;for(;e.length>0;){let s=e.shift();if(!n.has(s)){n.add(s),c(s)==="barrel"&&i.add(s);for(let u of r.get(s)??[])n.has(u)||e.push(u)}}return i})}var h=f("live-barrels");function b(t,r){return g(t).has(o(r))}function w(t){let r=g(t);return a(t).filter(e=>_(e)&&!r.has(e))}function D(t,r){let e=c(r);return e==="entry"||e==="worker"||b(t,r)}function E(t,r,e){let n=t.config.entryRoots;if(!n)return!1;let i=o(e);return!!(n.files?.some(s=>o(s)===i)||n.pathPrefixes?.some(s=>i.startsWith(o(s)))||n.qualifiedVars?.some(s=>$(r,s))||n.symbolPatterns?.some(s=>{try{return new RegExp(s).test(r)}catch{return!1}}))}var v=["%/__tests__/%","%.test.%","%.spec.%","%/test/%","%/tests/%","%_test.%","%_spec.%","%/test_%.%","%/spec_%.%"],B=["%/test-utils/%"];function x(t){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(t)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(t)||/(?:^|\/)spec_[^/]+$/i.test(t)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(t)||/(?:^|\/)[^/]+_tests\.rs$/i.test(t)||/(?:^|\/)tests\.rs$/i.test(t)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(t)||/(?:^|\/)__tests__\//i.test(t)||/(?:^|\/)test\//i.test(t)||/(?:^|\/)tests\//i.test(t)||/(?:^|\/)__fixtures__\//i.test(t)||/(?:^|\/)__mocks__\//i.test(t)||/(?:^|\/)test-support\//i.test(t)||/(?:^|\/)test-utils\//i.test(t)||/(?:^|\/)testing\//i.test(t))}function S(t){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(t)}function y(t){let r=t.split("/"),e=r[r.length-1]??t;return e==="cli.ts"||e==="cli.js"||e==="postinstall.ts"||e==="postinstall.js"||e==="main.ts"||e==="main.js"||e==="main.rs"||e==="main.go"||e==="main.py"||e==="build.rs"||e==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(t)||/(?:^|\/)examples\/[^/]+\.rs$/.test(t)||/(?:^|\/)tests\/[^/]+\.rs$/.test(t)||/(?:^|\/)benches\/[^/]+\.rs$/.test(t)?!0:e==="index.ts"||e==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(t)?!0:r.length<=2:!1}function P(t){return t==="index.ts"||t==="index.js"||t.endsWith("/index.ts")||t.endsWith("/index.js")||t.endsWith("/mod.rs")||t.endsWith("/__init__.py")}function o(t){return t.replace(/\\/g,"/")}function $(t,r){let e=r.lastIndexOf("/");if(e<0)return!1;let n=r.slice(0,e),i=r.slice(e+1);return t.includes(l(n)+"/")&&t.includes(l(i)+".")}function l(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}export{c as a,_ as b,b as c,w as d,D as e,E as f,v as g,B as h};
2
+ //# sourceMappingURL=chunk-PK4U6NWP.js.map
@@ -1,4 +1,4 @@
1
- import{a as m}from"./chunk-4HCKXL7T.js";function c(e,n,o){let d=m(e,n)??n,s=m(e,o)??o,t=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
1
+ import{a as m}from"./chunk-MO65UK5V.js";function r(e,o,n){let d=m(e,o)??o,s=m(e,n)??n,t=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
2
2
  FROM global_symbols gs
3
3
  WHERE (
4
4
  -- Defined in file1, referenced in file2
@@ -30,7 +30,7 @@ import{a as m}from"./chunk-4HCKXL7T.js";function c(e,n,o){let d=m(e,n)??n,s=m(e,
30
30
  JOIN documents d ON c.document_id = d.id
31
31
  WHERE m.symbol_id = gs.id AND m.role != 1 AND d.relative_path = ?
32
32
  )
33
- )`,d,s,s,d);return{file1:d,file2:s,sharedSymbols:t?.shared??0}}function r(e,n={}){let{limit:o=20,scope:d}=n,s=d?`AND d1.relative_path LIKE '%${d}%' AND d2.relative_path LIKE '%${d}%'`:"";return e.all(`SELECT
33
+ )`,d,s,s,d);return{file1:d,file2:s,sharedSymbols:t?.shared??0}}function c(e,o={}){let{limit:n=20,scope:d}=o,s=d?`AND d1.relative_path LIKE '%${d}%' AND d2.relative_path LIKE '%${d}%'`:"";return e.all(`SELECT
34
34
  def_d.relative_path AS file1,
35
35
  ref_d.relative_path AS file2,
36
36
  COUNT(DISTINCT gs.id) AS shared
@@ -52,5 +52,5 @@ import{a as m}from"./chunk-4HCKXL7T.js";function c(e,n,o){let d=m(e,n)??n,s=m(e,
52
52
  ${s}
53
53
  GROUP BY def_d.id, ref_d.id
54
54
  ORDER BY shared DESC
55
- LIMIT ?`,o).filter(i=>!e.isIgnored(i.file1)&&!e.isIgnored(i.file2)).map(i=>({file1:i.file1,file2:i.file2,sharedSymbols:i.shared}))}export{c as a,r as b};
56
- //# sourceMappingURL=chunk-GALIM3IE.js.map
55
+ LIMIT ?`,n).filter(i=>!e.isIgnored(i.file1)&&!e.isIgnored(i.file2)).map(i=>({file1:i.file1,file2:i.file2,sharedSymbols:i.shared}))}export{r as a,c as b};
56
+ //# sourceMappingURL=chunk-Q2ALKKSE.js.map
@@ -0,0 +1,39 @@
1
+ import{a as g}from"./chunk-MO65UK5V.js";import{e as a}from"./chunk-2ZGHRI2A.js";import{n as u}from"./chunk-YU25IHJX.js";import{a as p}from"./chunk-ZHHMG4UC.js";import{o as l,p as c,t as f}from"./chunk-QFZE73XF.js";function T(t,r){return h(t,r)?.map(e=>({symbol:e.symbol,shortName:e.shortName,fromFile:e.fromFile}))??[]}function M(t,r){let e=E(t,r);return e.length>0?e:N(t,r)}function J(t,r){return h(t,r)?.filter(e=>!e.used).map(e=>({symbol:e.symbol,shortName:e.shortName,importedIn:e.importer}))??[]}function E(t,r){return t.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d ON c.document_id = d.id
5
+ JOIN global_symbols gs ON m.symbol_id = gs.id
6
+ WHERE gs.symbol LIKE ?
7
+ AND m.role = 2
8
+ ORDER BY d.relative_path`,`%${r}%`).filter(s=>!t.isIgnored(s.importer)).map(s=>({symbol:s.symbol,shortName:l(s.symbol),fromFile:s.importer}))}function N(t,r){let e=p(t,r),s=e?.relativePath??null,o=e?c(e.symbol):r.replace(/\(\)$/,""),i=e?f(e.symbol):!1,m=t.all(`SELECT relative_path
9
+ FROM documents
10
+ WHERE 1 = 1
11
+ ${t.pathExclusionsFor("documents")}
12
+ ORDER BY relative_path`),d=new Set;for(let n of m)if(!t.isIgnored(n.relative_path))for(let b of a(t,n.relative_path))S(b,n.relative_path,{targetFile:s,targetLeaf:o,targetIsModule:i})&&d.add(n.relative_path);return[...d].sort().map(n=>({symbol:e?.symbol??o,shortName:e?l(e.symbol):o,fromFile:n}))}function S(t,r,e){return!t.sourcePath||e.targetFile&&_(t.sourcePath)!==_(e.targetFile)?!1:t.kind==="side-effect"||e.targetFile&&R(r)||e.targetIsModule||t.kind==="named"&&t.importedName===e.targetLeaf?!0:t.kind==="namespace"&&t.usedMembers.includes(e.targetLeaf)}function h(t,r){let e=g(t,r);return e?O(t,e)??F(t,e)??y(t,e):null}function O(t,r){let s=t.all(`SELECT DISTINCT
13
+ gs.symbol,
14
+ def_d.relative_path AS from_file,
15
+ imp_d.relative_path AS importer,
16
+ EXISTS (
17
+ SELECT 1
18
+ FROM mentions ref_m
19
+ JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
20
+ WHERE ref_m.symbol_id = gs.id
21
+ AND ref_m.role != 1
22
+ AND ref_c.document_id = imp_d.id
23
+ ) AS used
24
+ FROM mentions m
25
+ JOIN chunks c ON m.chunk_id = c.id
26
+ JOIN documents imp_d ON c.document_id = imp_d.id
27
+ JOIN global_symbols gs ON m.symbol_id = gs.id
28
+ LEFT JOIN (
29
+ SELECT m2.symbol_id, c2.document_id
30
+ FROM mentions m2
31
+ JOIN chunks c2 ON m2.chunk_id = c2.id
32
+ WHERE m2.role = 1
33
+ GROUP BY m2.symbol_id
34
+ ) sym_def ON sym_def.symbol_id = gs.id
35
+ LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
36
+ WHERE imp_d.relative_path = ?
37
+ AND m.role = 2
38
+ ORDER BY def_d.relative_path, gs.symbol`,r).filter(o=>!t.isIgnored(o.importer));if(s.length>0){let o=u(t,r);return s.map(i=>({symbol:i.symbol,shortName:l(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||o.some(m=>m.isUsed&&m.sourcePath===i.from_file)}))}return null}function F(t,r){let e=u(t,r);return e.length>0?e.map(s=>{let o=I(s.importedName,s.localName,s.kind);return{symbol:o,shortName:o,fromFile:s.sourcePath??"(external)",importer:r,used:s.kind==="side-effect"?!0:s.isUsed}}):null}function y(t,r){return a(t,r).map(e=>{let s=I(e.importedName,e.localName,e.kind),o=e.kind==="side-effect"?!0:e.used;return{symbol:s,shortName:s,fromFile:e.sourcePath??"(external)",importer:r,used:o}})}function I(t,r,e){return e==="namespace"&&t==="*"&&r?`* as ${r}`:e==="default"&&r?`default as ${r}`:e==="side-effect"?"(side effect import)":r&&r!==t?`${t} as ${r}`:t}function _(t){return t.replace(/\\/g,"/")}function R(t){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(t)}export{T as a,M as b,J as c};
39
+ //# sourceMappingURL=chunk-QFCK6WV2.js.map
@@ -0,0 +1,84 @@
1
+ function h(e){let n=new WeakMap,t=r=>{let i=n.get(r);return i||(i=new Map,n.set(r,i)),i};return{get(r,i,a){let s=t(r);if(s.has(i))return s.get(i);let c=a();return s.set(i,c),c},invalidate(r,i){n.get(r)?.delete(i)},invalidateAll(r){n.delete(r)},size(r){return n.get(r)?.size??0}}}function Fe(e){let n=new WeakMap;return{get(t,r){let i=n.get(t);if(i)return i.value;let a=r();return n.set(t,{value:a}),a},invalidate(t){n.delete(t)},has(t){return n.has(t)}}}function I(e){let n=new WeakMap,t=r=>{let i=n.get(r);return i||(i=new Map,n.set(r,i)),i};return{get(r,i,a,s){let c=t(r),o=c.get(i);if(o&&o.source===a)return o.value;let l=s();return c.set(i,{source:a,value:l}),l},invalidate(r,i){n.get(r)?.delete(i)},invalidateAll(r){n.delete(r)}}}import{existsSync as K,readFileSync as G}from"fs";import{join as q}from"path";var J=h("source-text");function m(e,n){let t=n.replace(/\\/g,"/");return J.get(e,t,()=>{let r=q(e.config.projectRoot,t);return K(r)?G(r,"utf-8"):""})}var X=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale|wrapper|passthrough|drift|extract)?/i;function Be(e,n,t){if(t<=0)return!1;let r=m(e,n);if(!r)return!1;let i=r.split(`
2
+ `);for(let a=t-1;a>=0&&a>=t-5;a-=1){let s=(i[a]??"").trim();if(s!==""){if(X.test(s))return!0;if(!s.startsWith("//")&&!s.startsWith("*")&&!s.startsWith("/*")&&!s.startsWith("@")&&!s.startsWith("#"))return!1}}return!1}import{extname as N}from"path";import{createRequire as Z}from"module";var f=Z(import.meta.url),x=null,M=!1;function T(){if(M)return null;if(x)return x;try{return x=f("tree-sitter"),x}catch{return M=!0,null}}var ee={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb"},A=new Map,L=new Set;function E(e){if(L.has(e))return null;let n=A.get(e);if(n)return n;let t;try{switch(e){case"rust":t=f("tree-sitter-rust");break;case"typescript":t=f("tree-sitter-typescript").typescript;break;case"tsx":t=f("tree-sitter-typescript").tsx;break;case"javascript":t=f("tree-sitter-javascript");break;case"python":t=f("tree-sitter-python");break;case"java":t=f("tree-sitter-java");break;case"kotlin":t=f("tree-sitter-kotlin");break;case"scala":t=f("tree-sitter-scala");break;case"ruby":t=f("tree-sitter-ruby");break;case"c":t=f("tree-sitter-c");break;case"cpp":t=f("tree-sitter-cpp");break;case"csharp":t=f("tree-sitter-c-sharp");break;case"php":t=f("tree-sitter-php").php;break;case"vb":{let r=f("tree-sitter-vb-dotnet");t=r.language??r;break}}}catch{return L.add(e),null}return A.set(e,t),t}var w=new Map;function P(e){let n=w.get(e);if(n)return n;let t=E(e);if(!t)return null;let r=T();if(!r)return null;let i=new r;try{i.setLanguage(t)}catch{return L.add(e),null}return w.set(e,i),i}function S(e){return ee[N(e).toLowerCase()]??null}function te(e){return N(e).toLowerCase()===".vue"}var O=I("ast-trees");function C(e,n){if(te(n))return ne(e,n);let t=S(n);if(!t)return null;let r=m(e,n);return r?O.get(e,n,r,()=>{let i=P(t);if(!i)return null;try{return $(i,r)}catch{return null}}):null}function ne(e,n){let t=m(e,n);return t?O.get(e,n,t,()=>{let r=re(t);if(!r)return null;let i=P(r.language);if(!i)return null;let a=`
3
+ `.repeat(r.startLine)+r.body;try{return $(i,a)}catch{return null}}):null}function $(e,n){return e.parse(r=>r>=n.length?null:n.slice(r,Math.min(n.length,r+16384)))}function re(e){let n=[],t=/<script\b([^>]*)>([\s\S]*?)<\/script>/g;for(let o of e.matchAll(t))typeof o.index=="number"&&n.push({tagOpen:o[1]??"",body:o[2]??"",openIdx:o.index+(o[0].length-(o[2]?.length??0)-9)});if(n.length===0)return null;let r=n.find(o=>/\bsetup\b/.test(o.tagOpen))??n[0],a=r.tagOpen.match(/\blang\s*=\s*["']?([\w-]+)/)?.[1]?.toLowerCase(),s=a==="ts"||a==="typescript"?"typescript":a==="tsx"?"tsx":"javascript",c=ie(e,r.openIdx);return{body:r.body,startLine:c,language:s}}function ie(e,n){let t=0;for(let r=0;r<n&&r<e.length;r++)e.charCodeAt(r)===10&&t++;return t}var g=new Map;function ae(e,n){let t=`${e}::${n}`;if(g.has(t))return g.get(t)??null;let r=E(e);if(!r)return g.set(t,null),null;let i=T();if(!i)return g.set(t,null),null;try{let a=new i.Query(r,n);return g.set(t,a),a}catch{return g.set(t,null),null}}var se={rust:`
4
+ (function_item name: (identifier) @name) @def
5
+ (function_signature_item name: (identifier) @name) @def
6
+ `,typescript:`
7
+ (function_declaration name: (identifier) @name) @def
8
+ (method_definition name: (property_identifier) @name) @def
9
+ (method_signature name: (property_identifier) @name) @def
10
+ (function_signature name: (identifier) @name) @def
11
+ (variable_declarator name: (identifier) @name value: (arrow_function)) @def
12
+ (variable_declarator name: (identifier) @name value: (function_expression)) @def
13
+ (public_field_definition name: (property_identifier) @name value: (arrow_function)) @def
14
+ `,tsx:`
15
+ (function_declaration name: (identifier) @name) @def
16
+ (method_definition name: (property_identifier) @name) @def
17
+ (method_signature name: (property_identifier) @name) @def
18
+ (function_signature name: (identifier) @name) @def
19
+ (variable_declarator name: (identifier) @name value: (arrow_function)) @def
20
+ (variable_declarator name: (identifier) @name value: (function_expression)) @def
21
+ (public_field_definition name: (property_identifier) @name value: (arrow_function)) @def
22
+ `,javascript:`
23
+ (function_declaration name: (identifier) @name) @def
24
+ (method_definition name: (property_identifier) @name) @def
25
+ (variable_declarator name: (identifier) @name value: (arrow_function)) @def
26
+ (variable_declarator name: (identifier) @name value: (function_expression)) @def
27
+ `,python:`
28
+ (function_definition name: (identifier) @name) @def
29
+ `},oe=new WeakMap;function F(e,n){return j(e,n,oe,se,t=>{let r=[];for(let i of t){let a=null,s=null;for(let c of i.captures)c.name==="name"?a=c.node.text:c.name==="def"&&(s={startLine:c.node.startPosition.row,endLine:c.node.endPosition.row});a&&s&&r.push({name:a,startLine:s.startLine,endLine:s.endLine})}return r})}var ce={rust:`
30
+ (call_expression function: (_) @target) @call
31
+ (macro_invocation macro: (_) @target) @call
32
+ `,typescript:`
33
+ (call_expression function: (_) @target) @call
34
+ (new_expression constructor: (_) @target) @call
35
+ `,tsx:`
36
+ (call_expression function: (_) @target) @call
37
+ (new_expression constructor: (_) @target) @call
38
+ `,javascript:`
39
+ (call_expression function: (_) @target) @call
40
+ (new_expression constructor: (_) @target) @call
41
+ `,python:`
42
+ (call function: (_) @target) @call
43
+ `},le=new WeakMap;function Ge(e,n){return j(e,n,le,ce,t=>{let r=[];for(let i of t){let a=null,s=null;for(let o of i.captures)o.name==="target"?a=o.node:o.name==="call"&&(s=o.node);if(!a||!s)continue;let c=D(a);c&&r.push({calleeLeaf:c,memberAccess:ue(a),line:s.startPosition.row})}return r})}function ue(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function qe(e,n){return de(e,n,fe,()=>new Map,(t,r,i)=>{let a=(o,l)=>{if(o===l)return;let u=i.get(o);u||(u=new Set,i.set(o,u)),u.add(l)},s=r==="python"?new Set(["identifier"]):new Set(["type_identifier"]),c=(o,l)=>{let u=d=>{s.has(d.type)&&d.text!==l&&a(d.text,l);for(let y of d.children)u(y)};for(let d of o.children)u(d)};if(r==="rust")for(let o of t.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let l=o.namedChildren.find(d=>d.type==="type_identifier")?.text;if(!l)continue;let u=o.namedChildren.find(d=>d.type==="field_declaration_list"||d.type==="enum_variant_list"||d.type==="ordered_field_declaration_list");u&&c(u,l),o.type==="type_item"&&c(o,l)}else if(r==="python")for(let o of t.rootNode.descendantsOfType("class_definition")){let l=o.namedChildren.find(d=>d.type==="identifier")?.text;if(!l)continue;let u=o.namedChildren.find(d=>d.type==="block");if(u)for(let d of u.descendantsOfType("type"))for(let y of d.descendantsOfType("identifier"))y.text!==l&&a(y.text,l)}else for(let o of t.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let l=o.namedChildren.find(u=>u.type==="type_identifier")?.text;l&&c(o,l)}})??new Map}function de(e,n,t,r,i){let a=S(n);if(!a)return null;let s=C(e,n);if(!s)return null;let c=t.get(s);if(c)return c;let o=r();return i(s,a,o),t.set(s,o),o}function j(e,n,t,r,i){let a=S(n);if(!a)return null;let s=r[a];if(!s)return null;let c=C(e,n);if(!c)return null;let o=t.get(c);if(o)return o;let l=ae(a,s);if(!l)return null;let u=i(l.matches(c.rootNode));return t.set(c,u),u}var fe=new WeakMap,R=new WeakMap;function Je(e,n,t,r){let i=S(n);if(!i)return null;let a=C(e,n);if(!a)return null;let s=R.get(a);return s||(s=pe(a,i),R.set(a,s)),s.get(`${t}:${r}`)??null}function pe(e,n){let t=n==="rust"?new Set(["function_item","function_signature_item"]):n==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),r=new Map,i=a=>{if(t.has(a.type)){let s=a.namedChildren.find(o=>o.type==="parameters"||o.type==="formal_parameters"),c=0;if(s)for(let o of s.namedChildren)o.type==="comment"||o.type==="line_comment"||o.type==="block_comment"||(c+=1);r.set(`${a.startPosition.row}:${a.endPosition.row}`,{paramCount:c})}for(let s of a.children)i(s)};return i(e.rootNode),r}function D(e){switch(e.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return e.text;case"field_expression":case"member_expression":case"attribute":{let n=e.namedChild(e.namedChildCount-1);return n?D(n):null}case"scoped_identifier":{let n=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return n?D(n):null}case"super":case"self":case"this":return null;default:return null}}var me={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function p(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],r=n[1],i=e.slice(t.length+1+r.length+1),a;if(i.startsWith("`")){let l=i.indexOf("`",1);l===-1?(a=i.slice(1),i=""):(a=i.slice(1,l),i=i.slice(l+2))}else{let l=i.indexOf(" ");l===-1?(a=i,i=""):(a=i.slice(0,l),i=i.slice(l+1))}let s,c=i.indexOf(" ");c===-1?(s=i,i=""):(s=i.slice(0,c),i=i.slice(c+1));let o=ge(i);return{scheme:t,manager:r,packageName:a,version:s,descriptors:o,raw:e}}function ge(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let a=e.indexOf("]",t+1);if(a===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,a),suffix:"type-param"}),t=a+1;continue}if(e[t]==="("&&(n.length===0||t===0||Q(e[t-1]))){let a=e.indexOf(")",t+1);if(a!==-1&&e[a+1]!=="."){n.push({name:e.slice(t+1,a),suffix:"parameter"}),t=a+1;continue}}let r;if(e[t]==="`"){let a=e.indexOf("`",t+1);if(a===-1){r=e.slice(t+1),n.push({name:r,suffix:"term"});break}r=e.slice(t+1,a),t=a+1}else{let a=t;for(;t<e.length&&!Q(e[t]);)t++;r=e.slice(a,t)}if(t>=e.length){r&&n.push({name:r,suffix:"term"});break}let i=e[t];if(i==="("){let a=e.indexOf(")",t+1);a!==-1&&e[a+1]==="."?(n.push({name:r,suffix:"method"}),t=a+2):a!==-1?(n.push({name:r,suffix:"method"}),t=a+1):(n.push({name:r,suffix:"term"}),t++)}else{let a=me[i];a&&n.push({name:r,suffix:a}),t+=1}}return n}function Q(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function V(e){let n=p(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let r=[];for(let i of t.descriptors){let a=be(i);a&&r.push(a)}return r.join(":")}function be(e){let n=e.suffix==="namespace"?ye(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function ye(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function W(e){let n=p(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function b(e){let n=p(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Ze(e){return e.endsWith("().")||b(e)==="method"}function B(e){let n=b(e);return n==="method"||n==="term"}function et(e){return b(e)==="namespace"}var he=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function tt(e){return he.test(e)}var xe=new Set(["test","tests","_tests"]);function nt(e){let n=p(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let r=n.descriptors[t];if(r?.suffix==="namespace"&&r.name&&xe.has(r.name))return!0}return!1}function rt(e,n){let t=p(e),r=p(n);if("kind"in t||"kind"in r)return!1;let i=t.descriptors,a=r.descriptors;if(a.length!==i.length+1)return!1;for(let s=0;s<i.length;s++){let c=i[s],o=a[s];if(c.name!==o.name||c.suffix!==o.suffix)return!1}return!0}function it(e,n){let t=p(e),r=p(n);if("kind"in t||"kind"in r)return!1;let i=t.descriptors,a=r.descriptors;if(a.length<=i.length)return!1;for(let s=0;s<i.length;s++){let c=i[s],o=a[s];if(c.name!==o.name||c.suffix!==o.suffix)return!1}return!0}function z(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function U(e){if(!e)return null;let n=H(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let r=e.slice(t+1);return(H(r)??r).replace(/\n/g," ")}function H(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}var Se=h("file-definitions");function k(e,n){return Se.get(e,n,()=>{let t=Ce(_e(e,n),Le(e,n));return Ie(e,n,t.map(De))})}function _e(e,n){return e.all(`SELECT
44
+ gs.id,
45
+ gs.symbol,
46
+ der.document_id,
47
+ der.start_line,
48
+ der.end_line,
49
+ d.relative_path,
50
+ gs.display_name,
51
+ gs.kind,
52
+ gs.documentation,
53
+ gs.enclosing_symbol
54
+ FROM global_symbols gs
55
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
56
+ JOIN documents d ON der.document_id = d.id
57
+ WHERE d.relative_path = ?
58
+ ${e.symbolNoiseFor("gs")}
59
+ ORDER BY der.start_line, der.end_line`,n)}function Le(e,n){return e.all(`SELECT
60
+ gs.id,
61
+ gs.symbol,
62
+ c.document_id,
63
+ MIN(c.start_line) AS start_line,
64
+ MAX(c.end_line) AS end_line,
65
+ d.relative_path,
66
+ gs.display_name,
67
+ gs.kind,
68
+ gs.documentation,
69
+ gs.enclosing_symbol
70
+ FROM global_symbols gs
71
+ JOIN mentions m ON m.symbol_id = gs.id
72
+ JOIN chunks c ON m.chunk_id = c.id
73
+ JOIN documents d ON c.document_id = d.id
74
+ WHERE d.relative_path = ?
75
+ AND m.role = 1
76
+ ${e.symbolNoiseFor("gs")}
77
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
78
+ ORDER BY start_line, end_line`,n)}function De(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:W(e.symbol),parentTypeName:v(e.symbol),isFunctionLike:B(e.symbol),isTypeLike:b(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function Ce(e,n){let t=new Map;for(let r of n)e.length>0&&!ke(r)||t.set(r.id,r);for(let r of e)t.set(r.id,r);return[...t.values()].sort((r,i)=>r.start_line-i.start_line||r.end_line-i.end_line||r.symbol.localeCompare(i.symbol))}function ke(e){if(v(e.symbol)!==null)return!1;let t=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(t)}function ft(e,n={}){return ve(e,n.scope)}function ve(e,n){let t=n?`AND relative_path LIKE '%${n}%'`:"";return e.all(`SELECT relative_path
79
+ FROM documents
80
+ WHERE 1 = 1
81
+ ${e.pathExclusionsFor("documents")}
82
+ ${t}
83
+ ORDER BY relative_path`).flatMap(r=>k(e,r.relative_path)).filter(r=>!e.isIgnored(r.relativePath))}function pt(e,n,t={}){if(n.length===0)return[];let r=n.flatMap(i=>k(e,i)).filter(i=>!e.isIgnored(i.relativePath));return t.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),t.sort&&(r=r.sort((i,a)=>i.relativePath.localeCompare(a.relativePath)||i.startLine-a.startLine||i.endLine-a.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:V(i.symbol),signature:z(U(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function mt(e,n){let t=null;for(let r of e)r.startLine>n||r.endLine<n||(!t||r.endLine-r.startLine<t.endLine-t.startLine)&&(t=r);return t}function gt(e,n){let t=k(e,n.relative_path).find(r=>r.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function Ie(e,n,t){let r=m(e,n),i=F(e,n);return i?Te(t,i,r):r?Me(t,r):t}function Me(e,n){let t=n.split(/\r?\n/),r=Ae(e,t),i=we(e,r),a=Re(i,t);return Ne(e,a)}function Ae(e,n){let t=e.some(i=>_(i.symbol))?Pe(n):null,r=new Map;for(let i of e)r.set(i.symbolId,Ee(n,t,i));return r}function we(e,n){return e.filter(t=>_(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,r)=>t.startLine-r.startLine||t.definition.startLine-r.definition.startLine||t.definition.symbol.localeCompare(r.definition.symbol))}function Re(e,n){let t=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],a=e[r+1],s=a?Math.max(i.startLine,a.startLine-1):n.length-1;t.set(i.definition.symbolId,{startLine:i.startLine,endLine:Oe(n,i.definition,i.startLine,s)})}return t}function Ne(e,n){return e.map(t=>{let r=n.get(t.symbolId);return r?{...t,startLine:r.startLine,endLine:r.endLine}:t})}function Te(e,n,t=null){let r=new Map;for(let i of n){let a=r.get(i.name);a?a.push(i):r.set(i.name,[i])}return e.map(i=>{if(!_(i.symbol)||!i.leaf)return Y(i,t);let a=r.get(i.leaf);if(!a||a.length===0)return Y(i,t);let s=a[0],c=Math.abs(s.startLine-i.startLine);for(let o=1;o<a.length;o+=1){let l=a[o],u=Math.abs(l.startLine-i.startLine);u<c&&(s=l,c=u)}return{...i,startLine:s.startLine,endLine:s.endLine}})}function Y(e,n){if(!n||!e.leaf||b(e.symbol)!=="term"||v(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),a=n.split(/\r?\n/).findIndex(s=>r.test(s));return a>=0?{...e,startLine:a,endLine:a}:e}function Ee(e,n,t){if(!_(t.symbol))return t.startLine;let r=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return r;let i=n.get(t.leaf);if(!i||i.length===0)return r;let a=null;for(let s of i){let c=Math.abs(s-t.startLine);(!a||c<a.distance)&&(a={line:s,distance:c})}return a?.line??r}function Pe(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,a=new Map,s=(c,o)=>{let l=a.get(c);if(!l){a.set(c,[o]);return}l[l.length-1]!==o&&l.push(o)};for(let c=0;c<e.length;c+=1){let o=e[c]??"";for(let u of o.matchAll(n))u[1]&&s(u[1],c);for(let u of o.matchAll(t))u[1]&&s(u[1],c);let l=o.match(r);l?.[1]&&s(l[1],c);for(let u of o.matchAll(i))u[1]&&s(u[1],c)}return a}function Oe(e,n,t,r){let i=Math.max(t,Math.min(e.length-1,r)),a=Math.max(t,Math.min(i,n.endLine)),s=0,c=0,o=!1;for(let l=t;l<=i;l+=1){let u=$e(e[l]??"");for(let d of u)d==="{"?(s+=1,o=!0):d==="}"?s=Math.max(0,s-1):d==="("?c+=1:d===")"&&(c=Math.max(0,c-1));if(o&&s===0||!o&&c===0&&l>=a)return l}return a}function $e(e){let n="",t=null,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i],s=e[i+1];if(!t&&a==="/"&&s==="/"){n+=" ".repeat(e.length-i);break}if(t){if(r){r=!1,n+=" ";continue}if(a==="\\"){r=!0,n+=" ";continue}a===t&&(t=null),n+=" ";continue}if(a==='"'||a==="'"||a==="`"){t=a,n+=" ";continue}n+=a}return n}function _(e){return e.includes("().")}function v(e){let n=p(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let r=n.descriptors[t];if(r?.suffix==="type")return r.name}return null}function bt(e){let n=p(e);if("kind"in n)return[];let t=[];for(let r=n.descriptors.length-2;r>=0;r-=1){let i=n.descriptors[r];i?.suffix==="type"&&i.name&&t.push(i.name)}return t}export{h as a,Fe as b,I as c,m as d,Be as e,S as f,te as g,C as h,Ge as i,qe as j,de as k,Je as l,D as m,p as n,V as o,W as p,b as q,Ze as r,B as s,et as t,tt as u,nt as v,rt as w,it as x,z as y,U as z,k as A,ft as B,ve as C,pt as D,mt as E,gt as F,v as G,bt as H};
84
+ //# sourceMappingURL=chunk-QFZE73XF.js.map
@@ -0,0 +1,2 @@
1
+ import{statSync as i}from"fs";function r(t){let e=t.get("SELECT COUNT(*) as c FROM documents").c,s=t.get("SELECT COUNT(*) as c FROM global_symbols").c,n=t.get("SELECT COUNT(*) as c FROM mentions WHERE role = 1").c,c=t.get("SELECT COUNT(*) as c FROM mentions WHERE role != 1").c;return{documents:e,symbols:s,definitions:n,references:c,...o(t.config.dbPath)}}function o(t){try{let e=i(t);return{indexSizeBytes:e.size,lastBuilt:e.mtime}}catch{return{indexSizeBytes:0,lastBuilt:null}}}export{r as a};
2
+ //# sourceMappingURL=chunk-QRYEOK3M.js.map
@@ -1,2 +1,2 @@
1
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
2
+ //# sourceMappingURL=chunk-RKTDEIHF.js.map
@@ -0,0 +1,2 @@
1
+ import{a as c}from"./chunk-32R4VYYA.js";import{h as a,i}from"./chunk-4X7C236P.js";import{o as m}from"./chunk-QFZE73XF.js";function d(o,e={}){let{limit:r=20,scope:s,minFanIn:t=2,minFanOut:p=2}=e;return new c(o).productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0}).map(n=>u(o,n)).filter(n=>n.fanIn>=t&&n.fanOut>=p).sort((n,l)=>l.score-n.score||l.fanIn-n.fanIn).slice(0,r)}function u(o,e){let r=new Set(i(o,e,{limit:500}).map(t=>t.file)).size,s=new Set(a(o,e,{limit:500}).filter(t=>t.file!==e.relativePath).map(t=>`${t.symbol}|${t.file}`)).size;return{symbol:e.symbol,shortName:m(e.symbol),fanIn:r,fanOut:s,score:r*s,definedIn:e.relativePath}}export{d as a};
2
+ //# sourceMappingURL=chunk-ROWAEEOD.js.map
@@ -0,0 +1,7 @@
1
+ import{c as m}from"./chunk-WIIZF5FP.js";import{j as g}from"./chunk-4X7C236P.js";import{a as R}from"./chunk-ZHHMG4UC.js";import{d as u,s as h}from"./chunk-QFZE73XF.js";function $(t,a){let e=R(t,a);if(!e)return[];let i=!h(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],r=m(t,e),l=(r.length>0?r:g(t,e)).filter(n=>!t.isIgnored(n.file)).map(n=>({relativePath:n.file,line:n.line})),c=S(t,e),s=new Set,f=[];for(let n of[...i,...l,...c]){let p=`${n.relativePath}:${n.line}`;s.has(p)||(s.add(p),f.push(n))}return f}function S(t,a){if(!a.relativePath.endsWith(".rb"))return[];let e=d(a.symbol);if(e.length===0)return[];let o=t.all(`SELECT relative_path
2
+ FROM documents
3
+ WHERE relative_path LIKE '%.rb'
4
+ ${t.pathExclusionsFor("documents")}
5
+ ORDER BY relative_path`),i=[];for(let r of o){if(t.isIgnored(r.relative_path))continue;let l=u(t,r.relative_path);if(!l)continue;let c=l.split(`
6
+ `);for(let s=0;s<c.length;s++){let f=c[s]??"";e.some(n=>new RegExp(`@${n}\\b|\\b${n}:`).test(f))&&i.push({relativePath:r.relative_path,line:s})}}return i}function d(t){let e=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),o=e.split("_").filter(Boolean),i=new Set;return e&&i.add(e),o.length>=1&&i.add(o[o.length-1]),o.length>=2&&i.add(o.slice(-2).join("_")),[...i]}export{$ as a};
7
+ //# sourceMappingURL=chunk-RT5PV5JQ.js.map
@@ -0,0 +1,2 @@
1
+ import{b as p}from"./chunk-MO65UK5V.js";import{D as u,x as f}from"./chunk-QFZE73XF.js";function S(a,b){let y=p(a,b),o=u(a,y,{sort:!0});if(o.length===0)return[];let i=o.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,children:[]})),s=new Map;for(let e of i)s.set(e.symbol,e);let m=[];for(let e=0;e<o.length;e++){let r=o[e],n=i[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,c=1/0;for(let t of i)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!f(t.symbol,n.symbol))continue;let d=t.endLine-t.startLine;d<c&&(c=d,l=t)}l?l.children.push(n):m.push(n)}return m}export{S as a};
2
+ //# sourceMappingURL=chunk-TLRA5TR6.js.map