@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.
- package/.turbo/turbo-build.log +33 -32
- package/.turbo/turbo-format-check.log +1 -1
- package/.turbo/turbo-lint.log +8 -0
- package/dist/chunk-HD4Y3GYL.mjs +124 -0
- package/dist/{chunk-M2EGQ36M.mjs → chunk-ISWPFG2C.mjs} +43 -98
- package/dist/{chunk-BQCISA2F.mjs → chunk-QW6ULRML.mjs} +32 -6
- package/dist/{chunk-WHB7QI7N.mjs → chunk-T733LS62.mjs} +23 -4
- package/dist/{cli-action-CXIHOVAC.mjs → cli-action-FV4G4OB6.mjs} +3 -3
- package/dist/{cli-action-3CWN7PBE.mjs → cli-action-HYSWE7F4.mjs} +3 -3
- package/dist/{cli-action-MLFCIW2O.mjs → cli-action-VIQZSWSP.mjs} +3 -3
- package/dist/{cli-action-E7UGP4KE.mjs → cli-action-W7TESWAV.mjs} +6 -8
- package/dist/cli.js +236 -191
- package/dist/cli.mjs +1 -1
- package/dist/console-report-AP4JYNQY.mjs +74 -0
- package/dist/html-report-ULELSIYG.mjs +73 -0
- package/dist/index.d.mts +69 -337
- package/dist/index.d.ts +69 -337
- package/dist/index.js +90 -452
- package/dist/index.mjs +9 -157
- package/dist/interactive-setup-JGFBFI3M.mjs +75 -0
- package/dist/{orchestrator-3ERQS3NW.mjs → orchestrator-QNE2E4TE.mjs} +2 -2
- package/dist/summary-GQRWW3A2.mjs +7 -0
- package/dist/summary-JTBS7CPM.mjs +7 -0
- package/dist/summary-TZFB6ZFM.mjs +7 -0
- package/package.json +2 -2
- package/src/__tests__/file-classification.fixtures.ts +57 -0
- package/src/__tests__/file-classification.test.ts +24 -929
- package/src/__tests__/provider.test.ts +6 -72
- package/src/classifier.ts +42 -42
- package/src/cli-action.ts +11 -6
- package/src/index.ts +30 -27
- package/src/provider.ts +1 -1
- package/src/summary.ts +65 -10
- package/dist/__tests__/analyzer.test.d.ts +0 -2
- package/dist/__tests__/analyzer.test.d.ts.map +0 -1
- package/dist/__tests__/analyzer.test.js +0 -198
- package/dist/__tests__/analyzer.test.js.map +0 -1
- package/dist/__tests__/auto-detection.test.d.ts +0 -2
- package/dist/__tests__/auto-detection.test.d.ts.map +0 -1
- package/dist/__tests__/auto-detection.test.js +0 -132
- package/dist/__tests__/auto-detection.test.js.map +0 -1
- package/dist/__tests__/cluster-detector.test.d.ts +0 -2
- package/dist/__tests__/cluster-detector.test.d.ts.map +0 -1
- package/dist/__tests__/cluster-detector.test.js +0 -121
- package/dist/__tests__/cluster-detector.test.js.map +0 -1
- package/dist/__tests__/contract.test.d.ts +0 -2
- package/dist/__tests__/contract.test.d.ts.map +0 -1
- package/dist/__tests__/contract.test.js +0 -59
- package/dist/__tests__/contract.test.js.map +0 -1
- package/dist/__tests__/enhanced-cohesion.test.d.ts +0 -2
- package/dist/__tests__/enhanced-cohesion.test.d.ts.map +0 -1
- package/dist/__tests__/enhanced-cohesion.test.js +0 -119
- package/dist/__tests__/enhanced-cohesion.test.js.map +0 -1
- package/dist/__tests__/file-classification.test.d.ts +0 -2
- package/dist/__tests__/file-classification.test.d.ts.map +0 -1
- package/dist/__tests__/file-classification.test.js +0 -749
- package/dist/__tests__/file-classification.test.js.map +0 -1
- package/dist/__tests__/fragmentation-advanced.test.d.ts +0 -2
- package/dist/__tests__/fragmentation-advanced.test.d.ts.map +0 -1
- package/dist/__tests__/fragmentation-advanced.test.js +0 -44
- package/dist/__tests__/fragmentation-advanced.test.js.map +0 -1
- package/dist/__tests__/fragmentation-coupling.test.d.ts +0 -2
- package/dist/__tests__/fragmentation-coupling.test.d.ts.map +0 -1
- package/dist/__tests__/fragmentation-coupling.test.js +0 -52
- package/dist/__tests__/fragmentation-coupling.test.js.map +0 -1
- package/dist/__tests__/fragmentation-log.test.d.ts +0 -2
- package/dist/__tests__/fragmentation-log.test.d.ts.map +0 -1
- package/dist/__tests__/fragmentation-log.test.js +0 -29
- package/dist/__tests__/fragmentation-log.test.js.map +0 -1
- package/dist/__tests__/provider.test.d.ts +0 -2
- package/dist/__tests__/provider.test.d.ts.map +0 -1
- package/dist/__tests__/provider.test.js +0 -72
- package/dist/__tests__/provider.test.js.map +0 -1
- package/dist/__tests__/remediation.test.d.ts +0 -2
- package/dist/__tests__/remediation.test.d.ts.map +0 -1
- package/dist/__tests__/remediation.test.js +0 -61
- package/dist/__tests__/remediation.test.js.map +0 -1
- package/dist/__tests__/scoring.test.d.ts +0 -2
- package/dist/__tests__/scoring.test.d.ts.map +0 -1
- package/dist/__tests__/scoring.test.js +0 -298
- package/dist/__tests__/scoring.test.js.map +0 -1
- package/dist/__tests__/structural-cohesion.test.d.ts +0 -2
- package/dist/__tests__/structural-cohesion.test.d.ts.map +0 -1
- package/dist/__tests__/structural-cohesion.test.js +0 -35
- package/dist/__tests__/structural-cohesion.test.js.map +0 -1
- package/dist/analyzer.d.ts +0 -37
- package/dist/analyzer.d.ts.map +0 -1
- package/dist/analyzer.js +0 -283
- package/dist/analyzer.js.map +0 -1
- package/dist/analyzers/python-context.d.ts +0 -38
- package/dist/analyzers/python-context.d.ts.map +0 -1
- package/dist/analyzers/python-context.js +0 -234
- package/dist/analyzers/python-context.js.map +0 -1
- package/dist/ast-utils.d.ts +0 -16
- package/dist/ast-utils.d.ts.map +0 -1
- package/dist/ast-utils.js +0 -81
- package/dist/ast-utils.js.map +0 -1
- package/dist/chunk-22ZO4EKZ.mjs +0 -1297
- package/dist/chunk-2HE27YEV.mjs +0 -1739
- package/dist/chunk-45P4RDYP.mjs +0 -607
- package/dist/chunk-474DEGWW.mjs +0 -1792
- package/dist/chunk-4SYIJ7CU.mjs +0 -1538
- package/dist/chunk-4U4LDWGF.mjs +0 -360
- package/dist/chunk-4XQVYYPC.mjs +0 -1470
- package/dist/chunk-5CLU3HYU.mjs +0 -1475
- package/dist/chunk-5K73Q3OQ.mjs +0 -1520
- package/dist/chunk-5N5DCJOV.mjs +0 -583
- package/dist/chunk-6AVS4KTM.mjs +0 -1536
- package/dist/chunk-6FQYIG6I.mjs +0 -1298
- package/dist/chunk-6I4552YB.mjs +0 -1467
- package/dist/chunk-6LPITDKG.mjs +0 -1539
- package/dist/chunk-72QC5QUS.mjs +0 -549
- package/dist/chunk-736QSHJP.mjs +0 -1807
- package/dist/chunk-7LUSCLGR.mjs +0 -2058
- package/dist/chunk-7VK3XTSH.mjs +0 -1756
- package/dist/chunk-7ZEJGWLN.mjs +0 -1363
- package/dist/chunk-AECWO7NQ.mjs +0 -1539
- package/dist/chunk-AEK3MZC5.mjs +0 -709
- package/dist/chunk-AJC3FR6G.mjs +0 -1509
- package/dist/chunk-AMPK6SWS.mjs +0 -1754
- package/dist/chunk-BA7QGUHN.mjs +0 -1722
- package/dist/chunk-BCEZGRXI.mjs +0 -1297
- package/dist/chunk-BD4NWUVG.mjs +0 -1242
- package/dist/chunk-BEZPBI5C.mjs +0 -1829
- package/dist/chunk-BHCRDEE4.mjs +0 -1745
- package/dist/chunk-BW463GQB.mjs +0 -1767
- package/dist/chunk-CAX2MOUZ.mjs +0 -1801
- package/dist/chunk-CBWM3EK5.mjs +0 -1854
- package/dist/chunk-CCBNKQYB.mjs +0 -1812
- package/dist/chunk-CDIVYADN.mjs +0 -2110
- package/dist/chunk-CVGIDSMN.mjs +0 -1522
- package/dist/chunk-D25B5LZR.mjs +0 -1739
- package/dist/chunk-D3SIHB2V.mjs +0 -2118
- package/dist/chunk-DD7UVNE3.mjs +0 -678
- package/dist/chunk-DMRZMS2U.mjs +0 -964
- package/dist/chunk-DXG5NIYL.mjs +0 -1527
- package/dist/chunk-EBXG2Q5Y.mjs +0 -2059
- package/dist/chunk-EH3PMNZQ.mjs +0 -569
- package/dist/chunk-EMYD7NS6.mjs +0 -137
- package/dist/chunk-EVX2W2BK.mjs +0 -1896
- package/dist/chunk-EWFR366Y.mjs +0 -1740
- package/dist/chunk-EX7HCWAO.mjs +0 -625
- package/dist/chunk-FNPSK3CG.mjs +0 -1760
- package/dist/chunk-FO6YT6RG.mjs +0 -1751
- package/dist/chunk-FYI56A5M.mjs +0 -1892
- package/dist/chunk-G3CCJCBI.mjs +0 -1521
- package/dist/chunk-G7PO3DNK.mjs +0 -1072
- package/dist/chunk-GFADGYXZ.mjs +0 -1752
- package/dist/chunk-GTRIBVS6.mjs +0 -1467
- package/dist/chunk-GXTGOLZT.mjs +0 -92
- package/dist/chunk-H4HWBQU6.mjs +0 -1530
- package/dist/chunk-HDFXSEFW.mjs +0 -605
- package/dist/chunk-HOUDVRG2.mjs +0 -1422
- package/dist/chunk-HQNHM2X7.mjs +0 -997
- package/dist/chunk-I54HL4FZ.mjs +0 -781
- package/dist/chunk-I77HFFZU.mjs +0 -1876
- package/dist/chunk-IKRP7ECY.mjs +0 -1754
- package/dist/chunk-ILMLGJGI.mjs +0 -1295
- package/dist/chunk-IPIE5TXJ.mjs +0 -1741
- package/dist/chunk-IRWCPDWD.mjs +0 -779
- package/dist/chunk-J3MUOWHC.mjs +0 -1747
- package/dist/chunk-J5TA3AZU.mjs +0 -1795
- package/dist/chunk-JH535NPP.mjs +0 -1619
- package/dist/chunk-JUHHOSHG.mjs +0 -1808
- package/dist/chunk-JZ2SE4DB.mjs +0 -1116
- package/dist/chunk-K2WFOBAZ.mjs +0 -1821
- package/dist/chunk-K6U64EL3.mjs +0 -517
- package/dist/chunk-KDUUZQBK.mjs +0 -1692
- package/dist/chunk-KGFWKSGJ.mjs +0 -1442
- package/dist/chunk-KGVMS4R5.mjs +0 -1750
- package/dist/chunk-KWIS5FQP.mjs +0 -1739
- package/dist/chunk-KYSZF5N6.mjs +0 -1876
- package/dist/chunk-LERPI33Y.mjs +0 -2060
- package/dist/chunk-M64RHH4D.mjs +0 -1896
- package/dist/chunk-MBE4AQP5.mjs +0 -1362
- package/dist/chunk-MR7WXHIE.mjs +0 -1833
- package/dist/chunk-MZP3G7TF.mjs +0 -2118
- package/dist/chunk-N2GQWNFG.mjs +0 -1527
- package/dist/chunk-N6XBOOVA.mjs +0 -564
- package/dist/chunk-NJUW6VED.mjs +0 -610
- package/dist/chunk-NOHK5DLU.mjs +0 -2173
- package/dist/chunk-NQA3F2HJ.mjs +0 -1532
- package/dist/chunk-NXXQ2U73.mjs +0 -1467
- package/dist/chunk-OP4G6GLN.mjs +0 -1876
- package/dist/chunk-ORLC5Y4J.mjs +0 -1787
- package/dist/chunk-OTCQL7DY.mjs +0 -2045
- package/dist/chunk-OUYSZZ7X.mjs +0 -1846
- package/dist/chunk-OZE3FVZT.mjs +0 -1089
- package/dist/chunk-P3T3H27S.mjs +0 -1895
- package/dist/chunk-P5YV5WIX.mjs +0 -1803
- package/dist/chunk-P74BO725.mjs +0 -1296
- package/dist/chunk-PDN74MG3.mjs +0 -1834
- package/dist/chunk-PJD4VCIH.mjs +0 -1722
- package/dist/chunk-PVVCCE6W.mjs +0 -755
- package/dist/chunk-PVVMK56C.mjs +0 -1793
- package/dist/chunk-Q2GDZ2FZ.mjs +0 -1794
- package/dist/chunk-QDGPR3L6.mjs +0 -1518
- package/dist/chunk-RQCIJO5Z.mjs +0 -1116
- package/dist/chunk-RRB2C34Q.mjs +0 -1738
- package/dist/chunk-RYIB5CWD.mjs +0 -781
- package/dist/chunk-S6OPP4L5.mjs +0 -1791
- package/dist/chunk-SAVOSPM3.mjs +0 -1522
- package/dist/chunk-SFK6XTJE.mjs +0 -2110
- package/dist/chunk-SIX4KMF2.mjs +0 -1468
- package/dist/chunk-SPAM2YJE.mjs +0 -1537
- package/dist/chunk-T6ZCOPPI.mjs +0 -538
- package/dist/chunk-TPF75CNP.mjs +0 -581
- package/dist/chunk-TWWPY7FD.mjs +0 -1754
- package/dist/chunk-U5R2FTCR.mjs +0 -1803
- package/dist/chunk-UG7OPVHB.mjs +0 -1521
- package/dist/chunk-UMZTAWDA.mjs +0 -1812
- package/dist/chunk-UU4HZ7ZT.mjs +0 -1849
- package/dist/chunk-UXC6QUZ7.mjs +0 -1801
- package/dist/chunk-VBWXHKGD.mjs +0 -1895
- package/dist/chunk-VIJTZPBI.mjs +0 -1470
- package/dist/chunk-VLV6MXPL.mjs +0 -1750
- package/dist/chunk-VTALAPQZ.mjs +0 -1241
- package/dist/chunk-W2KNBN6W.mjs +0 -1849
- package/dist/chunk-W37E7MW5.mjs +0 -1403
- package/dist/chunk-W76FEISE.mjs +0 -1538
- package/dist/chunk-WCFQYXQA.mjs +0 -1532
- package/dist/chunk-WKOZOHOU.mjs +0 -2060
- package/dist/chunk-WTQJNY4U.mjs +0 -1785
- package/dist/chunk-XBFM2Z4O.mjs +0 -1792
- package/dist/chunk-XIXAWCMS.mjs +0 -1760
- package/dist/chunk-XTAXUNQN.mjs +0 -1742
- package/dist/chunk-XY77XABG.mjs +0 -1545
- package/dist/chunk-XZ645X5U.mjs +0 -1425
- package/dist/chunk-Y6FXYEAI.mjs +0 -10
- package/dist/chunk-YCGDIGOG.mjs +0 -1467
- package/dist/chunk-YYB6NZE3.mjs +0 -1869
- package/dist/chunk-Z5WY6A4P.mjs +0 -1754
- package/dist/chunk-ZAMFWKIB.mjs +0 -1842
- package/dist/classifier.d.ts +0 -114
- package/dist/classifier.d.ts.map +0 -1
- package/dist/classifier.js +0 -439
- package/dist/classifier.js.map +0 -1
- package/dist/cli-action-SA7SCYNV.mjs +0 -95
- package/dist/cli-action-VCXBZGZP.mjs +0 -95
- package/dist/cli-action-YAJOJCXJ.mjs +0 -95
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster-detector.d.ts +0 -8
- package/dist/cluster-detector.d.ts.map +0 -1
- package/dist/cluster-detector.js +0 -70
- package/dist/cluster-detector.js.map +0 -1
- package/dist/defaults.d.ts +0 -7
- package/dist/defaults.d.ts.map +0 -1
- package/dist/defaults.js +0 -54
- package/dist/defaults.js.map +0 -1
- package/dist/graph-builder.d.ts +0 -33
- package/dist/graph-builder.d.ts.map +0 -1
- package/dist/graph-builder.js +0 -225
- package/dist/graph-builder.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/metrics.d.ts +0 -34
- package/dist/metrics.d.ts.map +0 -1
- package/dist/metrics.js +0 -170
- package/dist/metrics.js.map +0 -1
- package/dist/orchestrator-3L3NAZYP.mjs +0 -10
- package/dist/orchestrator-5AL3XBPZ.mjs +0 -10
- package/dist/orchestrator-KMAKMHTD.mjs +0 -10
- package/dist/orchestrator-MONOZHVW.mjs +0 -10
- package/dist/orchestrator-R6MZT4Z2.mjs +0 -10
- package/dist/orchestrator-ZR7JSKWI.mjs +0 -10
- package/dist/provider.d.ts +0 -6
- package/dist/provider.d.ts.map +0 -1
- package/dist/provider.js +0 -48
- package/dist/provider.js.map +0 -1
- package/dist/python-context-3GZKN3LR.mjs +0 -162
- package/dist/python-context-GOH747QU.mjs +0 -202
- package/dist/python-context-O2EN3M6Z.mjs +0 -162
- package/dist/python-context-PAETRLDY.mjs +0 -185
- package/dist/python-context-TBI5FVFY.mjs +0 -203
- package/dist/python-context-UOPTQH44.mjs +0 -192
- package/dist/remediation.d.ts +0 -25
- package/dist/remediation.d.ts.map +0 -1
- package/dist/remediation.js +0 -98
- package/dist/remediation.js.map +0 -1
- package/dist/scoring.d.ts +0 -9
- package/dist/scoring.d.ts.map +0 -1
- package/dist/scoring.js +0 -142
- package/dist/scoring.js.map +0 -1
- package/dist/semantic-analysis.d.ts +0 -33
- package/dist/semantic-analysis.d.ts.map +0 -1
- package/dist/semantic-analysis.js +0 -303
- package/dist/semantic-analysis.js.map +0 -1
- package/dist/summary-7PZVW72O.mjs +0 -7
- package/dist/summary-LKUCJAIS.mjs +0 -7
- package/dist/summary.d.ts +0 -6
- package/dist/summary.d.ts.map +0 -1
- package/dist/summary.js +0 -92
- package/dist/summary.js.map +0 -1
- package/dist/types.d.ts +0 -124
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/output-formatter.d.ts +0 -14
- package/dist/utils/output-formatter.d.ts.map +0 -1
- package/dist/utils/output-formatter.js +0 -338
- package/dist/utils/output-formatter.js.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// src/report/console-report.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
function displayConsoleReport(summary, results, maxResults = 10) {
|
|
4
|
+
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";
|
|
5
|
+
const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
|
|
6
|
+
console.log(chalk.bold("\u{1F4CA} Context Analysis Summary:\n"));
|
|
7
|
+
console.log(` \u2022 Total Files: ${chalk.cyan(summary.totalFiles)}`);
|
|
8
|
+
console.log(
|
|
9
|
+
` \u2022 Total Tokens: ${chalk.cyan(summary.totalTokens.toLocaleString())}`
|
|
10
|
+
);
|
|
11
|
+
console.log(
|
|
12
|
+
` \u2022 Avg Budget: ${chalk.cyan(summary.avgContextBudget.toFixed(0))} tokens`
|
|
13
|
+
);
|
|
14
|
+
console.log(
|
|
15
|
+
` \u2022 Potential Saving: ${chalk.green(summary.totalPotentialSavings.toLocaleString())} tokens`
|
|
16
|
+
);
|
|
17
|
+
console.log();
|
|
18
|
+
if (totalIssues > 0) {
|
|
19
|
+
console.log(chalk.bold("\u26A0\uFE0F Issues Detected:\n"));
|
|
20
|
+
console.log(` \u2022 ${chalk.red("\u{1F534} Critical:")} ${summary.criticalIssues}`);
|
|
21
|
+
console.log(` \u2022 ${chalk.yellow("\u{1F7E1} Major:")} ${summary.majorIssues}`);
|
|
22
|
+
console.log(` \u2022 ${chalk.blue("\u{1F535} Minor:")} ${summary.minorIssues}`);
|
|
23
|
+
console.log();
|
|
24
|
+
} else {
|
|
25
|
+
console.log(chalk.green("\u2705 No significant context issues detected!\n"));
|
|
26
|
+
}
|
|
27
|
+
if (summary.fragmentedModules.length > 0) {
|
|
28
|
+
console.log(chalk.bold("\u{1F9E9} Top Fragmented Modules:\n"));
|
|
29
|
+
summary.fragmentedModules.slice(0, maxResults).forEach((mod) => {
|
|
30
|
+
const scoreColor = mod.fragmentationScore > 0.7 ? chalk.red : mod.fragmentationScore > 0.4 ? chalk.yellow : chalk.green;
|
|
31
|
+
console.log(
|
|
32
|
+
` ${scoreColor("\u25A0")} ${chalk.white(mod.domain)} ${chalk.dim(`(${mod.files.length} files, ${(mod.fragmentationScore * 100).toFixed(0)}% frag)`)}`
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
console.log();
|
|
36
|
+
}
|
|
37
|
+
if (summary.topExpensiveFiles.length > 0) {
|
|
38
|
+
console.log(chalk.bold("\u{1F4B8} Most Expensive Files (Context Budget):\n"));
|
|
39
|
+
summary.topExpensiveFiles.slice(0, maxResults).forEach((item) => {
|
|
40
|
+
const fileName = item.file.split("/").slice(-2).join("/");
|
|
41
|
+
const severityColor = item.severity === "critical" ? chalk.red : item.severity === "major" ? chalk.yellow : chalk.blue;
|
|
42
|
+
console.log(
|
|
43
|
+
` ${severityColor("\u25CF")} ${chalk.white(fileName)} ${chalk.dim(`- ${item.contextBudget.toLocaleString()} tokens`)}`
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
console.log();
|
|
47
|
+
}
|
|
48
|
+
if (totalIssues > 0) {
|
|
49
|
+
console.log(chalk.bold("\u{1F4A1} Top Recommendations:\n"));
|
|
50
|
+
const topFiles = results.filter((r) => r.severity === "critical" || r.severity === "major").slice(0, 3);
|
|
51
|
+
topFiles.forEach((result, index) => {
|
|
52
|
+
const fileName = result.file.split("/").slice(-2).join("/");
|
|
53
|
+
console.log(chalk.cyan(` ${index + 1}. ${fileName}`));
|
|
54
|
+
result.recommendations.slice(0, 2).forEach((rec) => {
|
|
55
|
+
console.log(chalk.dim(` \u2022 ${rec}`));
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
console.log();
|
|
59
|
+
}
|
|
60
|
+
console.log(chalk.cyan(divider));
|
|
61
|
+
console.log(
|
|
62
|
+
chalk.dim(
|
|
63
|
+
"\n\u2B50 Like aiready? Star us on GitHub: https://github.com/caopengau/aiready-context-analyzer"
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
console.log(
|
|
67
|
+
chalk.dim(
|
|
68
|
+
"\u{1F41B} Found a bug? Report it: https://github.com/caopengau/aiready-context-analyzer/issues\n"
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
displayConsoleReport
|
|
74
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// src/report/html-report.ts
|
|
2
|
+
import {
|
|
3
|
+
generateIssueSummary,
|
|
4
|
+
generateTable,
|
|
5
|
+
generateStandardHtmlReport
|
|
6
|
+
} from "@aiready/core";
|
|
7
|
+
function generateHTMLReport(summary, results) {
|
|
8
|
+
const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
|
|
9
|
+
void results;
|
|
10
|
+
const stats = [
|
|
11
|
+
{ value: summary.totalFiles, label: "Files Analyzed" },
|
|
12
|
+
{ value: summary.totalTokens.toLocaleString(), label: "Total Tokens" },
|
|
13
|
+
{ value: summary.avgContextBudget.toFixed(0), label: "Avg Context Budget" },
|
|
14
|
+
{
|
|
15
|
+
value: totalIssues,
|
|
16
|
+
label: "Total Issues",
|
|
17
|
+
color: totalIssues > 0 ? "#f39c12" : void 0
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
const sections = [];
|
|
21
|
+
if (totalIssues > 0) {
|
|
22
|
+
sections.push({
|
|
23
|
+
title: "\u26A0\uFE0F Issues Summary",
|
|
24
|
+
content: generateIssueSummary(
|
|
25
|
+
summary.criticalIssues,
|
|
26
|
+
summary.majorIssues,
|
|
27
|
+
summary.minorIssues,
|
|
28
|
+
summary.totalPotentialSavings
|
|
29
|
+
)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (summary.fragmentedModules.length > 0) {
|
|
33
|
+
sections.push({
|
|
34
|
+
title: "\u{1F9E9} Fragmented Modules",
|
|
35
|
+
content: generateTable({
|
|
36
|
+
headers: ["Domain", "Files", "Fragmentation", "Token Cost"],
|
|
37
|
+
rows: summary.fragmentedModules.map((m) => [
|
|
38
|
+
m.domain,
|
|
39
|
+
String(m.files.length),
|
|
40
|
+
`${(m.fragmentationScore * 100).toFixed(0)}%`,
|
|
41
|
+
m.totalTokens.toLocaleString()
|
|
42
|
+
])
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (summary.topExpensiveFiles.length > 0) {
|
|
47
|
+
sections.push({
|
|
48
|
+
title: "\u{1F4B8} Most Expensive Files",
|
|
49
|
+
content: generateTable({
|
|
50
|
+
headers: ["File", "Context Budget", "Severity"],
|
|
51
|
+
rows: summary.topExpensiveFiles.map((f) => [
|
|
52
|
+
f.file,
|
|
53
|
+
`${f.contextBudget.toLocaleString()} tokens`,
|
|
54
|
+
`<span class="issue-${f.severity}">${f.severity.toUpperCase()}</span>`
|
|
55
|
+
])
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return generateStandardHtmlReport(
|
|
60
|
+
{
|
|
61
|
+
title: "Context Analysis Report",
|
|
62
|
+
packageName: "context-analyzer",
|
|
63
|
+
packageUrl: "https://github.com/caopengau/aiready-context-analyzer",
|
|
64
|
+
bugUrl: "https://github.com/caopengau/aiready-context-analyzer/issues",
|
|
65
|
+
emoji: "\u{1F9E0}"
|
|
66
|
+
},
|
|
67
|
+
stats,
|
|
68
|
+
sections
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
generateHTMLReport
|
|
73
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ToolProvider, Severity, ScanOptions, ExportInfo,
|
|
1
|
+
import { ToolProvider, Severity, ScanOptions, ExportInfo, CostConfig, ToolScoringOutput, FileContent } from '@aiready/core';
|
|
2
2
|
export { ExportInfo } from '@aiready/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Context Analyzer Tool Provider
|
|
6
6
|
*/
|
|
7
|
-
declare const
|
|
7
|
+
declare const CONTEXT_ANALYZER_PROVIDER: ToolProvider;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Options for the Context Analyzer tool.
|
|
@@ -152,12 +152,6 @@ interface TypeDependency {
|
|
|
152
152
|
usedBy: string[];
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
interface MappingOptions {
|
|
156
|
-
maxDepth: number;
|
|
157
|
-
maxContextBudget: number;
|
|
158
|
-
minCohesion: number;
|
|
159
|
-
maxFragmentation: number;
|
|
160
|
-
}
|
|
161
155
|
/**
|
|
162
156
|
* Calculate cohesion score (how related are exports in a file).
|
|
163
157
|
* Legacy wrapper for backward compatibility with exact test expectations.
|
|
@@ -179,56 +173,24 @@ declare function calculateCohesion(exports: any[], filePath?: string, options?:
|
|
|
179
173
|
declare function analyzeContext(options: ContextAnalyzerOptions): Promise<ContextAnalysisResult[]>;
|
|
180
174
|
|
|
181
175
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* @param files - Array of file contents to analyze for folder patterns.
|
|
185
|
-
* @returns Array of singularized domain keywords.
|
|
186
|
-
*/
|
|
187
|
-
declare function extractDomainKeywordsFromPaths(files: FileContent[]): string[];
|
|
188
|
-
/**
|
|
189
|
-
* Build a dependency graph from file contents, resolving imports and extracting metadata.
|
|
190
|
-
*
|
|
191
|
-
* @param files - Array of file contents to process.
|
|
192
|
-
* @param options - Optional configuration for domain detection.
|
|
193
|
-
* @returns Complete dependency graph with nodes, edges, and semantic matrices.
|
|
194
|
-
*/
|
|
195
|
-
declare function buildDependencyGraph(files: FileContent[], options?: {
|
|
196
|
-
domainKeywords?: string[];
|
|
197
|
-
}): Promise<DependencyGraph>;
|
|
198
|
-
/**
|
|
199
|
-
* Calculate the maximum depth of the import tree for a specific file.
|
|
200
|
-
*
|
|
201
|
-
* @param file - File path to start depth calculation from.
|
|
202
|
-
* @param graph - The dependency graph.
|
|
203
|
-
* @param visited - Optional set to track visited nodes during traversal.
|
|
204
|
-
* @param depth - Current recursion depth.
|
|
205
|
-
* @returns Maximum depth of the import chain.
|
|
206
|
-
*/
|
|
207
|
-
declare function calculateImportDepth(file: string, graph: DependencyGraph, visited?: Set<string>, depth?: number): number;
|
|
208
|
-
/**
|
|
209
|
-
* Retrieve all transitive dependencies for a specific file.
|
|
176
|
+
* Calculate AI Readiness Score for context efficiency (0-100).
|
|
210
177
|
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* @param visited - Optional set to track visited nodes.
|
|
214
|
-
* @returns Array of all reachable file paths.
|
|
215
|
-
*/
|
|
216
|
-
declare function getTransitiveDependencies(file: string, graph: DependencyGraph, visited?: Set<string>): string[];
|
|
217
|
-
/**
|
|
218
|
-
* Calculate total context budget (tokens needed to understand this file and its dependencies).
|
|
178
|
+
* Evaluates how efficiently an AI model can process the project's code context
|
|
179
|
+
* based on token budgets, import depth, and file fragmentation.
|
|
219
180
|
*
|
|
220
|
-
* @param
|
|
221
|
-
* @param
|
|
222
|
-
* @returns
|
|
181
|
+
* @param summary - Consolidated context summary from the scan.
|
|
182
|
+
* @param costConfig - Optional configuration for business value calculations.
|
|
183
|
+
* @returns Standardized scoring output for the context analyzer tool.
|
|
184
|
+
* @lastUpdated 2026-03-18
|
|
223
185
|
*/
|
|
224
|
-
declare function
|
|
186
|
+
declare function calculateContextScore(summary: ContextSummary, costConfig?: Partial<CostConfig>): ToolScoringOutput;
|
|
225
187
|
/**
|
|
226
|
-
*
|
|
188
|
+
* Maps a numerical score to a human-readable rating slug.
|
|
227
189
|
*
|
|
228
|
-
* @param
|
|
229
|
-
* @returns
|
|
190
|
+
* @param score - The 0-100 readiness score.
|
|
191
|
+
* @returns A formatted rating string (e.g., "excellent", "at risk").
|
|
230
192
|
*/
|
|
231
|
-
declare function
|
|
193
|
+
declare function mapScoreToRating(score: number): string;
|
|
232
194
|
|
|
233
195
|
/**
|
|
234
196
|
* Calculates a cohesion score (0-1) for a module based on its exports,
|
|
@@ -286,23 +248,61 @@ declare function calculatePathEntropy(files: string[]): number;
|
|
|
286
248
|
declare function calculateDirectoryDistance(files: string[]): number;
|
|
287
249
|
|
|
288
250
|
/**
|
|
289
|
-
*
|
|
251
|
+
* Group files by domain to detect module clusters
|
|
252
|
+
* @param graph - The dependency graph to analyze
|
|
253
|
+
* @param options - Optional configuration options
|
|
254
|
+
* @param options.useLogScale - Whether to use logarithmic scaling for calculations
|
|
255
|
+
* @returns Array of module clusters
|
|
290
256
|
*/
|
|
291
|
-
declare
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
257
|
+
declare function detectModuleClusters(graph: DependencyGraph, options?: {
|
|
258
|
+
useLogScale?: boolean;
|
|
259
|
+
}): ModuleCluster[];
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Build a dependency graph from file contents, resolving imports and extracting metadata.
|
|
263
|
+
*
|
|
264
|
+
* @param files - Array of file contents to process.
|
|
265
|
+
* @param options - Optional configuration for domain detection.
|
|
266
|
+
* @returns Complete dependency graph with nodes, edges, and semantic matrices.
|
|
267
|
+
*/
|
|
268
|
+
declare function buildDependencyGraph(files: FileContent[], options?: {
|
|
269
|
+
domainKeywords?: string[];
|
|
270
|
+
}): Promise<DependencyGraph>;
|
|
271
|
+
/**
|
|
272
|
+
* Calculate the maximum depth of the import tree for a specific file.
|
|
273
|
+
*
|
|
274
|
+
* @param file - File path to start depth calculation from.
|
|
275
|
+
* @param graph - The dependency graph.
|
|
276
|
+
* @param visited - Optional set to track visited nodes during traversal.
|
|
277
|
+
* @param depth - Current recursion depth.
|
|
278
|
+
* @returns Maximum depth of the import chain.
|
|
279
|
+
*/
|
|
280
|
+
declare function calculateImportDepth(file: string, graph: DependencyGraph, visited?: Set<string>, depth?: number): number;
|
|
281
|
+
/**
|
|
282
|
+
* Retrieve all transitive dependencies for a specific file.
|
|
283
|
+
*
|
|
284
|
+
* @param file - File path to analyze.
|
|
285
|
+
* @param graph - The dependency graph.
|
|
286
|
+
* @param visited - Optional set to track visited nodes.
|
|
287
|
+
* @returns Array of all reachable file paths.
|
|
288
|
+
*/
|
|
289
|
+
declare function getTransitiveDependencies(file: string, graph: DependencyGraph, visited?: Set<string>): string[];
|
|
290
|
+
/**
|
|
291
|
+
* Calculate total context budget (tokens needed to understand this file and its dependencies).
|
|
292
|
+
*
|
|
293
|
+
* @param file - File path to calculate budget for.
|
|
294
|
+
* @param graph - The dependency graph.
|
|
295
|
+
* @returns Total token count including recursive dependencies.
|
|
296
|
+
*/
|
|
297
|
+
declare function calculateContextBudget(file: string, graph: DependencyGraph): number;
|
|
298
|
+
/**
|
|
299
|
+
* Detect circular dependencies (cycles) within the dependency graph.
|
|
300
|
+
*
|
|
301
|
+
* @param graph - The dependency graph to scan.
|
|
302
|
+
* @returns Array of dependency cycles (each cycle is an array of file paths).
|
|
303
|
+
*/
|
|
304
|
+
declare function detectCircularDependencies(graph: DependencyGraph): string[][];
|
|
305
|
+
|
|
306
306
|
/**
|
|
307
307
|
* Classify a file into a specific type for better analysis context
|
|
308
308
|
*
|
|
@@ -330,17 +330,6 @@ declare function adjustCohesionForClassification(baseCohesion: number, classific
|
|
|
330
330
|
*/
|
|
331
331
|
declare function adjustFragmentationForClassification(baseFragmentation: number, classification: FileClassification): number;
|
|
332
332
|
|
|
333
|
-
/**
|
|
334
|
-
* Group files by domain to detect module clusters
|
|
335
|
-
* @param graph - The dependency graph to analyze
|
|
336
|
-
* @param options - Optional configuration options
|
|
337
|
-
* @param options.useLogScale - Whether to use logarithmic scaling for calculations
|
|
338
|
-
* @returns Array of module clusters
|
|
339
|
-
*/
|
|
340
|
-
declare function detectModuleClusters(graph: DependencyGraph, options?: {
|
|
341
|
-
useLogScale?: boolean;
|
|
342
|
-
}): ModuleCluster[];
|
|
343
|
-
|
|
344
333
|
/**
|
|
345
334
|
* Get classification-specific recommendations
|
|
346
335
|
*
|
|
@@ -374,35 +363,6 @@ declare function getGeneralRecommendations(metrics: {
|
|
|
374
363
|
severity: any;
|
|
375
364
|
};
|
|
376
365
|
|
|
377
|
-
/**
|
|
378
|
-
* Calculate AI Readiness Score for context efficiency (0-100).
|
|
379
|
-
*
|
|
380
|
-
* Evaluates how efficiently an AI model can process the project's code context
|
|
381
|
-
* based on token budgets, import depth, and file fragmentation.
|
|
382
|
-
*
|
|
383
|
-
* @param summary - Consolidated context summary from the scan.
|
|
384
|
-
* @param costConfig - Optional configuration for business value calculations.
|
|
385
|
-
* @returns Standardized scoring output for the context analyzer tool.
|
|
386
|
-
* @lastUpdated 2026-03-18
|
|
387
|
-
*/
|
|
388
|
-
declare function calculateContextScore(summary: ContextSummary, costConfig?: Partial<CostConfig>): ToolScoringOutput;
|
|
389
|
-
/**
|
|
390
|
-
* Maps a numerical score to a human-readable rating slug.
|
|
391
|
-
*
|
|
392
|
-
* @param score - The 0-100 readiness score.
|
|
393
|
-
* @returns A formatted rating string (e.g., "excellent", "at risk").
|
|
394
|
-
*/
|
|
395
|
-
declare function mapScoreToRating(score: number): string;
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Generate smart defaults for context analysis based on repository size
|
|
399
|
-
* Automatically tunes thresholds to target ~10 most serious issues
|
|
400
|
-
* @param directory - The root directory to analyze
|
|
401
|
-
* @param userOptions - Partial user-provided options to merge with defaults
|
|
402
|
-
* @returns Complete ContextAnalyzerOptions with smart defaults
|
|
403
|
-
*/
|
|
404
|
-
declare function getSmartDefaults(directory: string, userOptions: Partial<ContextAnalyzerOptions>): Promise<ContextAnalyzerOptions>;
|
|
405
|
-
|
|
406
366
|
/**
|
|
407
367
|
* Generate summary of context analysis results
|
|
408
368
|
*
|
|
@@ -412,232 +372,4 @@ declare function getSmartDefaults(directory: string, userOptions: Partial<Contex
|
|
|
412
372
|
*/
|
|
413
373
|
declare function generateSummary(results: ContextAnalysisResult[], options?: any): ContextSummary;
|
|
414
374
|
|
|
415
|
-
|
|
416
|
-
* Build co-usage matrix: track which files are imported together frequently.
|
|
417
|
-
*
|
|
418
|
-
* @param graph - The dependency graph to analyze.
|
|
419
|
-
* @returns Map of file path to nested map of related files and their co-occurrence counts.
|
|
420
|
-
*/
|
|
421
|
-
declare function buildCoUsageMatrix(graph: DependencyGraph): Map<string, Map<string, number>>;
|
|
422
|
-
/**
|
|
423
|
-
* Find semantic clusters using frequently occurring co-usage patterns.
|
|
424
|
-
*
|
|
425
|
-
* @param coUsageMatrix - The co-usage matrix from buildCoUsageMatrix.
|
|
426
|
-
* @param minCoUsage - Minimum co-usage count to consider a strong relationship (default: 3).
|
|
427
|
-
* @returns Map of cluster representative files to their associated cluster members.
|
|
428
|
-
*/
|
|
429
|
-
declare function findSemanticClusters(coUsageMatrix: Map<string, Map<string, number>>, minCoUsage?: number): Map<string, string[]>;
|
|
430
|
-
/**
|
|
431
|
-
* Retrieve co-usage data for a specific file.
|
|
432
|
-
*
|
|
433
|
-
* @param file - The file path to look up.
|
|
434
|
-
* @param coUsageMatrix - The global co-usage matrix.
|
|
435
|
-
* @returns Formatted co-usage data object.
|
|
436
|
-
*/
|
|
437
|
-
declare function getCoUsageData(file: string, coUsageMatrix: Map<string, Map<string, number>>): CoUsageData;
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Extract type dependencies from AST exports to build a type-based relationship graph.
|
|
441
|
-
*
|
|
442
|
-
* @param graph - The dependency graph to analyze.
|
|
443
|
-
* @returns Map of type reference names to sets of files that consume or export them.
|
|
444
|
-
*/
|
|
445
|
-
declare function buildTypeGraph(graph: DependencyGraph): Map<string, Set<string>>;
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Calculate confidence score for a domain assignment based on signals.
|
|
449
|
-
*
|
|
450
|
-
* @param signals - The set of semantic signals detected for a domain.
|
|
451
|
-
* @returns Numerical confidence score (0-1).
|
|
452
|
-
*/
|
|
453
|
-
declare function calculateDomainConfidence(signals: DomainSignals): number;
|
|
454
|
-
/**
|
|
455
|
-
* Infer domain from semantic analysis (co-usage + types) to identify logical modules.
|
|
456
|
-
*
|
|
457
|
-
* @param file - The file path to infer domain for.
|
|
458
|
-
* @param exportName - The specific export identifier.
|
|
459
|
-
* @param graph - The full dependency graph.
|
|
460
|
-
* @param coUsageMatrix - Matrix of files frequently imported together.
|
|
461
|
-
* @param typeGraph - Map of type references to files.
|
|
462
|
-
* @param exportTypeRefs - Optional list of types referenced by the export.
|
|
463
|
-
* @returns Array of potential domain assignments with confidence scores.
|
|
464
|
-
*/
|
|
465
|
-
declare function inferDomainFromSemantics(file: string, exportName: string, graph: DependencyGraph, coUsageMatrix: Map<string, Map<string, number>>, typeGraph: Map<string, Set<string>>, exportTypeRefs?: string[]): DomainAssignment[];
|
|
466
|
-
/**
|
|
467
|
-
* Regex-based export extraction (legacy/fallback)
|
|
468
|
-
*
|
|
469
|
-
* @param content - Source code content.
|
|
470
|
-
* @param filePath - Optional file path for domain context.
|
|
471
|
-
* @param domainOptions - Optional overrides for domain keywords.
|
|
472
|
-
* @param fileImports - Optional list of actual imports for semantic context.
|
|
473
|
-
* @returns Array of extracted export information.
|
|
474
|
-
*/
|
|
475
|
-
declare function extractExports(content: string, filePath?: string, domainOptions?: {
|
|
476
|
-
domainKeywords?: string[];
|
|
477
|
-
}, fileImports?: string[]): ExportInfo[];
|
|
478
|
-
/**
|
|
479
|
-
* Infer domain from name, path, or imports
|
|
480
|
-
*
|
|
481
|
-
* @param name - The identifier name to analyze.
|
|
482
|
-
* @param filePath - Optional file path for structure context.
|
|
483
|
-
* @param domainOptions - Optional overrides for domain keywords.
|
|
484
|
-
* @param fileImports - Optional list of imports for domain context.
|
|
485
|
-
* @returns The inferred domain name (string).
|
|
486
|
-
*/
|
|
487
|
-
declare function inferDomain(name: string, filePath?: string, domainOptions?: {
|
|
488
|
-
domainKeywords?: string[];
|
|
489
|
-
}, fileImports?: string[]): string;
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Identify candidates for module consolidation based on high co-usage or shared types.
|
|
493
|
-
*
|
|
494
|
-
* @param graph - The dependency graph.
|
|
495
|
-
* @param coUsageMatrix - Matrix of frequently paired files.
|
|
496
|
-
* @param typeGraph - Map of shared type references.
|
|
497
|
-
* @param minCoUsage - Minimum co-usage count threshold.
|
|
498
|
-
* @param minSharedTypes - Minimum shared types threshold.
|
|
499
|
-
* @returns Array of consolidation candidates sorted by strength.
|
|
500
|
-
*/
|
|
501
|
-
declare function findConsolidationCandidates(graph: DependencyGraph, coUsageMatrix: Map<string, Map<string, number>>, typeGraph: Map<string, Set<string>>, minCoUsage?: number, minSharedTypes?: number): {
|
|
502
|
-
files: string[];
|
|
503
|
-
reason: string;
|
|
504
|
-
strength: number;
|
|
505
|
-
}[];
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Classification pattern constants for file type detection.
|
|
509
|
-
*/
|
|
510
|
-
/** Minimum exports to consider a file as a barrel export */
|
|
511
|
-
declare const BARREL_EXPORT_MIN_EXPORTS = 5;
|
|
512
|
-
/** Token cost limit for barrel export detection */
|
|
513
|
-
declare const BARREL_EXPORT_TOKEN_LIMIT = 1000;
|
|
514
|
-
/** Patterns for Lambda/API handler detection */
|
|
515
|
-
declare const HANDLER_NAME_PATTERNS: string[];
|
|
516
|
-
/** Patterns for service file detection */
|
|
517
|
-
declare const SERVICE_NAME_PATTERNS: string[];
|
|
518
|
-
/** Patterns for email template detection */
|
|
519
|
-
declare const EMAIL_NAME_PATTERNS: string[];
|
|
520
|
-
/** Patterns for parser/transformer detection */
|
|
521
|
-
declare const PARSER_NAME_PATTERNS: string[];
|
|
522
|
-
/** Patterns for session/state management detection */
|
|
523
|
-
declare const SESSION_NAME_PATTERNS: string[];
|
|
524
|
-
/** Next.js metadata export names */
|
|
525
|
-
declare const NEXTJS_METADATA_EXPORTS: string[];
|
|
526
|
-
/** Patterns for configuration file detection */
|
|
527
|
-
declare const CONFIG_NAME_PATTERNS: string[];
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Detect if a file is a boilerplate barrel (architectural theater).
|
|
531
|
-
* A boilerplate barrel re-exports from other sources without adding value.
|
|
532
|
-
*
|
|
533
|
-
* @param node - The dependency node to analyze.
|
|
534
|
-
* @returns True if the file matches boilerplate barrel patterns.
|
|
535
|
-
*/
|
|
536
|
-
declare function isBoilerplateBarrel(node: DependencyNode): boolean;
|
|
537
|
-
/**
|
|
538
|
-
* Detect if a file is a barrel export (index.ts).
|
|
539
|
-
*
|
|
540
|
-
* @param node - The dependency node to analyze.
|
|
541
|
-
* @returns True if the file matches barrel export patterns.
|
|
542
|
-
* @lastUpdated 2026-03-20
|
|
543
|
-
*/
|
|
544
|
-
declare function isBarrelExport(node: DependencyNode): boolean;
|
|
545
|
-
/**
|
|
546
|
-
* Detect if a file is primarily type definitions.
|
|
547
|
-
*
|
|
548
|
-
* @param node - The dependency node to analyze.
|
|
549
|
-
* @returns True if the file contains primarily types or matches type paths.
|
|
550
|
-
* @lastUpdated 2026-03-18
|
|
551
|
-
*/
|
|
552
|
-
declare function isTypeDefinition(node: DependencyNode): boolean;
|
|
553
|
-
/**
|
|
554
|
-
* Detect if a file is a utility module.
|
|
555
|
-
*
|
|
556
|
-
* @param node - The dependency node to analyze.
|
|
557
|
-
* @returns True if the file path or name suggests a utility/helper role.
|
|
558
|
-
* @lastUpdated 2026-03-18
|
|
559
|
-
*/
|
|
560
|
-
declare function isUtilityModule(node: DependencyNode): boolean;
|
|
561
|
-
/**
|
|
562
|
-
* Detect if a file is a Lambda/API handler.
|
|
563
|
-
*
|
|
564
|
-
* @param node - The dependency node to analyze.
|
|
565
|
-
* @returns True if the file serves as a coordination point for requests/lambdas.
|
|
566
|
-
* @lastUpdated 2026-03-18
|
|
567
|
-
*/
|
|
568
|
-
declare function isLambdaHandler(node: DependencyNode): boolean;
|
|
569
|
-
/**
|
|
570
|
-
* Detect if a file is a service file.
|
|
571
|
-
*
|
|
572
|
-
* @param node - The dependency node to analyze.
|
|
573
|
-
* @returns True if the file orchestrates logic or matches service patterns.
|
|
574
|
-
* @lastUpdated 2026-03-18
|
|
575
|
-
*/
|
|
576
|
-
declare function isServiceFile(node: DependencyNode): boolean;
|
|
577
|
-
/**
|
|
578
|
-
* Detect if a file is an email template/layout.
|
|
579
|
-
*
|
|
580
|
-
* @param node - The dependency node to analyze.
|
|
581
|
-
* @returns True if the file is used for rendering notifications or emails.
|
|
582
|
-
* @lastUpdated 2026-03-18
|
|
583
|
-
*/
|
|
584
|
-
declare function isEmailTemplate(node: DependencyNode): boolean;
|
|
585
|
-
/**
|
|
586
|
-
* Detect if a file is a parser/transformer.
|
|
587
|
-
*
|
|
588
|
-
* @param node - The dependency node to analyze.
|
|
589
|
-
* @returns True if the file handles data conversion or serialization.
|
|
590
|
-
* @lastUpdated 2026-03-18
|
|
591
|
-
*/
|
|
592
|
-
declare function isParserFile(node: DependencyNode): boolean;
|
|
593
|
-
/**
|
|
594
|
-
* Detect if a file is a session/state management file.
|
|
595
|
-
*
|
|
596
|
-
* @param node - The dependency node to analyze.
|
|
597
|
-
* @returns True if the file manages application state or sessions.
|
|
598
|
-
* @lastUpdated 2026-03-18
|
|
599
|
-
*/
|
|
600
|
-
declare function isSessionFile(node: DependencyNode): boolean;
|
|
601
|
-
/**
|
|
602
|
-
* Detect if a file is a Next.js App Router page.
|
|
603
|
-
*
|
|
604
|
-
* @param node - The dependency node to analyze.
|
|
605
|
-
* @returns True if the file is a Next.js page or metadata entry.
|
|
606
|
-
* @lastUpdated 2026-03-18
|
|
607
|
-
*/
|
|
608
|
-
declare function isNextJsPage(node: DependencyNode): boolean;
|
|
609
|
-
/**
|
|
610
|
-
* Detect if a file is a configuration or schema file.
|
|
611
|
-
*
|
|
612
|
-
* @param node - The dependency node to analyze.
|
|
613
|
-
* @returns True if the file matches configuration, setting, or schema patterns.
|
|
614
|
-
* @lastUpdated 2026-03-18
|
|
615
|
-
*/
|
|
616
|
-
declare function isConfigFile(node: DependencyNode): boolean;
|
|
617
|
-
/**
|
|
618
|
-
* Detect if a file is part of a hub-and-spoke monorepo architecture.
|
|
619
|
-
*
|
|
620
|
-
* Many files spread across multiple packages (spokes) is intentional in
|
|
621
|
-
* AIReady and shouldn't be penalized as heavily for fragmentation.
|
|
622
|
-
*
|
|
623
|
-
* @param node - The dependency node to analyze.
|
|
624
|
-
* @returns True if the file path suggests it belongs to a spoke package.
|
|
625
|
-
*/
|
|
626
|
-
declare function isHubAndSpokeFile(node: DependencyNode): boolean;
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* Display analysis report in console
|
|
630
|
-
*/
|
|
631
|
-
declare function displayConsoleReport(summary: ReturnType<typeof generateSummary>, results: Awaited<ReturnType<typeof analyzeContext>>, maxResults?: number): void;
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* Generate HTML report
|
|
635
|
-
*/
|
|
636
|
-
declare function generateHTMLReport(summary: ReturnType<typeof generateSummary>, results: Awaited<ReturnType<typeof analyzeContext>>): string;
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* Interactive setup: detect common frameworks and suggest excludes & focus areas
|
|
640
|
-
*/
|
|
641
|
-
declare function runInteractiveSetup(directory: string, current: any): Promise<any>;
|
|
642
|
-
|
|
643
|
-
export { BARREL_EXPORT_MIN_EXPORTS, BARREL_EXPORT_TOKEN_LIMIT, CONFIG_NAME_PATTERNS, Classification, type CoUsageData, type ContextAnalysisResult, type ContextAnalyzerOptions, ContextAnalyzerProvider, type ContextSummary, type DependencyGraph, type DependencyNode, type DomainAssignment, type DomainSignals, EMAIL_NAME_PATTERNS, type FileClassification, HANDLER_NAME_PATTERNS, type MappingOptions, type ModuleCluster, NEXTJS_METADATA_EXPORTS, PARSER_NAME_PATTERNS, SERVICE_NAME_PATTERNS, SESSION_NAME_PATTERNS, type TypeDependency, adjustCohesionForClassification, adjustFragmentationForClassification, analyzeContext, buildCoUsageMatrix, buildDependencyGraph, buildTypeGraph, calculateCohesion, calculateContextBudget, calculateContextScore, calculateDirectoryDistance, calculateDomainConfidence, calculateEnhancedCohesion, calculateFragmentation, calculateImportDepth, calculatePathEntropy, calculateStructuralCohesionFromCoUsage, classifyFile, detectCircularDependencies, detectModuleClusters, displayConsoleReport, extractDomainKeywordsFromPaths, extractExports, findConsolidationCandidates, findSemanticClusters, generateHTMLReport, generateSummary, getClassificationRecommendations, getCoUsageData, getGeneralRecommendations, getSmartDefaults, getTransitiveDependencies, inferDomain, inferDomainFromSemantics, isBarrelExport, isBoilerplateBarrel, isConfigFile, isEmailTemplate, isHubAndSpokeFile, isLambdaHandler, isNextJsPage, isParserFile, isServiceFile, isSessionFile, isTypeDefinition, isUtilityModule, mapScoreToRating, runInteractiveSetup };
|
|
375
|
+
export { CONTEXT_ANALYZER_PROVIDER, type CoUsageData, type ContextAnalysisResult, type ContextAnalyzerOptions, type ContextSummary, type DependencyGraph, type DependencyNode, type DomainAssignment, type DomainSignals, type FileClassification, type ModuleCluster, type TypeDependency, adjustCohesionForClassification, adjustFragmentationForClassification, analyzeContext, buildDependencyGraph, calculateCohesion, calculateContextBudget, calculateContextScore, calculateDirectoryDistance, calculateEnhancedCohesion, calculateFragmentation, calculateImportDepth, calculatePathEntropy, calculateStructuralCohesionFromCoUsage, classifyFile, detectCircularDependencies, detectModuleClusters, generateSummary, getClassificationRecommendations, getGeneralRecommendations, getTransitiveDependencies, mapScoreToRating };
|