scip-query 0.10.1 → 0.10.3

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 (273) hide show
  1. package/README.md +2 -2
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-24PFLKFK.js → chunk-3KLLFNT4.js} +2 -2
  4. package/dist/{chunk-UIWAZ2NT.js → chunk-3UVJJ6Z7.js} +1 -1
  5. package/dist/chunk-3UW7VM4H.js +62 -0
  6. package/dist/chunk-3ZYF3ELZ.js +2 -0
  7. package/dist/{chunk-6YKJSETN.js → chunk-47UA45TU.js} +2 -2
  8. package/dist/chunk-4HOMAEDD.js +2 -0
  9. package/dist/{chunk-5VB3WU7K.js → chunk-4ZUJJRWT.js} +2 -2
  10. package/dist/{chunk-LWPEZ4FP.js → chunk-5FOPAXWY.js} +2 -2
  11. package/dist/{chunk-CCB45WDY.js → chunk-5M4TYWVI.js} +2 -2
  12. package/dist/{chunk-PV4CEDIL.js → chunk-5QJXH6ZL.js} +5 -5
  13. package/dist/{chunk-NN3O7TPH.js → chunk-64MNV6AB.js} +1 -1
  14. package/dist/{chunk-LWWZBABT.js → chunk-77YBOOYT.js} +2 -2
  15. package/dist/chunk-7ADUXFRZ.js +2 -0
  16. package/dist/chunk-7KCSELEV.js +2 -0
  17. package/dist/{chunk-GZXXBDJA.js → chunk-7OHWPJ5N.js} +2 -2
  18. package/dist/{chunk-BJ7OHKB5.js → chunk-7S5E7KWT.js} +1 -1
  19. package/dist/chunk-A3VNUGKJ.js +2 -0
  20. package/dist/{chunk-CMGOXDVP.js → chunk-A4L36SZS.js} +2 -2
  21. package/dist/{chunk-5D3BT4B4.js → chunk-AUVBR62P.js} +2 -2
  22. package/dist/chunk-AW4N6MGC.js +18 -0
  23. package/dist/{chunk-65UWNXEH.js → chunk-B6MJ5VQV.js} +2 -2
  24. package/dist/chunk-BKDXBJDQ.js +2 -0
  25. package/dist/{chunk-WZVTADY7.js → chunk-C2QSK7E7.js} +1 -1
  26. package/dist/chunk-C3MZZ2ZN.js +2 -0
  27. package/dist/{chunk-GTNPPGZJ.js → chunk-CAWSSEVM.js} +2 -2
  28. package/dist/chunk-CFL2CNIF.js +10 -0
  29. package/dist/{chunk-E55WCTLH.js → chunk-CJJP64OC.js} +2 -2
  30. package/dist/{chunk-ADKQX2OY.js → chunk-CRU42NJU.js} +2 -2
  31. package/dist/chunk-CSWZFD46.js +2 -0
  32. package/dist/{chunk-QOFKVNFE.js → chunk-CTCAF3YA.js} +2 -2
  33. package/dist/{chunk-YVQUQIBM.js → chunk-D322LMSA.js} +2 -2
  34. package/dist/{chunk-IJYWCB57.js → chunk-DAI74TJU.js} +2 -2
  35. package/dist/chunk-DE7MA6OD.js +3 -0
  36. package/dist/chunk-DJMK4DBL.js +2 -0
  37. package/dist/{chunk-FVX4GEAC.js → chunk-E44ZMVNA.js} +2 -2
  38. package/dist/{chunk-MESUJJVQ.js → chunk-E7KERP7E.js} +2 -2
  39. package/dist/{chunk-YIE5FZAF.js → chunk-EOZIZWW4.js} +2 -2
  40. package/dist/{chunk-XGGTESMN.js → chunk-ERHOS6AW.js} +2 -2
  41. package/dist/{chunk-5HDYAOSF.js → chunk-ESG4HBEF.js} +2 -2
  42. package/dist/{chunk-HCQ7J2N5.js → chunk-EWC3UK4V.js} +3 -3
  43. package/dist/chunk-EYLXU575.js +2 -0
  44. package/dist/chunk-FIB4JPEX.js +2 -0
  45. package/dist/chunk-FNRPGGVI.js +2 -0
  46. package/dist/{chunk-QUKZ77A6.js → chunk-FOQHUKNZ.js} +2 -2
  47. package/dist/{chunk-QH5GTVVB.js → chunk-FUPDW5AC.js} +2 -2
  48. package/dist/{chunk-B3HMRQDA.js → chunk-G3WGZU5Q.js} +2 -2
  49. package/dist/chunk-GLJAAKDW.js +4 -0
  50. package/dist/{chunk-TUAPDKBI.js → chunk-GS33KGAY.js} +2 -2
  51. package/dist/{chunk-623UQCVG.js → chunk-GZCQTZLK.js} +2 -2
  52. package/dist/{chunk-SA6B3EGD.js → chunk-HVTYSC26.js} +2 -2
  53. package/dist/chunk-I7TSQZ3J.js +4 -0
  54. package/dist/{chunk-R7S3UCDR.js → chunk-ICXVNWMI.js} +2 -2
  55. package/dist/chunk-JM72FNGA.js +2 -0
  56. package/dist/{chunk-DRU74YUM.js → chunk-KPHKX4LP.js} +1 -1
  57. package/dist/chunk-KRGBLZT2.js +7 -0
  58. package/dist/{chunk-YYCQQBMG.js → chunk-LPLGJ4HO.js} +2 -2
  59. package/dist/chunk-MUULWXSJ.js +2 -0
  60. package/dist/chunk-MZ7APUFN.js +3 -0
  61. package/dist/{chunk-LYS4SMAQ.js → chunk-NNDYO2DX.js} +2 -2
  62. package/dist/{chunk-ATGRITZP.js → chunk-NP5HYVLX.js} +4 -4
  63. package/dist/{chunk-MHAQXOZY.js → chunk-NVFERV4U.js} +2 -2
  64. package/dist/{chunk-LWYIGRHR.js → chunk-NXIAHE7F.js} +1 -1
  65. package/dist/chunk-O3OKSF6O.js +2 -0
  66. package/dist/chunk-O4L4AB3T.js +2 -0
  67. package/dist/{chunk-TMS4JPWY.js → chunk-OBBDKQAG.js} +2 -2
  68. package/dist/chunk-OLD6PBU6.js +7 -0
  69. package/dist/{chunk-5BZOSICN.js → chunk-PFOCOG57.js} +1 -1
  70. package/dist/{chunk-CFLYMEUS.js → chunk-PVZMPG5I.js} +1 -1
  71. package/dist/{chunk-T67R7V5I.js → chunk-QLNGUWR7.js} +2 -2
  72. package/dist/chunk-QSXQT3NE.js +2 -0
  73. package/dist/{chunk-6TWFT4Y5.js → chunk-QVCCLDZI.js} +2 -2
  74. package/dist/{chunk-PNN3D4BE.js → chunk-RHTJBYZ5.js} +2 -2
  75. package/dist/chunk-SPE4YCOT.js +7 -0
  76. package/dist/{chunk-4N7LFYSD.js → chunk-TM6GVHA6.js} +2 -2
  77. package/dist/chunk-TO54DY4O.js +2 -0
  78. package/dist/{chunk-HQHFMPLJ.js → chunk-UMNENNTX.js} +2 -2
  79. package/dist/chunk-UQJGTVHV.js +5 -0
  80. package/dist/{chunk-TKDJQ2WD.js → chunk-UUBMFL3F.js} +1 -1
  81. package/dist/chunk-VAA5FFIW.js +2 -0
  82. package/dist/chunk-X474LKJX.js +2 -0
  83. package/dist/chunk-X7ZY6FFF.js +4 -0
  84. package/dist/{chunk-RNLUCQJB.js → chunk-YQH353VA.js} +2 -2
  85. package/dist/{chunk-44JOJLMO.js → chunk-YTR4CO5S.js} +2 -2
  86. package/dist/chunk-YUOAAR24.js +2 -0
  87. package/dist/chunk-YVLHL6KQ.js +8 -0
  88. package/dist/{chunk-ADTG377O.js → chunk-YYD245WG.js} +2 -2
  89. package/dist/{chunk-I6PTB2CM.js → chunk-Z4VHYJ5U.js} +2 -2
  90. package/dist/chunk-ZFMPHDAT.js +4 -0
  91. package/dist/chunk-ZQLO2SCU.js +6 -0
  92. package/dist/chunk-ZSLT7NWQ.js +61 -0
  93. package/dist/cli.js +242 -225
  94. package/dist/{config-types-Bok4jrO3.d.ts → config-types-Bj4sh28g.d.ts} +8 -0
  95. package/dist/{db-BkFlkzI3.d.ts → db-CTarohbZ.d.ts} +1 -1
  96. package/dist/git-history-Dao3_Pu9.d.ts +12 -0
  97. package/dist/{health-CbGMdRPg.d.ts → health-Bx0x1HAG.d.ts} +23 -2
  98. package/dist/index.d.ts +3 -3
  99. package/dist/index.js +1 -1
  100. package/dist/postinstall.js +1 -1
  101. package/dist/queries/affected.d.ts +2 -2
  102. package/dist/queries/affected.js +1 -1
  103. package/dist/queries/bottlenecks.d.ts +6 -2
  104. package/dist/queries/bottlenecks.js +1 -1
  105. package/dist/queries/by-kind.d.ts +2 -2
  106. package/dist/queries/by-kind.js +1 -1
  107. package/dist/queries/call-graph.d.ts +2 -2
  108. package/dist/queries/call-graph.js +1 -1
  109. package/dist/queries/change-surface.d.ts +2 -2
  110. package/dist/queries/change-surface.js +1 -1
  111. package/dist/queries/cleanup-plan.d.ts +2 -2
  112. package/dist/queries/cleanup-plan.js +1 -1
  113. package/dist/queries/co-change.d.ts +37 -3
  114. package/dist/queries/co-change.js +1 -1
  115. package/dist/queries/code.d.ts +2 -2
  116. package/dist/queries/code.js +1 -1
  117. package/dist/queries/complexity-hotspots.d.ts +2 -2
  118. package/dist/queries/complexity-hotspots.js +1 -1
  119. package/dist/queries/complexity.d.ts +2 -2
  120. package/dist/queries/complexity.js +1 -1
  121. package/dist/queries/convergence.d.ts +2 -2
  122. package/dist/queries/convergence.js +1 -1
  123. package/dist/queries/coupling.d.ts +6 -2
  124. package/dist/queries/coupling.js +1 -1
  125. package/dist/queries/cycles.d.ts +2 -2
  126. package/dist/queries/cycles.js +1 -1
  127. package/dist/queries/dataflow.d.ts +2 -2
  128. package/dist/queries/dataflow.js +1 -1
  129. package/dist/queries/dead.d.ts +10 -3
  130. package/dist/queries/dead.js +1 -1
  131. package/dist/queries/deep-chains.d.ts +6 -2
  132. package/dist/queries/deep-chains.js +1 -1
  133. package/dist/queries/deps.d.ts +2 -2
  134. package/dist/queries/deps.js +1 -1
  135. package/dist/queries/diff-gate.d.ts +53 -3
  136. package/dist/queries/diff-gate.js +1 -1
  137. package/dist/queries/diff-impact.d.ts +2 -2
  138. package/dist/queries/diff-impact.js +1 -1
  139. package/dist/queries/doc-drift.d.ts +20 -3
  140. package/dist/queries/doc-drift.js +1 -1
  141. package/dist/queries/drift.d.ts +10 -3
  142. package/dist/queries/drift.js +1 -1
  143. package/dist/queries/extract-candidates.d.ts +11 -3
  144. package/dist/queries/extract-candidates.js +1 -1
  145. package/dist/queries/fan.d.ts +2 -2
  146. package/dist/queries/fan.js +1 -1
  147. package/dist/queries/files.d.ts +2 -2
  148. package/dist/queries/files.js +1 -1
  149. package/dist/queries/health.d.ts +3 -3
  150. package/dist/queries/health.js +1 -1
  151. package/dist/queries/hierarchy.d.ts +2 -2
  152. package/dist/queries/hierarchy.js +1 -1
  153. package/dist/queries/hotspots.d.ts +2 -2
  154. package/dist/queries/hotspots.js +1 -1
  155. package/dist/queries/imports.d.ts +2 -2
  156. package/dist/queries/imports.js +1 -1
  157. package/dist/queries/incomplete-migration.d.ts +14 -3
  158. package/dist/queries/incomplete-migration.js +1 -1
  159. package/dist/queries/index.d.ts +17 -15
  160. package/dist/queries/index.js +1 -1
  161. package/dist/queries/isolated.d.ts +2 -2
  162. package/dist/queries/isolated.js +1 -1
  163. package/dist/queries/locality-candidates.d.ts +51 -0
  164. package/dist/queries/locality-candidates.js +2 -0
  165. package/dist/queries/members.d.ts +2 -2
  166. package/dist/queries/members.js +1 -1
  167. package/dist/queries/methods.d.ts +2 -2
  168. package/dist/queries/methods.js +1 -1
  169. package/dist/queries/outline.d.ts +2 -2
  170. package/dist/queries/outline.js +1 -1
  171. package/dist/queries/passthrough-candidates.d.ts +8 -3
  172. package/dist/queries/passthrough-candidates.js +1 -1
  173. package/dist/queries/plan-context.d.ts +4 -2
  174. package/dist/queries/plan-context.js +1 -1
  175. package/dist/queries/react-component-duplicates.d.ts +2 -2
  176. package/dist/queries/react-component-duplicates.js +1 -1
  177. package/dist/queries/react-hook-candidates.d.ts +9 -3
  178. package/dist/queries/react-hook-candidates.js +1 -1
  179. package/dist/queries/react-large-component-pressure.d.ts +9 -3
  180. package/dist/queries/react-large-component-pressure.js +1 -1
  181. package/dist/queries/recent-duplicates.d.ts +25 -3
  182. package/dist/queries/recent-duplicates.js +1 -1
  183. package/dist/queries/redundant-reexports.d.ts +7 -3
  184. package/dist/queries/redundant-reexports.js +1 -1
  185. package/dist/queries/refs.d.ts +2 -2
  186. package/dist/queries/refs.js +1 -1
  187. package/dist/queries/self-audit.d.ts +2 -2
  188. package/dist/queries/self-audit.js +1 -1
  189. package/dist/queries/similar-chains.d.ts +2 -2
  190. package/dist/queries/similar-chains.js +1 -1
  191. package/dist/queries/similar-files.d.ts +2 -2
  192. package/dist/queries/similar-files.js +1 -1
  193. package/dist/queries/similar-signatures.d.ts +2 -2
  194. package/dist/queries/similar-signatures.js +1 -1
  195. package/dist/queries/similar.d.ts +24 -3
  196. package/dist/queries/similar.js +1 -1
  197. package/dist/queries/slice.d.ts +2 -2
  198. package/dist/queries/slice.js +1 -1
  199. package/dist/queries/stale-abstractions.d.ts +10 -3
  200. package/dist/queries/stale-abstractions.js +1 -1
  201. package/dist/queries/stats.d.ts +2 -2
  202. package/dist/queries/stats.js +1 -1
  203. package/dist/queries/surface.d.ts +2 -2
  204. package/dist/queries/surface.js +1 -1
  205. package/dist/queries/symbols.d.ts +2 -2
  206. package/dist/queries/symbols.js +1 -1
  207. package/dist/queries/system.d.ts +2 -2
  208. package/dist/queries/system.js +1 -1
  209. package/dist/queries/trace.d.ts +2 -2
  210. package/dist/queries/trace.js +1 -1
  211. package/dist/queries/unused-imports.d.ts +4 -0
  212. package/dist/queries/unused-imports.js +2 -0
  213. package/dist/queries/unused-params.d.ts +2 -2
  214. package/dist/queries/unused-params.js +1 -1
  215. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  216. package/dist/queries/vue-component-duplicates.js +1 -1
  217. package/dist/queries/vue-composable-candidates.d.ts +9 -3
  218. package/dist/queries/vue-composable-candidates.js +1 -1
  219. package/dist/queries/vue-large-view-pressure.d.ts +9 -3
  220. package/dist/queries/vue-large-view-pressure.js +1 -1
  221. package/dist/queries/wrapper-candidates.d.ts +6 -3
  222. package/dist/queries/wrapper-candidates.js +1 -1
  223. package/dist/reindex-worker.js +1 -1
  224. package/dist/reindex.d.ts +1 -1
  225. package/dist/reindex.js +1 -1
  226. package/dist/runtime.d.ts +1 -1
  227. package/dist/runtime.js +2 -2
  228. package/docs/COMMAND_REFERENCE.md +3 -2
  229. package/docs/analyzer-inventory.md +162 -0
  230. package/docs/analyzer-validation-ledger.md +262 -0
  231. package/docs/analyzer-validation-protocol.md +192 -0
  232. package/docs/locality-analyzer-design.md +193 -0
  233. package/package.json +14 -3
  234. package/skills/scip-directory-architecture/SKILL.md +178 -0
  235. package/skills/scip-maintainability/SKILL.md +1 -1
  236. package/skills/scip-query/SKILL.md +2 -1
  237. package/skills/scip-query-setup/SKILL.md +118 -0
  238. package/skills/scip-react-maintainability/SKILL.md +1 -1
  239. package/skills/scip-vue-maintainability/SKILL.md +1 -1
  240. package/dist/chunk-23FVN4Y5.js +0 -2
  241. package/dist/chunk-27KPKLRJ.js +0 -7
  242. package/dist/chunk-2NLK4INB.js +0 -2
  243. package/dist/chunk-2XKAMW6B.js +0 -61
  244. package/dist/chunk-332L7SRO.js +0 -2
  245. package/dist/chunk-4EAANIWC.js +0 -2
  246. package/dist/chunk-5ALI77D7.js +0 -3
  247. package/dist/chunk-5IDEQEM4.js +0 -4
  248. package/dist/chunk-62NMBOA5.js +0 -2
  249. package/dist/chunk-64LH2QUP.js +0 -62
  250. package/dist/chunk-6U4EODW3.js +0 -2
  251. package/dist/chunk-A2GVUCZR.js +0 -8
  252. package/dist/chunk-DBIG4QAJ.js +0 -2
  253. package/dist/chunk-DMLPJ75B.js +0 -2
  254. package/dist/chunk-DTERBKUE.js +0 -7
  255. package/dist/chunk-F4PKYBQB.js +0 -2
  256. package/dist/chunk-JTRY2YRJ.js +0 -2
  257. package/dist/chunk-L77GXANO.js +0 -6
  258. package/dist/chunk-LT6GJ27X.js +0 -10
  259. package/dist/chunk-LUBKUISI.js +0 -2
  260. package/dist/chunk-LVYXX7ZW.js +0 -2
  261. package/dist/chunk-LXM7AHQG.js +0 -4
  262. package/dist/chunk-LY6NRJPJ.js +0 -2
  263. package/dist/chunk-N2T2GPYQ.js +0 -2
  264. package/dist/chunk-OB6PEVI3.js +0 -2
  265. package/dist/chunk-R42LZMLX.js +0 -2
  266. package/dist/chunk-RGDUIMNE.js +0 -3
  267. package/dist/chunk-RYBMW2EN.js +0 -2
  268. package/dist/chunk-TTGWDUJ4.js +0 -5
  269. package/dist/chunk-UVK3SL4Z.js +0 -2
  270. package/dist/chunk-W3PQRAI4.js +0 -2
  271. package/dist/chunk-WWFBDM5Y.js +0 -2
  272. package/dist/chunk-Y33GRQK6.js +0 -18
  273. package/dist/chunk-YISMWW66.js +0 -7
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: scip-directory-architecture
3
+ description: Review and improve repository directory architecture with scip-query evidence. Use when the user asks to design, evaluate, reorganize, or migrate source folder structure; identify feature/module ownership boundaries; turn a messy or AI-generated codebase into clearer folders; decide whether locality boundaries are mature enough for config; or plan safe directory migrations without guessing from filenames alone.
4
+ ---
5
+
6
+ # SCIP Directory Architecture
7
+
8
+ ## Overview
9
+
10
+ Use this skill to turn source layout questions into an evidence-backed architecture review. Do not treat the current folder tree as authoritative, and do not invent an "optimal" structure without proving the ownership concepts from code, tests, docs, and dependency evidence.
11
+
12
+ A directory architecture is the filesystem arrangement of source files by their main reason to change. Its defining trait is that a maintainer can predict where a concept belongs before reading every import.
13
+
14
+ An ownership boundary is a folder, package, module, or convention that groups code around one stable responsibility. Its defining trait is that code inside the boundary should usually change for the same kind of reason.
15
+
16
+ A target structure is a proposed future folder layout for the repo or scope. Its defining trait is that it expresses the desired ownership model, not merely a prettier tree.
17
+
18
+ A migration slice is the smallest set of file moves and import updates that can be verified independently. Its defining trait is that it reduces one structural ambiguity without requiring the whole architecture to move at once.
19
+
20
+ ## Non-Negotiables
21
+
22
+ 1. Start with evidence, not taste. Refresh the index when stale, then ground claims in `scip-query` outputs plus project docs and tests.
23
+ 2. Separate review from migration. A directory architecture review may propose moves; it does not move files unless the user asked for implementation or approved a specific migration slice.
24
+ 3. Preserve working conventions. Existing boundaries are not wrong just because they are broad; central folders such as `errors`, `routes`, `workflows`, `schemas`, `contracts`, or `features` may be doing real work.
25
+ 4. Do not reward generic `shared`. A shared folder is justified only when the shared concept has a name, owner, and consumers across real boundaries.
26
+ 5. Treat messy repos honestly. If ownership concepts are not stable, produce a discovery map and decision list instead of pretending the repo has a clean target structure.
27
+ 6. Prefer small verified moves. Broad reorganizations need staged migration slices with import updates, tests, `scip-query reindex`, and `scip-query diff-gate`.
28
+
29
+ ## Workflow
30
+
31
+ ### 1. Bound the Question
32
+
33
+ Identify whether the user wants:
34
+
35
+ - a review of the existing structure;
36
+ - a proposed target structure;
37
+ - a locality config decision;
38
+ - a migration plan;
39
+ - or an actual file-moving implementation.
40
+
41
+ If the user asks for "the best folder structure," translate that into: "What ownership model is supported by this repo's code, tests, product domains, and change history?"
42
+
43
+ ### 2. Refresh and Inventory
44
+
45
+ Run:
46
+
47
+ ```bash
48
+ scip-query status
49
+ scip-query reindex
50
+ scip-query stats
51
+ find . -maxdepth 3 -type d | sort
52
+ ```
53
+
54
+ Read durable project guidance before judging structure:
55
+
56
+ ```bash
57
+ rg -n "architecture|structure|feature|module|boundary|shared|workflow|route|contract|domain|ownership" AGENTS.md README.md docs agent-os .codex -g '!node_modules'
58
+ ```
59
+
60
+ Use `rg --files` to sample real files in each important folder. Ignore generated, build, coverage, vendored, and dependency directories unless they are part of the architecture question.
61
+
62
+ ### 3. Build the Evidence Map
63
+
64
+ Use these probes as evidence, not as verdicts:
65
+
66
+ ```bash
67
+ scip-query system <scope>
68
+ scip-query files <pattern>
69
+ scip-query surface <scope>
70
+ scip-query deps <file>
71
+ scip-query rdeps <file>
72
+ scip-query change-surface <file>
73
+ scip-query plan-context <file-or-symbol>
74
+ scip-query locality-candidates --json --full
75
+ scip-query cycles
76
+ scip-query co-change
77
+ scip-query similar-files --min-similarity 0.6 --min-deps 3
78
+ scip-query similar-chains --min-similarity 0.5
79
+ scip-query recent-duplicates
80
+ scip-query drift
81
+ ```
82
+
83
+ For each folder under review, record:
84
+
85
+ - real-world concept or product area represented by the folder;
86
+ - public exports, entry points, routes, commands, or package surfaces;
87
+ - main consumers and cross-boundary consumers;
88
+ - tests that define the folder's behavior;
89
+ - co-change partners and repeated edit patterns;
90
+ - duplicated or parallel folder patterns;
91
+ - docs or standards that claim ownership rules.
92
+
93
+ ### 4. Classify Boundary Maturity
94
+
95
+ Classify each candidate folder:
96
+
97
+ - Mature: repeated, documented, and enforced by imports, tests, routes, packages, standards, or review history.
98
+ - Emerging: meaningful and partly repeated, but not yet consistent enough to configure or enforce.
99
+ - Accidental: a convenience bucket, legacy pile, generated artifact, recent edit cluster, or mixed folder with unrelated reasons to change.
100
+
101
+ A slop codebase is a codebase whose files are arranged by accident, convenience, or recent edits rather than stable ownership rules. Its defining trait is that directory names do not reliably predict where code should live. For this case, stop at discovery and decision prompts unless the user explicitly asks for a first migration slice.
102
+
103
+ ### 5. Propose the Target Structure
104
+
105
+ Produce an architecture proposal with this shape:
106
+
107
+ ````markdown
108
+ # Directory Architecture Review
109
+
110
+ ## Scope
111
+ ## Current Structure Map
112
+ ## Boundary Maturity
113
+
114
+ | Boundary | Evidence | Maturity | Judgment |
115
+ | --- | --- | --- | --- |
116
+
117
+ ## Target Structure
118
+
119
+ ```text
120
+ src/
121
+ ...
122
+ ```
123
+
124
+ ## Move Ledger
125
+
126
+ | Slice | Current files | Proposed home | Why | Verification |
127
+ | --- | --- | --- | --- | --- |
128
+
129
+ ## Locality Config
130
+ ## Deferred Decisions
131
+ ## Migration Order
132
+ ````
133
+
134
+ The target structure should name ownership concepts, not just folder labels. Prefer existing names when they already carry meaning. Introduce a new folder only when it removes ambiguity for multiple files or consumers.
135
+
136
+ ### 6. Decide What Not to Move
137
+
138
+ Explicitly list no-move decisions when:
139
+
140
+ - a broad consumer set proves a central boundary is useful;
141
+ - a folder is route-facing, package-facing, or contract-facing;
142
+ - consumers cross boundaries because the concept is infrastructure;
143
+ - moving would hide a domain-specific concept under generic `shared`;
144
+ - the evidence is too weak and needs a human ownership decision.
145
+
146
+ ### 7. Implement Only a Migration Slice
147
+
148
+ When the user asks to proceed, pick the smallest high-confidence slice. Before editing, state:
149
+
150
+ - files to move;
151
+ - imports/exports/tests/docs to update;
152
+ - expected verification commands;
153
+ - rollback risk.
154
+
155
+ Then move files with normal filesystem tools, update imports with project tooling where available, and run:
156
+
157
+ ```bash
158
+ scip-query reindex
159
+ scip-query incomplete-migration
160
+ scip-query recent-duplicates
161
+ scip-query co-change <moved-file-or-config>
162
+ scip-query diff-gate
163
+ ```
164
+
165
+ Also run the repo's normal tests or typecheck for the affected workspace. If the migration adds or changes `.scipquery.json` locality settings, run:
166
+
167
+ ```bash
168
+ scip-query config-validate
169
+ scip-query locality-candidates --json --full
170
+ ```
171
+
172
+ ## Output Rules
173
+
174
+ - Lead with findings and judgments, not command transcripts.
175
+ - Every proposed boundary needs evidence from at least two independent signals or a clear note that it is only a candidate.
176
+ - Every proposed move needs a verification path.
177
+ - For messy repos, output "discovery mode" and decision questions instead of a fake complete architecture.
178
+ - For implementation, never batch unrelated folder moves just because they fit the same target structure.
@@ -249,7 +249,7 @@ Then run the post-change checks that match what the fix actually did:
249
249
  | --- | --- |
