@aiready/context-analyzer 0.22.14 → 0.22.16
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 +19 -19
- package/.turbo/turbo-format-check.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +347 -25
- package/.turbo/turbo-type-check.log +1 -1
- package/dist/chunk-2LEHY2GV.mjs +1287 -0
- package/dist/chunk-P2ZQGQAO.mjs +1282 -0
- package/dist/chunk-QGI23DBA.mjs +1282 -0
- package/dist/chunk-QTB4KYCX.mjs +1260 -0
- package/dist/chunk-RQ5BQLT6.mjs +102 -0
- package/dist/chunk-VYFHSGV6.mjs +1283 -0
- package/dist/chunk-WLXLBWDU.mjs +96 -0
- package/dist/chunk-XDYPMFCH.mjs +1250 -0
- package/dist/cli-action-332WE54N.mjs +95 -0
- package/dist/cli-action-7QXG7LHS.mjs +95 -0
- package/dist/cli-action-BIX6TYXF.mjs +95 -0
- package/dist/cli-action-BUGVCH44.mjs +95 -0
- package/dist/cli-action-JKG3R6RV.mjs +93 -0
- package/dist/cli-action-RO24U52W.mjs +95 -0
- package/dist/cli-action-WAZ5KM6X.mjs +95 -0
- package/dist/cli-action-XDKINE2R.mjs +95 -0
- package/dist/cli-action-Y6VATXMV.mjs +95 -0
- package/dist/cli.js +79 -31
- package/dist/cli.mjs +1 -1
- package/dist/console-report-CVGRMWEU.mjs +74 -0
- package/dist/html-report-BYGKWC3K.mjs +73 -0
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +71 -25
- package/dist/index.mjs +3 -3
- package/dist/orchestrator-2KQNMO2L.mjs +10 -0
- package/dist/orchestrator-66ZVNOLR.mjs +10 -0
- package/dist/orchestrator-KM2OJPZD.mjs +10 -0
- package/dist/orchestrator-MKDZPRBA.mjs +10 -0
- package/dist/orchestrator-QSHWWBWS.mjs +10 -0
- package/dist/orchestrator-WFQPMNSD.mjs +10 -0
- package/dist/python-context-H2OLC5JN.mjs +162 -0
- package/dist/python-context-OBP7JD5P.mjs +162 -0
- package/package.json +8 -6
- package/src/__tests__/analyzer.test.ts +4 -3
- package/src/__tests__/issue-analyzer.test.ts +4 -2
- package/src/classify/file-classifiers.ts +14 -13
- package/src/cli-action.ts +6 -3
- package/src/graph-builder.ts +43 -8
- package/src/issue-analyzer.ts +19 -7
- package/src/orchestrator.ts +6 -4
- package/src/report/console-report.ts +2 -2
- package/src/report/html-report.ts +2 -2
- package/src/semantic/domain-inference.ts +1 -1
- package/src/types.ts +2 -0
- package/src/utils/dependency-graph-utils.ts +22 -13
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeContext
|
|
3
|
+
} from "./chunk-XDYPMFCH.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: 10,
|
|
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(
|
|
51
|
+
finalOptions
|
|
52
|
+
);
|
|
53
|
+
const summary = generateSummary(results, finalOptions);
|
|
54
|
+
const duration = getElapsedTime(startTime);
|
|
55
|
+
if (options.output === "json") {
|
|
56
|
+
handleJSONOutput(
|
|
57
|
+
{
|
|
58
|
+
summary: {
|
|
59
|
+
...summary,
|
|
60
|
+
executionTime: duration,
|
|
61
|
+
config: {
|
|
62
|
+
scan: { tools: ["context"] },
|
|
63
|
+
tools: { context: finalOptions }
|
|
64
|
+
},
|
|
65
|
+
toolConfigs: { context: finalOptions }
|
|
66
|
+
},
|
|
67
|
+
context: { results }
|
|
68
|
+
},
|
|
69
|
+
options.outputFile
|
|
70
|
+
);
|
|
71
|
+
} else if (options.output === "html") {
|
|
72
|
+
const { generateHTMLReport } = await import("./html-report-BYGKWC3K.mjs");
|
|
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
|
+
const { displayConsoleReport } = await import("./console-report-CVGRMWEU.mjs");
|
|
84
|
+
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
85
|
+
console.log(chalk.dim(`
|
|
86
|
+
\u2728 Analysis completed in ${duration}ms
|
|
87
|
+
`));
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
handleCLIError(error, "context-analyzer");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
contextActionHandler
|
|
95
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeContext
|
|
3
|
+
} from "./chunk-2LEHY2GV.mjs";
|
|
4
|
+
import "./chunk-RQ5BQLT6.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: 10,
|
|
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(
|
|
51
|
+
finalOptions
|
|
52
|
+
);
|
|
53
|
+
const summary = generateSummary(results, finalOptions);
|
|
54
|
+
const duration = getElapsedTime(startTime);
|
|
55
|
+
if (options.output === "json") {
|
|
56
|
+
handleJSONOutput(
|
|
57
|
+
{
|
|
58
|
+
summary: {
|
|
59
|
+
...summary,
|
|
60
|
+
executionTime: duration,
|
|
61
|
+
config: {
|
|
62
|
+
scan: { tools: ["context"] },
|
|
63
|
+
tools: { context: finalOptions }
|
|
64
|
+
},
|
|
65
|
+
toolConfigs: { context: finalOptions }
|
|
66
|
+
},
|
|
67
|
+
context: { results }
|
|
68
|
+
},
|
|
69
|
+
options.outputFile
|
|
70
|
+
);
|
|
71
|
+
} else if (options.output === "html") {
|
|
72
|
+
const { generateHTMLReport } = await import("./html-report-BYGKWC3K.mjs");
|
|
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
|
+
const { displayConsoleReport } = await import("./console-report-CVGRMWEU.mjs");
|
|
84
|
+
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
85
|
+
console.log(chalk.dim(`
|
|
86
|
+
\u2728 Analysis completed in ${duration}ms
|
|
87
|
+
`));
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
handleCLIError(error, "context-analyzer");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
contextActionHandler
|
|
95
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
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(
|
|
51
|
+
finalOptions
|
|
52
|
+
);
|
|
53
|
+
const summary = generateSummary(results, finalOptions);
|
|
54
|
+
const duration = getElapsedTime(startTime);
|
|
55
|
+
if (options.output === "json") {
|
|
56
|
+
handleJSONOutput(
|
|
57
|
+
{
|
|
58
|
+
summary: {
|
|
59
|
+
...summary,
|
|
60
|
+
executionTime: duration,
|
|
61
|
+
config: {
|
|
62
|
+
scan: { tools: ["context"] },
|
|
63
|
+
tools: { context: finalOptions }
|
|
64
|
+
},
|
|
65
|
+
toolConfigs: { context: finalOptions }
|
|
66
|
+
},
|
|
67
|
+
context: { results }
|
|
68
|
+
},
|
|
69
|
+
options.outputFile
|
|
70
|
+
);
|
|
71
|
+
} else if (options.output === "html") {
|
|
72
|
+
const { generateHTMLReport } = await import("./html-report-BYGKWC3K.mjs");
|
|
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
|
+
const { displayConsoleReport } = await import("./console-report-CVGRMWEU.mjs");
|
|
84
|
+
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
85
|
+
console.log(chalk.dim(`
|
|
86
|
+
\u2728 Analysis completed in ${duration}ms
|
|
87
|
+
`));
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
handleCLIError(error, "context-analyzer");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
contextActionHandler
|
|
95
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeContext
|
|
3
|
+
} from "./chunk-QTB4KYCX.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: 10,
|
|
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(
|
|
51
|
+
finalOptions
|
|
52
|
+
);
|
|
53
|
+
const summary = generateSummary(results, finalOptions);
|
|
54
|
+
const duration = getElapsedTime(startTime);
|
|
55
|
+
if (options.output === "json") {
|
|
56
|
+
handleJSONOutput(
|
|
57
|
+
{
|
|
58
|
+
summary: {
|
|
59
|
+
...summary,
|
|
60
|
+
executionTime: duration,
|
|
61
|
+
config: {
|
|
62
|
+
scan: { tools: ["context"] },
|
|
63
|
+
tools: { context: finalOptions }
|
|
64
|
+
},
|
|
65
|
+
toolConfigs: { context: finalOptions }
|
|
66
|
+
},
|
|
67
|
+
context: { results }
|
|
68
|
+
},
|
|
69
|
+
options.outputFile
|
|
70
|
+
);
|
|
71
|
+
} else if (options.output === "html") {
|
|
72
|
+
const { generateHTMLReport } = await import("./html-report-BYGKWC3K.mjs");
|
|
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
|
+
const { displayConsoleReport } = await import("./console-report-CVGRMWEU.mjs");
|
|
84
|
+
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
85
|
+
console.log(chalk.dim(`
|
|
86
|
+
\u2728 Analysis completed in ${duration}ms
|
|
87
|
+
`));
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
handleCLIError(error, "context-analyzer");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
contextActionHandler
|
|
95
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeContext
|
|
3
|
+
} from "./chunk-QGI23DBA.mjs";
|
|
4
|
+
import "./chunk-WLXLBWDU.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: 10,
|
|
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(
|
|
51
|
+
finalOptions
|
|
52
|
+
);
|
|
53
|
+
const summary = generateSummary(results, finalOptions);
|
|
54
|
+
const duration = getElapsedTime(startTime);
|
|
55
|
+
if (options.output === "json") {
|
|
56
|
+
handleJSONOutput(
|
|
57
|
+
{
|
|
58
|
+
summary: {
|
|
59
|
+
...summary,
|
|
60
|
+
executionTime: duration,
|
|
61
|
+
config: {
|
|
62
|
+
scan: { tools: ["context"] },
|
|
63
|
+
tools: { context: finalOptions }
|
|
64
|
+
},
|
|
65
|
+
toolConfigs: { context: finalOptions }
|
|
66
|
+
},
|
|
67
|
+
context: { results }
|
|
68
|
+
},
|
|
69
|
+
options.outputFile
|
|
70
|
+
);
|
|
71
|
+
} else if (options.output === "html") {
|
|
72
|
+
const { generateHTMLReport } = await import("./html-report-BYGKWC3K.mjs");
|
|
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
|
+
const { displayConsoleReport } = await import("./console-report-CVGRMWEU.mjs");
|
|
84
|
+
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
85
|
+
console.log(chalk.dim(`
|
|
86
|
+
\u2728 Analysis completed in ${duration}ms
|
|
87
|
+
`));
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
handleCLIError(error, "context-analyzer");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
contextActionHandler
|
|
95
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeContext
|
|
3
|
+
} from "./chunk-P2ZQGQAO.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: 10,
|
|
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(
|
|
51
|
+
finalOptions
|
|
52
|
+
);
|
|
53
|
+
const summary = generateSummary(results, finalOptions);
|
|
54
|
+
const duration = getElapsedTime(startTime);
|
|
55
|
+
if (options.output === "json") {
|
|
56
|
+
handleJSONOutput(
|
|
57
|
+
{
|
|
58
|
+
summary: {
|
|
59
|
+
...summary,
|
|
60
|
+
executionTime: duration,
|
|
61
|
+
config: {
|
|
62
|
+
scan: { tools: ["context"] },
|
|
63
|
+
tools: { context: finalOptions }
|
|
64
|
+
},
|
|
65
|
+
toolConfigs: { context: finalOptions }
|
|
66
|
+
},
|
|
67
|
+
context: { results }
|
|
68
|
+
},
|
|
69
|
+
options.outputFile
|
|
70
|
+
);
|
|
71
|
+
} else if (options.output === "html") {
|
|
72
|
+
const { generateHTMLReport } = await import("./html-report-BYGKWC3K.mjs");
|
|
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
|
+
const { displayConsoleReport } = await import("./console-report-CVGRMWEU.mjs");
|
|
84
|
+
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
85
|
+
console.log(chalk.dim(`
|
|
86
|
+
\u2728 Analysis completed in ${duration}ms
|
|
87
|
+
`));
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
handleCLIError(error, "context-analyzer");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
contextActionHandler
|
|
95
|
+
};
|