@aiready/context-analyzer 0.22.9 → 0.22.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 (302) hide show
  1. package/.turbo/turbo-build.log +33 -32
  2. package/.turbo/turbo-format-check.log +1 -1
  3. package/.turbo/turbo-lint.log +8 -0
  4. package/dist/chunk-HD4Y3GYL.mjs +124 -0
  5. package/dist/{chunk-M2EGQ36M.mjs → chunk-ISWPFG2C.mjs} +43 -98
  6. package/dist/{chunk-BQCISA2F.mjs → chunk-QW6ULRML.mjs} +32 -6
  7. package/dist/{chunk-WHB7QI7N.mjs → chunk-T733LS62.mjs} +23 -4
  8. package/dist/{cli-action-CXIHOVAC.mjs → cli-action-FV4G4OB6.mjs} +3 -3
  9. package/dist/{cli-action-3CWN7PBE.mjs → cli-action-HYSWE7F4.mjs} +3 -3
  10. package/dist/{cli-action-MLFCIW2O.mjs → cli-action-VIQZSWSP.mjs} +3 -3
  11. package/dist/{cli-action-E7UGP4KE.mjs → cli-action-W7TESWAV.mjs} +6 -8
  12. package/dist/cli.js +236 -191
  13. package/dist/cli.mjs +1 -1
  14. package/dist/console-report-AP4JYNQY.mjs +74 -0
  15. package/dist/html-report-ULELSIYG.mjs +73 -0
  16. package/dist/index.d.mts +69 -337
  17. package/dist/index.d.ts +69 -337
  18. package/dist/index.js +90 -452
  19. package/dist/index.mjs +9 -157
  20. package/dist/interactive-setup-JGFBFI3M.mjs +75 -0
  21. package/dist/{orchestrator-3ERQS3NW.mjs → orchestrator-QNE2E4TE.mjs} +2 -2
  22. package/dist/summary-GQRWW3A2.mjs +7 -0
  23. package/dist/summary-JTBS7CPM.mjs +7 -0
  24. package/dist/summary-TZFB6ZFM.mjs +7 -0
  25. package/package.json +2 -2
  26. package/src/__tests__/file-classification.fixtures.ts +57 -0
  27. package/src/__tests__/file-classification.test.ts +24 -929
  28. package/src/__tests__/provider.test.ts +6 -72
  29. package/src/classifier.ts +42 -42
  30. package/src/cli-action.ts +11 -6
  31. package/src/index.ts +30 -27
  32. package/src/provider.ts +1 -1
  33. package/src/summary.ts +65 -10
  34. package/dist/__tests__/analyzer.test.d.ts +0 -2
  35. package/dist/__tests__/analyzer.test.d.ts.map +0 -1
  36. package/dist/__tests__/analyzer.test.js +0 -198
  37. package/dist/__tests__/analyzer.test.js.map +0 -1
  38. package/dist/__tests__/auto-detection.test.d.ts +0 -2
  39. package/dist/__tests__/auto-detection.test.d.ts.map +0 -1
  40. package/dist/__tests__/auto-detection.test.js +0 -132
  41. package/dist/__tests__/auto-detection.test.js.map +0 -1
  42. package/dist/__tests__/cluster-detector.test.d.ts +0 -2
  43. package/dist/__tests__/cluster-detector.test.d.ts.map +0 -1
  44. package/dist/__tests__/cluster-detector.test.js +0 -121
  45. package/dist/__tests__/cluster-detector.test.js.map +0 -1
  46. package/dist/__tests__/contract.test.d.ts +0 -2
  47. package/dist/__tests__/contract.test.d.ts.map +0 -1
  48. package/dist/__tests__/contract.test.js +0 -59
  49. package/dist/__tests__/contract.test.js.map +0 -1
  50. package/dist/__tests__/enhanced-cohesion.test.d.ts +0 -2
  51. package/dist/__tests__/enhanced-cohesion.test.d.ts.map +0 -1
  52. package/dist/__tests__/enhanced-cohesion.test.js +0 -119
  53. package/dist/__tests__/enhanced-cohesion.test.js.map +0 -1
  54. package/dist/__tests__/file-classification.test.d.ts +0 -2
  55. package/dist/__tests__/file-classification.test.d.ts.map +0 -1
  56. package/dist/__tests__/file-classification.test.js +0 -749
  57. package/dist/__tests__/file-classification.test.js.map +0 -1
  58. package/dist/__tests__/fragmentation-advanced.test.d.ts +0 -2
  59. package/dist/__tests__/fragmentation-advanced.test.d.ts.map +0 -1
  60. package/dist/__tests__/fragmentation-advanced.test.js +0 -44
  61. package/dist/__tests__/fragmentation-advanced.test.js.map +0 -1
  62. package/dist/__tests__/fragmentation-coupling.test.d.ts +0 -2
  63. package/dist/__tests__/fragmentation-coupling.test.d.ts.map +0 -1
  64. package/dist/__tests__/fragmentation-coupling.test.js +0 -52
  65. package/dist/__tests__/fragmentation-coupling.test.js.map +0 -1
  66. package/dist/__tests__/fragmentation-log.test.d.ts +0 -2
  67. package/dist/__tests__/fragmentation-log.test.d.ts.map +0 -1
  68. package/dist/__tests__/fragmentation-log.test.js +0 -29
  69. package/dist/__tests__/fragmentation-log.test.js.map +0 -1
  70. package/dist/__tests__/provider.test.d.ts +0 -2
  71. package/dist/__tests__/provider.test.d.ts.map +0 -1
  72. package/dist/__tests__/provider.test.js +0 -72
  73. package/dist/__tests__/provider.test.js.map +0 -1
  74. package/dist/__tests__/remediation.test.d.ts +0 -2
  75. package/dist/__tests__/remediation.test.d.ts.map +0 -1
  76. package/dist/__tests__/remediation.test.js +0 -61
  77. package/dist/__tests__/remediation.test.js.map +0 -1
  78. package/dist/__tests__/scoring.test.d.ts +0 -2
  79. package/dist/__tests__/scoring.test.d.ts.map +0 -1
  80. package/dist/__tests__/scoring.test.js +0 -298
  81. package/dist/__tests__/scoring.test.js.map +0 -1
  82. package/dist/__tests__/structural-cohesion.test.d.ts +0 -2
  83. package/dist/__tests__/structural-cohesion.test.d.ts.map +0 -1
  84. package/dist/__tests__/structural-cohesion.test.js +0 -35
  85. package/dist/__tests__/structural-cohesion.test.js.map +0 -1
  86. package/dist/analyzer.d.ts +0 -37
  87. package/dist/analyzer.d.ts.map +0 -1
  88. package/dist/analyzer.js +0 -283
  89. package/dist/analyzer.js.map +0 -1
  90. package/dist/analyzers/python-context.d.ts +0 -38
  91. package/dist/analyzers/python-context.d.ts.map +0 -1
  92. package/dist/analyzers/python-context.js +0 -234
  93. package/dist/analyzers/python-context.js.map +0 -1
  94. package/dist/ast-utils.d.ts +0 -16
  95. package/dist/ast-utils.d.ts.map +0 -1
  96. package/dist/ast-utils.js +0 -81
  97. package/dist/ast-utils.js.map +0 -1
  98. package/dist/chunk-22ZO4EKZ.mjs +0 -1297
  99. package/dist/chunk-2HE27YEV.mjs +0 -1739
  100. package/dist/chunk-45P4RDYP.mjs +0 -607
  101. package/dist/chunk-474DEGWW.mjs +0 -1792
  102. package/dist/chunk-4SYIJ7CU.mjs +0 -1538
  103. package/dist/chunk-4U4LDWGF.mjs +0 -360
  104. package/dist/chunk-4XQVYYPC.mjs +0 -1470
  105. package/dist/chunk-5CLU3HYU.mjs +0 -1475
  106. package/dist/chunk-5K73Q3OQ.mjs +0 -1520
  107. package/dist/chunk-5N5DCJOV.mjs +0 -583
  108. package/dist/chunk-6AVS4KTM.mjs +0 -1536
  109. package/dist/chunk-6FQYIG6I.mjs +0 -1298
  110. package/dist/chunk-6I4552YB.mjs +0 -1467
  111. package/dist/chunk-6LPITDKG.mjs +0 -1539
  112. package/dist/chunk-72QC5QUS.mjs +0 -549
  113. package/dist/chunk-736QSHJP.mjs +0 -1807
  114. package/dist/chunk-7LUSCLGR.mjs +0 -2058
  115. package/dist/chunk-7VK3XTSH.mjs +0 -1756
  116. package/dist/chunk-7ZEJGWLN.mjs +0 -1363
  117. package/dist/chunk-AECWO7NQ.mjs +0 -1539
  118. package/dist/chunk-AEK3MZC5.mjs +0 -709
  119. package/dist/chunk-AJC3FR6G.mjs +0 -1509
  120. package/dist/chunk-AMPK6SWS.mjs +0 -1754
  121. package/dist/chunk-BA7QGUHN.mjs +0 -1722
  122. package/dist/chunk-BCEZGRXI.mjs +0 -1297
  123. package/dist/chunk-BD4NWUVG.mjs +0 -1242
  124. package/dist/chunk-BEZPBI5C.mjs +0 -1829
  125. package/dist/chunk-BHCRDEE4.mjs +0 -1745
  126. package/dist/chunk-BW463GQB.mjs +0 -1767
  127. package/dist/chunk-CAX2MOUZ.mjs +0 -1801
  128. package/dist/chunk-CBWM3EK5.mjs +0 -1854
  129. package/dist/chunk-CCBNKQYB.mjs +0 -1812
  130. package/dist/chunk-CDIVYADN.mjs +0 -2110
  131. package/dist/chunk-CVGIDSMN.mjs +0 -1522
  132. package/dist/chunk-D25B5LZR.mjs +0 -1739
  133. package/dist/chunk-D3SIHB2V.mjs +0 -2118
  134. package/dist/chunk-DD7UVNE3.mjs +0 -678
  135. package/dist/chunk-DMRZMS2U.mjs +0 -964
  136. package/dist/chunk-DXG5NIYL.mjs +0 -1527
  137. package/dist/chunk-EBXG2Q5Y.mjs +0 -2059
  138. package/dist/chunk-EH3PMNZQ.mjs +0 -569
  139. package/dist/chunk-EMYD7NS6.mjs +0 -137
  140. package/dist/chunk-EVX2W2BK.mjs +0 -1896
  141. package/dist/chunk-EWFR366Y.mjs +0 -1740
  142. package/dist/chunk-EX7HCWAO.mjs +0 -625
  143. package/dist/chunk-FNPSK3CG.mjs +0 -1760
  144. package/dist/chunk-FO6YT6RG.mjs +0 -1751
  145. package/dist/chunk-FYI56A5M.mjs +0 -1892
  146. package/dist/chunk-G3CCJCBI.mjs +0 -1521
  147. package/dist/chunk-G7PO3DNK.mjs +0 -1072
  148. package/dist/chunk-GFADGYXZ.mjs +0 -1752
  149. package/dist/chunk-GTRIBVS6.mjs +0 -1467
  150. package/dist/chunk-GXTGOLZT.mjs +0 -92
  151. package/dist/chunk-H4HWBQU6.mjs +0 -1530
  152. package/dist/chunk-HDFXSEFW.mjs +0 -605
  153. package/dist/chunk-HOUDVRG2.mjs +0 -1422
  154. package/dist/chunk-HQNHM2X7.mjs +0 -997
  155. package/dist/chunk-I54HL4FZ.mjs +0 -781
  156. package/dist/chunk-I77HFFZU.mjs +0 -1876
  157. package/dist/chunk-IKRP7ECY.mjs +0 -1754
  158. package/dist/chunk-ILMLGJGI.mjs +0 -1295
  159. package/dist/chunk-IPIE5TXJ.mjs +0 -1741
  160. package/dist/chunk-IRWCPDWD.mjs +0 -779
  161. package/dist/chunk-J3MUOWHC.mjs +0 -1747
  162. package/dist/chunk-J5TA3AZU.mjs +0 -1795
  163. package/dist/chunk-JH535NPP.mjs +0 -1619
  164. package/dist/chunk-JUHHOSHG.mjs +0 -1808
  165. package/dist/chunk-JZ2SE4DB.mjs +0 -1116
  166. package/dist/chunk-K2WFOBAZ.mjs +0 -1821
  167. package/dist/chunk-K6U64EL3.mjs +0 -517
  168. package/dist/chunk-KDUUZQBK.mjs +0 -1692
  169. package/dist/chunk-KGFWKSGJ.mjs +0 -1442
  170. package/dist/chunk-KGVMS4R5.mjs +0 -1750
  171. package/dist/chunk-KWIS5FQP.mjs +0 -1739
  172. package/dist/chunk-KYSZF5N6.mjs +0 -1876
  173. package/dist/chunk-LERPI33Y.mjs +0 -2060
  174. package/dist/chunk-M64RHH4D.mjs +0 -1896
  175. package/dist/chunk-MBE4AQP5.mjs +0 -1362
  176. package/dist/chunk-MR7WXHIE.mjs +0 -1833
  177. package/dist/chunk-MZP3G7TF.mjs +0 -2118
  178. package/dist/chunk-N2GQWNFG.mjs +0 -1527
  179. package/dist/chunk-N6XBOOVA.mjs +0 -564
  180. package/dist/chunk-NJUW6VED.mjs +0 -610
  181. package/dist/chunk-NOHK5DLU.mjs +0 -2173
  182. package/dist/chunk-NQA3F2HJ.mjs +0 -1532
  183. package/dist/chunk-NXXQ2U73.mjs +0 -1467
  184. package/dist/chunk-OP4G6GLN.mjs +0 -1876
  185. package/dist/chunk-ORLC5Y4J.mjs +0 -1787
  186. package/dist/chunk-OTCQL7DY.mjs +0 -2045
  187. package/dist/chunk-OUYSZZ7X.mjs +0 -1846
  188. package/dist/chunk-OZE3FVZT.mjs +0 -1089
  189. package/dist/chunk-P3T3H27S.mjs +0 -1895
  190. package/dist/chunk-P5YV5WIX.mjs +0 -1803
  191. package/dist/chunk-P74BO725.mjs +0 -1296
  192. package/dist/chunk-PDN74MG3.mjs +0 -1834
  193. package/dist/chunk-PJD4VCIH.mjs +0 -1722
  194. package/dist/chunk-PVVCCE6W.mjs +0 -755
  195. package/dist/chunk-PVVMK56C.mjs +0 -1793
  196. package/dist/chunk-Q2GDZ2FZ.mjs +0 -1794
  197. package/dist/chunk-QDGPR3L6.mjs +0 -1518
  198. package/dist/chunk-RQCIJO5Z.mjs +0 -1116
  199. package/dist/chunk-RRB2C34Q.mjs +0 -1738
  200. package/dist/chunk-RYIB5CWD.mjs +0 -781
  201. package/dist/chunk-S6OPP4L5.mjs +0 -1791
  202. package/dist/chunk-SAVOSPM3.mjs +0 -1522
  203. package/dist/chunk-SFK6XTJE.mjs +0 -2110
  204. package/dist/chunk-SIX4KMF2.mjs +0 -1468
  205. package/dist/chunk-SPAM2YJE.mjs +0 -1537
  206. package/dist/chunk-T6ZCOPPI.mjs +0 -538
  207. package/dist/chunk-TPF75CNP.mjs +0 -581
  208. package/dist/chunk-TWWPY7FD.mjs +0 -1754
  209. package/dist/chunk-U5R2FTCR.mjs +0 -1803
  210. package/dist/chunk-UG7OPVHB.mjs +0 -1521
  211. package/dist/chunk-UMZTAWDA.mjs +0 -1812
  212. package/dist/chunk-UU4HZ7ZT.mjs +0 -1849
  213. package/dist/chunk-UXC6QUZ7.mjs +0 -1801
  214. package/dist/chunk-VBWXHKGD.mjs +0 -1895
  215. package/dist/chunk-VIJTZPBI.mjs +0 -1470
  216. package/dist/chunk-VLV6MXPL.mjs +0 -1750
  217. package/dist/chunk-VTALAPQZ.mjs +0 -1241
  218. package/dist/chunk-W2KNBN6W.mjs +0 -1849
  219. package/dist/chunk-W37E7MW5.mjs +0 -1403
  220. package/dist/chunk-W76FEISE.mjs +0 -1538
  221. package/dist/chunk-WCFQYXQA.mjs +0 -1532
  222. package/dist/chunk-WKOZOHOU.mjs +0 -2060
  223. package/dist/chunk-WTQJNY4U.mjs +0 -1785
  224. package/dist/chunk-XBFM2Z4O.mjs +0 -1792
  225. package/dist/chunk-XIXAWCMS.mjs +0 -1760
  226. package/dist/chunk-XTAXUNQN.mjs +0 -1742
  227. package/dist/chunk-XY77XABG.mjs +0 -1545
  228. package/dist/chunk-XZ645X5U.mjs +0 -1425
  229. package/dist/chunk-Y6FXYEAI.mjs +0 -10
  230. package/dist/chunk-YCGDIGOG.mjs +0 -1467
  231. package/dist/chunk-YYB6NZE3.mjs +0 -1869
  232. package/dist/chunk-Z5WY6A4P.mjs +0 -1754
  233. package/dist/chunk-ZAMFWKIB.mjs +0 -1842
  234. package/dist/classifier.d.ts +0 -114
  235. package/dist/classifier.d.ts.map +0 -1
  236. package/dist/classifier.js +0 -439
  237. package/dist/classifier.js.map +0 -1
  238. package/dist/cli-action-SA7SCYNV.mjs +0 -95
  239. package/dist/cli-action-VCXBZGZP.mjs +0 -95
  240. package/dist/cli-action-YAJOJCXJ.mjs +0 -95
  241. package/dist/cli.d.ts.map +0 -1
  242. package/dist/cli.js.map +0 -1
  243. package/dist/cluster-detector.d.ts +0 -8
  244. package/dist/cluster-detector.d.ts.map +0 -1
  245. package/dist/cluster-detector.js +0 -70
  246. package/dist/cluster-detector.js.map +0 -1
  247. package/dist/defaults.d.ts +0 -7
  248. package/dist/defaults.d.ts.map +0 -1
  249. package/dist/defaults.js +0 -54
  250. package/dist/defaults.js.map +0 -1
  251. package/dist/graph-builder.d.ts +0 -33
  252. package/dist/graph-builder.d.ts.map +0 -1
  253. package/dist/graph-builder.js +0 -225
  254. package/dist/graph-builder.js.map +0 -1
  255. package/dist/index.d.ts.map +0 -1
  256. package/dist/index.js.map +0 -1
  257. package/dist/metrics.d.ts +0 -34
  258. package/dist/metrics.d.ts.map +0 -1
  259. package/dist/metrics.js +0 -170
  260. package/dist/metrics.js.map +0 -1
  261. package/dist/orchestrator-3L3NAZYP.mjs +0 -10
  262. package/dist/orchestrator-5AL3XBPZ.mjs +0 -10
  263. package/dist/orchestrator-KMAKMHTD.mjs +0 -10
  264. package/dist/orchestrator-MONOZHVW.mjs +0 -10
  265. package/dist/orchestrator-R6MZT4Z2.mjs +0 -10
  266. package/dist/orchestrator-ZR7JSKWI.mjs +0 -10
  267. package/dist/provider.d.ts +0 -6
  268. package/dist/provider.d.ts.map +0 -1
  269. package/dist/provider.js +0 -48
  270. package/dist/provider.js.map +0 -1
  271. package/dist/python-context-3GZKN3LR.mjs +0 -162
  272. package/dist/python-context-GOH747QU.mjs +0 -202
  273. package/dist/python-context-O2EN3M6Z.mjs +0 -162
  274. package/dist/python-context-PAETRLDY.mjs +0 -185
  275. package/dist/python-context-TBI5FVFY.mjs +0 -203
  276. package/dist/python-context-UOPTQH44.mjs +0 -192
  277. package/dist/remediation.d.ts +0 -25
  278. package/dist/remediation.d.ts.map +0 -1
  279. package/dist/remediation.js +0 -98
  280. package/dist/remediation.js.map +0 -1
  281. package/dist/scoring.d.ts +0 -9
  282. package/dist/scoring.d.ts.map +0 -1
  283. package/dist/scoring.js +0 -142
  284. package/dist/scoring.js.map +0 -1
  285. package/dist/semantic-analysis.d.ts +0 -33
  286. package/dist/semantic-analysis.d.ts.map +0 -1
  287. package/dist/semantic-analysis.js +0 -303
  288. package/dist/semantic-analysis.js.map +0 -1
  289. package/dist/summary-7PZVW72O.mjs +0 -7
  290. package/dist/summary-LKUCJAIS.mjs +0 -7
  291. package/dist/summary.d.ts +0 -6
  292. package/dist/summary.d.ts.map +0 -1
  293. package/dist/summary.js +0 -92
  294. package/dist/summary.js.map +0 -1
  295. package/dist/types.d.ts +0 -124
  296. package/dist/types.d.ts.map +0 -1
  297. package/dist/types.js +0 -2
  298. package/dist/types.js.map +0 -1
  299. package/dist/utils/output-formatter.d.ts +0 -14
  300. package/dist/utils/output-formatter.d.ts.map +0 -1
  301. package/dist/utils/output-formatter.js +0 -338
  302. package/dist/utils/output-formatter.js.map +0 -1
