scip-query 0.7.2 → 0.8.0

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 (173) hide show
  1. package/README.md +179 -221
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-OPWOX7NT.js → chunk-2EC4JTHC.js} +2 -2
  4. package/dist/{chunk-SVSLAUSJ.js → chunk-46ILZVMX.js} +2 -2
  5. package/dist/chunk-4A4JFNWG.js +2 -0
  6. package/dist/{chunk-QBXTQODK.js → chunk-4B7YLRXX.js} +2 -2
  7. package/dist/chunk-64UY7VTR.js +63 -0
  8. package/dist/chunk-66ORT3LS.js +2 -0
  9. package/dist/{chunk-VMS5YTBS.js → chunk-6G76D2YM.js} +2 -2
  10. package/dist/{chunk-PEU24CSY.js → chunk-6P5W4U6G.js} +2 -2
  11. package/dist/chunk-6ZFKI5EP.js +40 -0
  12. package/dist/{chunk-EVXQF7DM.js → chunk-7I6KNKE3.js} +2 -2
  13. package/dist/{chunk-EIGCLVKK.js → chunk-7TYJD45F.js} +2 -2
  14. package/dist/chunk-7UZWNW4E.js +2 -0
  15. package/dist/{chunk-GIRI7FHW.js → chunk-AGW2MVIO.js} +2 -2
  16. package/dist/chunk-APLCSDXL.js +4 -0
  17. package/dist/{chunk-JDFWJ7VK.js → chunk-BCFED24F.js} +2 -2
  18. package/dist/chunk-CVRXOP6M.js +3 -0
  19. package/dist/{chunk-2QNKEJ7R.js → chunk-D43L5PQF.js} +2 -2
  20. package/dist/chunk-DJTJ3DLZ.js +7 -0
  21. package/dist/chunk-EAU4RDFG.js +2 -0
  22. package/dist/{chunk-BI4F6GXI.js → chunk-EKP7XJ6L.js} +2 -2
  23. package/dist/{chunk-LLL7THVV.js → chunk-EM2PPDN7.js} +2 -2
  24. package/dist/{chunk-6QC7SCKV.js → chunk-FIPE5AQT.js} +2 -2
  25. package/dist/chunk-FTBT4RP2.js +7 -0
  26. package/dist/{chunk-TB2OYNRS.js → chunk-GD7XRHSV.js} +2 -2
  27. package/dist/{chunk-XDXZP3BE.js → chunk-GMEBYEMU.js} +2 -2
  28. package/dist/chunk-GTZAU7OL.js +2 -0
  29. package/dist/chunk-HVGNOUYP.js +2 -0
  30. package/dist/chunk-HVXIXDLV.js +2 -0
  31. package/dist/{chunk-5TB4N27G.js → chunk-I7OTKWNY.js} +2 -2
  32. package/dist/{chunk-RFCR2BRD.js → chunk-JAMU6FLN.js} +2 -2
  33. package/dist/chunk-JTCEWV7Q.js +2 -0
  34. package/dist/chunk-K4Z3FCUJ.js +6 -0
  35. package/dist/{chunk-WJQFABZN.js → chunk-K6YIGVL7.js} +2 -2
  36. package/dist/chunk-MKE7SEEX.js +2 -0
  37. package/dist/chunk-N5D5ZCBW.js +7 -0
  38. package/dist/{chunk-ROZNBWIF.js → chunk-NGLRXEWN.js} +2 -2
  39. package/dist/{chunk-IFGEPTH5.js → chunk-NK7TQQG4.js} +2 -2
  40. package/dist/chunk-NOVKLH2F.js +2 -0
  41. package/dist/chunk-OIMM7KMI.js +2 -0
  42. package/dist/chunk-OQSV6OS2.js +2 -0
  43. package/dist/chunk-PBGTMPJ7.js +2 -0
  44. package/dist/{chunk-YH6TTQEI.js → chunk-PCMVXWDC.js} +4 -4
  45. package/dist/{chunk-U75WH4XG.js → chunk-PE4EJOLN.js} +2 -2
  46. package/dist/chunk-PLFYFZX3.js +2 -0
  47. package/dist/{chunk-HTVLH3NL.js → chunk-QYQXPPDI.js} +2 -2
  48. package/dist/{chunk-P7UMQ7R7.js → chunk-RCRK4E7E.js} +2 -2
  49. package/dist/chunk-RIXOMSOR.js +20 -0
  50. package/dist/chunk-SB6I6O3P.js +2 -0
  51. package/dist/{chunk-X2JB54QF.js → chunk-SDGCKEB7.js} +2 -2
  52. package/dist/chunk-SLOIQKY7.js +2 -0
  53. package/dist/{chunk-4VYIZV3S.js → chunk-SOGLYIJ4.js} +4 -4
  54. package/dist/chunk-SSINY7HL.js +4 -0
  55. package/dist/{chunk-FU5WRWAN.js → chunk-TFO4OMJZ.js} +2 -2
  56. package/dist/chunk-TH4JVC34.js +71 -0
  57. package/dist/chunk-TQTVM27C.js +6 -0
  58. package/dist/{chunk-QP6FLI6D.js → chunk-TR5AU6A5.js} +2 -2
  59. package/dist/{chunk-4LKJMRT5.js → chunk-UQE3DSXY.js} +2 -2
  60. package/dist/{chunk-LXJTDFOV.js → chunk-UUDYI3FF.js} +2 -2
  61. package/dist/chunk-VDZL45XI.js +2 -0
  62. package/dist/{chunk-XANDY7N5.js → chunk-VN6B6HFB.js} +2 -2
  63. package/dist/{chunk-SDPP5KVQ.js → chunk-WC43FMAB.js} +2 -2
  64. package/dist/chunk-WEJYUS5O.js +2 -0
  65. package/dist/chunk-WQFOZIID.js +4 -0
  66. package/dist/chunk-XBFLIGWU.js +3 -0
  67. package/dist/{chunk-TGNL3ZKZ.js → chunk-XSZ5NC4O.js} +2 -2
  68. package/dist/{chunk-4T35WUCX.js → chunk-Z2AJQ7VA.js} +2 -2
  69. package/dist/{chunk-S5VMVNFM.js → chunk-ZIIQ55VK.js} +2 -2
  70. package/dist/chunk-ZJ737ZMD.js +2 -0
  71. package/dist/cli.js +171 -173
  72. package/dist/health-C6r2VgpA.d.ts +234 -0
  73. package/dist/index.d.ts +11 -18
  74. package/dist/index.js +1 -1
  75. package/dist/postinstall.js +4 -4
  76. package/dist/queries/affected.js +1 -1
  77. package/dist/queries/bottlenecks.js +1 -1
  78. package/dist/queries/by-kind.js +1 -1
  79. package/dist/queries/call-graph.js +1 -1
  80. package/dist/queries/change-surface.js +1 -1
  81. package/dist/queries/cleanup-plan.d.ts +66 -0
  82. package/dist/queries/cleanup-plan.js +2 -0
  83. package/dist/queries/co-change.d.ts +42 -0
  84. package/dist/queries/co-change.js +2 -0
  85. package/dist/queries/code.js +1 -1
  86. package/dist/queries/complexity-hotspots.js +1 -1
  87. package/dist/queries/complexity.js +1 -1
  88. package/dist/queries/convergence.js +1 -1
  89. package/dist/queries/coupling.js +1 -1
  90. package/dist/queries/cycles.js +1 -1
  91. package/dist/queries/dataflow.js +1 -1
  92. package/dist/queries/dead.js +1 -1
  93. package/dist/queries/deep-chains.js +1 -1
  94. package/dist/queries/deps.js +1 -1
  95. package/dist/queries/diff-gate.d.ts +52 -0
  96. package/dist/queries/diff-gate.js +2 -0
  97. package/dist/queries/diff-impact.js +1 -1
  98. package/dist/queries/doc-drift.d.ts +69 -0
  99. package/dist/queries/doc-drift.js +2 -0
  100. package/dist/queries/drift.js +1 -1
  101. package/dist/queries/extract-candidates.js +1 -1
  102. package/dist/queries/fan.js +1 -1
  103. package/dist/queries/health.d.ts +1 -1
  104. package/dist/queries/health.js +1 -1
  105. package/dist/queries/hierarchy.js +1 -1
  106. package/dist/queries/hotspots.js +1 -1
  107. package/dist/queries/imports.js +1 -1
  108. package/dist/queries/index.d.ts +38 -2
  109. package/dist/queries/index.js +1 -1
  110. package/dist/queries/isolated.js +1 -1
  111. package/dist/queries/members.js +1 -1
  112. package/dist/queries/methods.js +1 -1
  113. package/dist/queries/outline.d.ts +1 -0
  114. package/dist/queries/outline.js +1 -1
  115. package/dist/queries/passthrough-candidates.js +1 -1
  116. package/dist/queries/plan-context.d.ts +65 -0
  117. package/dist/queries/plan-context.js +2 -0
  118. package/dist/queries/recent-duplicates.d.ts +48 -0
  119. package/dist/queries/recent-duplicates.js +2 -0
  120. package/dist/queries/redundant-reexports.js +1 -1
  121. package/dist/queries/refs.js +1 -1
  122. package/dist/queries/self-audit.d.ts +58 -0
  123. package/dist/queries/self-audit.js +2 -0
  124. package/dist/queries/similar-chains.js +1 -1
  125. package/dist/queries/similar-files.d.ts +6 -0
  126. package/dist/queries/similar-files.js +1 -1
  127. package/dist/queries/similar-signatures.js +1 -1
  128. package/dist/queries/similar.js +1 -1
  129. package/dist/queries/slice.js +1 -1
  130. package/dist/queries/stale-abstractions.js +1 -1
  131. package/dist/queries/surface.js +1 -1
  132. package/dist/queries/symbols.js +1 -1
  133. package/dist/queries/system.js +1 -1
  134. package/dist/queries/trace.js +1 -1
  135. package/dist/queries/unused-params.d.ts +38 -0
  136. package/dist/queries/unused-params.js +2 -0
  137. package/dist/queries/wrapper-candidates.js +1 -1
  138. package/dist/reindex-worker.js +1 -1
  139. package/dist/reindex.js +1 -1
  140. package/dist/runtime.d.ts +3 -2
  141. package/dist/runtime.js +2 -2
  142. package/package.json +33 -1
  143. package/skills/concrete-plan/SKILL.md +37 -7
  144. package/skills/scip-ai-cleanup/SKILL.md +145 -0
  145. package/skills/scip-debloat/SKILL.md +37 -7
  146. package/skills/scip-explore/SKILL.md +22 -9
  147. package/skills/scip-language-playbook/SKILL.md +4 -4
  148. package/skills/scip-maintainability/SKILL.md +264 -0
  149. package/skills/scip-verify/SKILL.md +2 -2
  150. package/dist/chunk-3X43EYFU.js +0 -3
  151. package/dist/chunk-4GPWGSOE.js +0 -40
  152. package/dist/chunk-5RGK4YA5.js +0 -63
  153. package/dist/chunk-5TT47UMX.js +0 -44
  154. package/dist/chunk-6QH2L26C.js +0 -71
  155. package/dist/chunk-6SR4UNWI.js +0 -2
  156. package/dist/chunk-6XEWA6FX.js +0 -2
  157. package/dist/chunk-7WHNTKSD.js +0 -2
  158. package/dist/chunk-BOVNTAKQ.js +0 -3
  159. package/dist/chunk-D62LLANH.js +0 -2
  160. package/dist/chunk-EDXML2HI.js +0 -4
  161. package/dist/chunk-EZQOVY3C.js +0 -2
  162. package/dist/chunk-IODTPF5H.js +0 -20
  163. package/dist/chunk-KJ6CW6EK.js +0 -2
  164. package/dist/chunk-NBUINPSH.js +0 -2
  165. package/dist/chunk-NHDPYW7O.js +0 -2
  166. package/dist/chunk-NKJKI6SE.js +0 -2
  167. package/dist/chunk-OPZQIJZU.js +0 -7
  168. package/dist/chunk-P3PVY6TX.js +0 -2
  169. package/dist/chunk-QE6MGGUY.js +0 -2
  170. package/dist/chunk-QVPYMZUJ.js +0 -6
  171. package/dist/chunk-RCJEFQOK.js +0 -4
  172. package/dist/chunk-UHMJYNTK.js +0 -2
  173. package/dist/health-x7B4Xu_6.d.ts +0 -119
