@aiready/context-analyzer 0.22.8 → 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 +2 -2
- package/.turbo/turbo-lint.log +9 -1
- package/.turbo/turbo-test.log +23 -23
- package/.turbo/turbo-type-check.log +1 -1
- 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
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
|
|
977
|
+
return CLASSIFICATION.BOILERPLATE;
|
|
978
978
|
}
|
|
979
979
|
if (isBarrelExport(node)) {
|
|
980
|
-
return
|
|
980
|
+
return CLASSIFICATION.BARREL;
|
|
981
981
|
}
|
|
982
982
|
if (isTypeDefinition(node)) {
|
|
983
|
-
return
|
|
983
|
+
return CLASSIFICATION.TYPE_DEFINITION;
|
|
984
984
|
}
|
|
985
985
|
if (isNextJsPage(node)) {
|
|
986
|
-
return
|
|
986
|
+
return CLASSIFICATION.NEXTJS_PAGE;
|
|
987
987
|
}
|
|
988
988
|
if (isLambdaHandler(node)) {
|
|
989
|
-
return
|
|
989
|
+
return CLASSIFICATION.LAMBDA_HANDLER;
|
|
990
990
|
}
|
|
991
991
|
if (isServiceFile(node)) {
|
|
992
|
-
return
|
|
992
|
+
return CLASSIFICATION.SERVICE;
|
|
993
993
|
}
|
|
994
994
|
if (isEmailTemplate(node)) {
|
|
995
|
-
return
|
|
995
|
+
return CLASSIFICATION.EMAIL_TEMPLATE;
|
|
996
996
|
}
|
|
997
997
|
if (isParserFile(node)) {
|
|
998
|
-
return
|
|
998
|
+
return CLASSIFICATION.PARSER;
|
|
999
999
|
}
|
|
1000
1000
|
if (isSessionFile(node)) {
|
|
1001
1001
|
if (cohesionScore >= 0.25 && domains.length <= 1)
|
|
1002
|
-
return
|
|
1003
|
-
return
|
|
1002
|
+
return CLASSIFICATION.COHESIVE_MODULE;
|
|
1003
|
+
return CLASSIFICATION.UTILITY_MODULE;
|
|
1004
1004
|
}
|
|
1005
1005
|
if (isUtilityModule(node)) {
|
|
1006
|
-
return
|
|
1006
|
+
return CLASSIFICATION.UTILITY_MODULE;
|
|
1007
1007
|
}
|
|
1008
1008
|
if (isConfigFile(node)) {
|
|
1009
|
-
return
|
|
1009
|
+
return CLASSIFICATION.COHESIVE_MODULE;
|
|
1010
1010
|
}
|
|
1011
1011
|
if (isHubAndSpokeFile(node)) {
|
|
1012
|
-
return
|
|
1012
|
+
return CLASSIFICATION.SPOKE_MODULE;
|
|
1013
1013
|
}
|
|
1014
1014
|
if (domains.length <= 1 && domains[0] !== "unknown") {
|
|
1015
|
-
return
|
|
1015
|
+
return CLASSIFICATION.COHESIVE_MODULE;
|
|
1016
1016
|
}
|
|
1017
1017
|
if (domains.length > 1 && cohesionScore < 0.4) {
|
|
1018
|
-
return
|
|
1018
|
+
return CLASSIFICATION.MIXED_CONCERNS;
|
|
1019
1019
|
}
|
|
1020
1020
|
if (cohesionScore >= 0.7) {
|
|
1021
|
-
return
|
|
1021
|
+
return CLASSIFICATION.COHESIVE_MODULE;
|
|
1022
1022
|
}
|
|
1023
|
-
return
|
|
1023
|
+
return CLASSIFICATION.UNKNOWN;
|
|
1024
1024
|
}
|
|
1025
1025
|
function adjustCohesionForClassification(baseCohesion, classification, node) {
|
|
1026
1026
|
switch (classification) {
|
|
1027
|
-
case
|
|
1027
|
+
case CLASSIFICATION.BOILERPLATE:
|
|
1028
1028
|
return 0.2;
|
|
1029
1029
|
// Redundant indirection is low cohesion (architectural theater)
|
|
1030
|
-
case
|
|
1030
|
+
case CLASSIFICATION.BARREL:
|
|
1031
1031
|
return 1;
|
|
1032
|
-
case
|
|
1032
|
+
case CLASSIFICATION.TYPE_DEFINITION:
|
|
1033
1033
|
return 1;
|
|
1034
|
-
case
|
|
1034
|
+
case CLASSIFICATION.NEXTJS_PAGE:
|
|
1035
1035
|
return 1;
|
|
1036
|
-
case
|
|
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
|
|
1044
|
+
case CLASSIFICATION.SERVICE:
|
|
1045
1045
|
return Math.max(0.72, Math.min(1, baseCohesion + 0.3));
|
|
1046
|
-
case
|
|
1046
|
+
case CLASSIFICATION.LAMBDA_HANDLER:
|
|
1047
1047
|
return Math.max(0.75, Math.min(1, baseCohesion + 0.35));
|
|
1048
|
-
case
|
|
1048
|
+
case CLASSIFICATION.EMAIL_TEMPLATE:
|
|
1049
1049
|
return Math.max(0.72, Math.min(1, baseCohesion + 0.3));
|
|
1050
|
-
case
|
|
1050
|
+
case CLASSIFICATION.PARSER:
|
|
1051
1051
|
return Math.max(0.7, Math.min(1, baseCohesion + 0.3));
|
|
1052
|
-
case
|
|
1052
|
+
case CLASSIFICATION.SPOKE_MODULE:
|
|
1053
1053
|
return Math.max(baseCohesion, 0.6);
|
|
1054
|
-
case
|
|
1054
|
+
case CLASSIFICATION.COHESIVE_MODULE:
|
|
1055
1055
|
return Math.max(baseCohesion, 0.7);
|
|
1056
|
-
case
|
|
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
|
|
1105
|
+
case CLASSIFICATION.BOILERPLATE:
|
|
1106
1106
|
return baseFragmentation * 1.5;
|
|
1107
1107
|
// Redundant barrels increase fragmentation
|
|
1108
|
-
case
|
|
1108
|
+
case CLASSIFICATION.BARREL:
|
|
1109
1109
|
return 0;
|
|
1110
|
-
case
|
|
1110
|
+
case CLASSIFICATION.TYPE_DEFINITION:
|
|
1111
1111
|
return 0;
|
|
1112
|
-
case
|
|
1113
|
-
case
|
|
1114
|
-
case
|
|
1115
|
-
case
|
|
1116
|
-
case
|
|
1117
|
-
case
|
|
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
|
|
1119
|
+
case CLASSIFICATION.SPOKE_MODULE:
|
|
1120
1120
|
return baseFragmentation * 0.15;
|
|
1121
1121
|
// Heavily discount intentional monorepo separation
|
|
1122
|
-
case
|
|
1122
|
+
case CLASSIFICATION.COHESIVE_MODULE:
|
|
1123
1123
|
return baseFragmentation * 0.3;
|
|
1124
|
-
case
|
|
1124
|
+
case CLASSIFICATION.MIXED_CONCERNS:
|
|
1125
1125
|
return baseFragmentation;
|
|
1126
1126
|
default:
|
|
1127
1127
|
return baseFragmentation * 0.7;
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
|
-
var
|
|
1130
|
+
var CLASSIFICATION;
|
|
1131
1131
|
var init_classifier = __esm({
|
|
1132
1132
|
"src/classifier.ts"() {
|
|
1133
1133
|
"use strict";
|
|
1134
1134
|
init_file_classifiers();
|
|
1135
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1666
|
-
|
|
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
|
|
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:
|
|
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/
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
console.log(
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
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
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
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 (
|
|
1776
|
-
|
|
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
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
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
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
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
|
|
1812
|
-
"src/report/
|
|
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/
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
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 (
|
|
1911
|
-
|
|
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
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
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
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
{
|
|
1931
|
-
|
|
1932
|
-
{
|
|
1933
|
-
|
|
1934
|
-
|
|
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.
|
|
1957
|
-
|
|
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
|
|
1960
|
-
var
|
|
1961
|
-
"src/report/
|
|
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
|
-
|
|
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
|
|
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(
|
|
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-
|
|
40
|
+
const { contextActionHandler } = await import("./cli-action-W7TESWAV.mjs");
|
|
41
41
|
await contextActionHandler(directory, options);
|
|
42
42
|
});
|
|
43
43
|
}
|