scip-query 0.10.10 → 0.10.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/chunk-2KHTSEIL.js +102 -0
  2. package/dist/{chunk-CCKPYPDI.js → chunk-4UZO3XCV.js} +2 -2
  3. package/dist/{chunk-MMLZEGMS.js → chunk-54KGX7EX.js} +2 -2
  4. package/dist/{chunk-2VM46FC5.js → chunk-5GOLFJEO.js} +2 -2
  5. package/dist/chunk-5OST6GYB.js +2 -0
  6. package/dist/{chunk-2UYQLFVC.js → chunk-6GN7FXCH.js} +2 -2
  7. package/dist/{chunk-7UQWUVRG.js → chunk-6IR2AOBM.js} +2 -2
  8. package/dist/{chunk-QX7LLCGB.js → chunk-6JRV4MY2.js} +2 -2
  9. package/dist/{chunk-IPQTC36U.js → chunk-6LJHXREW.js} +2 -2
  10. package/dist/{chunk-CZ425R2B.js → chunk-6QSOCTZT.js} +2 -2
  11. package/dist/{chunk-RYXW3KRC.js → chunk-7B6LP46R.js} +2 -2
  12. package/dist/chunk-7GO4EQF5.js +2 -0
  13. package/dist/chunk-7IVSJJZU.js +7 -0
  14. package/dist/{chunk-56P7PDST.js → chunk-7TWLSZK5.js} +2 -2
  15. package/dist/{chunk-AW2QHPLL.js → chunk-AVWPHM2Q.js} +2 -2
  16. package/dist/{chunk-UYD7FJ3K.js → chunk-BASVXNY3.js} +2 -2
  17. package/dist/{chunk-XXZXDXTD.js → chunk-BFXPG2VN.js} +2 -2
  18. package/dist/{chunk-UWYJDBDW.js → chunk-CO5GJRP7.js} +2 -2
  19. package/dist/chunk-CW5YFOCP.js +5 -0
  20. package/dist/{chunk-7JRRXGVZ.js → chunk-E35O7UCB.js} +2 -2
  21. package/dist/{chunk-XIVO4SDZ.js → chunk-EXDQ35NN.js} +2 -2
  22. package/dist/{chunk-UFX7EPBA.js → chunk-EY43NV4M.js} +2 -2
  23. package/dist/{chunk-NZ4UDB5N.js → chunk-FFVIFETB.js} +2 -2
  24. package/dist/{chunk-UDGXK2WA.js → chunk-FKCGBZAC.js} +2 -2
  25. package/dist/{chunk-TL6QPNF5.js → chunk-FXNWFMKW.js} +2 -2
  26. package/dist/chunk-G5UPYQGL.js +4 -0
  27. package/dist/{chunk-Y6E3JHC4.js → chunk-GQBMH2TQ.js} +2 -2
  28. package/dist/{chunk-736BLPHR.js → chunk-IHUETYFW.js} +2 -2
  29. package/dist/{chunk-5VG7RKEF.js → chunk-JATUZIEH.js} +2 -2
  30. package/dist/chunk-JCLDUKT6.js +38 -0
  31. package/dist/{chunk-SGLLBSCV.js → chunk-JGN2ZFJR.js} +2 -2
  32. package/dist/{chunk-WG6KRH5F.js → chunk-JME7OWD3.js} +2 -2
  33. package/dist/{chunk-F6ICF7HL.js → chunk-KDFONWTW.js} +2 -2
  34. package/dist/{chunk-J7RWXLUL.js → chunk-LSET2TXH.js} +2 -2
  35. package/dist/{chunk-ZU6PROUY.js → chunk-M4COR2H6.js} +2 -2
  36. package/dist/{chunk-DQVKIG3D.js → chunk-NOJAM5ZV.js} +2 -2
  37. package/dist/{chunk-A6TANQNV.js → chunk-O6ZH6C6Y.js} +2 -2
  38. package/dist/chunk-OLTESY4K.js +3 -0
  39. package/dist/chunk-P4KYUPBD.js +4 -0
  40. package/dist/{chunk-Z4I7BVIU.js → chunk-P753MDDE.js} +2 -2
  41. package/dist/{chunk-6LNQOOTB.js → chunk-P7AL7Y37.js} +2 -2
  42. package/dist/{chunk-YWDVDAD7.js → chunk-QLAUCRDJ.js} +2 -2
  43. package/dist/{chunk-UQLFQLAF.js → chunk-RNM6LMCF.js} +2 -2
  44. package/dist/{chunk-PTQVNJ4Q.js → chunk-TK7O5ER5.js} +2 -2
  45. package/dist/chunk-TQ5W2H3S.js +4 -0
  46. package/dist/chunk-USPV3T5K.js +2 -0
  47. package/dist/{chunk-I46WR7MT.js → chunk-VCQYSG2M.js} +2 -2
  48. package/dist/{chunk-XSNRACLV.js → chunk-W6BVEKYC.js} +2 -2
  49. package/dist/{chunk-KX5PLFZ5.js → chunk-WUCEKFQC.js} +2 -2
  50. package/dist/{chunk-TH2N6QHW.js → chunk-Y5NBHMQX.js} +2 -2
  51. package/dist/{chunk-YBEEVDJQ.js → chunk-YCOFCT4B.js} +2 -2
  52. package/dist/{chunk-RXRLZFUL.js → chunk-YWYFU2V3.js} +2 -2
  53. package/dist/{chunk-5NVUWIAN.js → chunk-Z3YYR4OS.js} +2 -2
  54. package/dist/{chunk-ZQO43G2T.js → chunk-Z4HICZGY.js} +2 -2
  55. package/dist/{chunk-3DGD6NKW.js → chunk-ZQDIXAF5.js} +2 -2
  56. package/dist/cli.js +250 -247
  57. package/dist/index.js +1 -1
  58. package/dist/queries/affected.js +1 -1
  59. package/dist/queries/bottlenecks.js +1 -1
  60. package/dist/queries/by-kind.js +1 -1
  61. package/dist/queries/call-graph.js +1 -1
  62. package/dist/queries/change-surface.js +1 -1
  63. package/dist/queries/cleanup-plan.js +1 -1
  64. package/dist/queries/code.js +1 -1
  65. package/dist/queries/complexity-hotspots.js +1 -1
  66. package/dist/queries/complexity.js +1 -1
  67. package/dist/queries/convergence.js +1 -1
  68. package/dist/queries/coupling.js +1 -1
  69. package/dist/queries/dataflow.js +1 -1
  70. package/dist/queries/dead.js +1 -1
  71. package/dist/queries/deps.js +1 -1
  72. package/dist/queries/diff-gate.js +1 -1
  73. package/dist/queries/diff-impact.js +1 -1
  74. package/dist/queries/doc-drift.js +1 -1
  75. package/dist/queries/drift.js +1 -1
  76. package/dist/queries/extract-candidates.js +1 -1
  77. package/dist/queries/fan.js +1 -1
  78. package/dist/queries/health.js +1 -1
  79. package/dist/queries/hierarchy.js +1 -1
  80. package/dist/queries/hotspots.js +1 -1
  81. package/dist/queries/imports.js +1 -1
  82. package/dist/queries/incomplete-migration.js +1 -1
  83. package/dist/queries/index.d.ts +1 -1
  84. package/dist/queries/index.js +1 -1
  85. package/dist/queries/isolated.js +1 -1
  86. package/dist/queries/locality-candidates.js +1 -1
  87. package/dist/queries/members.js +1 -1
  88. package/dist/queries/methods.js +1 -1
  89. package/dist/queries/outline.js +1 -1
  90. package/dist/queries/passthrough-candidates.js +1 -1
  91. package/dist/queries/plan-context.js +1 -1
  92. package/dist/queries/recent-duplicates.js +1 -1
  93. package/dist/queries/redundant-reexports.js +1 -1
  94. package/dist/queries/refs.js +1 -1
  95. package/dist/queries/self-audit.js +1 -1
  96. package/dist/queries/similar-signatures.js +1 -1
  97. package/dist/queries/similar.d.ts +11 -1
  98. package/dist/queries/similar.js +1 -1
  99. package/dist/queries/slice.js +1 -1
  100. package/dist/queries/stale-abstractions.js +1 -1
  101. package/dist/queries/surface.js +1 -1
  102. package/dist/queries/symbols.js +1 -1
  103. package/dist/queries/system.js +1 -1
  104. package/dist/queries/trace.js +1 -1
  105. package/dist/queries/unused-imports.js +1 -1
  106. package/dist/queries/unused-params.js +1 -1
  107. package/dist/queries/wrapper-candidates.js +1 -1
  108. package/docs/COMMAND_REFERENCE.md +1 -1
  109. package/package.json +1 -1
  110. package/skills/scip-hyper-optimization/SKILL.md +153 -24
  111. package/skills/scip-hyper-optimization/agents/openai.yaml +3 -3
  112. package/dist/chunk-3Q77KKEY.js +0 -2
  113. package/dist/chunk-4KTOV4QN.js +0 -3
  114. package/dist/chunk-4N4WONI4.js +0 -102
  115. package/dist/chunk-A6IDHNMC.js +0 -4
  116. package/dist/chunk-FRPEPTYJ.js +0 -5
  117. package/dist/chunk-GBEYTDY5.js +0 -2
  118. package/dist/chunk-PKMZCDQD.js +0 -4
  119. package/dist/chunk-QVI3NR7E.js +0 -7
  120. package/dist/chunk-SULEXAHO.js +0 -38
  121. package/dist/chunk-YGHUVQLR.js +0 -2
