scip-query 0.10.8 → 0.10.11

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 (233) hide show
  1. package/README.md +3 -1
  2. package/dist/chunk-2KHTSEIL.js +102 -0
  3. package/dist/chunk-3VD3JMK2.js +2 -0
  4. package/dist/{chunk-MEKSFV6H.js → chunk-4UZO3XCV.js} +2 -2
  5. package/dist/{chunk-BJWNO6BU.js → chunk-54KGX7EX.js} +2 -2
  6. package/dist/chunk-5GOLFJEO.js +8 -0
  7. package/dist/chunk-5OST6GYB.js +2 -0
  8. package/dist/{chunk-C6BYNIH4.js → chunk-65AU3HFZ.js} +2 -2
  9. package/dist/{chunk-E2CCBFLR.js → chunk-6GN7FXCH.js} +2 -2
  10. package/dist/{chunk-RHKMQNFI.js → chunk-6IR2AOBM.js} +2 -2
  11. package/dist/{chunk-6EO3E3IP.js → chunk-6JRV4MY2.js} +2 -2
  12. package/dist/{chunk-5SMUKUV5.js → chunk-6LJHXREW.js} +2 -2
  13. package/dist/chunk-6QSOCTZT.js +18 -0
  14. package/dist/{chunk-6TDOT7B3.js → chunk-72KY2ZFO.js} +2 -2
  15. package/dist/{chunk-LGX2Y4BA.js → chunk-7B6LP46R.js} +2 -2
  16. package/dist/chunk-7GO4EQF5.js +2 -0
  17. package/dist/chunk-7IVSJJZU.js +7 -0
  18. package/dist/{chunk-EBIQY3RK.js → chunk-7TWLSZK5.js} +2 -2
  19. package/dist/{chunk-X3Z4MLVL.js → chunk-AVWPHM2Q.js} +2 -2
  20. package/dist/{chunk-GZQID3FS.js → chunk-BASVXNY3.js} +2 -2
  21. package/dist/{chunk-BJG67TCR.js → chunk-BFXPG2VN.js} +2 -2
  22. package/dist/chunk-BSN22NRK.js +9 -0
  23. package/dist/{chunk-ZDR4VTOP.js → chunk-BVRS7RKQ.js} +2 -2
  24. package/dist/{chunk-ANIOISCE.js → chunk-C5CTSJ6X.js} +2 -2
  25. package/dist/{chunk-VXT7WVIN.js → chunk-CO5GJRP7.js} +2 -2
  26. package/dist/chunk-CW5YFOCP.js +5 -0
  27. package/dist/chunk-E35O7UCB.js +2 -0
  28. package/dist/{chunk-LWTML2AN.js → chunk-EXDQ35NN.js} +2 -2
  29. package/dist/{chunk-Q34NWRPP.js → chunk-EY43NV4M.js} +2 -2
  30. package/dist/chunk-FAYI6KZ5.js +2 -0
  31. package/dist/{chunk-ZL52RLDK.js → chunk-FDEQIPPK.js} +2 -2
  32. package/dist/{chunk-5G5VI7J4.js → chunk-FFVIFETB.js} +2 -2
  33. package/dist/{chunk-JUIAOOK7.js → chunk-FKCGBZAC.js} +2 -2
  34. package/dist/{chunk-JRUKS66S.js → chunk-FXNWFMKW.js} +2 -2
  35. package/dist/chunk-G5UPYQGL.js +4 -0
  36. package/dist/chunk-GQBMH2TQ.js +2 -0
  37. package/dist/{chunk-VFLHKRTW.js → chunk-GRJY65YT.js} +2 -2
  38. package/dist/chunk-HF25DFSC.js +3 -0
  39. package/dist/chunk-HHN2B5KA.js +2 -0
  40. package/dist/{chunk-7KJBH4IP.js → chunk-IHUETYFW.js} +2 -2
  41. package/dist/{chunk-BEUQVBE3.js → chunk-JATUZIEH.js} +2 -2
  42. package/dist/chunk-JCLDUKT6.js +38 -0
  43. package/dist/{chunk-B4EHYG6M.js → chunk-JGN2ZFJR.js} +2 -2
  44. package/dist/{chunk-L4QKEQ4S.js → chunk-JME7OWD3.js} +2 -2
  45. package/dist/chunk-KDFONWTW.js +40 -0
  46. package/dist/{chunk-VMPB52FG.js → chunk-LPL4MA6R.js} +2 -2
  47. package/dist/{chunk-FGTHPJON.js → chunk-LSET2TXH.js} +2 -2
  48. package/dist/chunk-LZHUWKGD.js +2 -0
  49. package/dist/{chunk-JYSAYZNX.js → chunk-M4COR2H6.js} +2 -2
  50. package/dist/{chunk-QDGKE5HN.js → chunk-NOJAM5ZV.js} +2 -2
  51. package/dist/chunk-O6ZH6C6Y.js +2 -0
  52. package/dist/{chunk-3LQFMQPY.js → chunk-OBGRLXWF.js} +2 -2
  53. package/dist/chunk-OLTESY4K.js +3 -0
  54. package/dist/chunk-P4KYUPBD.js +4 -0
  55. package/dist/chunk-P5RYBRIO.js +4 -0
  56. package/dist/{chunk-6N6QTGSD.js → chunk-P753MDDE.js} +2 -2
  57. package/dist/{chunk-NWFSC356.js → chunk-P7AL7Y37.js} +2 -2
  58. package/dist/chunk-QLAUCRDJ.js +2 -0
  59. package/dist/{chunk-FHWEEQVO.js → chunk-QPU7EXAW.js} +2 -2
  60. package/dist/{chunk-AA7L7GKI.js → chunk-QYB5P7GL.js} +2 -2
  61. package/dist/chunk-RNM6LMCF.js +2 -0
  62. package/dist/chunk-RVWSAMTT.js +2 -0
  63. package/dist/{chunk-T633QLYF.js → chunk-TK7O5ER5.js} +2 -2
  64. package/dist/chunk-TQ5W2H3S.js +4 -0
  65. package/dist/chunk-USPV3T5K.js +2 -0
  66. package/dist/{chunk-FKUCFCLU.js → chunk-VCQYSG2M.js} +2 -2
  67. package/dist/{chunk-2YI45TNM.js → chunk-VUKC6F77.js} +2 -2
  68. package/dist/{chunk-N7F5UM6J.js → chunk-W6BVEKYC.js} +2 -2
  69. package/dist/{chunk-63MSELOP.js → chunk-WUCEKFQC.js} +2 -2
  70. package/dist/chunk-XUGQU7PM.js +41 -0
  71. package/dist/{chunk-KZYHFI2X.js → chunk-Y5NBHMQX.js} +2 -2
  72. package/dist/{chunk-6BNOACLT.js → chunk-YCOFCT4B.js} +2 -2
  73. package/dist/{chunk-SHM5D3DQ.js → chunk-YWYFU2V3.js} +2 -2
  74. package/dist/{chunk-BWL2ECGQ.js → chunk-Z3YYR4OS.js} +2 -2
  75. package/dist/{chunk-3FYGJ2GY.js → chunk-Z4HICZGY.js} +2 -2
  76. package/dist/{chunk-24S6MYOC.js → chunk-ZQDIXAF5.js} +2 -2
  77. package/dist/cli.js +298 -244
  78. package/dist/{db-BAVwb4Pb.d.ts → db-Djj3Nqrb.d.ts} +2 -0
  79. package/dist/{health-B17sVFYf.d.ts → health-D5J42g4D.d.ts} +1 -1
  80. package/dist/index.d.ts +3 -2
  81. package/dist/index.js +3 -3
  82. package/dist/queries/affected.d.ts +1 -1
  83. package/dist/queries/affected.js +1 -1
  84. package/dist/queries/bottlenecks.d.ts +1 -1
  85. package/dist/queries/bottlenecks.js +1 -1
  86. package/dist/queries/by-kind.d.ts +1 -1
  87. package/dist/queries/by-kind.js +1 -1
  88. package/dist/queries/call-graph.d.ts +1 -1
  89. package/dist/queries/call-graph.js +1 -1
  90. package/dist/queries/change-surface.d.ts +1 -1
  91. package/dist/queries/change-surface.js +1 -1
  92. package/dist/queries/cleanup-plan.d.ts +1 -1
  93. package/dist/queries/cleanup-plan.js +1 -1
  94. package/dist/queries/co-change.d.ts +1 -1
  95. package/dist/queries/co-change.js +1 -1
  96. package/dist/queries/code.d.ts +1 -1
  97. package/dist/queries/code.js +1 -1
  98. package/dist/queries/complexity-hotspots.d.ts +1 -1
  99. package/dist/queries/complexity-hotspots.js +1 -1
  100. package/dist/queries/complexity.d.ts +1 -1
  101. package/dist/queries/complexity.js +1 -1
  102. package/dist/queries/convergence.d.ts +1 -1
  103. package/dist/queries/convergence.js +1 -1
  104. package/dist/queries/coupling.d.ts +1 -1
  105. package/dist/queries/coupling.js +1 -1
  106. package/dist/queries/cycles.d.ts +1 -1
  107. package/dist/queries/cycles.js +1 -1
  108. package/dist/queries/dataflow.d.ts +1 -1
  109. package/dist/queries/dataflow.js +1 -1
  110. package/dist/queries/dead.d.ts +1 -1
  111. package/dist/queries/dead.js +1 -1
  112. package/dist/queries/deep-chains.d.ts +1 -1
  113. package/dist/queries/deep-chains.js +1 -1
  114. package/dist/queries/deps.d.ts +1 -1
  115. package/dist/queries/deps.js +1 -1
  116. package/dist/queries/diff-gate.d.ts +1 -1
  117. package/dist/queries/diff-gate.js +1 -1
  118. package/dist/queries/diff-impact.d.ts +1 -1
  119. package/dist/queries/diff-impact.js +1 -1
  120. package/dist/queries/doc-drift.d.ts +1 -1
  121. package/dist/queries/doc-drift.js +1 -1
  122. package/dist/queries/drift.d.ts +2 -1
  123. package/dist/queries/drift.js +1 -1
  124. package/dist/queries/extract-candidates.d.ts +1 -1
  125. package/dist/queries/extract-candidates.js +1 -1
  126. package/dist/queries/fan.d.ts +1 -1
  127. package/dist/queries/fan.js +1 -1
  128. package/dist/queries/files.d.ts +1 -1
  129. package/dist/queries/health.d.ts +2 -2
  130. package/dist/queries/health.js +1 -1
  131. package/dist/queries/hierarchy.d.ts +1 -1
  132. package/dist/queries/hierarchy.js +1 -1
  133. package/dist/queries/hotspots.d.ts +1 -1
  134. package/dist/queries/hotspots.js +1 -1
  135. package/dist/queries/imports.d.ts +1 -1
  136. package/dist/queries/imports.js +1 -1
  137. package/dist/queries/incomplete-migration.d.ts +1 -1
  138. package/dist/queries/incomplete-migration.js +1 -1
  139. package/dist/queries/index.d.ts +3 -3
  140. package/dist/queries/index.js +1 -1
  141. package/dist/queries/isolated.d.ts +1 -1
  142. package/dist/queries/isolated.js +1 -1
  143. package/dist/queries/locality-candidates.d.ts +1 -1
  144. package/dist/queries/locality-candidates.js +1 -1
  145. package/dist/queries/members.d.ts +1 -1
  146. package/dist/queries/members.js +1 -1
  147. package/dist/queries/methods.d.ts +1 -1
  148. package/dist/queries/methods.js +1 -1
  149. package/dist/queries/outline.d.ts +1 -1
  150. package/dist/queries/outline.js +1 -1
  151. package/dist/queries/passthrough-candidates.d.ts +1 -1
  152. package/dist/queries/passthrough-candidates.js +1 -1
  153. package/dist/queries/plan-context.d.ts +1 -1
  154. package/dist/queries/plan-context.js +1 -1
  155. package/dist/queries/react-component-duplicates.d.ts +2 -1
  156. package/dist/queries/react-component-duplicates.js +1 -1
  157. package/dist/queries/react-hook-candidates.d.ts +2 -1
  158. package/dist/queries/react-hook-candidates.js +1 -1
  159. package/dist/queries/react-large-component-pressure.d.ts +1 -1
  160. package/dist/queries/react-large-component-pressure.js +1 -1
  161. package/dist/queries/recent-duplicates.d.ts +1 -1
  162. package/dist/queries/recent-duplicates.js +1 -1
  163. package/dist/queries/redundant-reexports.d.ts +1 -1
  164. package/dist/queries/redundant-reexports.js +1 -1
  165. package/dist/queries/refs.d.ts +1 -1
  166. package/dist/queries/refs.js +1 -1
  167. package/dist/queries/self-audit.d.ts +1 -1
  168. package/dist/queries/self-audit.js +1 -1
  169. package/dist/queries/similar-chains.d.ts +1 -1
  170. package/dist/queries/similar-chains.js +1 -1
  171. package/dist/queries/similar-files.d.ts +1 -1
  172. package/dist/queries/similar-files.js +1 -1
  173. package/dist/queries/similar-signatures.d.ts +1 -1
  174. package/dist/queries/similar-signatures.js +1 -1
  175. package/dist/queries/similar.d.ts +13 -2
  176. package/dist/queries/similar.js +1 -1
  177. package/dist/queries/slice.d.ts +1 -1
  178. package/dist/queries/slice.js +1 -1
  179. package/dist/queries/stale-abstractions.d.ts +1 -1
  180. package/dist/queries/stale-abstractions.js +1 -1
  181. package/dist/queries/stats.d.ts +1 -1
  182. package/dist/queries/surface.d.ts +1 -1
  183. package/dist/queries/surface.js +1 -1
  184. package/dist/queries/symbols.d.ts +1 -1
  185. package/dist/queries/symbols.js +1 -1
  186. package/dist/queries/system.d.ts +1 -1
  187. package/dist/queries/system.js +1 -1
  188. package/dist/queries/trace.d.ts +1 -1
  189. package/dist/queries/trace.js +1 -1
  190. package/dist/queries/unused-imports.d.ts +1 -1
  191. package/dist/queries/unused-imports.js +1 -1
  192. package/dist/queries/unused-params.d.ts +1 -1
  193. package/dist/queries/unused-params.js +1 -1
  194. package/dist/queries/vue-component-duplicates.d.ts +2 -1
  195. package/dist/queries/vue-component-duplicates.js +1 -1
  196. package/dist/queries/vue-composable-candidates.d.ts +2 -1
  197. package/dist/queries/vue-composable-candidates.js +1 -1
  198. package/dist/queries/vue-large-view-pressure.d.ts +1 -1
  199. package/dist/queries/wrapper-candidates.d.ts +1 -1
  200. package/dist/queries/wrapper-candidates.js +1 -1
  201. package/docs/COMMAND_REFERENCE.md +1 -1
  202. package/docs/analyzer-inventory.md +29 -0
  203. package/docs/analyzer-validation-ledger.md +32 -1
  204. package/package.json +1 -1
  205. package/skills/scip-hyper-optimization/SKILL.md +153 -24
  206. package/skills/scip-hyper-optimization/agents/openai.yaml +3 -3
  207. package/dist/chunk-2H57MJLI.js +0 -2
  208. package/dist/chunk-4TMJDHC6.js +0 -5
  209. package/dist/chunk-5GVOJOBL.js +0 -2
  210. package/dist/chunk-7XWXGANX.js +0 -4
  211. package/dist/chunk-AETMKBZR.js +0 -40
  212. package/dist/chunk-BTCASU5J.js +0 -3
  213. package/dist/chunk-C6ROZBJA.js +0 -32
  214. package/dist/chunk-COUFCH64.js +0 -2
  215. package/dist/chunk-EKECQP6Z.js +0 -2
  216. package/dist/chunk-FVA3NH4P.js +0 -2
  217. package/dist/chunk-I274B3B3.js +0 -7
  218. package/dist/chunk-J6ADQKQA.js +0 -2
  219. package/dist/chunk-K7VBTWNR.js +0 -2
  220. package/dist/chunk-KLXVEBVC.js +0 -2
  221. package/dist/chunk-KRGBLZT2.js +0 -7
  222. package/dist/chunk-P3K7LX7M.js +0 -4
  223. package/dist/chunk-PVZMPG5I.js +0 -2
  224. package/dist/chunk-RSKOYTSY.js +0 -3
  225. package/dist/chunk-RY7CAOJF.js +0 -4
  226. package/dist/chunk-S7YOLFLX.js +0 -2
  227. package/dist/chunk-SOGKYB5I.js +0 -8
  228. package/dist/chunk-VAXDTQHE.js +0 -18
  229. package/dist/chunk-X3BJUFSN.js +0 -62
  230. package/dist/chunk-XPOZO76D.js +0 -2
  231. package/dist/chunk-XWC67C3Q.js +0 -2
  232. package/dist/chunk-YNSVAJR6.js +0 -2
  233. package/dist/chunk-ZMU6IWDK.js +0 -38