250
250
  | Extracted a helper, hook, composable, component logic, or named abstraction | `scip-query incomplete-migration`; migrate every unchanged site that still contains the extracted logic or document essential variation |
251
251
  | Added a new helper, module, component, hook, or composable | `scip-query similar <new-symbol>` when symbol-like, plus `scip-query recent-duplicates --full`; delete echoes of established code |
252
- | Consolidated duplicated files, command handlers, adapters, or workflows | rerun the detector that motivated the change: `similar-files`, `similar-chains`, `wrapper-candidates`, `passthrough-candidates`, frontend duplicate commands, or `health --full` |
252
+ | Consolidated duplicated files, command handlers, adapters, or workflows | rerun the detector that motivated the change: `similar-files`, `similar-chains`, `wrapper-candidates`, `passthrough-candidates`, frontend duplicate commands, or `health` |
253
253
  | Added parameters, options, config flags, props, or broad option objects | `scip-query unused-params`; remove speculative inputs that no body uses |
254
254
  | Added a wrapper, adapter, facade, re-export, or forwarding layer | `scip-query wrapper-candidates`, `scip-query passthrough-candidates`, and `scip-query redundant-reexports` when exports changed |
255
255
  | Added an interface, base class, type alias, or abstraction boundary | `scip-query stale-abstractions --include-low-confidence`; prove the abstraction has real consumers and policy |