@@ -1,71 +0,0 @@
1
- import we from"better-sqlite3";import{existsSync as It,readFileSync as Dt,writeFileSync as Ft}from"fs";import{dirname as wt,join as Ot,resolve as Oe}from"path";import Q from"better-sqlite3";import{execFileSync as Z}from"child_process";import{existsSync as ee,readdirSync as te,readFileSync as ne}from"fs";import{extname as m,join as I}from"path";import G from"ignore";import{readFileSync as U,existsSync as b}from"fs";import{dirname as h,isAbsolute as V,join as S,relative as K,resolve as B}from"path";function k(e){let t=G(),r=!1,n=J(e);for(let o of n)try{let i=U(o,"utf-8");t.add(i),r=!0}catch{}return r||t.add(z),{isIgnored:o=>x(t,e,o),filter:o=>o.filter(i=>!x(t,e,i))}}function J(e){let t=[],r=S(e,".gitignore");b(r)&&t.push(r);let n=h(e),o=0;for(;n!==h(n)&&o<5;){let i=S(n,".gitignore");if(b(i)&&t.push(i),b(S(n,".git")))break;n=h(n),o++}return t}var z=`
2
- # Dependencies
3
- node_modules/
4
- vendor/
5
- .bundle/
6
-
7
- # Build output
8
- dist/
9
- build/
10
- out/
11
- target/
12
- bin/
13
- obj/
14
-
15
- # Python
16
- __pycache__/
17
- *.pyc
18
- *.pyo
19
- .venv/
20
- venv/
21
- .env/
22
- env/
23
- *.egg-info/
24
-
25
- # Rust
26
- target/
27
-
28
- # Java / Kotlin / Scala
29
- *.class
30
- .gradle/
31
- .mvn/
32
-
33
- # C# / .NET
34
- bin/
35
- obj/
36
- packages/
37
-
38
- # Go
39
- vendor/
40
-
41
- # Dart
42
- .dart_tool/
43
- build/
44
-
45
- # PHP
46
- vendor/
47
-
48
- # IDE / OS
49
- .idea/
50
- .vscode/
51
- *.swp
52
- *.swo
53
- .DS_Store
54
- Thumbs.db
55
-
56
- # Type definitions (often noise in queries)
57
- *.d.ts
58
- `;function x(e,t,r){let n=X(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function X(e,t){if(!t||t===".")return null;if(!V(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=V(t)?t:B(e,t),n=K(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as ze}from"fs";import{extname as qe,join as Ye}from"path";function C(e){let t=new WeakMap,r=n=>{let o=t.get(n);return o||(o=new Map,t.set(n,o)),o};return{get(n,o,i){let s=r(n);if(s.has(o))return s.get(o);let a=i();return s.set(o,a),a},invalidate(n,o){t.get(n)?.delete(o)},invalidateAll(n){t.delete(n)},size(n){return t.get(n)?.size??0}}}var q=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],T=[".vue"],Y=new Set(q.map(e=>e.toLowerCase())),Ze=[...Y].sort().join(","),L=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var et=C("source-files");function ut(e){let t=new Set((e.extensions??T).map(i=>i.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!ee(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=k(e.projectRoot),n=re(e.projectRoot,t).filter(i=>!r.isIgnored(i)),o=new Q(e.dbPath);try{let i=ie(o,n),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
59
- VALUES (?, ?, NULL, ?)`),u=o.transaction(l=>{let p=0;for(let g of l){if(i.has(g))continue;let d=ne(I(e.projectRoot,g),"utf-8"),H=s.run(se(g),g,d);p+=Number(H.changes)}return p})(n),c={scanned:n.length,inserted:u,existing:n.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function re(e,t){let r=oe(e,t);if(r)return r;let n=[],o=i=>{let s=i?I(e,i):e,a;try{a=te(s,{withFileTypes:!0})}catch{return}for(let u of a){if(L.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}t.has(m(u.name).toLowerCase())&&n.push(c)}};return o(""),n.sort()}function oe(e,t){try{return Z("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
60
- `).filter(n=>n&&t.has(m(n).toLowerCase())).sort()}catch{return null}}function ie(e,t){let r=new Set,n=500;for(let o=0;o<t.length;o+=n){let i=t.slice(o,o+n),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function se(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as ae}from"child_process";import{createHash as ue}from"crypto";import{readdirSync as ce,readFileSync as le}from"fs";import{join as D}from"path";function ge(e){return(de(e)??fe(e)).filter(t=>t&&!F(t)).sort()}function pt(e){return ge(e).map(t=>{let r=D(e,t);try{let n=le(r);return{path:t,size:n.byteLength,hash:ue("sha256").update(n).digest("hex")}}catch{return{path:t,size:-1,hash:"unreadable"}}})}function de(e){try{return ae("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
61
- `).filter(Boolean)}catch{return null}}function fe(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),o=n?D(e,n):e,i;try{i=ce(o,{withFileTypes:!0})}catch{continue}for(let s of i){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){F(a)||r.push(a);continue}t.push(a)}}return t}function F(e){return e.split("/").some(r=>pe.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var pe=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import{createRequire as me}from"module";import{existsSync as be,readFileSync as v}from"fs";import{dirname as E,extname as he,join as w,relative as Se,resolve as yt}from"path";import{pathToFileURL as ye}from"url";function O(e,t){let{vueCore:r,ts:n,volarTs:o}=ve(e),{parsed:i,vueOptions:s}=Re(r,n,t),a=E(t),u=r.createVueLanguagePlugin(n,i.options,s,d=>d),c=Ve(r,n,u),l=xe(a,i),{languageServiceHost:p}=o.createLanguageServiceHost(n,n.sys,c,d=>d,l),g=n.createLanguageService(p);return{ts:n,language:c,languageService:g,fileNames:i.fileNames,configDir:a}}function ve(e){let t=me(ye(w(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Re(e,t,r){let n=t.readConfigFile(r,t.sys.readFile);if(n.error||!n.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(t,t.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(n.config,t.sys,E(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:i}}function Ve(e,t,r){let n={},o=e.createLanguage([r],new Map,i=>{if(!be(i))return;let s=v(i,"utf-8");n.current?.scripts.set(i,t.ScriptSnapshot.fromString(s),r.getLanguageId(i)??Le(i))});return n.current=o,o}function xe(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function y(e,t,r){try{return e(t)}catch(n){throw(typeof n=="object"&&n!==null&&"code"in n?n.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:n}):n}}function A(e,t,r){let n=ke(e);return o=>{let i=f(t,o.fileName),s=r.get(o.fileName);if(!s)return null;let a=r.positionAt(s,o.textSpan.start),u=n.get(i);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Ce(u.starts,a.line,2)}}function ke(e){let t=e.prepare(`
62
- SELECT
63
- d.relative_path AS relativePath,
64
- der.start_line AS startLine,
65
- der.end_line AS endLine,
66
- der.symbol_id AS symbolId
67
- FROM defn_enclosing_ranges der
68
- JOIN documents d ON d.id = der.document_id
69
- ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
70
- `).all(),r=new Map;for(let n of t){let o=r.get(n.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(n.relativePath,o)),o.starts.push({line:n.startLine,symbolId:n.symbolId});for(let i=n.startLine;i<=n.endLine;i++)o.containingByLine.set(i,n.symbolId)}for(let n of r.values())n.starts.sort((o,i)=>o.line-i.line);return r}function Ce(e,t,r){let n=0,o=e.length-1;for(;n<=o;){let s=Math.floor((n+o)/2);e[s].line<t?n=s+1:o=s-1}let i=null;for(let s of[o,n]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-t);u>r||(!i||u<i.distance)&&(i={distance:u,symbolId:a.symbolId})}return i?.symbolId??null}function N(e,t){let r=De(t),n=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=Fe(n,r,t,i);return o.set(i,s),s}}}function P(e,t,r,n,o){if(e.fileName.endsWith(".vue")){let i=n.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=n.language.maps.get(s,i);if(R(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return t(e)}function*M(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),n;for(;n=t.exec(e);){let o=n[0];r.has(o)||(yield{text:o,start:n.index,end:n.index+o.length})}}function _(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function R(e,t){let r=e;for(let[n]of r.toSourceLocation(t,o=>!!o.navigation))return n;return null}function Te(e,t){let r=0,n=e.lineStarts.length-1;for(;r<=n;){let i=Math.floor((r+n)/2);e.lineStarts[i]<=t?r=i+1:n=i-1}let o=Math.max(0,n);return{line:o,character:t-e.lineStarts[o]}}function j(e,t){return f(e,t).startsWith("node_modules/")}function f(e,t){return Se(e,t).replaceAll("\\","/")}function Le(e){switch(he(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function $(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=v(t,"utf-8"),n={text:r,lineStarts:Ie(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:Te}}function Ie(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function De(e){try{let t=JSON.parse(v(w(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Fe(e,t,r,n){let o=f(r,n),i=Ee(t.name,t.version,o);return e.get(i)?.id??null}function Ee(e,t,r){let n=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function Nt(e){let t=Oe(e.projectRoot,e.tsconfig),r=new we(e.dbPath,{readonly:!0});try{let n=Ae({db:r,projectRoot:e.projectRoot,configPath:t,vueSymbolLookup:N(r,e.projectRoot)});return Ne({vueFiles:e.vueFiles??[],tasks:e.tasks,...n})}finally{r.close()}}function Ae(e){let t=$();return{projectRoot:e.projectRoot,context:O(e.projectRoot,e.configPath),symbolLookup:A(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function Ne(e){let t=[],r=0,n=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of n){let i=Pe(e,o);t.push(...i.occurrences),r+=i.skippedReferences}return{occurrences:t,skippedReferences:r}}function Pe(e,t){let r=e.context.language.scripts.get(t.fileName),n=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!n)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.sourceReader.get(t.fileName);if(!o)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.context.language.maps.get(n,r),s=f(e.projectRoot,t.fileName),a=[...M(o.text)],u={tokens:a.filter(c=>c.start>=t.startOffset&&c.start<t.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:je(a),processedStarts:new Set};return Me({...e,fileName:t.fileName,sourceInfo:o,sourceFile:s,map:i,tokenContext:u})}function Me(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let o=_(e.map,n.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(u=>!j(e.projectRoot,u.fileName));if(!s){r++;continue}let a=P(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}W(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),_e(t,e,n,o,a)}return{occurrences:t,skippedReferences:r}}function _e(e,t,r,n,o){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let i of $e(t.context.languageService,t.fileName,n+1,t.map,r,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(i))continue;let s=t.tokenContext.tokenByStart.get(i);s&&(W(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,o),t.tokenContext.processedStarts.add(i))}}function W(e,t,r,n,o,i){let s=t.positionAt(r,o.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,symbolId:i})}function je(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function $e(e,t,r,n,o,i){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let u of s)if(u.fileName===t)for(let c of u.highlightSpans){let l=We(n,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function We(e,t,r,n){let o=r.get(t);if(o?.text===n)return o.start;let i=R(e,t);if(i===null)return null;let s=r.get(i);return s?.text===n?s.start:null}export{ut as a,pt as b,Nt as c};
71
- //# sourceMappingURL=chunk-6QH2L26C.js.map
@@ -1,2 +0,0 @@
1
- import{b}from"./chunk-SDPP5KVQ.js";import{l as u,v as f}from"./chunk-4VYIZV3S.js";function S(a,p){let L=b(a,p),o=f(a,L,{sort:!0});if(o.length===0)return[];let i=o.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,children:[]})),s=new Map;for(let e of i)s.set(e.symbol,e);let c=[];for(let e=0;e<o.length;e++){let r=o[e],n=i[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of i)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!u(t.symbol,n.symbol))continue;let d=t.endLine-t.startLine;d<m&&(m=d,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
2
- //# sourceMappingURL=chunk-6SR4UNWI.js.map
@@ -1,2 +0,0 @@
1
- import{b as r}from"./chunk-SDPP5KVQ.js";import{v as e}from"./chunk-4VYIZV3S.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
- //# sourceMappingURL=chunk-6XEWA6FX.js.map
@@ -1,2 +0,0 @@
1
- import{a as C}from"./chunk-V76FCF5F.js";import{a as x,b as L}from"./chunk-MX6F756F.js";import{a as h}from"./chunk-NBUINPSH.js";import{c as m,g as c}from"./chunk-4VYIZV3S.js";import{e as g,g as y,j as b}from"./chunk-5TT47UMX.js";function P(o,e,s,n){let r=g(e);if(!r)return!0;let i=b(o,e);if(!i)return!0;let a=S.get(i);return a||(a=N(i,r),S.set(i,a)),a.get(`${s}:${n}`)??!0}var S=new WeakMap;function N(o,e){let s=y(e),n=new Map,r=i=>{s.has(i.type)&&n.set(`${i.startPosition.row}:${i.endPosition.row}`,w(i,e));for(let a of i.children)r(a)};return r(o.rootNode),n}function w(o,e){let s=o.namedChildren.find(t=>t.type==="block"||t.type==="statement_block");if(!s)return!1;let n=s.namedChildren.filter(t=>t.type!=="comment"&&t.type!=="line_comment"&&t.type!=="block_comment");if(n.length!==1)return!1;let r=n[0],i=null;if(r.type==="return_statement"||r.type==="expression_statement"?i=r.namedChild(0)??null:e==="rust"&&(r.type==="call_expression"||r.type==="macro_invocation")&&(i=r),!i)return!1;let a=e==="python"?"call":"call_expression";if(i.type!==a)return!1;let l=i.namedChildren.find(t=>t.type==="arguments"||t.type==="argument_list");if(!l)return!1;let d=l.namedChildren.filter(t=>t.type!=="comment"),p=o.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters");if(!p)return!1;let u=[];for(let t of p.namedChildren)if(t.type==="identifier")u.push(t.text);else{let f=t.namedChildren.find(T=>T.type==="identifier");f&&u.push(f.text)}if(d.length!==u.length)return!1;for(let t=0;t<u.length;t+=1){let f=d[t];if(f.type!=="identifier"||f.text!==u[t])return!1}return!0}function $(o,e){let{scope:s,maxLoc:n=15,limit:r=30,scanLimit:i}=e??{},a=new h(o);return C({candidates:()=>A(a,s,n),orderCandidates:L,scanLimit:i,prepare:l=>a.calleeMap(l,{semantic:e?.semantic!==!1}),evaluate:(l,d)=>_(o,l,d.get(l.symbolId)??[]),orderResults:(l,d)=>l.loc-d.loc||l.file.localeCompare(d.file),limit:r})}function _(o,e,s){let n=D(s);if(n.size!==1||!P(o,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...n.entries()][0];return{symbol:e.symbol,shortName:m(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:x(e),forwardsTo:r.symbol,forwardsToShort:m(r.symbol),forwardsToFile:r.file}}function D(o){let e=o.some(n=>c(n.symbol))?o.filter(n=>c(n.symbol)):o,s=new Map;for(let n of e)s.has(n.symbol)||s.set(n.symbol,n);return s}function A(o,e,s){return o.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:s,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0})}export{$ as a};
2
- //# sourceMappingURL=chunk-7WHNTKSD.js.map
@@ -1,3 +0,0 @@
1
- import{b as v,c as j}from"./chunk-NHDPYW7O.js";import{a as P}from"./chunk-NN3O7TPH.js";function b(t){return t.replace(/'''[\s\S]*?'''/g,f).replace(/"""[\s\S]*?"""/g,f).replace(/#.*$/gm,f).replace(/\/\/.*$/gm,f).replace(/\/\*[\s\S]*?\*\//g,f).replace(/`(?:\\[\s\S]|[^`])*`/g,f).replace(/'(?:\\.|[^'\\\r\n])*'/g,f).replace(/"(?:\\.|[^"\\\r\n])*"/g,f)}function f(t){return t.replace(/[^\r\n]/g," ")}var D=j("stripped-lines");function _t(t,n,e){return D.get(t,n,e,()=>b(e).split(`
2
- `))}function Tt(t){D.invalidateAll(t),_=null,E=""}function Dt(t,n){D.invalidate(t,n),_=null,E=""}var _=null,E="";function Y(t){return _===t||(_=t,E=b(t)),E}function Rt(t,n,e){let r=Y(t);return`${r.slice(0,n)}${" ".repeat(e-n)}${r.slice(e)}`}function $t(t,n){return new RegExp(`\\b${w(n)}\\b`,"m").test(t)}function yt(t,n){let e=new Set,r=new RegExp(`\\b${w(n)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let o of t.matchAll(r)){let s=o[1];s&&e.add(s)}return[...e]}function w(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ct(t){let n=0;for(let e of t)e==="("&&(n+=1),e===")"&&(n-=1);return n}import{existsSync as T}from"fs";import{basename as G,dirname as S,extname as p,join as g,relative as h,resolve as u}from"path";var K=v("indexed-paths"),m=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],X=[".py",".pyi"],k=[".java",".scala",".kt",".kts"],A=[".rs"],L=[".rb"],W=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],H=[".cs",".vb"],U=[".dart"],J=[".php"],Q=new Set(m),R=new Set(X),M=new Set(k),$=new Set(A),y=new Set(L),B=new Set(W),F=new Set(H),C=new Set(U),z=new Set(J),Z=[{extensions:m,lookup:Q},{extensions:X,lookup:R},{extensions:k,lookup:M},{extensions:A,lookup:$},{extensions:L,lookup:y},{extensions:W,lookup:B},{extensions:H,lookup:F},{extensions:U,lookup:C},{extensions:J,lookup:z}];function x(t,n){return n.has(p(t).toLowerCase())}function q(t){return x(t,R)}function tt(t){return x(t,M)}function nt(t){return x(t,$)}function et(t){return x(t,y)}function rt(t){return x(t,B)}function ot(t){return x(t,F)}function wt(t){return p(t).toLowerCase()===".vb"}function st(t){return x(t,C)}function it(t){return x(t,z)}function ct(t){let n=p(t).toLowerCase();for(let e of Z)if(e.lookup.has(n))return e.extensions;return m}function at(t){return tt(t)||ot(t)||it(t)}function Xt(t,n,e){return q(n)?ut(t,n,e):nt(n)?gt(t,n,e):et(n)?pt(t,n,e):rt(n)?ft(t,n,e):at(n)?St(t,e.replace(/\\/g,"."),ct(n)):st(n)?xt(t,n,e):lt(t,n,e)}function lt(t,n,e){if(!e.startsWith(".")&&!e.startsWith("/"))return null;let r=S(g(t.config.projectRoot,n)),o=u(r,e),s=N(t);for(let c of Nt(o)){let a=d(h(t.config.projectRoot,c));if(s.has(a)||T(c))return a}return d(h(t.config.projectRoot,o))}function ut(t,n,e){let r=N(t),o;if(e.startsWith(".")){let s=e.match(/^(\.+)(.*)$/);if(!s)return null;let c=s[1].length,a=s[2].replace(/^\./,""),i=S(g(t.config.projectRoot,n));for(let l=1;l<c;l++)i=S(i);o=a?u(i,a.replace(/\./g,"/")):i}else o=u(t.config.projectRoot,e.replace(/\./g,"/"));for(let s of dt(o)){let c=d(h(t.config.projectRoot,s));if(r.has(c)||T(s))return c}return null}function gt(t,n,e){if(!e)return null;let r=e.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let o=S(g(t.config.projectRoot,n)),s;return r.startsWith("crate::")?s=u(t.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?s=u(o,r.slice(6).replace(/::/g,"/")):s=u(S(o),r.slice(7).replace(/::/g,"/")),O(t,Et(s))}function pt(t,n,e){let r=S(g(t.config.projectRoot,n)),o=u(r,e);return O(t,ht(o))}function ft(t,n,e){let r=S(g(t.config.projectRoot,n)),o=[u(r,e),u(t.config.projectRoot,e),u(t.config.projectRoot,"include",e),u(t.config.projectRoot,"src",e)];return O(t,o)}function St(t,n,e){let r=N(t),o=n.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),s=o.replace(/\./g,"/"),c=o.split(".").pop()??o;for(let i of e){let l=`${s}${i}`,I=[...r].find(V=>V.endsWith(l));if(I)return I}for(let i of e){let l=[...r].find(I=>G(I)===`${c}${i}`);if(l)return l}let a=[...r].filter(i=>e.includes(p(i).toLowerCase())).filter(i=>i.includes(`/${s}/`)||i.includes(`/${c}/`)).sort((i,l)=>i.localeCompare(l));return a.length===1?a[0]:null}function xt(t,n,e){let r=N(t);if(e.startsWith("package:")){let c=e.slice(8),a=c.indexOf("/");if(a<0)return null;let i=c.slice(a+1),l=d(i.startsWith("lib/")?i:`lib/${i}`);return r.has(l)?l:null}let o=S(g(t.config.projectRoot,n)),s=u(o,e);for(let c of mt(s)){let a=d(h(t.config.projectRoot,c));if(r.has(a)||T(c))return a}return null}function dt(t){let n=p(t);return R.has(n)?[t]:[`${t}.py`,`${t}.pyi`,g(t,"__init__.py"),g(t,"__init__.pyi")]}function O(t,n){let e=N(t);for(let r of n){let o=d(h(t.config.projectRoot,r));if(e.has(o)||T(r))return o}return null}function Et(t){let n=p(t);return $.has(n)?[t]:[`${t}.rs`,g(t,"mod.rs")]}function ht(t){let n=p(t);return y.has(n)?[t]:[`${t}.rb`,g(t,"index.rb")]}function mt(t){let n=p(t);return C.has(n)?[t]:[`${t}.dart`,t]}function Nt(t){let n=p(t),e=new Set;if(n){e.add(t);for(let r of m)e.add(t.slice(0,-n.length)+r)}else for(let r of m)e.add(`${t}${r}`),e.add(g(t,`index${r}`));return[...e]}function N(t){return K.get(t,()=>new Set(P(t,{includeIgnored:!1}).map(d)))}function d(t){return t.replace(/\\/g,"/")}export{m as a,X as b,k as c,A as d,L as e,W as f,H as g,U as h,J as i,wt as j,ct as k,Xt as l,ut as m,gt as n,pt as o,ft as p,St as q,xt as r,d as s,b as t,_t as u,Tt as v,Dt as w,Rt as x,$t as y,yt as z,w as A,Ct as B};
3
- //# sourceMappingURL=chunk-BOVNTAKQ.js.map
@@ -1,2 +0,0 @@
1
- import{a as b,c as p}from"./chunk-MX6F756F.js";import{a as g}from"./chunk-NBUINPSH.js";import{c as d}from"./chunk-4VYIZV3S.js";function M(n,l={}){let{scope:e,minLoc:s=10,minCallees:o=6,limit:t=20,scanLimit:i}=l,r=new g(n),c=r.productionCallableDefinitions({scope:e,minLoc:s,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),f=p(c,i),h=r.calleeMap(f,{semantic:l.semantic!==!1}),m=[];for(let a of f){let u=S(a,h.get(a.symbolId)??[],o);u&&m.push(u)}return m.sort((a,u)=>u.clusters.length-a.clusters.length||u.loc-a.loc),m.slice(0,t)}function S(n,l,e){let s=new Set(l.map(r=>r.symbol));if(s.size<e)return null;let o=C(s,l),t=y(s,o);if(t.length<2)return null;let i=x(t,o);return i.length===0?null:{symbol:n.symbol,shortName:d(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:b(n),totalCallees:s.size,clusters:i}}function C(n,l){let e=new Map;for(let o of n)e.set(o,new Set);let s=new Map;for(let o of l){let t=s.get(o.chunkId);t||(t=new Set,s.set(o.chunkId,t)),t.add(o.symbol)}for(let o of s.values()){let t=[...o];for(let i=0;i<t.length;i++)for(let r=i+1;r<t.length;r++)e.get(t[i]).add(t[r]),e.get(t[r]).add(t[i])}return e}function y(n,l){let e=new Set,s=[];for(let o of n){if(e.has(o))continue;let t=new Set,i=[o];for(;i.length>0;){let r=i.pop();if(!e.has(r)){e.add(r),t.add(r);for(let c of l.get(r)??[])e.has(c)||i.push(c)}}s.push(t)}return s}function x(n,l){return n.filter(e=>e.size>=3).map(e=>L(e,n,l)).filter(e=>e.isolation>.5).sort((e,s)=>s.isolation-e.isolation)}function L(n,l,e){let s=new Set;for(let r of l)if(r!==n)for(let c of r)s.add(c);let o=0;for(let r of n)for(let c of e.get(r)??[])s.has(c)&&o++;let t=n.size*s.size,i=t>0?1-o/t:1;return{callees:[...n].map(d),isolation:i}}export{M as a};
2
- //# sourceMappingURL=chunk-D62LLANH.js.map
@@ -1,4 +0,0 @@
1
- import{a as h,b as v,c as P}from"./chunk-3X43EYFU.js";import{a as b,c as L}from"./chunk-MX6F756F.js";import{a as D}from"./chunk-NBUINPSH.js";import{a as I,c as S,d as p}from"./chunk-4VYIZV3S.js";import{a as y,m as x}from"./chunk-5TT47UMX.js";function ie(t,n){let{scope:e,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:c=!1,scanLimit:l}=n??{},d=n?.semantic!==!1,a=new D(t),f=a.scopedDefinitions(e),u=V(a,e),g=L($(t,a,f,{minLoc:i,maxLoc:s}).sort((o,m)=>b(m)-b(o)||o.relativePath.localeCompare(m.relativePath)),l),F=A(a,g,{semantic:d}),k=O(t,a,f,g,{semantic:d}),R=B(g);return N(t,g,F,R).filter(o=>!k.has(o.definition.symbolId)).filter(o=>!o.transitivelyReachable).filter(o=>o.realConsumers.length<=1).filter(o=>!(o.realConsumers.length===0&&o.barrelConsumers>0)).filter(o=>Z(o.definition,o.realConsumers.length,u)).map(o=>j(t,o)).filter(o=>c||o.confidence!=="low").sort((o,m)=>{let C={high:0,medium:1,low:2};return C[o.confidence]-C[m.confidence]||m.loc-o.loc||o.file.localeCompare(m.file)||o.startLine-m.startLine}).slice(0,r)}function $(t,n,e,i){return e.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!H(s.symbol)).filter(s=>!n.hasSuppressionComment(s))}function A(t,n,e){return h(t,n,{semantic:e.semantic})}function B(t){let n=new Map;for(let e of t){let i=n.get(e.relativePath);i||(i=new Map,n.set(e.relativePath,i));let s=p(e.symbol);s&&i.set(s,e)}return n}function N(t,n,e,i){return n.map(s=>{let c=[...e.get(s.symbolId)??new Set].filter(u=>u!==s.relativePath&&!t.isIgnored(u)),{realConsumers:l,barrelConsumers:d,importOnlyConsumers:a}=v(t,s,c),f=_(t,s,e,i);return{definition:s,realConsumers:l,barrelConsumers:d+a,transitivelyReachable:f}})}function j(t,n){let e=w(t,n.definition.relativePath,n.definition.startLine),i=T(n.definition.relativePath)?!0:q(t,n.definition),{confidence:s,reason:r}=G(n.realConsumers.length,e,i);return{symbol:n.definition.symbol,shortName:S(n.definition.symbol),file:n.definition.relativePath,startLine:n.definition.startLine,endLine:n.definition.endLine,loc:b(n.definition),consumers:n.realConsumers.length,barrelConsumers:n.barrelConsumers,kind:e,definerUsesType:i,confidence:s,reason:r}}function O(t,n,e,i,s){let r=W(t,U(e),i),c=r.map(a=>a.singleton);if(r.length===0)return new Set;let l=h(n,c,{semantic:s.semantic}),d=new Set;for(let{singleton:a,classId:f}of r)E(t,a,l)&&d.add(f);return d}function U(t){let n=new Map;for(let e of t){let i=p(e.symbol);i&&n.set(M(e.relativePath,i),e)}return n}function W(t,n,e){let i=[];for(let s of e){let r=z(t,n,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function z(t,n,e){if(w(t,e.relativePath,e.startLine)!=="class")return null;let i=p(e.symbol);if(!i)return null;let s=K(t,e.relativePath,i);return s?n.get(M(e.relativePath,s))??null:null}function E(t,n,e){let i=p(n.symbol),s=e.get(n.symbolId);return!i||!s?!1:[...s].some(r=>r!==n.relativePath&&!t.isIgnored(r)&&!P(t,r,i))}function M(t,n){return`${t}\0${n}`}function K(t,n,e){let i=y(t,n);if(!i)return null;let s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function V(t,n){return new Set(t.scopedDefinitions(n).filter(e=>e.isFunctionLike).map(e=>e.relativePath))}function H(t){let n=I(t);if("kind"in n)return!1;let e=n.descriptors;if(e.length<2)return!1;let i=e[e.length-1],s=e[e.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let e=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(e==="types"||e.endsWith("-types")||e==="models"||e==="schema"||e==="common"||e==="protocol"||e==="proto"||e==="dto"||e==="mod"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t))}function Z(t,n,e){return!(T(t.relativePath)&&n>0||n===0&&e.has(t.relativePath))}function _(t,n,e,i){let s=x(t,n.relativePath),r=p(n.symbol);if(!r)return!1;let c=s.get(r);if(!c||c.size===0)return!1;let l=i.get(n.relativePath);if(!l)return!1;for(let d of c){let a=l.get(d);if(!a)continue;let f=e.get(a.symbolId);if(f){for(let u of f)if(u!==n.relativePath&&!t.isIgnored(u))return!0}}return!1}function w(t,n,e){let i=y(t,n);if(!i)return"other";let s=i.split(`
2
- `),r=Math.max(0,e-2),c=Math.min(s.length-1,e+2);for(let l=r;l<=c;l++){let a=(s[l]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(a))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(a))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(a))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(a))return"enum"}return"other"}function q(t,n){let e=y(t,n.relativePath);if(!e)return!1;let i=p(n.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),c=e.split(`
3
- `);for(let l=0;l<c.length;l++)if(!(l>=n.startLine&&l<=n.endLine)&&r.test(c[l]??""))return!0;return!1}function G(t,n,e){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&n==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!e?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{ie as a};
4
- //# sourceMappingURL=chunk-EDXML2HI.js.map
@@ -1,2 +0,0 @@
1
- import{c as ae}from"./chunk-MX6F756F.js";import{a as C}from"./chunk-NBUINPSH.js";import{d as A,e as j,f as O,g as B,h as H}from"./chunk-NKJKI6SE.js";import{b as N}from"./chunk-IODTPF5H.js";import{a as K,d as te}from"./chunk-P3PVY6TX.js";import{d as re}from"./chunk-YH6TTQEI.js";import{c as Y,d as Q,e as X,f as Z,h as v,l as ee,m as ne}from"./chunk-4GPWGSOE.js";import{a as R}from"./chunk-5RGK4YA5.js";import{b as T,d as w,e as M}from"./chunk-RCJEFQOK.js";import{v as L,w as _}from"./chunk-BOVNTAKQ.js";import{c as U,f as G,g as W,h as $,i as V,j as q,r as z,s as J,y as h}from"./chunk-4VYIZV3S.js";import{b as I,c as F,h as k,i as E}from"./chunk-5TT47UMX.js";import{a as y}from"./chunk-NN3O7TPH.js";function ie(e){let n=new Map,r=t=>{let a=n.get(t);if(a)return a;let s=K(e,t);return a={ranges:s.map(i=>({startLine:i.startLine,endLine:i.endLine})),containers:new Set(s.map(i=>i.containerName).filter(i=>!!i))},n.set(t,a),a};return(t,a,s,i)=>{let l=r(t);for(let c of l.ranges)if(a>=c.startLine&&a<=c.endLine)return!0;if(i&&l.containers.has(i))return!0;for(let c of h(s))if(l.containers.has(c))return!0;return!1}}function oe(e){N(e),re(e),ee(e)}var Re=[{kind:"symbol-evidence",clearDatabase:oe},{kind:"semantic-provider",clearDatabase:R},{kind:"identifier-index",clearDatabase:Y,clearFile:Q},{kind:"language-parser",clearDatabase:w,clearFile:M},{kind:"source-stripper",clearDatabase:L,clearFile:_},{kind:"ast-tree",clearDatabase:k,clearFile:E},{kind:"source-text",clearDatabase:I,clearFile:F},{kind:"definition-catalog",clearFile:z}],se=["symbol-evidence","identifier-index","language-parser","source-stripper","ast-tree","source-text"],ce=["identifier-index","language-parser","source-stripper","ast-tree","source-text"];function le(e,n){let r=new Set(n.kinds);for(let t of Re)r.has(t.kind)&&(n.scope.kind==="database"?t.clearDatabase?.(e):t.clearFile?.(e,Ce(n.scope.relativePath)))}function en(e,n={}){le(e,{scope:{kind:"database"},kinds:n.semanticProvider===!0?[...se,"semantic-provider"]:se})}function D(e,n,r={}){le(e,{scope:{kind:"file",relativePath:n},kinds:r.definitions===!0?[...ce,"definition-catalog"]:ce})}function Ce(e){return e.replace(/\\/g,"/")}function de(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):$(e.symbol)?m("module-like-symbol"):ue(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&ue(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!x(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):V(e.symbol)?m("rust-trait-impl-member"):q(e.symbol)?m("rust-test-module"):!n.includeMembers&&!xe(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function x(e){return[...new Set([...B,...H])].every(r=>!De(e,r))}function m(e){return{accepted:!1,rejectionReason:e}}function De(e,n){return new RegExp(`^${n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/%/g,".*").replace(/_/g,".")}$`).test(e)}function ue(e){return W(e)||e.endsWith("().")||e.endsWith(".")}function xe(e){return G(e.symbol)||h(e.symbol).length===0}function me(){return new Map}function fe(e,n,r){let t=new Map;for(let a of X(e,r))e.isIgnored(a.relative_path)||n.has(a.relative_path)||S(t,a.symbol_id,a.relative_path,a.ref_count,"scip-mention");return t}function pe(e,n,r){let t=new Set;for(let a of Z(e,n))e.isIgnored(a.relative_path)||r.has(a.relative_path)||t.add(a.symbol_id);return t}function P(e,n){let r=e.get(n);if(!r)return!1;for(let t of r.values())if(t.occurrences>0)return!0;return!1}function ge(e){return e?.occurrences??0}function S(e,n,r,t,a="source-fallback"){if(t<=0)return;let s=ye(e,n,r);s.occurrences+=t,s.sources.add(a)}function be(e,n,r,t,a){if(t<=0)return;let s=ye(e,n,r);s.occurrences=Math.max(t,s.occurrences),s.sources.add(a)}function ye(e,n,r){let t=e.get(n);t||(t=new Map,e.set(n,t));let a=t.get(r);return a||(a={occurrences:0,sources:new Set},t.set(r,a)),a}function Dn(e,n={}){let{scope:r,minLoc:t=1,includeTests:a=!1,skipBarrels:s=!1,includeMembers:i=!1,deadCodeOnly:l=!1,scanLimit:c,semantic:d=!0}=n,o=ae(Pe(e,{scope:r,minLoc:t,includeTests:a,includeMembers:i}),c),u=s?new Set(A(e)):new Set,p=l?me():fe(e,u,o.map(f=>f.symbolId)),g=l?pe(e,o.map(f=>f.symbolId),u):new Set,b=l?o.filter(f=>!g.has(f.symbolId)):o;l?ke(e,b,p,u):_e(e,b,p,u);let Se=l?b.filter(f=>!P(p,f.symbolId)):o;Ne(e,Se,p,{includeTests:a,inactiveBarrelPaths:u,includeSemantic:!l&&d});let ve=l?b.filter(f=>!P(p,f.symbolId)):o;return Le(e,Ie(ve,p))}function Pe(e,n){let r=ie(e),t=[];for(let a of y(e,{scope:n.scope}))try{for(let s of J(e,a))de(s,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:l=>e.isIgnored(l),isExcludedRegion:r}).accepted&&t.push(s)}finally{D(e,a,{definitions:!0})}return t}function Ie(e,n){return e.map(r=>Fe(r,n)).filter(r=>r.cross_file_refs===0).sort((r,t)=>t.loc-r.loc||r.relative_path.localeCompare(t.relative_path)||r.start_line-t.start_line)}function Fe(e,n){let r=n.get(e.symbolId)??new Map,t=ge(r.get(e.relativePath)),a=0;for(let[s,i]of r)s!==e.relativePath&&(a+=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:t,cross_file_refs:a}}function Le(e,n){let r=[],t=0,a=0,s=0;for(let i of n){if(e.isIgnored(i.relative_path)||j(e,i.relative_path)||O(e,i.symbol,i.relative_path))continue;let l=i.same_file_refs===0?"dead-code":"file-internal";l==="dead-code"?t++:a++,s+=i.loc,r.push({relativePath:i.relative_path,startLine:i.start_line,endLine:i.end_line,loc:i.loc,symbol:i.symbol,shortName:U(i.symbol),sameFileRefs:i.same_file_refs,kind:l})}return{symbols:r,totalCount:r.length,deadCodeCount:t,fileInternalCount:a,totalLoc:s}}function _e(e,n,r,t){if(n.length===0)return;let a=new C(e),s=new Set(n.map(c=>c.symbolId)),i=new Set(n.map(c=>c.leaf).filter(Boolean)),l=new Set(a.sourceFiles());for(let c of y(e))l.add(c);a.scanSourceReferences({paths:l,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:i,skipPath:c=>t.has(c)},c=>{s.has(c.target.symbolId)&&(we(e,c)||S(r,c.target.symbolId,c.sourceFile,Me(c),"source-fallback"))})}function ke(e,n,r,t){if(n.length===0)return;let a=new C(e),s=Ee(n),i=new Set(a.sourceFiles());for(let o of y(e))i.add(o);let l=new Set(s.keys()),c=new Map,d=o=>{let u=c.get(o);return u||(u=ne(e,o),c.set(o,u)),u};a.scanSourceReferences({paths:i,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:l,skipPath:o=>t.has(o),resolveTargets:({sourceFile:o,name:u,kind:p})=>{let g=s.get(u);return g?Te(o,u,g,d(o),{permissive:p!=="cross-language-dispatch"}):[]},afterPath:o=>{c.delete(o),D(e,o)}},o=>{let u=o.kind==="identifier"&&o.sourceFile===o.target.relativePath?Math.max(0,o.occurrences-1):o.occurrences;o.kind==="identifier"&&he(e,{sourceFile:o.sourceFile,name:o.name,target:o.target,occurrences:u})||S(r,o.target.symbolId,o.sourceFile,u,"source-fallback")})}function Ee(e){let n=new Map;for(let r of e){if(!r.leaf)continue;let t=n.get(r.leaf)??[];t.push(r),n.set(r.leaf,t)}return n}function Te(e,n,r,t,a){let s=r.filter(c=>c.relativePath===e);if(s.length>0)return s;let i=t.get(n);if(i)for(let c of i){let d=r.filter(o=>v(c,o.relativePath));if(d.length>0)return d}let l=new Set;for(let c of t.values())for(let d of c)l.add(d);for(let c of l){let d=r.filter(o=>v(c,o.relativePath));if(d.length>0&&d.length===r.length)return d}return a.permissive?[...r]:[]}function we(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&he(e,n)}function Me(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function he(e,n){return n.occurrences>1?!1:T(e,n.sourceFile).some(r=>r.used||r.sourcePath!==n.target.relativePath?!1:r.importedName===n.name||r.localName===n.name)}function Ne(e,n,r,t){for(let a of n){let s=te(e,a,{semantic:t.includeSemantic!==!1});if(s.length!==0)for(let i of s){let l=i.file;l===a.relativePath||e.isIgnored(l)||t.inactiveBarrelPaths.has(l)||!t.includeTests&&!x(l)||be(r,a.symbolId,l,1,"caller-map")}}}export{en as a,Dn as b};
2
- //# sourceMappingURL=chunk-EZQOVY3C.js.map
@@ -1,20 +0,0 @@
1
- import{b as c}from"./chunk-RCJEFQOK.js";import{a as d}from"./chunk-NHDPYW7O.js";import{a}from"./chunk-NN3O7TPH.js";var g=d("file-dep-graph");function _(e,i){return g.get(e,i??"",()=>{let s=new Map,n=new Set(a(e,{includeIgnored:!1})),r=(t,o)=>m(e,s,n,t,o);for(let t of l(e,i))r(t.from_file,t.to_file);for(let t of n)if(!(i&&!t.includes(i)))for(let o of c(e,t))o.sourcePath&&r(t,o.sourcePath);return s})}function l(e,i){let s=i?`AND d1.relative_path LIKE '%${i}%'`:"";return e.all(`SELECT DISTINCT
2
- d1.relative_path AS from_file,
3
- d2.relative_path AS to_file
4
- FROM mentions m
5
- JOIN chunks c ON m.chunk_id = c.id
6
- JOIN documents d1 ON c.document_id = d1.id
7
- JOIN global_symbols gs ON m.symbol_id = gs.id
8
- JOIN (
9
- SELECT m2.symbol_id, c2.document_id
10
- FROM mentions m2
11
- JOIN chunks c2 ON m2.chunk_id = c2.id
12
- WHERE m2.role = 1
13
- GROUP BY m2.symbol_id
14
- ) sym_def ON sym_def.symbol_id = gs.id
15
- JOIN documents d2 ON sym_def.document_id = d2.id
16
- WHERE d1.id != d2.id
17
- AND m.role != 1
18
- ${e.pathExclusionsFor("d1","d2")}
19
- ${s}`)}function m(e,i,s,n,r){if(n===r||e.isIgnored(n)||e.isIgnored(r)||!s.has(r))return;let t=i.get(n);t||(t=new Set,i.set(n,t)),t.add(r)}function h(e){g.invalidateAll(e)}export{_ as a,h as b};
20
- //# sourceMappingURL=chunk-IODTPF5H.js.map
@@ -1,2 +0,0 @@
1
- import{a as d}from"./chunk-NHDPYW7O.js";import{a as S}from"./chunk-NN3O7TPH.js";import{readdirSync as x}from"fs";import{extname as l,join as f}from"path";var m=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],j=[".vue"],p=new Set(m.map(t=>t.toLowerCase())),g=[...p].sort().join(","),y=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function w(t,o={}){let s=o.includeIndexed??!0,i=o.includeAuxiliary??!0,e=o.extensions?.map(c=>c.toLowerCase()),r=e?new Set(e):p,u=e?[...r].sort().join(","):g,n=`${s?"1":"0"}|${i?"1":"0"}|${u}`;return h.get(t,n,()=>{let c=new Set;if(s)for(let a of S(t,{includeIgnored:!1}))r.has(l(a).toLowerCase())&&c.add(a);if(i)for(let a of E(t.config.projectRoot,r))t.isIgnored(a)||c.add(a);return[...c].sort()})}var h=d("source-files");function E(t,o){let s=new Set,i=e=>{let r=e?f(t,e):t,u;try{u=x(r,{withFileTypes:!0})}catch{return}for(let n of u)if(!y.has(n.name)){if(n.isDirectory()){i(e?`${e}/${n.name}`:n.name);continue}o.has(l(n.name).toLowerCase())&&s.add(e?`${e}/${n.name}`:n.name)}};return i(""),s}export{j as a,y as b,w as c};
2
- //# sourceMappingURL=chunk-KJ6CW6EK.js.map
@@ -1,2 +0,0 @@
1
- import{a as h,e as M}from"./chunk-NKJKI6SE.js";import{a as v}from"./chunk-IODTPF5H.js";import{b as p,c as P,e as _,f as j,g as G}from"./chunk-P3PVY6TX.js";import{c as O}from"./chunk-YH6TTQEI.js";import{a as B,n as R,o as K}from"./chunk-4GPWGSOE.js";import{c as T}from"./chunk-KJ6CW6EK.js";import{f as N,g as k,i as A,j as w,s as E,u as q}from"./chunk-4VYIZV3S.js";import{d as S,e as d,f as L,g as x,j as F}from"./chunk-5TT47UMX.js";import{a as D}from"./chunk-NN3O7TPH.js";var V=new WeakMap;function $(i,e,o,s){let t=d(e);if(!t)return null;let n=F(i,e);if(!n)return null;let a=V.get(n);return a||(a=U(n,t),V.set(n,a)),a.get(`${o}:${s}`)??null}function U(i,e){let o=x(e),s=new Map,t=n=>{if(o.has(n.type)){let a=n.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters"),c=0;if(a)for(let r of a.namedChildren)r.type==="comment"||r.type==="line_comment"||r.type==="block_comment"||(c+=1);s.set(`${n.startPosition.row}:${n.endPosition.row}`,{paramCount:c})}for(let a of n.children)t(a)};return t(i.rootNode),s}function H(i,e,o){let s=e.identifierResolution==="strict"?R:K;for(let t of e.paths){let n=d(t);if(!(!n&&!(e.includeVueSfc&&L(t)))&&!i.isIgnored(t)&&!e.skipPath?.(t))try{let a=(r,f,y,b)=>{if(e.candidateNames&&!e.candidateNames.has(r))return;let g=e.resolveTargets?e.resolveTargets({sourceFile:t,name:r,kind:f,defaultTargets:b}):b();for(let m of g)o({sourceFile:t,name:r,target:m,occurrences:y,kind:f})},c=B(i,t);for(let[r,f]of c)a(r,"identifier",f.length,()=>s(i,t,r));if(e.includeCrossLanguageDispatchNames)for(let r of P(i,t))a(r,"cross-language-dispatch",1,()=>R(i,t,r));if(e.includeRustAttributeNames&&n==="rust")for(let r of p(i,t))a(r,"rust-attribute",1,()=>s(i,t,r))}finally{e.afterPath?.(t)}}}var W=class{constructor(e){this.db=e}db;scopedDefinitions(e){return q(this.db,e)}definitionsForFile(e){return E(this.db,e)}productionCallableDefinitions(e={}){let{scope:o,minLoc:s=1,maxLoc:t=Number.POSITIVE_INFINITY,excludeSymbol:n,excludeEntrySurfaces:a=!1,excludeTypesFiles:c=!1,requireFunctionLikeSymbol:r=!1,requireCallableSymbol:f=!1,excludeRustTraitImplMembers:y=!1,includeSuppressed:b=!1,sortByLocDesc:g=!1}=e,m=[];for(let l of this.scopedDefinitions(o)){let u=l.relativePath;if(this.db.isIgnored(u)||a&&M(this.db,u)||!Y(l,{requireFunctionLikeSymbol:r,requireCallableSymbol:f})||n!==void 0&&l.symbol===n)continue;let C=I(l);C<s||C>t||c&&z(u)||y&&A(l.symbol)||h(u)!=="test"&&(w(l.symbol)||!b&&S(this.db,u,l.startLine)||m.push(l))}return g?m.sort((l,u)=>I(u)-I(l)):m}calleeMap(e,o={}){return O(this.db,e,o)}crossFileCallerMap(e,o={}){return _(this.db,e,o)}sourceFallbackCallerFiles(e){return j(this.db,e)}callerFileMap(e,o={}){return G(this.db,e,o)}frameworkReferencedSymbolIds(e){let o=new Map;for(let t of e){if(!t.leaf)continue;let n=o.get(t.leaf)??[];n.push(t.symbolId),o.set(t.leaf,n)}let s=new Set;for(let t of D(this.db,{includeIgnored:!1}))if(d(t)==="rust")for(let n of p(this.db,t))for(let a of o.get(n)??[])s.add(a);return s}symbolsWithNonSelfCallees(e,o={}){if(e.length===0)return new Set;let s=new Map(e.map(n=>[n.symbolId,n.symbol])),t=this.calleeMap(e,o);return new Set([...t.entries()].filter(([n,a])=>{let c=s.get(n);return a.some(r=>r.symbol!==c)}).map(([n])=>n))}fileDependencyGraph(e){return v(this.db,e)}fileKind(e){return h(e)}hasSuppressionComment(e){return S(this.db,e.relativePath,e.startLine)}sourceFiles(){return T(this.db)}scanSourceReferences(e,o){H(this.db,e,o)}callableSignature(e){return $(this.db,e.relativePath,e.startLine,e.endLine)}};function Y(i,e){return e.requireCallableSymbol?N(i.symbol):e.requireFunctionLikeSymbol?k(i.symbol):i.isFunctionLike}function I(i){return i.endLine-i.startLine+1}function z(i){return(i.split("/").pop()??"").includes("types")}export{W as a};
2
- //# sourceMappingURL=chunk-NBUINPSH.js.map
@@ -1,2 +0,0 @@
1
- function l(o){let t=new WeakMap,r=a=>{let e=t.get(a);return e||(e=new Map,t.set(a,e)),e};return{get(a,e,i){let n=r(a);if(n.has(e))return n.get(e);let c=i();return n.set(e,c),c},invalidate(a,e){t.get(a)?.delete(e)},invalidateAll(a){t.delete(a)},size(a){return t.get(a)?.size??0}}}function p(o){let t=new WeakMap;return{get(r,a){let e=t.get(r);if(e)return e.value;let i=a();return t.set(r,{value:i}),i},invalidate(r){t.delete(r)},has(r){return t.has(r)}}}function b(o){let t=new WeakMap,r=a=>{let e=t.get(a);return e||(e=new Map,t.set(a,e)),e};return{get(a,e,i,n){let c=r(a),s=c.get(e);if(s&&s.source===i)return s.value;let u=n();return c.set(e,{source:i,value:u}),u},invalidate(a,e){t.get(a)?.delete(e)},invalidateAll(a){t.delete(a)}}}export{l as a,p as b,b as c};
2
- //# sourceMappingURL=chunk-NHDPYW7O.js.map
@@ -1,2 +0,0 @@
1
- import{a as p}from"./chunk-IODTPF5H.js";import{c as a}from"./chunk-KJ6CW6EK.js";import{b as f}from"./chunk-NHDPYW7O.js";function c(t){let r=o(t);return x(r)?"test":S(r)?"worker":y(r)?"entry":P(r)?"barrel":"source"}function _(t){return c(t)==="barrel"}function g(t){return h.get(t,()=>{let r=p(t),e=a(t).filter(s=>{let u=c(s);return u==="entry"||u==="worker"}),n=new Set,i=new Set;for(;e.length>0;){let s=e.shift();if(!n.has(s)){n.add(s),c(s)==="barrel"&&i.add(s);for(let u of r.get(s)??[])n.has(u)||e.push(u)}}return i})}var h=f("live-barrels");function b(t,r){return g(t).has(o(r))}function w(t){let r=g(t);return a(t).filter(e=>_(e)&&!r.has(e))}function D(t,r){let e=c(r);return e==="entry"||e==="worker"||b(t,r)}function E(t,r,e){let n=t.config.entryRoots;if(!n)return!1;let i=o(e);return!!(n.files?.some(s=>o(s)===i)||n.pathPrefixes?.some(s=>i.startsWith(o(s)))||n.qualifiedVars?.some(s=>$(r,s))||n.symbolPatterns?.some(s=>{try{return new RegExp(s).test(r)}catch{return!1}}))}var v=["%/__tests__/%","%.test.%","%.spec.%","%/test/%","%/tests/%","%_test.%","%_spec.%","%/test_%.%","%/spec_%.%"],B=["%/test-utils/%"];function x(t){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(t)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(t)||/(?:^|\/)spec_[^/]+$/i.test(t)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(t)||/(?:^|\/)[^/]+_tests\.rs$/i.test(t)||/(?:^|\/)tests\.rs$/i.test(t)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(t)||/(?:^|\/)__tests__\//i.test(t)||/(?:^|\/)test\//i.test(t)||/(?:^|\/)tests\//i.test(t)||/(?:^|\/)__fixtures__\//i.test(t)||/(?:^|\/)__mocks__\//i.test(t)||/(?:^|\/)test-support\//i.test(t)||/(?:^|\/)test-utils\//i.test(t)||/(?:^|\/)testing\//i.test(t))}function S(t){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(t)}function y(t){let r=t.split("/"),e=r[r.length-1]??t;return e==="cli.ts"||e==="cli.js"||e==="postinstall.ts"||e==="postinstall.js"||e==="main.ts"||e==="main.js"||e==="main.rs"||e==="main.go"||e==="main.py"||e==="build.rs"||e==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(t)||/(?:^|\/)examples\/[^/]+\.rs$/.test(t)||/(?:^|\/)tests\/[^/]+\.rs$/.test(t)||/(?:^|\/)benches\/[^/]+\.rs$/.test(t)?!0:e==="index.ts"||e==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(t)?!0:r.length<=2:!1}function P(t){return t==="index.ts"||t==="index.js"||t.endsWith("/index.ts")||t.endsWith("/index.js")||t.endsWith("/mod.rs")||t.endsWith("/__init__.py")}function o(t){return t.replace(/\\/g,"/")}function $(t,r){let e=r.lastIndexOf("/");if(e<0)return!1;let n=r.slice(0,e),i=r.slice(e+1);return t.includes(l(n)+"/")&&t.includes(l(i)+".")}function l(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}export{c as a,_ as b,b as c,w as d,D as e,E as f,v as g,B as h};
2
- //# sourceMappingURL=chunk-NKJKI6SE.js.map
@@ -1,7 +0,0 @@
1
- import{a as D,b as L}from"./chunk-3X43EYFU.js";import{a as M}from"./chunk-V76FCF5F.js";import{a as C,b as F}from"./chunk-MX6F756F.js";import{a as I}from"./chunk-NBUINPSH.js";import{a as b}from"./chunk-4GPWGSOE.js";import{c as f,d,j as p,w as g}from"./chunk-4VYIZV3S.js";import{basename as c,extname as m}from"path";function q(t,n){let{scope:e,maxLoc:r=15,limit:a=30,scanLimit:o}=n??{},i=new I(t),s=k(i.fileDependencyGraph(e));return M({candidates:()=>x(i,e,r),orderCandidates:F,scanLimit:o,prepare:l=>({callerFileMap:D(i,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,u)=>h(t,i,l,u),orderResults:(l,u)=>u.callerFanIn-l.callerFanIn||u.loc-l.loc,limit:a})}function h(t,n,e,r){let a=S(t,n,e,r.callerFileMap);if(a.length!==1)return null;let o=a[0],i=y(t,e.symbolId,o);if(!i)return null;let s=v(n,t,o,e.symbol,i);if(s&&p(s.symbol))return null;let l=P(r.callerFileMap,r.reverseFanIn,o,s);return l<=3?null:{symbol:e.symbol,shortName:f(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:C(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?f(s.symbol):c(o),callerFanIn:l}}function x(t,n,e){return t.productionCallableDefinitions({scope:n,minLoc:2,maxLoc:e,requireFunctionLikeSymbol:!0})}function S(t,n,e,r){let a=c(e.relativePath,m(e.relativePath)),o=[...r.get(e.symbolId)??[]].filter(i=>i!==e.relativePath).filter(i=>c(i,m(i))!==a).filter(i=>{let s=n.fileKind(i);return s!=="barrel"&&s!=="entry"&&s!=="test"});return L(t,e,o).realConsumers}function y(t,n,e){return t.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 v(t,n,e,r,a){let o=t.definitionsForFile(e),i=_(n,e,r,a.start_line,a.end_line);return g(o,i)}function P(t,n,e,r){if(r?.isFunctionLike){let a=[...t.get(r.symbolId)??[]].filter(o=>o!==r.relativePath);if(a.length>0)return a.length}return N(n,e)}function _(t,n,e,r,a){let o=d(e);if(!o)return r;let i=b(t,n).get(o);if(!i||i.length===0)return r;for(let s of i)if(s>=r&&s<=a)return s;return r}function k(t){let n=new Map;for(let[e,r]of t){n.has(e)||n.set(e,n.get(e)??0);for(let a of r)n.set(a,(n.get(a)??0)+1)}return n}function N(t,n){let e=t.get(n)??0;if(e>0)return e;let r=c(n,m(n)),a=0;for(let[o,i]of t)o!==n&&c(o,m(o))===r&&i>a&&(a=i);return a}export{q as a};
7
- //# sourceMappingURL=chunk-OPZQIJZU.js.map
@@ -1,2 +0,0 @@
1
- import{b as N}from"./chunk-YH6TTQEI.js";import{g as C,i as k,j as L,k as A,p as D}from"./chunk-4GPWGSOE.js";import{d as M}from"./chunk-5RGK4YA5.js";import{t as R}from"./chunk-4VYIZV3S.js";import{e as m,j as b,l as w,n as y,o as E}from"./chunk-5TT47UMX.js";import{a as x}from"./chunk-NN3O7TPH.js";var p=new WeakMap;function he(e,n){let t=m(n);return t==="rust"?K(e,n):t==="typescript"||t==="tsx"||t==="javascript"?O(e,n):[]}var z=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function O(e,n){let t=b(e,n);if(!t)return[];let s=p.get(t);if(s)return s;let o=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(n)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(n),i=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(n),r=!1,c=t.rootNode;for(let a of c.namedChildren){if(a.type!=="expression_statement")continue;let d=a.namedChild(0);if(!d||d.type!=="call_expression")continue;let u=d.namedChild(0);if(!u)continue;let f=u.type==="member_expression"?u.namedChild(u.namedChildCount-1)?.text:u.text;if(f&&z.has(f)){r=!0;break}}let l=[];r&&l.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(o||i)&&l.push({startLine:0,endLine:c.endPosition.row,reason:o?"Next.js / Remix route file":"Vite/Vue route component"});for(let a of c.namedChildren){let d=null,u=null;if(a.type==="function_declaration")d=a.namedChild(0)?.text??null,u=a;else if(a.type==="export_statement"){let f=a.namedChild(0);f?.type==="function_declaration"&&(d=f.namedChild(0)?.text??null,u=f)}else if(a.type==="lexical_declaration"){let f=a.namedChild(0);if(f?.type==="variable_declarator"){let _=f.namedChild(0)?.text,S=f.namedChild(1);_&&(S?.type==="arrow_function"||S?.type==="function_expression")&&(d=_,u=f)}}d&&/^use[A-Z]/.test(d)&&u&&l.push({startLine:u.startPosition.row,endLine:u.endPosition.row,reason:"React custom hook (use*)"})}return l.push(...P(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),p.set(t,l),l}var W=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function G(e){return W.test(e)}function P(e,n,t){let s=[],o=i=>{if(n.has(i.type)&&i.parent){let c=i.parent.children,l=-1;for(let a=0;a<c.length;a+=1)if(c[a].startIndex===i.startIndex&&c[a].type===i.type){l=a;break}if(l>0)for(let a=l-1;a>=0;a-=1){let d=c[a];if(t.has(d.type)){if(G(d.text)){s.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(d.type==="attribute_item"||d.type==="inner_attribute_item"))break}}for(let r of i.namedChildren)o(r)};return o(e.rootNode),s}function K(e,n){let t=b(e,n);if(!t)return[];let s=p.get(t);if(s)return s;let o=[],i=q(t);return i?(p.set(t,i),i):(F(t.rootNode,o,!1,!1),o.push(...P(t,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),o.push(...Z(t.rootNode)),p.set(t,o),o)}function q(e){return Q(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function F(e,n,t,s){let o=t,i=s;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(i=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?$(e,n,t,s):s&&X(e)?n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?B(e,n,t):e.type==="mod_item"&&g(e).some(r=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(r))&&(o=!0);for(let r of e.namedChildren)F(r,n,o,i)}function $(e,n,t,s){let o=g(e),i=null;s?i="trait impl method (dynamic dispatch)":t&&(i="inside #[cfg(test)] mod");for(let r of o){let c=J(r);if(c){i=c;break}if(H(r)){i="#[allow(dead_code)]";break}}i&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:i})}function B(e,n,t){let s=g(e),o=e.namedChildren.find(i=>i.type==="type_identifier")?.text;s.some(U)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:o}),s.some(H)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:o}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:o})}function g(e){let n=e.parent;if(!n)return[];let t=n.children,s=-1;for(let i=0;i<t.length;i+=1)if(t[i].startIndex===e.startIndex&&t[i].type===e.type){s=i;break}if(s<=0)return[];let o=[];for(let i=s-1;i>=0;i-=1){let r=t[i];if(r.type==="attribute_item"||r.type==="inner_attribute_item")o.push(r.text);else{if(r.type==="line_comment"||r.type==="block_comment")continue;break}}return o}function J(e){return/#\[\s*tauri::command\b/.test(e)?"#[tauri::command]":/#\[\s*command\b/.test(e)?"#[command]":/#\[\s*test\b/.test(e)?"#[test]":/#\[\s*bench\b/.test(e)?"#[bench]":/#\[\s*tokio::test\b/.test(e)?"#[tokio::test]":/#\[\s*async_std::test\b/.test(e)?"#[async_std::test]":/#\[\s*wasm_bindgen\b/.test(e)?"#[wasm_bindgen]":/#\[\s*no_mangle\b/.test(e)?"#[no_mangle]":/#\[\s*napi\b/.test(e)?"#[napi]":/#\[\s*pyfunction\b/.test(e)?"#[pyfunction]":/#\[\s*pymethod\b/.test(e)?"#[pymethod]":/#\[\s*pyo3\b/.test(e)?"#[pyo3]":/#\[\s*cfg\s*\(\s*test\s*\)/.test(e)?"#[cfg(test)]":/#\[\s*doc\s*\(\s*hidden\s*\)/.test(e)?"#[doc(hidden)]":null}function U(e){return/#\[\s*derive\s*\(/.test(e)?/\bSerialize\b/.test(e)||/\bDeserialize\b/.test(e)||/\bFromRow\b/.test(e)||/\bDeriveEntityModel\b/.test(e)||/\bIntoSchema\b/.test(e)||/\bToSchema\b/.test(e)||/\bDeriveValueType\b/.test(e)||/\bsqlx::FromRow\b/.test(e)||/\bError\b/.test(e)||/\bthiserror::Error\b/.test(e):!1}function H(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function X(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Z(e){let n=ie(e);if(n.size===0)return[];let t=[];for(let s of e.descendantsOfType("mod_item")){let o=s.childForFieldName("name")?.text;o&&n.has(o)&&t.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:o})}return t}function Q(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Y=[{key:"default",re:/\bdefault\s*=\s*"([^"]+)"/g},{key:"with",re:/\bwith\s*=\s*"([^"]+)"/g},{key:"serialize_with",re:/\bserialize_with\s*=\s*"([^"]+)"/g},{key:"deserialize_with",re:/\bdeserialize_with\s*=\s*"([^"]+)"/g},{key:"skip_serializing_if",re:/\bskip_serializing_if\s*=\s*"([^"]+)"/g},{key:"getter",re:/\bgetter\s*=\s*"([^"]+)"/g},{key:"rename_all_with",re:/\brename_all_with\s*=\s*"([^"]+)"/g},{key:"schema_with",re:/\bschema_with\s*=\s*"([^"]+)"/g}],j=/^#!?\[\s*serde\s*\(/,ee=/^#!?\[\s*schemars\s*\(/,te=/^#!?\[\s*validate\s*\(/,v=/\bwith\s*=\s*"([^"]+)"/g;function V(e,n){return y(e,n,ne,()=>new Set,(t,s,o)=>{if(s==="rust"){for(let i of t.rootNode.descendantsOfType("attribute_item"))I(i.text,o);for(let i of t.rootNode.descendantsOfType("inner_attribute_item"))I(i.text,o)}})??new Set}var ne=new WeakMap;function I(e,n){let t=j.test(e),s=ee.test(e),o=te.test(e);if(!(!t&&!s&&!o))for(let{re:i}of Y){i.lastIndex=0;let r;for(;(r=i.exec(e))!==null;){let c=r[1],l=c.split("::").pop()??c;l==="is_none"&&/\bOption\b/.test(c)||l==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(c)||l&&n.add(l)}}}function ie(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!j.test(t.text))continue;v.lastIndex=0;let s;for(;(s=v.exec(t.text))!==null;){let o=s[1],i=o.split("::").pop()??o;i&&n.add(i)}}return n}var se=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function _e(e,n){return y(e,n,oe,()=>new Set,(t,s,o)=>{if(!(s!=="typescript"&&s!=="tsx"&&s!=="javascript"))for(let i of t.rootNode.descendantsOfType("call_expression")){let r=i.namedChild(0);if(!r)continue;let c=E(r);if(!c||!se.has(c))continue;let l=i.namedChildren.find(u=>u.type==="arguments");if(!l)continue;let a=l.namedChild(0);if(!a||a.type!=="string")continue;let d=a.namedChildren.find(u=>u.type==="string_fragment");d&&o.add(d.text)}})??new Set}var oe=new WeakMap;function T(e,n,t={}){let s=new Map;if(n&&n.length===0)return s;let o=x(e,{includeIgnored:!1}),i=A(e),r=n??R(e),c=new Set(r.map(l=>l.symbolId));return re(e,s,o,i,c),ae(e,s,r,c),ue(e,s,o,i,c),t.semantic!==!1&&me(s,M(e,fe(r))),s}function re(e,n,t,s,o){for(let i of t){if(!m(i))continue;let r=w(e,i);if(r)for(let c of r){let l=k(i,s.get(c.calleeLeaf)??[]);if(!l||l.length===0)continue;let a=L(e,i,l,c.memberAccess);a&&o.has(a.symbolId)&&a.file!==i&&h(n,a.symbolId,i)}}}function ae(e,n,t,s){let o=le(t);for(let i of ce(e,s))e.isIgnored(i.relative_path)||de(i,o.get(i.symbol_id))||h(n,i.symbol_id,i.relative_path)}function ce(e,n){return C(e,n?[...n]:void 0)}function le(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 de(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function ue(e,n,t,s,o){for(let i of t){if(m(i)!=="rust")continue;let r=V(e,i);if(r.size!==0)for(let c of r){let l=s.get(c);if(l)for(let a of l)o.has(a.symbolId)&&a.file!==i&&h(n,a.symbolId,i)}}}function h(e,n,t){let s=e.get(n);s||(s=new Set,e.set(n,s)),s.add(t)}function fe(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function me(e,n){for(let[t,s]of n){let o=e.get(t);o||(o=new Set,e.set(t,o));for(let i of s)o.add(i)}}function ve(e,n,t={}){return N(e,n,t)}function pe(e,n,t={}){return T(e,n,t)}function be(e,n){return D(e,n)}function Ie(e,n,t={}){let s=pe(e,n,{semantic:t.semantic});return t.sourceFallback===!1?s:ye(s,be(e,n))}function ye(e,n){let t=new Map;for(let[s,o]of e)t.set(s,new Set(o));for(let[s,o]of n){let i=t.get(s)??new Set;for(let r of o)i.add(r);t.set(s,i)}return t}export{he as a,V as b,_e as c,ve as d,pe as e,be as f,Ie as g};
2
- //# sourceMappingURL=chunk-P3PVY6TX.js.map
@@ -1,2 +0,0 @@
1
- import{c as d}from"./chunk-RKTDEIHF.js";import{a}from"./chunk-IODTPF5H.js";function F(n,i={}){let{minSimilarity:f=.5,limit:t=20,scope:o,filePattern:s}=i,p=i.minDeps??(s?1:3),e=g(n,{scope:o,minDeps:p}),u=[];if(s){let r=e.find(l=>l.file.includes(s));if(!r)return[];for(let l of e){if(l.file===r.file)continue;let c=m(r,l,f);c&&u.push(c)}}else for(let r=0;r<e.length;r++){for(let l=r+1;l<e.length;l++){let c=m(e[r],e[l],f);c&&u.push(c)}if(u.length>t*5)break}return u.sort((r,l)=>l.similarity-r.similarity),u.slice(0,t)}function g(n,i){let{scope:f,minDeps:t}=i,o=a(n,f),s=h(o),p=[];for(let[e,u]of o)u.size>=t&&p.push({file:e,deps:new Set([...u].filter(r=>!s.has(r)))});return p}function h(n){let i=new Set,f=n.size;if(f===0)return i;let t=new Map;for(let o of n.values())for(let s of o)t.set(s,(t.get(s)??0)+1);for(let[o,s]of t)s>=5&&s/f>.3&&i.add(o);return i}function m(n,i,f){let t=new Set;for(let e of n.deps)i.deps.has(e)&&t.add(e);if(t.size<3||n.deps.size<4||i.deps.size<4)return null;let o=d(n.deps,i.deps);if(o<f)return null;let s=[];for(let e of n.deps)i.deps.has(e)||s.push(e);let p=[];for(let e of i.deps)n.deps.has(e)||p.push(e);return{fileA:n.file,fileB:i.file,similarity:o,sharedDeps:[...t],uniqueToA:s,uniqueToB:p}}export{F as a};
2
- //# sourceMappingURL=chunk-QE6MGGUY.js.map
@@ -1,6 +0,0 @@
1
- import{a as F,b as y,d as R,e as T}from"./chunk-RKTDEIHF.js";import{c as N}from"./chunk-MX6F756F.js";import{a as k}from"./chunk-NBUINPSH.js";import{a as M}from"./chunk-YH6TTQEI.js";import{a as A}from"./chunk-EVXQF7DM.js";import{c as p,d as P,g as w,j as q}from"./chunk-4VYIZV3S.js";import{a as z}from"./chunk-5TT47UMX.js";function ae(i,t,e={}){let{minSimilarity:s=.4,limit:r=20}=e,a=U(i,t,{semantic:e.semantic!==!1});if(!a)return[];if(!w(a.symbol))return[];let n=V(i,a,s,{scanLimit:e.scanLimit,semantic:e.semantic!==!1});return n.length>0?n.slice(0,r):K(i,t,{minSimilarity:s,limit:r})}function V(i,t,e,s){let r=v(i,{minCallees:3,excludeSymbol:t.symbol,scanLimit:s.scanLimit,semantic:s.semantic}),a=R([t,...r].map(o=>o.callees)),n=[];for(let o of r){if(o.callees.size<3)continue;let l=$(t,o,a,{minSimilarity:e,requireSignificantShared:1,requireSharedCount:0});l&&n.push(l)}return n.sort((o,l)=>l.similarity-o.similarity),n}function $(i,t,e,s){let{similarity:r,significantShared:a}=T(i.callees,t.callees,e);if(r<s.minSimilarity)return null;let n=F(i.callees,t.callees).size;if(a.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let o=a.length>0?a:[...F(i.callees,t.callees)];return{symbolA:i.symbol,shortNameA:p(i.symbol),fileA:i.file,symbolB:t.symbol,shortNameB:p(t.symbol),fileB:t.file,similarity:r,similarityBasis:"callees",sharedCallees:o.map(p),uniqueToA:[...y(i.callees,t.callees)].map(p),uniqueToB:[...y(t.callees,i.callees)].map(p)}}function le(i,t={}){let{minSimilarity:e=.5,limit:s=20,scope:r,minCallees:a=4,crossFileOnly:n=!1,scanLimit:o}=t,l=v(i,{minCallees:a,scope:r,scanLimit:o,semantic:t.semantic!==!1}),c=R(l.map(m=>m.callees)),u=new Map;for(let m of l)for(let f of m.callees)u.set(f,(u.get(f)??0)+1);let h=Math.max(8,Math.ceil(Math.sqrt(l.length))),x=new Map;for(let m=0;m<l.length;m+=1)for(let f of l[m].callees){if((u.get(f)??0)>h)continue;let g=x.get(f);g||(g=[],x.set(f,g)),g.push(m)}let C=[],L=new Set;e:for(let m=0;m<l.length;m+=1){let f=l[m],g=new Set;for(let D of f.callees){let S=x.get(D);if(S)for(let b of S)b>m&&g.add(b)}for(let D of g){let S=`${m}|${D}`;if(L.has(S))continue;L.add(S);let b=l[D];if(n&&f.file===b.file)continue;if(f.paramCount>=0&&b.paramCount>=0){let _=Math.abs(f.paramCount-b.paramCount),O=Math.max(2,Math.ceil(Math.max(f.paramCount,b.paramCount)*.5));if(_>O)continue}let B=$(f,b,c,{minSimilarity:e,requireSignificantShared:2,requireSharedCount:4});if(B&&(C.push(B),C.length>s*5))break e}}return C.sort((m,f)=>f.similarity-m.similarity),C.slice(0,s)}var Z=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function U(i,t,e){let s=A(i,t),r=new k(i);if(!s)return null;let a=M(i,s,{semantic:e.semantic});return{symbol:s.symbol,file:s.relativePath,callees:E(a.map(n=>n.symbol)),paramCount:r.callableSignature(s)?.paramCount??-1}}function v(i,t){let{minCallees:e,scope:s,excludeSymbol:r,scanLimit:a}=t,n=new k(i),o=N(n.productionCallableDefinitions({scope:s,minLoc:5,excludeSymbol:r,sortByLocDesc:typeof a=="number"&&a>0}),a),l=n.calleeMap(o,{semantic:t.semantic!==!1});return o.map(c=>({symbol:c.symbol,file:c.relativePath,callees:E((l.get(c.symbolId)??[]).map(u=>u.symbol)),paramCount:n.callableSignature(c)?.paramCount??-1})).filter(c=>c.callees.size>=e)}function E(i){return new Set([...i].filter(t=>!W(t)))}function W(i){return Z.some(t=>i.includes(t))}function K(i,t,e){let s=G(i,t);if(!s||s.tokens.size<3)return[];let r=e.minSimilarity>=.5?e.minSimilarity:.3,a=[];for(let n of J(i)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let o=F(s.tokens,n.tokens);if(o.size<2)continue;let l=new Set([...s.tokens,...n.tokens]),c=l.size>0?o.size/l.size:0;c<r||a.push({symbolA:s.symbol,shortNameA:p(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:c,similarityBasis:"source-tokens",sharedCallees:[...o].sort(),uniqueToA:[...y(s.tokens,n.tokens)].sort(),uniqueToB:[...y(n.tokens,s.tokens)].sort()})}return a.sort((n,o)=>o.similarity-n.similarity||n.shortNameB.localeCompare(o.shortNameB)),a.slice(0,e.limit)}function G(i,t){let e=A(i,t);if(!e||!w(e.symbol))return null;let s=H(i,e);return s?{symbol:e.symbol,file:e.relativePath,tokens:s}:null}function H(i,t){let e=P(t.symbol),s=I(i,t.relativePath,t.startLine,t.endLine,e),r=j(s,e);return r.size>0?r:null}function J(i){let t=new k(i);return t.scopedDefinitions().filter(e=>e.isFunctionLike).filter(e=>t.fileKind(e.relativePath)!=="test").filter(e=>!q(e.symbol)).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:j(I(i,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function I(i,t,e,s,r){let a=z(i,t);if(!a)return"";let n=a.split(`
2
- `);if(s>=e&&s-e<=12)return n.slice(e,s+1).join(`
3
- `);let o=[new RegExp(`\\bdef\\s+${d(r)}\\b`),new RegExp(`\\bfun\\s+${d(r)}\\b`),new RegExp(`\\bfn\\s+${d(r)}\\b`),new RegExp(`\\bfunction\\s+${d(r)}\\b`),new RegExp(`\\b${d(r)}\\s*\\(`)],l=n.findIndex(c=>o.some(u=>u.test(c)));if(l>=0){let c=l;for(let u=l+1;u<n.length&&u<=l+8;u++){let h=n[u]??"";if(u>l&&X(h)||(c=u,h.trim()===""&&u>l+1))break}return n.slice(l,c+1).join(`
4
- `)}return n.slice(e,Math.min(n.length,e+8)).join(`
5
- `)}function j(i,t){if(!i)return new Set;let e=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),s=Q(t),a=i.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!e.has(n)).filter(n=>!s.has(n));return new Set(a)}function Q(i){return new Set(i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(t=>t.toLowerCase()).filter(t=>t.length>1))}function X(i){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(i)}function d(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ae as a,le as b};
6
- //# sourceMappingURL=chunk-QVPYMZUJ.js.map
@@ -1,4 +0,0 @@
1
- import{B as Y,a as se,b as ne,c as b,d as oe,e as ie,f as ae,g as L,h as pe,i as U,j as ce,k as me,l as E,m as F,n as T,o as V,p as H,q as S,r as Q,s as W,x as C,y as h,z as M}from"./chunk-BOVNTAKQ.js";import{a as j,e as le,f as ue,j as R}from"./chunk-5TT47UMX.js";import{a as w}from"./chunk-NHDPYW7O.js";import{basename as de}from"path";var Ae=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(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 y(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&&Ae.has(n.type)&&e.add(n.text);for(let a of n.children)s(a,i)};return s(t.rootNode,!1),e}function P(t,r,e,s,n,o,i){return{importedName:n,localName:o,sourcePath:i??S(t,s,me(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 D(t,r){return{importedName:t,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function O(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=le(r),i=o?e[o]:void 0;return n&&i?i(n):s()}function fe(t,r,e){return I(t,r,s=>we(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=de(o).replace(/\.[^.]+$/,"");return[$(o,i,H(t,r,o),h(n,i))]})}function we(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=de(i).replace(/\.[^.]+$/,"");n.push(f(i,a,H(t,r,i),s))}return n}function ge(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 Se(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 he(t,r,e){return X(t,r,{csharp:s=>je(t,r,s),vb:s=>Le(t,r,s)},()=>{let s=ce(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[P(t,r,o,c,l,u,S(t,c,L))]})})}function Le(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,L),s,p?"namespace":"named"))}return n}function je(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,L),s,a?"namespace":"named"))}return n}var Me=w("vue-non-script-identifiers");function xe(t,r){return Me.get(t,r,()=>{let e=new Set,s=j(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 K(t,r,e){return I(t,r,s=>qe(t,r,s),()=>$e(t,r,e))}function $e(t,r,e){return Ye(e).flatMap(s=>Ke(t,r,s.clause,s.specifier,s.start,s.end,e))}function qe(t,r,e){let s=Ue(t,r,e),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))n.push(...Fe(t,r,e,o,s));return n}function Ue(t,r,e){let s=g(e,new Set(["import_statement"]));if(ue(r))for(let n of xe(t,r))s.add(n);return s}function Fe(t,r,e,s,n){let o=ze(s);if(!o)return[];let i=E(t,r,o),a=y(s,"import_clause");return a?We(e,a,i,n,Ve(s.text)):[D("*",i)]}function We(t,r,e,s,n){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(Je(i.text,e,s,n));else if(i.type==="namespace_import"){let a=Xe(t,i,e,s,n);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Be(i,e,s,n));return o}function Je(t,r,e,s){return f("default",t,r,e,"default",{isTypeOnly:s})}function Xe(t,r,e,s,n){let i=y(r,"identifier")?.text??"";if(!i)return null;let a=Qe(t,i);return O("*",e,{localName:i,usedMembers:a,isTypeOnly:n,used:a.length>0||s.has(i)})}function Be(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||He(o.text)}))}return n}function ze(t){let r=y(t,"string");if(!r)return null;let e=y(r,"string_fragment");return e?e.text:null}function Ve(t){return/^\s*import\s+type\b/.test(t)}function He(t){return/^\s*type\b/.test(t.trim())}function Qe(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 Ye(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 Ke(t,r,e,s,n,o,i){let a=E(t,r,s),p=C(i,n,o);return e?Ze(e).map(c=>({...c,sourcePath:a})).map(c=>{if(c.kind==="namespace"){let l=M(p,c.localName);return O(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"?D(c.importedName,c.sourcePath):$(c.importedName,c.localName??"",c.sourcePath,c.localName?h(p,c.localName):!1,c.kind,[],{isTypeOnly:c.isTypeOnly})}):[D("*",a)]}function Ze(t){let r=t.trim(),e=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,o]=Ge(s),i=[];return n&&i.push(...ye(n,e)),o&&i.push(...ye(o,e)),i}function ye(t,r){let e=t.trim();if(!e)return[];if(e.startsWith("{")){let s=e.slice(1,-1).trim();return s?x(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 Ge(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 Z(t,r,e){let s=R(t,r);return s?ot(t,r,s):et(t,r,e)}function et(t,r,e){return[...tt(t,r,e),...rt(t,r,e),...st(t,r,e)]}function tt(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=x(i).map(l=>nt(l.trim())).filter(l=>!!l),m=q(e,o.index),c=q(e,o.index+o[0].length-1);s.push({kind:"named",sourcePath:E(t,r,a),names:p,startLine:m,endLine:c})}return s}function rt(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:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function st(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:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function nt(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 ot(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("export_statement")){let o=it(t,r,n);if(o===void 0)continue;let i=n.startPosition.row,a=n.endPosition.row,p=at(n,o,i,a);s.push(p)}return s}function it(t,r,e){let s=y(e,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return E(t,r,n.text)}function at(t,r,e,s){let n=y(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 y(t,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:e,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:e,endLine:s}}function Ne(t,r,e){return X(t,r,{java:s=>pt(t,r,s),kotlin:s=>ct(t,r,s),scala:s=>mt(t,r,s)},()=>N(e,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(s,n)=>{let o=s[1]?.trim();return o?lt(t,r,o,n):[]}))}function pt(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(O("*",S(t,m,b)));continue}let c=m.split(".").pop()??m;n.push(f(c,c,S(t,m,b),s))}return n}function ct(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(O("*",S(t,i.text,b)));continue}let m=i.text,c=m.split(".").pop()??m,u=p?.namedChild(0)?.text??c;n.push(f(c,u,S(t,m,b),s))}return n}function mt(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(O("*",S(t,p,b)));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 _=u.text,A=d?.text??_;if(_==="_")continue;n.push(f(_,A,S(t,`${p}.${_}`,b),s))}else if(l.type==="identifier"){let u=l.text;n.push(f(u,u,S(t,`${p}.${u}`,b),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,b),s))}return n}function lt(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 x(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[P(t,r,s,u,c,l)]})}return[P(t,r,s,e,e.split(".").pop()??e,e.split(".").pop()??e)]}function be(t,r,e){return I(t,r,s=>ut(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?x(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[P(t,r,n,c,l,u,S(t,c.replace(/\\/g,"."),U))]}):[]}))}function ut(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,"."),U),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}=Ie(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}=Ie(p,"");m&&o(l,m,c)}}return n}function Ie(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 _e(t,r,e){return I(t,r,s=>dt(t,r,s),()=>gt(e).flatMap(s=>ht(t,r,s,e)))}function dt(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=Pe(i);if(!a)continue;let p=F(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=ft(i);if(a===null)continue;let p=F(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=Pe(c);l&&n.push({importedName:l.qualifiedName,localName:l.localName,sourcePath:p,kind:"named",used:s.has(l.localName),usedMembers:[]})}}return n}function Pe(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 ft(t){if(t.type==="dotted_name")return t.text;if(t.type==="relative_import"){let r=y(t,"import_prefix")?.text??"",e=y(t,"dotted_name")?.text??"";return`${r}${e}`}return null}function gt(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=Y(o);for(;n+1<r.length&&(c>0||p.trimEnd().endsWith("\\"));){n++;let u=r[n];p+=`
3
- ${u}`,m+=1+u.length,c+=Y(u),s+=u.length+1}let l=St(p);l&&e.push({...l,start:a,end:m})}return e}function St(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 ht(t,r,e,s){let n=C(s,e.start,e.end),o=e.clause.replace(/\n/g," ").trim();if(e.kind==="import")return x(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(),_=F(t,r,u),A=M(n,d);return[{importedName:u,localName:d,sourcePath:_,kind:"namespace",used:h(n,d)||A.length>0,usedMembers:A}]});let i=e.module?F(t,r,e.module):null,a=[];for(let p of x(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 xt}from"path";function Ee(t,r,e){return I(t,r,s=>Nt(t,r,s),()=>yt(t,r,e))}function yt(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"?V(t,r,i):null;if(a){let p=Te(i);return[$(p,p,a,h(n,p))]}return[D(i,a)]})}function Nt(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"?V(t,r,l):null;if(u){let d=Te(l);n.push(f(d,d,u,s))}else n.push(D(l,u))}return n}function Te(t){return xt(t).replace(/\.[^.]+$/,"").split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}function Ce(t,r,e){return I(t,r,s=>It(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?bt(t,r,o,n):[]}))}function It(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 J(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 J(t,r){switch(t.type){case"identifier":case"super":case"self":case"crate":{let e=t.text;return[{qualifiedName:B(r,e),importedName:e,localName:e}]}case"scoped_identifier":{let e=t.text,s=e.split("::").pop()??e;return[{qualifiedName:B(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=B(r,e.text),o=[];for(let i of s.namedChildren)o.push(...J(i,n));return o}case"use_list":{let e=[];for(let s of t.namedChildren)e.push(...J(s,r));return e}case"use_as_clause":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=J(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:B(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function B(t,r){return t?r?`${t}::${r}`:t:r}function bt(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 x(l).flatMap(u=>{let d=u.trim();if(!d||d==="self")return[];let[_,A]=d.split(/\s+as\s+/),v=_?.trim();if(!v)return[];let Oe=(A??v.split("::").pop()??v).trim(),ke=`${c}::${v}`.replace(/::::/g,"::");return[P(t,r,s,ke,v.split("::").pop()??v,Oe,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[P(t,r,s,a,a.split("::").pop()??a,p,m)]}function Re(t,r,e){let s=R(t,r);if(s)return Pt(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(...Et(t,r,i))}return n}function Pt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("use_declaration")){if(!_t(n))continue;let o=n.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of J(o,""))i.importedName&&s.push(G(t,r,i.qualifiedName))}return s}function _t(t){for(let r of t.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function Et(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 x(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[G(t,r,m)]})}return[G(t,r,s)]}function G(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 De(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 Tt={language:"javascript",extensions:se,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:K,parseReExports:Z},Ct=k({language:"python",extensions:ne,imports:"ast-with-regex-fallback",parseImports:_e}),Rt=k({language:"jvm",extensions:b,imports:"ast-dispatch-with-regex-fallback",parseImports:Ne}),Dt={language:"rust",extensions:oe,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:Ce,parseExports:Re},Ot=k({language:"ruby",extensions:ie,imports:"ast-with-regex-fallback",parseImports:Ee}),kt=k({language:"c/cpp",extensions:ae,imports:"ast-with-regex-fallback",parseImports:fe}),At=k({language:"dotnet",extensions:L,imports:"ast-dispatch-with-regex-fallback",parseImports:he}),vt={language:"dart",extensions:pe,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:ge,parseExports:Se},wt=k({language:"php",extensions:U,imports:"ast-with-regex-fallback",parseImports:be}),Lt=[Tt,Ct,Rt,Dt,Ot,kt,At,vt,wt];function z(t){return De(Lt,t)}var ee=w("source-imports"),te=w("source-exports"),re=w("source-reexports");function Yr(t,r){let e=W(r);return re.get(t,e,()=>{let s=z(e);if(!s?.parseReExports)return[];let n=j(t,e);return n?s.parseReExports(t,e,n):[]})}function Kr(t,r){let e=W(r);return ee.get(t,e,()=>{let s=z(e);if(!s)return[];let n=j(t,e);return n?s.parseImports(t,e,n):[]})}function Zr(t,r){let e=W(r);return te.get(t,e,()=>{let s=z(e);if(!s?.parseExports)return[];let n=j(t,e);return n?s.parseExports(t,e,n):[]})}function Gr(t){ee.invalidateAll(t),te.invalidateAll(t),re.invalidateAll(t)}function es(t,r){let e=W(r);ee.invalidate(t,e),te.invalidate(t,e),re.invalidate(t,e)}export{Yr as a,Kr as b,Zr as c,Gr as d,es as e};
4
- //# sourceMappingURL=chunk-RCJEFQOK.js.map
@@ -1,2 +0,0 @@
1
- import{a as P}from"./chunk-EDXML2HI.js";import{a as v}from"./chunk-AQYBOORI.js";import{a as R}from"./chunk-OPZQIJZU.js";import{d as w}from"./chunk-3X43EYFU.js";import{a as L}from"./chunk-7WHNTKSD.js";import{b as x}from"./chunk-QVPYMZUJ.js";import{a as S}from"./chunk-HTVLH3NL.js";import{a as b}from"./chunk-OPWOX7NT.js";import{a as C}from"./chunk-D62LLANH.js";import{a as g}from"./chunk-WJQFABZN.js";import{a as H}from"./chunk-BI4F6GXI.js";import{a as d,b as y}from"./chunk-EZQOVY3C.js";import{e as u,f as l}from"./chunk-NKJKI6SE.js";function m(t){let e=z(t);return{score:I(t),overview:{documents:t.statsResult.documents,symbols:t.statsResult.symbols,indexSizeBytes:t.statsResult.indexSizeBytes},findings:{deadSymbols:t.dead.count,deadLoc:t.dead.loc,isolatedSymbols:t.isolated.count,isolatedLoc:t.isolated.loc,cycles:t.realCycleCount,similarPairs:t.similarCount,extractionCandidates:t.extractCount,wrappers:t.wrappers.count,passthroughs:t.passthroughs.count,staleTypes:t.stale.count,driftedFiles:t.drift.count,complexityHotspotCount:t.complexity.extremeCount},actions:e,topComplexity:t.complexity.top,warnings:t.warnings.length>0?t.warnings:void 0}}function z(t){let e=[];if(t.dead.count>0&&e.push({category:"Dead code",description:`${t.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:t.dead.count,locRecoverable:t.dead.loc}),t.isolated.count>0&&e.push({category:"Isolated symbols",description:`${t.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:t.isolated.count,locRecoverable:t.isolated.loc}),t.realCycleCount>0&&e.push({category:"Circular dependencies",description:`${t.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:t.realCycleCount,locRecoverable:0}),t.similarCount>0&&e.push({category:"Similar functions",description:`${t.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:t.similarCount,locRecoverable:0}),t.extractCount>0&&e.push({category:"Extraction candidates",description:`${t.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:t.extractCount,locRecoverable:0}),t.wrappers.count>0&&e.push({category:"Wrapper functions",description:`${t.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:t.wrappers.count,locRecoverable:t.wrappers.loc}),t.passthroughs.count>0&&e.push({category:"Passthrough functions",description:`${t.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:t.passthroughs.count,locRecoverable:t.passthroughs.loc}),t.stale.count>0){let i=[];t.stale.unused>0&&i.push(`${t.stale.unused} unused`),t.stale.singleUse>0&&i.push(`${t.stale.singleUse} single-consumer (not in types file)`),e.push({category:"Stale abstractions",description:`${i.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:t.stale.count,locRecoverable:t.stale.loc})}if(t.drift.count>0){let i=[];t.drift.unusedImports>0&&i.push(`${t.drift.unusedImports} unused imports`),t.drift.layerViolations>0&&i.push(`${t.drift.layerViolations} layer violations`),e.push({category:"Structural drift",description:i.join(", "),effort:t.drift.layerViolations>0?"medium":"low",impact:t.drift.layerViolations>0?"medium":"low",count:t.drift.count,locRecoverable:0})}let a={high:3,medium:2,low:1},r={low:3,medium:2,high:1};return e.sort((i,n)=>{let c=a[i.impact]*r[i.effort];return a[n.impact]*r[n.effort]-c}),e}function I(t){let e=Math.max(t.statsResult.documents,1),a=Math.max(t.statsResult.symbols,1),r=100,i=t.dead.count/a;r-=Math.min(20,Math.round(i*200));let n=t.isolated.count/a;r-=Math.min(10,Math.round(n*200)),r-=Math.min(15,t.realCycleCount*5);let c=t.similarCount/a*1e3;r-=Math.min(10,Math.round(c));let f=t.extractCount/a*1e3;r-=Math.min(5,Math.round(f/2)),r-=Math.min(3,t.wrappers.count),r-=Math.min(3,t.passthroughs.count);let M=t.stale.count/Math.max(a*.1,1);r-=Math.min(8,Math.round(M*10));let _=t.drift.count/e;return r-=Math.min(5,Math.round(_*50)),r-=Math.min(5,t.complexity.extremeCount*2),Math.max(0,Math.min(100,r))}import{getHeapStatistics as $}from"v8";var N=64*1024*1024;function h(){let t=globalThis.gc;if(!t)return;let e=$();e.heap_size_limit-e.used_heap_size<N||t()}var O=50,j=75e3,U=5e3,E=2500,V=["overview","dead","isolated","cycles","similar","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots"],A={overview:(t,e,a,r)=>({phase:"overview",statsResult:r,warnings:a.warnings}),dead:(t,e,a)=>({phase:"dead",dead:G(t,e,a)}),isolated:(t,e,a)=>({phase:"isolated",isolated:F(t,e,a)}),cycles:(t,e,a)=>({phase:"cycles",realCycleCount:W(t,e,a)}),similar:(t,e,a)=>({phase:"similar",similarCount:q(t,e,a)}),"extract-candidates":(t,e,a)=>({phase:"extract-candidates",extractCount:Y(t,e,a)}),"wrapper-candidates":(t,e,a)=>({phase:"wrapper-candidates",wrappers:Q(t,e,a)}),"passthrough-candidates":(t,e,a)=>({phase:"passthrough-candidates",passthroughs:X(t,e,a)}),"stale-abstractions":(t,e,a)=>({phase:"stale-abstractions",stale:J(t,e,a)}),drift:(t,e,a)=>({phase:"drift",drift:K(t,e,a)}),"complexity-hotspots":(t,e,a)=>({phase:"complexity-hotspots",complexity:Z(t,e,a)})};function Rt(t,e={}){return T(t,e.full===!0,(a,r)=>{let i=k(t,e.scope,a,r);return m(i)})}function Lt(t,e,a={}){return T(t,a.full===!0,(r,i)=>A[e](t,a.scope,i,r))}function T(t,e,a){let r=v(t),i=tt(r,e);try{return a(r,i)}finally{d(t,{semanticProvider:!0}),h()}}function Pt(t){return m(D(t))}function D(t){let e=o(t,"overview");return{statsResult:e.statsResult,warnings:e.warnings,dead:o(t,"dead").dead,isolated:o(t,"isolated").isolated,realCycleCount:o(t,"cycles").realCycleCount,similarCount:o(t,"similar").similarCount,extractCount:o(t,"extract-candidates").extractCount,wrappers:o(t,"wrapper-candidates").wrappers,passthroughs:o(t,"passthrough-candidates").passthroughs,stale:o(t,"stale-abstractions").stale,drift:o(t,"drift").drift,complexity:o(t,"complexity-hotspots").complexity}}function o(t,e){let a=t.find(r=>r.phase===e);if(!a)throw new Error(`Missing health phase result: ${e}`);return a}function k(t,e,a,r){return D(V.map(i=>A[i](t,e,r,a)))}function G(t,e,a){return s(t,a,"dead",()=>{let r=y(t,{scope:e,minLoc:3,skipBarrels:!0,deadCodeOnly:!0,scanLimit:a.candidateScanLimit,semantic:!1});return p(rt(t,r.symbols))})}function F(t,e,a){return s(t,a,"isolated",()=>{let r=S(t,{scope:e,minLoc:3,scanLimit:a.candidateScanLimit,semantic:!1});return p(it(t,r))})}function W(t,e,a){return s(t,a,"cycles",()=>H(t,{scope:e}).filter(i=>i.kind==="real").length)}function q(t,e,a){return s(t,a,"similar",()=>x(t,{scope:e,minSimilarity:.6,limit:50,minCallees:4,scanLimit:a.candidateScanLimit,semantic:!1}).length)}function Y(t,e,a){return s(t,a,"extract-candidates",()=>C(t,{scope:e,minLoc:15,minCallees:5,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}).length)}function Q(t,e,a){return B(t,a,"wrapper-candidates",()=>R(t,{scope:e,maxLoc:15,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}))}function X(t,e,a){return B(t,a,"passthrough-candidates",()=>L(t,{scope:e,maxLoc:15,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}))}function J(t,e,a){return s(t,a,"stale-abstractions",()=>{let r=P(t,{scope:e,minLoc:3,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}),i=r.filter(n=>n.consumers===0).length;return{count:r.length,loc:r.reduce((n,c)=>n+c.loc,0),unused:i,singleUse:r.length-i}})}function K(t,e,a){return s(t,a,"drift",()=>{let r=b(t,{scope:e,semantic:!1});return{count:r.unusedImports+r.layerViolations,unusedImports:r.unusedImports,layerViolations:r.layerViolations}})}function Z(t,e,a){return s(t,a,"complexity-hotspots",()=>{let r=g(t,{scope:e,minLoc:10,limit:10,scanLimit:a.candidateScanLimit,semantic:!1});return{top:r.slice(0,5).map(i=>({symbol:i.shortName,score:i.score})),extremeCount:r.filter(i=>i.score>O).length}})}function tt(t,e){return t.symbols>=j||t.documents>=U?e?{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:["Large index detected; running unbounded health analyses because --full was supplied."]}:{candidateScanLimit:E,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${E} symbols. Run "scip-query health --full" for unbounded candidate counts.`]}:{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:[]}}function et(t,e){e.releaseCachesBetweenPhases&&(w(t),d(t),h())}function s(t,e,a,r){at(a);try{return r()}finally{et(t,e)}}function B(t,e,a,r){return s(t,e,a,()=>p(r()))}function at(t){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${t}`)}function rt(t,e){return e.filter(a=>!u(t,a.relativePath)&&!l(t,a.symbol,a.relativePath)&&a.kind==="dead-code")}function it(t,e){return e.filter(a=>!u(t,a.relativePath)&&!l(t,a.symbol,a.relativePath))}function p(t){return{count:t.length,loc:t.reduce((e,a)=>e+a.loc,0)}}export{V as a,Rt as b,Lt as c,Pt as d};
2
- //# sourceMappingURL=chunk-UHMJYNTK.js.map
@@ -1,119 +0,0 @@
1
- import { S as ScipDatabase } from './db-DdTPetj5.js';
2
- import { stats } from './queries/stats.js';
3
-
4
- interface CountLocSummary {
5
- count: number;
6
- loc: number;
7
- }
8
- interface StaleSummary extends CountLocSummary {
9
- unused: number;
10
- singleUse: number;
11
- }
12
- interface DriftSummary {
13
- count: number;
14
- unusedImports: number;
15
- layerViolations: number;
16
- }
17
- interface ComplexitySummary {
18
- top: Array<{
19
- symbol: string;
20
- score: number;
21
- }>;
22
- extremeCount: number;
23
- }
24
-
25
- interface HealthAction {
26
- category: string;
27
- description: string;
28
- effort: 'low' | 'medium' | 'high';
29
- impact: 'low' | 'medium' | 'high';
30
- count: number;
31
- locRecoverable: number;
32
- }
33
- interface HealthReport {
34
- score: number;
35
- overview: {
36
- documents: number;
37
- symbols: number;
38
- indexSizeBytes: number;
39
- };
40
- findings: {
41
- deadSymbols: number;
42
- deadLoc: number;
43
- isolatedSymbols: number;
44
- isolatedLoc: number;
45
- cycles: number;
46
- similarPairs: number;
47
- extractionCandidates: number;
48
- wrappers: number;
49
- passthroughs: number;
50
- staleTypes: number;
51
- driftedFiles: number;
52
- complexityHotspotCount: number;
53
- };
54
- actions: HealthAction[];
55
- topComplexity: Array<{
56
- symbol: string;
57
- score: number;
58
- }>;
59
- warnings?: string[];
60
- }
61
-
62
- declare const HEALTH_PHASES: readonly ["overview", "dead", "isolated", "cycles", "similar", "extract-candidates", "wrapper-candidates", "passthrough-candidates", "stale-abstractions", "drift", "complexity-hotspots"];
63
- type HealthPhaseName = typeof HEALTH_PHASES[number];
64
- type HealthPhaseResult = {
65
- phase: 'overview';
66
- statsResult: ReturnType<typeof stats>;
67
- warnings: string[];
68
- } | {
69
- phase: 'dead';
70
- dead: CountLocSummary;
71
- } | {
72
- phase: 'isolated';
73
- isolated: CountLocSummary;
74
- } | {
75
- phase: 'cycles';
76
- realCycleCount: number;
77
- } | {
78
- phase: 'similar';
79
- similarCount: number;
80
- } | {
81
- phase: 'extract-candidates';
82
- extractCount: number;
83
- } | {
84
- phase: 'wrapper-candidates';
85
- wrappers: CountLocSummary;
86
- } | {
87
- phase: 'passthrough-candidates';
88
- passthroughs: CountLocSummary;
89
- } | {
90
- phase: 'stale-abstractions';
91
- stale: StaleSummary;
92
- } | {
93
- phase: 'drift';
94
- drift: DriftSummary;
95
- } | {
96
- phase: 'complexity-hotspots';
97
- complexity: ComplexitySummary;
98
- };
99
- /**
100
- * Single composite health report that runs all de-bloat analyses
101
- * and produces a prioritized action list.
102
- *
103
- * The scoring formula accounts for common false positives:
104
- * - Entry points (CLI, workers, barrels) appearing as "dead code"
105
- * - Typed result interfaces with 1 consumer (normal for APIs)
106
- * - Consistent import patterns across sibling modules (not duplication)
107
- * - Barrel and orchestrator files deviating from sibling patterns (expected)
108
- */
109
- declare function health(db: ScipDatabase, opts?: {
110
- scope?: string;
111
- full?: boolean;
112
- }): HealthReport;
113
- declare function healthPhase(db: ScipDatabase, phase: HealthPhaseName, opts?: {
114
- scope?: string;
115
- full?: boolean;
116
- }): HealthPhaseResult;
117
- declare function healthReportFromPhases(phaseResults: HealthPhaseResult[]): HealthReport;
118
-
119
- export { HEALTH_PHASES as H, type HealthAction as a, type HealthReport as b, healthPhase as c, healthReportFromPhases as d, type HealthPhaseName as e, health as h };