@@ -1,2 +0,0 @@
1
- import{a as C,b as k,c as a,d as m}from"./chunk-BZ53S4ZN.js";import{a as V}from"./chunk-PVZMPG5I.js";import{a as B,b}from"./chunk-YWOOQ4FF.js";import{c as y}from"./chunk-YZA6PPZL.js";function L(e,s={}){let{minSimilarity:h=.45,minSharedBehaviors:o=6,limit:r=20,scope:t,scanLimit:l,filePattern:c}=s,d=y(e,{scope:t,minBehaviorTokens:Math.max(3,o),scanLimit:l}).map(n=>({file:n.file,tokens:n.behaviorTokens,profile:n}));return V({profiles:d,limit:r,filePattern:c,compare:(n,i)=>R(n,i,h,o),sort:(n,i)=>i.similarity-n.similarity||n.fileA.localeCompare(i.fileA)||n.fileB.localeCompare(i.fileB)})}function R(e,s,h,o){let r=B(e.tokens,s.tokens);if(r.size<o||!P(r))return null;let t=k(e.tokens,s.tokens);if(t<h)return null;let l=a(r,"composable:"),c=a(r,"store:"),d=a(r,"reactivity:"),n=a(r,"lifecycle:"),i=a(r,"request:"),f=a(r,"function:"),g=a(r,"function-verb:"),v=a(r,"template-binding:"),p=a(r,"template-event:"),u=T({sharedComposables:l,sharedStores:c,sharedReactivity:d,sharedLifecycle:n,sharedRequests:i,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:v,sharedTemplateEvents:p});return{fileA:e.file,fileB:s.file,similarity:t,sharedTokens:m(r),sharedComposables:l,sharedStores:c,sharedReactivity:d,sharedLifecycle:n,sharedRequests:i,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:v,sharedTemplateEvents:p,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:m(b(e.tokens,s.tokens)).slice(0,25),uniqueToB:m(b(s.tokens,e.tokens)).slice(0,25),reason:S({sharedComposables:l,sharedStores:c,sharedRequests:i,sharedLifecycle:n,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:v}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function T(e){return C({genericWords:q,primitiveGroups:[{values:e.sharedReactivity,reasonPrefix:"shared reactivity primitive",bucket:"generic"},{values:e.sharedLifecycle,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedComposables,label:"shared composable",fallbackBucket:"shared-abstraction"},{names:e.sharedStores,label:"shared store",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedFunctions,label:"shared function",fallbackBucket:"generic"},{names:e.sharedFunctionVerbs,label:"shared action verb",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"},{names:e.sharedTemplateEvents,label:"shared template event",fallbackBucket:"generic"}],recommendation:F})}function F(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct composable-extraction evidence."}}function P(e){let s=0,h=0,o=0,r=0,t=0,l=0,c=0;for(let i of e)i.startsWith("composable:")?s+=1:i.startsWith("store:")?h+=1:i.startsWith("request:")?o+=1:i.startsWith("lifecycle:")?r+=1:i.startsWith("function:")?t+=1:i.startsWith("reactivity:")?l+=1:(i.startsWith("function-verb:")||i.startsWith("template-binding:")||i.startsWith("template-event:"))&&(c+=1);let d=s+h,n=d+o+r+t+c;return o>=1&&n>=4||r>=1&&t>=2&&n>=4||d>=2&&(o>=1||t>=2)&&n>=5||t>=2&&l>=1&&n>=4}function S(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}var q=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{L as a};
2
- //# sourceMappingURL=chunk-EKECQP6Z.js.map
@@ -1,2 +0,0 @@
1
- import{b as G}from"./chunk-B75HZHUP.js";import{a as v}from"./chunk-XPOZO76D.js";import{b as B,e as W,f as U,g as H}from"./chunk-ANIOISCE.js";import{a as $}from"./chunk-YNSVAJR6.js";import{c as K,d as V,f as E,l as q}from"./chunk-AETMKBZR.js";import{e as Z}from"./chunk-RSKOYTSY.js";import{b as F}from"./chunk-RY7CAOJF.js";import{f as z,m as x}from"./chunk-X3BJUFSN.js";import{c as k,f as T,g as A,h as M,i as O,j}from"./chunk-JM72FNGA.js";import{a as N,d as S}from"./chunk-BTCASU5J.js";import{a as P}from"./chunk-DS6QEB3G.js";import{a as g}from"./chunk-64MNV6AB.js";import{b as _}from"./chunk-7S5E7KWT.js";var h=new WeakMap;function X(e,t){let n=N(t);return n==="rust"?Re(e,t):n==="typescript"||n==="tsx"||n==="javascript"?ye(e,t):[]}var me=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),pe=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,be=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function ye(e,t){let n=P(e,t);if(!n||!ge(n))return[];let r=S(e,t);if(!r)return[];let s=h.get(r);if(s)return s;let o=!1,i=r.rootNode;for(let c of i.namedChildren){if(c.type!=="expression_statement")continue;let l=c.namedChild(0);if(!l||l.type!=="call_expression")continue;let a=l.namedChild(0);if(!a)continue;let d=a.type==="member_expression"?a.namedChild(a.namedChildCount-1)?.text:a.text;if(d&&me.has(d)){o=!0;break}}let u=[];o&&u.push({startLine:0,endLine:i.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"});for(let c of i.namedChildren){let l=null,a=null;if(c.type==="function_declaration")l=c.namedChild(0)?.text??null,a=c;else if(c.type==="export_statement"){let d=c.namedChild(0);d?.type==="function_declaration"&&(l=d.namedChild(0)?.text??null,a=d)}else if(c.type==="lexical_declaration"){let d=c.namedChild(0);if(d?.type==="variable_declarator"){let m=d.namedChild(0)?.text,b=d.namedChild(1);m&&(b?.type==="arrow_function"||b?.type==="function_expression")&&(l=m,a=d)}}l&&/^use[A-Z]/.test(l)&&a&&u.push({startLine:a.startPosition.row,endLine:a.endPosition.row,reason:"React custom hook (use*)"})}return u.push(...Q(r,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),h.set(r,u),u}function ge(e){return e.includes("scip-query")||pe.test(e)||be.test(e)}var he=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function xe(e){return he.test(e)}function Q(e,t,n){let r=[],s=o=>{if(t.has(o.type)&&o.parent){let u=o.parent.children,c=-1;for(let l=0;l<u.length;l+=1)if(u[l].startIndex===o.startIndex&&u[l].type===o.type){c=l;break}if(c>0)for(let l=c-1;l>=0;l-=1){let a=u[l];if(n.has(a.type)){if(xe(a.text)){r.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 i of o.namedChildren)s(i)};return s(e.rootNode),r}function Re(e,t){let n=S(e,t);if(!n)return[];let r=h.get(n);if(r)return r;let s=[],o=_e(n);return o?(h.set(n,o),o):(Y(n.rootNode,s,!1,!1),s.push(...Q(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),s.push(...Ie(n.rootNode)),h.set(n,s),s)}function _e(e){return Pe(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function Y(e,t,n,r){let s=n,o=r;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?Se(e,t,n,r):r&&we(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?Ee(e,t,n):e.type==="mod_item"&&C(e).some(i=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(i))&&(s=!0);for(let i of e.namedChildren)Y(i,t,s,o)}function Se(e,t,n,r){let s=C(e),o=null;r?o="trait impl method (dynamic dispatch)":n&&(o="inside #[cfg(test)] mod");for(let i of s){let u=Ce(i);if(u){o=u;break}if(ee(i)){o="#[allow(dead_code)]";break}}o&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o})}function Ee(e,t,n){let r=C(e),s=e.namedChildren.find(o=>o.type==="type_identifier")?.text;r.some(Le)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:s}),r.some(ee)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:s}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:s})}function C(e){let t=e.parent;if(!t)return[];let n=t.children,r=-1;for(let o=0;o<n.length;o+=1)if(n[o].startIndex===e.startIndex&&n[o].type===e.type){r=o;break}if(r<=0)return[];let s=[];for(let o=r-1;o>=0;o-=1){let i=n[o];if(i.type==="attribute_item"||i.type==="inner_attribute_item")s.push(i.text);else{if(i.type==="line_comment"||i.type==="block_comment")continue;break}}return s}var ve=[{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 Ce(e){return ve.find(({re:t})=>t.test(e))?.reason??null}var De=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Le(e){return/#\[\s*derive\s*\(/.test(e)?De.some(t=>t.test(e)):!1}function ee(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function we(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ie(e){let t=Fe(e);if(t.size===0)return[];let n=[];for(let r of e.descendantsOfType("mod_item")){let s=r.childForFieldName("name")?.text;s&&t.has(s)&&n.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:s})}return n}function Pe(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var Ne=/^#!?\[\s*serde\s*\(/,J=/\bwith\s*=\s*"([^"]+)"/g;function Fe(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){if(!Ne.test(n.text))continue;J.lastIndex=0;let r;for(;(r=J.exec(n.text))!==null;){let s=r[1],o=s.split("::").pop()??s;o&&t.add(o)}}return t}function te(e){let t=new Map,n=r=>{let s=t.get(r);if(s)return s;let o=X(e,r);return s={ranges:o.map(i=>({startLine:i.startLine,endLine:i.endLine})),containers:new Set(o.map(i=>i.containerName).filter(i=>!!i))},t.set(r,s),s};return(r,s,o,i)=>{let u=n(r);for(let c of u.ranges)if(s>=c.startLine&&s<=c.endLine)return!0;if(i&&u.containers.has(i))return!0;for(let c of x(o))if(u.containers.has(c))return!0;return!1}}function et(e,t={}){_(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,t,n={}){_(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function re(e,t){return t.isIgnoredPath(e.relativePath)?p("ignored-file"):M(e.symbol)?p("module-like-symbol"):ne(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&ne(e.enclosingSymbol)?p("nested-non-callable-value"):!t.includeTests&&!L(e.relativePath)?p("test-file"):!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?p("excluded-file-region"):O(e.symbol)?p("rust-trait-impl-member"):j(e.symbol)?p("rust-test-module"):!t.includeMembers&&!ke(e)?p("member"):e.endLine-e.startLine+1<t.minLoc?p("below-min-loc"):{accepted:!0}:p("non-value-symbol")}function L(e){return B(e)!=="test"}function p(e){return{accepted:!1,rejectionReason:e}}function ne(e){return A(e)||e.endsWith("().")||e.endsWith(".")}function ke(e){return T(e.symbol)||x(e.symbol).length===0}function se(){return new Map}function oe(e,t,n){let r=new Map;for(let s of K(e,n))e.isIgnored(s.relative_path)||t.has(s.relative_path)||R(r,s.symbol_id,s.relative_path,s.ref_count,"scip-mention");return r}function ie(e,t,n){let r=new Set;for(let s of V(e,t))e.isIgnored(s.relative_path)||n.has(s.relative_path)||r.add(s.symbol_id);return r}function w(e,t){let n=e.get(t);if(!n)return!1;for(let r of n.values())if(r.occurrences>0)return!0;return!1}function I(e,t,n){let r=e.get(t);if(!r)return!1;for(let[s,o]of r)if(s!==n&&o.occurrences>0)return!0;return!1}function ae(e){return e?.occurrences??0}function R(e,t,n,r,s="source-fallback"){if(r<=0)return;let o=le(e,t,n);o.occurrences+=r,o.sources.add(s)}function ce(e,t,n,r,s){if(r<=0)return;let o=le(e,t,n);o.occurrences=Math.max(r,o.occurrences),o.sources.add(s)}function le(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let s=r.get(n);return s||(s={occurrences:0,sources:new Set},r.set(n,s)),s}var Te=3e3,Ae=1e3;function Et(e,t={}){let{scope:n,minLoc:r=1,includeTests:s=!1,skipBarrels:o=!1,includeMembers:i=!1,deadCodeOnly:u=!1,scanLimit:c,semantic:l=!0}=t,a=G(Me(e,{scope:n,minLoc:r,includeTests:s,includeMembers:i}),c),d=o?new Set(W(e)):new Set,m=u?se():oe(e,d,a.map(f=>f.symbolId)),b=u?ie(e,a.map(f=>f.symbolId),d):new Set,y=u?a.filter(f=>!b.has(f.symbolId)):a.filter(f=>!I(m,f.symbolId,f.relativePath));u?Ue(e,y,m,d):We(e,y,m,d);let de=u?y.filter(f=>!w(m,f.symbolId)):y.filter(f=>!I(m,f.symbolId,f.relativePath));Ze(e,de,m,{includeTests:s,inactiveBarrelPaths:d,includeSemantic:!u&&l});let fe=u?y.filter(f=>!w(m,f.symbolId)):a;return Be(e,Oe(fe,m))}function Me(e,t){let n=te(e),r=[];for(let s of g(e,{scope:t.scope}))try{for(let o of z(e,s))re(o,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:u=>e.isIgnored(u),isExcludedRegion:n}).accepted&&r.push(o)}finally{D(e,s,{definitions:!0})}return r}function Oe(e,t){return e.map(n=>je(n,t)).filter(n=>n.cross_file_refs===0).sort((n,r)=>r.loc-n.loc||n.relative_path.localeCompare(r.relative_path)||n.start_line-r.start_line)}function je(e,t){let n=t.get(e.symbolId)??new Map,r=ae(n.get(e.relativePath)),s=0;for(let[o,i]of n)o!==e.relativePath&&(s+=i.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:r,cross_file_refs:s}}function Be(e,t){let n=[],r=0,s=0,o=0;for(let i of t){if(e.isIgnored(i.relative_path)||U(e,i.relative_path)||H(e,i.symbol,i.relative_path))continue;let u=i.same_file_refs===0?"dead-code":"file-internal";u==="dead-code"?r++:s++,o+=i.loc,n.push({relativePath:i.relative_path,startLine:i.start_line,endLine:i.end_line,loc:i.loc,symbol:i.symbol,shortName:k(i.symbol),sameFileRefs:i.same_file_refs,kind:u})}return{symbols:n,counts:{total:n.length,deadCode:r,fileInternal:s,loc:o},totalCount:n.length,deadCodeCount:r,fileInternalCount:s,totalLoc:o}}function We(e,t,n,r){if(t.length===0)return;let s=new v(e),o=new Set(t.map(c=>c.symbolId)),i=new Set(t.map(c=>c.leaf).filter(Boolean)),u=new Set(s.sourceFiles());for(let c of g(e))u.add(c);s.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:i,skipPath:c=>r.has(c)},c=>{o.has(c.target.symbolId)&&(Ke(e,c)||R(n,c.target.symbolId,c.sourceFile,Ve(c),"source-fallback"))})}function Ue(e,t,n,r){if(t.length===0)return;let s=new v(e),o=He(t),i=new Set(s.sourceFiles());for(let a of g(e))i.add(a);let u=new Set(o.keys()),c=new Map,l=a=>{let d=c.get(a);return d||(d=q(e,a),c.set(a,d)),d};s.scanSourceReferences({paths:i,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:a=>r.has(a),resolveTargets:({sourceFile:a,name:d,kind:m})=>{let b=o.get(d);return b?ze(a,d,b,l(a),{permissive:m!=="cross-language-dispatch"}):[]},afterPath:a=>{c.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"&&ue(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(n,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function He(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let r=t.get(n.leaf)??[];r.push(n),t.set(n.leaf,r)}return t}function ze(e,t,n,r,s){let o=n.filter(c=>c.relativePath===e);if(o.length>0)return o;if(!s.permissive&&n.length===1)return[...n];let i=r.get(t);if(i)for(let c of i){let l=n.filter(a=>E(c,a.relativePath));if(l.length>0)return l}let u=new Set;for(let c of r.values())for(let l of c)u.add(l);for(let c of u){let l=n.filter(a=>E(c,a.relativePath));if(l.length>0&&l.length===n.length)return l}return s.permissive?[...n]:[]}function Ke(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&ue(e,t)}function Ve(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ue(e,t){return t.occurrences>1?!1:F(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function Ze(e,t,n,r){let s=r.includeSemantic!==!1,o=s&&t.length>=Te&&g(e).length>=Ae,i=(c,l)=>{l===c.relativePath||e.isIgnored(l)||r.inactiveBarrelPaths.has(l)||!r.includeTests&&!L(l)||ce(n,c.symbolId,l,1,"caller-map")};for(let c of t){let l=$(e,c,{semantic:s&&!o});if(l.length!==0)for(let a of l)i(c,a.file)}if(!o)return;let u=Z(e,t);for(let c of t){let l=u.get(c.symbolId);if(l)for(let a of l)i(c,a)}}export{et as a,Et as b};
2
- //# sourceMappingURL=chunk-FVA3NH4P.js.map
@@ -1,7 +0,0 @@
1
- import{a as L,b as M}from"./chunk-VFLHKRTW.js";import{a as F}from"./chunk-LM5SHAN4.js";import{a as D}from"./chunk-PFOCOG57.js";import{a as x}from"./chunk-B75HZHUP.js";import{a as h}from"./chunk-XPOZO76D.js";import{a as C}from"./chunk-BGBBVSH4.js";import{a as I}from"./chunk-AETMKBZR.js";import{k as b}from"./chunk-X3BJUFSN.js";import{c as f,d as p,j as g}from"./chunk-JM72FNGA.js";import{basename as u,extname as d}from"path";function K(r,n){let{scope:e,maxLoc:t=15,limit:a=30,scanLimit:o}=n??{},i=new h(r),l=E(i.fileDependencyGraph(e));return D({candidates:()=>v(i,e,t),orderCandidates:x,scanLimit:o,prepare:s=>({callerFileMap:L(i,s,{semantic:n?.semantic!==!1}),reverseFanIn:l}),evaluate:(s,c)=>S(r,i,s,c),orderResults:(s,c)=>c.callerFanIn-s.callerFanIn||c.loc-s.loc,limit:a})}function S(r,n,e,t){let a=y(r,n,e,t.callerFileMap);if(a.length!==1)return null;let o=a[0],i=P(r,e.symbolId,o);if(!i)return null;let l=w(n,r,o,e.symbol,i);if(l&&g(l.symbol))return null;let{fanIn:s,source:c}=_(t.callerFileMap,t.reverseFanIn,o,l);if(c==="function"?s<=3:s<=5)return null;let m=j(r,e,o,l);return{symbol:e.symbol,shortName:f(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:C(e),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?f(l.symbol):u(o),callerFanIn:s,actionTier:m.length>0?"signal":"direct",boundaryEvidence:m}}function v(r,n,e){return r.productionCallableDefinitions({scope:n,minLoc:2,maxLoc:e,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0})}function y(r,n,e,t){let a=u(e.relativePath,d(e.relativePath)),o=[...t.get(e.symbolId)??[]].filter(i=>i!==e.relativePath).filter(i=>u(i,d(i))!==a).filter(i=>{let l=n.fileKind(i);return l!=="barrel"&&l!=="entry"&&l!=="test"});return M(r,e,o).realConsumers}function P(r,n,e){return r.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`,n,e)}function w(r,n,e,t,a){let o=r.definitionsForFile(e),i=k(n,e,t,a.start_line,a.end_line);return b(o,i)}function _(r,n,e,t){if(t?.isFunctionLike){let a=[...r.get(t.symbolId)??[]].filter(o=>o!==t.relativePath);if(a.length>0)return{fanIn:a.length,source:"function"}}return{fanIn:N(n,e),source:"file"}}function k(r,n,e,t,a){let o=p(e);if(!o)return t;let i=I(r,n).get(o);if(!i||i.length===0)return t;for(let l of i)if(l>=t&&l<=a)return l;return t}function E(r){let n=new Map;for(let[e,t]of r){n.has(e)||n.set(e,n.get(e)??0);for(let a of t)n.set(a,(n.get(a)??0)+1)}return n}function N(r,n){let e=r.get(n)??0;if(e>0)return e;let t=u(n,d(n)),a=0;for(let[o,i]of r)o!==n&&u(o,d(o))===t&&i>a&&(a=i);return a}function j(r,n,e,t){return F(r,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:f(n.symbol)},{label:"caller name",value:t?.symbol?f(t.symbol):u(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{K as a};
7
- //# sourceMappingURL=chunk-I274B3B3.js.map
@@ -1,2 +0,0 @@
1
- import{a as u}from"./chunk-PFOCOG57.js";import{a as p}from"./chunk-XPOZO76D.js";import{c as i}from"./chunk-JM72FNGA.js";function x(e,r){let{scope:m,minLoc:o=10,limit:c=30,scanLimit:a}=r??{},s=new p(e);return u({candidates:()=>s.productionCallableDefinitions({scope:m,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:s.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:s.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>b(t,n,o),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:c})}function b(e,r,m){let o=e.endLine-e.startLine+1;if(o<m)return null;let c=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],s=a.filter(l=>l.file!==e.relativePath),t=new Set(s.map(l=>`${l.symbol}|${l.file}`)).size,n=new Set(a.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:i(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:c,fanOut:t,calleeCount:n,score:Math.round(o/50*(c/5)*Math.max(t/5,1)*100)/100}}export{x as a};
2
- //# sourceMappingURL=chunk-J6ADQKQA.js.map
@@ -1,2 +0,0 @@
1
- import{a as C}from"./chunk-EKECQP6Z.js";import{a as D}from"./chunk-2H57MJLI.js";import{a as f}from"./chunk-XWC67C3Q.js";import{a as g}from"./chunk-KLXVEBVC.js";import{c as y}from"./chunk-4TMJDHC6.js";import{e as h}from"./chunk-KRGBLZT2.js";import{d as p}from"./chunk-A536TEU4.js";var F=.7,S=.62,R=.45;function $(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=h(i);if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic}).map(r=>I(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(w);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:T(b)}}function A(i,t){let e=K(t.limit),n=[...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??F,limit:e,scanLimit:t.scanLimit,semantic:t.semantic})],a=p(i,{scope:t.scope});return a.react&&n.push(...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit})),a.vue&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit})),n}function B(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function k(i,t){return u(i,t,{query:f,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:P(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:g,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function E(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function x(i,t){return u(i,t,{query:C,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function I(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let l=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function w(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function T(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:N(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function N(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function P(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{$ as a};
2
- //# sourceMappingURL=chunk-K7VBTWNR.js.map
@@ -1,2 +0,0 @@
1
- import{a as p,b as H,c as l,d as m}from"./chunk-BZ53S4ZN.js";import{a as b}from"./chunk-PVZMPG5I.js";import{a as R,b as g}from"./chunk-YWOOQ4FF.js";import{e as v}from"./chunk-BTCASU5J.js";function V(e,s={}){let{minSimilarity:d=.45,minSharedBehaviors:i=6,limit:o=20,scope:n,scanLimit:a,filePattern:c}=s,h=v(e,{scope:n,minBehaviorTokens:Math.max(3,i),scanLimit:a}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r}));return b({profiles:h,limit:o,filePattern:c,compare:(r,t)=>y(r,t,d,i),sort:(r,t)=>t.similarity-r.similarity||r.fileA.localeCompare(t.fileA)||r.componentA.localeCompare(t.componentA)||r.fileB.localeCompare(t.fileB)||r.componentB.localeCompare(t.componentB)})}function y(e,s,d,i){let o=R(e.tokens,s.tokens);if(o.size<i||!A(o))return null;let n=H(e.tokens,s.tokens);if(n<d)return null;let a=l(o,"hook:"),c=l(o,"react-hook:"),h=l(o,"effect:"),r=l(o,"state:"),t=l(o,"request:"),u=l(o,"handler:"),k=l(o,"handler-verb:"),f=B({sharedHooks:a,sharedReactHooks:c,sharedEffects:h,sharedState:r,sharedRequests:t,sharedHandlers:u,sharedHandlerVerbs:k});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:n,sharedTokens:m(o),sharedHooks:a,sharedReactHooks:c,sharedEffects:h,sharedState:r,sharedRequests:t,sharedHandlers:u,sharedHandlerVerbs:k,evidenceClass:f.evidenceClass,actionTier:f.actionTier,evidenceClassReasons:f.reasons,recommendation:f.recommendation,uniqueToA:m(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:m(g(s.tokens,e.tokens)).slice(0,25),reason:E({sharedHooks:a,sharedReactHooks:c,sharedEffects:h,sharedState:r,sharedRequests:t,sharedHandlers:u,sharedHandlerVerbs:k}),locA:e.profile.loc,locB:s.profile.loc}}function B(e){return p({genericWords:P,stripPrefixes:S,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:C})}function C(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function A(e){let s=0,d=0,i=0,o=0,n=0,a=0,c=0;for(let t of e)t.startsWith("hook:")?s+=1:t.startsWith("react-hook:")?d+=1:t.startsWith("effect:")?i+=1:t.startsWith("request:")?o+=1:t.startsWith("handler:")||t.startsWith("handler-verb:")?n+=1:t.startsWith("state:")?a+=1:t.startsWith("state-hook:")&&(c+=1);let h=a+c,r=s+d+i+o+n+h;return o>=1&&r>=4||s>=1&&(o>=1||a>=1||n>=2)&&r>=5||a>=1&&n>=2&&(i>=1||d>=2)&&r>=5}function E(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var P=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),S=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{V as a};
2
- //# sourceMappingURL=chunk-KLXVEBVC.js.map
@@ -1,7 +0,0 @@
1
- import{d as y}from"./chunk-7S5E7KWT.js";import{execFileSync as H}from"child_process";var F=2e3,E=50,j=8,M=3,D=2160*60*60,L=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,O=3,B=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,I=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function S(e){let t=y(e,{clearGroups:["whole-project"]});return(n,r)=>{let i=v(n.config.projectRoot);if(!i)return null;let s=t.has(n)?t.get(n,()=>({head:"",value:null})):null;return s&&s.head===i?s.value:(t.invalidate(n),t.get(n,()=>({head:i,value:r(n.config.projectRoot,i)})).value)}}var N=S("git-commit-history");function x(e){return N(e,k)}function v(e){try{return A(e,["rev-parse","HEAD"]).trim()||null}catch{return null}}function A(e,t){return H("git",["-C",e,...t],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function k(e,t){let n;try{n=A(e,["log","--no-merges","--name-only","-n",String(F),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let r=[],i=0;for(let s of n.split("")){if(s.trim()==="")continue;let a=s.indexOf(`
2
- `),d=a>=0?s.slice(0,a):s,[g,f,C]=d.split("\0");if(!g||!f)continue;let c=a>=0?s.slice(a+1).split(`
3
- `).map(o=>o.trim()).filter(o=>o!==""):[];if(c.length>E){i+=1;continue}r.push({hash:g,timestamp:Number(f)||0,subject:C??"",files:c})}return{head:t,commits:r,skippedBulkCommits:i}}function z(e){return L.test(e.subject)}function Y(e){let t=x(e);if(!t)return null;let n=new Map;for(let r of t.commits){let i=z(r);for(let s of r.files){let a=n.get(s)??{changes:0,fixChanges:0,lastChangedAt:0};a.changes+=1,i&&(a.fixChanges+=1),r.timestamp>a.lastChangedAt&&(a.lastChangedAt=r.timestamp),n.set(s,a)}}return n}function ee(e){let t=x(e);if(!t||t.commits.length===0)return null;let n=t.commits.map(r=>r.files.length).filter(r=>r>0).sort((r,i)=>r-i);return n.length===0?null:{medianFilesPerCommit:R(n,.5),p90FilesPerCommit:R(n,.9),commitsAnalyzed:n.length}}function R(e,t){let n=Math.min(e.length-1,Math.floor(e.length*t));return e[n]}var G=S("git-tracked-files");function te(e){return G(e,t=>{try{let n=A(t,["ls-files"]);return new Set(n.split(`
4
- `).map(r=>r.trim()).filter(r=>r!==""))}catch{return null}})}var U=S("git-file-adds");function ne(e){return U(e,t=>J(t))}function J(e){let t;try{t=A(e,["log","--no-merges","--diff-filter=A","--name-only","-n",String(F),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,r=-1;for(let i of t.split("")){if(i.trim()==="")continue;r+=1;let s=i.indexOf(`
5
- `),a=s>=0?i.slice(0,s):i,[,d]=a.split("\0"),g=Number(d)||0;if(!(s<0))for(let f of i.slice(s+1).split(`
6
- `)){let C=f.trim();C!==""&&n.set(C,{commitsAgo:r,addedAt:g})}}return n}function re(e,t={}){let n=x(e);return n?P(n,t):null}function oe(e,t,n={}){let r=x(e);return r?t.size===0?[]:P(r,n,t):null}function P(e,t,n){let{minTogether:r=4,minConfidence:i=.6,maxFilesPerCommit:s=E}=t,a=new Map,d=new Map,g=0;for(let c of e.commits){let o=[...new Set(c.files)].sort();if(o.length>s)continue;c.timestamp>g&&(g=c.timestamp);let u=V(o),p=n===void 0||o.some(l=>n.has(l));for(let l of o)a.set(l,(a.get(l)??0)+1);if(p)for(let l=0;l<o.length;l++)for(let h=l+1;h<o.length;h++){if(n&&!n.has(o[l])&&!n.has(o[h]))continue;let b=`${o[l]}\0${o[h]}`,m=d.get(b)??{together:0,focusedTogether:0,broadTogether:0,lastTogetherAt:0,timestamps:[],subjects:[]};m.together+=1,u?m.broadTogether+=1:m.focusedTogether+=1,c.timestamp>m.lastTogetherAt&&(m.lastTogetherAt=c.timestamp),m.timestamps.push(c.timestamp),m.subjects.push(c.subject),d.set(b,m)}}let f=[],C=g-D;for(let[c,o]of d){let u=o.together;if(u<r)continue;let[p,l]=c.split("\0"),h=a.get(p)??u,b=a.get(l)??u,m=Math.max(u/h,u/b);if(m<i)continue;let _=o.broadTogether/u,T=o.timestamps.filter(w=>w>=C).length;f.push({fileA:p,fileB:l,together:u,confidence:m,changesA:h,changesB:b,focusedTogether:o.focusedTogether,broadTogether:o.broadTogether,broadCommitRatio:_,lastTogetherAt:o.lastTogetherAt,recentTogether:T,commitScope:W(o.broadTogether,u),recency:T>0?"recent":"stale",subjectContext:X(o.subjects)})}return f.sort((c,o)=>o.together-c.together||o.confidence-c.confidence||c.fileA.localeCompare(o.fileA)),f}function V(e){return e.length>=j?!0:K(e).size>=M}function K(e){let t=new Set;for(let n of e){let r=n.indexOf("/");t.add(r>=0?n.slice(0,r):".")}return t}function W(e,t){return e===0?"focused":e/t>=.5?"broad-sweep":"mixed"}function X(e){let t=new Set,n=[],r=[];for(let i of e){!r.includes(i)&&r.length<O&&r.push(i);for(let s of Z(i))t.add(s);for(let s of i.match(B)??[])n.includes(s)||n.push(s)}return{subjectLabels:[...t].sort(),issueRefs:n,sampleSubjects:r,externalIssueLabelStatus:"unavailable"}}function Z(e){let t=new Set,n=I.exec(e)?.[1]?.toLowerCase();return n&&t.add($(n)),/\b(?:feat|feature)\b/i.test(e)&&t.add("feature"),/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i.test(e)&&t.add("fix"),/\b(?:docs?|documentation|guide|readme)\b/i.test(e)&&t.add("docs"),/\brefactor(?:ing|ed)?\b/i.test(e)&&t.add("refactor"),/\btests?\b/i.test(e)&&t.add("test"),/\b(?:release|version|v\d+\.\d+)\b/i.test(e)&&t.add("release"),/\bchore\b/i.test(e)&&t.add("chore"),/\bbuild\b/i.test(e)&&t.add("build"),/\bci\b/i.test(e)&&t.add("ci"),/\bperf(?:ormance)?\b/i.test(e)&&t.add("perf"),[...t]}function $(e){return e==="feat"?"feature":e}export{x as a,Y as b,ee as c,te as d,ne as e,re as f,oe as g};
7
- //# sourceMappingURL=chunk-KRGBLZT2.js.map
@@ -1,4 +0,0 @@
1
- import{a as j,d as k}from"./chunk-KRGBLZT2.js";import{b as v,d as N,e as E}from"./chunk-C6ROZBJA.js";import{existsSync as X,readFileSync as _}from"fs";import{join as C}from"path";function F(t,n){let e=W(t,n)??G(t,n)??Z(t,n)??J(t,n);return q(t,e,n)}function W(t,n){let e=-1,i=null;for(let o=0;o<=n;o+=1){let r=M(t[o]??"");r&&(i===null?(i=r,e=o):r===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let o=n+1;o<t.length;o+=1)if(M(t[o]??"")===i)return{start:e,end:o+1};return{start:e,end:t.length}}function M(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function G(t,n){if(!T(t[n]??""))return null;let e=n;for(;e>0&&T(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&T(t[i]??"");)i+=1;return{start:e,end:i}}function T(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function Z(t,n){let e=n;for(;e>=0;){let r=t[e]??"";if(x(r)!==null)break;if(w(r)!==null)return null;e-=1}if(e<0)return null;let i=x(t[e]??"");if(i===null)return null;let o=e+1;for(;o<t.length;){let r=t[o]??"",c=x(r);if(c!==null){if(c<=i)break;o+=1;continue}if(w(r)!==null)break;o+=1}return{start:e,end:o}}function x(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function J(t,n){let e=t[n]??"";if(L(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&O(t[i-1]??"");)i-=1;let o=n+1;for(;o<t.length&&O(t[o]??"");)o+=1;return{start:i,end:o}}function O(t){return w(t)===null}function w(t){return t.trim().length===0?"blank":L(t)?"heading":M(t)?"fence":T(t)?"table":x(t)!==null?"list":null}function L(t){return/^#{1,6}\s+/.test(t.trim())}function q(t,n,e){let{start:i,end:o}=n;if(o-i>40){let c=Math.floor(20);i=Math.max(i,e-c),o=Math.min(o,i+40),i=Math.max(n.start,o-40)}let r=t.slice(i,o).join(`
2
- `).trim();return r.length<=2e3?r:`${r.slice(0,2e3).trimEnd()}...`}function R(t,n){return n.filter(e=>t.includes(e))}var S=/\.(?:md|mdx|rst|txt)$/i;function K(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var Q=3,H=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function dt(t,n={}){let{doc:e,limit:i=20,minCoupling:o=Q}=n,r=tt(t);if(!r)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=[];for(let s of r.docFiles){if(e!==void 0&&!s.includes(e)||e===void 0&&!B(t,s)||e!==void 0&&!X(C(t.config.projectRoot,s)))continue;let f=Math.max(0,...r.changeTimes.get(s)??[]),d=V(t,s),l=new Map,{resolved:a,broken:u,citations:h}=it(t,s,r.tracked,r.trackedBySuffix,r.everSeenInHistory),p=new Map(h.map(g=>[g.file,g.contexts]));for(let g of a){if(g===s||S.test(g))continue;let m=(r.changeTimes.get(g)??[]).filter(b=>b>f).length;m!==0&&l.set(g,{file:g,evidence:"reference",coChanges:0,changesSinceDocUpdate:m,...A("reference",d),citationContexts:p.get(g)})}for(let[g,m]of r.coupling.get(s)??[]){if(m<o||!r.tracked.has(g))continue;let b=(r.changeTimes.get(g)??[]).filter($=>$>f).length;if(b===0)continue;let y=l.get(g);y?(y.evidence="both",y.coChanges=m,Object.assign(y,A("both",d))):l.set(g,{file:g,evidence:"co-change",coChanges:m,changesSinceDocUpdate:b,...A("co-change",d)})}if(l.size===0&&u.length===0)continue;let D=[...l.values()].sort((g,m)=>m.changesSinceDocUpdate-g.changesSinceDocUpdate);c.push({doc:s,docLastChangedAt:f,staleness:D.reduce((g,m)=>g+m.changesSinceDocUpdate,0)+u.length*10,subjects:D.slice(0,8),brokenReferences:u})}return c.sort((s,f)=>f.staleness-s.staleness),{available:!0,commitsAnalyzed:r.historyCommitCount,docsScanned:r.docFiles.length,findings:c.slice(0,i)}}function V(t,n){let e;try{e=_(C(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
3
- ${e}`.toLowerCase(),o=R(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(o.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${o.join(", ")}`]};let r=R(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return r.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${r.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function A(t,n){return{actionTier:Y(t,n.docIntent),docIntent:n.docIntent,docIntentReasons:n.reasons}}function Y(t,n){return n==="historical-note"?"support":t==="co-change"?"signal":"direct"}function tt(t){let n=j(t);if(!n)return null;let e=k(t)??new Set,i=new Map,o=new Map,r=new Set;for(let c of n.commits){let s=[...new Set(c.files)],f=s.filter(l=>S.test(l)),d=s.filter(l=>!S.test(l));for(let l of s){r.add(l);let a=i.get(l)??[];a.push(c.timestamp),i.set(l,a)}for(let l of f){let a=o.get(l);a||(a=new Map,o.set(l,a));for(let u of d)a.set(u,(a.get(u)??0)+1)}}return{changeTimes:i,coupling:o,docFiles:[...e].filter(c=>S.test(c)),everSeenInHistory:r,historyCommitCount:n.commits.length,tracked:e,trackedBySuffix:z(e)}}function ht(t,n){if(n.size===0)return[];let e=k(t)??new Set,i=z(e),o=nt(n,i),r=[];for(let c of e){if(!B(t,c))continue;let s=U(t,c);if(!s)continue;let f=et(s,n,o,e,i);if(f.size===0)continue;let d=[...new Set([...f.values()].flatMap(h=>[...h]))],l=P(t,c,d),a=[...f].map(([h,p])=>({file:h,contexts:I([...p].flatMap(D=>l.get(D)??[])).slice(0,3)})).filter(h=>h.contexts.length>0),u=[...f.keys()];if(u.length>0){let h=u.sort();r.push({doc:c,cited:h,citations:a,citedClaims:I(a.flatMap(p=>p.contexts)).slice(0,3)})}}return r}function B(t,n){return S.test(n)&&!K(n)&&X(C(t.config.projectRoot,n))}function z(t){let n=new Map;for(let e of t){let i=e.split("/");for(let o of[2,3]){if(i.length<o)continue;let r=i.slice(-o).join("/"),c=n.get(r)??[];c.push(e),n.set(r,c)}}return n}function nt(t,n){let e=new Set(t);for(let i of t){let o=i.split("/");for(let r of[2,3]){if(o.length<r)continue;let c=o.slice(-r).join("/"),s=n.get(c);s?.length===1&&s[0]===i&&e.add(c)}}return e}function et(t,n,e,i,o){let r=new Map;for(let c of t){if(!e.has(c))continue;let s;if(i.has(c))s=c;else{let d=o.get(c);d?.length===1&&(s=d[0])}if(!s||!n.has(s))continue;let f=r.get(s)??new Set;f.add(c),r.set(s,f)}return r}function it(t,n,e,i,o){let r=new Set,c=new Set,s=U(t,n);if(!s)return{resolved:r,broken:[],citations:[]};let f=P(t,n,s),d=new Map,l=(a,u)=>{let h=f.get(u);if(!h||h.length===0)return;let p=d.get(a)??[];p.push(...h),d.set(a,I(p).slice(0,3))};for(let a of s){if(e.has(a)){r.add(a),l(a,a);continue}let u=i.get(a);if(u&&u.length===1){r.add(u[0]),l(u[0],a);continue}u&&u.length>1||o.has(a)&&c.add(a)}return{resolved:r,broken:[...c],citations:[...d].map(([a,u])=>({file:a,contexts:u}))}}function P(t,n,e){let i;try{i=_(C(t.config.projectRoot,n),"utf-8").split(/\r?\n/)}catch{return new Map}let o=new Set(e),r=new Map;for(let c=0;c<i.length;c+=1){let s=i[c]??"";for(let f of s.matchAll(H)){let d=f[0].replace(/^\.?\//,"");if(!o.has(d))continue;let l=F(i,c);if(l.length===0)continue;let a=r.get(d)??[];a.push(l),r.set(d,I(a).slice(0,3))}}return r}function I(t){let n=[];for(let e of new Set(t))n.some(i=>rt(i,e))||n.push(e);return n}function rt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(s=>s.trim()).filter(s=>s.length>0),i=n.split(/\r?\n/).map(s=>s.trim()).filter(s=>s.length>0),o=Math.min(e.length,i.length);if(o===0)return!1;if(o<3)return t.includes(n)||n.includes(t);let r=new Set(i),c=e.filter(s=>r.has(s)).length;return c>=3&&c/o>=.6}function U(t,n){let e;try{e=_(C(t.config.projectRoot,n),"utf-8")}catch{return null}let i=v(t,n,e),o=N(t,"doc-path-tokens",n,i);if(o!==null)try{return JSON.parse(o)}catch{}let r=[...new Set([...e.matchAll(H)].map(c=>c[0].replace(/^\.?\//,"")))];return E(t,"doc-path-tokens",n,i,JSON.stringify(r)),r}export{F as a,R as b,K as c,dt as d,ht as e};
4
- //# sourceMappingURL=chunk-P3K7LX7M.js.map
@@ -1,2 +0,0 @@
1
- function f(e){let t=[];if(e.filePattern){let r=e.profiles.find(i=>i.file.includes(e.filePattern));if(!r)return[];for(let i of e.profiles){if(i.file===r.file)continue;let l=e.compare(r,i);l&&t.push(l)}}else{let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let i=0;i<e.profiles.length;i+=1){for(let l=i+1;l<e.profiles.length;l+=1){let n=e.compare(e.profiles[i],e.profiles[l]);n&&t.push(n)}if(t.length>r)break}}return t.sort(e.sort??((r,i)=>i.similarity-r.similarity)),t.slice(0,e.limit)}export{f as a};
2
- //# sourceMappingURL=chunk-PVZMPG5I.js.map
@@ -1,3 +0,0 @@
1
- import{l as T}from"./chunk-3LQFMQPY.js";import{f as g}from"./chunk-X3BJUFSN.js";import{d as h}from"./chunk-JM72FNGA.js";import{c as B,g as _,i as V}from"./chunk-C6ROZBJA.js";import{a as k}from"./chunk-64MNV6AB.js";import{a as W,c as $}from"./chunk-7S5E7KWT.js";function p(r,e,t){if(r.has(e))return r.get(e);let n=t();return r.set(e,n),n}import J from"path";function de(r,e){return r.getReferences().map(t=>{let n=t.getNode();return Y(n,e)})}function me(r){let e=r;return typeof e.findReferences=="function"?e.findReferences():[]}function z(r,e,t,n){let i=[];for(let o of me(r))for(let s of de(o,n))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||i.push(s);for(let o of t)i.push(o);return M(i)}function K(r,e,t,n){let i=[],o=t?.getStart();for(let s of r.getReferences()){let a=s.getNode();S(n,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||i.push({location:Y(a,n),node:a}))}return i}function Y(r,e){let t=r.getSourceFile(),n=t.getLineAndColumnAtPos(r.getStart());return{file:S(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function X(r,e,t){let n=r.getSourceFile(),i=y(n,r),o=r.getText(),s=new RegExp(`\\b${ge(o)}\\b`,"g"),a=n.getFullText().split(`
2
- `),c=[];for(let l=0;l<a.length;l++){if(l===i)continue;let u=a[l]??"";s.lastIndex=0;let d;for(;(d=s.exec(u))!==null;)c.push({file:e,line:l,column:d.index})}return M(c.filter(l=>S(t,J.join(t,l.file))===e))}function R(r){for(let e=r;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function y(r,e){return r.getLineAndColumnAtPos(e.getStart()).line-1}function M(r){let e=new Set,t=[];for(let n of r){let i=`${n.file}:${n.line}:${n.column}`;e.has(i)||(e.add(i),t.push(n))}return t}function S(r,e){let t=J.relative(r||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function ge(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(r,e,t,n){let i=ye(e,n);return i.size===0?new Map:he(r,t,i)}function ye(r,e){let t=new Map;for(let n of g(r,e)){let i=h(n.symbol)??n.leaf;if(!i)continue;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(n)}return t}function he(r,e,t){let n=new Map,i=new Map;return e.forEachDescendant(o=>{for(let s of Se(r,o)){let a=t.get(s);if(!a)continue;let c=y(e,o);for(let l of a){if(c<l.startLine-1||c>l.endLine+1)continue;let u=Math.abs(c-l.startLine),d=i.get(l.symbolId);d!==void 0&&d<=u||(i.set(l.symbolId,u),n.set(l.symbolId,o))}}}),n}function Se(r,e){let t=[],n=i=>{i&&!t.includes(i)&&t.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();n(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();n(i)}return r.Node.isIdentifier(e)&&n(e.getText()),t}var xe=$("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function H(r,e,t,n){let i=Z(r,e),o=G(i.get(n)??[],t);if(o)return o;let s=[];for(let a of i.values())for(let c of a)((c.leaf||h(c.symbol)||"").includes(n)||c.symbol.includes(n))&&s.push(c);return G(s,t)}function Q(r,e){let t=new Map;for(let[n,i]of Z(r,e)){let o=i[0];o&&t.set(n,o)}return t}function Z(r,e){return xe.get(r,e,()=>{let t=new Map;for(let n of g(r,e)){let i=n.leaf||h(n.symbol);if(!i)continue;let o=t.get(i);o||(o=[],t.set(i,o)),o.push({...n,leaf:i})}for(let n of t.values())n.sort((i,o)=>i.startLine-o.startLine||i.endLine-o.endLine||i.symbolId-o.symbolId);return t})}function G(r,e){let t=null,n=Number.POSITIVE_INFINITY;for(let i of r){let o=Math.abs(i.startLine-e);(o<n||o===n&&t&&i.startLine<t.startLine)&&(t=i,n=o)}return t}import Ie from"path";var x=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function I(r){let e=r.toLowerCase();return x.some(t=>e.endsWith(t))}function ee(r,e){let t=new Map,n=i=>I(i)?p(t,i,()=>{let o=Ie.join(r.config.projectRoot,i);for(let{project:s}of e){let a=s.getSourceFile(o)??s.addSourceFileAtPathIfExists(o)??null;if(a)return{project:s,sourceFile:a}}return null}):null;return{sourceFile:i=>n(i)?.sourceFile??null,sourceFileMatch:n,indexedTypeScriptLikeDocuments:()=>k(r,{extensions:x})}}import m from"path";import{existsSync as F,readdirSync as be,readFileSync as te}from"fs";function ne(r){let e=m.join(r,"package.json");if(!F(e))return[];let t;try{t=JSON.parse(te(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>De(r,i)).flatMap(i=>Ne(r,i))}function De(r,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=m.join(r,e);return F(m.join(s,"package.json"))?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),i=e.slice(t+1).replace(/^\//,""),o=m.join(r,n||".");if(!F(o))return[];try{return be(o).map(s=>m.join(o,s,i)).filter(s=>F(m.join(s,"package.json")))}catch{return[]}}function Ne(r,e){try{let t=JSON.parse(te(m.join(e,"package.json"),"utf8"));if(!t.name)return[];let n=m.relative(r,e).replace(/\\/g,"/");return[{name:t.name,rootRelative:n,sourceRootRelative:`${n}/src`}]}catch{return[]}}function re(r,e){for(let t of r)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function ie(r){return[`${r.sourceRootRelative}/index.ts`,`${r.sourceRootRelative}/index.tsx`,`${r.sourceRootRelative}/index.mts`,`${r.sourceRootRelative}/index.cts`]}import{existsSync as b,readFileSync as ke,readdirSync as Me,statSync as Fe}from"fs";import f from"path";var E=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function j(r,e){let n=e?f.dirname(f.join(r,e)):r,i=f.resolve(r);for(;n.startsWith(i);){for(let s of E){let a=f.join(n,s);if(b(a))return a}let o=f.dirname(n);if(o===n)break;n=o}for(let o of E){let s=f.join(r,o);if(b(s))return s}return null}function oe(r){let e=r.config.projectRoot,t=new Set(ve(e,r.config.semantic?.typescript?.tsconfigs)),n=k(r,{includeIgnored:!1,extensions:x});for(let i of n){let o=j(e,i);o&&t.add(f.resolve(o))}if(t.size===0){let i=j(e);i&&t.add(f.resolve(i))}return[...t].filter(i=>!se(e,i)).sort((i,o)=>i.localeCompare(o))}function ve(r,e=[]){let t=new Set;for(let n of e){let i=f.isAbsolute(n)?n:f.join(r,n);b(i)&&t.add(f.resolve(i))}for(let n of Pe(r))for(let i of E){let o=f.join(n,i);b(o)&&t.add(f.resolve(o))}if(t.size===0){let n=j(r);n&&t.add(f.resolve(n))}return[...t].filter(n=>!se(r,n)).sort((n,i)=>n.localeCompare(i))}function Pe(r){let e=f.join(r,"package.json");if(!b(e))return[];let t;try{t=JSON.parse(ke(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>Te(r,i))}function Te(r,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=f.join(r,e);return C(s)?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),i=e.slice(t+1).replace(/^\//,""),o=f.join(r,n||".");return C(o)?Me(o).map(s=>f.join(o,s,i)).filter(C):[]}function C(r){try{return Fe(r).isDirectory()}catch{return!1}}function se(r,e){let t=f.relative(r,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as Re}from"module";var Ce=Re(import.meta.url),D;function ae(){if(D!==void 0)return D;try{D=Ce("ts-morph")}catch{D=null}return D}function ce(r,e){return e.map(t=>({tsconfigPath:t,project:new r.Project({tsConfigFilePath:t,skipFileDependencyResolution:!1})}))}function v(r,e,t){return{language:"typescript",availability:()=>({available:!1,reason:r,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}function pe(r,e){let t=ae();if(!t)return v("ts-morph is not installed");let n=oe(r);if(n.length===0)return v("no tsconfig found");try{let i=ce(t,n);return new w(r,t,i)}catch(i){return v(i instanceof Error?i.message:String(i),n[0],n)}}var w=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=ne(e.config.projectRoot),this.sourceFiles=ee(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return p(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=[];for(let i of t.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,i))n.push(o);return n})}referencesFor(e){return p(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e),n=this.packageImportReferencesForDefinition(e);return t?z(t,e,n,this.db.config.projectRoot):n})}calleesFor(e){return p(this.calleesCache,e.symbolId,()=>p(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return p(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let i=n.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return fe(c)}),o=n.getReturnType().getText(t);return`(${i.join(",")})=>${fe(o)}`})}importUsageForDeclaration(e,t){let n=T(this.db,e,t.getModuleSpecifierValue()),i=le(t);return t.getImportClause()?.isTypeOnly()?i.map(o=>Ee(e,n,o)):i.map(o=>this.valueImportUsageForEntry(e,n,o))}valueImportUsageForEntry(e,t,n){let i=n.identifier?n.identifier.findReferences():[],o=[];for(let l of i)for(let u of K(l,e,n.identifier,this.db.config.projectRoot))o.push(u);let s=o.some(l=>!R(l.node)),a=o.some(l=>R(l.node)),c=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:c,isUsed:c||o.length>0,isTypeUsed:c||a,isValueUsed:s,references:o.map(l=>l.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,i]of e)e.set(n,M(i));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let i=this.sourceFiles.sourceFileMatch(n);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,i){let o=re(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of le(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=X(a.identifier,n,this.db.config.projectRoot);l.length>0&&Le(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let i of ie(t))this.collectPackageExports(t,i,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,i){if(i.has(t))return;i.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?T(this.db,t,a):t;if(!c||!c.startsWith(`${e.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,n,i);continue}for(let u of l){let d=u.getNameNode().getText(),O=u.getAliasNode()?.getText()??d,U=this.indexedDefinitionByLeaf(c,d);if(!U)continue;let N=n.get(O);N||(N=new Set,n.set(O,N)),N.add(U.symbolId)}}}indexedDefinitionByLeaf(e,t){return p(this.indexedDefinitionLeafCache,e,()=>Q(this.db,e)).get(t)??null}nodeForDefinition(e){return p(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return p(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?q(this.tsMorph,this.db,t,e):new Map})}definitionFromSymbol(e){let t=e.getDeclarations();for(let n of t){let i=n.getSourceFile(),o=S(this.db.config.projectRoot,i.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=y(i,n),a=H(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let t=this.sourceFiles.sourceFile(e);if(!t)return new Map;let n=g(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(n.length===0)return new Map;let i=new Map;t.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(t,n,o);s&&je(i,s.callerId,s.target)});for(let[o,s]of i)i.set(o,Ae(s));return i}semanticCalleeForCallNode(e,t,n){let i=we(t,y(e,n));if(!i)return null;let o=n.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:i.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function le(r){let e=[],t=r.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});let n=r.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});for(let i of r.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(r.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Ee(r,e,t){return{importer:r,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function je(r,e,t){let n=r.get(e);n||(n=[],r.set(e,n)),n.push(t)}function we(r,e){let t=null;for(let n of r)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function Le(r,e,t){for(let n of e){let i=r.get(n)??[];i.push(...t),r.set(n,i)}}function Ae(r){let e=new Set,t=[];for(let n of r){let i=`${n.symbol}|${n.file}|${n.line}`;e.has(i)||(e.add(i),t.push(n))}return t}function fe(r){return r.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var L=new WeakMap;W({name:"semantic-provider",groups:["semantic-provider"],clearAll:r=>L.delete(r)});function A(r,e){let t=`${r.config.projectRoot}:typescript-workspace`,n=L.get(r);n||(n=new Map,L.set(r,n));let i=n.get(t);if(i)return i;let o=pe(r,e);return n.set(t,o),o}function Tt(r,e){let t=P(r,e);return t?t.importUsage(e):[]}function ue(r,e){let t=P(r,e.relativePath);return t?t.referencesFor(e):[]}function Rt(r,e){let t=new Map,n=B(r),i=[];for(let o of e){let s=Oe(r,o,n,i);for(let a of s){if(a.file===o.relativePath||r.isIgnored(a.file))continue;let c=t.get(o.symbolId);c||(c=new Set,t.set(o.symbolId,c)),c.add(a.file)}}return i.length>0&&A(r).availability().available&&V(r,i),t}function Oe(r,e,t,n){if(!t||!I(e.relativePath))return ue(r,e);let i=_(r,e.relativePath,e.symbol,t);if(i!==null){let s=Ue(i);if(s)return s}let o=ue(r,e);return n.push({relativePath:e.relativePath,symbol:e.symbol,projectFingerprint:t,payload:JSON.stringify(o)}),o}function Ue(r){try{return JSON.parse(r)}catch{return null}}function Ct(r,e){let t=new Map;for(let n of e){let i=P(r,n.relativePath);if(!i)continue;let o=i.calleesFor(n);o.length>0&&t.set(n.symbolId,o)}return t}function Et(r,e){let t=P(r,e.relativePath);return t?t.signatureFor(e):null}function P(r,e){if(!I(e))return null;let t=A(r,e);return t.availability().available?t:null}export{I as a,A as b,Tt as c,ue as d,Rt as e,Ct as f,Et as g};
3
- //# sourceMappingURL=chunk-RSKOYTSY.js.map
@@ -1,4 +0,0 @@
1
- import{a as ne,b as oe,c as P,d as ie,e as ae,f as pe,g as j,h as ce,i as F,j as me,k as le,l as _,m as U,n as T,o as H,p as V,q as S,r as Q,s as ue,t as J,v as C,w as h,x as M,y as G}from"./chunk-3LQFMQPY.js";import{b as ge}from"./chunk-YZA6PPZL.js";import{a as de,b as fe,d as R}from"./chunk-BTCASU5J.js";import{a as v}from"./chunk-DS6QEB3G.js";import{b as te,d as re,e as se}from"./chunk-C6ROZBJA.js";import{c as L}from"./chunk-7S5E7KWT.js";import{basename as Se}from"path";var je=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function y(t){let r=[],e=0,s=0;for(let n=0;n<t.length;n++){let o=t[n];(o==="{"||o==="["||o==="(")&&e++,(o==="}"||o==="]"||o===")")&&e--,o===","&&e===0&&(r.push(t.slice(s,n)),s=n+1)}return r.push(t.slice(s)),r}function x(t,r){for(let e of t.namedChildren)if(e.type===r)return e;return null}function g(t,r){let e=new Set,s=(n,o)=>{let i=o||r.has(n.type);!i&&je.has(n.type)&&e.add(n.text);for(let a of n.children)s(a,i)};return s(t.rootNode,!1),e}function b(t,r,e,s,n,o,i){return{importedName:n,localName:o,sourcePath:i??S(t,s,le(r)),kind:"named",used:h(e,o),usedMembers:[]}}function f(t,r,e,s,n="named",o={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s.has(r),usedMembers:[],isTypeOnly:o.isTypeOnly}}function $(t,r,e,s,n="named",o=[],i={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s,usedMembers:o,isTypeOnly:i.isTypeOnly}}function O(t,r){return{importedName:t,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function D(t,r,e={}){return{importedName:t,localName:e.localName??null,sourcePath:r,kind:"namespace",used:e.used??!0,usedMembers:e.usedMembers??[],isTypeOnly:e.isTypeOnly}}function N(t,r,e){let s=[];for(let n of t.matchAll(r)){let o=n[0];if(!o||typeof n.index!="number")continue;let i=C(t,n.index,n.index+o.length);for(let a of e(n,i))s.push(a)}return s}function I(t,r,e,s){let n=R(t,r);if(n){let o=e(n);if(o)return o}return s()}function X(t,r,e,s){let n=R(t,r),o=de(r),i=o?e[o]:void 0;return n&&i?i(n):s()}function he(t,r,e){return I(t,r,s=>Me(t,r,s),()=>ve(t,r,e))}function ve(t,r,e){return N(e,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(s,n)=>{let o=s[1]?.trim();if(!o)return[];let i=Se(o).replace(/\.[^.]+$/,"");return[$(o,i,V(t,r,o),h(n,i))]})}function Me(t,r,e){let s=g(e,new Set(["preproc_include"])),n=[];for(let o of e.rootNode.descendantsOfType("preproc_include")){let i=null;for(let p of o.namedChildren){if(p.type==="system_lib_string"){i=p.text.replace(/^<|>$/g,"");break}if(p.type==="string_literal"){i=p.namedChildren.find(c=>c.type==="string_content")?.text??p.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=Se(i).replace(/\.[^.]+$/,"");n.push(f(i,a,V(t,r,i),s))}return n}function ye(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=n[1]?.trim(),i=n[2]?.trim()??null,a=n[0];if(!o||!a||typeof n.index!="number")continue;let p=C(e,n.index,n.index+a.length);s.push({importedName:o,localName:i,sourcePath:Q(t,r,o),kind:i?"namespace":"side-effect",used:i?h(p,i):!0,usedMembers:i?M(p,i):[]})}return s}function xe(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=n[1]?.trim();o&&s.push({specifier:o,sourcePath:Q(t,r,o)})}return s}function Ne(t,r,e){return X(t,r,{csharp:s=>qe(t,r,s),vb:s=>$e(t,r,s)},()=>{let s=me(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(e,s,(n,o)=>{let i=n[1]?.trim();if(!i)return[];let[a,p]=i.split(/\s*=\s*/),m=!!p,c=(m?p:a)?.trim()??i,l=c.split(".").pop()??c,u=m?a?.trim()??l:l;return[b(t,r,o,c,l,u,S(t,c,j))]})})}function $e(t,r,e){let s=g(e,new Set(["imports_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(u=>u.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],p=i.length>1?i[0]:null,m=a.text,c=m.split(".").pop()??m,l=p?.text??c;n.push(f(c,l,S(t,m,j),s,p?"namespace":"named"))}return n}function qe(t,r,e){let s=g(e,new Set(["using_directive"])),n=[];for(let o of e.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,p;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],p=i[1]):p=i[i.length-1];let m=p.text,c=m.split(".").pop()??m,l=a?.text??c;n.push(f(c,l,S(t,m,j),s,a?"namespace":"named"))}return n}var Fe=L("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function Ie(t,r){return Fe.get(t,r,()=>{let e=new Set,s=v(t,r);if(!s)return e;let o=s.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))e.add(i[0]);return e})}function Y(t,r,e){return I(t,r,s=>We(t,r,s),()=>Ue(t,r,e))}function Ue(t,r,e){return Ze(e).flatMap(s=>et(t,r,s.clause,s.specifier,s.start,s.end,e))}function We(t,r,e){let s=Je(t,r,e),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))n.push(...Xe(t,r,e,o,s));return n}function Je(t,r,e){let s=g(e,new Set(["import_statement"]));if(fe(r))for(let n of Ie(t,r))s.add(n);return s}function Xe(t,r,e,s,n){let o=Qe(s);if(!o)return[];let i=_(t,r,o),a=x(s,"import_clause");return a?ze(e,a,i,n,Ge(s.text)):[O("*",i)]}function ze(t,r,e,s,n){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(Be(i.text,e,s,n));else if(i.type==="namespace_import"){let a=He(t,i,e,s,n);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Ve(i,e,s,n));return o}function Be(t,r,e,s){return f("default",t,r,e,"default",{isTypeOnly:s})}function He(t,r,e,s,n){let i=x(r,"identifier")?.text??"";if(!i)return null;let a=Ke(t,i);return D("*",e,{localName:i,usedMembers:a,isTypeOnly:n,used:a.length>0||s.has(i)})}function Ve(t,r,e,s){let n=[];for(let o of t.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let p=i.text,m=a?.text??p;n.push(f(p,m,r,e,"named",{isTypeOnly:s||Ye(o.text)}))}return n}function Qe(t){let r=x(t,"string");if(!r)return null;let e=x(r,"string_fragment");return e?e.text:null}function Ge(t){return/^\s*import\s+type\b/.test(t)}function Ye(t){return/^\s*type\b/.test(t.trim())}function Ke(t,r){let e=new Set;for(let s of t.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),o=s.namedChild(1);!n||!o||n.type!=="identifier"||n.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&e.add(o.text)}return[...e]}function Ze(t){let r=[],e=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(e)){let o=n[0],i=n[1],a=n[2];!o||!a||typeof n.index!="number"||r.push({clause:i,specifier:a,start:n.index,end:n.index+o.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(s)){let o=n[0],i=n[1];!o||!i||typeof n.index!="number"||r.push({clause:null,specifier:i,start:n.index,end:n.index+o.length})}return r.sort((n,o)=>n.start-o.start)}function et(t,r,e,s,n,o,i){let a=_(t,r,s),p=C(i,n,o);return e?tt(e).map(c=>({...c,sourcePath:a})).map(c=>{if(c.kind==="namespace"){let l=M(p,c.localName);return D(c.importedName,c.sourcePath,{localName:c.localName,usedMembers:l,used:l.length>0||h(p,c.localName),isTypeOnly:c.isTypeOnly})}return c.kind==="side-effect"?O(c.importedName,c.sourcePath):$(c.importedName,c.localName??"",c.sourcePath,c.localName?h(p,c.localName):!1,c.kind,[],{isTypeOnly:c.isTypeOnly})}):[O("*",a)]}function tt(t){let r=t.trim(),e=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,o]=rt(s),i=[];return n&&i.push(...Pe(n,e)),o&&i.push(...Pe(o,e)),i}function Pe(t,r){let e=t.trim();if(!e)return[];if(e.startsWith("{")){let s=e.slice(1,-1).trim();return s?y(s).map(n=>{let o=n.trim(),i=r||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[p,m]=a.split(/\s+as\s+/);return{importedName:p.trim(),localName:(m??p).trim(),kind:"named",isTypeOnly:i}}):[]}return e.startsWith("* as ")?[{importedName:"*",localName:e.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:e,kind:"default",isTypeOnly:r}]}function rt(t){let r=0;for(let e=0;e<t.length;e++){let s=t[e];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[t.slice(0,e).trim(),t.slice(e+1).trim()]}return[t.trim(),null]}function K(t,r,e){let s=R(t,r);return s?pt(t,r,s):st(t,r,e)}function st(t,r,e){return[...nt(t,r,e),...ot(t,r,e),...it(t,r,e)]}function nt(t,r,e){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",p=y(i).map(l=>at(l.trim())).filter(l=>!!l),m=q(e,o.index),c=q(e,o.index+o[0].length-1);s.push({kind:"named",sourcePath:_(t,r,a),names:p,startLine:m,endLine:c})}return s}function ot(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[2]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star-as",sourcePath:_(t,r,i),names:[],startLine:a,endLine:p})}return s}function it(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star",sourcePath:_(t,r,i),names:[],startLine:a,endLine:p})}return s}function at(t){if(!t)return null;let r=t.replace(/^type\s+/,"").trim();if(!r)return null;let e=r.match(/^(\w+)\s+as\s+(\w+)$/);if(e)return e[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function q(t,r){let e=0;for(let s=0;s<r&&s<t.length;s++)t.charCodeAt(s)===10&&e++;return e}function pt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("export_statement")){let o=ct(t,r,n);if(o===void 0)continue;let i=n.startPosition.row,a=n.endPosition.row,p=mt(n,o,i,a);s.push(p)}return s}function ct(t,r,e){let s=x(e,"string");if(!s)return;let n=x(s,"string_fragment");if(n)return _(t,r,n.text)}function mt(t,r,e,s){let n=x(t,"export_clause");if(n){let i=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let p=a.namedChild(0),m=a.namedChild(1);p&&i.push((m??p).text)}return{kind:"named",sourcePath:r,names:i,startLine:e,endLine:s}}return x(t,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:e,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:e,endLine:s}}function be(t,r,e){return X(t,r,{java:s=>lt(t,r,s),kotlin:s=>ut(t,r,s),scala:s=>dt(t,r,s)},()=>N(e,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(s,n)=>{let o=s[1]?.trim();return o?ft(t,r,o,n):[]}))}function lt(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(l=>l.type==="asterisk"),p=o.namedChildren.find(l=>l.type==="scoped_identifier")??o.namedChildren.find(l=>l.type==="identifier");if(!p)continue;let m=p.text;if(i){n.push(D("*",S(t,m,P)));continue}let c=m.split(".").pop()??m;n.push(f(c,c,S(t,m,P),s))}return n}function ut(t,r,e){let s=g(e,new Set(["import_header","import_list"])),n=[];for(let o of e.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"),p=o.namedChildren.find(d=>d.type==="import_alias");if(a){n.push(D("*",S(t,i.text,P)));continue}let m=i.text,c=m.split(".").pop()??m,u=p?.namedChild(0)?.text??c;n.push(f(c,u,S(t,m,P),s))}return n}function dt(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(l=>l.type==="namespace_selectors"||l.type==="namespace_wildcard"),a=o.namedChildren.filter(l=>l!==i&&(l.type==="identifier"||l.type==="stable_identifier")),p=a.map(l=>l.text).join(".");if(!p)continue;if(i?.type==="namespace_wildcard"){n.push(D("*",S(t,p,P)));continue}if(i?.type==="namespace_selectors"){for(let l of i.namedChildren)if(l.type==="arrow_renamed_identifier"){let[u,d]=l.namedChildren;if(!u)continue;let E=u.text,A=d?.text??E;if(E==="_")continue;n.push(f(E,A,S(t,`${p}.${E}`,P),s))}else if(l.type==="identifier"){let u=l.text;n.push(f(u,u,S(t,`${p}.${u}`,P),s))}continue}let m=a[a.length-1]?.text??p,c=a.slice(0,-1).map(l=>l.text).join(".")||p;n.push(f(m,m,S(t,c&&a.length>1?`${c}.${m}`:p,P),s))}return n}function ft(t,r,e,s){if(e.includes("{")&&e.includes("}")){let n=e.slice(0,e.indexOf("{")).replace(/\.$/,"").trim(),o=e.slice(e.indexOf("{")+1,e.lastIndexOf("}")).trim();return y(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),c=p?.trim();if(!c||c==="_")return[];let l=(m??c.split(".").pop()??c).trim(),u=c==="_"?n:`${n}.${c}`.replace(/\.\./g,".");return[b(t,r,s,u,c,l)]})}return[b(t,r,s,e,e.split(".").pop()??e,e.split(".").pop()??e)]}function _e(t,r,e){return I(t,r,s=>gt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?y(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.split(/\s+as\s+/i),c=p?.trim()??a,l=c.split("\\").pop()??c,u=(m??l).trim();return[b(t,r,n,c,l,u,S(t,c.replace(/\\/g,"."),F))]}):[]}))}function gt(t,r,e){let s=g(e,new Set(["namespace_use_declaration"])),n=[],o=(i,a,p)=>{n.push(f(a,p,S(t,i.replace(/\\/g,"."),F),s))};for(let i of e.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(p=>p.type==="namespace_use_group");if(a){let p=i.namedChildren.find(m=>m.type==="namespace_name")?.text??"";for(let m of a.namedChildren){if(m.type!=="namespace_use_clause")continue;let{importedName:c,localName:l,qualified:u}=Ee(m,p);c&&o(u,c,l)}continue}for(let p of i.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:m,localName:c,qualified:l}=Ee(p,"");m&&o(l,m,c)}}return n}function Ee(t,r){let e=t.namedChildren.find(m=>m.type==="qualified_name"),s=t.namedChildren.filter(m=>m.type==="name"),n="";e?n=e.text:s.length>=1&&(n=s[0].text);let o=e&&s.length>0?s[s.length-1]:null,i=n.split("\\").pop()??n,a=o?.text??i,p=r?`${r}\\${n}`:n;return{importedName:i,localName:a,qualified:p}}function Ce(t,r,e){return I(t,r,s=>St(t,r,s),()=>yt(e).flatMap(s=>Nt(t,r,s,e)))}function St(t,r,e){let s=g(e,new Set(["import_statement","import_from_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=Te(i);if(!a)continue;let p=U(t,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:p,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let o of e.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=ht(i);if(a===null)continue;let p=U(t,r,a);for(let m=1;m<o.namedChildCount;m+=1){let c=o.namedChild(m);if(c.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:p,kind:"side-effect",used:!0,usedMembers:[]});continue}let l=Te(c);l&&n.push({importedName:l.qualifiedName,localName:l.localName,sourcePath:p,kind:"named",used:s.has(l.localName),usedMembers:[]})}}return n}function Te(t){if(t.type==="aliased_import"){let r=t.namedChild(0),e=t.namedChild(1);return!r||!e?null:{qualifiedName:r.text,localName:e.text}}if(t.type==="dotted_name"){let r=t.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return t.type==="identifier"?{qualifiedName:t.text,localName:t.text}:null}function ht(t){if(t.type==="dotted_name")return t.text;if(t.type==="relative_import"){let r=x(t,"import_prefix")?.text??"",e=x(t,"dotted_name")?.text??"";return`${r}${e}`}return null}function yt(t){let r=t.split(`
2
- `),e=[],s=0;for(let n=0;n<r.length;n++){let o=r[n],i=o.trimStart(),a=s;if(s+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let p=o,m=a+o.length,c=G(o);for(;n+1<r.length&&(c>0||p.trimEnd().endsWith("\\"));){n++;let u=r[n];p+=`
3
- ${u}`,m+=1+u.length,c+=G(u),s+=u.length+1}let l=xt(p);l&&e.push({...l,start:a,end:m})}return e}function xt(t){let r=t.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let e=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!e)return null;let s=e[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:e[1],clause:s}}function Nt(t,r,e,s){let n=C(s,e.start,e.end),o=e.clause.replace(/\n/g," ").trim();if(e.kind==="import")return y(o).flatMap(p=>{let m=p.trim().replace(/,$/,"");if(!m)return[];let[c,l]=m.split(/\s+as\s+/),u=c.trim(),d=(l??u.split(".")[0]??u).trim(),E=U(t,r,u),A=M(n,d);return[{importedName:u,localName:d,sourcePath:E,kind:"namespace",used:h(n,d)||A.length>0,usedMembers:A}]});let i=e.module?U(t,r,e.module):null,a=[];for(let p of y(o)){let m=p.trim().replace(/,$/,"");if(!m)continue;if(m==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[c,l]=m.split(/\s+as\s+/),u=(l??c).trim();a.push({importedName:c.trim(),localName:u,sourcePath:i,kind:"named",used:h(n,u),usedMembers:[]})}return a}import{basename as It}from"path";function Re(t,r,e){return I(t,r,s=>bt(t,r,s),()=>Pt(t,r,e))}function Pt(t,r,e){return N(e,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(s,n)=>{let o=s[1],i=s[2];if(!o||!i)return[];let a=o==="require_relative"?H(t,r,i):null;if(a){let p=Oe(i);return[$(p,p,a,h(n,p))]}return[O(i,a)]})}function bt(t,r,e){let s=g(e,new Set([])),n=[],o=new Set(["require","require_relative","load"]);for(let i of e.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let m=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!m||m.type!=="string")continue;let l=m.namedChildren.find(d=>d.type==="string_content")?.text;if(!l)continue;let u=a.text==="require_relative"?H(t,r,l):null;if(u){let d=Oe(l);n.push(f(d,d,u,s))}else n.push(O(l,u))}return n}function Oe(t){return ge(It(t).replace(/\.[^.]+$/,""),/_/)}function De(t,r,e){return I(t,r,s=>Et(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?_t(t,r,o,n):[]}))}function Et(t,r,e){let s=g(e,new Set(["use_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of W(i,"")){if(!a.importedName||a.importedName==="*")continue;let p=T(t,r,a.qualifiedName)??T(t,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push(f(a.importedName,a.localName,p,s))}}return n}function W(t,r){switch(t.type){case"identifier":case"super":case"self":case"crate":{let e=t.text;return[{qualifiedName:z(r,e),importedName:e,localName:e}]}case"scoped_identifier":{let e=t.text,s=e.split("::").pop()??e;return[{qualifiedName:z(r,e),importedName:s,localName:s}]}case"scoped_use_list":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=z(r,e.text),o=[];for(let i of s.namedChildren)o.push(...W(i,n));return o}case"use_list":{let e=[];for(let s of t.namedChildren)e.push(...W(s,r));return e}case"use_as_clause":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=W(e,r),o=s.text;return n.map(i=>({...i,localName:o}))}case"use_wildcard":{let e=t.namedChild(0),s=e?e.text:"";return[{qualifiedName:z(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function z(t,r){return t?r?`${t}::${r}`:t:r}function _t(t,r,e,s){let n=e.trim();if(n.includes("{")&&n.includes("}")){let c=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),l=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return y(l).flatMap(u=>{let d=u.trim();if(!d||d==="self")return[];let[E,A]=d.split(/\s+as\s+/),w=E?.trim();if(!w)return[];let we=(A??w.split("::").pop()??w).trim(),Le=`${c}::${w}`.replace(/::::/g,"::");return[b(t,r,s,Le,w.split("::").pop()??w,we,T(t,r,c))]})}let[o,i]=n.split(/\s+as\s+/),a=o?.trim()??n,p=(i??a.split("::").pop()??a).trim(),m=T(t,r,a)??T(t,r,a.split("::").slice(0,-1).join("::"));return[b(t,r,s,a,a.split("::").pop()??a,p,m)]}function ke(t,r,e){let s=R(t,r);if(s)return Tt(t,r,s);let n=[];for(let o of e.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&n.push(...Rt(t,r,i))}return n}function Tt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("use_declaration")){if(!Ct(n))continue;let o=n.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of W(o,""))i.importedName&&s.push(Z(t,r,i.qualifiedName))}return s}function Ct(t){for(let r of t.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function Rt(t,r,e){let s=e.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),o=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return y(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[p]=a.split(/\s+as\s+/),m=`${n}::${p?.trim()??a}`.replace(/::::/g,"::");return[Z(t,r,m)]})}return[Z(t,r,s)]}function Z(t,r,e){return{specifier:e,sourcePath:T(t,r,e)??T(t,r,e.split("::").slice(0,-1).join("::"))}}function k({language:t,extensions:r,imports:e,parseImports:s}){return{language:t,extensions:r,capabilities:{imports:e},parseImports:s}}function Ae(t,r){let e=r.toLowerCase();for(let s of t)for(let n of s.extensions)if(e.endsWith(n))return s;return null}var Ot={language:"javascript",extensions:ne,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:Y,parseReExports:K},Dt=k({language:"python",extensions:oe,imports:"ast-with-regex-fallback",parseImports:Ce}),kt=k({language:"jvm",extensions:P,imports:"ast-dispatch-with-regex-fallback",parseImports:be}),At={language:"rust",extensions:ie,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:De,parseExports:ke},wt=k({language:"ruby",extensions:ae,imports:"ast-with-regex-fallback",parseImports:Re}),Lt=k({language:"c/cpp",extensions:pe,imports:"ast-with-regex-fallback",parseImports:he}),jt=k({language:"dotnet",extensions:j,imports:"ast-dispatch-with-regex-fallback",parseImports:Ne}),vt={language:"dart",extensions:ce,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:ye,parseExports:xe},Mt=k({language:"php",extensions:F,imports:"ast-with-regex-fallback",parseImports:_e}),$t=[Ot,Dt,kt,At,wt,Lt,jt,vt,Mt];function B(t){return Ae($t,t)}var ee={clearGroups:["whole-project","source-file"]},qt=L("source-imports",ee),Ft=L("source-exports",ee),Ut=L("source-reexports",ee);function ns(t,r){let e=J(r);return Ut.get(t,e,()=>{let s=B(e);if(!s?.parseReExports)return[];let n=v(t,e);return n?s.parseReExports(t,e,n):[]})}function os(t,r){let e=J(r);return qt.get(t,e,()=>{let s=B(e);if(!s)return[];let n=v(t,e);if(!n)return[];let o=te(t,e,n),i=ue(t),a=re(t,"source-imports",e,o);if(a!==null)try{let m=JSON.parse(a);if(m.resolutionFingerprint===i&&Array.isArray(m.imports))return m.imports}catch{}let p=s.parseImports(t,e,n);return se(t,"source-imports",e,o,JSON.stringify({resolutionFingerprint:i,imports:p})),p})}function is(t,r){let e=J(r);return Ft.get(t,e,()=>{let s=B(e);if(!s?.parseExports)return[];let n=v(t,e);return n?s.parseExports(t,e,n):[]})}export{ns as a,os as b,is as c};
4
- //# sourceMappingURL=chunk-RY7CAOJF.js.map
@@ -1,2 +0,0 @@
1
- import{a as b}from"./chunk-PFOCOG57.js";import{a as g}from"./chunk-XPOZO76D.js";import{a as d}from"./chunk-AETMKBZR.js";import{c as p}from"./chunk-JM72FNGA.js";import{a as c}from"./chunk-6TDOT7B3.js";import{a as o}from"./chunk-BTCASU5J.js";function T(t,r={}){let{scope:l,limit:s=30,scanLimit:f}=r,u=r.files===void 0?null:new Set(r.files),L=new g(t);return b({candidates:()=>L.productionCallableDefinitions({scope:l,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}).filter(e=>h(e.relativePath)&&(u===null||u.has(e.relativePath))),scanLimit:f,evaluate:e=>{let n=c(t,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(a=>!a.simple)||n.paramsEndLine>=n.endLine)return null;let y=d(t,e.relativePath),m=[];for(let a=n.params.length-1;a>=0;a--){let i=n.params[a];if(i.name===""||i.name.startsWith("_")||P(y.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function h(t){let r=o(t);return r==="typescript"||r==="tsx"||r==="javascript"}function P(t,r,l){return t?t.some(s=>s>r&&s<=l):!1}export{T as a};
2
- //# sourceMappingURL=chunk-S7YOLFLX.js.map
@@ -1,8 +0,0 @@
1
- import{f as D,i as H}from"./chunk-4TMJDHC6.js";import{d as L}from"./chunk-YWOOQ4FF.js";import{b as w,d as _,h as T,i as E}from"./chunk-QDGKE5HN.js";import{a as N}from"./chunk-XPOZO76D.js";import{c as b,d as F}from"./chunk-JM72FNGA.js";var q=5;function te(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??_(e,{base:a}),l={available:s.note!==w,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new N(e),k=new Set(s.changedFiles),A=new Map(s.renamedFiles.map(i=>[i.to,i.from])),$=t.baseContentAt??T(e.config.projectRoot,a,E(s)),h=U(x,k,A,$);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let M=D(e,{minCallees:Math.min(3,r),scanLimit:g,semantic:f}),z=x.calleeMap(R,{semantic:f}),j=R.map(i=>({def:i,callees:H((z.get(i.symbolId)??[]).map(p=>p.symbol))}));for(let{def:i,callees:p}of j){let u=b(i.symbol);if(p.size<r){l.skipped.push({helperShortName:u,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=K(p,M);if(P===0){l.skipped.push({helperShortName:u,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let C=W(e,i.symbolId);if(C.length===0){l.skipped.push({helperShortName:u,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=B({candidateIndex:M,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:C});I.length!==0&&(I.sort((d,S)=>O(S.migrationScope)-O(d.migrationScope)||S.containment-d.containment||S.siteCoverage-d.siteCoverage||d.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:u,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:P,migratedFiles:C.sort(),leftovers:I.slice(0,q)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function B(e){let t=[],a=V(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=L(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=G(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:b(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(b).sort()})}return t}function O(e){return e==="same-scope"?2:e==="unknown"?1:0}function V(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function G(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var J=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!J.has(t))}function K(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function U(e,t,a,o){return e.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${X(r.leaf)}\\b`).test(c)})}function W(e,t){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")}`,t).map(o=>o.relative_path)}function X(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{te as a};
8
- //# sourceMappingURL=chunk-SOGKYB5I.js.map
@@ -1,18 +0,0 @@
1
- import{a as m}from"./chunk-XPOZO76D.js";import{b as h}from"./chunk-ANIOISCE.js";import{c as b}from"./chunk-RSKOYTSY.js";import{b as g}from"./chunk-RY7CAOJF.js";import{a as S}from"./chunk-64MNV6AB.js";import d from"path";function u(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length<=1?"(root)":t.length>=3&&["src","lib","app","server","client"].includes(t[0])?`${t[0]}/${t[1]}`:t[0]}function y(e,n){if(e===n)return"ok";let t=p(e),i=p(n);return t&&i?R(t,i)?"ok":"violation":k(e,n)}function D(e,n){let t=p(u(e)),i=p(u(n));return!!t&&!!i}function p(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function R(e,n){return n==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","semantic","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(n)??!1}function k(e,n){if(n==="shared")return"ok";let t={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return t[e]?t[e].has(n)?"ok":"violation":null}function X(e,n){let{scope:t,minDeviation:i=5}=n??{},r=n?.semantic!==!1,c=new m(e).fileDependencyGraph(t),a=O(e,t);return _([...x(e,c,a,{semantic:r}),...$(c),...I(c,i)])}function x(e,n,t,i){let r=[];for(let[s,c]of n){if(l(s))continue;let a=t.get(s)??new Set;for(let o of c)if(!l(o)&&!a.has(o)){if(i.semantic&&A(e,s,o)||j(e,s,o)||B(e,s,o)||L(o)||q(e,s,o)||V(o))continue;r.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${s} to ${o}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."})}}return r}function $(e){let n=[],t=F(e);for(let[i,r]of e){if(l(i))continue;let s=u(i);for(let c of r){if(l(c))continue;let a=u(c);if(s===a)continue;let o=y(s,a),f=o?"explicit":"inferred";if((o??t.get(`${s}->${a}`))==="violation"){let w=f==="explicit"?"direct":"signal";n.push({file:i,kind:"layer-violation",description:`Imports from ${a}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${a}/`,actionTier:w,policyBasis:f,evidenceReasons:[`dependency edge exists from ${i} to ${c}`,f==="explicit"?`explicit layer policy rejects ${s}/ -> ${a}/`:`rare cross-layer edge ${s}/ -> ${a}/ is inferred as a violation`],recommendation:f==="explicit"?"Move the dependency behind an allowed layer boundary or document a policy change.":"Review whether this is a real boundary break or an intentional exception before moving code."})}}}return n}function I(e,n){let t=[];for(let[i,r]of M(e)){let s=r.filter(a=>!l(a));if(s.length<n)continue;let c=P(e,s);for(let a of s)for(let o of e.get(a)??[])l(o)||(c.get(o)??0)===1&&d.dirname(o)!==i&&d.dirname(o)!==d.dirname(i)&&(D(a,o)||t.push({file:a,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${o}`,dep:o,actionTier:"signal",evidenceReasons:[`${s.length} sibling file(s) in ${i}/ were compared`,`${a} is the only non-skipped sibling depending on ${o}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."}))}return t}function _(e){return{results:e,unusedImports:e.filter(n=>n.kind==="unused-import").length,layerViolations:e.filter(n=>n.kind==="layer-violation").length,patternDeviations:e.filter(n=>n.kind==="pattern-deviation").length}}function M(e){let n=new Map;for(let t of e.keys()){let i=d.dirname(t),r=n.get(i);r||(r=[],n.set(i,r)),r.push(t)}return n}function P(e,n){let t=new Map;for(let i of n)for(let r of e.get(i)??[])l(r)||t.set(r,(t.get(r)??0)+1);return t}function O(e,n){let t=new Map;return E(e,t,n),T(e,t),t}function E(e,n,t){for(let i of N(e,t))v(e,n,i.from_file,i.to_file)}function N(e,n){let t=n?`AND d1.relative_path LIKE '%${n}%'`:"";return e.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
- ${e.pathExclusionsFor("d1","d2")}
17
- ${t}`)}function T(e,n){new m(e).scanSourceReferences({paths:S(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},i=>{i.target.relativePath!==i.sourceFile&&(e.isIgnored(i.target.relativePath)||v(e,n,i.sourceFile,i.target.relativePath))})}function v(e,n,t,i){if(e.isIgnored(t)||e.isIgnored(i))return;let r=n.get(t);r||(r=new Set,n.set(t,r)),r.add(i)}function F(e){let n=new Map;for(let[i,r]of e){if(l(i))continue;let s=u(i);for(let c of r){if(l(c))continue;let a=u(c);if(s===a||y(s,a))continue;let o=`${s}->${a}`;n.set(o,(n.get(o)??0)+1)}}let t=new Map;for(let[i,r]of n)t.set(i,r<=2?"violation":"ok");return t}function L(e){return e.includes("types")||e.endsWith(".d.ts")}function A(e,n,t){let i=b(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.some(r=>r.isUsed)}function j(e,n,t){let i=g(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.some(r=>r.used)}function B(e,n,t){let i=g(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.every(r=>r.isTypeOnly===!0)}function V(e){return e.endsWith(".vue")}function q(e,n,t){let i=g(e,n).filter(r=>r.sourcePath===t);return i.length===0?!1:i.every(r=>r.kind==="side-effect"||r.kind==="namespace"&&r.usedMembers.length===0&&!r.used)}function l(e){let n=h(e);return!!(n==="entry"||n==="barrel"||n==="test"||n==="worker"||J(d.basename(e)))}function J(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{X as a};
18
- //# sourceMappingURL=chunk-VAXDTQHE.js.map
@@ -1,62 +0,0 @@
1
- import{a as _,b as m,c as h,d as D,e as f,g as S}from"./chunk-JM72FNGA.js";import{c as L}from"./chunk-6TDOT7B3.js";import{a as x}from"./chunk-DS6QEB3G.js";import{a as y}from"./chunk-64MNV6AB.js";import{c as g}from"./chunk-7S5E7KWT.js";function K(e,n){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 ${n.where}
6
- ${e.pathExclusionsFor("d")}
7
- ${R(n.orderBy)}
8
- ${M(n.limit)}`,...n.params??[])}function V(e,n){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 ${n.where}
23
- ${e.pathExclusionsFor("d")}
24
- GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
25
- ${R(n.orderBy)}
26
- ${M(n.limit)}`,...n.params??[])}function R(e){return e?`ORDER BY ${e}`:""}function M(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 w(e){if(!e)return null;let n=I(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let r=e.slice(t+1);return(I(r)??r).replace(/\n/g," ")}function I(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function F(e){if(m(e.symbol)!==null)return!1;let t=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(t)}function E(e,n,t={}){let r=new Map;for(let o of n)e.length>0&&!F(o)||r.set(o.id,o);for(let o of e)r.set(o.id,o);let i=[...r.values()];return t.sort?i.sort((o,s)=>o.start_line-s.start_line||o.end_line-s.end_line||o.symbol.localeCompare(s.symbol)):i}var v=g("file-definitions",{clearGroups:["definition-catalog"]}),O=new WeakMap;function p(e,n){return v.get(e,n,()=>{let t=E(k(e,n),$(e,n),{sort:!0});return P(e,n,t.map(A))})}function k(e,n){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`,n)}function $(e,n){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`,n)}function A(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:D(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:S(e.symbol),isTypeLike:f(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function ce(e,n={}){return Q(e,n.scope)}function Q(e,n){return y(e,{scope:n,includeIgnored:!1}).flatMap(t=>p(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function de(e,n,t={}){if(n.length===0)return[];let r=n.flatMap(i=>p(e,i)).filter(i=>!e.isIgnored(i.relativePath));return t.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),t.sort&&(r=r.sort((i,o)=>i.relativePath.localeCompare(o.relativePath)||i.startLine-o.startLine||i.endLine-o.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:h(i.symbol),signature:N(w(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function T(e){let n=new Map,t=e.map((r,i)=>({definition:r,index:i,span:r.endLine-r.startLine})).sort((r,i)=>r.span-i.span||r.index-i.index);for(let{definition:r}of t)for(let i=r.startLine;i<=r.endLine;i+=1)n.has(i)||n.set(i,r);return n}function me(e,n){let t=O.get(e);return t||(t=T(e),O.set(e,t)),t.get(n)??null}function ue(e,n){let t=p(e,n.relative_path).find(r=>r.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function P(e,n,t){let r=x(e,n),i=L(e,n);return i?j(t,i,r):r?B(t,r):t}function B(e,n){let t=n.split(/\r?\n/),r=J(e,t),i=H(e,r),o=W(i,t);return Y(e,o)}function J(e,n){let t=e.some(i=>b(i.symbol))?Z(n):null,r=new Map;for(let i of e)r.set(i.symbolId,G(n,t,i));return r}function H(e,n){return e.filter(t=>b(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,r)=>t.startLine-r.startLine||t.definition.startLine-r.definition.startLine||t.definition.symbol.localeCompare(r.definition.symbol))}function W(e,n){let t=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],o=e[r+1],s=o?Math.max(i.startLine,o.startLine-1):n.length-1;t.set(i.definition.symbolId,{startLine:i.startLine,endLine:U(n,i.definition,i.startLine,s)})}return t}function Y(e,n){return e.map(t=>{let r=n.get(t.symbolId);return r?{...t,startLine:r.startLine,endLine:r.endLine}:t})}function j(e,n,t=null){let r=new Map;for(let i of n){let o=r.get(i.name);o?o.push(i):r.set(i.name,[i])}return e.map(i=>{if(!z(i)||!i.leaf)return C(i,t);let o=r.get(i.leaf);if(!o||o.length===0)return C(i,t);let s=o[0],a=Math.abs(s.startLine-i.startLine);for(let c=1;c<o.length;c+=1){let l=o[c],d=Math.abs(l.startLine-i.startLine);d<a&&(s=l,a=d)}return{...i,startLine:s.startLine,endLine:s.endLine}})}function z(e){return b(e.symbol)?!0:f(e.symbol)==="term"&&m(e.symbol)===null}function C(e,n){if(!n||!e.leaf||f(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),o=n.split(/\r?\n/).findIndex(s=>r.test(s));return o>=0?{...e,startLine:o,endLine:o}:e}function G(e,n,t){if(!b(t.symbol))return t.startLine;let r=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return r;let i=n.get(t.leaf);if(!i||i.length===0)return r;let o=null;for(let s of i){let a=Math.abs(s-t.startLine);(!o||a<o.distance)&&(o={line:s,distance:a})}return o?.line??r}function Z(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,o=new Map,s=(a,c)=>{let l=o.get(a);if(!l){o.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(n))d[1]&&s(d[1],a);for(let d of c.matchAll(t))d[1]&&s(d[1],a);let l=c.match(r);l?.[1]&&s(l[1],a);for(let d of c.matchAll(i))d[1]&&s(d[1],a)}return o}function U(e,n,t,r){let i=Math.max(t,Math.min(e.length-1,r)),o=Math.max(t,Math.min(i,n.endLine)),s=0,a=0,c=!1;for(let l=t;l<=i;l+=1){let d=X(e[l]??"");for(let u of d)u==="{"?(s+=1,c=!0):u==="}"?s=Math.max(0,s-1):u==="("?a+=1:u===")"&&(a=Math.max(0,a-1));if(c&&s===0||!c&&a===0&&l>=o)return l}return o}function X(e){let n="",t=null,r=!1;for(let i=0;i<e.length;i+=1){let o=e[i],s=e[i+1];if(!t&&o==="/"&&s==="/"){n+=" ".repeat(e.length-i);break}if(t){if(r){r=!1,n+=" ";continue}if(o==="\\"){r=!0,n+=" ";continue}o===t&&(t=null),n+=" ";continue}if(o==='"'||o==="'"||o==="`"){t=o,n+=" ";continue}n+=o}return n}function b(e){return e.includes("().")}function fe(e){let n=_(e);if("kind"in n)return[];let t=[];for(let r=n.descriptors.length-2;r>=0;r-=1){let i=n.descriptors[r];i?.suffix==="type"&&i.name&&t.push(i.name)}return t}export{K as a,V as b,N as c,w as d,E as e,p as f,ce as g,Q as h,de as i,T as j,me as k,ue as l,fe as m};
62
- //# sourceMappingURL=chunk-X3BJUFSN.js.map
@@ -1,2 +0,0 @@
1
- import{b as g,f as E,g as q}from"./chunk-ANIOISCE.js";import{a as R}from"./chunk-BGBBVSH4.js";import{b as H,c as W,d as Y}from"./chunk-YNSVAJR6.js";import{c as O}from"./chunk-ZMU6IWDK.js";import{a as j,j as B,k as V,m as F,n as G}from"./chunk-AETMKBZR.js";import{a as k}from"./chunk-2YI45TNM.js";import{f as K,h}from"./chunk-X3BJUFSN.js";import{f as N,g as P,i as A,j as w}from"./chunk-JM72FNGA.js";import{a as M,f as S}from"./chunk-6TDOT7B3.js";import{a as y,b as L}from"./chunk-BTCASU5J.js";import{a as v,d as p}from"./chunk-DS6QEB3G.js";import{c as T}from"./chunk-A536TEU4.js";import{a as C}from"./chunk-64MNV6AB.js";function _(n,e,r){let a=e.identifierResolution==="strict"?F:G,o=e.candidateNames?B(e.candidateNames):null;for(let t of e.paths)if(!(!y(t)&&!(e.includeVueSfc&&L(t)))&&!n.isIgnored(t)&&!e.skipPath?.(t))try{if(o&&!V(v(n,t),o))continue;let f=(i,l,D,b)=>{if(e.candidateNames&&!e.candidateNames.has(i))return;let I=e.resolveTargets?e.resolveTargets({sourceFile:t,name:i,kind:l,defaultTargets:b}):b();for(let d of I)r({sourceFile:t,name:i,target:d,occurrences:D,kind:l})},m=j(n,t);for(let[i,l]of m)f(i,"identifier",l.length,()=>a(n,t,i));for(let i of S(n,t,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let l=i.kind==="cross-language-dispatch"?()=>F(n,t,i.name):()=>a(n,t,i.name);f(i.name,i.kind,i.occurrences,l)}}finally{e.afterPath?.(t)}}function z(n,e={}){let{scope:r,minLoc:a=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:t,excludeEntrySurfaces:u=!1,excludeTypesFiles:f=!1,excludeRootedSymbols:m=!1,requireFunctionLikeSymbol:i=!1,requireCallableSymbol:l=!1,excludeRustTraitImplMembers:D=!1,includeSuppressed:b=!1,sortByLocDesc:I=!1}=e,d=[];for(let s of h(n,r)){let c=s.relativePath;if(n.isIgnored(c)||u&&E(n,c)||!Q(s,{requireFunctionLikeSymbol:i,requireCallableSymbol:l})||t!==void 0&&s.symbol===t)continue;let x=R(s);x<a||x>o||f&&U(c)||m&&q(n,s.symbol,c)||D&&A(s.symbol)||g(c)!=="test"&&(w(s.symbol)||!b&&p(n,c,s.startLine)||d.push(s))}return I?d.sort((s,c)=>R(c)-R(s)):d}function Q(n,e){return e.requireCallableSymbol?N(n.symbol):e.requireFunctionLikeSymbol?P(n.symbol):n.isFunctionLike}function U(n){return(n.split("/").pop()??"").includes("types")}var J=class{constructor(e){this.db=e}db;scopedDefinitions(e){return h(this.db,e)}definitionsForFile(e){return K(this.db,e)}productionCallableDefinitions(e={}){return z(this.db,e)}calleeMap(e,r={}){return O(this.db,e,r)}crossFileCallerMap(e,r={}){return H(this.db,e,r)}sourceFallbackCallerFiles(e){return W(this.db,e)}callerFileMap(e,r={}){return Y(this.db,e,r)}frameworkReferencedSymbolIds(e){let r=new Map;for(let o of e){if(!o.leaf)continue;let t=r.get(o.leaf)??[];t.push(o.symbolId),r.set(o.leaf,t)}let a=new Set;for(let o of C(this.db,{includeIgnored:!1}))if(y(o)==="rust")for(let{name:t}of S(this.db,o,{includeRustAttributeNames:!0}))for(let u of r.get(t)??[])a.add(u);return a}symbolsWithNonSelfCallees(e,r={}){if(e.length===0)return new Set;let a=new Map(e.map(t=>[t.symbolId,t.symbol])),o=this.calleeMap(e,r);return new Set([...o.entries()].filter(([t,u])=>{let f=a.get(t);return u.some(m=>m.symbol!==f)}).map(([t])=>t))}fileDependencyGraph(e){return k(this.db,e)}fileKind(e){return g(e)}hasSuppressionComment(e){return p(this.db,e.relativePath,e.startLine)}sourceFiles(){return T(this.db)}scanSourceReferences(e,r){_(this.db,e,r)}callableSignature(e){let r=M(this.db,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);return r?{paramCount:r.paramCount}:null}};export{J as a};
2
- //# sourceMappingURL=chunk-XPOZO76D.js.map
@@ -1,2 +0,0 @@
1
- import{c as s,d as l}from"./chunk-BZ53S4ZN.js";import{a as u}from"./chunk-PVZMPG5I.js";import{a as p,b as m,c as f}from"./chunk-YWOOQ4FF.js";import{e as c}from"./chunk-BTCASU5J.js";function A(i,t={}){let{minSimilarity:r=.62,minTokens:e=8,limit:a=20,scope:d,scanLimit:g,filePattern:h}=t,k=c(i,{scope:d,minJsxTokens:e,scanLimit:g}).filter(n=>n.kind==="component").map(n=>({file:n.file,component:n.name,tokens:n.jsxTokens,profile:n}));return u({profiles:k,limit:a,filePattern:h,compare:(n,o)=>P(n,o,r),sort:(n,o)=>o.similarity-n.similarity||n.fileA.localeCompare(o.fileA)||n.componentA.localeCompare(o.componentA)||n.fileB.localeCompare(o.fileB)||n.componentB.localeCompare(o.componentB)})}function P(i,t,r){let e=p(i.tokens,t.tokens);if(e.size<6||!B(e))return null;let a=f(i.tokens,t.tokens);return a<r?null:{fileA:i.file,componentA:i.component,fileB:t.file,componentB:t.component,similarity:a,sharedTokens:l(e),sharedComponents:s(e,"component:"),sharedNativeTags:s(e,"native:"),sharedProps:s(e,"prop:"),sharedEvents:s(e,"event:"),sharedBindings:s(e,"binding:"),uniqueToA:l(m(i.tokens,t.tokens)).slice(0,25),uniqueToB:l(m(t.tokens,i.tokens)).slice(0,25),locA:i.profile.loc,locB:t.profile.loc}}function B(i){let t=0,r=0;for(let e of i)e.startsWith("component:")&&(t+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("native:")||e.startsWith("jsx:"))&&(r+=1);return t>=1||r>=4}export{A as a};
2
- //# sourceMappingURL=chunk-XWC67C3Q.js.map
@@ -1,2 +0,0 @@
1
- import{b as h}from"./chunk-ZMU6IWDK.js";import{e as y,g as S,h as g,i as M,o as C}from"./chunk-AETMKBZR.js";import{e as R}from"./chunk-RSKOYTSY.js";import{g as b}from"./chunk-X3BJUFSN.js";import{d as m,f as p}from"./chunk-6TDOT7B3.js";import{a as f}from"./chunk-BTCASU5J.js";import{a as u}from"./chunk-64MNV6AB.js";function D(e,n,t={}){let o=new Map;if(n&&n.length===0)return o;let i=u(e,{includeIgnored:!1}),a=M(e),r=n??b(e),l=new Set(r.map(s=>s.symbolId));return k(e,o,i,a,l),I(e,o,r,l),x(e,o,i,a,l),t.semantic!==!1&&_(o,R(e,A(r))),o}function k(e,n,t,o,i){for(let a of t){if(!f(a))continue;let r=m(e,a);if(r)for(let l of r){let s=S(a,o.get(l.calleeLeaf)??[]);if(!s||s.length===0)continue;let c=g(e,a,s,l.memberAccess);c&&i.has(c.symbolId)&&c.file!==a&&d(n,c.symbolId,a)}}}function I(e,n,t,o){let i=v(t);for(let a of L(e,o))e.isIgnored(a.relative_path)||w(a,i.get(a.symbol_id))||d(n,a.symbol_id,a.relative_path)}function L(e,n){return y(e,n?[...n]:void 0)}function v(e){let n=new Map;for(let t of e)n.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return n}function w(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function x(e,n,t,o,i){for(let a of t){if(f(a)!=="rust")continue;let r=p(e,a,{includeRustAttributeNames:!0});if(r.length!==0)for(let{name:l}of r){let s=o.get(l);if(s)for(let c of s)i.has(c.symbolId)&&c.file!==a&&d(n,c.symbolId,a)}}}function d(e,n,t){let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}function A(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function _(e,n){for(let[t,o]of n){let i=e.get(t);i||(i=new Set,e.set(t,i));for(let a of o)i.add(a)}}function O(e,n,t={}){return h(e,n,t)}function F(e,n,t={}){return D(e,n,t)}function j(e,n){return C(e,n)}function Q(e,n,t={}){let o=F(e,n,{semantic:t.semantic});return t.sourceFallback===!1?o:V(o,j(e,n))}function V(e,n){let t=new Map;for(let[o,i]of e)t.set(o,new Set(i));for(let[o,i]of n){let a=t.get(o)??new Set;for(let r of i)a.add(r);t.set(o,a)}return t}export{O as a,F as b,j as c,Q as d,V as e};
2
- //# sourceMappingURL=chunk-YNSVAJR6.js.map
@@ -1,38 +0,0 @@
1
- import{b as j,g as G,h as J,i as B,p as Q}from"./chunk-AETMKBZR.js";import{a as W,b as U,d as K,f as q}from"./chunk-RSKOYTSY.js";import{a as O}from"./chunk-2YI45TNM.js";import{f as P,g as F,j as H,k as $}from"./chunk-X3BJUFSN.js";import{d as T,f as x}from"./chunk-JM72FNGA.js";import{d as E}from"./chunk-6TDOT7B3.js";import{a as N}from"./chunk-BTCASU5J.js";import{a as M}from"./chunk-DS6QEB3G.js";import{a as A,b as I,f as v,h as k}from"./chunk-C6ROZBJA.js";import{c as L,d as D}from"./chunk-7S5E7KWT.js";function Le(e,n,l={}){let o=Y(e,[n],{additive:l.additive,semantic:l.semantic}),s=l.callableOnly?(o.get(n.symbolId)??[]).filter(c=>x(c.symbol)):o.get(n.symbolId)??[];return typeof l.limit=="number"?s.slice(0,l.limit):s}function De(e,n,l={}){let o=ne(e)?oe(e,n,{semantic:l.semantic!==!1}):te(e).get(n.symbolId)??[];return typeof l.limit=="number"?o.slice(0,l.limit):o}var X=D("caller-rows",{clearGroups:["whole-project"]}),ee=2e4;function ne(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>ee}function te(e){return X.get(e,()=>{let n=F(e),l=Y(e,n),o=new Map;for(let i of n)o.set(i.symbol,i.symbolId);let s=new Map,c=new Map;for(let i of n){let a=l.get(i.symbolId);if(!(!a||a.length===0))for(let d of a){let r=o.get(d.symbol);if(r===void 0||r===i.symbolId)continue;let m=s.get(r);m||(m=[],s.set(r,m),c.set(r,new Set));let u=`${i.symbol}|${i.relativePath}`;c.get(r).has(u)||(c.get(r).add(u),m.push({symbol:i.symbol,file:i.relativePath,source:"caller-map-inversion"}))}}return s})}function oe(e,n,l){let o=[],s=new Set,c=a=>{if(a.symbol===n.symbol)return;let d=`${a.symbol}|${a.file}`;s.has(d)||(s.add(d),o.push(a))};for(let a of Q(e,n))a.file!==n.relativePath&&c({symbol:a.enclosingSymbol??a.file,file:a.file,source:"resolved-reference"});let i=l.semantic?ie(e,n):null;if(i)for(let a of K(e,i)){if(a.file===n.relativePath||e.isIgnored(a.file))continue;let d=$(P(e,a.file),a.line);c({symbol:d?.symbol??a.file,file:a.file,source:"semantic-reference"})}return o}function ie(e,n){return e.get(`SELECT
2
- d.id AS documentId,
3
- gs.id AS symbolId,
4
- gs.symbol,
5
- d.relative_path AS relativePath,
6
- COALESCE(der.start_line, c.start_line) AS startLine,
7
- COALESCE(der.end_line, c.end_line) AS endLine,
8
- COALESCE(gs.display_name, '') AS leaf,
9
- NULL AS parentTypeName,
10
- CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
11
- CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
12
- gs.kind AS kind,
13
- gs.documentation AS documentation,
14
- gs.enclosing_symbol AS enclosingSymbol
15
- FROM global_symbols gs
16
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
17
- LEFT JOIN chunks c ON c.document_id = der.document_id
18
- JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
19
- WHERE gs.id = ?
20
- LIMIT 1`,n.symbolId)??null}function Y(e,n,l={}){if(n.length===0)return new Map;let o=l.additive??!1,s=[],c=[];for(let m of n)N(m.relativePath)&&E(e,m.relativePath)!==null?s.push(m):c.push(m);let i=new Map,a=new Map,d=m=>{for(let[u,t]of m){let b=i.get(u);b||(b=[],i.set(u,b));let p=a.get(u);p||(p=new Set,a.set(u,p));for(let g of t){let h=`${g.symbol}|${g.chunkId}`;p.has(h)||(p.add(h),b.push(g))}}};s.length>0&&d(re(e,s)),l.semantic!==!1&&d(fe(le(e,n)));let r=o?n:c;return r.length>0&&d(ue(e,r)),i}function le(e,n){let l=new Map,o=[],s=[];for(let i of n){if(!W(i.relativePath))continue;let a=M(e,i.relativePath);if(!a){s.push(i);continue}let d=I(e,i.relativePath,a),r=ce(e,i.relativePath),m=v(e,i.relativePath,i.symbol,d,r);if(m!==null){let u=se(m);if(u){u.length>0&&l.set(i.symbolId,u);continue}}o.push({def:i,contentHash:d,depsDigest:r})}if(o.length===0&&s.length===0)return l;let c=q(e,[...s,...o.map(i=>i.def)]);for(let[i,a]of c)l.set(i,a);return U(e).availability().available&&k(e,o.map(i=>({relativePath:i.def.relativePath,symbol:i.def.symbol,contentHash:i.contentHash,depsDigest:i.depsDigest,payload:JSON.stringify(c.get(i.def.symbolId)??[])}))),l}function se(e){try{return JSON.parse(e)}catch{return null}}var ae=L("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function ce(e,n){return ae.get(e,n,()=>{let o=[...O(e).get(n)??[]].sort().map(s=>`${s}:${I(e,s,M(e,s))}`);return A(o.join("|"))})}function re(e,n){let l=new Map,o=me(n,l),s=B(e);for(let[c,i]of o){let a=E(e,c);if(!a)continue;let d=H(i);for(let r of a){let m=d.get(r.line);if(!m)continue;let u=de(e,c,s,r.calleeLeaf,r.memberAccess);u&&u.symbol!==m.symbol&&l.get(m.symbolId).push({symbol:u.symbol,file:u.file,chunkId:r.line,source:"ast-callsite"})}}return l}function me(e,n){let l=new Map;for(let o of e){let s=l.get(o.relativePath);s?s.push(o):l.set(o.relativePath,[o]),n.set(o.symbolId,[])}for(let o of l.values())o.sort((s,c)=>s.endLine-s.startLine-(c.endLine-c.startLine));return l}function de(e,n,l,o,s){let c=G(n,l.get(o)??[]);return c.length===0?null:J(e,n,c,s)}function ue(e,n){if(n.length===0)return new Map;let o=R(n.map(t=>t.documentId)).flatMap(t=>e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
21
- FROM mentions m
22
- JOIN chunks c ON m.chunk_id = c.id
23
- WHERE m.role != 1
24
- AND c.document_id IN (${t.map(()=>"?").join(",")})`,...t)),s=new Map;for(let t of o)s.has(t.document_id)||s.set(t.document_id,[]),s.get(t.document_id).push(t);let i=R(o.map(t=>t.symbol_id)).flatMap(t=>e.all(`SELECT gs.id AS symbol_id, gs.symbol,
25
- COALESCE(der.document_id, def_chunk.document_id) AS document_id
26
- FROM global_symbols gs
27
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
28
- LEFT JOIN (
29
- SELECT m.symbol_id, MIN(c.document_id) AS document_id
30
- FROM mentions m
31
- JOIN chunks c ON m.chunk_id = c.id
32
- WHERE m.role = 1
33
- AND m.symbol_id IN (${t.map(()=>"?").join(",")})
34
- GROUP BY m.symbol_id
35
- ) def_chunk ON def_chunk.symbol_id = gs.id
36
- WHERE gs.id IN (${t.map(()=>"?").join(",")})`,...t,...t)),a=R([...n.map(t=>t.documentId),...i.flatMap(t=>t.document_id===null?[]:[t.document_id])]),d=new Map(a.flatMap(t=>e.all(`SELECT id, relative_path FROM documents
37
- WHERE id IN (${t.map(()=>"?").join(",")})`,...t).map(b=>[b.id,b.relative_path]))),r=new Map;for(let t of i)r.has(t.symbol_id)||r.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?d.get(t.document_id)??"":""});let m=new Map,u=d;for(let t of n){let b=s.get(t.documentId)??[],p=new Set,g=[],h=null,Z=()=>{if(h)return h;let f=u.get(t.documentId)??"",y=new Set;if(f){let _=j(e,f),C=Math.max(0,t.startLine),w=Math.min(_.length-1,t.endLine);for(let S=C;S<=w;S+=1)for(let z of _[S])y.add(z)}return h=y,y};for(let f of b){if(f.symbol_id===t.symbolId)continue;let y=r.get(f.symbol_id);if(!y)continue;if(!(f.start_line>=t.startLine&&f.end_line<=t.endLine)){if(!(f.start_line<=t.endLine&&f.end_line>=t.startLine))continue;let S=T(y.symbol);if(!S||!Z().has(S))continue}let C=`${y.symbol}|${f.chunk_id}`;p.has(C)||(p.add(C),g.push({...y,chunkId:f.chunk_id,source:"scip-chunk"}))}m.set(t.symbolId,g)}return m}var V=500;function R(e){let n=[...new Set(e)],l=[];for(let o=0;o<n.length;o+=V)l.push(n.slice(o,o+V));return l}function fe(e){let n=new Map;for(let[l,o]of e){let s=[];for(let c of o)s.push({symbol:c.symbol,file:c.file,chunkId:-1,source:"semantic-callee"});n.set(l,s)}return n}export{Le as a,De as b,Y as c};
38
- //# sourceMappingURL=chunk-ZMU6IWDK.js.map