@@ -37,7 +37,8 @@ When the user asks you to build, change, or fix something non-trivial:
37
37
  | Find dead code, duplication, or structural bloat | `scip-debloat` | `scip-query health` |
38
38
  | Clean up after AI-assisted coding sessions | `scip-ai-cleanup` | `scip-query recent-duplicates`, `scip-query incomplete-migration` |
39
39
  | Reconcile docs/standards that drifted from the code | `scip-doc-reconcile` | `scip-query doc-drift <doc>` |
40
- | Review architecture, boundaries, hidden policies | `scip-maintainability` | `scip-query bottlenecks`, `scip-query coupling` |
40
+ | Review or redesign source folder structure and ownership boundaries | `scip-directory-architecture` | `scip-query locality-candidates --json --full`, `scip-query similar-files --full` |
41
+ | Review architecture, hidden policies, weak boundaries beyond folder structure | `scip-maintainability` | `scip-query bottlenecks`, `scip-query coupling` |
41
42
  | Review React frontend reuse, components, hooks, or TSX/JSX maintainability | `scip-react-maintainability` | `scip-query react-component-duplicates --full`, `scip-query react-hook-candidates --full` |
42
43
  | Review Vue frontend reuse, SFCs, templates, or composables | `scip-vue-maintainability` | `scip-query vue-component-duplicates --full`, `scip-query vue-composable-candidates --full` |
