@aiready/context-analyzer 0.21.26 → 0.22.0
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 +16 -10
- package/.turbo/turbo-test.log +31 -69
- package/coverage/clover.xml +392 -1878
- package/coverage/coverage-final.json +15 -19
- package/coverage/index.html +48 -63
- package/coverage/src/analyzers/index.html +21 -21
- package/coverage/src/analyzers/python-context.ts.html +96 -96
- package/coverage/src/ast-utils.ts.html +34 -109
- package/coverage/src/classifier.ts.html +104 -104
- package/coverage/src/classify/classification-patterns.ts.html +1 -1
- package/coverage/src/classify/file-classifiers.ts.html +1 -1
- package/coverage/src/classify/index.html +1 -1
- package/coverage/src/cluster-detector.ts.html +72 -72
- package/coverage/src/defaults.ts.html +1 -1
- package/coverage/src/graph-builder.ts.html +131 -131
- package/coverage/src/index.html +101 -116
- package/coverage/src/index.ts.html +2 -2
- package/coverage/src/issue-analyzer.ts.html +32 -83
- package/coverage/src/mapper.ts.html +20 -2
- package/coverage/src/metrics.ts.html +127 -130
- package/coverage/src/orchestrator.ts.html +13 -13
- package/coverage/src/provider.ts.html +19 -19
- package/coverage/src/remediation.ts.html +59 -59
- package/coverage/src/report/console-report.ts.html +2 -2
- package/coverage/src/report/html-report.ts.html +60 -84
- package/coverage/src/report/index.html +7 -7
- package/coverage/src/report/interactive-setup.ts.html +1 -1
- package/coverage/src/scoring.ts.html +62 -62
- package/coverage/src/semantic/co-usage.ts.html +1 -1
- package/coverage/src/semantic/consolidation.ts.html +1 -1
- package/coverage/src/semantic/domain-inference.ts.html +1 -1
- package/coverage/src/semantic/index.html +1 -1
- package/coverage/src/semantic/type-graph.ts.html +1 -1
- package/coverage/src/summary.ts.html +67 -67
- package/coverage/src/types.ts.html +1 -1
- package/coverage/src/utils/dependency-graph-utils.ts.html +41 -41
- package/coverage/src/utils/index.html +21 -21
- package/coverage/src/utils/string-utils.ts.html +1 -1
- package/dist/chunk-22ZO4EKZ.mjs +1297 -0
- package/dist/chunk-4U4LDWGF.mjs +360 -0
- package/dist/chunk-BA7QGUHN.mjs +1722 -0
- package/dist/chunk-BCEZGRXI.mjs +1297 -0
- package/dist/chunk-BQCISA2F.mjs +91 -0
- package/dist/chunk-EMYD7NS6.mjs +137 -0
- package/dist/chunk-EWFR366Y.mjs +1740 -0
- package/dist/chunk-FO6YT6RG.mjs +1751 -0
- package/dist/chunk-J3SZQZNU.mjs +221 -0
- package/dist/chunk-OZE3FVZT.mjs +1089 -0
- package/dist/chunk-WHB7QI7N.mjs +91 -0
- package/dist/cli-action-CXIHOVAC.mjs +95 -0
- package/dist/cli-action-SA7SCYNV.mjs +95 -0
- package/dist/cli-action-YAJOJCXJ.mjs +95 -0
- package/dist/cli.js +688 -566
- package/dist/cli.mjs +4 -88
- package/dist/index.js +889 -773
- package/dist/index.mjs +21 -14
- package/dist/orchestrator-3L3NAZYP.mjs +10 -0
- package/dist/orchestrator-MONOZHVW.mjs +10 -0
- package/dist/orchestrator-ZR7JSKWI.mjs +10 -0
- package/dist/summary-7PZVW72O.mjs +7 -0
- package/dist/summary-LKUCJAIS.mjs +7 -0
- package/package.json +2 -2
- package/src/__tests__/analyzer.test.ts +1 -1
- package/src/__tests__/enhanced-cohesion.test.ts +4 -1
- package/src/__tests__/orchestrator.test.ts +19 -4
- package/src/__tests__/python-context.test.ts +6 -0
- package/src/__tests__/report/html-report.test.ts +8 -2
- package/src/ast-utils.ts +1 -26
- package/src/cli-definition.ts +4 -2
- package/src/issue-analyzer.ts +4 -19
- package/src/metrics.ts +1 -2
- package/src/provider.ts +4 -4
- package/src/report/html-report.ts +43 -59
- package/coverage/dist/chunk-64U3PNO3.mjs.html +0 -367
- package/coverage/dist/chunk-J3MUOWHC.mjs.html +0 -5326
- package/coverage/dist/index.html +0 -146
- package/coverage/dist/index.mjs.html +0 -1396
- package/coverage/src/analyzer.ts.html +0 -88
package/dist/cli.mjs
CHANGED
|
@@ -1,95 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
analyzeContext,
|
|
4
|
-
displayConsoleReport,
|
|
5
|
-
generateHTMLReport,
|
|
6
|
-
generateSummary,
|
|
7
|
-
runInteractiveSetup
|
|
8
|
-
} from "./chunk-VLV6MXPL.mjs";
|
|
9
|
-
import "./chunk-64U3PNO3.mjs";
|
|
10
2
|
|
|
11
3
|
// src/cli.ts
|
|
12
4
|
import { Command } from "commander";
|
|
13
5
|
|
|
14
|
-
// src/cli-action.ts
|
|
15
|
-
import {
|
|
16
|
-
loadMergedConfig,
|
|
17
|
-
handleJSONOutput,
|
|
18
|
-
handleCLIError,
|
|
19
|
-
getElapsedTime,
|
|
20
|
-
resolveOutputPath
|
|
21
|
-
} from "@aiready/core";
|
|
22
|
-
import chalk from "chalk";
|
|
23
|
-
import { writeFileSync } from "fs";
|
|
24
|
-
async function contextActionHandler(directory, options) {
|
|
25
|
-
console.log(chalk.blue("\u{1F50D} Analyzing context window costs...\n"));
|
|
26
|
-
const startTime = Date.now();
|
|
27
|
-
try {
|
|
28
|
-
const defaults = {
|
|
29
|
-
maxDepth: 5,
|
|
30
|
-
maxContextBudget: 1e4,
|
|
31
|
-
minCohesion: 0.6,
|
|
32
|
-
maxFragmentation: 0.5,
|
|
33
|
-
focus: "all",
|
|
34
|
-
includeNodeModules: false,
|
|
35
|
-
include: void 0,
|
|
36
|
-
exclude: void 0,
|
|
37
|
-
maxResults: 10
|
|
38
|
-
};
|
|
39
|
-
let finalOptions = await loadMergedConfig(directory, defaults, {
|
|
40
|
-
maxDepth: options.maxDepth ? parseInt(options.maxDepth) : void 0,
|
|
41
|
-
maxContextBudget: options.maxContext ? parseInt(options.maxContext) : void 0,
|
|
42
|
-
minCohesion: options.minCohesion ? parseFloat(options.minCohesion) : void 0,
|
|
43
|
-
maxFragmentation: options.maxFragmentation ? parseFloat(options.maxFragmentation) : void 0,
|
|
44
|
-
focus: options.focus || void 0,
|
|
45
|
-
includeNodeModules: options.includeNodeModules,
|
|
46
|
-
include: options.include?.split(","),
|
|
47
|
-
exclude: options.exclude?.split(","),
|
|
48
|
-
maxResults: options.maxResults ? parseInt(options.maxResults) : void 0
|
|
49
|
-
});
|
|
50
|
-
if (options.interactive) {
|
|
51
|
-
finalOptions = await runInteractiveSetup(directory, finalOptions);
|
|
52
|
-
}
|
|
53
|
-
const results = await analyzeContext(finalOptions);
|
|
54
|
-
const summary = generateSummary(results, finalOptions);
|
|
55
|
-
const duration = getElapsedTime(startTime);
|
|
56
|
-
if (options.output === "json") {
|
|
57
|
-
handleJSONOutput(
|
|
58
|
-
{
|
|
59
|
-
summary: {
|
|
60
|
-
...summary,
|
|
61
|
-
executionTime: duration,
|
|
62
|
-
config: {
|
|
63
|
-
scan: { tools: ["context"] },
|
|
64
|
-
tools: { context: finalOptions }
|
|
65
|
-
},
|
|
66
|
-
toolConfigs: { context: finalOptions }
|
|
67
|
-
},
|
|
68
|
-
context: { results }
|
|
69
|
-
},
|
|
70
|
-
options.outputFile
|
|
71
|
-
);
|
|
72
|
-
} else if (options.output === "html") {
|
|
73
|
-
const html = generateHTMLReport(summary, results);
|
|
74
|
-
const outputPath = resolveOutputPath(
|
|
75
|
-
directory,
|
|
76
|
-
options.outputFile,
|
|
77
|
-
"context-report.html"
|
|
78
|
-
);
|
|
79
|
-
writeFileSync(outputPath, html, "utf-8");
|
|
80
|
-
console.log(chalk.green(`
|
|
81
|
-
\u2705 HTML report saved to: ${outputPath}`));
|
|
82
|
-
} else {
|
|
83
|
-
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
84
|
-
console.log(chalk.dim(`
|
|
85
|
-
\u2728 Analysis completed in ${duration}ms
|
|
86
|
-
`));
|
|
87
|
-
}
|
|
88
|
-
} catch (error) {
|
|
89
|
-
handleCLIError(error, "context-analyzer");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
6
|
// src/cli-definition.ts
|
|
94
7
|
function defineContextCommand(program2) {
|
|
95
8
|
program2.name("aiready-context").description("Analyze AI context window cost and code structure").version("0.1.0").addHelpText(
|
|
@@ -123,7 +36,10 @@ function defineContextCommand(program2) {
|
|
|
123
36
|
).option("--output-file <path>", "Output file path (for json/html)").option(
|
|
124
37
|
"--interactive",
|
|
125
38
|
"Run interactive setup to suggest excludes and focus areas"
|
|
126
|
-
).action(
|
|
39
|
+
).action(async (directory, options) => {
|
|
40
|
+
const { contextActionHandler } = await import("./cli-action-SA7SCYNV.mjs");
|
|
41
|
+
await contextActionHandler(directory, options);
|
|
42
|
+
});
|
|
127
43
|
}
|
|
128
44
|
|
|
129
45
|
// src/cli.ts
|