@@ -0,0 +1,102 @@
1
+ import{a as N,b as m,c as F,d as E,e as p,g as M}from"./chunk-JM72FNGA.js";import{c as R}from"./chunk-72KY2ZFO.js";import{a as f}from"./chunk-DS6QEB3G.js";import{b,c as S,d as I,e as h,j as D}from"./chunk-XUGQU7PM.js";import{a as _}from"./chunk-64MNV6AB.js";import{c as g}from"./chunk-7S5E7KWT.js";function pe(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
2
+ FROM global_symbols gs
3
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
+ JOIN documents d ON der.document_id = d.id
5
+ WHERE ${n.where}
6
+ ${e.pathExclusionsFor("d")}
7
+ ${k(n.orderBy)}
8
+ ${w(n.limit)}`,...n.params??[])}function ye(e,n){return e.all(`SELECT
9
+ gs.id,
10
+ gs.symbol,
11
+ c.document_id,
12
+ MIN(c.start_line) AS start_line,
13
+ MAX(c.end_line) AS end_line,
14
+ d.relative_path,
15
+ gs.display_name,
16
+ gs.documentation
17
+ FROM global_symbols gs
18
+ JOIN mentions m ON m.symbol_id = gs.id
19
+ JOIN chunks c ON m.chunk_id = c.id
20
+ JOIN documents d ON c.document_id = d.id
21
+ WHERE m.role = 1
22
+ AND ${n.where}
23
+ ${e.pathExclusionsFor("d")}
24
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
25
+ ${k(n.orderBy)}
26
+ ${w(n.limit)}`,...n.params??[])}function k(e){return e?`ORDER BY ${e}`:""}function w(e){return typeof e=="number"?`LIMIT ${e}`:""}function $(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function C(e){if(!e)return null;let n=O(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let i=e.slice(t+1);return(O(i)??i).replace(/\n/g," ")}function O(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function j(e){if(m(e.symbol)!==null)return!1;let t=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(t)}function L(e,n,t={}){let i=new Map;for(let r of n)e.length>0&&!j(r)||i.set(r.id,r);for(let r of e)i.set(r.id,r);let o=[...i.values()];return t.sort?o.sort((r,s)=>r.start_line-s.start_line||r.end_line-s.end_line||r.symbol.localeCompare(s.symbol)):o}var W=g("file-definitions",{clearGroups:["definition-catalog"]}),Y=g("file-function-like-definitions",{clearGroups:["definition-catalog"]}),A=new WeakMap;function x(e,n){return W.get(e,n,()=>{let t=P(e,n);if(t)return t;let i=B(e,n),o=S(e),r=f(e,n);return o&&r&&h(e,"file-definitions",n,b(e,n,r),JSON.stringify({projectFingerprint:o,definitions:i.map(s=>({...s}))})),i})}function z(e,n){return Y.get(e,n,()=>{let t=P(e,n);return t?t.filter(i=>i.isFunctionLike):B(e,n,i=>i.isFunctionLike)})}function P(e,n){let t=S(e);if(!t)return null;let i=f(e,n);if(!i)return null;let o=I(e,"file-definitions",n,b(e,n,i));return o?G(o,t,n):null}function G(e,n,t){try{let i=JSON.parse(e);if(!D(i)||i.projectFingerprint!==n||!Array.isArray(i.definitions))return null;let o=[];for(let r of i.definitions){let s=K(r,t);if(!s)return null;o.push(s)}return o}catch{return null}}function K(e,n){return!D(e)||typeof e.symbolId!="number"||typeof e.symbol!="string"||typeof e.documentId!="number"||typeof e.startLine!="number"||typeof e.endLine!="number"||e.relativePath!==n||typeof e.leaf!="string"||typeof e.parentTypeName!="string"&&e.parentTypeName!==null||typeof e.isFunctionLike!="boolean"||typeof e.isTypeLike!="boolean"||typeof e.kind!="number"&&e.kind!==null||typeof e.documentation!="string"&&e.documentation!==null||typeof e.enclosingSymbol!="string"&&e.enclosingSymbol!==null?null:{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,endLine:e.endLine,relativePath:e.relativePath,leaf:e.leaf,parentTypeName:e.parentTypeName,isFunctionLike:e.isFunctionLike,isTypeLike:e.isTypeLike,kind:e.kind,documentation:e.documentation,enclosingSymbol:e.enclosingSymbol}}function B(e,n,t){let i=L(U(e,n),q(e,n),{sort:!0}).map(J);return t&&(i=i.filter(t)),v(e,n,i)}function U(e,n){return e.all(`SELECT
27
+ gs.id,
28
+ gs.symbol,
29
+ der.document_id,
30
+ der.start_line,
31
+ der.end_line,
32
+ d.relative_path,
33
+ gs.display_name,
34
+ gs.kind,
35
+ gs.documentation,
36
+ gs.enclosing_symbol
37
+ FROM global_symbols gs
38
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
39
+ JOIN documents d ON der.document_id = d.id
40
+ WHERE d.relative_path = ?
41
+ ${e.symbolNoiseFor("gs")}
42
+ ORDER BY der.start_line, der.end_line`,n)}function q(e,n){return e.all(`SELECT
43
+ gs.id,
44
+ gs.symbol,
45
+ c.document_id,
46
+ MIN(c.start_line) AS start_line,
47
+ MAX(c.end_line) AS end_line,
48
+ d.relative_path,
49
+ gs.display_name,
50
+ gs.kind,
51
+ gs.documentation,
52
+ gs.enclosing_symbol
53
+ FROM global_symbols gs
54
+ JOIN mentions m ON m.symbol_id = gs.id
55
+ JOIN chunks c ON m.chunk_id = c.id
56
+ JOIN documents d ON c.document_id = d.id
57
+ WHERE d.relative_path = ?
58
+ AND m.role = 1
59
+ ${e.symbolNoiseFor("gs")}
60
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
61
+ ORDER BY start_line, end_line`,n)}function J(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:E(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:M(e.symbol),isTypeLike:p(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function Ee(e,n={}){return X(e,n.scope)}function X(e,n){return _(e,{scope:n,includeIgnored:!1}).flatMap(t=>x(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function Me(e,n){return _(e,{scope:n,includeIgnored:!1}).flatMap(t=>z(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function Oe(e,n){let t=T(Z(e,n.scope,n.sqlPrefilter)),i=T(V(e,n.scope,n.sqlPrefilter)),o=new Set([...t.keys(),...i.keys()]),r=[];for(let s of[...o].sort()){if(e.isIgnored(s))continue;let l=L(t.get(s)??[],i.get(s)??[],{sort:!0}).filter(a=>n.symbolMatches(a.symbol));l.length!==0&&r.push(...v(e,s,l.map(J)))}return r}function Z(e,n,t){let i=n?"AND d.relative_path LIKE ?":"",o=t?`AND ${H("gs",t)}`:"",r=n?[`%${n}%`]:[];return e.all(`SELECT
62
+ gs.id,
63
+ gs.symbol,
64
+ der.document_id,
65
+ der.start_line,
66
+ der.end_line,
67
+ d.relative_path,
68
+ gs.display_name,
69
+ gs.kind,
70
+ gs.documentation,
71
+ gs.enclosing_symbol
72
+ FROM global_symbols gs
73
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
74
+ JOIN documents d ON der.document_id = d.id
75
+ WHERE 1 = 1
76
+ ${e.pathExclusionsFor("d")}
77
+ ${i}
78
+ ${o}
79
+ ${e.symbolNoiseFor("gs")}
80
+ ORDER BY d.relative_path, der.start_line, der.end_line`,...r)}function V(e,n,t){let i=n?"AND d.relative_path LIKE ?":"",o=t?`AND ${H("gs",t)}`:"",r=n?[`%${n}%`]:[];return e.all(`SELECT
81
+ gs.id,
82
+ gs.symbol,
83
+ c.document_id,
84
+ MIN(c.start_line) AS start_line,
85
+ MAX(c.end_line) AS end_line,
86
+ d.relative_path,
87
+ gs.display_name,
88
+ gs.kind,
89
+ gs.documentation,
90
+ gs.enclosing_symbol
91
+ FROM global_symbols gs
92
+ JOIN mentions m ON m.symbol_id = gs.id
93
+ JOIN chunks c ON m.chunk_id = c.id
94
+ JOIN documents d ON c.document_id = d.id
95
+ WHERE m.role = 1
96
+ ${e.pathExclusionsFor("d")}
97
+ ${i}
98
+ ${o}
99
+ ${e.symbolNoiseFor("gs")}
100
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
101
+ ORDER BY d.relative_path, start_line, end_line`,...r)}function ee(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function H(e,n){return n==="callable"?ee(e):ne(e)}function ne(e){return`${e}.symbol LIKE '%.'`}function T(e){let n=new Map;for(let t of e){let i=n.get(t.relative_path);i?i.push(t):n.set(t.relative_path,[t])}return n}function ke(e,n,t={}){if(n.length===0)return[];let i=n.flatMap(o=>x(e,o)).filter(o=>!e.isIgnored(o.relativePath));return t.onlyDocumented&&(i=i.filter(o=>o.documentation!==null&&o.documentation!=="")),t.sort&&(i=i.sort((o,r)=>o.relativePath.localeCompare(r.relativePath)||o.startLine-r.startLine||o.endLine-r.endLine)),i.map(o=>({startLine:o.startLine,endLine:o.endLine,symbol:o.symbol,shortName:F(o.symbol),signature:$(C(o.documentation)),relativePath:o.relativePath,enclosingSymbol:o.enclosingSymbol}))}function te(e){let n=new Map,t=e.map((i,o)=>({definition:i,index:o,span:i.endLine-i.startLine})).sort((i,o)=>i.span-o.span||i.index-o.index);for(let{definition:i}of t)for(let o=i.startLine;o<=i.endLine;o+=1)n.has(o)||n.set(o,i);return n}function we(e,n){let t=A.get(e);return t||(t=te(e),A.set(e,t)),t.get(n)??null}function $e(e,n){let t=x(e,n.relative_path).find(i=>i.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function v(e,n,t){let i=f(e,n),o=R(e,n);return o?ae(t,o,i):i?ie(t,i):t}function ie(e,n){let t=n.split(/\r?\n/),i=oe(e,t),o=re(e,i),r=se(o,t);return le(e,r)}function oe(e,n){let t=e.some(o=>y(o.symbol))?me(n):null,i=new Map;for(let o of e)i.set(o.symbolId,de(n,t,o));return i}function re(e,n){return e.filter(t=>y(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,i)=>t.startLine-i.startLine||t.definition.startLine-i.definition.startLine||t.definition.symbol.localeCompare(i.definition.symbol))}function se(e,n){let t=new Map;for(let i=0;i<e.length;i+=1){let o=e[i],r=e[i+1],s=r?Math.max(o.startLine,r.startLine-1):n.length-1;t.set(o.definition.symbolId,{startLine:o.startLine,endLine:ue(n,o.definition,o.startLine,s)})}return t}function le(e,n){return e.map(t=>{let i=n.get(t.symbolId);return i?{...t,startLine:i.startLine,endLine:i.endLine}:t})}function ae(e,n,t=null){let i=new Map;for(let o of n){let r=i.get(o.name);r?r.push(o):i.set(o.name,[o])}return e.map(o=>{if(!ce(o)||!o.leaf)return Q(o,t);let r=i.get(o.leaf);if(!r||r.length===0)return Q(o,t);let s=r[0],l=Math.abs(s.startLine-o.startLine);for(let a=1;a<r.length;a+=1){let c=r[a],d=Math.abs(c.startLine-o.startLine);d<l&&(s=c,l=d)}return{...o,startLine:s.startLine,endLine:s.endLine}})}function ce(e){return y(e.symbol)?!0:p(e.symbol)==="term"&&m(e.symbol)===null}function Q(e,n){if(!n||!e.leaf||p(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),r=n.split(/\r?\n/).findIndex(s=>i.test(s));return r>=0?{...e,startLine:r,endLine:r}:e}function de(e,n,t){if(!y(t.symbol))return t.startLine;let i=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return i;let o=n.get(t.leaf);if(!o||o.length===0)return i;let r=null;for(let s of o){let l=Math.abs(s-t.startLine);(!r||l<r.distance)&&(r={line:s,distance:l})}return r?.line??i}function me(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,o=/\b([A-Za-z_$][\w$]*)\s*\(/g,r=new Map,s=(l,a)=>{let c=r.get(l);if(!c){r.set(l,[a]);return}c[c.length-1]!==a&&c.push(a)};for(let l=0;l<e.length;l+=1){let a=e[l]??"";for(let d of a.matchAll(n))d[1]&&s(d[1],l);for(let d of a.matchAll(t))d[1]&&s(d[1],l);let c=a.match(i);c?.[1]&&s(c[1],l);for(let d of a.matchAll(o))d[1]&&s(d[1],l)}return r}function ue(e,n,t,i){let o=Math.max(t,Math.min(e.length-1,i)),r=Math.max(t,Math.min(o,n.endLine)),s=0,l=0,a=!1;for(let c=t;c<=o;c+=1){let d=fe(e[c]??"");for(let u of d)u==="{"?(s+=1,a=!0):u==="}"?s=Math.max(0,s-1):u==="("?l+=1:u===")"&&(l=Math.max(0,l-1));if(a&&s===0||!a&&l===0&&c>=r)return c}return r}function fe(e){let n="",t=null,i=!1;for(let o=0;o<e.length;o+=1){let r=e[o],s=e[o+1];if(!t&&r==="/"&&s==="/"){n+=" ".repeat(e.length-o);break}if(t){if(i){i=!1,n+=" ";continue}if(r==="\\"){i=!0,n+=" ";continue}r===t&&(t=null),n+=" ";continue}if(r==='"'||r==="'"||r==="`"){t=r,n+=" ";continue}n+=r}return n}function y(e){return e.includes("().")}function Ce(e){let n=N(e);if("kind"in n)return[];let t=[];for(let i=n.descriptors.length-2;i>=0;i-=1){let o=n.descriptors[i];o?.suffix==="type"&&o.name&&t.push(o.name)}return t}export{pe as a,ye as b,$ as c,C as d,L as e,x as f,Ee as g,X as h,Me as i,Oe as j,ke as k,te as l,we as m,$e as n,Ce as o};
102
+ //# sourceMappingURL=chunk-2KHTSEIL.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-RYXW3KRC.js";import{c as u}from"./chunk-4KTOV4QN.js";import{a as p}from"./chunk-PTQVNJ4Q.js";import{b as a}from"./chunk-P5RYBRIO.js";import{c as l,d as c,h as f}from"./chunk-JM72FNGA.js";import{a as d}from"./chunk-64MNV6AB.js";function J(e,s,t={}){return I(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function P(e,s){let t=N(e,s);return t.length>0?t:E(e,s)}function v(e,s,t={}){return I(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function N(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
1
+ import{a as g}from"./chunk-7B6LP46R.js";import{c as u}from"./chunk-OLTESY4K.js";import{a as p}from"./chunk-TK7O5ER5.js";import{b as a}from"./chunk-P5RYBRIO.js";import{c as l,d as c,h as f}from"./chunk-JM72FNGA.js";import{a as d}from"./chunk-64MNV6AB.js";function J(e,s,t={}){return I(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function P(e,s){let t=N(e,s);return t.length>0?t:E(e,s)}function v(e,s,t={}){return I(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function N(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d ON c.document_id = d.id
@@ -32,4 +32,4 @@ import{a as g}from"./chunk-RYXW3KRC.js";import{c as u}from"./chunk-4KTOV4QN.js";
32
32
  WHERE imp_d.relative_path = ?
33
33
  AND m.role = 2
34
34
  ORDER BY def_d.relative_path, gs.symbol`,s).filter(m=>!e.isIgnored(m.importer));if(o.length>0){let m=t.semantic===!1?[]:u(e,s);return o.map(i=>({symbol:i.symbol,shortName:l(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||m.some(n=>n.isUsed&&n.sourcePath===i.from_file)}))}return null}function F(e,s){let t=u(e,s);return t.length>0?t.map(r=>{let o=h(r.importedName,r.localName,r.kind);return{symbol:o,shortName:o,fromFile:r.sourcePath??"(external)",importer:s,used:r.kind==="side-effect"?!0:r.isUsed}}):null}function O(e,s){return a(e,s).map(t=>{let r=h(t.importedName,t.localName,t.kind),o=t.kind==="side-effect"?!0:t.used;return{symbol:r,shortName:r,fromFile:t.sourcePath??"(external)",importer:s,used:o}})}function h(e,s,t){return t==="namespace"&&e==="*"&&s?`* as ${s}`:t==="default"&&s?`default as ${s}`:t==="side-effect"?"(side effect import)":s&&s!==e?`${e} as ${s}`:e}function b(e){return e.replace(/\\/g,"/")}function R(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{J as a,P as b,v as c};
35
- //# sourceMappingURL=chunk-CCKPYPDI.js.map
35
+ //# sourceMappingURL=chunk-4UZO3XCV.js.map
@@ -1,4 +1,4 @@
1
- import{b as m}from"./chunk-RYXW3KRC.js";import{j as o}from"./chunk-4N4WONI4.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
1
+ import{b as m}from"./chunk-7B6LP46R.js";import{k as o}from"./chunk-2KHTSEIL.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
2
2
  WHERE relative_path IN (${d})
3
3
  ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
4
4
  FROM mentions m
@@ -32,4 +32,4 @@ import{b as m}from"./chunk-RYXW3KRC.js";import{j as o}from"./chunk-4N4WONI4.js";
32
32
  WHERE d2.relative_path IN (${d})
33
33
  AND d1.relative_path NOT IN (${d})
34
34
  ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{h as a};
35
- //# sourceMappingURL=chunk-MMLZEGMS.js.map
35
+ //# sourceMappingURL=chunk-54KGX7EX.js.map
@@ -1,8 +1,8 @@
1
- import{f as H,i as O}from"./chunk-FRPEPTYJ.js";import{d as D}from"./chunk-YWOOQ4FF.js";import{b as _,d as T,h as E,i as L}from"./chunk-DQVKIG3D.js";import{a as w}from"./chunk-GBEYTDY5.js";import{c as C,d as F}from"./chunk-JM72FNGA.js";var V=5;function re(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??T(e,{base:a}),l={available:s.note!==_,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new w(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),z=t.baseContentAt??E(e.config.projectRoot,a,L(s)),h=X(x,k,$,z);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let j=x.calleeMap(R,{semantic:f}),q=R.map(i=>({def:i,callees:O((j.get(i.symbolId)??[]).map(p=>p.symbol))})),M,B=()=>(M??=H(e,{minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of q){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=B(),N=W(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Y(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=G({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>A(S.migrationScope)-A(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,V)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function G(e){let t=[],a=J(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=D(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=K(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function A(e){return e==="same-scope"?2:e==="unknown"?1:0}function J(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function K(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var U=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!U.has(t))}function W(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function X(e,t,a,o){return e.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${Z(r.leaf)}\\b`).test(c)})}function Y(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
1
+ import{g as H,j as O}from"./chunk-CW5YFOCP.js";import{d as D}from"./chunk-YWOOQ4FF.js";import{b as _,d as T,h as E,i as L}from"./chunk-NOJAM5ZV.js";import{a as w}from"./chunk-5OST6GYB.js";import{c as C,d as F}from"./chunk-JM72FNGA.js";var V=5;function re(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??T(e,{base:a}),l={available:s.note!==_,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new w(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),z=t.baseContentAt??E(e.config.projectRoot,a,L(s)),h=X(x,k,$,z);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let j=x.calleeMap(R,{semantic:f}),q=R.map(i=>({def:i,callees:O((j.get(i.symbolId)??[]).map(p=>p.symbol))})),M,B=()=>(M??=H(e,{minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of q){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=B(),N=W(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Y(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=G({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>A(S.migrationScope)-A(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,V)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function G(e){let t=[],a=J(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=D(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=K(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function A(e){return e==="same-scope"?2:e==="unknown"?1:0}function J(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function K(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var U=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!U.has(t))}function W(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function X(e,t,a,o){return e.productionCallableDefinitions({files:[...t],requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${Z(r.leaf)}\\b`).test(c)})}function Y(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents ref_d ON c.document_id = ref_d.id
5
5
  WHERE m.symbol_id = ?
6
6
  AND m.role != 1
7
7
  ${e.pathExclusionsFor("ref_d")}`,t).map(o=>o.relative_path)}function Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{re as a};
8
- //# sourceMappingURL=chunk-2VM46FC5.js.map
8
+ //# sourceMappingURL=chunk-5GOLFJEO.js.map
@@ -0,0 +1,2 @@
1
+ import{b as R,f as B,g as j}from"./chunk-C5CTSJ6X.js";import{a as F}from"./chunk-BGBBVSH4.js";import{b as J,c as Q,d as U}from"./chunk-RNM6LMCF.js";import{c as z}from"./chunk-JCLDUKT6.js";import{a as H,j as W,k as Y,m as M,n as _}from"./chunk-KDFONWTW.js";import{a as A}from"./chunk-VUKC6F77.js";import{f as h,h as V,i as G,j as O}from"./chunk-2KHTSEIL.js";import{f as C,g as q,i as E,j as K}from"./chunk-JM72FNGA.js";import{a as P,f as g}from"./chunk-72KY2ZFO.js";import{a as S,b as N}from"./chunk-HF25DFSC.js";import{a as k,d as y}from"./chunk-DS6QEB3G.js";import{c as w}from"./chunk-A536TEU4.js";import{a as T}from"./chunk-64MNV6AB.js";function X(t,e,i){let o=e.identifierResolution==="strict"?M:_,s=e.candidateNames?W(e.candidateNames):null;for(let n of e.paths)if(!(!S(n)&&!(e.includeVueSfc&&N(n)))&&!t.isIgnored(n)&&!e.skipPath?.(n))try{if(s&&!Y(k(t,n),s))continue;let d=(a,c,p,b)=>{if(e.candidateNames&&!e.candidateNames.has(a))return;let D=e.resolveTargets?e.resolveTargets({sourceFile:n,name:a,kind:c,defaultTargets:b}):b();for(let I of D)i({sourceFile:n,name:a,target:I,occurrences:p,kind:c})},m=H(t,n);for(let[a,c]of m)d(a,"identifier",c.length,()=>o(t,n,a));for(let a of g(t,n,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let c=a.kind==="cross-language-dispatch"?()=>M(t,n,a.name):()=>o(t,n,a.name);d(a.name,a.kind,a.occurrences,c)}}finally{e.afterPath?.(n)}}function Z(t,e={}){let{scope:i,files:o,minLoc:s=1,maxLoc:n=Number.POSITIVE_INFINITY,excludeSymbol:f,excludeEntrySurfaces:d=!1,excludeTypesFiles:m=!1,excludeRootedSymbols:a=!1,requireFunctionLikeSymbol:c=!1,requireCallableSymbol:p=!1,excludeRustTraitImplMembers:b=!1,includeSuppressed:D=!1,sortByLocDesc:I=!1}=e,x=[],ee=ie(t,{scope:i,files:o,requireCallableSymbol:p}),L=new Map,v=new Map,ne=r=>{let l=L.get(r);if(l!==void 0)return l;let u=B(t,r);return L.set(r,u),u},te=r=>{let l=v.get(r);if(l!==void 0)return l;let u=R(r);return v.set(r,u),u};for(let r of ee){let l=r.relativePath;if(t.isIgnored(l)||d&&ne(l)||!re(r,{requireFunctionLikeSymbol:c,requireCallableSymbol:p})||f!==void 0&&r.symbol===f)continue;let u=F(r);u<s||u>n||m&&oe(l)||a&&j(t,r.symbol,l)||b&&E(r.symbol)||te(l)!=="test"&&(K(r.symbol)||!D&&y(t,l,r.startLine)||x.push(r))}return I?x.sort((r,l)=>F(l)-F(r)):x}function ie(t,e){return e.files!==void 0?[...new Set(e.files.map(o=>o.replace(/\\/g,"/")))].sort().filter(o=>!e.scope||o.includes(e.scope)).flatMap(o=>h(t,o)):e.requireCallableSymbol?O(t,{scope:e.scope,symbolMatches:C,sqlPrefilter:"callable"}):G(t,e.scope)}function re(t,e){return e.requireCallableSymbol?C(t.symbol):e.requireFunctionLikeSymbol?q(t.symbol):t.isFunctionLike}function oe(t){return(t.split("/").pop()??"").includes("types")}var $=class{constructor(e){this.db=e}db;scopedDefinitions(e){return V(this.db,e)}definitionsForFile(e){return h(this.db,e)}productionCallableDefinitions(e={}){return Z(this.db,e)}calleeMap(e,i={}){return z(this.db,e,i)}crossFileCallerMap(e,i={}){return J(this.db,e,i)}sourceFallbackCallerFiles(e){return Q(this.db,e)}callerFileMap(e,i={}){return U(this.db,e,i)}frameworkReferencedSymbolIds(e){let i=new Map;for(let s of e){if(!s.leaf)continue;let n=i.get(s.leaf)??[];n.push(s.symbolId),i.set(s.leaf,n)}let o=new Set;for(let s of T(this.db,{includeIgnored:!1}))if(S(s)==="rust")for(let{name:n}of g(this.db,s,{includeRustAttributeNames:!0}))for(let f of i.get(n)??[])o.add(f);return o}symbolsWithNonSelfCallees(e,i={}){if(e.length===0)return new Set;let o=new Map(e.map(n=>[n.symbolId,n.symbol])),s=this.calleeMap(e,i);return new Set([...s.entries()].filter(([n,f])=>{let d=o.get(n);return f.some(m=>m.symbol!==d)}).map(([n])=>n))}fileDependencyGraph(e){return A(this.db,e)}fileKind(e){return R(e)}hasSuppressionComment(e){return y(this.db,e.relativePath,e.startLine)}sourceFiles(){return w(this.db)}scanSourceReferences(e,i){X(this.db,e,i)}callableSignature(e){let i=P(this.db,e.relativePath)?.callables.find(o=>o.startLine===e.startLine&&o.endLine===e.endLine);return i?{paramCount:i.paramCount}:null}};export{$ as a};
2
+ //# sourceMappingURL=chunk-5OST6GYB.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-GBEYTDY5.js";import{a as i}from"./chunk-PTQVNJ4Q.js";import{c as s,e as o,k as m}from"./chunk-JM72FNGA.js";function L(t,l){let r=i(t,l);return r?new a(t).definitionsForFile(r.relativePath).filter(e=>e.symbol!==r.symbol).filter(e=>m(r.symbol,e.symbol)).sort((e,n)=>e.startLine-n.startLine||e.endLine-n.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{L as a};
2
- //# sourceMappingURL=chunk-2UYQLFVC.js.map
1
+ import{a}from"./chunk-5OST6GYB.js";import{a as i}from"./chunk-TK7O5ER5.js";import{c as s,e as o,k as m}from"./chunk-JM72FNGA.js";function L(t,l){let r=i(t,l);return r?new a(t).definitionsForFile(r.relativePath).filter(e=>e.symbol!==r.symbol).filter(e=>m(r.symbol,e.symbol)).sort((e,n)=>e.startLine-n.startLine||e.endLine-n.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{L as a};
2
+ //# sourceMappingURL=chunk-6GN7FXCH.js.map
@@ -1,7 +1,7 @@
1
- import{a as u}from"./chunk-GBEYTDY5.js";import{a as b}from"./chunk-PTQVNJ4Q.js";import{u as l}from"./chunk-OBGRLXWF.js";import{c as m}from"./chunk-JM72FNGA.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
1
+ import{a as u}from"./chunk-5OST6GYB.js";import{a as b}from"./chunk-TK7O5ER5.js";import{u as l}from"./chunk-OBGRLXWF.js";import{c as m}from"./chunk-JM72FNGA.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
2
2
  `).slice(r,t+1).join(`
3
3
  `)}catch{return""}}function S(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
4
4
  FROM mentions m
5
5
  JOIN chunks c ON m.chunk_id = c.id
6
6
  WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function L(e,n){return new Set(e.filter(r=>r.file!==n).map(r=>r.symbol)).size}function P(e,n){let r=l(e),t=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=r.match(o);s&&(t+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}return t}export{O as a};
7
- //# sourceMappingURL=chunk-7UQWUVRG.js.map
7
+ //# sourceMappingURL=chunk-6IR2AOBM.js.map
@@ -1,4 +1,4 @@
1
- import{g as p}from"./chunk-4N4WONI4.js";import{a as f,c as g,e as l}from"./chunk-JM72FNGA.js";import{a as c}from"./chunk-64MNV6AB.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},d=new Map;for(let[e,r]of Object.entries(m))d.set(r.toLowerCase(),Number(e));var b=500;function _(e){let r=parseInt(e,10);if(!isNaN(r))return r;let t=e.toLowerCase(),n=d.get(t);if(n!==void 0)return n;for(let[i,o]of d)if(i.includes(t))return o;return null}function O(e,r,t={}){let{scope:n,limit:i=100}=t,o=_(r);return o===null?[]:h(e,n).map(s=>({row:s,resolvedKind:N(s)})).filter(s=>s.resolvedKind===o).slice(0,i).map(({row:s,resolvedKind:u})=>({symbol:s.symbol,shortName:g(s.symbol),kind:u,kindName:m[u]??"Unknown",relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line}))}function P(e,r={}){let t=k(e,r.scope);for(let n of S(e,r.scope)){let i=N(n);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((n,i)=>i[1]-n[1]||n[0]-i[0]).map(([n,i])=>({kind:n,kindName:m[n]??"Unknown",count:i}))}function h(e,r){return p(e,{scope:r}).map(K)}function k(e,r){let t=new Map;for(let n of y(c(e,{scope:r,includeIgnored:!1}))){let i=n.map(()=>"?").join(", "),o=e.all(`SELECT gs.kind AS kind, COUNT(*) AS count
1
+ import{g as p}from"./chunk-2KHTSEIL.js";import{a as f,c as g,e as l}from"./chunk-JM72FNGA.js";import{a as c}from"./chunk-64MNV6AB.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},d=new Map;for(let[e,r]of Object.entries(m))d.set(r.toLowerCase(),Number(e));var b=500;function _(e){let r=parseInt(e,10);if(!isNaN(r))return r;let t=e.toLowerCase(),n=d.get(t);if(n!==void 0)return n;for(let[i,o]of d)if(i.includes(t))return o;return null}function O(e,r,t={}){let{scope:n,limit:i=100}=t,o=_(r);return o===null?[]:h(e,n).map(s=>({row:s,resolvedKind:N(s)})).filter(s=>s.resolvedKind===o).slice(0,i).map(({row:s,resolvedKind:u})=>({symbol:s.symbol,shortName:g(s.symbol),kind:u,kindName:m[u]??"Unknown",relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line}))}function P(e,r={}){let t=k(e,r.scope);for(let n of S(e,r.scope)){let i=N(n);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((n,i)=>i[1]-n[1]||n[0]-i[0]).map(([n,i])=>({kind:n,kindName:m[n]??"Unknown",count:i}))}function h(e,r){return p(e,{scope:r}).map(K)}function k(e,r){let t=new Map;for(let n of y(c(e,{scope:r,includeIgnored:!1}))){let i=n.map(()=>"?").join(", "),o=e.all(`SELECT gs.kind AS kind, COUNT(*) AS count
2
2
  FROM defn_enclosing_ranges der
3
3
  JOIN global_symbols gs ON der.symbol_id = gs.id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -20,4 +20,4 @@ import{g as p}from"./chunk-4N4WONI4.js";import{a as f,c as g,e as l}from"./chunk
20
20
  ${e.symbolNoiseFor("gs")}
21
21
  AND d.relative_path IN (${i})
22
22
  ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...n))}return t}function y(e){let r=[];for(let t=0;t<e.length;t+=b)r.push(e.slice(t,t+b));return r}function K(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function N(e){return e.kind!==null&&e.kind!==0?M(e.kind,e.symbol,e.documentation):R(e.symbol,e.documentation,e.enclosing_symbol)}function M(e,r,t){let n=(t??"").toLowerCase();if(l(r)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function R(e,r,t){let n=f(e);if("kind"in n)return null;let i=n.descriptors,o=i[i.length-2]??null,a=l(e),s=(r??"").toLowerCase();return a==="type"?s.includes("type ")?76:s.includes("interface ")?27:s.includes("struct ")?68:s.includes("trait ")?73:(s.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:s.includes("async def ")||s.includes("def ")?23:(t?l(t):o?.suffix??null)==="type"?21:83}export{O as a,P as b};
23
- //# sourceMappingURL=chunk-QX7LLCGB.js.map
23
+ //# sourceMappingURL=chunk-6JRV4MY2.js.map
@@ -1,4 +1,4 @@
1
- import{a as s}from"./chunk-RYXW3KRC.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
1
+ import{a as s}from"./chunk-7B6LP46R.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -30,4 +30,4 @@ import{a as s}from"./chunk-RYXW3KRC.js";function m(e,d){let i=s(e,d);return i?e.
30
30
  WHERE d2.relative_path = ?
31
31
  AND d1.relative_path != ?
32
32
  ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{m as a,o as b};
33
- //# sourceMappingURL=chunk-IPQTC36U.js.map
33
+ //# sourceMappingURL=chunk-6LJHXREW.js.map
@@ -1,4 +1,4 @@
1
- import{a as y}from"./chunk-GBEYTDY5.js";import{b}from"./chunk-C5CTSJ6X.js";import{c as D}from"./chunk-4KTOV4QN.js";import{b as p}from"./chunk-P5RYBRIO.js";import{a as h}from"./chunk-64MNV6AB.js";import g from"path";function d(e){let n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n.length<=1?"(root)":n.length>=3&&["src","lib","app","server","client"].includes(n[0])?`${n[0]}/${n[1]}`:n[0]}function S(e,t){if(e===t)return"ok";let n=m(e),i=m(t);return n&&i?k(n,i)?"ok":"violation":x(e,t)}function v(e,t){let n=m(d(e)),i=m(d(t));return!!n&&!!i}function m(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function k(e,t){return t==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","semantic","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(t)??!1}function x(e,t){if(t==="shared")return"ok";let n={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return n[e]?n[e].has(t)?"ok":"violation":null}function Z(e,t){let{scope:n,minDeviation:i=5}=t??{},r=t?.semantic!==!1,s=t?.includePatternDeviations!==!1,o=new y(e).fileDependencyGraph(n);return M([...$(e,o,{scope:n,semantic:r}),...P(o),...s?_(o,i):[]])}function $(e,t,n){let i=N(e,n.scope),r=[],s=new Set;for(let[o,a]of t){if(l(o))continue;let u=i.get(o)??new Set;for(let f of a)l(f)||u.has(f)||I(e,o,f,n)||(r.push({file:o,dep:f}),s.add(o))}s.size>0&&A(e,i,{paths:[...s]});let c=[];for(let{file:o,dep:a}of r)(i.get(o)??new Set).has(a)||c.push({file:o,kind:"unused-import",description:`Depends on ${a} but references none of its symbols`,dep:a,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${o} to ${a}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return c}function I(e,t,n,i){return i.semantic&&B(e,t,n)||V(e,t,n)||q(e,t,n)||j(n)||U(e,t,n)?!0:J(n)}function P(e){let t=[],n=L(e);for(let[i,r]of e){if(l(i))continue;let s=d(i);for(let c of r){if(l(c))continue;let o=d(c);if(s===o)continue;let a=S(s,o),u=a?"explicit":"inferred";if((a??n.get(`${s}->${o}`))==="violation"){let R=u==="explicit"?"direct":"signal";t.push({file:i,kind:"layer-violation",description:`Imports from ${o}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${o}/`,actionTier:R,policyBasis:u,evidenceReasons:[`dependency edge exists from ${i} to ${c}`,u==="explicit"?`explicit layer policy rejects ${s}/ -> ${o}/`:`rare cross-layer edge ${s}/ -> ${o}/ is inferred as a violation`],recommendation:u==="explicit"?"Move the dependency behind an allowed layer boundary or document a policy change.":"Review whether this is a real boundary break or an intentional exception before moving code."})}}}return t}function _(e,t){let n=[];for(let[i,r]of O(e)){let s=r.filter(o=>!l(o));if(s.length<t)continue;let c=E(e,s);for(let o of s)for(let a of e.get(o)??[])l(a)||(c.get(a)??0)===1&&g.dirname(a)!==i&&g.dirname(a)!==g.dirname(i)&&(v(o,a)||n.push({file:o,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${a}`,dep:a,actionTier:"signal",evidenceReasons:[`${s.length} sibling file(s) in ${i}/ were compared`,`${o} is the only non-skipped sibling depending on ${a}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."}))}return n}function M(e){return{results:e,unusedImports:e.filter(t=>t.kind==="unused-import").length,layerViolations:e.filter(t=>t.kind==="layer-violation").length,patternDeviations:e.filter(t=>t.kind==="pattern-deviation").length}}function O(e){let t=new Map;for(let n of e.keys()){let i=g.dirname(n),r=t.get(i);r||(r=[],t.set(i,r)),r.push(n)}return t}function E(e,t){let n=new Map;for(let i of t)for(let r of e.get(i)??[])l(r)||n.set(r,(n.get(r)??0)+1);return n}function N(e,t){let n=new Map;return F(e,n,t),n}function F(e,t,n){for(let i of T(e,n))w(e,t,i.from_file,i.to_file)}function T(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
1
+ import{a as y}from"./chunk-5OST6GYB.js";import{b}from"./chunk-C5CTSJ6X.js";import{c as D}from"./chunk-OLTESY4K.js";import{b as p}from"./chunk-P5RYBRIO.js";import{a as h}from"./chunk-64MNV6AB.js";import g from"path";function d(e){let n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n.length<=1?"(root)":n.length>=3&&["src","lib","app","server","client"].includes(n[0])?`${n[0]}/${n[1]}`:n[0]}function S(e,t){if(e===t)return"ok";let n=m(e),i=m(t);return n&&i?k(n,i)?"ok":"violation":x(e,t)}function v(e,t){let n=m(d(e)),i=m(d(t));return!!n&&!!i}function m(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function k(e,t){return t==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","semantic","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(t)??!1}function x(e,t){if(t==="shared")return"ok";let n={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return n[e]?n[e].has(t)?"ok":"violation":null}function Z(e,t){let{scope:n,minDeviation:i=5}=t??{},r=t?.semantic!==!1,s=t?.includePatternDeviations!==!1,o=new y(e).fileDependencyGraph(n);return M([...$(e,o,{scope:n,semantic:r}),...P(o),...s?_(o,i):[]])}function $(e,t,n){let i=N(e,n.scope),r=[],s=new Set;for(let[o,a]of t){if(l(o))continue;let u=i.get(o)??new Set;for(let f of a)l(f)||u.has(f)||I(e,o,f,n)||(r.push({file:o,dep:f}),s.add(o))}s.size>0&&A(e,i,{paths:[...s]});let c=[];for(let{file:o,dep:a}of r)(i.get(o)??new Set).has(a)||c.push({file:o,kind:"unused-import",description:`Depends on ${a} but references none of its symbols`,dep:a,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${o} to ${a}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return c}function I(e,t,n,i){return V(e,t,n)||q(e,t,n)||j(n)||U(e,t,n)||J(n)?!0:i.semantic&&B(e,t,n)}function P(e){let t=[],n=L(e);for(let[i,r]of e){if(l(i))continue;let s=d(i);for(let c of r){if(l(c))continue;let o=d(c);if(s===o)continue;let a=S(s,o),u=a?"explicit":"inferred";if((a??n.get(`${s}->${o}`))==="violation"){let R=u==="explicit"?"direct":"signal";t.push({file:i,kind:"layer-violation",description:`Imports from ${o}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${o}/`,actionTier:R,policyBasis:u,evidenceReasons:[`dependency edge exists from ${i} to ${c}`,u==="explicit"?`explicit layer policy rejects ${s}/ -> ${o}/`:`rare cross-layer edge ${s}/ -> ${o}/ is inferred as a violation`],recommendation:u==="explicit"?"Move the dependency behind an allowed layer boundary or document a policy change.":"Review whether this is a real boundary break or an intentional exception before moving code."})}}}return t}function _(e,t){let n=[];for(let[i,r]of O(e)){let s=r.filter(o=>!l(o));if(s.length<t)continue;let c=E(e,s);for(let o of s)for(let a of e.get(o)??[])l(a)||(c.get(a)??0)===1&&g.dirname(a)!==i&&g.dirname(a)!==g.dirname(i)&&(v(o,a)||n.push({file:o,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${a}`,dep:a,actionTier:"signal",evidenceReasons:[`${s.length} sibling file(s) in ${i}/ were compared`,`${o} is the only non-skipped sibling depending on ${a}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."}))}return n}function M(e){return{results:e,unusedImports:e.filter(t=>t.kind==="unused-import").length,layerViolations:e.filter(t=>t.kind==="layer-violation").length,patternDeviations:e.filter(t=>t.kind==="pattern-deviation").length}}function O(e){let t=new Map;for(let n of e.keys()){let i=g.dirname(n),r=t.get(i);r||(r=[],t.set(i,r)),r.push(n)}return t}function E(e,t){let n=new Map;for(let i of t)for(let r of e.get(i)??[])l(r)||n.set(r,(n.get(r)??0)+1);return n}function N(e,t){let n=new Map;return F(e,n,t),n}function F(e,t,n){for(let i of T(e,n))w(e,t,i.from_file,i.to_file)}function T(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -15,4 +15,4 @@ import{a as y}from"./chunk-GBEYTDY5.js";import{b}from"./chunk-C5CTSJ6X.js";impor
15
15
  AND m.role != 1
16
16
  ${e.pathExclusionsFor("d1","d2")}
17
17
  ${n}`)}function A(e,t,n={}){new y(e).scanSourceReferences({paths:n.paths??h(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},r=>{r.target.relativePath!==r.sourceFile&&(e.isIgnored(r.target.relativePath)||w(e,t,r.sourceFile,r.target.relativePath))})}function w(e,t,n,i){if(e.isIgnored(n)||e.isIgnored(i))return;let r=t.get(n);r||(r=new Set,t.set(n,r)),r.add(i)}function L(e){let t=new Map;for(let[i,r]of e){if(l(i))continue;let s=d(i);for(let c of r){if(l(c))continue;let o=d(c);if(s===o||S(s,o))continue;let a=`${s}->${o}`;t.set(a,(t.get(a)??0)+1)}}let n=new Map;for(let[i,r]of t)n.set(i,r<=2?"violation":"ok");return n}function j(e){return e.includes("types")||e.endsWith(".d.ts")}function B(e,t,n){let i=D(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.some(r=>r.isUsed)}function V(e,t,n){let i=p(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.some(r=>r.used)}function q(e,t,n){let i=p(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.every(r=>r.isTypeOnly===!0)}function J(e){return e.endsWith(".vue")}function U(e,t,n){let i=p(e,t).filter(r=>r.sourcePath===n);return i.length===0?!1:i.every(r=>r.kind==="side-effect"||r.kind==="namespace"&&r.usedMembers.length===0&&!r.used)}function l(e){let t=b(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||z(g.basename(e)))}function z(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{Z as a};
18
- //# sourceMappingURL=chunk-CZ425R2B.js.map
18
+ //# sourceMappingURL=chunk-6QSOCTZT.js.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-PTQVNJ4Q.js";import{a as c}from"./chunk-64MNV6AB.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
2
- //# sourceMappingURL=chunk-RYXW3KRC.js.map
1
+ import{a as u}from"./chunk-TK7O5ER5.js";import{a as c}from"./chunk-64MNV6AB.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
2
+ //# sourceMappingURL=chunk-7B6LP46R.js.map
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-7B6LP46R.js";import{k as e}from"./chunk-2KHTSEIL.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-7GO4EQF5.js.map
@@ -0,0 +1,7 @@
1
+ import{a as C,b as E}from"./chunk-GRJY65YT.js";import{a as _}from"./chunk-LM5SHAN4.js";import{a as P}from"./chunk-PFOCOG57.js";import{a as w}from"./chunk-B75HZHUP.js";import{a as k}from"./chunk-5OST6GYB.js";import{a as v}from"./chunk-BGBBVSH4.js";import{e as I}from"./chunk-RNM6LMCF.js";import{a as y}from"./chunk-KDFONWTW.js";import{b as L}from"./chunk-TQ5W2H3S.js";import{m as x}from"./chunk-2KHTSEIL.js";import{c as d,d as D,j as S}from"./chunk-JM72FNGA.js";import{basename as f,extname as g}from"path";function ne(t,n){let{scope:e,maxLoc:i=15,limit:a=30,scanLimit:o}=n??{},r=new k(t),l=B(r.fileDependencyGraph(e));return P({candidates:()=>T(r,e,i),orderCandidates:w,scanLimit:o,prepare:s=>({callerFileMap:W(t,r,s,{semantic:n?.semantic!==!1}),reverseFanIn:l}),evaluate:(s,c)=>R(t,r,s,c),orderResults:(s,c)=>c.callerFanIn-s.callerFanIn||c.loc-s.loc,limit:a})}function W(t,n,e,i){let a=C(n,e,{semantic:!1,sourceFallback:!1}),o=[];i.semantic&&L("wrapper.semantic-candidates",()=>{o=e.filter(u=>F(t,n,u,a).length<=1)},()=>({symbols:e.length,semanticCandidates:o.length}));let r=o.length===0?new Map:C(n,o,{semantic:!0,sourceFallback:!1}),l=r.size===0?a:I(a,r),s=new Map(e.map(u=>[u.symbolId,u])),c=new Map;for(let u of e){let b=F(t,n,u,l);if(b.length>1||(c.set(u.symbolId,u),b.length!==1))continue;let h=b[0],M=N(t,u.symbolId,h);if(!M)continue;let p=j(n,t,h,u.symbol,M);p?.isFunctionLike&&s.has(p.symbolId)&&c.set(p.symbolId,s.get(p.symbolId))}let m=[...c.values()];return m.length===0?l:I(l,n.sourceFallbackCallerFiles(m))}function R(t,n,e,i){let a=F(t,n,e,i.callerFileMap);if(a.length!==1)return null;let o=a[0],r=N(t,e.symbolId,o);if(!r)return null;let l=j(n,t,o,e.symbol,r);if(l&&S(l.symbol))return null;let{fanIn:s,source:c}=A(i.callerFileMap,i.reverseFanIn,o,l);if(c==="function"?s<=3:s<=5)return null;let m=q(t,e,o,l);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:v(e),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?d(l.symbol):f(o),callerFanIn:s,actionTier:m.length>0?"signal":"direct",boundaryEvidence:m}}function T(t,n,e){return t.productionCallableDefinitions({scope:n,minLoc:2,maxLoc:e,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0})}function F(t,n,e,i){let a=f(e.relativePath,g(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>f(r,g(r))!==a).filter(r=>{let l=n.fileKind(r);return l!=="barrel"&&l!=="entry"&&l!=="test"});return E(t,e,o).realConsumers}function N(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 j(t,n,e,i,a){let o=t.definitionsForFile(e),r=O(n,e,i,a.start_line,a.end_line);return x(o,r)}function A(t,n,e,i){if(i?.isFunctionLike){let a=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(a.length>0)return{fanIn:a.length,source:"function"}}return{fanIn:J(n,e),source:"file"}}function O(t,n,e,i,a){let o=D(e);if(!o)return i;let r=y(t,n).get(o);if(!r||r.length===0)return i;for(let l of r)if(l>=i&&l<=a)return l;return i}function B(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let a of i)n.set(a,(n.get(a)??0)+1)}return n}function J(t,n){let e=t.get(n)??0;if(e>0)return e;let i=f(n,g(n)),a=0;for(let[o,r]of t)o!==n&&f(o,g(o))===i&&r>a&&(a=r);return a}function q(t,n,e,i){return _(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):f(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ne as a};
7
+ //# sourceMappingURL=chunk-7IVSJJZU.js.map
@@ -1,2 +1,2 @@
1
- import{c as i}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-UQLFQLAF.js";import{a}from"./chunk-SULEXAHO.js";import{a as r}from"./chunk-PTQVNJ4Q.js";import{c as o}from"./chunk-JM72FNGA.js";function S(s,n,c={}){let e=r(s,n);if(!e)return null;let t=c.semantic!==!1,y=m(s,e,{limit:50,semantic:t}),b=i(a(s,e,{limit:50,additive:!0,callableOnly:!0,semantic:t}));return{symbol:e.symbol,shortName:o(e.symbol),callers:y.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file})),callees:b.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file}))}}export{S as a};
2
- //# sourceMappingURL=chunk-56P7PDST.js.map
1
+ import{c as i}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-RNM6LMCF.js";import{a}from"./chunk-JCLDUKT6.js";import{a as r}from"./chunk-TK7O5ER5.js";import{c as o}from"./chunk-JM72FNGA.js";function S(s,n,c={}){let e=r(s,n);if(!e)return null;let t=c.semantic!==!1,y=m(s,e,{limit:50,semantic:t}),b=i(a(s,e,{limit:50,additive:!0,callableOnly:!0,semantic:t}));return{symbol:e.symbol,shortName:o(e.symbol),callers:y.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file})),callees:b.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file}))}}export{S as a};
2
+ //# sourceMappingURL=chunk-7TWLSZK5.js.map
@@ -1,4 +1,4 @@
1
- import{a as I,b as K,c as $}from"./chunk-GRJY65YT.js";import{a as A}from"./chunk-PFOCOG57.js";import{a as R}from"./chunk-GBEYTDY5.js";import{b as M,g as k}from"./chunk-C5CTSJ6X.js";import{a as b}from"./chunk-BGBBVSH4.js";import{e as S}from"./chunk-UQLFQLAF.js";import{e as F}from"./chunk-4KTOV4QN.js";import{a as P,c as w,d as p}from"./chunk-JM72FNGA.js";import{e as T}from"./chunk-72KY2ZFO.js";import{a as h}from"./chunk-DS6QEB3G.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:o=!1,scanLimit:l}=e??{},d=e?.semantic!==!1,a=new R(t),m=a.scopedDefinitions(n),g=Q(a,n),v={high:0,medium:1,low:2};return A({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>b(c)-b(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:l,prepare:u=>{let c=z(u),f=W(t,a,u,c,{semantic:d}),y=u.filter(L=>{let x=C(t,L,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&B(L,x.realConsumers.length,g)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,y,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=C(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!B(f.definition,f.realConsumers.length,g))return null;let y=E(t,f);return!o&&y.confidence==="low"?null:y},orderResults:(u,c)=>v[u.confidence]-v[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>M(s.relativePath)!=="test").filter(s=>!k(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function U(t,e,n){return I(t,e,{semantic:n.semantic,sourceFallback:n.sourceFallback})}function W(t,e,n,i,s){let r=U(e,n,{semantic:!1,sourceFallback:!1}),o=n.filter(a=>{let m=C(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&D(a.relativePath))}),l=s.semantic&&o.length>0?S(r,F(t,o)):r,d=o.filter(a=>C(t,a,l,i).realConsumers.length<=1);return S(l,e.sourceFallbackCallerFiles(d))}function z(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=p(n.symbol);s&&i.set(s,n)}return e}function C(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:o,barrelConsumers:l,importOnlyConsumers:d}=K(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:o,barrelConsumers:l+d,transitivelyReachable:a}}function E(t,e){let n=N(t,e.definition.relativePath,e.definition.startLine),i=D(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),o=V(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:w(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:b(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:o.actionTier,stalenessKind:o.stalenessKind,recommendation:o.recommendation}}function V(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),o=r.map(a=>a.singleton);if(r.length===0)return new Set;let l=I(e,o,{semantic:s.semantic}),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,l)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=p(n.symbol);i&&e.set(j(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(N(t,n.relativePath,n.startLine)!=="class")return null;let i=p(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(j(n.relativePath,s))??null:null}function G(t,e,n){let i=p(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!$(t,r,i))}function j(t,e){return`${t}\0${e}`}function J(t,e,n){let i=h(t,e);if(!i)return null;let s=n.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 Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=P(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function D(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function B(t,e,n){return!(D(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=T(t,e.relativePath),r=p(e.symbol);if(!r)return!1;let o=s.get(r);if(!o||o.size===0)return!1;let l=i.get(e.relativePath);if(!l)return!1;for(let d of o){let a=l.get(d);if(!a)continue;let m=n.get(a.symbolId);if(m){for(let g of m)if(g!==e.relativePath&&!t.isIgnored(g))return!0}}return!1}function N(t,e,n){let i=h(t,e);if(!i)return"other";let s=i.split(`
1
+ import{a as I,b as K,c as $}from"./chunk-GRJY65YT.js";import{a as A}from"./chunk-PFOCOG57.js";import{a as R}from"./chunk-5OST6GYB.js";import{b as M,g as k}from"./chunk-C5CTSJ6X.js";import{a as b}from"./chunk-BGBBVSH4.js";import{e as S}from"./chunk-RNM6LMCF.js";import{e as F}from"./chunk-OLTESY4K.js";import{a as P,c as w,d as p}from"./chunk-JM72FNGA.js";import{e as T}from"./chunk-72KY2ZFO.js";import{a as h}from"./chunk-DS6QEB3G.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:o=!1,scanLimit:l}=e??{},d=e?.semantic!==!1,a=new R(t),m=a.scopedDefinitions(n),g=Q(a,n),v={high:0,medium:1,low:2};return A({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>b(c)-b(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:l,prepare:u=>{let c=z(u),f=W(t,a,u,c,{semantic:d}),y=u.filter(L=>{let x=C(t,L,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&B(L,x.realConsumers.length,g)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,y,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=C(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!B(f.definition,f.realConsumers.length,g))return null;let y=E(t,f);return!o&&y.confidence==="low"?null:y},orderResults:(u,c)=>v[u.confidence]-v[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>M(s.relativePath)!=="test").filter(s=>!k(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function U(t,e,n){return I(t,e,{semantic:n.semantic,sourceFallback:n.sourceFallback})}function W(t,e,n,i,s){let r=U(e,n,{semantic:!1,sourceFallback:!1}),o=n.filter(a=>{let m=C(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&D(a.relativePath))}),l=s.semantic&&o.length>0?S(r,F(t,o)):r,d=o.filter(a=>C(t,a,l,i).realConsumers.length<=1);return S(l,e.sourceFallbackCallerFiles(d))}function z(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=p(n.symbol);s&&i.set(s,n)}return e}function C(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:o,barrelConsumers:l,importOnlyConsumers:d}=K(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:o,barrelConsumers:l+d,transitivelyReachable:a}}function E(t,e){let n=N(t,e.definition.relativePath,e.definition.startLine),i=D(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),o=V(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:w(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:b(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:o.actionTier,stalenessKind:o.stalenessKind,recommendation:o.recommendation}}function V(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),o=r.map(a=>a.singleton);if(r.length===0)return new Set;let l=I(e,o,{semantic:s.semantic}),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,l)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=p(n.symbol);i&&e.set(j(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(N(t,n.relativePath,n.startLine)!=="class")return null;let i=p(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(j(n.relativePath,s))??null:null}function G(t,e,n){let i=p(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!$(t,r,i))}function j(t,e){return`${t}\0${e}`}function J(t,e,n){let i=h(t,e);if(!i)return null;let s=n.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 Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=P(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function D(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function B(t,e,n){return!(D(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=T(t,e.relativePath),r=p(e.symbol);if(!r)return!1;let o=s.get(r);if(!o||o.size===0)return!1;let l=i.get(e.relativePath);if(!l)return!1;for(let d of o){let a=l.get(d);if(!a)continue;let m=n.get(a.symbolId);if(m){for(let g of m)if(g!==e.relativePath&&!t.isIgnored(g))return!0}}return!1}function N(t,e,n){let i=h(t,e);if(!i)return"other";let s=i.split(`
2
2
  `),r=Math.max(0,n-2),o=Math.min(s.length-1,n+2);for(let l=r;l<=o;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 ee(t,e){let n=h(t,e.relativePath);if(!n)return!1;let i=p(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),o=n.split(`
3
3
  `);for(let l=0;l<o.length;l++)if(!(l>=e.startLine&&l<=e.endLine)&&r.test(o[l]??""))return!0;return!1}function ne(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{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{de as a};
4
- //# sourceMappingURL=chunk-AW2QHPLL.js.map
4
+ //# sourceMappingURL=chunk-AVWPHM2Q.js.map
@@ -1,4 +1,4 @@
1
- import{a as t}from"./chunk-RYXW3KRC.js";function l(e,n,i){let d=t(e,n)??n,o=t(e,i)??i,r=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
1
+ import{a as t}from"./chunk-7B6LP46R.js";function l(e,n,i){let d=t(e,n)??n,o=t(e,i)??i,r=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
2
2
  FROM global_symbols gs
3
3
  WHERE (
4
4
  -- Defined in file1, referenced in file2
@@ -53,4 +53,4 @@ import{a as t}from"./chunk-RYXW3KRC.js";function l(e,n,i){let d=t(e,n)??n,o=t(e,
53
53
  GROUP BY def_d.id, ref_d.id
54
54
  ORDER BY shared DESC
55
55
  LIMIT ?`,i).filter(s=>!e.isIgnored(s.file1)&&!e.isIgnored(s.file2)).map(s=>c(s.file1,s.file2,s.shared))}function c(e,n,i){return{file1:e,file2:n,sharedSymbols:i,actionTier:"signal",couplingKind:"shared-symbol-coupling",evidenceReasons:[`${i} symbol(s) are defined in one file and referenced by the other`],recommendation:"Review whether the shared symbol surface is an intentional boundary or hidden coordination pressure before moving code."}}export{l as a,_ as b};
56
- //# sourceMappingURL=chunk-UYD7FJ3K.js.map
56
+ //# sourceMappingURL=chunk-BASVXNY3.js.map
@@ -1,2 +1,2 @@
1
- import{c as m}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-UQLFQLAF.js";import{a as g}from"./chunk-SULEXAHO.js";import{q as y}from"./chunk-F6ICF7HL.js";import{a as c}from"./chunk-PTQVNJ4Q.js";import{c as r}from"./chunk-JM72FNGA.js";function v(l,t,n={}){let o=c(l,t);if(!o)return null;let a=[{file:o.relativePath,line:o.startLine}],s=y(l,o,{semantic:n.semantic}).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?r(e.enclosingSymbol):"(top-level)"})),{producers:f,consumers:i}=S(l,o,s,{semantic:n.semantic!==!1});return{symbol:o.symbol,shortName:r(o.symbol),relativePath:o.relativePath,definitionSites:a.filter(e=>!l.isIgnored(e.file)),usageSites:s,producers:f.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:r(e.symbol),file:e.file})),consumers:i.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":r(e.symbol),file:e.file}))}}function S(l,t,n,o){let a=m(g(l,t,{limit:30,semantic:o.semantic}).map(i=>({symbol:i.symbol,file:i.file}))),s=m(b(l,t,{limit:30,semantic:o.semantic})),f=s.length>0?s:m(n.map(i=>({symbol:i.enclosingSymbol==="(top-level)"?i.file:i.enclosingSymbol,file:i.file})));return{producers:a,consumers:f}}export{v as a};
2
- //# sourceMappingURL=chunk-XXZXDXTD.js.map
1
+ import{c as m}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-RNM6LMCF.js";import{a as g}from"./chunk-JCLDUKT6.js";import{q as y}from"./chunk-KDFONWTW.js";import{a as c}from"./chunk-TK7O5ER5.js";import{c as r}from"./chunk-JM72FNGA.js";function v(l,t,n={}){let o=c(l,t);if(!o)return null;let a=[{file:o.relativePath,line:o.startLine}],s=y(l,o,{semantic:n.semantic}).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?r(e.enclosingSymbol):"(top-level)"})),{producers:f,consumers:i}=S(l,o,s,{semantic:n.semantic!==!1});return{symbol:o.symbol,shortName:r(o.symbol),relativePath:o.relativePath,definitionSites:a.filter(e=>!l.isIgnored(e.file)),usageSites:s,producers:f.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:r(e.symbol),file:e.file})),consumers:i.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":r(e.symbol),file:e.file}))}}function S(l,t,n,o){let a=m(g(l,t,{limit:30,semantic:o.semantic}).map(i=>({symbol:i.symbol,file:i.file}))),s=m(b(l,t,{limit:30,semantic:o.semantic})),f=s.length>0?s:m(n.map(i=>({symbol:i.enclosingSymbol==="(top-level)"?i.file:i.enclosingSymbol,file:i.file})));return{producers:a,consumers:f}}export{v as a};
2
+ //# sourceMappingURL=chunk-BFXPG2VN.js.map
@@ -1,2 +1,2 @@
1
- import{a as A}from"./chunk-GRJY65YT.js";import{a as C}from"./chunk-GBEYTDY5.js";import{a as k}from"./chunk-PTQVNJ4Q.js";import{c as b}from"./chunk-JM72FNGA.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as f}from"path";var j=20,z=1,_=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),G=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),O=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function De(e,n={}){let t=L(n.limit,j),i=L(n.minConsumers,z),o=new C(e),s=o.fileDependencyGraph(n.scope),r=de(p(e,{includeIgnored:!1})),c=fe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?q(e,o,n.target):Y(e,n.scope,n.scanLimit)).map(a=>K(o,s,a,n,r,c)).filter(a=>a.consumerFiles.length>=i||n.target).sort(ue).slice(0,t)}function q(e,n,t){let i=V(e,t);if(i)return[N(i)];let o=k(e,t);if(!o)return[];let s=n.definitionsForFile(o.relativePath).find(r=>r.symbolId===o.symbolId);return s?[X(s)]:[{unit:{kind:"symbol",file:o.relativePath,shortName:b(o.symbol),symbol:o.symbol,startLine:o.startLine,endLine:o.endLine}}]}function Y(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),o=L(t,i.length);return i.slice(0,o).map(s=>N(s))}function K(e,n,t,i,o,s){let r=t.definition?J(e,t.definition,i.semantic):Q(n,t.unit.file),c=t.definition?r.length>0?"exact":"none":r.length>0?"file-level":"none",m=t.unit.file,l=u(f.dirname(m)),a=ee(r),h=Z(l),B=w([...F(l),...a?F(a):[]]),y=ne(t.unit,l,a,r),g=te(y,t.unit,l,a,r,o,s),E=ae(t.unit,c,a,r,l,g.whyNoSuggestedHome),W=ce(t.unit,l,a,r,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:t.unit,candidatePath:m,currentDirectory:l,directoryAncestry:h,consumerFiles:r,consumerCoverage:c,nearestCommonOwner:a,boundaryMarkers:B,recommendedTier:y,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:E,reasons:W,recommendation:le(y,g.suggestedHome,c)}}function J(e,n,t){let i=A(e,[n],{semantic:t!==!1,sourceFallback:!0});return H(i.get(n.symbolId)??[])}function Q(e,n){let t=[];for(let[i,o]of e.entries())i!==n&&o.has(n)&&t.push(i);return H(t)}function V(e,n){let t=D(n),i=p(e,{includeIgnored:!1}),o=i.find(r=>r===t);if(o)return o;let s=i.find(r=>r.endsWith(`/${t}`));return s||(i.find(r=>r.includes(t))??null)}function X(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:b(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function N(e){return{unit:{kind:"file",file:e,shortName:f.basename(e)}}}function Z(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let o=t.slice(0,i+1).join("/");n.push({path:o,depth:i,markers:v(o)})}return n}function F(e){return e==="."?[]:I(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function v(e){return w(I(e).map(({marker:n})=>n))}function I(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let o=_.get(n[i]);o&&t.push({marker:o,prefix:n.slice(0,i+1).join("/")})}return t}function ee(e){if(e.length===0)return null;let n=e.map(i=>u(f.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let o=i.split("/").filter(Boolean),s=[],r=Math.min(t.length,o.length);for(let c=0;c<r&&t[c]===o[c];c+=1)s.push(t[c]);t=s}return t.length===0?".":t.join("/")}function ne(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":R(t,"package")?"package-level-shared":R(t,"app")?"app-level-shared":U(t,["feature","domain","module"])||U(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function te(e,n,t,i,o,s,r){let c=ie(e,i);if(c)return d(c);let m=me(n.file),l=re(e,t,m,o,r);if(l)return l;let a=i;if(u(t)===u(a))return d(`${t} is already the nearest common owner for its consumers.`);let h=oe(a,t,m,r);return h||se(a,t,m,s,r)}function ie(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function re(e,n,t,i,o){if(e==="same-file"){let s=i[0]??null;return s?S(s):d("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=u(f.dirname(i[0])),r=M(n,t,s,o);return r?d(r):S(s)}return null}function oe(e,n,t,i){return pe(e)?$(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function se(e,n,t,i,o){if(e===".")return d("The nearest common owner is the repository root.");let s=`${e}/shared`,r=$(s,n,t,o,`Proposed home ${s} is outside source root ${t}.`);return r.confidence==="withheld"||i.has(s)?r:d(`${s} does not exist in the indexed project.`)}function $(e,n,t,i,o){if(!P(e,t))return d(o);let s=M(n,t,e,i);return s?d(s):S(e)}function S(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function d(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function ae(e,n,t,i,o,s){let r=["Report-only signal; review ownership before moving files."];return n==="none"&&r.push("No consumers were found in the current index."),n==="file-level"&&r.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&r.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&r.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&r.push("File targets describe module locality, not symbol-level usage."),t&&o.startsWith(`${t}/`)&&r.push("Candidate already lives under the nearest common owner."),s&&r.push(`No exact suggested home: ${s}`),r}function ce(e,n,t,i,o,s){let r=[];return r.push(`${e.shortName} currently lives in ${n}.`),t?r.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):r.push("No consumer owner could be inferred from the current index."),o?r.push(`Suggested home is ${o}.`):s&&r.push(`No exact suggested home: ${s}`),r}function le(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function ue(e,n){return T(n)-T(e)||e.candidatePath.localeCompare(n.candidatePath)}function T(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n-=8),e.recommendedTier==="no-exact-consumers"&&(n-=12),n}function de(e){let n=new Set(["."]);for(let t of e){let i=u(f.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=u(f.dirname(i))}return n}function me(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function P(e,n){let t=u(e),i=u(n);return i==="."||t===i||t.startsWith(`${i}/`)}function ge(e,n,t){let i=x(e),o=x(n);return(P(e,n)?i.slice(o.length):i).some(r=>t.has(r.toLowerCase()))}function M(e,n,t,i){return u(e)===u(t)||!ge(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function fe(...e){let n=new Set(O);for(let t of e)for(let i of t??[]){let o=he(i);o&&n.add(o)}return n}function he(e){let n=e.trim().toLowerCase();return n===""?null:n}function R(e,n){return v(e).includes(n)}function U(e,n){let t=v(e);return n.some(i=>t.includes(i))}function pe(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?G.has(t):!1}function D(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function u(e){let n=D(e);return n===""?".":n}function x(e){let n=D(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function H(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{De as a};
2
- //# sourceMappingURL=chunk-UWYJDBDW.js.map
1
+ import{a as A}from"./chunk-GRJY65YT.js";import{a as C}from"./chunk-5OST6GYB.js";import{a as k}from"./chunk-TK7O5ER5.js";import{c as b}from"./chunk-JM72FNGA.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as f}from"path";var j=20,z=1,_=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),G=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),O=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function De(e,n={}){let t=L(n.limit,j),i=L(n.minConsumers,z),o=new C(e),s=o.fileDependencyGraph(n.scope),r=de(p(e,{includeIgnored:!1})),c=fe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?q(e,o,n.target):Y(e,n.scope,n.scanLimit)).map(a=>K(o,s,a,n,r,c)).filter(a=>a.consumerFiles.length>=i||n.target).sort(ue).slice(0,t)}function q(e,n,t){let i=V(e,t);if(i)return[N(i)];let o=k(e,t);if(!o)return[];let s=n.definitionsForFile(o.relativePath).find(r=>r.symbolId===o.symbolId);return s?[X(s)]:[{unit:{kind:"symbol",file:o.relativePath,shortName:b(o.symbol),symbol:o.symbol,startLine:o.startLine,endLine:o.endLine}}]}function Y(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),o=L(t,i.length);return i.slice(0,o).map(s=>N(s))}function K(e,n,t,i,o,s){let r=t.definition?J(e,t.definition,i.semantic):Q(n,t.unit.file),c=t.definition?r.length>0?"exact":"none":r.length>0?"file-level":"none",m=t.unit.file,l=u(f.dirname(m)),a=ee(r),h=Z(l),B=w([...F(l),...a?F(a):[]]),y=ne(t.unit,l,a,r),g=te(y,t.unit,l,a,r,o,s),E=ae(t.unit,c,a,r,l,g.whyNoSuggestedHome),W=ce(t.unit,l,a,r,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:t.unit,candidatePath:m,currentDirectory:l,directoryAncestry:h,consumerFiles:r,consumerCoverage:c,nearestCommonOwner:a,boundaryMarkers:B,recommendedTier:y,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:E,reasons:W,recommendation:le(y,g.suggestedHome,c)}}function J(e,n,t){let i=A(e,[n],{semantic:t!==!1,sourceFallback:!0});return H(i.get(n.symbolId)??[])}function Q(e,n){let t=[];for(let[i,o]of e.entries())i!==n&&o.has(n)&&t.push(i);return H(t)}function V(e,n){let t=D(n),i=p(e,{includeIgnored:!1}),o=i.find(r=>r===t);if(o)return o;let s=i.find(r=>r.endsWith(`/${t}`));return s||(i.find(r=>r.includes(t))??null)}function X(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:b(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function N(e){return{unit:{kind:"file",file:e,shortName:f.basename(e)}}}function Z(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let o=t.slice(0,i+1).join("/");n.push({path:o,depth:i,markers:v(o)})}return n}function F(e){return e==="."?[]:I(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function v(e){return w(I(e).map(({marker:n})=>n))}function I(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let o=_.get(n[i]);o&&t.push({marker:o,prefix:n.slice(0,i+1).join("/")})}return t}function ee(e){if(e.length===0)return null;let n=e.map(i=>u(f.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let o=i.split("/").filter(Boolean),s=[],r=Math.min(t.length,o.length);for(let c=0;c<r&&t[c]===o[c];c+=1)s.push(t[c]);t=s}return t.length===0?".":t.join("/")}function ne(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":R(t,"package")?"package-level-shared":R(t,"app")?"app-level-shared":U(t,["feature","domain","module"])||U(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function te(e,n,t,i,o,s,r){let c=ie(e,i);if(c)return d(c);let m=me(n.file),l=re(e,t,m,o,r);if(l)return l;let a=i;if(u(t)===u(a))return d(`${t} is already the nearest common owner for its consumers.`);let h=oe(a,t,m,r);return h||se(a,t,m,s,r)}function ie(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function re(e,n,t,i,o){if(e==="same-file"){let s=i[0]??null;return s?S(s):d("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=u(f.dirname(i[0])),r=M(n,t,s,o);return r?d(r):S(s)}return null}function oe(e,n,t,i){return pe(e)?$(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function se(e,n,t,i,o){if(e===".")return d("The nearest common owner is the repository root.");let s=`${e}/shared`,r=$(s,n,t,o,`Proposed home ${s} is outside source root ${t}.`);return r.confidence==="withheld"||i.has(s)?r:d(`${s} does not exist in the indexed project.`)}function $(e,n,t,i,o){if(!P(e,t))return d(o);let s=M(n,t,e,i);return s?d(s):S(e)}function S(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function d(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function ae(e,n,t,i,o,s){let r=["Report-only signal; review ownership before moving files."];return n==="none"&&r.push("No consumers were found in the current index."),n==="file-level"&&r.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&r.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&r.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&r.push("File targets describe module locality, not symbol-level usage."),t&&o.startsWith(`${t}/`)&&r.push("Candidate already lives under the nearest common owner."),s&&r.push(`No exact suggested home: ${s}`),r}function ce(e,n,t,i,o,s){let r=[];return r.push(`${e.shortName} currently lives in ${n}.`),t?r.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):r.push("No consumer owner could be inferred from the current index."),o?r.push(`Suggested home is ${o}.`):s&&r.push(`No exact suggested home: ${s}`),r}function le(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function ue(e,n){return T(n)-T(e)||e.candidatePath.localeCompare(n.candidatePath)}function T(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n-=8),e.recommendedTier==="no-exact-consumers"&&(n-=12),n}function de(e){let n=new Set(["."]);for(let t of e){let i=u(f.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=u(f.dirname(i))}return n}function me(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function P(e,n){let t=u(e),i=u(n);return i==="."||t===i||t.startsWith(`${i}/`)}function ge(e,n,t){let i=x(e),o=x(n);return(P(e,n)?i.slice(o.length):i).some(r=>t.has(r.toLowerCase()))}function M(e,n,t,i){return u(e)===u(t)||!ge(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function fe(...e){let n=new Set(O);for(let t of e)for(let i of t??[]){let o=he(i);o&&n.add(o)}return n}function he(e){let n=e.trim().toLowerCase();return n===""?null:n}function R(e,n){return v(e).includes(n)}function U(e,n){let t=v(e);return n.some(i=>t.includes(i))}function pe(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?G.has(t):!1}function D(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function u(e){let n=D(e);return n===""?".":n}function x(e){let n=D(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function H(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{De as a};
2
+ //# sourceMappingURL=chunk-CO5GJRP7.js.map
@@ -0,0 +1,5 @@
1
+ import{a as ne,b as A,e as H,f as $,g as z,h as ie,i as te}from"./chunk-YWOOQ4FF.js";import{b as O}from"./chunk-B75HZHUP.js";import{a as T}from"./chunk-5OST6GYB.js";import{a as ee}from"./chunk-JCLDUKT6.js";import{a as D,b as S}from"./chunk-TQ5W2H3S.js";import{a as U}from"./chunk-TK7O5ER5.js";import{c as L,d as G,g as P}from"./chunk-JM72FNGA.js";import{a as _,b as j}from"./chunk-DS6QEB3G.js";import{b as X,d as J,e as Q}from"./chunk-XUGQU7PM.js";import{a as Y}from"./chunk-64MNV6AB.js";import{d as E}from"./chunk-7S5E7KWT.js";function fn(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=Me(e,n,{semantic:t.semantic!==!1});if(!s)return[];if(!P(s.symbol))return[];if(s.callees.size===0)return re(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"});let a=ye(e,s,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,r):re(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"})}function ye(e,n,t,i){let r=W(e,{minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=De(n,r),a=he(n,r),l=$(a),c=z(n.callees,a),m=[];for(let f of s){if(f.callees.size<3)continue;let d=z(f.callees,a),o=oe(n,f,a,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:l,magnitudeA:c,magnitudeB:d});o&&m.push(o)}return m.sort((f,d)=>d.similarity-f.similarity),m}function he(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return H(t,n.corpus.length+1)}function oe(e,n,t,i){let r=Ce(e,n,t,i);if(!ke(r,i))return null;let{similarity:s,significantShared:a,trivialShared:l}=r,c=a.length>0?a:l,m=ue(c,"callees");return{symbolA:e.symbol,shortNameA:L(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:L(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(L),uniqueToA:[...A(e.callees,n.callees)].map(L),uniqueToB:[...A(n.callees,e.callees)].map(L),...m}}function Fe(e,n,t,i){let r=i.magnitudeA??z(e.callees,t),s=i.magnitudeB??z(n.callees,t),a=0,l=0,c=0,m=i.medianIdf??$(t);for(let o of e.callees){if(!n.callees.has(o))continue;let g=t.get(o)??0;a+=g*g,c+=1,g>=m&&(l+=1)}if(c===0)return!1;let f=r*s;return(f>0?a/f:0)<i.minSimilarity?!1:l>=i.requireSignificantShared||c>=i.requireSharedCount}function Ce(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?ie(e.callees,n.callees,t,{medianIdf:i.medianIdf}):te(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function ke(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function gn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:l}=n,c=n.semantic!==!1,m=D(),f=0,d=0,o=0,g=0,u=0,p=0,b=0;return S("similar.all",()=>{let y=W(e,{minCallees:s,scope:r,scanLimit:l,semantic:c}),C=y.corpus;f=C.length;let x=n.focusFiles,k=[],B=0;return S("similar.all.pair-scan",()=>{for(let F=0;F<C.length;F+=1){let h=C[F],I=x?.has(h.file)??!1,w=y.weightedMagnitudes[F],M=new Set;for(let N of h.callees){let R=y.candidateIndexesByCallee.get(N);if(R)for(let v of R)v<=F||x&&!I&&!x.has(C[v].file)||M.add(v)}m&&(o+=M.size,M.size>0&&(d+=1));for(let N of M){let R=C[N];if(a&&h.file===R.file){m&&(u+=1);continue}if(le(h,R)){m&&(p+=1);continue}m&&(g+=1);let v=oe(h,R,y.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:y.medianIdf,magnitudeA:w,magnitudeB:y.weightedMagnitudes[N]});v&&(xe(k,v,i,B),m&&(b+=1),B+=1)}}},()=>({corpusSize:f,candidateSets:d,candidatePairs:o,comparedPairs:g,crossFileSkips:u,signatureSkips:p,insertedResults:b,topResults:k.length})),S("similar.all.sort-project",()=>(k.sort((F,h)=>h.result.similarity-F.result.similarity||F.order-h.order),k.map(F=>F.result)),()=>({topResults:k.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:l,semantic:c,corpusSize:f,candidateSets:d,candidatePairs:o,comparedPairs:g,crossFileSkips:u,signatureSkips:p,insertedResults:b}))}function pn(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,l=n.semantic!==!1,c=D(),m=0,f=0,d=0,o=0,g=0,u=0,p=0;return S("similar.all-count",()=>{let b=W(e,{minCallees:r,scope:i,scanLimit:a,semantic:l}),y=b.corpus;m=y.length;let C=n.focusFiles;return S("similar.all-count.pair-scan",()=>{for(let x=0;x<y.length;x+=1){let k=y[x],B=C?.has(k.file)??!1,F=b.weightedMagnitudes[x],h=new Set;for(let I of k.callees){let w=b.candidateIndexesByCallee.get(I);if(w)for(let M of w)M<=x||C&&!B&&!C.has(y[M].file)||h.add(M)}c&&(d+=h.size,h.size>0&&(f+=1));for(let I of h){let w=y[I];if(s&&k.file===w.file){c&&(g+=1);continue}if(le(k,w)){c&&(u+=1);continue}c&&(o+=1),Fe(k,w,b.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:b.medianIdf,magnitudeA:F,magnitudeB:b.weightedMagnitudes[I]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:f,candidatePairs:d,comparedPairs:o,crossFileSkips:g,signatureSkips:u,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:l,corpusSize:m,candidateSets:f,candidatePairs:d,comparedPairs:o,crossFileSkips:g,signatureSkips:u,insertedResults:p}))}function le(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}function xe(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let l=e[a],c=e[r];(l.result.similarity<c.result.similarity||l.result.similarity===c.result.similarity&&l.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var we=["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 Me(e,n,t){let i=U(e,n);if(!i||!P(i.symbol))return null;let r=new T(e),s=ee(e,i,{semantic:t.semantic});return{symbol:i.symbol,file:i.relativePath,callees:ce(s.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}var Le=E("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Ie=E("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function Re(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,l=Le.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,f=0,d=0;return S("similar.callee-fingerprints.resolve",()=>{let o=l.get(c);if(m=o!==void 0,o||(o=ze(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),l.set(c,o)),f=o.length,r===void 0)return o;let g=o.filter(u=>u.symbol!==r);return d=o.length-g.length,g},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:f,excludeSymbol:r!==void 0,excludedSymbols:d}))}function W(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=Ie.get(e,()=>new Map),l=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,f=0,d=0;return S("similar.callee-index.resolve",()=>{let o=a.get(l);return c=o!==void 0,o||(o=ve(Re(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(l,o)),m=o.corpus.length,f=o.docFreq.size,d=o.candidateIndexesByCallee.size,o},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:f,candidateBuckets:d}))}function ve(e){let n=D(),t=0,i=S("similar.callee-index.doc-frequency",()=>{let o=new Map;for(let g of e)for(let u of g.callees)o.set(u,(o.get(u)??0)+1);return t=o.size,o},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=S("similar.callee-index.idf-weights",()=>H(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=S("similar.callee-index.weighted-magnitudes",()=>e.map(o=>z(o.callees,s)),()=>({corpusSize:e.length})),l=0,c=0,m=0,f=S("similar.callee-index.candidate-buckets",()=>{let o=new Map;for(let g=0;g<e.length;g+=1){let u=e[g];for(let p of u.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let b=o.get(p);b||(b=[],o.set(p,b)),b.push(g),n&&(l+=1)}}return n&&(m=o.size),o},()=>({corpusSize:e.length,buckets:m,candidateRefs:l,ubiquitousSkips:c,ubiquityThreshold:r})),d=S("similar.callee-index.median-idf",()=>$(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:f,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:d,ubiquityThreshold:r}}function De(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function ze(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=D(),l=new T(e),c=0,m=S("similar.callee-fingerprints.candidates",()=>{let u=O(l.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=u.length,u},()=>({scope:i,scanLimit:r,candidateCount:c})),f=0,d=S("similar.callee-fingerprints.callee-map",()=>{let u=l.calleeMap(m,{semantic:s});if(a)for(let p of u.values())f+=p.length;return u},()=>({candidateCount:c,semantic:s,calleeEdges:f})),o=0,g=0;return S("similar.callee-fingerprints.shape",()=>{let u=m.map(p=>({symbol:p.symbol,file:p.relativePath,callees:ce((d.get(p.symbolId)??[]).map(b=>b.symbol)),paramCount:l.callableSignature(p)?.paramCount??-1})).filter(p=>p.callees.size>=t);return o=u.length,a&&(g=u.reduce((p,b)=>p+b.callees.size,0)),u},()=>({candidateCount:c,fingerprintCount:o,retainedCalleeCount:g,minCallees:t}))}function ce(e){return new Set([...e].filter(n=>!Ee(n)))}function Ee(e){return we.some(n=>e.includes(n))}function re(e,n,t){let i=Be(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",l=0,c=0,m=0,f=0;return S("similar.source-shape",()=>{let d=a==="target-pruned"?Ue(e,i,{minSimilarity:r,scanLimit:t.scanLimit}):Ge(i,_e(e,{scanLimit:t.scanLimit}));l=d.length;for(let o of d){if(o.symbol===i.symbol||o.tokens.size<3)continue;c+=1;let g=ne(i.tokens,o.tokens);if(g.size<2){m+=1;continue}let u=new Set([...i.tokens,...o.tokens]),p=u.size>0?g.size/u.size:0;if(p<r){f+=1;continue}s.push({symbolA:i.symbol,shortNameA:L(i.symbol),fileA:i.file,symbolB:o.symbol,shortNameB:L(o.symbol),fileB:o.file,similarity:p,similarityBasis:"source-tokens",sharedCallees:[...g].sort(),uniqueToA:[...A(i.tokens,o.tokens)].sort(),uniqueToB:[...A(o.tokens,i.tokens)].sort(),...ue([...g],"source-tokens")})}return s.sort((o,g)=>g.similarity-o.similarity||o.shortNameB.localeCompare(g.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:l,comparedPairs:c,sharedSkips:m,similaritySkips:f,results:s.length}))}function ue(e,n){let t=e.flatMap(V),i=e.flatMap(b=>se(b,n)),r=K(t,me),s=K(t,de),a=K(i,Z),l=[...new Set(i.filter(ae))],c=e.filter(b=>{let y=se(b,n);return y.some(C=>Z.has(C))&&y.some(ae)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&l.length>0&&m.push(`domain-specific terms: ${l.slice(0,5).join(", ")}`);let f=n==="source-tokens"&&t.length>0&&t.every(b=>fe.has(b));f&&m.push("shared source tokens are generic scaffolding");let d=a.length>0&&l.length>0,o=r.length+s.length>0,g=n==="callees"&&d&&e.length>=4&&l.length>=4&&c>=2,u=g?"domain-behavior":d?o?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||f?"framework-scaffolding":"structural-overlap";u==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=u==="domain-behavior"&&(e.length>=3||g)?"direct":"signal";return{evidenceClass:u,actionTier:p,evidenceClassReasons:m,recommendation:Te(u,p)}}function Te(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function K(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function se(e,n){if(n==="source-tokens")return V(e);let t=G(e);return V(t.length>0?t:Ae(e))}function Ae(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function ae(e){return e.length>3&&!Z.has(e)&&!me.has(e)&&!de.has(e)&&!fe.has(e)&&!qe.has(e)}var Z=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),me=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),de=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),fe=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),qe=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Be(e,n){let t=U(e,n);if(!t||!P(t.symbol))return null;let i=Ne(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ne(e,n){let t=G(n.symbol),i=We(e,n.relativePath,n.startLine,n.endLine,t),r=Se(i,t);return r.size>0?r:null}var Pe=E("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Oe=E("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function ge(e){return`${e.scanLimit??""}`}function $e(e,n={}){let t=Pe.get(e,()=>new Map),i=ge(n),r=t.get(i);return r||(r=Ze(e,n),t.set(i,r)),r}function _e(e,n={}){let t=Oe.get(e,()=>new Map),i=ge(n),r=t.get(i);return r||(r=je($e(e,n)),t.set(i,r)),r}function je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ge(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Ue(e,n,t){let i=D(),r=new T(e),s=He(n.tokens.size,t.minSimilarity),a=0,l=0,c=0,m=S("similar.source-shape.target-files",()=>{let u=[...n.tokens],p=[];for(let b of Y(e,{includeIgnored:!1})){a+=1;let y=_(e,b);y&&(l+=1,Ke(y,u,s)&&p.push(b))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:l,candidateFiles:c})),f=0,d=S("similar.source-shape.target-definitions",()=>{let u=O(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return f=u.length,u},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:f})),o=0;return S("similar.source-shape.target-fingerprints",()=>{let u=pe(e,d);return i&&(o=u.length),u},()=>({symbol:n.symbol,definitionCount:f,fingerprintCount:o})).filter(u=>u.symbol!==n.symbol)}function He(e,n){return Math.max(2,Math.ceil(e*n))}function Ke(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(Ve(i,s)&&(r+=1,r>=t))return!0;return!1}function Ve(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function Ze(e,n={}){let t=new T(e),{scanLimit:i}=n,r=O(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return pe(e,r)}function pe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=_(e,r);if(!a)continue;let l=X(e,r,a),c=Je(e,r,l),m=!1,f=null;for(let d of s){let o=Xe(d),g=c.get(o),u=g?new Set(g.tokens):null;u||(f??=j(e,r),u=Se(be(f,d.startLine,d.endLine,d.leaf),d.leaf),c.set(o,{key:o,symbol:d.symbol,startLine:d.startLine,endLine:d.endLine,leaf:d.leaf,tokens:[...u].sort()}),m=!0),u.size>0&&i.set(d.symbol,{symbol:d.symbol,file:d.relativePath,tokens:u})}m&&Qe(e,r,l,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function We(e,n,t,i,r){let s=j(e,n);return s.length===0?"":be(s,t,i,r)}function be(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
2
+ `);let r=[new RegExp(`\\bdef\\s+${q(i)}\\b`),new RegExp(`\\bfun\\s+${q(i)}\\b`),new RegExp(`\\bfn\\s+${q(i)}\\b`),new RegExp(`\\bfunction\\s+${q(i)}\\b`),new RegExp(`\\b${q(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(l=>l.test(a)));if(s>=0){let a=s;for(let l=s+1;l<e.length&&l<=s+8;l++){let c=e[l]??"";if(l>s&&en(c)||(a=l,c.trim()===""&&l>s+1))break}return e.slice(s,a+1).join(`
3
+ `)}return e.slice(n,Math.min(e.length,n+8)).join(`
4
+ `)}function Xe(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function Je(e,n,t){let i=J(e,"source-fingerprints",n,t);if(!i)return new Map;try{let r=JSON.parse(i);if(!Array.isArray(r.entries))return new Map;let s=new Map;for(let a of r.entries){if(!a||typeof a.key!="string"||typeof a.symbol!="string"||typeof a.startLine!="number"||typeof a.endLine!="number"||typeof a.leaf!="string"||!Array.isArray(a.tokens)||!a.tokens.every(l=>typeof l=="string"))return new Map;s.set(a.key,a)}return s}catch{return new Map}}function Qe(e,n,t,i){let r={entries:[...i.values()].sort((s,a)=>s.key.localeCompare(a.key))};Q(e,"source-fingerprints",n,t,JSON.stringify(r))}function Se(e,n){if(!e)return new Set;let t=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"]),i=Ye(n),s=e.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(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function Ye(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function en(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{fn as a,he as b,gn as c,pn as d,xe as e,Re as f,W as g,ve as h,De as i,ce as j,ue as k};
5
+ //# sourceMappingURL=chunk-CW5YFOCP.js.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-PFOCOG57.js";import{a as d}from"./chunk-GBEYTDY5.js";import{a as c}from"./chunk-F6ICF7HL.js";import{c as p}from"./chunk-JM72FNGA.js";import{a as u}from"./chunk-72KY2ZFO.js";import{a as o}from"./chunk-HF25DFSC.js";function F(r,t={}){let{scope:l,limit:s=30,scanLimit:b}=t,f=new d(r);return g({candidates:()=>f.productionCallableDefinitions({scope:l,files:t.files,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}).filter(e=>y(e.relativePath)),scanLimit:b,evaluate:e=>{let n=u(r,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(a=>!a.simple)||n.paramsEndLine>=n.endLine)return null;let L=c(r,e.relativePath),m=[];for(let a=n.params.length-1;a>=0;a--){let i=n.params[a];if(i.name===""||i.name.startsWith("_")||h(L.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function y(r){let t=o(r);return t==="typescript"||t==="tsx"||t==="javascript"}function h(r,t,l){return r?r.some(s=>s>t&&s<=l):!1}export{F as a};
2
- //# sourceMappingURL=chunk-7JRRXGVZ.js.map
1
+ import{a as g}from"./chunk-PFOCOG57.js";import{a as d}from"./chunk-5OST6GYB.js";import{a as c}from"./chunk-KDFONWTW.js";import{c as p}from"./chunk-JM72FNGA.js";import{a as u}from"./chunk-72KY2ZFO.js";import{a as o}from"./chunk-HF25DFSC.js";function F(r,t={}){let{scope:l,limit:s=30,scanLimit:b}=t,f=new d(r);return g({candidates:()=>f.productionCallableDefinitions({scope:l,files:t.files,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}).filter(e=>y(e.relativePath)),scanLimit:b,evaluate:e=>{let n=u(r,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(a=>!a.simple)||n.paramsEndLine>=n.endLine)return null;let L=c(r,e.relativePath),m=[];for(let a=n.params.length-1;a>=0;a--){let i=n.params[a];if(i.name===""||i.name.startsWith("_")||h(L.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function y(r){let t=o(r);return t==="typescript"||t==="tsx"||t==="javascript"}function h(r,t,l){return r?r.some(s=>s>t&&s<=l):!1}export{F as a};
2
+ //# sourceMappingURL=chunk-E35O7UCB.js.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-SULEXAHO.js";import{a as u}from"./chunk-PTQVNJ4Q.js";import{c as i}from"./chunk-JM72FNGA.js";function w(r,b,y,f={}){let s=u(r,b),n=u(r,y);if(!s||!n)return null;let c=new Set(g(r,s,{semantic:f.semantic}).map(e=>e.symbol)),m=new Set(g(r,n,{semantic:f.semantic}).map(e=>e.symbol)),l=[];for(let e of c)m.has(e)&&l.push(e);let o=[];for(let e of c)m.has(e)||o.push(e);let a=[];for(let e of m)c.has(e)||a.push(e);let h=new Set([...c,...m]),d=h.size>0?l.length/h.size:0,t;h.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":l.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":o.length===0&&a.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":a.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&a.length<=2?t=`Create a shared function with the ${l.length} common callees. Pass the ${o.length+a.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${l.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${o.length} callees in A, ${a.length} in B).`;let p=s.endLine-s.startLine+1,A=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:i(s.symbol),file:s.relativePath,loc:p},symbolB:{symbol:n.symbol,shortName:i(n.symbol),file:n.relativePath,loc:A},similarity:d,sharedCallees:l.map(i),uniqueToA:o.map(i),uniqueToB:a.map(i),consolidationStrategy:t}}export{w as a};
2
- //# sourceMappingURL=chunk-XIVO4SDZ.js.map
1
+ import{a as g}from"./chunk-JCLDUKT6.js";import{a as u}from"./chunk-TK7O5ER5.js";import{c as i}from"./chunk-JM72FNGA.js";function w(r,b,y,f={}){let s=u(r,b),n=u(r,y);if(!s||!n)return null;let c=new Set(g(r,s,{semantic:f.semantic}).map(e=>e.symbol)),m=new Set(g(r,n,{semantic:f.semantic}).map(e=>e.symbol)),l=[];for(let e of c)m.has(e)&&l.push(e);let o=[];for(let e of c)m.has(e)||o.push(e);let a=[];for(let e of m)c.has(e)||a.push(e);let h=new Set([...c,...m]),d=h.size>0?l.length/h.size:0,t;h.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":l.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":o.length===0&&a.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":a.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&a.length<=2?t=`Create a shared function with the ${l.length} common callees. Pass the ${o.length+a.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${l.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${o.length} callees in A, ${a.length} in B).`;let p=s.endLine-s.startLine+1,A=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:i(s.symbol),file:s.relativePath,loc:p},symbolB:{symbol:n.symbol,shortName:i(n.symbol),file:n.relativePath,loc:A},similarity:d,sharedCallees:l.map(i),uniqueToA:o.map(i),uniqueToB:a.map(i),consolidationStrategy:t}}export{w as a};
2
+ //# sourceMappingURL=chunk-EXDQ35NN.js.map
@@ -1,4 +1,4 @@
1
- import{a as r}from"./chunk-RYXW3KRC.js";import{a as l}from"./chunk-PTQVNJ4Q.js";import{a as c}from"./chunk-VUKC6F77.js";import{c as d}from"./chunk-JM72FNGA.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
1
+ import{a as r}from"./chunk-7B6LP46R.js";import{a as l}from"./chunk-TK7O5ER5.js";import{a as c}from"./chunk-VUKC6F77.js";import{c as d}from"./chunk-JM72FNGA.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  WHERE m.symbol_id = ?
@@ -59,4 +59,4 @@ import{a as r}from"./chunk-RYXW3KRC.js";import{a as l}from"./chunk-PTQVNJ4Q.js";
59
59
  GROUP BY d.id
60
60
  ORDER BY symbol_count DESC
61
61
  LIMIT ?`,o).filter(i=>!e.isIgnored(i.relative_path)).map(i=>({name:i.relative_path,count:i.symbol_count}))}export{p as a,b,y as c,I as d};
62
- //# sourceMappingURL=chunk-UFX7EPBA.js.map
62
+ //# sourceMappingURL=chunk-EY43NV4M.js.map