43
44
 
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: scip-query-setup
3
+ description: Set up or refresh scip-query in a repository so agents can use compiler-resolved code intelligence effectively. Use when adopting scip-query in a repo, fixing stale setup, adding AGENTS.md guidance, checking capability coverage, configuring .scipquery.json, or calibrating locality architectural boundaries.
4
+ allowed-tools: [Bash, Read, Edit, Write, Glob, Skill]
5
+ ---
6
+
7
+ # scip-query Setup
8
+
9
+ Use this skill when a repository needs to become a reliable scip-query workspace, not merely a repo where the binary happens to run.
10
+
11
+ A scip-query workspace is a source repository with a current SCIP index, project config, and agent guidance that make code references compiler-resolved instead of guessed from text search. Its defining trait is that agents can answer "where is this defined, who uses it, and what changes with it?" from the index before editing.
12
+
13
+ A setup pass is the bounded workflow that installs or verifies the tool, creates the project index, writes agent instructions, and records repo-specific calibration. Its defining trait is that it turns one-off local success into a repeatable operating surface for future agents.
14
+
15
+ ## Setup Workflow
16
+
17
+ 1. Confirm the project root.
18
+
19
+ ```bash
20
+ pwd
21
+ git rev-parse --show-toplevel
22
+ ```
23
+
24
+ 2. Verify the command is available.
25
+
26
+ ```bash
27
+ scip-query --version
28
+ scip-query status --json
29
+ ```
30
+
31
+ If the command is missing, install or link it using the repo's package manager, then rerun this step.
32
+
33
+ 3. Create or refresh the index.
34
+
35
+ ```bash
36
+ scip-query reindex
37
+ scip-query stats
38
+ ```
39
+
40
+ If indexing fails, run `scip-query status --json` and fix the reported missing indexer, language, or config problem before continuing.
41
+
42
+ 4. Seed durable agent guidance.
43
+
44
+ ```bash
45
+ scip-query setup-agent
46
+ ```
47
+
48
+ Use `scip-query setup-agent --git-hook` only when the user wants the repository to enforce `diff-gate` before commits.
49
+
50
+ 5. Check capability coverage.
51
+
52
+ ```bash
53
+ scip-query capability-matrix
54
+ scip-query health
55
+ ```
56
+
57
+ Record unsupported or partial capabilities in the setup notes. Do not describe an analyzer as "clean" when the capability matrix says its evidence is unavailable for the language.
58
+
59
+ 6. Calibrate project config.
60
+
61
+ Open or create `.scipquery.json`. Keep config minimal and tied to observed repo facts.
62
+
63
+ ```json
64
+ {
65
+ "languages": ["typescript"],
66
+ "locality": {
67
+ "architecturalBoundarySegments": ["effect", "errors", "policies", "workflows"]
68
+ }
69
+ }
70
+ ```
71
+
72
+ An architectural boundary segment is a folder name that marks a code ownership boundary, such as `effect`, `errors`, `policies`, `routes`, `schemas`, or `workflows`. Its defining trait is that broad use of code inside that folder can mean the boundary is central and intentional, so `locality-candidates` should not invent a generic `shared` destination for it.
73
+
74
+ Before writing `locality.architecturalBoundarySegments`, classify boundary maturity:
75
+
76
+ - Mature boundary: folder names recur as intentional ownership units in code, tests, docs, route/workflow conventions, or agent standards. Add only the repo-specific segment names not already built in.
77
+ - Emerging boundary: folder names look meaningful, but ownership is inconsistent or only visible in one area. Do not configure yet; record candidates and rerun after a few reviewed locality results prove the boundary.
78
+ - No reliable boundary: the repo is mostly flat, mixed, generated, or ad hoc. Leave locality config absent or empty. Do not invent architecture; use `locality-candidates` as a discovery report and ask for human ownership decisions.
79
+
80
+ Treat boundary maturity as an evidence question. A segment needs at least two independent signals before it belongs in config: directory structure plus a project standard, repeated import convention, test organization, package boundary, route family, workflow family, or reviewed locality false positive. If the same folder name means different things in different parts of the repo, do not add it globally.
81
+
82
+ For an unstructured repo, setup runs in discovery mode. Discovery mode means the tool records candidate ownership clusters and uncertain folders, but does not write `locality.architecturalBoundarySegments`. The setup note should say which paths need a human architecture decision and should keep `locality-candidates` recommendations as suggestions to inspect, not moves to trust.
83
+
84
+ Use `locality.architecturalBoundarySegments` only when validation finds a repo-specific mature boundary that is not already in the built-in list. Add folder names, not paths.
85
+
86
+ 7. Validate directory-organization signals when setup touches locality.
87
+
88
+ ```bash
89
+ scip-query locality-candidates --json --full
90
+ ```
91
+
92
+ Review rows with non-null `suggestedHome`. Keep exact destinations only when the path already exists, stays inside the source root, and matches the repo's ownership model. When a generic `shared` destination is wrong because the current folder is a real boundary, add that folder name to `.scipquery.json` and rerun.
93
+
94
+ Validate both suppression and emission. Suppression means a bad generic home was withheld because the source already lives in a real boundary. Emission means a useful `suggestedHome` is still shown for code that genuinely lacks a home. A config that suppresses every row is acceptable only when manual review confirms there were no useful destinations to emit.
95
+
96
+ If the repo has no mature boundaries, the correct setup result is a note, not a config guess: "locality boundaries not configured; repo needs architecture ownership decisions first." A slop codebase is a codebase whose files are arranged by accident, convenience, or recent edits rather than by stable ownership rules. Its defining trait is that directory names do not reliably predict where code should live, so the setup skill must not make `locality-candidates` appear more certain than the repo itself.
97
+
98
+ 8. Finish with the standard gate.
99
+
100
+ ```bash
101
+ scip-query reindex
102
+ scip-query diff-gate
103
+ ```
104
+
105
+ Fix findings or state the explicit acceptance reason.
106
+
107
+ ## Handoff Notes
108
+
109
+ When setup changes are complete, record:
110
+
111
+ - repository path and revision;
112
+ - index command and result;
113
+ - capability matrix limitations;
114
+ - `.scipquery.json` changes and why each setting exists;
115
+ - validation commands and raw-output locations;
116
+ - final `diff-gate` result.
117
+
118
+ Do not add broad analyzer config in advance. Each setting should be justified by a reviewed false positive, false negative, capability gap, or repo convention.
@@ -31,7 +31,7 @@ scip-query react-component-duplicates --scope <react-source-scope> --full --json
31
31
  scip-query react-hook-candidates --scope <react-source-scope> --full --json
32
32
  scip-query react-large-component-pressure --scope <react-source-scope> --full --json
33
33
  scip-query recent-duplicates --scope <react-source-scope> --full --json
34
- scip-query health --scope <react-source-scope> --full --json
34
+ scip-query health --scope <react-source-scope> --json
35
35
  ```
36
36
 
37
37
  ## Workflow
@@ -38,7 +38,7 @@ Run the Vue review commands uncapped when doing a serious frontend pass. Do not
38
38
  scip-query vue-component-duplicates --scope <vue-source-scope> --full --json
39
39
  scip-query vue-composable-candidates --scope <vue-source-scope> --full --json
40
40
  scip-query vue-large-view-pressure --scope <vue-source-scope> --full --json
41
- scip-query health --full --json
41
+ scip-query health --json
42
42
  ```
43
43
 
44
44
  ## Workflow
