@aiready/context-analyzer 0.22.13 → 0.22.15
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 +34 -33
- package/.turbo/turbo-format-check.log +1 -1
- package/.turbo/turbo-lint.log +1 -9
- package/.turbo/turbo-test.log +24 -24
- package/.turbo/turbo-type-check.log +1 -1
- package/dist/cli-action-JKG3R6RV.mjs +93 -0
- package/dist/cli.js +4 -4
- package/dist/cli.mjs +1 -1
- package/dist/console-report-CVGRMWEU.mjs +74 -0
- package/dist/html-report-BYGKWC3K.mjs +73 -0
- package/package.json +5 -5
- package/src/__tests__/file-classification.test.ts +1 -6
- package/src/report/console-report.ts +2 -2
- package/src/report/html-report.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
DTS
|
|
30
|
-
DTS
|
|
31
|
-
DTS dist/
|
|
32
|
-
DTS dist/
|
|
33
|
-
DTS dist/
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @aiready/context-analyzer@0.22.14 build /Users/pengcao/projects/aiready/packages/context-analyzer
|
|
4
|
+
> tsup src/index.ts src/cli.ts --format cjs,esm --dts
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
|
+
[34mCLI[39m Target: es2020
|
|
10
|
+
[34mCJS[39m Build start
|
|
11
|
+
[34mESM[39m Build start
|
|
12
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m1.81 KB[39m
|
|
13
|
+
[32mESM[39m [1mdist/cli-action-JKG3R6RV.mjs [22m[32m3.00 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/orchestrator-QNE2E4TE.mjs [22m[32m190.00 B[39m
|
|
15
|
+
[32mESM[39m [1mdist/chunk-ISWPFG2C.mjs [22m[32m39.61 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/python-context-BWDC4E5Z.mjs [22m[32m4.48 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/chunk-64U3PNO3.mjs [22m[32m2.65 KB[39m
|
|
18
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m9.02 KB[39m
|
|
19
|
+
[32mESM[39m [1mdist/chunk-HD4Y3GYL.mjs [22m[32m4.48 KB[39m
|
|
20
|
+
[32mESM[39m [1mdist/chunk-JSM7Q5CY.mjs [22m[32m4.98 KB[39m
|
|
21
|
+
[32mESM[39m [1mdist/interactive-setup-JGFBFI3M.mjs [22m[32m2.44 KB[39m
|
|
22
|
+
[32mESM[39m [1mdist/summary-TZFB6ZFM.mjs [22m[32m119.00 B[39m
|
|
23
|
+
[32mESM[39m [1mdist/html-report-BYGKWC3K.mjs [22m[32m2.15 KB[39m
|
|
24
|
+
[32mESM[39m [1mdist/console-report-CVGRMWEU.mjs [22m[32m3.54 KB[39m
|
|
25
|
+
[32mESM[39m ⚡️ Build success in 81ms
|
|
26
|
+
[32mCJS[39m [1mdist/index.js [22m[32m70.37 KB[39m
|
|
27
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m71.51 KB[39m
|
|
28
|
+
[32mCJS[39m ⚡️ Build success in 83ms
|
|
29
|
+
DTS Build start
|
|
30
|
+
DTS ⚡️ Build success in 2192ms
|
|
31
|
+
DTS dist/cli.d.ts 20.00 B
|
|
32
|
+
DTS dist/index.d.ts 14.57 KB
|
|
33
|
+
DTS dist/cli.d.mts 20.00 B
|
|
34
|
+
DTS dist/index.d.mts 14.57 KB
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/context-analyzer@0.22.
|
|
3
|
+
> @aiready/context-analyzer@0.22.14 format-check /Users/pengcao/projects/aiready/packages/context-analyzer
|
|
4
4
|
> prettier --check . --ignore-path ../../.prettierignore
|
|
5
5
|
|
|
6
6
|
Checking formatting...
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/context-analyzer@0.22.
|
|
3
|
+
> @aiready/context-analyzer@0.22.14 lint /Users/pengcao/projects/aiready/packages/context-analyzer
|
|
4
4
|
> eslint src
|
|
5
5
|
|
|
6
|
-
[0m
|
|
7
|
-
[4m/Users/pengcao/projects/aiready/packages/context-analyzer/src/__tests__/file-classification.test.ts[24m
|
|
8
|
-
[2m4:3[22m [33mwarning[39m 'adjustFragmentationForClassification' is defined but never used. Allowed unused vars must match /^_/u [2m@typescript-eslint/no-unused-vars[22m
|
|
9
|
-
[2m5:3[22m [33mwarning[39m 'adjustCohesionForClassification' is defined but never used. Allowed unused vars must match /^_/u [2m@typescript-eslint/no-unused-vars[22m
|
|
10
|
-
[2m6:3[22m [33mwarning[39m 'getClassificationRecommendations' is defined but never used. Allowed unused vars must match /^_/u [2m@typescript-eslint/no-unused-vars[22m
|
|
11
|
-
|
|
12
|
-
[33m[1m✖ 3 problems (0 errors, 3 warnings)[22m[39m
|
|
13
|
-
[0m
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/context-analyzer@0.22.
|
|
3
|
+
> @aiready/context-analyzer@0.22.14 test /Users/pengcao/projects/aiready/packages/context-analyzer
|
|
4
4
|
> vitest run --exclude "**/dist/**"
|
|
5
5
|
|
|
6
6
|
[?25l
|
|
7
7
|
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/context-analyzer[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m src/__tests__/report/console-report.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
10
|
-
[32m✓[39m src/__tests__/report/html-report.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 67[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/__tests__/report/console-report.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 19[2mms[22m[39m
|
|
11
10
|
[90mstderr[2m | src/__tests__/python-context.test.ts[2m > [22m[2mpython-context[2m > [22m[2manalyzePythonContext[2m > [22m[2mshould filter for Python files only
|
|
12
11
|
[22m[39mFailed to analyze src/file2.py: TypeError: Cannot read properties of undefined (reading 'split')
|
|
13
12
|
at Module.analyzePythonContext [90m(/Users/pengcao/projects/aiready/packages/context-analyzer/[39msrc/analyzers/python-context.ts:91:32[90m)[39m
|
|
@@ -22,30 +21,31 @@
|
|
|
22
21
|
at [90m/Users/pengcao/projects/aiready/packages/context-analyzer/[39msrc/__tests__/python-context.test.ts:84:23
|
|
23
22
|
at file:///Users/pengcao/projects/aiready/node_modules/[4m.pnpm[24m/@vitest+runner@4.0.18/node_modules/[4m@vitest/runner[24m/dist/index.js:915:20
|
|
24
23
|
|
|
25
|
-
[32m✓[39m src/__tests__/python-context.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
26
|
-
[32m✓[39m src/__tests__/domain-inference.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m
|
|
27
|
-
[32m✓[39m src/__tests__/
|
|
28
|
-
[32m✓[39m src/__tests__/issue-analyzer.test.ts [2m([22m[2m17 tests[22m[2m)[22m[32m 99[2mms[22m[39m
|
|
29
|
-
[32m✓[39m src/__tests__/orchestrator.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 70[2mms[22m[39m
|
|
30
|
-
[32m✓[39m src/__tests__/auto-detection.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
31
|
-
[32m✓[39m src/__tests__/contract.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 19[2mms[22m[39m
|
|
32
|
-
[32m✓[39m src/__tests__/consolidation.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
33
|
-
[32m✓[39m src/__tests__/fragmentation-coupling.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 64[2mms[22m[39m
|
|
34
|
-
[32m✓[39m src/__tests__/structural-cohesion.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
35
|
-
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 47[2mms[22m[39m
|
|
36
|
-
[32m✓[39m src/__tests__/file-classification.test.ts [2m([22m[2m63 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
24
|
+
[32m✓[39m src/__tests__/python-context.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
25
|
+
[32m✓[39m src/__tests__/domain-inference.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
26
|
+
[32m✓[39m src/__tests__/report/html-report.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 96[2mms[22m[39m
|
|
37
27
|
[32m✓[39m src/__tests__/remediation.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
38
|
-
[32m✓[39m src/__tests__/
|
|
28
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
29
|
+
[32m✓[39m src/__tests__/issue-analyzer.test.ts [2m([22m[2m17 tests[22m[2m)[22m[32m 114[2mms[22m[39m
|
|
30
|
+
[32m✓[39m src/__tests__/contract.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 80[2mms[22m[39m
|
|
31
|
+
[32m✓[39m src/__tests__/fragmentation-coupling.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 198[2mms[22m[39m
|
|
32
|
+
[32m✓[39m src/__tests__/auto-detection.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 217[2mms[22m[39m
|
|
33
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 175[2mms[22m[39m
|
|
34
|
+
[32m✓[39m src/__tests__/orchestrator.test.ts [2m([22m[2m8 tests[22m[2m)[22m[33m 384[2mms[22m[39m
|
|
35
|
+
[32m✓[39m src/__tests__/boilerplate-barrel.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 35[2mms[22m[39m
|
|
36
|
+
[32m✓[39m src/__tests__/cluster-detector.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
37
|
+
[32m✓[39m src/__tests__/defaults.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
38
|
+
[32m✓[39m src/__tests__/consolidation.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
39
|
+
[32m✓[39m src/__tests__/fragmentation-log.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 1[2mms[22m[39m
|
|
40
|
+
[32m✓[39m src/__tests__/structural-cohesion.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
41
|
+
[32m✓[39m src/__tests__/enhanced-cohesion.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
39
42
|
[32m✓[39m src/__tests__/fragmentation-advanced.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
40
|
-
[32m✓[39m src/__tests__/
|
|
41
|
-
[32m✓[39m src/__tests__/
|
|
42
|
-
[32m✓[39m src/__tests__/enhanced-cohesion.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
43
|
-
[32m✓[39m src/__tests__/fragmentation-log.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
44
|
-
[32m✓[39m src/__tests__/boilerplate-barrel.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
43
|
+
[32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
44
|
+
[32m✓[39m src/__tests__/file-classification.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 1[2mms[22m[39m
|
|
45
45
|
|
|
46
46
|
[2m Test Files [22m [1m[32m22 passed[39m[22m[90m (22)[39m
|
|
47
|
-
[2m Tests [22m [1m[
|
|
48
|
-
[2m Start at [22m
|
|
49
|
-
[2m Duration [22m
|
|
47
|
+
[2m Tests [22m [1m[32m162 passed[39m[22m[90m (162)[39m
|
|
48
|
+
[2m Start at [22m 01:04:42
|
|
49
|
+
[2m Duration [22m 7.01s[2m (transform 8.95s, setup 0ms, import 44.26s, tests 1.45s, environment 8ms)[22m
|
|
50
50
|
|
|
51
51
|
[?25h
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeContext
|
|
3
|
+
} from "./chunk-ISWPFG2C.mjs";
|
|
4
|
+
import "./chunk-64U3PNO3.mjs";
|
|
5
|
+
import {
|
|
6
|
+
generateSummary
|
|
7
|
+
} from "./chunk-HD4Y3GYL.mjs";
|
|
8
|
+
import "./chunk-JSM7Q5CY.mjs";
|
|
9
|
+
|
|
10
|
+
// src/cli-action.ts
|
|
11
|
+
import {
|
|
12
|
+
loadMergedConfig,
|
|
13
|
+
handleJSONOutput,
|
|
14
|
+
handleCLIError,
|
|
15
|
+
getElapsedTime,
|
|
16
|
+
resolveOutputPath
|
|
17
|
+
} from "@aiready/core";
|
|
18
|
+
import chalk from "chalk";
|
|
19
|
+
import { writeFileSync } from "fs";
|
|
20
|
+
async function contextActionHandler(directory, options) {
|
|
21
|
+
console.log(chalk.blue("\u{1F50D} Analyzing context window costs...\n"));
|
|
22
|
+
const startTime = Date.now();
|
|
23
|
+
try {
|
|
24
|
+
const defaults = {
|
|
25
|
+
maxDepth: 5,
|
|
26
|
+
maxContextBudget: 1e4,
|
|
27
|
+
minCohesion: 0.6,
|
|
28
|
+
maxFragmentation: 0.5,
|
|
29
|
+
focus: "all",
|
|
30
|
+
includeNodeModules: false,
|
|
31
|
+
include: void 0,
|
|
32
|
+
exclude: void 0,
|
|
33
|
+
maxResults: 10
|
|
34
|
+
};
|
|
35
|
+
let finalOptions = await loadMergedConfig(directory, defaults, {
|
|
36
|
+
maxDepth: options.maxDepth ? parseInt(options.maxDepth) : void 0,
|
|
37
|
+
maxContextBudget: options.maxContext ? parseInt(options.maxContext) : void 0,
|
|
38
|
+
minCohesion: options.minCohesion ? parseFloat(options.minCohesion) : void 0,
|
|
39
|
+
maxFragmentation: options.maxFragmentation ? parseFloat(options.maxFragmentation) : void 0,
|
|
40
|
+
focus: options.focus || void 0,
|
|
41
|
+
includeNodeModules: options.includeNodeModules,
|
|
42
|
+
include: options.include?.split(","),
|
|
43
|
+
exclude: options.exclude?.split(","),
|
|
44
|
+
maxResults: options.maxResults ? parseInt(options.maxResults) : void 0
|
|
45
|
+
});
|
|
46
|
+
if (options.interactive) {
|
|
47
|
+
const { runInteractiveSetup } = await import("./interactive-setup-JGFBFI3M.mjs");
|
|
48
|
+
finalOptions = await runInteractiveSetup(directory, finalOptions);
|
|
49
|
+
}
|
|
50
|
+
const results = await analyzeContext(finalOptions);
|
|
51
|
+
const summary = generateSummary(results, finalOptions);
|
|
52
|
+
const duration = getElapsedTime(startTime);
|
|
53
|
+
if (options.output === "json") {
|
|
54
|
+
handleJSONOutput(
|
|
55
|
+
{
|
|
56
|
+
summary: {
|
|
57
|
+
...summary,
|
|
58
|
+
executionTime: duration,
|
|
59
|
+
config: {
|
|
60
|
+
scan: { tools: ["context"] },
|
|
61
|
+
tools: { context: finalOptions }
|
|
62
|
+
},
|
|
63
|
+
toolConfigs: { context: finalOptions }
|
|
64
|
+
},
|
|
65
|
+
context: { results }
|
|
66
|
+
},
|
|
67
|
+
options.outputFile
|
|
68
|
+
);
|
|
69
|
+
} else if (options.output === "html") {
|
|
70
|
+
const { generateHTMLReport } = await import("./html-report-BYGKWC3K.mjs");
|
|
71
|
+
const html = generateHTMLReport(summary, results);
|
|
72
|
+
const outputPath = resolveOutputPath(
|
|
73
|
+
directory,
|
|
74
|
+
options.outputFile,
|
|
75
|
+
"context-report.html"
|
|
76
|
+
);
|
|
77
|
+
writeFileSync(outputPath, html, "utf-8");
|
|
78
|
+
console.log(chalk.green(`
|
|
79
|
+
\u2705 HTML report saved to: ${outputPath}`));
|
|
80
|
+
} else {
|
|
81
|
+
const { displayConsoleReport } = await import("./console-report-CVGRMWEU.mjs");
|
|
82
|
+
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
83
|
+
console.log(chalk.dim(`
|
|
84
|
+
\u2728 Analysis completed in ${duration}ms
|
|
85
|
+
`));
|
|
86
|
+
}
|
|
87
|
+
} catch (error) {
|
|
88
|
+
handleCLIError(error, "context-analyzer");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
contextActionHandler
|
|
93
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -1914,8 +1914,8 @@ function generateHTMLReport(summary, results) {
|
|
|
1914
1914
|
{
|
|
1915
1915
|
title: "Context Analysis Report",
|
|
1916
1916
|
packageName: "context-analyzer",
|
|
1917
|
-
packageUrl: "https://github.com/
|
|
1918
|
-
bugUrl: "https://github.com/
|
|
1917
|
+
packageUrl: "https://github.com/getaiready/aiready-context-analyzer",
|
|
1918
|
+
bugUrl: "https://github.com/getaiready/aiready-context-analyzer/issues",
|
|
1919
1919
|
emoji: "\u{1F9E0}"
|
|
1920
1920
|
},
|
|
1921
1921
|
stats,
|
|
@@ -1995,12 +1995,12 @@ function displayConsoleReport(summary, results, maxResults = 10) {
|
|
|
1995
1995
|
console.log(import_chalk2.default.cyan(divider));
|
|
1996
1996
|
console.log(
|
|
1997
1997
|
import_chalk2.default.dim(
|
|
1998
|
-
"\n\u2B50 Like aiready? Star us on GitHub: https://github.com/
|
|
1998
|
+
"\n\u2B50 Like aiready? Star us on GitHub: https://github.com/getaiready/aiready-context-analyzer"
|
|
1999
1999
|
)
|
|
2000
2000
|
);
|
|
2001
2001
|
console.log(
|
|
2002
2002
|
import_chalk2.default.dim(
|
|
2003
|
-
"\u{1F41B} Found a bug? Report it: https://github.com/
|
|
2003
|
+
"\u{1F41B} Found a bug? Report it: https://github.com/getaiready/aiready-context-analyzer/issues\n"
|
|
2004
2004
|
)
|
|
2005
2005
|
);
|
|
2006
2006
|
}
|
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-JKG3R6RV.mjs");
|
|
41
41
|
await contextActionHandler(directory, options);
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -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/getaiready/aiready-context-analyzer"
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
console.log(
|
|
67
|
+
chalk.dim(
|
|
68
|
+
"\u{1F41B} Found a bug? Report it: https://github.com/getaiready/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/getaiready/aiready-context-analyzer",
|
|
64
|
+
bugUrl: "https://github.com/getaiready/aiready-context-analyzer/issues",
|
|
65
|
+
emoji: "\u{1F9E0}"
|
|
66
|
+
},
|
|
67
|
+
stats,
|
|
68
|
+
sections
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
generateHTMLReport
|
|
73
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/context-analyzer",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.15",
|
|
4
4
|
"description": "AI context window cost analysis - detect fragmented code, deep import chains, and expensive context budgets",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
|
-
"url": "https://github.com/
|
|
42
|
+
"url": "https://github.com/getaiready/aiready-context-analyzer.git"
|
|
43
43
|
},
|
|
44
|
-
"homepage": "https://github.com/
|
|
44
|
+
"homepage": "https://github.com/getaiready/aiready-context-analyzer",
|
|
45
45
|
"bugs": {
|
|
46
|
-
"url": "https://github.com/
|
|
46
|
+
"url": "https://github.com/getaiready/aiready-context-analyzer/issues"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"commander": "^14.0.0",
|
|
50
50
|
"chalk": "^5.3.0",
|
|
51
51
|
"prompts": "^2.4.2",
|
|
52
|
-
"@aiready/core": "0.24.
|
|
52
|
+
"@aiready/core": "0.24.16"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^24.0.0",
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
classifyFile,
|
|
4
|
-
adjustFragmentationForClassification,
|
|
5
|
-
adjustCohesionForClassification,
|
|
6
|
-
getClassificationRecommendations,
|
|
7
|
-
} from '../index';
|
|
2
|
+
import { classifyFile } from '../index';
|
|
8
3
|
import { createNode } from './file-classification.fixtures';
|
|
9
4
|
|
|
10
5
|
describe('file classification core', () => {
|
|
@@ -99,12 +99,12 @@ export function displayConsoleReport(
|
|
|
99
99
|
console.log(chalk.cyan(divider));
|
|
100
100
|
console.log(
|
|
101
101
|
chalk.dim(
|
|
102
|
-
'\n⭐ Like aiready? Star us on GitHub: https://github.com/
|
|
102
|
+
'\n⭐ Like aiready? Star us on GitHub: https://github.com/getaiready/aiready-context-analyzer'
|
|
103
103
|
)
|
|
104
104
|
);
|
|
105
105
|
console.log(
|
|
106
106
|
chalk.dim(
|
|
107
|
-
'🐛 Found a bug? Report it: https://github.com/
|
|
107
|
+
'🐛 Found a bug? Report it: https://github.com/getaiready/aiready-context-analyzer/issues\n'
|
|
108
108
|
)
|
|
109
109
|
);
|
|
110
110
|
}
|
|
@@ -74,8 +74,8 @@ export function generateHTMLReport(
|
|
|
74
74
|
{
|
|
75
75
|
title: 'Context Analysis Report',
|
|
76
76
|
packageName: 'context-analyzer',
|
|
77
|
-
packageUrl: 'https://github.com/
|
|
78
|
-
bugUrl: 'https://github.com/
|
|
77
|
+
packageUrl: 'https://github.com/getaiready/aiready-context-analyzer',
|
|
78
|
+
bugUrl: 'https://github.com/getaiready/aiready-context-analyzer/issues',
|
|
79
79
|
emoji: '🧠',
|
|
80
80
|
},
|
|
81
81
|
stats,
|