@@ -1,16 +1,11 @@
1
- import {
2
- displayConsoleReport,
3
- generateHTMLReport,
4
- runInteractiveSetup
5
- } from "./chunk-J3SZQZNU.mjs";
6
1
  import {
7
2
  analyzeContext
8
- } from "./chunk-ILMLGJGI.mjs";
3
+ } from "./chunk-ISWPFG2C.mjs";
9
4
  import "./chunk-64U3PNO3.mjs";
10
5
  import {
11
6
  generateSummary
12
- } from "./chunk-BQCISA2F.mjs";
13
- import "./chunk-EMYD7NS6.mjs";
7
+ } from "./chunk-HD4Y3GYL.mjs";
8
+ import "./chunk-JSM7Q5CY.mjs";
14
9
 
15
10
  // src/cli-action.ts
16
11
  import {
@@ -49,6 +44,7 @@ async function contextActionHandler(directory, options) {
49
44
  maxResults: options.maxResults ? parseInt(options.maxResults) : void 0
50
45
  });
51
46
  if (options.interactive) {
47
+ const { runInteractiveSetup } = await import("./interactive-setup-JGFBFI3M.mjs");
52
48
  finalOptions = await runInteractiveSetup(directory, finalOptions);
53
49
  }
54
50
  const results = await analyzeContext(finalOptions);