@@ -1,2 +0,0 @@
1
- import{b as r}from"./chunk-QOFKVNFE.js";import{u as e}from"./chunk-64LH2QUP.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
- //# sourceMappingURL=chunk-23FVN4Y5.js.map
@@ -1,7 +0,0 @@
1
- import{b as k}from"./chunk-6U4EODW3.js";import{a as D}from"./chunk-W3PQRAI4.js";import{e as h,f as y}from"./chunk-L77GXANO.js";import{n as S}from"./chunk-SA6B3EGD.js";import{c as v,r as L}from"./chunk-64LH2QUP.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||h(e,l.relativePath)||y(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:v(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(h(e,t.relativePath)||y(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:v(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
2
- FROM global_symbols gs
3
- JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
4
- JOIN documents d ON d.id = der.document_id
5
- WHERE gs.symbol = ?
6
- LIMIT 1`,n);return s?L(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=L(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
7
- //# sourceMappingURL=chunk-27KPKLRJ.js.map
@@ -1,2 +0,0 @@
1
- import{a as k,d as b}from"./chunk-YISMWW66.js";import{b as y,c as x,d as C}from"./chunk-CMGOXDVP.js";import{existsSync as v,readFileSync as M}from"fs";import{join as D}from"path";var h=/\.(?:md|mdx|rst|txt)$/i;function j(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var T=3,E=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function L(t,n={}){let{doc:i,limit:r=20,minCoupling:o=T}=n,e=I(t);if(!e)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=[];for(let s of e.docFiles){if(i!==void 0&&!s.includes(i)||i===void 0&&!R(t,s)||i!==void 0&&!v(D(t.config.projectRoot,s)))continue;let a=Math.max(0,...e.changeTimes.get(s)??[]),d=new Map,{resolved:g,broken:l}=F(t,s,e.tracked,e.trackedBySuffix,e.everSeenInHistory);for(let f of g){if(f===s||h.test(f))continue;let u=(e.changeTimes.get(f)??[]).filter(p=>p>a).length;u!==0&&d.set(f,{file:f,evidence:"reference",coChanges:0,changesSinceDocUpdate:u})}for(let[f,u]of e.coupling.get(s)??[]){if(u<o||!e.tracked.has(f))continue;let p=(e.changeTimes.get(f)??[]).filter(w=>w>a).length;if(p===0)continue;let S=d.get(f);S?(S.evidence="both",S.coChanges=u):d.set(f,{file:f,evidence:"co-change",coChanges:u,changesSinceDocUpdate:p})}if(d.size===0&&l.length===0)continue;let m=[...d.values()].sort((f,u)=>u.changesSinceDocUpdate-f.changesSinceDocUpdate);c.push({doc:s,docLastChangedAt:a,staleness:m.reduce((f,u)=>f+u.changesSinceDocUpdate,0)+l.length*10,subjects:m.slice(0,8),brokenReferences:l})}return c.sort((s,a)=>a.staleness-s.staleness),{available:!0,commitsAnalyzed:e.historyCommitCount,docsScanned:e.docFiles.length,findings:c.slice(0,r)}}function I(t){let n=k(t);if(!n)return null;let i=b(t)??new Set,r=new Map,o=new Map,e=new Set;for(let c of n.commits){let s=[...new Set(c.files)],a=s.filter(g=>h.test(g)),d=s.filter(g=>!h.test(g));for(let g of s){e.add(g);let l=r.get(g)??[];l.push(c.timestamp),r.set(g,l)}for(let g of a){let l=o.get(g);l||(l=new Map,o.set(g,l));for(let m of d)l.set(m,(l.get(m)??0)+1)}}return{changeTimes:r,coupling:o,docFiles:[...i].filter(c=>h.test(c)),everSeenInHistory:e,historyCommitCount:n.commits.length,tracked:i,trackedBySuffix:A(i)}}function O(t,n){let i=b(t)??new Set,r=A(i),o=[];for(let e of i){if(!R(t,e))continue;let{resolved:c}=F(t,e,i,r,new Set),s=[...c].filter(a=>n.has(a));s.length>0&&o.push({doc:e,cited:s.sort()})}return o}function R(t,n){return h.test(n)&&!j(n)&&v(D(t.config.projectRoot,n))}function A(t){let n=new Map;for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let e=r.slice(-o).join("/"),c=n.get(e)??[];c.push(i),n.set(e,c)}}return n}function F(t,n,i,r,o){let e=new Set,c=new Set,s=H(t,n);if(!s)return{resolved:e,broken:[]};for(let a of s){if(i.has(a)){e.add(a);continue}let d=r.get(a);if(d&&d.length===1){e.add(d[0]);continue}d&&d.length>1||o.has(a)&&c.add(a)}return{resolved:e,broken:[...c]}}function H(t,n){let i;try{i=M(D(t.config.projectRoot,n),"utf-8")}catch{return null}let r=y(t,n,i),o=x(t,"doc-path-tokens",n,r);if(o!==null)try{return JSON.parse(o)}catch{}let e=[...new Set([...i.matchAll(E)].map(c=>c[0].replace(/^\.?\//,"")))];return C(t,"doc-path-tokens",n,r,JSON.stringify(e)),e}export{j as a,L as b,O as c};
2
- //# sourceMappingURL=chunk-2NLK4INB.js.map
@@ -1,61 +0,0 @@
1
- import{a as _}from"./chunk-W3PQRAI4.js";import{c as u}from"./chunk-L77GXANO.js";import{b as l,c as d}from"./chunk-QUKZ77A6.js";import{c as a,e as m}from"./chunk-64LH2QUP.js";import{a as s}from"./chunk-NN3O7TPH.js";function A(e,o={}){let{scope:n,limit:r}=o,t=new _(e),i=h([...b(e,n),...g(e,t,n)]);return y(i),r?i.slice(0,r):i}function b(e,o){let n=[];for(let r of f(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||u(e,r.barrel_path))continue;let t=R(e,r),i=t?.barrel_consumers??0,c=t?.direct_consumers??0;i!==0||c!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:a(r.symbol),originalFile:r.original_path,barrelConsumers:i,directConsumers:c})}return n}function f(e,o){let n=o?`AND barrel_d.relative_path LIKE '%${o}%'`:"";return e.all(`SELECT DISTINCT
2
- barrel_d.id AS barrel_doc_id,
3
- barrel_d.relative_path AS barrel_path,
4
- gs.id AS symbol_id,
5
- gs.symbol AS symbol,
6
- orig_d.id AS original_doc_id,
7
- orig_d.relative_path AS original_path
8
- FROM mentions m
9
- JOIN chunks c ON m.chunk_id = c.id
10
- JOIN documents barrel_d ON c.document_id = barrel_d.id
11
- JOIN global_symbols gs ON m.symbol_id = gs.id
12
- JOIN (
13
- SELECT m2.symbol_id, c2.document_id
14
- FROM mentions m2
15
- JOIN chunks c2 ON m2.chunk_id = c2.id
16
- WHERE m2.role = 1
17
- GROUP BY m2.symbol_id
18
- ) sym_def ON sym_def.symbol_id = gs.id
19
- JOIN documents orig_d ON sym_def.document_id = orig_d.id
20
- WHERE m.role != 1
21
- AND (barrel_d.relative_path LIKE '%/index.ts'
22
- OR barrel_d.relative_path LIKE '%/index.js'
23
- OR barrel_d.relative_path = 'index.ts'
24
- OR barrel_d.relative_path = 'index.js')
25
- AND orig_d.id != barrel_d.id
26
- ${e.pathExclusionsFor("barrel_d","orig_d")}
27
- ${e.symbolNoiseFor("gs")}
28
- -- Only function-level symbols (ending with ().), not module-level
29
- AND gs.symbol LIKE '%().'
30
- ${n}
31
- ORDER BY barrel_d.relative_path, gs.symbol`)}function R(e,o){return e.get(`SELECT
32
- SUM(CASE WHEN uses_barrel = 1 THEN 1 ELSE 0 END) AS barrel_consumers,
33
- SUM(CASE WHEN uses_barrel = 0 THEN 1 ELSE 0 END) AS direct_consumers
34
- FROM (
35
- SELECT
36
- consumer_d.id AS consumer_doc_id,
37
- MAX(CASE WHEN EXISTS (
38
- SELECT 1
39
- FROM mentions barrel_m
40
- JOIN chunks barrel_c ON barrel_m.chunk_id = barrel_c.id
41
- WHERE barrel_c.document_id = consumer_d.id
42
- AND barrel_m.role != 1
43
- AND barrel_m.symbol_id IN (
44
- SELECT m2.symbol_id
45
- FROM mentions m2
46
- JOIN chunks c2 ON m2.chunk_id = c2.id
47
- WHERE c2.document_id = ?
48
- AND m2.role != 1
49
- )
50
- ) THEN 1 ELSE 0 END) AS uses_barrel
51
- FROM mentions ref_m
52
- JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
53
- JOIN documents consumer_d ON ref_c.document_id = consumer_d.id
54
- WHERE ref_m.symbol_id = ?
55
- AND ref_m.role != 1
56
- AND consumer_d.id != ?
57
- AND consumer_d.id != ?
58
- ${e.pathExclusionsFor("consumer_d")}
59
- GROUP BY consumer_d.id
60
- )`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function g(e,o,n){let r=[];for(let t of E(e,n))p(e,t,t)>0||r.push(...S(e,o,t));return r}function E(e,o){return s(e,{scope:o,includeIgnored:!1}).filter(n=>d(e,n).length>0)}function S(e,o,n){return d(e,n).filter(r=>r.sourcePath&&!e.isIgnored(r.sourcePath)).flatMap(r=>x(e,o,n,r.sourcePath))}function x(e,o,n,r){let t=N(o,r);return t?[{barrelFile:n,symbol:t.symbol,shortName:a(t.symbol),originalFile:r,barrelConsumers:0,directConsumers:p(e,r,n)}]:[]}function p(e,o,n){let r=new Set;for(let t of s(e,{includeIgnored:!1}))if(t!==n)for(let i of l(e,t))i.sourcePath===o&&r.add(t);return r.size}function N(e,o){let n=e.definitionsForFile(o);return n.find(r=>m(r.symbol)==="method")??n[0]??null}function h(e){let o=new Set,n=[];for(let r of e){let t=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(t)||(o.add(t),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{A as a};
61
- //# sourceMappingURL=chunk-2XKAMW6B.js.map
@@ -1,2 +0,0 @@
1
- import{a as y}from"./chunk-5D3BT4B4.js";function R(D,k={}){let{limit:x=10,scope:M,minDepth:v=3}=k,a=y(D,M),u=new Map,c=[],l=new Map,r=new Map,g=new Set,f=[],h=0;for(let t of a.keys()){if(l.has(t))continue;let n=[],s=(a.get(t)??new Set).values();for(l.set(t,h),r.set(t,h),h+=1,f.push(t),g.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let d=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(d)))}let o=e.iter.next();if(o.done){if(r.get(e.node)===l.get(e.node)){let d=[];for(;;){let p=f.pop();if(g.delete(p),d.push(p),u.set(p,c.length),p===e.node)break}c.push(d)}n.pop();continue}let i=o.value;if(l.has(i))g.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,h),r.set(i,h),h+=1,f.push(i),g.add(i);let d=(a.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:d,pendingChild:null})}}}let m=new Map,w=new Array(c.length);for(let t=0;t<c.length;t++)w[t]=c[t].length,m.set(t,new Set);for(let[t,n]of a){let s=u.get(t);for(let e of n){let o=u.get(e);o!==s&&m.get(s).add(o)}}let S=new Array(c.length),I=new Array(c.length);for(let t=0;t<c.length;t++){let n=[],s=0;for(let e of m.get(t)){let o=I[e];o>s&&(s=o,n=S[e])}S[t]=[t,...n],I[t]=w[t]+s}function A(t){return S[t]}let F=c.map(t=>[...t].sort()),C=new Set,b=[];for(let t=0;t<c.length;t++){let n=A(t),s=[];for(let o of n)s.push(...F[o]);if(s.length<v)continue;let e=s.join(" ");C.has(e)||(C.add(e),b.push({chain:s,depth:s.length}))}return b.sort((t,n)=>n.depth-t.depth),b.slice(0,x)}export{R as a};
2
- //# sourceMappingURL=chunk-332L7SRO.js.map
@@ -1,2 +0,0 @@
1
- import{a as f}from"./chunk-5BZOSICN.js";import{a as m}from"./chunk-W3PQRAI4.js";import{a as d}from"./chunk-BGBBVSH4.js";import{c as u}from"./chunk-64LH2QUP.js";function w(n,a={}){let{scope:e,minLoc:r=10,minCallees:o=6,limit:t=20,scanLimit:i}=a,s=new m(n);return f({candidates:()=>s.productionCallableDefinitions({scope:e,minLoc:r,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,prepare:l=>s.calleeMap(l,{semantic:a.semantic!==!1}),evaluate:(l,c)=>g(l,c.get(l.symbolId)??[],o),orderResults:(l,c)=>c.clusters.length-l.clusters.length||c.loc-l.loc,limit:t})}function g(n,a,e){let r=new Set(a.map(s=>s.symbol));if(r.size<e)return null;let o=b(r,a),t=p(r,o);if(t.length<2)return null;let i=h(t,o);return i.length===0?null:{symbol:n.symbol,shortName:u(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:r.size,clusters:i}}function b(n,a){let e=new Map;for(let o of n)e.set(o,new Set);let r=new Map;for(let o of a){let t=r.get(o.chunkId);t||(t=new Set,r.set(o.chunkId,t)),t.add(o.symbol)}for(let o of r.values()){let t=[...o];for(let i=0;i<t.length;i++)for(let s=i+1;s<t.length;s++)e.get(t[i]).add(t[s]),e.get(t[s]).add(t[i])}return e}function p(n,a){let e=new Set,r=[];for(let o of n){if(e.has(o))continue;let t=new Set,i=[o];for(;i.length>0;){let s=i.pop();if(!e.has(s)){e.add(s),t.add(s);for(let l of a.get(s)??[])e.has(l)||i.push(l)}}r.push(t)}return r}function h(n,a){return n.filter(e=>e.size>=3).map(e=>C(e,n,a)).filter(e=>e.isolation>.5).sort((e,r)=>r.isolation-e.isolation)}function C(n,a,e){let r=new Set;for(let s of a)if(s!==n)for(let l of s)r.add(l);let o=0;for(let s of n)for(let l of e.get(s)??[])r.has(l)&&o++;let t=n.size*r.size,i=t>0?1-o/t:1;return{callees:[...n].map(u),isolation:i}}export{w as a};
2
- //# sourceMappingURL=chunk-4EAANIWC.js.map
@@ -1,3 +0,0 @@
1
- import{b as D,c as $,d as Q,f as v,g as A,h as N,m as y,n as d,q as w,x as f}from"./chunk-64LH2QUP.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
2
- AND `),r=y(e,{where:o,params:i,limit:200}),a=d(e,{where:o,params:i,limit:200});return w(r,a)}function J(e,n,t,i){let o=n.trim(),r=t,a=r.replace(/\(\)$/,""),c=n.toLowerCase(),l=t.toLowerCase(),S=l.replace(/\(\)$/,""),k=e.symbol,C=$(e.symbol),b=Q(e.symbol),E=e.display_name??"",g=e.symbol.toLowerCase(),u=C.toLowerCase(),m=b.toLowerCase(),R=E.toLowerCase(),p=e.relative_path.toLowerCase(),K=/[/:.]/.test(t),M=I(t),_=M?.leaf.toLowerCase(),s=0;return(k===o||k===r)&&(s+=1150),(C===o||C===r)&&(s+=1100),E===a&&(s+=1180),b===a&&(s+=1160),(`${b}()`===o||`${b}()`===r)&&(s+=955),(g===c||g===l)&&(s+=1e3),(u===c||u===l)&&(s+=950),(p===c||p===l)&&(s+=925),(p.endsWith(`/${l}`)||p.endsWith(`/${c}`))&&(s+=875),R===S&&(s+=850),m===S&&(s+=825),(`${m}()`===c||`${m}()`===l)&&(s+=820),(u.endsWith(`:${l}`)||u.endsWith(`:${S}`)||u.endsWith(`:${S}()`))&&(s+=800),g.includes(l)&&(s+=120),u.includes(l)&&(s+=140),p.includes(l)&&(s+=140),R.includes(l)&&(s+=110),i.every(B=>{let L=B.toLowerCase();return g.includes(L)||u.includes(L)||p.includes(L)||R.includes(L)})&&(s+=100+i.length*15),M&&p.includes(M.path.toLowerCase())&&(s+=360,_&&(m===_||`${m}()`===_||`${m}()`==`${_}()`)&&(s+=700),v(e.symbol)&&(s+=180)),A(e.symbol)&&m===S&&(s+=60),!K&&N(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function I(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let i=n.slice(t+1).replace(/\(\)$/,"");return!i||i.includes(".")?null:{path:n.slice(0,t),leaf:i}}function x(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function U(e){let n=x(e),t=n.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return t.length>0?[...new Set(t)]:[n]}function V(e,n,t){let i=n.trim(),o=e.filter(r=>{let a=$(r.symbol),c=(r.display_name??"").trim();return r.symbol===i||a===i||a===t||c===i||c===t||`${c}()`===i||h(r,t)>1||r.relative_path===i});return o.length===0?null:(o.sort((r,a)=>h(a,t)-h(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),o[0]??null)}function h(e,n){let t=I(n);if(!t)return 0;let i=e.relative_path.toLowerCase(),o=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return i.includes(r)?o!==a?1:v(e.symbol)?D(e.symbol)===null?5:4:D(e.symbol)===null?3:2:0}export{re as a,Z as b,ae as c};
3
- //# sourceMappingURL=chunk-5ALI77D7.js.map
@@ -1,4 +0,0 @@
1
- import{o as f}from"./chunk-SA6B3EGD.js";import{a as d}from"./chunk-5ALI77D7.js";import{c as s,g as u,o as m,p as g}from"./chunk-64LH2QUP.js";import{a as c}from"./chunk-YVQUQIBM.js";function E(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:y(a,t?.display_name??null,n.symbol),source:S(e,n.relativePath,n.startLine,n.endLine)}],b=f(e,n,{semantic:i.semantic}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:b}}function S(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
2
- `).slice(i,n+1).join(`
3
- `).trimEnd();return o.length>0?o:null}function y(e,r,i){let n=m(e);if(n&&!p(n))return n;let t=(r??"").trim();return t?u(i)&&!t.endsWith("()")?`${t}()`:t:s(i)}function p(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{E as a};
4
- //# sourceMappingURL=chunk-5IDEQEM4.js.map
@@ -1,2 +0,0 @@
1
- import{c as a}from"./chunk-XGGTESMN.js";function V(e,s={}){let{minTotalLines:n=800,minTemplateLines:t=300,minScriptLines:u=300,minStyleLines:m=500,limit:L=20,scope:c,scanLimit:o,filePattern:r}=s;return a(e,{scope:c,scanLimit:o}).filter(i=>!r||i.file.includes(r)).map(i=>p(i,{minTotalLines:n,minTemplateLines:t,minScriptLines:u,minStyleLines:m})).filter(i=>i!==null).sort((i,l)=>l.totalLines-i.totalLines||i.file.localeCompare(l.file)).slice(0,L)}function p(e,s){let n=[];return e.totalLines>=s.minTotalLines&&n.push(`${e.totalLines} total component line(s)`),e.templateLines>=s.minTemplateLines&&n.push(`${e.templateLines} template line(s)`),e.scriptLines>=s.minScriptLines&&n.push(`${e.scriptLines} script line(s)`),e.styleLines>=s.minStyleLines&&n.push(`${e.styleLines} style line(s)`),n.length===0?null:{file:e.file,totalLines:e.totalLines,sfcLines:e.sfcLines,templateLines:e.templateLines,scriptLines:e.scriptLines,styleLines:e.styleLines,externalScriptLines:e.externalScriptLines,externalScriptPaths:e.externalScriptPaths,customBlockLines:e.customBlockLines,dominantPressure:b(e),reasons:n,loc:e.totalLines}}function b(e){let s=[{axis:"template",lines:e.templateLines},{axis:"script",lines:e.scriptLines-e.externalScriptLines},{axis:"style",lines:e.styleLines},{axis:"external-script",lines:e.externalScriptLines},{axis:"custom-block",lines:e.customBlockLines}];return s.sort((n,t)=>t.lines-n.lines),s[0]?.lines?s[0].axis:"total"}export{V as a};
2
- //# sourceMappingURL=chunk-62NMBOA5.js.map
@@ -1,62 +0,0 @@
1
- import{c as S}from"./chunk-T67R7V5I.js";import{a as h}from"./chunk-YVQUQIBM.js";import{a as x}from"./chunk-NN3O7TPH.js";import{c as y}from"./chunk-BJ7OHKB5.js";var w={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let n=t[0],i=t[1],r=e.slice(n.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=C(r);return{scheme:n,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let t=u(e);if("kind"in t)return null;for(let n=t.descriptors.length-2;n>=0;n--){let i=t.descriptors[n];if(i?.suffix==="type")return i.name}return null}function C(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="["){let s=e.indexOf("]",n+1);if(s===-1){t.push({name:e.slice(n+1),suffix:"type-param"});break}t.push({name:e.slice(n+1,s),suffix:"type-param"}),n=s+1;continue}if(e[n]==="("&&(t.length===0||n===0||D(e[n-1]))){let s=e.indexOf(")",n+1);if(s!==-1&&e[s+1]!=="."){t.push({name:e.slice(n+1,s),suffix:"parameter"}),n=s+1;continue}}let i;if(e[n]==="`"){let s=e.indexOf("`",n+1);if(s===-1){i=e.slice(n+1),t.push({name:i,suffix:"term"});break}i=e.slice(n+1,s),n=s+1}else{let s=n;for(;n<e.length&&!D(e[n]);)n++;i=e.slice(s,n)}if(n>=e.length){i&&t.push({name:i,suffix:"term"});break}let r=e[n];if(r==="("){let s=e.indexOf(")",n+1);s!==-1&&e[s+1]==="."?(t.push({name:i,suffix:"method"}),n=s+2):s!==-1?(t.push({name:i,suffix:"method"}),n=s+1):(t.push({name:i,suffix:"term"}),n++)}else{let s=w[r];s&&t.push({name:i,suffix:s}),n+=1}}return t}function D(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function L(e){let t=u(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let n=t;if(n.descriptors.length===0)return n.raw;let i=[];for(let r of n.descriptors){let s=F(r);s&&i.push(s)}return i.join(":")}function F(e){let t=e.suffix==="namespace"?T(e.name):e.name;return t?e.suffix==="method"?`${t}()`:t:""}function T(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 _(e){let t=u(e);if("kind"in t&&t.kind==="local")return t.id;let n=t;return n.descriptors.length===0?"":n.descriptors[n.descriptors.length-1].name}function f(e){let t=u(e);if("kind"in t&&t.kind==="local")return null;let n=t;return n.descriptors[n.descriptors.length-1]?.suffix??null}function ie(e){return e.endsWith("().")||f(e)==="method"}function I(e){let t=f(e);return t==="method"||t==="term"}function se(e){return f(e)==="namespace"}var A=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function oe(e){return A.test(e)}var Q=new Set(["test","tests","_tests"]);function ae(e){let t=u(e);if("kind"in t)return!1;for(let n=0;n<t.descriptors.length-1;n+=1){let i=t.descriptors[n];if(i?.suffix==="namespace"&&i.name&&Q.has(i.name))return!0}return!1}function le(e,t){let n=u(e),i=u(t);if("kind"in n||"kind"in i)return!1;let r=n.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function ce(e,t){let n=u(e),i=u(t);if("kind"in n||"kind"in i)return!1;let r=n.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function ue(e,t){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
2
- FROM global_symbols gs
3
- JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
- JOIN documents d ON der.document_id = d.id
5
- WHERE ${t.where}
6
- ${e.pathExclusionsFor("d")}
7
- ${M(t.orderBy)}
8
- ${k(t.limit)}`,...t.params??[])}function me(e,t){return e.all(`SELECT
9
- gs.id,
10
- gs.symbol,
11
- c.document_id,
12
- MIN(c.start_line) AS start_line,
13
- MAX(c.end_line) AS end_line,
14
- d.relative_path,
15
- gs.display_name,
16
- gs.documentation
17
- FROM global_symbols gs
18
- JOIN mentions m ON m.symbol_id = gs.id
19
- JOIN chunks c ON m.chunk_id = c.id
20
- JOIN documents d ON c.document_id = d.id
21
- WHERE m.role = 1
22
- AND ${t.where}
23
- ${e.pathExclusionsFor("d")}
24
- GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
25
- ${M(t.orderBy)}
26
- ${k(t.limit)}`,...t.params??[])}function M(e){return e?`ORDER BY ${e}`:""}function k(e){return typeof e=="number"?`LIMIT ${e}`:""}function N(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 O(e){if(!e)return null;let t=R(e);if(t)return t.replace(/\n/g," ");let n=e.indexOf("|");if(n===-1)return e.replace(/\n/g," ");let i=e.slice(n+1);return(R(i)??i).replace(/\n/g," ")}function R(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function P(e){if(m(e.symbol)!==null)return!1;let n=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(n)}function E(e,t,n={}){let i=new Map;for(let s of t)e.length>0&&!P(s)||i.set(s.id,s);for(let s of e)i.set(s.id,s);let r=[...i.values()];return n.sort?r.sort((s,o)=>s.start_line-o.start_line||s.end_line-o.end_line||s.symbol.localeCompare(o.symbol)):r}var B=y("file-definitions",{clearGroups:["definition-catalog"]}),$=new WeakMap;function g(e,t){return B.get(e,t,()=>{let n=E(j(e,t),J(e,t),{sort:!0});return U(e,t,n.map(W))})}function j(e,t){return e.all(`SELECT
27
- gs.id,
28
- gs.symbol,
29
- der.document_id,
30
- der.start_line,
31
- der.end_line,
32
- d.relative_path,
33
- gs.display_name,
34
- gs.kind,
35
- gs.documentation,
36
- gs.enclosing_symbol
37
- FROM global_symbols gs
38
- JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
39
- JOIN documents d ON der.document_id = d.id
40
- WHERE d.relative_path = ?
41
- ${e.symbolNoiseFor("gs")}
42
- ORDER BY der.start_line, der.end_line`,t)}function J(e,t){return e.all(`SELECT
43
- gs.id,
44
- gs.symbol,
45
- c.document_id,
46
- MIN(c.start_line) AS start_line,
47
- MAX(c.end_line) AS end_line,
48
- d.relative_path,
49
- gs.display_name,
50
- gs.kind,
51
- gs.documentation,
52
- gs.enclosing_symbol
53
- FROM global_symbols gs
54
- JOIN mentions m ON m.symbol_id = gs.id
55
- JOIN chunks c ON m.chunk_id = c.id
56
- JOIN documents d ON c.document_id = d.id
57
- WHERE d.relative_path = ?
58
- AND m.role = 1
59
- ${e.symbolNoiseFor("gs")}
60
- GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
61
- ORDER BY start_line, end_line`,t)}function W(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:_(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:I(e.symbol),isTypeLike:f(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function _e(e,t={}){return H(e,t.scope)}function H(e,t){return x(e,{scope:t,includeIgnored:!1}).flatMap(n=>g(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function Ie(e,t,n={}){if(t.length===0)return[];let i=t.flatMap(r=>g(e,r)).filter(r=>!e.isIgnored(r.relativePath));return n.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),n.sort&&(i=i.sort((r,s)=>r.relativePath.localeCompare(s.relativePath)||r.startLine-s.startLine||r.endLine-s.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:L(r.symbol),signature:N(O(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function z(e){let t=new Map,n=e.map((i,r)=>({definition:i,index:r,span:i.endLine-i.startLine})).sort((i,r)=>i.span-r.span||i.index-r.index);for(let{definition:i}of n)for(let r=i.startLine;r<=i.endLine;r+=1)t.has(r)||t.set(r,i);return t}function Re(e,t){let n=$.get(e);return n||(n=z(e),$.set(e,n)),n.get(t)??null}function Me(e,t){let n=g(e,t.relative_path).find(i=>i.symbolId===t.id);return n?{symbolId:n.symbolId,symbol:n.symbol,documentId:n.documentId,startLine:n.startLine,endLine:n.endLine,relativePath:n.relativePath}:{symbolId:t.id,symbol:t.symbol,documentId:t.document_id,startLine:t.start_line,endLine:t.end_line,relativePath:t.relative_path}}function U(e,t,n){let i=h(e,t),r=S(e,t);return r?V(n,r,i):i?Y(n,i):n}function Y(e,t){let n=t.split(/\r?\n/),i=G(e,n),r=X(e,i),s=Z(r,n);return K(e,s)}function G(e,t){let n=e.some(r=>b(r.symbol))?ne(t):null,i=new Map;for(let r of e)i.set(r.symbolId,ee(t,n,r));return i}function X(e,t){return e.filter(n=>b(n.symbol)).map(n=>({definition:n,startLine:t.get(n.symbolId)??n.startLine})).sort((n,i)=>n.startLine-i.startLine||n.definition.startLine-i.definition.startLine||n.definition.symbol.localeCompare(i.definition.symbol))}function Z(e,t){let n=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],s=e[i+1],o=s?Math.max(r.startLine,s.startLine-1):t.length-1;n.set(r.definition.symbolId,{startLine:r.startLine,endLine:te(t,r.definition,r.startLine,o)})}return n}function K(e,t){return e.map(n=>{let i=t.get(n.symbolId);return i?{...n,startLine:i.startLine,endLine:i.endLine}:n})}function V(e,t,n=null){let i=new Map;for(let r of t){let s=i.get(r.name);s?s.push(r):i.set(r.name,[r])}return e.map(r=>{if(!q(r)||!r.leaf)return v(r,n);let s=i.get(r.leaf);if(!s||s.length===0)return v(r,n);let o=s[0],a=Math.abs(o.startLine-r.startLine);for(let c=1;c<s.length;c+=1){let l=s[c],d=Math.abs(l.startLine-r.startLine);d<a&&(o=l,a=d)}return{...r,startLine:o.startLine,endLine:o.endLine}})}function q(e){return b(e.symbol)?!0:f(e.symbol)==="term"&&m(e.symbol)===null}function v(e,t){if(!t||!e.leaf||f(e.symbol)!=="term"||m(e.symbol)!==null)return e;let n=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${n}\\b`),s=t.split(/\r?\n/).findIndex(o=>i.test(o));return s>=0?{...e,startLine:s,endLine:s}:e}function ee(e,t,n){if(!b(n.symbol))return n.startLine;let i=Math.max(0,Math.min(n.startLine,e.length-1));if(!t)return i;let r=t.get(n.leaf);if(!r||r.length===0)return i;let s=null;for(let o of r){let a=Math.abs(o-n.startLine);(!s||a<s.distance)&&(s={line:o,distance:a})}return s?.line??i}function ne(e){let t=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,n=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,s=new Map,o=(a,c)=>{let l=s.get(a);if(!l){s.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let d of c.matchAll(t))d[1]&&o(d[1],a);for(let d of c.matchAll(n))d[1]&&o(d[1],a);let l=c.match(i);l?.[1]&&o(l[1],a);for(let d of c.matchAll(r))d[1]&&o(d[1],a)}return s}function te(e,t,n,i){let r=Math.max(n,Math.min(e.length-1,i)),s=Math.max(n,Math.min(r,t.endLine)),o=0,a=0,c=!1;for(let l=n;l<=r;l+=1){let d=re(e[l]??"");for(let p of d)p==="{"?(o+=1,c=!0):p==="}"?o=Math.max(0,o-1):p==="("?a+=1:p===")"&&(a=Math.max(0,a-1));if(c&&o===0||!c&&a===0&&l>=s)return l}return s}function re(e){let t="",n=null,i=!1;for(let r=0;r<e.length;r+=1){let s=e[r],o=e[r+1];if(!n&&s==="/"&&o==="/"){t+=" ".repeat(e.length-r);break}if(n){if(i){i=!1,t+=" ";continue}if(s==="\\"){i=!0,t+=" ";continue}s===n&&(n=null),t+=" ";continue}if(s==='"'||s==="'"||s==="`"){n=s,t+=" ";continue}t+=s}return t}function b(e){return e.includes("().")}function ke(e){let t=u(e);if("kind"in t)return[];let n=[];for(let i=t.descriptors.length-2;i>=0;i-=1){let r=t.descriptors[i];r?.suffix==="type"&&r.name&&n.push(r.name)}return n}export{u as a,m as b,L as c,_ as d,f as e,ie as f,I as g,se as h,oe as i,ae as j,le as k,ce as l,ue as m,me as n,N as o,O as p,E as q,g as r,_e as s,H as t,Ie as u,z as v,Re as w,Me as x,ke as y};
62
- //# sourceMappingURL=chunk-64LH2QUP.js.map
@@ -1,2 +0,0 @@
1
- import{b as G}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-W3PQRAI4.js";import{a as F,d as N,e as k,f as T}from"./chunk-L77GXANO.js";import{a as z}from"./chunk-623UQCVG.js";import{c as H,d as U,f as v,j as q}from"./chunk-SA6B3EGD.js";import{b as I}from"./chunk-QUKZ77A6.js";import{c as M,f as A,g as j,h as O,i as B,j as W,r as V,y as x}from"./chunk-64LH2QUP.js";import{a as P,d as _}from"./chunk-HCQ7J2N5.js";import{a as h}from"./chunk-NN3O7TPH.js";import{b as S}from"./chunk-BJ7OHKB5.js";var g=new WeakMap;function J(e,n){let t=P(n);return t==="rust"?pe(e,n):t==="typescript"||t==="tsx"||t==="javascript"?de(e,n):[]}var ue=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function de(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(n)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(n),o=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(n),s=!1,c=t.rootNode;for(let u of c.namedChildren){if(u.type!=="expression_statement")continue;let a=u.namedChild(0);if(!a||a.type!=="call_expression")continue;let d=a.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&ue.has(f)){s=!0;break}}let l=[];s&&l.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(r||o)&&l.push({startLine:0,endLine:c.endPosition.row,reason:r?"Next.js / Remix route file":"Vite/Vue route component"});for(let u of c.namedChildren){let a=null,d=null;if(u.type==="function_declaration")a=u.namedChild(0)?.text??null,d=u;else if(u.type==="export_statement"){let f=u.namedChild(0);f?.type==="function_declaration"&&(a=f.namedChild(0)?.text??null,d=f)}else if(u.type==="lexical_declaration"){let f=u.namedChild(0);if(f?.type==="variable_declarator"){let b=f.namedChild(0)?.text,y=f.namedChild(1);b&&(y?.type==="arrow_function"||y?.type==="function_expression")&&(a=b,d=f)}}a&&/^use[A-Z]/.test(a)&&d&&l.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return l.push(...K(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),g.set(t,l),l}var fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function me(e){return fe.test(e)}function K(e,n,t){let i=[],r=o=>{if(n.has(o.type)&&o.parent){let c=o.parent.children,l=-1;for(let u=0;u<c.length;u+=1)if(c[u].startIndex===o.startIndex&&c[u].type===o.type){l=u;break}if(l>0)for(let u=l-1;u>=0;u-=1){let a=c[u];if(t.has(a.type)){if(me(a.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of o.namedChildren)r(s)};return r(e.rootNode),i}function pe(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=[],o=be(t);return o?(g.set(t,o),o):(X(t.rootNode,r,!1,!1),r.push(...K(t,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...ve(t.rootNode)),g.set(t,r),r)}function be(e){return Ee(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function X(e,n,t,i){let r=t,o=i;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?ye(e,n,t,i):i&&_e(e)?n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ge(e,n,t):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(r=!0);for(let s of e.namedChildren)X(s,n,r,o)}function ye(e,n,t,i){let r=C(e),o=null;i?o="trait impl method (dynamic dispatch)":t&&(o="inside #[cfg(test)] mod");for(let s of r){let c=xe(s);if(c){o=c;break}if(Z(s)){o="#[allow(dead_code)]";break}}o&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o})}function ge(e,n,t){let i=C(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Se)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(Z)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function C(e){let n=e.parent;if(!n)return[];let t=n.children,i=-1;for(let o=0;o<t.length;o+=1)if(t[o].startIndex===e.startIndex&&t[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let s=t[o];if(s.type==="attribute_item"||s.type==="inner_attribute_item")r.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return r}var he=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function xe(e){return he.find(({re:n})=>n.test(e))?.reason??null}var Re=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Se(e){return/#\[\s*derive\s*\(/.test(e)?Re.some(n=>n.test(e)):!1}function Z(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function _e(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function ve(e){let n=De(e);if(n.size===0)return[];let t=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&n.has(r)&&t.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return t}function Ee(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Ce=/^#!?\[\s*serde\s*\(/,$=/\bwith\s*=\s*"([^"]+)"/g;function De(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!Ce.test(t.text))continue;$.lastIndex=0;let i;for(;(i=$.exec(t.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&n.add(o)}}return n}function Q(e){let n=new Map,t=i=>{let r=n.get(i);if(r)return r;let o=J(e,i);return r={ranges:o.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(o.map(s=>s.containerName).filter(s=>!!s))},n.set(i,r),r};return(i,r,o,s)=>{let c=t(i);for(let l of c.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(s&&c.containers.has(s))return!0;for(let l of x(o))if(c.containers.has(l))return!0;return!1}}function ze(e,n={}){S(e,{groups:n.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,n,t={}){S(e,{groups:t.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:n.replace(/\\/g,"/")})}function ee(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):O(e.symbol)?m("module-like-symbol"):Y(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&Y(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!w(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):B(e.symbol)?m("rust-trait-impl-member"):W(e.symbol)?m("rust-test-module"):!n.includeMembers&&!we(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function w(e){return F(e)!=="test"}function m(e){return{accepted:!1,rejectionReason:e}}function Y(e){return j(e)||e.endsWith("().")||e.endsWith(".")}function we(e){return A(e.symbol)||x(e.symbol).length===0}function te(){return new Map}function ne(e,n,t){let i=new Map;for(let r of H(e,t))e.isIgnored(r.relative_path)||n.has(r.relative_path)||R(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function re(e,n,t){let i=new Set;for(let r of U(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||i.add(r.symbol_id);return i}function L(e,n){let t=e.get(n);if(!t)return!1;for(let i of t.values())if(i.occurrences>0)return!0;return!1}function ie(e){return e?.occurrences??0}function R(e,n,t,i,r="source-fallback"){if(i<=0)return;let o=se(e,n,t);o.occurrences+=i,o.sources.add(r)}function oe(e,n,t,i,r){if(i<=0)return;let o=se(e,n,t);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function se(e,n,t){let i=e.get(n);i||(i=new Map,e.set(n,i));let r=i.get(t);return r||(r={occurrences:0,sources:new Set},i.set(t,r)),r}function mt(e,n={}){let{scope:t,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:s=!1,deadCodeOnly:c=!1,scanLimit:l,semantic:u=!0}=n,a=G(Le(e,{scope:t,minLoc:i,includeTests:r,includeMembers:s}),l),d=o?new Set(N(e)):new Set,f=c?te():ne(e,d,a.map(p=>p.symbolId)),b=c?re(e,a.map(p=>p.symbolId),d):new Set,y=c?a.filter(p=>!b.has(p.symbolId)):a;c?ke(e,y,f,d):Ne(e,y,f,d);let ce=c?y.filter(p=>!L(f,p.symbolId)):a;Oe(e,ce,f,{includeTests:r,inactiveBarrelPaths:d,includeSemantic:!c&&u});let le=c?y.filter(p=>!L(f,p.symbolId)):a;return Fe(e,Pe(le,f))}function Le(e,n){let t=Q(e),i=[];for(let r of h(e,{scope:n.scope}))try{for(let o of V(e,r))ee(o,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:t}).accepted&&i.push(o)}finally{D(e,r,{definitions:!0})}return i}function Pe(e,n){return e.map(t=>Ie(t,n)).filter(t=>t.cross_file_refs===0).sort((t,i)=>i.loc-t.loc||t.relative_path.localeCompare(i.relative_path)||t.start_line-i.start_line)}function Ie(e,n){let t=n.get(e.symbolId)??new Map,i=ie(t.get(e.relativePath)),r=0;for(let[o,s]of t)o!==e.relativePath&&(r+=s.occurrences);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:i,cross_file_refs:r}}function Fe(e,n){let t=[],i=0,r=0,o=0;for(let s of n){if(e.isIgnored(s.relative_path)||k(e,s.relative_path)||T(e,s.symbol,s.relative_path))continue;let c=s.same_file_refs===0?"dead-code":"file-internal";c==="dead-code"?i++:r++,o+=s.loc,t.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:M(s.symbol),sameFileRefs:s.same_file_refs,kind:c})}return{symbols:t,totalCount:t.length,deadCodeCount:i,fileInternalCount:r,totalLoc:o}}function Ne(e,n,t,i){if(n.length===0)return;let r=new E(e),o=new Set(n.map(l=>l.symbolId)),s=new Set(n.map(l=>l.leaf).filter(Boolean)),c=new Set(r.sourceFiles());for(let l of h(e))c.add(l);r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:l=>i.has(l)},l=>{o.has(l.target.symbolId)&&(Ae(e,l)||R(t,l.target.symbolId,l.sourceFile,je(l),"source-fallback"))})}function ke(e,n,t,i){if(n.length===0)return;let r=new E(e),o=Te(n),s=new Set(r.sourceFiles());for(let a of h(e))s.add(a);let c=new Set(o.keys()),l=new Map,u=a=>{let d=l.get(a);return d||(d=q(e,a),l.set(a,d)),d};r.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:a=>i.has(a),resolveTargets:({sourceFile:a,name:d,kind:f})=>{let b=o.get(d);return b?Me(a,d,b,u(a),{permissive:f!=="cross-language-dispatch"}):[]},afterPath:a=>{l.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ae(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(t,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function Te(e){let n=new Map;for(let t of e){if(!t.leaf)continue;let i=n.get(t.leaf)??[];i.push(t),n.set(t.leaf,i)}return n}function Me(e,n,t,i,r){let o=t.filter(l=>l.relativePath===e);if(o.length>0)return o;if(!r.permissive&&t.length===1)return[...t];let s=i.get(n);if(s)for(let l of s){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0)return u}let c=new Set;for(let l of i.values())for(let u of l)c.add(u);for(let l of c){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0&&u.length===t.length)return u}return r.permissive?[...t]:[]}function Ae(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&ae(e,n)}function je(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ae(e,n){return n.occurrences>1?!1:I(e,n.sourceFile).some(t=>t.used||t.sourcePath!==n.target.relativePath?!1:t.importedName===n.name||t.localName===n.name)}function Oe(e,n,t,i){for(let r of n){let o=z(e,r,{semantic:i.includeSemantic!==!1});if(o.length!==0)for(let s of o){let c=s.file;c===r.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!w(c)||oe(t,r.symbolId,c,1,"caller-map")}}}export{ze as a,mt as b};
2
- //# sourceMappingURL=chunk-6U4EODW3.js.map
@@ -1,8 +0,0 @@
1
- import{d as P,e as _}from"./chunk-TTGWDUJ4.js";import{d as N}from"./chunk-UIWAZ2NT.js";import{a as M,c as v,f as x}from"./chunk-ATGRITZP.js";import{a as S}from"./chunk-W3PQRAI4.js";import{c as f}from"./chunk-64LH2QUP.js";var L=5;function z(e,r={}){let{base:a="HEAD",minContainment:n=.7,minCallees:i=3,maxHelpers:l=Number.POSITIVE_INFINITY,limit:c=20}=r,p=r.semantic!==!1,s=r.diffPlan??v(e,{base:a}),o={available:s.note!==M,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!o.available||s.changedFiles.length===0)return o;let u=new S(e),b=new Set(s.changedFiles),w=new Map(s.renamedFiles.map(t=>[t.to,t.from])),d=A(e,u,b,a,w);if(d.length===0)return o;let I=d.slice(0,l);d.length>l&&(o.note=`helper scoring capped at ${l} of ${d.length} new symbols`);let E=P(e,{minCallees:Math.min(3,i),semantic:p}),R=T(E),k=u.calleeMap(I,{semantic:p}),D=I.map(t=>({def:t,callees:_((k.get(t.symbolId)??[]).map(m=>m.symbol))}));for(let{def:t,callees:m}of D){let g=f(t.symbol);if(m.size<i){o.skipped.push({helperShortName:g,helperFile:t.relativePath,reason:`fewer than ${i} meaningful callees \u2014 too small to score`});continue}let y=O(e,t.symbolId);if(y.length===0){o.skipped.push({helperShortName:g,helperFile:t.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}o.helpersChecked+=1;let h=q({candidateIndex:R,changed:b,helperCallees:m,helperSymbol:t.symbol,minContainment:n});h.length!==0&&(h.sort((F,C)=>C.containment-F.containment||F.file.localeCompare(C.file)),o.findings.push({helperSymbol:t.symbol,helperShortName:g,helperFile:t.relativePath,migratedFiles:y.sort(),leftovers:h.slice(0,L)}))}return o.findings.sort((t,m)=>(m.leftovers[0]?.containment??0)-(t.leftovers[0]?.containment??0)||t.helperFile.localeCompare(m.helperFile)),o.findings=o.findings.slice(0,c),o}function T(e){let r=new Map,a=new Map;for(let n of e)for(let i of n.callees){r.set(i,(r.get(i)??0)+1);let l=a.get(i);l||(l=[],a.set(i,l)),l.push(n)}return{candidatesByCallee:a,docFreq:r,ubiquityThreshold:Math.max(8,Math.ceil(Math.sqrt(e.length)))}}function q(e){let r=[],a=new Set;for(let n of e.helperCallees)for(let i of e.candidateIndex.candidatesByCallee.get(n)??[])a.add(i);for(let n of a){if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let i=N(e.helperCallees,n.callees);if(i<e.minContainment)continue;let l=[...e.helperCallees].filter(c=>n.callees.has(c));l.some(c=>(e.candidateIndex.docFreq.get(c)??0)<=e.candidateIndex.ubiquityThreshold)&&r.push({symbol:n.symbol,shortName:f(n.symbol),file:n.file,containment:i,sharedCallees:l.map(f).sort()})}return r}function A(e,r,a,n,i){let l=new Map;return r.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(c=>{if(!a.has(c.relativePath))return!1;let p=i.get(c.relativePath)??c.relativePath,s=l.get(p);return s===void 0&&(s=x(e.config.projectRoot,n,p),l.set(p,s)),s===null||!new RegExp(`\\b${$(c.leaf)}\\b`).test(s)})}function O(e,r){return e.all(`SELECT DISTINCT ref_d.relative_path
2
- FROM mentions m
3
- JOIN chunks c ON m.chunk_id = c.id
4
- JOIN documents ref_d ON c.document_id = ref_d.id
5
- WHERE m.symbol_id = ?
6
- AND m.role != 1
7
- ${e.pathExclusionsFor("ref_d")}`,r).map(n=>n.relative_path)}function $(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{z as a};
8
- //# sourceMappingURL=chunk-A2GVUCZR.js.map