scip-query 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/README.md +14 -7
  2. package/dist/chunk-2DSS2NGF.js +10 -0
  3. package/dist/chunk-2RLP74AO.js +2 -0
  4. package/dist/chunk-4QJ7LVW5.js +2 -0
  5. package/dist/chunk-4TYGGOLO.js +5 -0
  6. package/dist/chunk-5IADAU5B.js +7 -0
  7. package/dist/chunk-7754WFFV.js +18 -0
  8. package/dist/chunk-7VOF4ZG6.js +2 -0
  9. package/dist/chunk-7Z4COVMC.js +2 -0
  10. package/dist/chunk-AJ5PWKD4.js +2 -0
  11. package/dist/chunk-BDBRZPX3.js +7 -0
  12. package/dist/chunk-BE6EQIWY.js +2 -0
  13. package/dist/chunk-BQ3INTYT.js +8 -0
  14. package/dist/chunk-D7KLLMPB.js +2 -0
  15. package/dist/chunk-D7YBWSON.js +29 -0
  16. package/dist/chunk-DE5ZBHMK.js +39 -0
  17. package/dist/chunk-DHYIJHXZ.js +33 -0
  18. package/dist/chunk-EEF3YEHW.js +2 -0
  19. package/dist/chunk-F2LLHRRZ.js +2 -0
  20. package/dist/chunk-FCC3XJTI.js +2 -0
  21. package/dist/chunk-GNXRLK5G.js +2 -0
  22. package/dist/chunk-GXVB36TG.js +62 -0
  23. package/dist/chunk-HMKJTAZD.js +2 -0
  24. package/dist/chunk-IBGBI3VU.js +2 -0
  25. package/dist/chunk-IYFZS4PV.js +84 -0
  26. package/dist/chunk-JH3A7HTU.js +2 -0
  27. package/dist/chunk-JS2RNIC7.js +2 -0
  28. package/dist/chunk-K5FQFCSN.js +41 -0
  29. package/dist/chunk-K6GBKEQE.js +6 -0
  30. package/dist/chunk-KO7YJRWP.js +12 -0
  31. package/dist/chunk-KYT47WU2.js +4 -0
  32. package/dist/chunk-LORWXBOO.js +2 -0
  33. package/dist/chunk-LX4H4LLG.js +89 -0
  34. package/dist/chunk-N3Z2SJCR.js +2 -0
  35. package/dist/chunk-NTDA4A2D.js +25 -0
  36. package/dist/chunk-NXMYYHDO.js +24 -0
  37. package/dist/chunk-PZ6ESKRH.js +7 -0
  38. package/dist/chunk-QXE6EDY2.js +6 -0
  39. package/dist/chunk-RJ7SPBJ5.js +5 -0
  40. package/dist/chunk-RWE6FHG3.js +3 -0
  41. package/dist/chunk-SDX6MDBL.js +2 -0
  42. package/dist/chunk-SG35Y7J2.js +2 -0
  43. package/dist/chunk-STOGKRJH.js +4 -0
  44. package/dist/chunk-TINPMWJK.js +2 -0
  45. package/dist/chunk-UJB62HV3.js +2 -0
  46. package/dist/chunk-VEUMRDHW.js +2 -0
  47. package/dist/chunk-WCDXJGYT.js +65 -0
  48. package/dist/chunk-WTSTDJZ7.js +6 -0
  49. package/dist/chunk-XAZTIDST.js +2 -0
  50. package/dist/chunk-XVDASCN7.js +35 -0
  51. package/dist/chunk-Y7H6D2EV.js +2 -0
  52. package/dist/chunk-Y7LOQSWY.js +2 -0
  53. package/dist/chunk-YIPCV7M7.js +70 -0
  54. package/dist/chunk-ZSRXMNMK.js +5 -0
  55. package/dist/chunk-ZXKURFVB.js +56 -0
  56. package/dist/cli.js +509 -8758
  57. package/dist/{db-6F9R9e_t.d.ts → db-BSTtBG_H.d.ts} +146 -1
  58. package/dist/index.d.ts +11 -2
  59. package/dist/index.js +13 -1616
  60. package/dist/postinstall.js +4 -100
  61. package/dist/queries/affected.d.ts +1 -1
  62. package/dist/queries/affected.js +1 -8
  63. package/dist/queries/bottlenecks.d.ts +1 -1
  64. package/dist/queries/bottlenecks.js +1 -8
  65. package/dist/queries/by-kind.d.ts +1 -4
  66. package/dist/queries/by-kind.js +1 -10
  67. package/dist/queries/call-graph.d.ts +1 -1
  68. package/dist/queries/call-graph.js +1 -8
  69. package/dist/queries/change-surface.d.ts +1 -1
  70. package/dist/queries/change-surface.js +1 -8
  71. package/dist/queries/code.d.ts +1 -1
  72. package/dist/queries/code.js +1 -8
  73. package/dist/queries/complexity-hotspots.d.ts +5 -10
  74. package/dist/queries/complexity-hotspots.js +1 -8
  75. package/dist/queries/complexity.d.ts +1 -1
  76. package/dist/queries/complexity.js +1 -8
  77. package/dist/queries/convergence.d.ts +1 -1
  78. package/dist/queries/convergence.js +1 -8
  79. package/dist/queries/coupling.d.ts +1 -1
  80. package/dist/queries/coupling.js +1 -10
  81. package/dist/queries/cycles.d.ts +1 -1
  82. package/dist/queries/cycles.js +1 -8
  83. package/dist/queries/dataflow.d.ts +1 -1
  84. package/dist/queries/dataflow.js +1 -8
  85. package/dist/queries/dead.d.ts +1 -1
  86. package/dist/queries/dead.js +1 -9
  87. package/dist/queries/deep-chains.d.ts +9 -1
  88. package/dist/queries/deep-chains.js +1 -8
  89. package/dist/queries/deps.d.ts +1 -1
  90. package/dist/queries/deps.js +1 -10
  91. package/dist/queries/diff-impact.d.ts +1 -1
  92. package/dist/queries/diff-impact.js +1 -7
  93. package/dist/queries/drift.d.ts +1 -1
  94. package/dist/queries/drift.js +1 -8
  95. package/dist/queries/extract-candidates.d.ts +1 -1
  96. package/dist/queries/extract-candidates.js +1 -8
  97. package/dist/queries/fan.d.ts +1 -1
  98. package/dist/queries/fan.js +1 -14
  99. package/dist/queries/files.d.ts +1 -1
  100. package/dist/queries/files.js +1 -6
  101. package/dist/queries/health.d.ts +1 -1
  102. package/dist/queries/health.js +1 -20
  103. package/dist/queries/hierarchy.d.ts +1 -1
  104. package/dist/queries/hierarchy.js +1 -8
  105. package/dist/queries/hotspots.d.ts +1 -1
  106. package/dist/queries/hotspots.js +1 -8
  107. package/dist/queries/imports.d.ts +1 -1
  108. package/dist/queries/imports.js +1 -12
  109. package/dist/queries/index.d.ts +1 -1
  110. package/dist/queries/index.js +1 -197
  111. package/dist/queries/isolated.d.ts +1 -1
  112. package/dist/queries/isolated.js +1 -9
  113. package/dist/queries/members.d.ts +1 -1
  114. package/dist/queries/members.js +1 -8
  115. package/dist/queries/methods.d.ts +1 -1
  116. package/dist/queries/methods.js +1 -8
  117. package/dist/queries/outline.d.ts +1 -1
  118. package/dist/queries/outline.js +1 -8
  119. package/dist/queries/passthrough-candidates.d.ts +1 -1
  120. package/dist/queries/passthrough-candidates.js +1 -8
  121. package/dist/queries/redundant-reexports.d.ts +1 -1
  122. package/dist/queries/redundant-reexports.js +1 -9
  123. package/dist/queries/refs.d.ts +1 -1
  124. package/dist/queries/refs.js +1 -8
  125. package/dist/queries/similar-chains.d.ts +1 -1
  126. package/dist/queries/similar-chains.js +1 -8
  127. package/dist/queries/similar-files.d.ts +1 -1
  128. package/dist/queries/similar-files.js +1 -8
  129. package/dist/queries/similar-signatures.d.ts +1 -1
  130. package/dist/queries/similar-signatures.js +1 -8
  131. package/dist/queries/similar.d.ts +1 -1
  132. package/dist/queries/similar.js +1 -10
  133. package/dist/queries/slice.d.ts +1 -1
  134. package/dist/queries/slice.js +1 -8
  135. package/dist/queries/stale-abstractions.d.ts +15 -5
  136. package/dist/queries/stale-abstractions.js +1 -8
  137. package/dist/queries/stats.d.ts +1 -1
  138. package/dist/queries/stats.js +1 -6
  139. package/dist/queries/surface.d.ts +1 -1
  140. package/dist/queries/surface.js +1 -8
  141. package/dist/queries/symbols.d.ts +1 -1
  142. package/dist/queries/symbols.js +1 -9
  143. package/dist/queries/system.d.ts +1 -1
  144. package/dist/queries/system.js +1 -9
  145. package/dist/queries/trace.d.ts +1 -1
  146. package/dist/queries/trace.js +1 -9
  147. package/dist/queries/wrapper-candidates.d.ts +1 -1
  148. package/dist/queries/wrapper-candidates.js +1 -8
  149. package/dist/reindex-worker.js +7 -672
  150. package/package.json +20 -2
  151. package/skills/concrete-plan/SKILL.md +3 -3
  152. package/skills/scip-debloat/SKILL.md +3 -6
  153. package/skills/scip-language-playbook/SKILL.md +2 -0
  154. package/dist/chunk-2MQ5DPY6.js +0 -61
  155. package/dist/chunk-2QTYIOJ5.js +0 -165
  156. package/dist/chunk-3VI4YXCL.js +0 -172
  157. package/dist/chunk-3VV2G6U7.js +0 -34
  158. package/dist/chunk-44PFXVXG.js +0 -76
  159. package/dist/chunk-6SLFQR36.js +0 -64
  160. package/dist/chunk-74RFWB5T.js +0 -24
  161. package/dist/chunk-7DBPRGMS.js +0 -221
  162. package/dist/chunk-DTB724R3.js +0 -110
  163. package/dist/chunk-FLOYI6I4.js +0 -185
  164. package/dist/chunk-FO2CBB7U.js +0 -23
  165. package/dist/chunk-GJT3MO2T.js +0 -17
  166. package/dist/chunk-HAP4LJKX.js +0 -66
  167. package/dist/chunk-JCOJQ4I6.js +0 -93
  168. package/dist/chunk-JGQMOS4V.js +0 -59
  169. package/dist/chunk-JMD4WJ2Q.js +0 -213
  170. package/dist/chunk-JSQPZOPO.js +0 -64
  171. package/dist/chunk-JSXGC2EH.js +0 -151
  172. package/dist/chunk-JZN3DRCT.js +0 -59
  173. package/dist/chunk-KMWYB3CX.js +0 -71
  174. package/dist/chunk-MRM755FU.js +0 -37
  175. package/dist/chunk-N2XO3Z5F.js +0 -69
  176. package/dist/chunk-OLW5UL36.js +0 -76
  177. package/dist/chunk-OMCRXXDX.js +0 -2600
  178. package/dist/chunk-OWJOHUZE.js +0 -44
  179. package/dist/chunk-P3VCDYMJ.js +0 -269
  180. package/dist/chunk-PEDH3D4G.js +0 -53
  181. package/dist/chunk-POAN4SCR.js +0 -46
  182. package/dist/chunk-PTMGEBU3.js +0 -101
  183. package/dist/chunk-PU44HK7P.js +0 -87
  184. package/dist/chunk-QJI7EECA.js +0 -327
  185. package/dist/chunk-R5HICGMB.js +0 -110
  186. package/dist/chunk-RJ2D6YWQ.js +0 -49
  187. package/dist/chunk-RZ5GYPBP.js +0 -79
  188. package/dist/chunk-SRLQNO6O.js +0 -101
  189. package/dist/chunk-UGS7HJI4.js +0 -84
  190. package/dist/chunk-VKUUXOE7.js +0 -105
  191. package/dist/chunk-VPUJSJCI.js +0 -84
  192. package/dist/chunk-VRWVV3EP.js +0 -72
  193. package/dist/chunk-WJWQEU4A.js +0 -162
  194. package/dist/chunk-WJZHDUSB.js +0 -40
  195. package/dist/chunk-WWOCQ5W4.js +0 -34
  196. package/dist/chunk-X3Q2OVRL.js +0 -77
  197. package/dist/chunk-Y3P7QKKN.js +0 -27
  198. package/dist/chunk-Y6FAHY4N.js +0 -81
  199. package/dist/chunk-YMSJCSRG.js +0 -213
  200. package/dist/chunk-ZDL3U4W2.js +0 -124
  201. package/dist/chunk-ZXNX5JRE.js +0 -216
  202. package/dist/queries/clean-signature.d.ts +0 -17
  203. package/dist/queries/clean-signature.js +0 -9
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Language-agnostic code intelligence CLI powered by [SCIP](https://github.com/sourcegraph/scip) indexes. Index any codebase, then query it for references, dependencies, dead code, similarity, coupling, and more — without an IDE or language server running.
4
4
 
5
- Works with every language that has a SCIP indexer: TypeScript, JavaScript, Java, Scala, Kotlin, Rust, Python, Ruby, Go, C/C++, C#, Dart, PHP.
5
+ Works with every language that has a SCIP indexer: TypeScript, JavaScript, Vue, Java, Scala, Kotlin, Rust, Python, Ruby, Go, C/C++, C#, Visual Basic, Dart, PHP.
6
6
 
7
7
  ## Workflows
8
8
 
@@ -43,7 +43,7 @@ scip-query diff-impact # what did my changes affect?
43
43
 
44
44
  | Language | Indexer | Install |
45
45
  |---|---|---|
46
- | TypeScript / JavaScript | scip-typescript | `npm install -g @sourcegraph/scip-typescript` |
46
+ | TypeScript / JavaScript / Vue | scip-typescript | `npm install -g @sourcegraph/scip-typescript` |
47
47
  | Java / Scala / Kotlin | scip-java | [releases](https://github.com/sourcegraph/scip-java/releases) |
48
48
  | Rust | rust-analyzer | Ships with rust-analyzer (`rust-analyzer scip`) |
49
49
  | Python | scip-python-plus | `npm install -g scip-python-plus` |
@@ -54,7 +54,9 @@ scip-query diff-impact # what did my changes affect?
54
54
  | Dart | scip-dart | [releases](https://github.com/nicovince/scip-dart/releases) |
55
55
  | PHP | scip-php | [releases](https://github.com/nicovince/scip-php/releases) |
56
56
 
57
- For Python, the npm package is `scip-python-plus`. Depending on which version you installed, the executable on your `PATH` may be `scip-python`, `scip-python-plus`, or both. `scip-query` now accepts either name.
57
+ For Python, the npm package is `scip-python-plus`. Depending on which version you installed, the executable on your `PATH` may be `scip-python`, `scip-python-plus`, or both. `scip-query` accepts either name.
58
+
59
+ Vue single-file components (`.vue`) are handled by the JavaScript/TypeScript indexer. `scip-query` extracts the `<script>` block (or `<script setup>`, picking the language from the `lang=` attribute) and parses it as TS/JS so symbol, reference, and import queries cover Vue components alongside regular `.ts`/`.js` files.
58
60
 
59
61
  ## How It Works
60
62
 
@@ -466,6 +468,8 @@ scip-query dead src/utils --skip-barrels --include-members
466
468
  - `--include-tests` — Include test files in results (excluded by default)
467
469
  - `--skip-barrels` — Ignore references from inactive barrel re-export files
468
470
  - `--include-members` — Include class members (module-level only by default)
471
+ - `--only-dead` — Show only `[dead code]` symbols (skip `[file-internal only]`)
472
+ - `--only-internal` — Show only `[file-internal only]` symbols (skip `[dead code]`)
469
473
 
470
474
  **Value:** Find code you can delete. The `--skip-barrels` flag is key when a codebase has unused barrels, but it now keeps live entry-surface barrels counted so active exports do not look dead.
471
475
 
@@ -695,7 +699,7 @@ These commands find duplication, redundancy, and extraction opportunities — th
695
699
 
696
700
  #### `similar [symbol]`
697
701
 
698
- Find functions with similar callee fingerprints using Jaccard similarity. Two functions that call the same set of symbols are likely doing the same work and are candidates for consolidation.
702
+ Find functions with similar callee fingerprints using TF-IDF weighted cosine similarity. Each callee is weighted by how rare it is across the codebase two functions sharing a niche helper (`sendWelcomeEmail()`) score much higher than two functions sharing infrastructure callees (`db.all()`, `shortenSymbol()`). The "shared" list shown for each pair is the high-IDF (significant) intersection, not every shared callee.
699
703
 
700
704
  Without a symbol argument, finds the top N most similar pairs across the codebase. With a symbol, finds what's most similar to that specific function.
701
705
 
@@ -716,10 +720,11 @@ scip-query similar dead --min-similarity 0.3
716
720
  ```
717
721
 
718
722
  **Options:**
719
- - `--min-similarity <n>` — Minimum Jaccard similarity 0-1 (default: 0.4)
723
+ - `--min-similarity <n>` — Minimum cosine similarity 0-1 (default: 0.4)
720
724
  - `-n, --limit <n>` — Number of results (default: 20)
721
725
  - `-s, --scope <path>` — Limit to files matching path
722
726
  - `--min-callees <n>` — Minimum callees to consider a symbol (default: 4)
727
+ - `--cross-file-only` — Only show cross-file pairs (skip same-file matches)
723
728
 
724
729
  **Value:** Finds "these two functions do basically the same thing" at scale. The shared callee list shows exactly what's duplicated. The unique callees show where they diverge — that's the parameterization point for a consolidated version.
725
730
 
@@ -743,7 +748,7 @@ scip-query similar-files auth.controller.ts
743
748
  - `--min-similarity <n>` — Minimum Jaccard similarity 0-1 (default: 0.5)
744
749
  - `-n, --limit <n>` — Number of results (default: 20)
745
750
  - `-s, --scope <path>` — Limit to files matching path
746
- - `--min-deps <n>` — Minimum dependencies to consider (default: 3)
751
+ - `--min-deps <n>` — Minimum dependencies on the smaller side (auto-tunes by default; pass to override)
747
752
 
748
753
  **Value:** Finds copy-paste file variants and structurally redundant modules. When two files have 90%+ dependency overlap, they're likely doing similar jobs and should share code or be merged.
749
754
 
@@ -928,6 +933,7 @@ scip-query stale-abstractions --min-loc 5
928
933
  - `-s, --scope <path>` — Limit to files matching path
929
934
  - `--min-loc <n>` — Minimum LOC (default: 3)
930
935
  - `-n, --limit <n>` — Number of results (default: 30)
936
+ - `--include-low-confidence` — Include 1-consumer classes (usually encapsulation, not stale)
931
937
 
932
938
  **Value:** An interface with one implementation isn't an abstraction — it's indirection. Finds over-engineering.
933
939
 
@@ -1076,6 +1082,7 @@ scip-query slice login --forward # forward: what this feeds into
1076
1082
 
1077
1083
  **Options:**
1078
1084
  - `--forward` — Forward slice instead of backward (default: backward)
1085
+ - `--depth <n>` — Max transitive depth for backward slice (default: 3)
1079
1086
 
1080
1087
  **Value:** Backward slice shows inputs/dependencies. Forward slice shows outputs/effects. Useful for tracing data flow through error handling and concurrency paths.
1081
1088
 
@@ -1124,7 +1131,7 @@ scip-query similar-signatures --min-loc 5
1124
1131
 
1125
1132
  ## Programmatic API
1126
1133
 
1127
- All 49 commands are available as TypeScript functions:
1134
+ Every CLI command is also a TypeScript function. The `queries` namespace exports cover all of them — including the `top*` variants of `fan-in`, `fan-out`, and `coupling`, plus `similarAll` for the cross-codebase mode of `similar`:
1128
1135
 
1129
1136
  ```typescript
1130
1137
  import {
@@ -0,0 +1,10 @@
1
+ import{a as u}from"./chunk-WTSTDJZ7.js";import{p as c}from"./chunk-IYFZS4PV.js";import{b as a}from"./chunk-TINPMWJK.js";function _(t,d){let s=u(t,d);if(!s)return null;let n=t.get(`SELECT id, relative_path FROM documents
2
+ WHERE relative_path = ?
3
+ ${t.pathExclusionsFor("documents")}
4
+ LIMIT 1`,s);if(!n||t.isIgnored(n.relative_path))return null;let f=c(t,n.relative_path).sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine),m=[],l=0;for(let e of f){let o=t.get(`SELECT COUNT(DISTINCT c.document_id) AS consumer_count
5
+ FROM mentions m
6
+ JOIN chunks c ON m.chunk_id = c.id
7
+ WHERE m.symbol_id = ?
8
+ AND m.role != 1
9
+ AND c.document_id != ?`,e.symbolId,n.id)?.consumer_count??0,r;o>10?r="high":o>0?r="medium":r="low",l+=o,m.push({symbol:e.symbol,shortName:a(e.symbol),startLine:e.startLine,endLine:e.endLine,externalConsumers:o,riskLevel:r})}return{file:n.relative_path,symbols:m,totalExternalConsumers:l}}export{_ as a};
10
+ //# sourceMappingURL=chunk-2DSS2NGF.js.map
@@ -0,0 +1,2 @@
1
+ import{b as p}from"./chunk-WTSTDJZ7.js";import{s as u}from"./chunk-IYFZS4PV.js";import{i as f}from"./chunk-TINPMWJK.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 c=[];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,m=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<m&&(m=d,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
2
+ //# sourceMappingURL=chunk-2RLP74AO.js.map
@@ -0,0 +1,2 @@
1
+ import{c as d}from"./chunk-LORWXBOO.js";import{d as a}from"./chunk-WCDXJGYT.js";function F(t,i={}){let{minSimilarity:f=.5,limit:n=20,scope:o,filePattern:s}=i,u=i.minDeps??(s?1:3),e=g(t,{scope:o,minDeps:u}),p=[];if(s){let r=e.find(l=>l.file.includes(s));if(!r)return[];for(let l of e){if(l.file===r.file)continue;let c=m(r,l,f);c&&p.push(c)}}else for(let r=0;r<e.length;r++){for(let l=r+1;l<e.length;l++){let c=m(e[r],e[l],f);c&&p.push(c)}if(p.length>n*5)break}return p.sort((r,l)=>l.similarity-r.similarity),p.slice(0,n)}function g(t,i){let{scope:f,minDeps:n}=i,o=a(t,f),s=h(o),u=[];for(let[e,p]of o)p.size>=n&&u.push({file:e,deps:new Set([...p].filter(r=>!s.has(r)))});return u}function h(t){let i=new Set,f=t.size;if(f===0)return i;let n=new Map;for(let o of t.values())for(let s of o)n.set(s,(n.get(s)??0)+1);for(let[o,s]of n)s>=5&&s/f>.3&&i.add(o);return i}function m(t,i,f){let n=new Set;for(let e of t.deps)i.deps.has(e)&&n.add(e);if(n.size<3||t.deps.size<4||i.deps.size<4)return null;let o=d(t.deps,i.deps);if(o<f)return null;let s=[];for(let e of t.deps)i.deps.has(e)||s.push(e);let u=[];for(let e of i.deps)t.deps.has(e)||u.push(e);return{fileA:t.file,fileB:i.file,similarity:o,sharedDeps:[...n],uniqueToA:s,uniqueToB:u}}export{F as a};
2
+ //# sourceMappingURL=chunk-4QJ7LVW5.js.map
@@ -0,0 +1,5 @@
1
+ import{execFileSync as n}from"child_process";import{platform as o,arch as p}from"os";var a=o()==="win32",u="v0.7.0";function t(e){let r=a?"where":"which";try{return n(r,[e],{stdio:"pipe"}),!0}catch{return!1}}function h(){try{return n(a?"where":"which",["scip"],{stdio:"pipe"}),!0}catch{return!1}}function w(){try{return n("scip",["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function g(){let e=o(),r=p(),i,l,s;switch(e){case"darwin":i="darwin",s="tar.gz";break;case"linux":i="linux",s="tar.gz";break;case"win32":i="windows",s="zip";break;default:return null}switch(r){case"arm64":l="arm64";break;case"x64":l="amd64";break;default:return null}let c=`scip-${i}-${l}.${s}`;return{url:`https://github.com/sourcegraph/scip/releases/download/${u}/${c}`,filename:c}}function b(){let e=g();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),o()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
2
+ `),console.log("Or download manually:")):console.log("Download from:"),console.log(e?` ${e.url}
3
+ `:` https://github.com/sourcegraph/scip/releases/tag/${u}
4
+ `),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function I(e){if(o()==="darwin"&&t("brew")){e("Installing scip CLI via Homebrew...");try{if(n("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`Homebrew install failed: ${i}`)}}if(t("go")){e("Installing scip CLI via go install...");try{if(n("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),t("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`go install failed: ${i}`)}}return e("Could not auto-install scip CLI."),e("Install manually from: https://github.com/sourcegraph/scip/releases"),!1}export{h as a,w as b,b as c,I as d};
5
+ //# sourceMappingURL=chunk-4TYGGOLO.js.map
@@ -0,0 +1,7 @@
1
+ import{c as k}from"./chunk-VEUMRDHW.js";import{c as _,d as N,j as P}from"./chunk-WCDXJGYT.js";import{e as C,p as D,r as M,t as v}from"./chunk-IYFZS4PV.js";import{b as F,c as L,f as I}from"./chunk-TINPMWJK.js";import{basename as u,extname as d}from"path";function V(e,n){let{scope:i,maxLoc:t=15,limit:s=30}=n??{},o=J(N(e,i)),l=T(e,i,t),c=j(P(e,l),k(e,l)),g=[];for(let r of l){if(C(e,r.relativePath,r.startLine))continue;let p=u(r.relativePath,d(r.relativePath)),h=[...c.get(r.symbolId)??[]].filter(m=>m!==r.relativePath).filter(m=>u(m,d(m))!==p);if(h.length!==1)continue;let f=h[0],y=e.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`,r.symbolId,f);if(!y)continue;let R=D(e,f),w=A(e,f,r.symbol,y.start_line,y.end_line),a=v(R,w),b,E=a?.symbol??"",O=a?.isFunctionLike?F(a.symbol):u(f);if(a?.isFunctionLike&&a.symbolId!==r.symbolId){let m=[...c.get(a.symbolId)??[]].filter(W=>W!==a.relativePath);b=m.length>0?m.length:x(o,f)}else b=x(o,f);b<=3||g.push({symbol:r.symbol,shortName:F(r.symbol),file:r.relativePath,startLine:r.startLine,endLine:r.endLine,loc:S(r),singleCaller:E,singleCallerShort:O,callerFanIn:b})}return g.sort((r,p)=>p.callerFanIn-r.callerFanIn||p.loc-r.loc),g.slice(0,s)}function S(e){return e.endLine-e.startLine+1}function T(e,n,i){return M(e,n).filter(t=>!e.isIgnored(t.relativePath)).filter(t=>I(t.symbol)).filter(t=>S(t)<=i&&S(t)>=2)}function A(e,n,i,t,s){let o=L(i);if(!o)return t;let l=_(e,n).get(o);if(!l||l.length===0)return t;for(let c of l)if(c>=t&&c<=s)return c;return t}function j(...e){let n=new Map;for(let i of e)for(let[t,s]of i){let o=n.get(t);o||(o=new Set,n.set(t,o));for(let l of s)o.add(l)}return n}function J(e){let n=new Map;for(let[i,t]of e){n.has(i)||n.set(i,n.get(i)??0);for(let s of t)n.set(s,(n.get(s)??0)+1)}return n}function x(e,n){let i=e.get(n)??0;if(i>0)return i;let t=u(n,d(n)),s=0;for(let[o,l]of e)o!==n&&u(o,d(o))===t&&l>s&&(s=l);return s}export{V as a};
7
+ //# sourceMappingURL=chunk-5IADAU5B.js.map
@@ -0,0 +1,18 @@
1
+ import{d as y}from"./chunk-WCDXJGYT.js";import{e as h}from"./chunk-BQ3INTYT.js";import m from"path";function E(t,r){let{scope:i}=r??{},f=y(t,i),n=_(t,i),o=[];for(let[e,c]of f){if(d(e))continue;let u=n.get(e)??new Set;for(let s of c)if(!d(s)&&!u.has(s)){if(k(s)||b(t,e,s))continue;o.push({file:e,kind:"unused-import",description:`Depends on ${s} but references none of its symbols`,dep:s})}}let p=S(f);for(let[e,c]of f){if(d(e))continue;let u=g(e);for(let s of c){if(d(s))continue;let l=g(s);if(u===l)continue;p.get(`${u}->${l}`)==="violation"&&o.push({file:e,kind:"layer-violation",description:`Imports from ${l}/ (${s}) \u2014 may cross architectural boundary`,dep:s,detail:`${u}/ should not depend on ${l}/`})}}let a=new Map;for(let e of f.keys()){let c=m.dirname(e);a.has(c)||a.set(c,[]),a.get(c).push(e)}for(let[e,c]of a){if(c.length<3)continue;let u=new Map;for(let s of c)if(!d(s))for(let l of f.get(s)??[])d(l)||u.set(l,(u.get(l)??0)+1);for(let s of c)if(!d(s)){for(let l of f.get(s)??[])if(!d(l)&&(u.get(l)??0)===1){if(m.dirname(l)===e)continue;o.push({file:s,kind:"pattern-deviation",description:`Only file in ${e}/ that depends on ${l}`,dep:l})}}}return{results:o,unusedImports:o.filter(e=>e.kind==="unused-import").length,layerViolations:o.filter(e=>e.kind==="layer-violation").length,patternDeviations:o.filter(e=>e.kind==="pattern-deviation").length}}function _(t,r){let i=r?`AND d1.relative_path LIKE '%${r}%'`:"",f=t.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d1 ON c.document_id = d1.id
5
+ JOIN global_symbols gs ON m.symbol_id = gs.id
6
+ JOIN (
7
+ SELECT m2.symbol_id, c2.document_id
8
+ FROM mentions m2
9
+ JOIN chunks c2 ON m2.chunk_id = c2.id
10
+ WHERE m2.role = 1
11
+ GROUP BY m2.symbol_id
12
+ ) sym_def ON sym_def.symbol_id = gs.id
13
+ JOIN documents d2 ON sym_def.document_id = d2.id
14
+ WHERE d1.id != d2.id
15
+ AND m.role != 1
16
+ ${t.pathExclusionsFor("d1","d2")}
17
+ ${i}`),n=new Map;for(let o of f)t.isIgnored(o.from_file)||t.isIgnored(o.to_file)||(n.has(o.from_file)||n.set(o.from_file,new Set),n.get(o.from_file).add(o.to_file));return n}function S(t){let r=new Map,i=new Set;for(let[n,o]of t){if(d(n))continue;let p=g(n);i.add(p);for(let a of o){if(d(a))continue;let e=g(a);if(p===e)continue;i.add(e);let c=`${p}->${e}`;r.set(c,(r.get(c)??0)+1)}}let f=new Map;for(let[n,o]of r)f.set(n,o<=2?"violation":"ok");return f}function g(t){let i=t.replace(/\\/g,"/").split("/").filter(Boolean);return i.length<=1?"(root)":i.length>=3&&["src","lib","app","server","client"].includes(i[0])?`${i[0]}/${i[1]}`:i[0]}function k(t){return t.includes("types")||t.endsWith(".d.ts")}function b(t,r,i){let f=h(t,r).filter(n=>n.sourcePath===i);return f.length===0?!1:f.every(n=>n.kind==="side-effect"||n.kind==="namespace"&&n.usedMembers.length===0&&!n.used)}function d(t){return $(m.basename(t))||v(t)}function $(t){return!!(t==="index.ts"||t==="index.js"||t==="cli.ts"||t==="main.ts"||t==="main.rs"||t.includes("worker.")||t.includes("postinstall.")||t==="health.ts"||t==="health.js")}function v(t){let r=t.replace(/\\/g,"/"),i=m.basename(r);return r.includes("/__tests__/")||r.includes("/tests/")||r.includes("/test/")||/\.(test|spec)\.[A-Za-z0-9]+$/.test(i)||/_(test|spec)\.[A-Za-z0-9]+$/.test(i)||/^test[_-]/.test(i)||/^test\./.test(i)}export{E as a};
18
+ //# sourceMappingURL=chunk-7754WFFV.js.map
@@ -0,0 +1,2 @@
1
+ import{h as L}from"./chunk-WCDXJGYT.js";import{e as g,f as b,h as C,r as S}from"./chunk-IYFZS4PV.js";import{b as y,f as d}from"./chunk-TINPMWJK.js";function x(o,s,a,i){let r=b(s);if(!r)return!0;let t=C(o,s);if(!t)return!0;let l=_.get(t);return l||(l=w(t,r),_.set(t,l)),l.get(`${a}:${i}`)??!0}var _=new WeakMap;function w(o,s){let a=s==="rust"?new Set(["function_item","function_signature_item"]):s==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),i=new Map,r=t=>{a.has(t.type)&&i.set(`${t.startPosition.row}:${t.endPosition.row}`,P(t,s));for(let l of t.children)r(l)};return r(o.rootNode),i}function P(o,s){let a=o.namedChildren.find(e=>e.type==="block"||e.type==="statement_block");if(!a)return!1;let i=a.namedChildren.filter(e=>e.type!=="comment"&&e.type!=="line_comment"&&e.type!=="block_comment");if(i.length!==1)return!1;let r=i[0],t=null;if(r.type==="return_statement"||r.type==="expression_statement"?t=r.namedChild(0)??null:s==="rust"&&(r.type==="call_expression"||r.type==="macro_invocation")&&(t=r),!t)return!1;let l=s==="python"?"call":"call_expression";if(t.type!==l)return!1;let u=t.namedChildren.find(e=>e.type==="arguments"||e.type==="argument_list");if(!u)return!1;let n=u.namedChildren.filter(e=>e.type!=="comment"),f=o.namedChildren.find(e=>e.type==="parameters"||e.type==="formal_parameters");if(!f)return!1;let p=[];for(let e of f.namedChildren)if(e.type==="identifier")p.push(e.text);else{let m=e.namedChildren.find(c=>c.type==="identifier");m&&p.push(m.text)}if(n.length!==p.length)return!1;for(let e=0;e<p.length;e+=1){let m=n[e];if(m.type!=="identifier"||m.text!==p[e])return!1}return!0}function j(o,s){let{scope:a,maxLoc:i=15,limit:r=30}=s??{},t=T(o,a,i),l=L(o,t),u=[];for(let n of t){if(g(o,n.relativePath,n.startLine))continue;let f=l.get(n.symbolId)??[],p=f.some(c=>d(c.symbol))?f.filter(c=>d(c.symbol)):f,e=new Map;for(let c of p)e.has(c.symbol)||e.set(c.symbol,c);if(e.size!==1||!x(o,n.relativePath,n.startLine,n.endLine))continue;let[,m]=[...e.entries()][0];u.push({symbol:n.symbol,shortName:y(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:h(n),forwardsTo:m.symbol,forwardsToShort:y(m.symbol),forwardsToFile:m.file})}return u.sort((n,f)=>n.loc-f.loc||n.file.localeCompare(f.file)),u.slice(0,r)}function T(o,s,a){return S(o,s).filter(i=>!o.isIgnored(i.relativePath)).filter(i=>d(i.symbol)).filter(i=>h(i)>=3&&h(i)<=a)}function h(o){return o.endLine-o.startLine+1}export{j as a};
2
+ //# sourceMappingURL=chunk-7VOF4ZG6.js.map
@@ -0,0 +1,2 @@
1
+ import{d as i}from"./chunk-GNXRLK5G.js";import{c as n}from"./chunk-VEUMRDHW.js";import{h as o,j as m}from"./chunk-WCDXJGYT.js";import{r}from"./chunk-IYFZS4PV.js";import{b as l}from"./chunk-TINPMWJK.js";function F(t,c={}){let{scope:p,minLoc:y=3}=c,a=r(t,p).filter(e=>!t.isIgnored(e.relativePath)).filter(e=>!i(t,e.relativePath)).filter(e=>e.isFunctionLike).filter(e=>e.endLine-e.startLine+1>=y),b=m(t,a),L=n(t,a),u=new Set([...b.keys(),...L.keys()]),d=new Map(a.map(e=>[e.symbolId,e.symbol])),f=o(t,a,{additive:!0}),S=new Set([...f.entries()].filter(([e,s])=>{let h=d.get(e);return s.some(C=>C.symbol!==h)}).map(([e])=>e));return a.filter(e=>!u.has(e.symbolId)).filter(e=>!S.has(e.symbolId)).sort((e,s)=>s.endLine-s.startLine-(e.endLine-e.startLine)||e.relativePath.localeCompare(s.relativePath)||e.startLine-s.startLine).map(e=>({symbol:e.symbol,shortName:l(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1}))}export{F as a};
2
+ //# sourceMappingURL=chunk-7Z4COVMC.js.map
@@ -0,0 +1,2 @@
1
+ import{b as g}from"./chunk-VEUMRDHW.js";import{e as u,g as h}from"./chunk-WCDXJGYT.js";import{a as d,b as y}from"./chunk-LX4H4LLG.js";import{p as S,t as p}from"./chunk-IYFZS4PV.js";import{b as m}from"./chunk-TINPMWJK.js";function N(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,t=d(e,o);return t?c==="backward"?w(e,t,s):R(e,t):null}function w(e,o,r){let c=[],s=new Set([o.symbol]),t=[o];for(let n=1;n<=r&&t.length!==0;n++){let l=[];for(let a of t){let i=u(e,a);for(let f of i){if(s.has(f.symbol))continue;s.add(f.symbol),c.push({symbol:f.symbol,shortName:m(f.symbol),file:f.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let b=y(e,f.symbol);b&&!e.isIgnored(b.relativePath)&&l.push(b)}}t=l}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:c}}function R(e,o){let r=g(e,o),c=r.length>0?r:h(e,o),s=new Set,t=[];for(let n of c){if(t.length>=30)break;if(e.isIgnored(n.file))continue;let l=n.enclosingSymbol??p(S(e,n.file),n.line)?.symbol??null;if(!l||l===o.symbol)continue;let a=y(e,l);if(a){for(let i of u(e,a))if(i.symbol!==o.symbol&&i.symbol!==l&&i.file!==n.file&&!e.isIgnored(i.file)&&!s.has(i.symbol)&&(s.add(i.symbol),t.push({symbol:i.symbol,shortName:m(i.symbol),file:i.file,relationship:`used alongside target in ${m(l)}`}),t.length>=30))break}}return t.sort((n,l)=>n.file.localeCompare(l.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:t}}export{N as a};
2
+ //# sourceMappingURL=chunk-AJ5PWKD4.js.map
@@ -0,0 +1,7 @@
1
+ import{h as g}from"./chunk-WCDXJGYT.js";import{a as b}from"./chunk-LX4H4LLG.js";import{b as m}from"./chunk-TINPMWJK.js";import{readFileSync as y}from"fs";import{join as d}from"path";function I(o,i){let t=b(o,i);if(!t)return null;let l=o.get("SELECT language FROM documents WHERE relative_path = ?",t.relativePath)?.language??"unknown",s=d(o.config.projectRoot,t.relativePath),n="";try{n=y(s,"utf-8").split(`
2
+ `).slice(t.startLine,t.endLine+1).join(`
3
+ `)}catch{}let e=S(n,l),f=t.endLine-t.startLine+1,a=g(o,[t],{additive:!0}).get(t.symbolId)??[],p=new Set(a.map(r=>r.symbol)),u=o.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`,t.symbolId),h=new Set(a.filter(r=>r.file!==t.relativePath).map(r=>r.symbol)).size;return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:f,branches:e,cyclomaticEstimate:e+1,calleeCount:p.size,fanIn:u?.c??0,fanOut:h}}function S(o,i){let t=P(o),c=0,l=[/\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 s of l){let n=t.match(s);n&&(c+=n.length)}if(i==="python"){let s=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="rust"){let s=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="ruby"){let s=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="go"){let s=[/\bselect\b/g,/\bdefer\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}return c}function P(o){return o.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*/g,"").replace(/#.*/g,"").replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/`(?:[^`\\]|\\.)*`/g,"``")}export{I as a};
7
+ //# sourceMappingURL=chunk-BDBRZPX3.js.map
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-LX4H4LLG.js";import{p as l}from"./chunk-IYFZS4PV.js";import{b as m,d as o,h as i}from"./chunk-TINPMWJK.js";function f(r,a){let t=n(r,a);return t?l(r,t.relativePath).filter(e=>e.symbol!==t.symbol).filter(e=>i(t.symbol,e.symbol)).sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine).map(e=>({symbol:e.symbol,shortName:m(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{f as a};
2
+ //# sourceMappingURL=chunk-BE6EQIWY.js.map
@@ -0,0 +1,8 @@
1
+ import{a as B,b as ie,c as ae,d as G,f as F,g as ce,h as S}from"./chunk-IYFZS4PV.js";import{existsSync as ve,readFileSync as Ae}from"fs";import{join as Oe}from"path";import{existsSync as w}from"fs";import{basename as Le,dirname as j,extname as R,join as E,relative as A,resolve as P}from"path";var qe=ie("indexed-paths"),H=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],K=[".py",".pyi"],C=[".java",".scala",".kt",".kts"],Z=[".rs"],ee=[".rb"],pe=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],L=[".cs",".vb"],te=[".dart"],X=[".php"],Ue=[H,K,C,Z,ee,pe,L,te,X];function $(e,r){return r.includes(R(e).toLowerCase())}function We(e){return $(e,K)}function Be(e){return $(e,C)}function Xe(e){return $(e,Z)}function Je(e){return $(e,ee)}function Fe(e){return $(e,pe)}function He(e){return $(e,L)}function le(e){return R(e).toLowerCase()===".vb"}function ze(e){return $(e,te)}function Ve(e){return $(e,X)}function re(e){let r=R(e).toLowerCase();for(let t of Ue)if(t.includes(r))return t;return H}function Qe(e){return Be(e)||He(e)||Ve(e)}function O(e,r,t){return We(r)?q(e,r,t):Xe(r)?T(e,r,t):Je(r)?z(e,r,t):Fe(r)?V(e,r,t):Qe(r)?g(e,t.replace(/\\/g,"."),re(r)):ze(r)?Q(e,r,t):Ye(e,r,t)}function Ye(e,r,t){if(!t.startsWith(".")&&!t.startsWith("/"))return null;let n=j(E(e.config.projectRoot,r)),s=P(n,t),o=M(e);for(let i of tt(s)){let a=b(A(e.config.projectRoot,i));if(o.has(a)||w(i))return a}return b(A(e.config.projectRoot,s))}function q(e,r,t){let n=M(e),s;if(t.startsWith(".")){let o=t.match(/^(\.+)(.*)$/);if(!o)return null;let i=o[1].length,a=o[2].replace(/^\./,""),c=j(E(e.config.projectRoot,r));for(let p=1;p<i;p++)c=j(c);s=a?P(c,a.replace(/\./g,"/")):c}else s=P(e.config.projectRoot,t.replace(/\./g,"/"));for(let o of Ge(s)){let i=b(A(e.config.projectRoot,o));if(n.has(i)||w(o))return i}return null}function T(e,r,t){if(!t)return null;let n=t.replace(/\s+as\s+.+$/,"").trim();if(!n.startsWith("crate::")&&!n.startsWith("self::")&&!n.startsWith("super::"))return null;let s=j(E(e.config.projectRoot,r)),o;n.startsWith("crate::")?o=P(e.config.projectRoot,"src",n.slice(7).replace(/::/g,"/")):n.startsWith("self::")?o=P(s,n.slice(6).replace(/::/g,"/")):o=P(j(s),n.slice(7).replace(/::/g,"/"));for(let i of Ke(o)){let a=b(A(e.config.projectRoot,i));if(M(e).has(a)||w(i))return a}return null}function z(e,r,t){let n=j(E(e.config.projectRoot,r)),s=P(n,t);for(let o of Ze(s)){let i=b(A(e.config.projectRoot,o));if(M(e).has(i)||w(o))return i}return null}function V(e,r,t){let n=M(e),s=j(E(e.config.projectRoot,r)),o=[P(s,t),P(e.config.projectRoot,t),P(e.config.projectRoot,"include",t),P(e.config.projectRoot,"src",t)];for(let i of o){let a=b(A(e.config.projectRoot,i));if(n.has(a)||w(i))return a}return null}function g(e,r,t){let n=M(e),s=r.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=s.replace(/\./g,"/"),i=s.split(".").pop()??s;for(let c of t){let p=`${o}${c}`,l=[...n].find(u=>u.endsWith(p));if(l)return l}for(let c of t){let p=[...n].find(l=>Le(l)===`${i}${c}`);if(p)return p}let a=[...n].filter(c=>t.includes(R(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${i}/`)).sort((c,p)=>c.localeCompare(p));return a.length===1?a[0]:null}function Q(e,r,t){let n=M(e);if(t.startsWith("package:")){let i=t.slice(8),a=i.indexOf("/");if(a<0)return null;let c=i.slice(a+1),p=b(c.startsWith("lib/")?c:`lib/${c}`);return n.has(p)?p:null}let s=j(E(e.config.projectRoot,r)),o=P(s,t);for(let i of et(o)){let a=b(A(e.config.projectRoot,i));if(n.has(a)||w(i))return a}return null}function Ge(e){let r=R(e);return K.includes(r)?[e]:[`${e}.py`,`${e}.pyi`,E(e,"__init__.py"),E(e,"__init__.pyi")]}function Ke(e){let r=R(e);return Z.includes(r)?[e]:[`${e}.rs`,E(e,"mod.rs")]}function Ze(e){let r=R(e);return ee.includes(r)?[e]:[`${e}.rb`,E(e,"index.rb")]}function et(e){let r=R(e);return te.includes(r)?[e]:[`${e}.dart`,e]}function tt(e){let r=R(e),t=new Set;if(r){t.add(e);for(let n of H)t.add(e.slice(0,-r.length)+n)}else for(let n of H)t.add(`${e}${n}`),t.add(E(e,`index${n}`));return[...t]}function M(e){return qe.get(e,()=>new Set(e.all(`SELECT relative_path
2
+ FROM documents
3
+ WHERE 1 = 1
4
+ ${e.pathExclusionsFor("documents")}`).map(r=>b(r.relative_path)).filter(r=>!e.isIgnored(r))))}function b(e){return e.replace(/\\/g,"/")}function me(e){return e.replace(/'''[\s\S]*?'''/g,v).replace(/"""[\s\S]*?"""/g,v).replace(/#.*$/gm,v).replace(/\/\/.*$/gm,v).replace(/\/\*[\s\S]*?\*\//g,v).replace(/`(?:\\[\s\S]|[^`])*`/g,v).replace(/'(?:\\.|[^'\\\r\n])*'/g,v).replace(/"(?:\\.|[^"\\\r\n])*"/g,v)}function v(e){return e.replace(/[^\r\n]/g," ")}var rt=ae("stripped-lines");function er(e,r,t){return rt.get(e,r,t,()=>me(t).split(`
5
+ `))}var ue=null,ne="";function nt(e){return ue===e||(ue=e,ne=me(e)),ne}function x(e,r,t){let n=nt(e);return`${n.slice(0,r)}${" ".repeat(t-r)}${n.slice(t)}`}function y(e,r){return new RegExp(`\\b${de(r)}\\b`,"m").test(e)}function U(e,r){let t=new Set,n=new RegExp(`\\b${de(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let s of e.matchAll(n)){let o=s[1];o&&t.add(o)}return[...t]}function de(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I(e){let r=[],t=0,n=0;for(let s=0;s<e.length;s++){let o=e[s];(o==="{"||o==="["||o==="(")&&t++,(o==="}"||o==="]"||o===")")&&t--,o===","&&t===0&&(r.push(e.slice(n,s)),n=s+1)}return r.push(e.slice(n)),r}function _(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function h(e,r){let t=new Set,n=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]),s=(o,i)=>{let a=i||r.has(o.type);!a&&n.has(o.type)&&t.add(o.text);for(let c of o.children)s(c,a)};return s(e.rootNode,!1),t}function D(e,r,t,n,s,o,i){return{importedName:s,localName:o,sourcePath:i??g(e,n,re(r)),kind:"named",used:y(t,o),usedMembers:[]}}function ge(e,r,t){let n=S(e,r);return n?st(e,r,n):at(t).flatMap(s=>ct(e,r,s.clause,s.specifier,s.start,s.end,t))}function st(e,r,t){let n=h(t,new Set(["import_statement"]));if(ce(r))for(let o of ht(e,r))n.add(o);let s=[];for(let o of t.rootNode.descendantsOfType("import_statement")){let i=ot(o);if(!i)continue;let a=O(e,r,i),c=_(o,"import_clause");if(!c){s.push({importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]});continue}for(let p of c.namedChildren)switch(p.type){case"identifier":{let l=p.text;s.push({importedName:"default",localName:l,sourcePath:a,kind:"default",used:n.has(l),usedMembers:[]});break}case"namespace_import":{let u=_(p,"identifier")?.text??"";if(!u)break;let m=it(t,u);s.push({importedName:"*",localName:u,sourcePath:a,kind:"namespace",used:m.length>0||n.has(u),usedMembers:m});break}case"named_imports":{for(let l of p.namedChildren){if(l.type!=="import_specifier")continue;let u=l.namedChild(0),m=l.namedChild(1);if(!u)continue;let d=u.text,f=m?.text??d;s.push({importedName:d,localName:f,sourcePath:a,kind:"named",used:n.has(f),usedMembers:[]})}break}}}return s}function ot(e){let r=_(e,"string");if(!r)return null;let t=_(r,"string_fragment");return t?t.text:null}function it(e,r){let t=new Set;for(let n of e.rootNode.descendantsOfType("member_expression")){let s=n.namedChild(0),o=n.namedChild(1);!s||!o||s.type!=="identifier"||s.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&t.add(o.text)}return[...t]}function at(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(t)){let o=s[0],i=s[1],a=s[2];!o||!a||typeof s.index!="number"||r.push({clause:i,specifier:a,start:s.index,end:s.index+o.length})}let n=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(n)){let o=s[0],i=s[1];!o||!i||typeof s.index!="number"||r.push({clause:null,specifier:i,start:s.index,end:s.index+o.length})}return r.sort((s,o)=>s.start-o.start)}function ct(e,r,t,n,s,o,i){let a=O(e,r,n),c=x(i,s,o);return t?pt(t).map(l=>({...l,sourcePath:a})).map(l=>{if(l.kind==="namespace"){let u=U(c,l.localName);return{...l,used:u.length>0||y(c,l.localName),usedMembers:u}}return l.kind==="side-effect"?{...l,used:!0,usedMembers:[]}:{...l,used:l.localName?y(c,l.localName):!1,usedMembers:[]}}):[{importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]}]}function pt(e){let r=e.trim().replace(/^type\s+/,""),[t,n]=lt(r),s=[];return t&&s.push(...fe(t)),n&&s.push(...fe(n)),s}function fe(e){let r=e.trim();if(!r)return[];if(r.startsWith("{")){let t=r.slice(1,-1).trim();return t?I(t).map(n=>{let s=n.trim().replace(/^type\s+/,""),[o,i]=s.split(/\s+as\s+/);return{importedName:o.trim(),localName:(i??o).trim(),kind:"named"}}):[]}return r.startsWith("* as ")?[{importedName:"*",localName:r.slice(5).trim(),kind:"namespace"}]:[{importedName:"default",localName:r,kind:"default"}]}function lt(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];if(n==="{"&&r++,n==="}"&&r--,n===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function he(e,r){let t=S(e,r);if(t)return mt(e,r,t);let n=G(e,r);if(!n)return[];let s=[],o=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let c of n.matchAll(o)){if(typeof c.index!="number")continue;let p=c[1]??"",l=c[2]??"",u=I(p).map(f=>ut(f.trim())).filter(f=>!!f),m=W(n,c.index),d=W(n,c.index+c[0].length-1);s.push({kind:"named",sourcePath:O(e,r,l),names:u,startLine:m,endLine:d})}let i=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let c of n.matchAll(i)){if(typeof c.index!="number")continue;let p=c[2]??"",l=W(n,c.index),u=W(n,c.index+c[0].length-1);s.push({kind:"star-as",sourcePath:O(e,r,p),names:[],startLine:l,endLine:u})}let a=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let c of n.matchAll(a)){if(typeof c.index!="number")continue;let p=c[1]??"",l=W(n,c.index),u=W(n,c.index+c[0].length-1);s.push({kind:"star",sourcePath:O(e,r,p),names:[],startLine:l,endLine:u})}return s}function ut(e){if(!e)return null;let r=e.replace(/^type\s+/,"").trim();if(!r)return null;let t=r.match(/^(\w+)\s+as\s+(\w+)$/);if(t)return t[2]??null;let n=r.match(/^(\w+)$/);return n?n[1]??null:null}function W(e,r){let t=0;for(let n=0;n<r&&n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function mt(e,r,t){let n=[];for(let s of t.rootNode.descendantsOfType("export_statement")){let o=dt(e,r,s);if(o===void 0)continue;let i=s.startPosition.row,a=s.endPosition.row,c=ft(s,o,i,a);n.push(c)}return n}function dt(e,r,t){let n=_(t,"string");if(!n)return;let s=_(n,"string_fragment");if(s)return O(e,r,s.text)}function ft(e,r,t,n){let s=_(e,"export_clause");if(s){let i=[];for(let a of s.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),p=a.namedChild(1);c&&i.push((p??c).text)}return{kind:"named",sourcePath:r,names:i,startLine:t,endLine:n}}return _(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:n}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:n}}var gt=B("vue-non-script-identifiers");function ht(e,r){return gt.get(e,r,()=>{let t=new Set,n=G(e,r);if(!n)return t;let o=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))t.add(i[0]);return t})}import{basename as Se}from"path";function xe(e,r,t){let n=S(e,r);if(n)return St(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm)){let i=o[1]?.trim(),a=o[0];if(!i||!a||typeof o.index!="number")continue;let c=x(t,o.index,o.index+a.length),p=Se(i).replace(/\.[^.]+$/,"");s.push({importedName:i,localName:p,sourcePath:V(e,r,i),kind:"named",used:y(c,p),usedMembers:[]})}return s}function St(e,r,t){let n=h(t,new Set(["preproc_include"])),s=[];for(let o of t.rootNode.descendantsOfType("preproc_include")){let i=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){i=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){i=c.namedChildren.find(l=>l.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=Se(i).replace(/\.[^.]+$/,"");s.push({importedName:i,localName:a,sourcePath:V(e,r,i),kind:"named",used:n.has(a),usedMembers:[]})}return s}function ye(e,r,t){let n=[];for(let s of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=s[1]?.trim(),i=s[2]?.trim()??null,a=s[0];if(!o||!a||typeof s.index!="number")continue;let c=x(t,s.index,s.index+a.length);n.push({importedName:o,localName:i,sourcePath:Q(e,r,o),kind:i?"namespace":"side-effect",used:i?y(c,i):!0,usedMembers:i?U(c,i):[]})}return n}function Ne(e,r,t){let n=[];for(let s of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=s[1]?.trim();o&&n.push({specifier:o,sourcePath:Q(e,r,o)})}return n}function Ie(e,r,t){let n=S(e,r),s=F(r);if(n&&s==="csharp")return yt(e,r,n);if(n&&s==="vb")return xt(e,r,n);let o=[],i=le(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;for(let a of t.matchAll(i)){let c=a[1]?.trim(),p=a[0];if(!c||!p||typeof a.index!="number")continue;let l=x(t,a.index,a.index+p.length),[u,m]=c.split(/\s*=\s*/),d=!!m,f=(d?m:u)?.trim()??c,N=f.split(".").pop()??f,k=d?u?.trim()??N:N;o.push(D(e,r,l,f,N,k,g(e,f,L)))}return o}function xt(e,r,t){let n=h(t,new Set(["imports_statement"])),s=[];for(let o of t.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(m=>m.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],c=i.length>1?i[0]:null,p=a.text,l=p.split(".").pop()??p,u=c?.text??l;s.push({importedName:l,localName:u,sourcePath:g(e,p,L),kind:c?"namespace":"named",used:n.has(u),usedMembers:[]})}return s}function yt(e,r,t){let n=h(t,new Set(["using_directive"])),s=[];for(let o of t.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,c=null;if(i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],c=i[1]):c=i[i.length-1],!c)continue;let p=c.text,l=p.split(".").pop()??p,u=a?.text??l;s.push({importedName:l,localName:u,sourcePath:g(e,p,L),kind:a?"namespace":"named",used:n.has(u),usedMembers:[]})}return s}function Pe(e,r,t){let n=S(e,r),s=F(r);if(n&&s==="java")return Nt(e,r,n);if(n&&s==="kotlin")return It(e,r,n);if(n&&s==="scala")return Pt(e,r,n);let o=[];for(let i of t.matchAll(/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm)){let a=i[1]?.trim(),c=i[0];if(!a||!c||typeof i.index!="number")continue;let p=x(t,i.index,i.index+c.length);o.push(...bt(e,r,a,p))}return o}function Nt(e,r,t){let n=h(t,new Set(["import_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(u=>u.type==="asterisk"),c=o.namedChildren.find(u=>u.type==="scoped_identifier")??o.namedChildren.find(u=>u.type==="identifier");if(!c)continue;let p=c.text;if(i){s.push({importedName:"*",localName:null,sourcePath:g(e,p,C),kind:"namespace",used:!0,usedMembers:[]});continue}let l=p.split(".").pop()??p;s.push({importedName:l,localName:l,sourcePath:g(e,p,C),kind:"named",used:n.has(l),usedMembers:[]})}return s}function It(e,r,t){let n=h(t,new Set(["import_header","import_list"])),s=[];for(let o of t.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),c=o.namedChildren.find(d=>d.type==="import_alias");if(a){s.push({importedName:"*",localName:null,sourcePath:g(e,i.text,C),kind:"namespace",used:!0,usedMembers:[]});continue}let p=i.text,l=p.split(".").pop()??p,m=c?.namedChild(0)?.text??l;s.push({importedName:l,localName:m,sourcePath:g(e,p,C),kind:"named",used:n.has(m),usedMembers:[]})}return s}function Pt(e,r,t){let n=h(t,new Set(["import_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(u=>u.type==="namespace_selectors"||u.type==="namespace_wildcard"),a=o.namedChildren.filter(u=>u!==i&&(u.type==="identifier"||u.type==="stable_identifier")),c=a.map(u=>u.text).join(".");if(!c)continue;if(i?.type==="namespace_wildcard"){s.push({importedName:"*",localName:null,sourcePath:g(e,c,C),kind:"namespace",used:!0,usedMembers:[]});continue}if(i?.type==="namespace_selectors"){for(let u of i.namedChildren)if(u.type==="arrow_renamed_identifier"){let[m,d]=u.namedChildren;if(!m)continue;let f=m.text,N=d?.text??f;if(f==="_")continue;s.push({importedName:f,localName:N,sourcePath:g(e,`${c}.${f}`,C),kind:"named",used:n.has(N),usedMembers:[]})}else if(u.type==="identifier"){let m=u.text;s.push({importedName:m,localName:m,sourcePath:g(e,`${c}.${m}`,C),kind:"named",used:n.has(m),usedMembers:[]})}continue}let p=a[a.length-1]?.text??c,l=a.slice(0,-1).map(u=>u.text).join(".")||c;s.push({importedName:p,localName:p,sourcePath:g(e,l&&a.length>1?`${l}.${p}`:c,C),kind:"named",used:n.has(p),usedMembers:[]})}return s}function bt(e,r,t,n){if(t.includes("{")&&t.includes("}")){let s=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),o=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return I(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,p]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),l=c?.trim();if(!l||l==="_")return[];let u=(p??l.split(".").pop()??l).trim(),m=l==="_"?s:`${s}.${l}`.replace(/\.\./g,".");return[D(e,r,n,m,l,u)]})}return[D(e,r,n,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function _e(e,r,t){let n=S(e,r);if(n)return _t(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim(),a=o[0];if(!i||!a||typeof o.index!="number")continue;let c=x(t,o.index,o.index+a.length);for(let p of I(i)){let l=p.trim();if(!l)continue;let[u,m]=l.split(/\s+as\s+/i),d=u?.trim()??l,f=d.split("\\").pop()??d,N=(m??f).trim();s.push(D(e,r,c,d,f,N,g(e,d.replace(/\\/g,"."),X)))}}return s}function _t(e,r,t){let n=h(t,new Set(["namespace_use_declaration"])),s=[],o=(i,a,c)=>{s.push({importedName:a,localName:c,sourcePath:g(e,i.replace(/\\/g,"."),X),kind:"named",used:n.has(c),usedMembers:[]})};for(let i of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=i.namedChildren.find(p=>p.type==="namespace_name")?.text??"";for(let p of a.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:l,localName:u,qualified:m}=be(p,c);l&&o(m,l,u)}continue}for(let c of i.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:p,localName:l,qualified:u}=be(c,"");p&&o(u,p,l)}}return s}function be(e,r){let t=e.namedChildren.find(p=>p.type==="qualified_name"),n=e.namedChildren.filter(p=>p.type==="name"),s="";t?s=t.text:n.length>=1&&(s=n[0].text);let o=t&&n.length>0?n[n.length-1]:null,i=s.split("\\").pop()??s,a=o?.text??i,c=r?`${r}\\${s}`:s;return{importedName:i,localName:a,qualified:c}}function De(e,r,t){let n=S(e,r);return n?Et(e,r,n):Dt(t).flatMap(s=>Tt(e,r,s,t))}function Et(e,r,t){let n=h(t,new Set(["import_statement","import_from_statement"])),s=[];for(let o of t.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=Ee(i);if(!a)continue;let c=q(e,r,a.qualifiedName);s.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:n.has(a.localName),usedMembers:[]})}for(let o of t.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=Ct(i);if(a===null)continue;let c=q(e,r,a);for(let p=1;p<o.namedChildCount;p+=1){let l=o.namedChild(p);if(l.type==="wildcard_import"){s.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let u=Ee(l);u&&s.push({importedName:u.qualifiedName,localName:u.localName,sourcePath:c,kind:"named",used:n.has(u.localName),usedMembers:[]})}}return s}function Ee(e){if(e.type==="aliased_import"){let r=e.namedChild(0),t=e.namedChild(1);return!r||!t?null:{qualifiedName:r.text,localName:t.text}}if(e.type==="dotted_name"){let r=e.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function Ct(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=_(e,"import_prefix")?.text??"",t=_(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function Dt(e){let r=e.split(`
6
+ `),t=[],n=0;for(let s=0;s<r.length;s++){let o=r[s],i=o.trimStart(),a=n;if(n+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let c=o,p=a+o.length,l=Ce(o);for(;s+1<r.length&&(l>0||c.trimEnd().endsWith("\\"));){s++;let m=r[s];c+=`
7
+ ${m}`,p+=1+m.length,l+=Ce(m),n+=m.length+1}let u=Rt(c);u&&t.push({...u,start:a,end:p})}return t}function Rt(e){let r=e.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let t=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!t)return null;let n=t[2].trim();return n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1).trim()),{kind:"from",module:t[1],clause:n}}function Tt(e,r,t,n){let s=x(n,t.start,t.end),o=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return I(o).flatMap(c=>{let p=c.trim().replace(/,$/,"");if(!p)return[];let[l,u]=p.split(/\s+as\s+/),m=l.trim(),d=(u??m.split(".")[0]??m).trim(),f=q(e,r,m),N=U(s,d);return[{importedName:m,localName:d,sourcePath:f,kind:"namespace",used:y(s,d)||N.length>0,usedMembers:N}]});let i=t.module?q(e,r,t.module):null,a=[];for(let c of I(o)){let p=c.trim().replace(/,$/,"");if(!p)continue;if(p==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[l,u]=p.split(/\s+as\s+/),m=(u??l).trim();a.push({importedName:l.trim(),localName:m,sourcePath:i,kind:"named",used:y(s,m),usedMembers:[]})}return a}function Ce(e){let r=0;for(let t of e)t==="("&&r++,t===")"&&r--;return r}import{basename as kt}from"path";function Re(e,r,t){let n=S(e,r);if(n)return jt(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm)){let i=o[1],a=o[2],c=o[0];if(!i||!a||!c||typeof o.index!="number")continue;let p=x(t,o.index,o.index+c.length),l=i==="require_relative"?z(e,r,a):null;if(l){let u=Te(a);s.push({importedName:u,localName:u,sourcePath:l,kind:"named",used:y(p,u),usedMembers:[]});continue}s.push({importedName:a,localName:null,sourcePath:l,kind:"side-effect",used:!0,usedMembers:[]})}return s}function jt(e,r,t){let n=h(t,new Set([])),s=[],o=new Set(["require","require_relative","load"]);for(let i of t.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let p=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!p||p.type!=="string")continue;let u=p.namedChildren.find(d=>d.type==="string_content")?.text;if(!u)continue;let m=a.text==="require_relative"?z(e,r,u):null;if(m){let d=Te(u);s.push({importedName:d,localName:d,sourcePath:m,kind:"named",used:n.has(d),usedMembers:[]})}else s.push({importedName:u,localName:null,sourcePath:m,kind:"side-effect",used:!0,usedMembers:[]})}return s}function Te(e){return kt(e).replace(/\.[^.]+$/,"").split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}function ke(e,r,t){let n=S(e,r);if(n)return $t(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim(),a=o[0];if(!i||!a||typeof o.index!="number")continue;let c=x(t,o.index,o.index+a.length);s.push(...vt(e,r,i,c))}return s}function $t(e,r,t){let n=h(t,new Set(["use_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of J(i,"")){if(!a.importedName||a.importedName==="*")continue;let c=T(e,r,a.qualifiedName)??T(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));s.push({importedName:a.importedName,localName:a.localName,sourcePath:c,kind:"named",used:n.has(a.localName),usedMembers:[]})}}return s}function J(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:Y(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,n=t.split("::").pop()??t;return[{qualifiedName:Y(r,t),importedName:n,localName:n}]}case"scoped_use_list":{let t=e.namedChild(0),n=e.namedChild(1);if(!t||!n)return[];let s=Y(r,t.text),o=[];for(let i of n.namedChildren)o.push(...J(i,s));return o}case"use_list":{let t=[];for(let n of e.namedChildren)t.push(...J(n,r));return t}case"use_as_clause":{let t=e.namedChild(0),n=e.namedChild(1);if(!t||!n)return[];let s=J(t,r),o=n.text;return s.map(i=>({...i,localName:o}))}case"use_wildcard":{let t=e.namedChild(0),n=t?t.text:"";return[{qualifiedName:Y(r,`${n}::*`),importedName:"*",localName:"*"}]}default:return[]}}function Y(e,r){return e?r?`${e}::${r}`:e:r}function vt(e,r,t,n){let s=t.trim();if(s.includes("{")&&s.includes("}")){let l=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),u=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return I(u).flatMap(m=>{let d=m.trim();if(!d||d==="self")return[];let[f,N]=d.split(/\s+as\s+/),k=f?.trim();if(!k)return[];let Me=(N??k.split("::").pop()??k).trim(),we=`${l}::${k}`.replace(/::::/g,"::");return[D(e,r,n,we,k.split("::").pop()??k,Me,T(e,r,l))]})}let[o,i]=s.split(/\s+as\s+/),a=o?.trim()??s,c=(i??a.split("::").pop()??a).trim(),p=T(e,r,a)??T(e,r,a.split("::").slice(0,-1).join("::"));return[D(e,r,n,a,a.split("::").pop()??a,c,p)]}function je(e,r,t){let n=S(e,r);if(n)return At(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&s.push(...Mt(e,r,i))}return s}function At(e,r,t){let n=[];for(let s of t.rootNode.descendantsOfType("use_declaration")){if(!Ot(s))continue;let o=s.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of J(o,""))i.importedName&&n.push(se(e,r,i.qualifiedName))}return n}function Ot(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function Mt(e,r,t){let n=t.trim();if(n.includes("{")&&n.includes("}")){let s=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),o=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return I(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),p=`${s}::${c?.trim()??a}`.replace(/::::/g,"::");return[se(e,r,p)]})}return[se(e,r,n)]}function se(e,r,t){return{specifier:t,sourcePath:T(e,r,t)??T(e,r,t.split("::").slice(0,-1).join("::"))}}function $e(e,r){let t=r.toLowerCase();for(let n of e)for(let s of n.extensions)if(t.endsWith(s))return n;return null}var wt={language:"javascript",extensions:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],parseImports:ge},Lt={language:"python",extensions:[".py",".pyi"],parseImports:De},qt={language:"jvm",extensions:[".java",".scala",".kt",".kts"],parseImports:Pe},Ut={language:"rust",extensions:[".rs"],parseImports:ke,parseExports:je},Wt={language:"ruby",extensions:[".rb"],parseImports:Re},Bt={language:"c/cpp",extensions:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],parseImports:xe},Xt={language:"dotnet",extensions:[".cs",".vb"],parseImports:Ie},Jt={language:"dart",extensions:[".dart"],parseImports:ye,parseExports:Ne},Ft={language:"php",extensions:[".php"],parseImports:_e},Ht=[wt,Lt,qt,Ut,Wt,Bt,Xt,Jt,Ft];function oe(e){return $e(Ht,e)}function Sn(e,r){return he(e,r)}var zt=B("source-imports"),Vt=B("source-exports");function xn(e,r){let t=b(r);return zt.get(e,t,()=>{let n=oe(t);if(!n)return[];let s=Oe(e.config.projectRoot,t);if(!ve(s))return[];let o=Ae(s,"utf-8");return n.parseImports(e,t,o)})}function yn(e,r){let t=b(r);return Vt.get(e,t,()=>{let n=oe(t);if(!n?.parseExports)return[];let s=Oe(e.config.projectRoot,t);if(!ve(s))return[];let o=Ae(s,"utf-8");return n.parseExports(e,t,o)})}export{me as a,er as b,de as c,Sn as d,xn as e,yn as f};
8
+ //# sourceMappingURL=chunk-BQ3INTYT.js.map
@@ -0,0 +1,2 @@
1
+ import{f as S,j as M}from"./chunk-WCDXJGYT.js";import{a as g,b as I}from"./chunk-LX4H4LLG.js";import{p as d,t as p}from"./chunk-IYFZS4PV.js";import{b as u}from"./chunk-TINPMWJK.js";function N(s,f,n={}){let{maxDepth:a=5,scope:b}=n,c=g(s,f);if(!c)return[];let i=[],y=new Set([c.symbolId]),r=new Set,l=[c];for(let e=1;e<=a&&l.length!==0;e++){let t=[];for(let m of l)for(let o of w(s,m,b)){let h=`${o.file}|${o.shortName}`;if(o.symbolId!==null){if(y.has(o.symbolId))continue;y.add(o.symbolId)}else if(r.has(h))continue;r.add(h),i.push({symbol:o.symbol,shortName:o.shortName,file:o.file,depth:e}),o.symbolId!==null&&o.symbolMatch&&t.push(o.symbolMatch)}l=t}return i.sort((e,t)=>e.depth-t.depth||e.file.localeCompare(t.file)),i}function w(s,f,n){let a=S(s,f,{limit:500}).filter(e=>!s.isIgnored(e.file)).filter(e=>!n||e.file.includes(n)),b=new Set(a.map(e=>e.file)),c=M(s).get(f.symbolId)??new Set,i=[];for(let e of c){if(b.has(e)||s.isIgnored(e)||n&&!e.includes(n))continue;let t=d(s,e),m=t.length>0?p(t,t[0].startLine):null;i.push({symbol:m?.symbol??e,file:e})}let y=[...a,...i],r=[],l=new Set;for(let e of y){let t=I(s,e.symbol);if(!t){let o=`${e.file}|${e.symbol}`;if(l.has(o))continue;l.add(o),r.push({symbolId:null,symbol:e.symbol,shortName:u(e.symbol),file:e.file,symbolMatch:null});continue}if(t.symbolId===f.symbolId||s.isIgnored(t.relativePath))continue;let m=`${t.symbolId}|${t.relativePath}`;l.has(m)||(l.add(m),r.push({symbolId:t.symbolId,symbol:t.symbol,shortName:u(t.symbol),file:t.relativePath,symbolMatch:t}))}return r}export{N as a};
2
+ //# sourceMappingURL=chunk-D7KLLMPB.js.map
@@ -0,0 +1,29 @@
1
+ import{b as m}from"./chunk-WTSTDJZ7.js";import{p as a}from"./chunk-IYFZS4PV.js";import{b as d,e as l}from"./chunk-TINPMWJK.js";function u(t,n){let s=m(t,n);if(s.length===0)return[];let i=s.map(()=>"?").join(", "),c=t.all(`SELECT DISTINCT d1.relative_path, gs.symbol
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d1 ON c.document_id = d1.id
5
+ JOIN global_symbols gs ON m.symbol_id = gs.id
6
+ WHERE d1.relative_path NOT IN (${i})
7
+ AND (
8
+ EXISTS (
9
+ SELECT 1
10
+ FROM defn_enclosing_ranges der
11
+ JOIN documents d2 ON der.document_id = d2.id
12
+ WHERE der.symbol_id = gs.id
13
+ AND d2.relative_path IN (${i})
14
+ )
15
+ OR EXISTS (
16
+ SELECT 1
17
+ FROM mentions def_m
18
+ JOIN chunks def_c ON def_m.chunk_id = def_c.id
19
+ JOIN documents d2 ON def_c.document_id = d2.id
20
+ WHERE def_m.symbol_id = gs.id
21
+ AND def_m.role = 1
22
+ AND d2.relative_path IN (${i})
23
+ )
24
+ )
25
+ AND m.role != 1
26
+ AND ${t.localSymbolPredicate}
27
+ ${t.pathExclusionsFor("d1")}
28
+ ORDER BY d1.relative_path`,...s,...s,...s),p=s.flatMap(e=>a(t,e).filter(o=>l(o.symbol)).map(o=>({relative_path:e,symbol:o.symbol}))),r=new Set;return[...c,...p].filter(e=>!t.isIgnored(e.relative_path)).filter(e=>{let o=`${e.relative_path}|${e.symbol}`;return r.has(o)?!1:(r.add(o),!0)}).map(e=>({consumer:e.relative_path,symbol:e.symbol,shortName:d(e.symbol)}))}export{u as a};
29
+ //# sourceMappingURL=chunk-D7YBWSON.js.map
@@ -0,0 +1,39 @@
1
+ import{a as h}from"./chunk-WTSTDJZ7.js";import{e as p}from"./chunk-BQ3INTYT.js";import{a as _}from"./chunk-LX4H4LLG.js";import{b as d,c,g as f}from"./chunk-TINPMWJK.js";function v(e,i){return b(e,i)?.map(t=>({symbol:t.symbol,shortName:t.shortName,fromFile:t.fromFile}))??[]}function F(e,i){let a=e.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`,`%${i}%`).filter(s=>!e.isIgnored(s.importer)).map(s=>({symbol:s.symbol,shortName:d(s.symbol),fromFile:s.importer}));if(a.length>0)return a;let o=_(e,i),r=o?.relativePath??null,m=o?c(o.symbol):i.replace(/\(\)$/,""),u=o?f(o.symbol):!1,y=e.all(`SELECT relative_path
9
+ FROM documents
10
+ WHERE 1 = 1
11
+ ${e.pathExclusionsFor("documents")}
12
+ ORDER BY relative_path`),l=new Set;for(let s of y)if(!e.isIgnored(s.relative_path)){for(let n of p(e,s.relative_path))if(n.sourcePath&&!(r&&g(n.sourcePath)!==g(r))){if(n.kind==="side-effect"){l.add(s.relative_path);continue}if(r&&E(s.relative_path)){l.add(s.relative_path);continue}if(u){l.add(s.relative_path);continue}if(n.kind==="named"&&n.importedName===m){l.add(s.relative_path);continue}n.kind==="namespace"&&n.usedMembers.includes(m)&&l.add(s.relative_path)}}return[...l].sort().map(s=>({symbol:o?.symbol??m,shortName:o?d(o.symbol):m,fromFile:s}))}function D(e,i){return b(e,i)?.filter(t=>!t.used).map(t=>({symbol:t.symbol,shortName:t.shortName,importedIn:t.importer}))??[]}function b(e,i){let t=h(e,i);if(!t)return null;let o=e.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`,t).filter(r=>!e.isIgnored(r.importer));return o.length>0?o.map(r=>({symbol:r.symbol,shortName:d(r.symbol),fromFile:r.from_file??"(external)",importer:r.importer,used:r.used!==0})):p(e,t).map(r=>{let m=I(r.importedName,r.localName,r.kind),u=r.kind==="side-effect"?!0:r.used;return{symbol:m,shortName:m,fromFile:r.sourcePath??"(external)",importer:t,used:u}})}function I(e,i,t){return t==="namespace"&&e==="*"&&i?`* as ${i}`:t==="default"&&i?`default as ${i}`:t==="side-effect"?"(side effect import)":i&&i!==e?`${e} as ${i}`:e}function g(e){return e.replace(/\\/g,"/")}function E(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{v as a,F as b,D as c};
39
+ //# sourceMappingURL=chunk-DE5ZBHMK.js.map
@@ -0,0 +1,33 @@
1
+ import{a as s}from"./chunk-WTSTDJZ7.js";function r(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d1 ON c.document_id = d1.id
5
+ JOIN global_symbols gs ON m.symbol_id = gs.id
6
+ JOIN (
7
+ SELECT m2.symbol_id, c2.document_id
8
+ FROM mentions m2
9
+ JOIN chunks c2 ON m2.chunk_id = c2.id
10
+ WHERE m2.role = 1
11
+ GROUP BY m2.symbol_id
12
+ ) sym_def ON sym_def.symbol_id = gs.id
13
+ JOIN documents d2 ON sym_def.document_id = d2.id
14
+ WHERE d1.relative_path = ?
15
+ AND d2.relative_path <> d1.relative_path
16
+ AND ${e.localSymbolPredicate}
17
+ ORDER BY d2.relative_path`,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}function a(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d1.relative_path
18
+ FROM mentions m
19
+ JOIN chunks c ON m.chunk_id = c.id
20
+ JOIN documents d1 ON c.document_id = d1.id
21
+ JOIN global_symbols gs ON m.symbol_id = gs.id
22
+ JOIN (
23
+ SELECT m2.symbol_id, c2.document_id
24
+ FROM mentions m2
25
+ JOIN chunks c2 ON m2.chunk_id = c2.id
26
+ WHERE m2.role = 1
27
+ GROUP BY m2.symbol_id
28
+ ) sym_def ON sym_def.symbol_id = gs.id
29
+ JOIN documents d2 ON sym_def.document_id = d2.id
30
+ WHERE d2.relative_path = ?
31
+ AND d1.relative_path != ?
32
+ ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{r as a,a as b};
33
+ //# sourceMappingURL=chunk-DHYIJHXZ.js.map
@@ -0,0 +1,2 @@
1
+ import{a as h}from"./chunk-GNXRLK5G.js";import{d as x}from"./chunk-WCDXJGYT.js";function R(s,n={}){let{scope:i,maxDepth:C=10}=n,y=x(s,i),a=[],l=new Set,f=new Set,c=[];function m(e,t){if(t>C)return;if(f.has(e)){let o=c.indexOf(e);if(o!==-1){let r=c.slice(o).concat(e),u=r.indexOf(r.reduce((b,S)=>b<S?b:S)),p=[...r.slice(u,-1),...r.slice(0,u),r[u]],k=p.join(" -> ");d.has(k)||(d.add(k),a.push({path:p,kind:D(p)}))}return}if(l.has(e))return;l.add(e),f.add(e),c.push(e);let g=y.get(e);if(g)for(let o of g)m(o,t+1);c.pop(),f.delete(e)}let d=new Set;for(let e of y.keys())l.has(e)||m(e,0);return a.sort((e,t)=>e.kind!==t.kind?e.kind==="real"?-1:1:e.path.length-t.path.length),a}function D(s){if(s.length!==3)return"real";let[n,i]=s;return!n||!i?"real":h(n)||h(i)?"module-hierarchy":"real"}export{R as a};
2
+ //# sourceMappingURL=chunk-EEF3YEHW.js.map
@@ -0,0 +1,2 @@
1
+ import{h as v}from"./chunk-WCDXJGYT.js";import{e as L,r as w}from"./chunk-IYFZS4PV.js";import{b,f as C}from"./chunk-TINPMWJK.js";function q(i,k={}){let{scope:x,minLoc:z=10,minCallees:D=6,limit:E=20}=k,y=w(i,x).filter(t=>!i.isIgnored(t.relativePath)).filter(t=>h(t)>=z&&C(t.symbol)).filter(t=>!(t.relativePath.split("/").pop()??"").includes("types")).filter(t=>!L(i,t.relativePath,t.startLine)).sort((t,r)=>h(r)-h(t)),F=v(i,y),d=[];for(let t of y){let r=F.get(t.symbolId)??[],c=new Set(r.map(e=>e.symbol));if(c.size<D)continue;let l=new Map;for(let e of c)l.set(e,new Set);let a=new Map;for(let e of r)a.has(e.chunkId)||a.set(e.chunkId,new Set),a.get(e.chunkId).add(e.symbol);for(let e of a.values()){let s=[...e];for(let o=0;o<s.length;o++)for(let n=o+1;n<s.length;n++)l.get(s[o]).add(s[n]),l.get(s[n]).add(s[o])}let f=new Set,m=[];for(let e of c){if(f.has(e))continue;let s=new Set,o=[e];for(;o.length>0;){let n=o.pop();if(!f.has(n)){f.add(n),s.add(n);for(let u of l.get(n)??[])f.has(u)||o.push(u)}}m.push(s)}if(m.length<2)continue;let S=m.filter(e=>e.size>=3).map(e=>{let s=new Set;for(let p of m)if(p!==e)for(let g of p)s.add(g);let o=0;for(let p of e)for(let g of l.get(p)??[])s.has(g)&&o++;let n=e.size*s.size,u=n>0?1-o/n:1;return{callees:[...e].map(b),isolation:u}}).filter(e=>e.isolation>.5).sort((e,s)=>s.isolation-e.isolation);S.length>0&&d.push({symbol:t.symbol,shortName:b(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:h(t),totalCallees:c.size,clusters:S})}return d.sort((t,r)=>r.clusters.length-t.clusters.length||r.loc-t.loc),d.slice(0,E)}function h(i){return i.endLine-i.startLine+1}export{q as a};
2
+ //# sourceMappingURL=chunk-F2LLHRRZ.js.map
@@ -0,0 +1,2 @@
1
+ import{e as n,f as a}from"./chunk-WCDXJGYT.js";import{a as i}from"./chunk-LX4H4LLG.js";import{b as m}from"./chunk-TINPMWJK.js";function b(s,e){let o=i(s,e);if(!o)return null;let t=a(s,o,{limit:50}),r=y(n(s,o,{limit:50}));return{symbol:o.symbol,shortName:m(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file}))}}function y(s){let e=new Set,o=[];for(let t of s){let r=`${t.symbol}|${t.file}`;e.has(r)||(e.add(r),o.push(t))}return o}export{b as a};
2
+ //# sourceMappingURL=chunk-FCC3XJTI.js.map
@@ -0,0 +1,2 @@
1
+ import{a as c}from"./chunk-ZSRXMNMK.js";import{d as f}from"./chunk-WCDXJGYT.js";import{b as a}from"./chunk-IYFZS4PV.js";function i(t){let r=_(t);return b(r)?"test":x(r)?"worker":S(r)?"entry":P(r)?"barrel":"source"}function l(t){return i(t)==="barrel"}function p(t){return g.get(t,()=>{let r=f(t),e=c(t).filter(s=>{let n=i(s);return n==="entry"||n==="worker"}),u=new Set,o=new Set;for(;e.length>0;){let s=e.shift();if(!u.has(s)){u.add(s),i(s)==="barrel"&&o.add(s);for(let n of r.get(s)??[])u.has(n)||e.push(n)}}return o})}var g=a("live-barrels");function h(t,r){return p(t).has(_(r))}function $(t){let r=p(t);return c(t).filter(e=>l(e)&&!r.has(e))}function k(t,r){let e=i(r);return e==="entry"||e==="worker"||h(t,r)}var v=["%/__tests__/%","%.test.%","%.spec.%","%/test/%","%/tests/%","%_test.%","%_spec.%","%/test_%.%","%/spec_%.%"],w=["%/test-utils/%"];function b(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)||/(?:^|\/)[^/]+_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 x(t){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(t)}function S(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 _(t){return t.replace(/\\/g,"/")}export{l as a,h as b,$ as c,k as d,v as e,w as f};
2
+ //# sourceMappingURL=chunk-GNXRLK5G.js.map
@@ -0,0 +1,62 @@
1
+ import{a as l}from"./chunk-WTSTDJZ7.js";import{d as r}from"./chunk-WCDXJGYT.js";import{a as c}from"./chunk-LX4H4LLG.js";import{b as d}from"./chunk-TINPMWJK.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
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
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
6
+ FROM mentions m
7
+ JOIN chunks c ON m.chunk_id = c.id
8
+ JOIN documents d ON c.document_id = d.id
9
+ JOIN global_symbols gs ON m.symbol_id = gs.id
10
+ JOIN (
11
+ SELECT m2.symbol_id, c2.document_id
12
+ FROM mentions m2
13
+ JOIN chunks c2 ON m2.chunk_id = c2.id
14
+ WHERE m2.role = 1
15
+ GROUP BY m2.symbol_id
16
+ ) sym_def ON sym_def.symbol_id = gs.id
17
+ JOIN documents def_d ON sym_def.document_id = def_d.id
18
+ WHERE d.relative_path = ?
19
+ AND m.role != 1
20
+ AND def_d.id != d.id
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
23
+ FROM mentions m
24
+ JOIN chunks c ON m.chunk_id = c.id
25
+ JOIN global_symbols gs ON m.symbol_id = gs.id
26
+ JOIN (
27
+ SELECT m2.symbol_id, c2.document_id
28
+ FROM mentions m2
29
+ JOIN chunks c2 ON m2.chunk_id = c2.id
30
+ WHERE m2.role = 1
31
+ GROUP BY m2.symbol_id
32
+ ) sym_def ON sym_def.symbol_id = gs.id
33
+ JOIN documents def_d ON sym_def.document_id = def_d.id
34
+ WHERE m.role != 1
35
+ ${e.pathExclusionsFor("def_d")}
36
+ ${e.symbolNoiseFor("gs")}
37
+ ${n}
38
+ GROUP BY gs.id
39
+ HAVING file_count > 1
40
+ ORDER BY file_count DESC
41
+ LIMIT ?`,o)}function I(e,t={}){let{limit:o=30,scope:i}=t,n=i?`AND d.relative_path LIKE '%${i}%'`:"";return e.all(`SELECT d.relative_path, COUNT(DISTINCT gs.id) AS symbol_count
42
+ FROM mentions m
43
+ JOIN chunks c ON m.chunk_id = c.id
44
+ JOIN documents d ON c.document_id = d.id
45
+ JOIN global_symbols gs ON m.symbol_id = gs.id
46
+ JOIN (
47
+ SELECT m2.symbol_id, c2.document_id
48
+ FROM mentions m2
49
+ JOIN chunks c2 ON m2.chunk_id = c2.id
50
+ WHERE m2.role = 1
51
+ GROUP BY m2.symbol_id
52
+ ) sym_def ON sym_def.symbol_id = gs.id
53
+ JOIN documents def_d ON sym_def.document_id = def_d.id
54
+ WHERE m.role != 1
55
+ AND def_d.id != d.id
56
+ ${e.pathExclusionsFor("d")}
57
+ ${e.symbolNoiseFor("gs")}
58
+ ${n}
59
+ GROUP BY d.id
60
+ ORDER BY symbol_count DESC
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-GXVB36TG.js.map
@@ -0,0 +1,2 @@
1
+ import{e as f}from"./chunk-WCDXJGYT.js";import{a as m}from"./chunk-LX4H4LLG.js";import{b as r}from"./chunk-TINPMWJK.js";function w(i,g,p){let s=m(i,g),n=m(i,p);if(!s||!n)return null;let c=new Set(f(i,s).map(e=>e.symbol)),h=new Set(f(i,n).map(e=>e.symbol)),a=[];for(let e of c)h.has(e)&&a.push(e);let o=[];for(let e of c)h.has(e)||o.push(e);let l=[];for(let e of h)c.has(e)||l.push(e);let u=new Set([...c,...h]),d=u.size>0?a.length/u.size:0,t;u.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":a.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":o.length===0&&l.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":l.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&l.length<=2?t=`Create a shared function with the ${a.length} common callees. Pass the ${o.length+l.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${a.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${o.length} callees in A, ${l.length} in B).`;let y=s.endLine-s.startLine+1,b=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:r(s.symbol),file:s.relativePath,loc:y},symbolB:{symbol:n.symbol,shortName:r(n.symbol),file:n.relativePath,loc:b},similarity:d,sharedCallees:a.map(r),uniqueToA:o.map(r),uniqueToB:l.map(r),consolidationStrategy:t}}export{w as a};
2
+ //# sourceMappingURL=chunk-HMKJTAZD.js.map
@@ -0,0 +1,2 @@
1
+ import{d as y}from"./chunk-WCDXJGYT.js";function L(D,k={}){let{limit:x=10,scope:M,minDepth:j=3}=k,g=y(D,M),u=new Map,o=[],l=new Map,r=new Map,a=new Set,f=[],d=0;for(let t of g.keys()){if(l.has(t))continue;let n=[],s=(g.get(t)??new Set).values();for(l.set(t,d),r.set(t,d),d+=1,f.push(t),a.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let h=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(h)))}let c=e.iter.next();if(c.done){if(r.get(e.node)===l.get(e.node)){let h=[];for(;;){let p=f.pop();if(a.delete(p),h.push(p),u.set(p,o.length),p===e.node)break}o.push(h)}n.pop();continue}let i=c.value;if(l.has(i))a.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,d),r.set(i,d),d+=1,f.push(i),a.add(i);let h=(g.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:h,pendingChild:null})}}}let m=new Map,b=new Array(o.length);for(let t=0;t<o.length;t++)b[t]=o[t].length,m.set(t,new Set);for(let[t,n]of g){let s=u.get(t);for(let e of n){let c=u.get(e);c!==s&&m.get(s).add(c)}}let S=new Array(o.length),I=new Array(o.length);for(let t=0;t<o.length;t++){let n=[],s=0;for(let e of m.get(t)){let c=I[e];c>s&&(s=c,n=S[e])}S[t]=[t,...n],I[t]=b[t]+s}function v(t){return S[t]}let A=o.map(t=>[...t].sort()),C=new Set,w=[];for(let t=0;t<o.length;t++){let n=v(t),s=[];for(let c of n)s.push(...A[c]);if(s.length<j)continue;let e=s.join(" ");C.has(e)||(C.add(e),w.push({chain:s,depth:s.length}))}return w.sort((t,n)=>n.depth-t.depth),w.slice(0,x)}export{L as a};
2
+ //# sourceMappingURL=chunk-IBGBI3VU.js.map