@@ -71,6 +67,7 @@ async function contextActionHandler(directory, options) {
71
67
  options.outputFile
72
68
  );
73
69
  } else if (options.output === "html") {
70
+ const { generateHTMLReport } = await import("./html-report-ULELSIYG.mjs");
74
71
  const html = generateHTMLReport(summary, results);
75
72
  const outputPath = resolveOutputPath(
76
73
  directory,
@@ -81,6 +78,7 @@ async function contextActionHandler(directory, options) {
81
78
  console.log(chalk.green(`
82
79
  \u2705 HTML report saved to: ${outputPath}`));
83
80
  } else {
81
+ const { displayConsoleReport } = await import("./console-report-AP4JYNQY.mjs");
84
82
  displayConsoleReport(summary, results, finalOptions.maxResults);
85
83
  console.log(chalk.dim(`
86
84
  \u2728 Analysis completed in ${duration}ms
package/dist/cli.js CHANGED
@@ -974,66 +974,66 @@ var init_file_classifiers = __esm({
974
974
  // src/classifier.ts
975
975
  function classifyFile(node, cohesionScore = 1, domains = []) {
976
976
  if (isBoilerplateBarrel(node)) {
977
- return Classification.BOILERPLATE;
977
+ return CLASSIFICATION.BOILERPLATE;
978
978
  }
979
979
  if (isBarrelExport(node)) {
980
- return Classification.BARREL;
980
+ return CLASSIFICATION.BARREL;
981
981
  }
982
982
  if (isTypeDefinition(node)) {
983
- return Classification.TYPE_DEFINITION;
983
+ return CLASSIFICATION.TYPE_DEFINITION;
984
984
  }
985
985
  if (isNextJsPage(node)) {
986
- return Classification.NEXTJS_PAGE;
986
+ return CLASSIFICATION.NEXTJS_PAGE;
987
987
  }
988
988
  if (isLambdaHandler(node)) {
989
- return Classification.LAMBDA_HANDLER;
989
+ return CLASSIFICATION.LAMBDA_HANDLER;
990
990
  }
991
991
  if (isServiceFile(node)) {
992
- return Classification.SERVICE;
992
+ return CLASSIFICATION.SERVICE;
993
993
  }
994
994
  if (isEmailTemplate(node)) {
995
- return Classification.EMAIL_TEMPLATE;
995
+ return CLASSIFICATION.EMAIL_TEMPLATE;
996
996
  }
997
997
  if (isParserFile(node)) {
998
- return Classification.PARSER;
998
+ return CLASSIFICATION.PARSER;
999
999
  }
1000
1000
  if (isSessionFile(node)) {
1001
1001
  if (cohesionScore >= 0.25 && domains.length <= 1)
1002
- return Classification.COHESIVE_MODULE;
1003
- return Classification.UTILITY_MODULE;
1002
+ return CLASSIFICATION.COHESIVE_MODULE;
1003
+ return CLASSIFICATION.UTILITY_MODULE;
1004
1004
  }
1005
1005
  if (isUtilityModule(node)) {
1006
- return Classification.UTILITY_MODULE;
1006
+ return CLASSIFICATION.UTILITY_MODULE;
1007
1007
  }
1008
1008
  if (isConfigFile(node)) {
1009
- return Classification.COHESIVE_MODULE;
1009
+ return CLASSIFICATION.COHESIVE_MODULE;
1010
1010
  }
1011
1011
  if (isHubAndSpokeFile(node)) {
1012
- return Classification.SPOKE_MODULE;
1012
+ return CLASSIFICATION.SPOKE_MODULE;
1013
1013
  }
1014
1014
  if (domains.length <= 1 && domains[0] !== "unknown") {
1015
- return Classification.COHESIVE_MODULE;
1015
+ return CLASSIFICATION.COHESIVE_MODULE;
1016
1016
  }
1017
1017
  if (domains.length > 1 && cohesionScore < 0.4) {
1018
- return Classification.MIXED_CONCERNS;
1018
+ return CLASSIFICATION.MIXED_CONCERNS;
1019
1019
  }
1020
1020
  if (cohesionScore >= 0.7) {
1021
- return Classification.COHESIVE_MODULE;
1021
+ return CLASSIFICATION.COHESIVE_MODULE;
1022
1022
  }
1023
- return Classification.UNKNOWN;
1023
+ return CLASSIFICATION.UNKNOWN;
1024
1024
  }
1025
1025
  function adjustCohesionForClassification(baseCohesion, classification, node) {
1026
1026
  switch (classification) {
1027
- case Classification.BOILERPLATE:
1027
+ case CLASSIFICATION.BOILERPLATE:
1028
1028
  return 0.2;
1029
1029
  // Redundant indirection is low cohesion (architectural theater)
1030
- case Classification.BARREL:
1030
+ case CLASSIFICATION.BARREL:
1031
1031
  return 1;
1032
- case Classification.TYPE_DEFINITION:
1032
+ case CLASSIFICATION.TYPE_DEFINITION:
1033
1033
  return 1;
1034
- case Classification.NEXTJS_PAGE:
1034
+ case CLASSIFICATION.NEXTJS_PAGE:
1035
1035
  return 1;
1036
- case Classification.UTILITY_MODULE: {
1036
+ case CLASSIFICATION.UTILITY_MODULE: {
1037
1037
  if (node && hasRelatedExportNames(
1038
1038
  (node.exports || []).map((e) => e.name.toLowerCase())
1039
1039
  )) {
@@ -1041,19 +1041,19 @@ function adjustCohesionForClassification(baseCohesion, classification, node) {
1041
1041
  }
1042
1042
  return Math.max(0.75, Math.min(1, baseCohesion + 0.35));
1043
1043
  }
1044
- case Classification.SERVICE:
1044
+ case CLASSIFICATION.SERVICE:
1045
1045
  return Math.max(0.72, Math.min(1, baseCohesion + 0.3));
1046
- case Classification.LAMBDA_HANDLER:
1046
+ case CLASSIFICATION.LAMBDA_HANDLER:
1047
1047
  return Math.max(0.75, Math.min(1, baseCohesion + 0.35));
1048
- case Classification.EMAIL_TEMPLATE:
1048
+ case CLASSIFICATION.EMAIL_TEMPLATE:
1049
1049
  return Math.max(0.72, Math.min(1, baseCohesion + 0.3));
1050
- case Classification.PARSER:
1050
+ case CLASSIFICATION.PARSER:
1051
1051
  return Math.max(0.7, Math.min(1, baseCohesion + 0.3));
1052
- case Classification.SPOKE_MODULE:
1052
+ case CLASSIFICATION.SPOKE_MODULE:
1053
1053
  return Math.max(baseCohesion, 0.6);
1054
- case Classification.COHESIVE_MODULE:
1054
+ case CLASSIFICATION.COHESIVE_MODULE:
1055
1055
  return Math.max(baseCohesion, 0.7);
1056
- case Classification.MIXED_CONCERNS:
1056
+ case CLASSIFICATION.MIXED_CONCERNS:
1057
1057
  return baseCohesion;
1058
1058
  default:
1059
1059
  return Math.min(1, baseCohesion + 0.1);
@@ -1102,37 +1102,37 @@ function hasRelatedExportNames(exportNames) {
1102
1102
  }
1103
1103
  function adjustFragmentationForClassification(baseFragmentation, classification) {
1104
1104
  switch (classification) {
1105
- case Classification.BOILERPLATE:
1105
+ case CLASSIFICATION.BOILERPLATE:
1106
1106
  return baseFragmentation * 1.5;
1107
1107
  // Redundant barrels increase fragmentation
1108
- case Classification.BARREL:
1108
+ case CLASSIFICATION.BARREL:
1109
1109
  return 0;
1110
- case Classification.TYPE_DEFINITION:
1110
+ case CLASSIFICATION.TYPE_DEFINITION:
1111
1111
  return 0;
1112
- case Classification.UTILITY_MODULE:
1113
- case Classification.SERVICE:
1114
- case Classification.LAMBDA_HANDLER:
1115
- case Classification.EMAIL_TEMPLATE:
1116
- case Classification.PARSER:
1117
- case Classification.NEXTJS_PAGE:
1112
+ case CLASSIFICATION.UTILITY_MODULE:
1113
+ case CLASSIFICATION.SERVICE:
1114
+ case CLASSIFICATION.LAMBDA_HANDLER:
1115
+ case CLASSIFICATION.EMAIL_TEMPLATE:
1116
+ case CLASSIFICATION.PARSER:
1117
+ case CLASSIFICATION.NEXTJS_PAGE:
1118
1118
  return baseFragmentation * 0.2;
1119
- case Classification.SPOKE_MODULE:
1119
+ case CLASSIFICATION.SPOKE_MODULE:
1120
1120
  return baseFragmentation * 0.15;
1121
1121
  // Heavily discount intentional monorepo separation
1122
- case Classification.COHESIVE_MODULE:
1122
+ case CLASSIFICATION.COHESIVE_MODULE:
1123
1123
  return baseFragmentation * 0.3;
1124
- case Classification.MIXED_CONCERNS:
1124
+ case CLASSIFICATION.MIXED_CONCERNS:
1125
1125
  return baseFragmentation;
1126
1126
  default:
1127
1127
  return baseFragmentation * 0.7;
1128
1128
  }
1129
1129
  }
1130
- var Classification;
1130
+ var CLASSIFICATION;
1131
1131
  var init_classifier = __esm({
1132
1132
  "src/classifier.ts"() {
1133
1133
  "use strict";
1134
1134
  init_file_classifiers();
1135
- Classification = {
1135
+ CLASSIFICATION = {
1136
1136
  BARREL: "barrel-export",
1137
1137
  BOILERPLATE: "boilerplate-barrel",
1138
1138
  TYPE_DEFINITION: "type-definition",
@@ -1659,11 +1659,37 @@ function generateSummary(results, options = {}) {
1659
1659
  const deepFiles = results.filter((r) => r.importDepth > 5).map((r) => ({ file: r.file, depth: r.importDepth }));
1660
1660
  const maxImportDepth = Math.max(0, ...results.map((r) => r.importDepth));
1661
1661
  const moduleMap = /* @__PURE__ */ new Map();
1662
+ const rootDir = config.rootDir || "";
1662
1663
  results.forEach((r) => {
1663
- const parts = r.file.split("/");
1664
+ let relativePath = r.file;
1665
+ if (rootDir && r.file.startsWith(rootDir)) {
1666
+ relativePath = r.file.slice(rootDir.length);
1667
+ if (relativePath.startsWith("/")) relativePath = relativePath.slice(1);
1668
+ }
1669
+ const parts = relativePath.split("/");
1664
1670
  let domain = "root";
1665
- if (parts.length > 2) {
1666
- domain = parts.slice(0, 2).join("/");
1671
+ const domainIndicators = ["packages", "apps", "src", "lib", "modules"];
1672
+ for (let i = 0; i < parts.length - 1; i++) {
1673
+ if (domainIndicators.includes(parts[i]) && parts[i + 1]) {
1674
+ domain = `${parts[i]}/${parts[i + 1]}`;
1675
+ break;
1676
+ }
1677
+ }
1678
+ if (domain === "root" && parts.length > 1) {
1679
+ const skipPrefixes = [
1680
+ "src",
1681
+ "lib",
1682
+ "dist",
1683
+ "build",
1684
+ "out",
1685
+ "node_modules"
1686
+ ];
1687
+ for (let i = 0; i < parts.length - 1; i++) {
1688
+ if (!skipPrefixes.includes(parts[i]) && parts[i] !== "") {
1689
+ domain = parts[i];
1690
+ break;
1691
+ }
1692
+ }
1667
1693
  }
1668
1694
  if (!moduleMap.has(domain)) moduleMap.set(domain, []);
1669
1695
  moduleMap.get(domain).push(r);
@@ -1673,14 +1699,21 @@ function generateSummary(results, options = {}) {
1673
1699
  const clusterTokens = files.reduce((sum, f) => sum + f.tokenCost, 0);
1674
1700
  const filePaths = files.map((f) => f.file);
1675
1701
  const avgEntropy = calculatePathEntropy(filePaths);
1676
- const fragmentationScore = Math.min(1, avgEntropy * (files.length / 10));
1702
+ const avgCohesion2 = files.reduce((sum, f) => sum + f.cohesionScore, 0) / files.length;
1703
+ const cohesionFactor = avgCohesion2 < 0.5 ? (0.5 - avgCohesion2) * 2 : 0;
1704
+ const entropyFactor = avgEntropy > 0.7 ? (avgEntropy - 0.7) * 3.33 : 0;
1705
+ const sizeFactor = files.length > 20 ? Math.min(1, (files.length - 20) / 80) : 0;
1706
+ const fragmentationScore = Math.min(
1707
+ 1,
1708
+ cohesionFactor * 0.5 + entropyFactor * 0.3 + sizeFactor * 0.2
1709
+ );
1677
1710
  if (fragmentationScore > 0.4) {
1678
1711
  fragmentedModules.push({
1679
1712
  domain,
1680
1713
  files: filePaths,
1681
1714
  fragmentationScore,
1682
1715
  totalTokens: clusterTokens,
1683
- avgCohesion: files.reduce((sum, f) => sum + f.cohesionScore, 0) / files.length,
1716
+ avgCohesion: avgCohesion2,
1684
1717
  suggestedStructure: {
1685
1718
  targetFiles: Math.ceil(files.length / 2),
1686
1719
  consolidationPlan: [
@@ -1737,85 +1770,94 @@ var init_summary = __esm({
1737
1770
  }
1738
1771
  });
1739
1772
 
1740
- // src/report/console-report.ts
1741
- function displayConsoleReport(summary, results, maxResults = 10) {
1742
- const divider = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
1743
- const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
1744
- console.log(import_chalk.default.bold("\u{1F4CA} Context Analysis Summary:\n"));
1745
- console.log(` \u2022 Total Files: ${import_chalk.default.cyan(summary.totalFiles)}`);
1746
- console.log(
1747
- ` \u2022 Total Tokens: ${import_chalk.default.cyan(summary.totalTokens.toLocaleString())}`
1748
- );
1749
- console.log(
1750
- ` \u2022 Avg Budget: ${import_chalk.default.cyan(summary.avgContextBudget.toFixed(0))} tokens`
1751
- );
1752
- console.log(
1753
- ` \u2022 Potential Saving: ${import_chalk.default.green(summary.totalPotentialSavings.toLocaleString())} tokens`
1754
- );
1755
- console.log();
1756
- if (totalIssues > 0) {
1757
- console.log(import_chalk.default.bold("\u26A0\uFE0F Issues Detected:\n"));
1758
- console.log(` \u2022 ${import_chalk.default.red("\u{1F534} Critical:")} ${summary.criticalIssues}`);
1759
- console.log(` \u2022 ${import_chalk.default.yellow("\u{1F7E1} Major:")} ${summary.majorIssues}`);
1760
- console.log(` \u2022 ${import_chalk.default.blue("\u{1F535} Minor:")} ${summary.minorIssues}`);
1761
- console.log();
1762
- } else {
1763
- console.log(import_chalk.default.green("\u2705 No significant context issues detected!\n"));
1773
+ // src/report/interactive-setup.ts
1774
+ var interactive_setup_exports = {};
1775
+ __export(interactive_setup_exports, {
1776
+ runInteractiveSetup: () => runInteractiveSetup
1777
+ });
1778
+ async function runInteractiveSetup(directory, current) {
1779
+ console.log(import_chalk.default.yellow("\u{1F9ED} Interactive mode: let's tailor the analysis."));
1780
+ const pkgPath = (0, import_path3.join)(directory, "package.json");
1781
+ let deps = {};
1782
+ if ((0, import_fs2.existsSync)(pkgPath)) {
1783
+ try {
1784
+ const pkg = JSON.parse((0, import_fs2.readFileSync)(pkgPath, "utf-8"));
1785
+ deps = { ...pkg.dependencies || {}, ...pkg.devDependencies || {} };
1786
+ } catch (e) {
1787
+ void e;
1788
+ }
1764
1789
  }
1765
- if (summary.fragmentedModules.length > 0) {
1766
- console.log(import_chalk.default.bold("\u{1F9E9} Top Fragmented Modules:\n"));
1767
- summary.fragmentedModules.slice(0, maxResults).forEach((mod) => {
1768
- const scoreColor = mod.fragmentationScore > 0.7 ? import_chalk.default.red : mod.fragmentationScore > 0.4 ? import_chalk.default.yellow : import_chalk.default.green;
1769
- console.log(
1770
- ` ${scoreColor("\u25A0")} ${import_chalk.default.white(mod.domain)} ${import_chalk.default.dim(`(${mod.files.length} files, ${(mod.fragmentationScore * 100).toFixed(0)}% frag)`)}`
1771
- );
1772
- });
1773
- console.log();
1790
+ const hasNextJs = (0, import_fs2.existsSync)((0, import_path3.join)(directory, ".next")) || !!deps["next"];
1791
+ const hasCDK = (0, import_fs2.existsSync)((0, import_path3.join)(directory, "cdk.out")) || !!deps["aws-cdk-lib"] || Object.keys(deps).some((d) => d.startsWith("@aws-cdk/"));
1792
+ const recommendedExcludes = new Set(current.exclude || []);
1793
+ if (hasNextJs && !Array.from(recommendedExcludes).some((p) => p.includes(".next"))) {
1794
+ recommendedExcludes.add("**/.next/**");
1774
1795
  }
1775
- if (summary.topExpensiveFiles.length > 0) {
1776
- console.log(import_chalk.default.bold("\u{1F4B8} Most Expensive Files (Context Budget):\n"));
1777
- summary.topExpensiveFiles.slice(0, maxResults).forEach((item) => {
1778
- const fileName = item.file.split("/").slice(-2).join("/");
1779
- const severityColor = item.severity === "critical" ? import_chalk.default.red : item.severity === "major" ? import_chalk.default.yellow : import_chalk.default.blue;
1780
- console.log(
1781
- ` ${severityColor("\u25CF")} ${import_chalk.default.white(fileName)} ${import_chalk.default.dim(`- ${item.contextBudget.toLocaleString()} tokens`)}`
1782
- );
1783
- });
1784
- console.log();
1796
+ if (hasCDK && !Array.from(recommendedExcludes).some((p) => p.includes("cdk.out"))) {
1797
+ recommendedExcludes.add("**/cdk.out/**");
1785
1798
  }
1786
- if (totalIssues > 0) {
1787
- console.log(import_chalk.default.bold("\u{1F4A1} Top Recommendations:\n"));
1788
- const topFiles = results.filter((r) => r.severity === "critical" || r.severity === "major").slice(0, 3);
1789
- topFiles.forEach((result, index) => {
1790
- const fileName = result.file.split("/").slice(-2).join("/");
1791
- console.log(import_chalk.default.cyan(` ${index + 1}. ${fileName}`));
1792
- result.recommendations.slice(0, 2).forEach((rec) => {
1793
- console.log(import_chalk.default.dim(` \u2022 ${rec}`));
1794
- });
1795
- });
1796
- console.log();
1799
+ const { applyExcludes } = await (0, import_prompts.default)({
1800
+ type: "toggle",
1801
+ name: "applyExcludes",
1802
+ message: `Detected ${hasNextJs ? "Next.js " : ""}${hasCDK ? "AWS CDK " : ""}frameworks. Apply recommended excludes?`,
1803
+ initial: true,
1804
+ active: "yes",
1805
+ inactive: "no"
1806
+ });
1807
+ const nextOptions = { ...current };
1808
+ if (applyExcludes) {
1809
+ nextOptions.exclude = Array.from(recommendedExcludes);
1797
1810
  }
1798
- console.log(import_chalk.default.cyan(divider));
1799
- console.log(
1800
- import_chalk.default.dim(
1801
- "\n\u2B50 Like aiready? Star us on GitHub: https://github.com/caopengau/aiready-context-analyzer"
1802
- )
1803
- );
1804
- console.log(
1805
- import_chalk.default.dim(
1806
- "\u{1F41B} Found a bug? Report it: https://github.com/caopengau/aiready-context-analyzer/issues\n"
1807
- )
1808
- );
1811
+ const { focusArea } = await (0, import_prompts.default)({
1812
+ type: "select",
1813
+ name: "focusArea",
1814
+ message: "Which areas to focus?",
1815
+ choices: [
1816
+ { title: "Frontend (web app)", value: "frontend" },
1817
+ { title: "Backend (API/infra)", value: "backend" },
1818
+ { title: "Both", value: "both" }
1819
+ ],
1820
+ initial: 2
1821
+ });
1822
+ if (focusArea === "frontend") {
1823
+ nextOptions.include = ["**/*.{ts,tsx,js,jsx}"];
1824
+ nextOptions.exclude = Array.from(
1825
+ /* @__PURE__ */ new Set([
1826
+ ...nextOptions.exclude || [],
1827
+ "**/cdk.out/**",
1828
+ "**/infra/**",
1829
+ "**/server/**",
1830
+ "**/backend/**"
1831
+ ])
1832
+ );
1833
+ } else if (focusArea === "backend") {
1834
+ nextOptions.include = [
1835
+ "**/api/**",
1836
+ "**/server/**",
1837
+ "**/backend/**",
1838
+ "**/infra/**",
1839
+ "**/*.{ts,js,py,java}"
1840
+ ];
1841
+ }
1842
+ console.log(import_chalk.default.green("\u2713 Interactive configuration applied."));
1843
+ return nextOptions;
1809
1844
  }
1810
- var import_chalk;
1811
- var init_console_report = __esm({
1812
- "src/report/console-report.ts"() {
1845
+ var import_chalk, import_fs2, import_path3, import_prompts;
1846
+ var init_interactive_setup = __esm({
1847
+ "src/report/interactive-setup.ts"() {
1813
1848
  "use strict";
1814
1849
  import_chalk = __toESM(require("chalk"));
1850
+ import_fs2 = require("fs");
1851
+ import_path3 = require("path");
1852
+ import_prompts = __toESM(require("prompts"));
1815
1853
  }
1816
1854
  });
1817
1855
 
1818
1856
  // src/report/html-report.ts
1857
+ var html_report_exports = {};
1858
+ __export(html_report_exports, {
1859
+ generateHTMLReport: () => generateHTMLReport
1860
+ });
1819
1861
  function generateHTMLReport(summary, results) {
1820
1862
  const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
1821
1863
  void results;
@@ -1888,82 +1930,85 @@ var init_html_report = __esm({
1888
1930
  }
1889
1931
  });
1890
1932
 
1891
- // src/report/interactive-setup.ts
1892
- async function runInteractiveSetup(directory, current) {
1893
- console.log(import_chalk2.default.yellow("\u{1F9ED} Interactive mode: let's tailor the analysis."));
1894
- const pkgPath = (0, import_path3.join)(directory, "package.json");
1895
- let deps = {};
1896
- if ((0, import_fs2.existsSync)(pkgPath)) {
1897
- try {
1898
- const pkg = JSON.parse((0, import_fs2.readFileSync)(pkgPath, "utf-8"));
1899
- deps = { ...pkg.dependencies || {}, ...pkg.devDependencies || {} };
1900
- } catch (e) {
1901
- void e;
1902
- }
1903
- }
1904
- const hasNextJs = (0, import_fs2.existsSync)((0, import_path3.join)(directory, ".next")) || !!deps["next"];
1905
- const hasCDK = (0, import_fs2.existsSync)((0, import_path3.join)(directory, "cdk.out")) || !!deps["aws-cdk-lib"] || Object.keys(deps).some((d) => d.startsWith("@aws-cdk/"));
1906
- const recommendedExcludes = new Set(current.exclude || []);
1907
- if (hasNextJs && !Array.from(recommendedExcludes).some((p) => p.includes(".next"))) {
1908
- recommendedExcludes.add("**/.next/**");
1933
+ // src/report/console-report.ts
1934
+ var console_report_exports = {};
1935
+ __export(console_report_exports, {
1936
+ displayConsoleReport: () => displayConsoleReport
1937
+ });
1938
+ function displayConsoleReport(summary, results, maxResults = 10) {
1939
+ const divider = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
1940
+ const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
1941
+ console.log(import_chalk2.default.bold("\u{1F4CA} Context Analysis Summary:\n"));
1942
+ console.log(` \u2022 Total Files: ${import_chalk2.default.cyan(summary.totalFiles)}`);
1943
+ console.log(
1944
+ ` \u2022 Total Tokens: ${import_chalk2.default.cyan(summary.totalTokens.toLocaleString())}`
1945
+ );
1946
+ console.log(
1947
+ ` \u2022 Avg Budget: ${import_chalk2.default.cyan(summary.avgContextBudget.toFixed(0))} tokens`
1948
+ );
1949
+ console.log(
1950
+ ` \u2022 Potential Saving: ${import_chalk2.default.green(summary.totalPotentialSavings.toLocaleString())} tokens`
1951
+ );
1952
+ console.log();
1953
+ if (totalIssues > 0) {
1954
+ console.log(import_chalk2.default.bold("\u26A0\uFE0F Issues Detected:\n"));
1955
+ console.log(` \u2022 ${import_chalk2.default.red("\u{1F534} Critical:")} ${summary.criticalIssues}`);
1956
+ console.log(` \u2022 ${import_chalk2.default.yellow("\u{1F7E1} Major:")} ${summary.majorIssues}`);
1957
+ console.log(` \u2022 ${import_chalk2.default.blue("\u{1F535} Minor:")} ${summary.minorIssues}`);
1958
+ console.log();
1959
+ } else {
1960
+ console.log(import_chalk2.default.green("\u2705 No significant context issues detected!\n"));
1909
1961
  }
1910
- if (hasCDK && !Array.from(recommendedExcludes).some((p) => p.includes("cdk.out"))) {
1911
- recommendedExcludes.add("**/cdk.out/**");
1962
+ if (summary.fragmentedModules.length > 0) {
1963
+ console.log(import_chalk2.default.bold("\u{1F9E9} Top Fragmented Modules:\n"));
1964
+ summary.fragmentedModules.slice(0, maxResults).forEach((mod) => {
1965
+ const scoreColor = mod.fragmentationScore > 0.7 ? import_chalk2.default.red : mod.fragmentationScore > 0.4 ? import_chalk2.default.yellow : import_chalk2.default.green;
1966
+ console.log(
1967
+ ` ${scoreColor("\u25A0")} ${import_chalk2.default.white(mod.domain)} ${import_chalk2.default.dim(`(${mod.files.length} files, ${(mod.fragmentationScore * 100).toFixed(0)}% frag)`)}`
1968
+ );
1969
+ });
1970
+ console.log();
1912
1971
  }
1913
- const { applyExcludes } = await (0, import_prompts.default)({
1914
- type: "toggle",
1915
- name: "applyExcludes",
1916
- message: `Detected ${hasNextJs ? "Next.js " : ""}${hasCDK ? "AWS CDK " : ""}frameworks. Apply recommended excludes?`,
1917
- initial: true,
1918
- active: "yes",
1919
- inactive: "no"
1920
- });
1921
- const nextOptions = { ...current };
1922
- if (applyExcludes) {
1923
- nextOptions.exclude = Array.from(recommendedExcludes);
1972
+ if (summary.topExpensiveFiles.length > 0) {
1973
+ console.log(import_chalk2.default.bold("\u{1F4B8} Most Expensive Files (Context Budget):\n"));
1974
+ summary.topExpensiveFiles.slice(0, maxResults).forEach((item) => {
1975
+ const fileName = item.file.split("/").slice(-2).join("/");
1976
+ const severityColor = item.severity === "critical" ? import_chalk2.default.red : item.severity === "major" ? import_chalk2.default.yellow : import_chalk2.default.blue;
1977
+ console.log(
1978
+ ` ${severityColor("\u25CF")} ${import_chalk2.default.white(fileName)} ${import_chalk2.default.dim(`- ${item.contextBudget.toLocaleString()} tokens`)}`
1979
+ );
1980
+ });
1981
+ console.log();
1924
1982
  }
1925
- const { focusArea } = await (0, import_prompts.default)({
1926
- type: "select",
1927
- name: "focusArea",
1928
- message: "Which areas to focus?",
1929
- choices: [
1930
- { title: "Frontend (web app)", value: "frontend" },
1931
- { title: "Backend (API/infra)", value: "backend" },
1932
- { title: "Both", value: "both" }
1933
- ],
1934
- initial: 2
1935
- });
1936
- if (focusArea === "frontend") {
1937
- nextOptions.include = ["**/*.{ts,tsx,js,jsx}"];
1938
- nextOptions.exclude = Array.from(
1939
- /* @__PURE__ */ new Set([
1940
- ...nextOptions.exclude || [],
1941
- "**/cdk.out/**",
1942
- "**/infra/**",
1943
- "**/server/**",
1944
- "**/backend/**"
1945
- ])
1946
- );
1947
- } else if (focusArea === "backend") {
1948
- nextOptions.include = [
1949
- "**/api/**",
1950
- "**/server/**",
1951
- "**/backend/**",
1952
- "**/infra/**",
1953
- "**/*.{ts,js,py,java}"
1954
- ];
1983
+ if (totalIssues > 0) {
1984
+ console.log(import_chalk2.default.bold("\u{1F4A1} Top Recommendations:\n"));
1985
+ const topFiles = results.filter((r) => r.severity === "critical" || r.severity === "major").slice(0, 3);
1986
+ topFiles.forEach((result, index) => {
1987
+ const fileName = result.file.split("/").slice(-2).join("/");
1988
+ console.log(import_chalk2.default.cyan(` ${index + 1}. ${fileName}`));
1989
+ result.recommendations.slice(0, 2).forEach((rec) => {
1990
+ console.log(import_chalk2.default.dim(` \u2022 ${rec}`));
1991
+ });
1992
+ });
1993
+ console.log();
1955
1994
  }
1956
- console.log(import_chalk2.default.green("\u2713 Interactive configuration applied."));
1957
- return nextOptions;
1995
+ console.log(import_chalk2.default.cyan(divider));
1996
+ console.log(
1997
+ import_chalk2.default.dim(
1998
+ "\n\u2B50 Like aiready? Star us on GitHub: https://github.com/caopengau/aiready-context-analyzer"
1999
+ )
2000
+ );
2001
+ console.log(
2002
+ import_chalk2.default.dim(
2003
+ "\u{1F41B} Found a bug? Report it: https://github.com/caopengau/aiready-context-analyzer/issues\n"
2004
+ )
2005
+ );
1958
2006
  }
1959
- var import_chalk2, import_fs2, import_path3, import_prompts;
1960
- var init_interactive_setup = __esm({
1961
- "src/report/interactive-setup.ts"() {
2007
+ var import_chalk2;
2008
+ var init_console_report = __esm({
2009
+ "src/report/console-report.ts"() {
1962
2010
  "use strict";
1963
2011
  import_chalk2 = __toESM(require("chalk"));
1964
- import_fs2 = require("fs");
1965
- import_path3 = require("path");
1966
- import_prompts = __toESM(require("prompts"));
1967
2012
  }
1968
2013
  });
1969
2014
 
@@ -1999,7 +2044,8 @@ async function contextActionHandler(directory, options) {
1999
2044
  maxResults: options.maxResults ? parseInt(options.maxResults) : void 0
2000
2045
  });
2001
2046
  if (options.interactive) {
2002
- finalOptions = await runInteractiveSetup(directory, finalOptions);
2047
+ const { runInteractiveSetup: runInteractiveSetup2 } = await Promise.resolve().then(() => (init_interactive_setup(), interactive_setup_exports));
2048
+ finalOptions = await runInteractiveSetup2(directory, finalOptions);
2003
2049
  }
2004
2050
  const results = await analyzeContext(finalOptions);
2005
2051
  const summary = generateSummary(results, finalOptions);
@@ -2021,7 +2067,8 @@ async function contextActionHandler(directory, options) {
2021
2067
  options.outputFile
2022
2068
  );
2023
2069
  } else if (options.output === "html") {
2024
- const html = generateHTMLReport(summary, results);
2070
+ const { generateHTMLReport: generateHTMLReport2 } = await Promise.resolve().then(() => (init_html_report(), html_report_exports));
2071
+ const html = generateHTMLReport2(summary, results);
2025
2072
  const outputPath = (0, import_core9.resolveOutputPath)(
2026
2073
  directory,
2027
2074
  options.outputFile,
@@ -2031,7 +2078,8 @@ async function contextActionHandler(directory, options) {
2031
2078
  console.log(import_chalk3.default.green(`
2032
2079
  \u2705 HTML report saved to: ${outputPath}`));
2033
2080
  } else {
2034
- displayConsoleReport(summary, results, finalOptions.maxResults);
2081
+ const { displayConsoleReport: displayConsoleReport2 } = await Promise.resolve().then(() => (init_console_report(), console_report_exports));
2082
+ displayConsoleReport2(summary, results, finalOptions.maxResults);
2035
2083
  console.log(import_chalk3.default.dim(`
2036
2084
  \u2728 Analysis completed in ${duration}ms
2037
2085
  `));
@@ -2047,9 +2095,6 @@ var init_cli_action = __esm({
2047
2095
  import_core9 = require("@aiready/core");
2048
2096
  init_orchestrator();
2049
2097
  init_summary();
2050
- init_console_report();
2051
- init_html_report();
2052
- init_interactive_setup();
2053
2098
  import_chalk3 = __toESM(require("chalk"));
2054
2099
  import_fs3 = require("fs");
2055
2100
  }
package/dist/cli.mjs CHANGED
@@ -37,7 +37,7 @@ function defineContextCommand(program2) {
37
37
  "--interactive",
38
38
  "Run interactive setup to suggest excludes and focus areas"
39
39
  ).action(async (directory, options) => {
40
- const { contextActionHandler } = await import("./cli-action-HREY7TK5.mjs");
40
+ const { contextActionHandler } = await import("./cli-action-W7TESWAV.mjs");
41
41
  await contextActionHandler(directory, options);
42
42
  });
43
43
  }