@aiready/context-analyzer 0.4.2 → 0.4.3
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 +7 -7
- package/README.md +8 -2
- package/dist/cli.js +16 -3
- package/dist/cli.mjs +19 -6
- package/package.json +2 -2
- package/src/cli.ts +21 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/context-analyzer@0.4.
|
|
3
|
+
> @aiready/context-analyzer@0.4.3 build /Users/pengcao/projects/aiready/packages/context-analyzer
|
|
4
4
|
> tsup src/index.ts src/cli.ts --format cjs,esm --dts
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mESM[39m [1mdist/cli.mjs [22m[32m15.74 KB[39m
|
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m164.00 B[39m
|
|
14
12
|
[32mESM[39m [1mdist/chunk-HDFXSEFW.mjs [22m[32m19.11 KB[39m
|
|
15
|
-
[32mESM[39m
|
|
16
|
-
[
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m164.00 B[39m
|
|
14
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m16.16 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 16ms
|
|
16
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m36.36 KB[39m
|
|
17
17
|
[32mCJS[39m [1mdist/index.js [22m[32m20.26 KB[39m
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 16ms
|
|
19
19
|
DTS Build start
|
|
20
|
-
DTS ⚡️ Build success in
|
|
20
|
+
DTS ⚡️ Build success in 540ms
|
|
21
21
|
DTS dist/cli.d.ts 20.00 B
|
|
22
22
|
DTS dist/index.d.ts 2.37 KB
|
|
23
23
|
DTS dist/cli.d.mts 20.00 B
|
package/README.md
CHANGED
|
@@ -75,8 +75,14 @@ aiready-context ./src --focus depth
|
|
|
75
75
|
# Set thresholds
|
|
76
76
|
aiready-context ./src --max-depth 5 --max-context 10000 --min-cohesion 0.6
|
|
77
77
|
|
|
78
|
-
# Export to JSON
|
|
79
|
-
aiready-context ./src --output json
|
|
78
|
+
# Export to JSON (saved to .aiready/ by default)
|
|
79
|
+
aiready-context ./src --output json
|
|
80
|
+
|
|
81
|
+
# Or specify custom path
|
|
82
|
+
aiready-context ./src --output json --output-file custom-report.json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> **📁 Output Files:** By default, all output files are saved to the `.aiready/` directory in your project root. You can override this with `--output-file`.
|
|
80
86
|
|
|
81
87
|
# Generate HTML report
|
|
82
88
|
aiready-context ./src --output html --output-file report.html
|
package/dist/cli.js
CHANGED
|
@@ -641,13 +641,26 @@ program.name("aiready-context").description("Analyze AI context window cost and
|
|
|
641
641
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
642
642
|
analysisTime: elapsedTime
|
|
643
643
|
};
|
|
644
|
-
(0, import_core3.
|
|
645
|
-
|
|
644
|
+
const outputPath = (0, import_core3.resolveOutputPath)(
|
|
645
|
+
options.outputFile,
|
|
646
|
+
`context-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
|
|
647
|
+
directory
|
|
648
|
+
);
|
|
649
|
+
(0, import_core3.handleJSONOutput)(jsonOutput, outputPath, `
|
|
650
|
+
\u2713 JSON report saved to ${outputPath}`);
|
|
646
651
|
return;
|
|
647
652
|
}
|
|
648
653
|
if (options.output === "html") {
|
|
649
654
|
const html = generateHTMLReport(summary, results);
|
|
650
|
-
const outputPath =
|
|
655
|
+
const outputPath = (0, import_core3.resolveOutputPath)(
|
|
656
|
+
options.outputFile,
|
|
657
|
+
`context-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.html`,
|
|
658
|
+
directory
|
|
659
|
+
);
|
|
660
|
+
const dir = (0, import_path.dirname)(outputPath);
|
|
661
|
+
if (!(0, import_fs.existsSync)(dir)) {
|
|
662
|
+
(0, import_fs.mkdirSync)(dir, { recursive: true });
|
|
663
|
+
}
|
|
651
664
|
(0, import_fs.writeFileSync)(outputPath, html);
|
|
652
665
|
console.log(import_chalk.default.green(`
|
|
653
666
|
\u2713 HTML report saved to ${outputPath}`));
|
package/dist/cli.mjs
CHANGED
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
// src/cli.ts
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
import chalk from "chalk";
|
|
10
|
-
import { writeFileSync, existsSync, readFileSync } from "fs";
|
|
11
|
-
import { join } from "path";
|
|
12
|
-
import { loadMergedConfig, handleJSONOutput, handleCLIError, getElapsedTime } from "@aiready/core";
|
|
10
|
+
import { writeFileSync, existsSync, readFileSync, mkdirSync } from "fs";
|
|
11
|
+
import { join, dirname } from "path";
|
|
12
|
+
import { loadMergedConfig, handleJSONOutput, handleCLIError, getElapsedTime, resolveOutputPath } from "@aiready/core";
|
|
13
13
|
import prompts from "prompts";
|
|
14
14
|
var program = new Command();
|
|
15
15
|
program.name("aiready-context").description("Analyze AI context window cost and code structure").version("0.1.0").addHelpText("after", "\nCONFIGURATION:\n Supports config files: aiready.json, aiready.config.json, .aiready.json, .aireadyrc.json, aiready.config.js, .aireadyrc.js\n CLI options override config file settings").argument("<directory>", "Directory to analyze").option("--max-depth <number>", "Maximum acceptable import depth").option(
|
|
@@ -64,13 +64,26 @@ program.name("aiready-context").description("Analyze AI context window cost and
|
|
|
64
64
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
65
65
|
analysisTime: elapsedTime
|
|
66
66
|
};
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const outputPath = resolveOutputPath(
|
|
68
|
+
options.outputFile,
|
|
69
|
+
`context-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
|
|
70
|
+
directory
|
|
71
|
+
);
|
|
72
|
+
handleJSONOutput(jsonOutput, outputPath, `
|
|
73
|
+
\u2713 JSON report saved to ${outputPath}`);
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
71
76
|
if (options.output === "html") {
|
|
72
77
|
const html = generateHTMLReport(summary, results);
|
|
73
|
-
const outputPath =
|
|
78
|
+
const outputPath = resolveOutputPath(
|
|
79
|
+
options.outputFile,
|
|
80
|
+
`context-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.html`,
|
|
81
|
+
directory
|
|
82
|
+
);
|
|
83
|
+
const dir = dirname(outputPath);
|
|
84
|
+
if (!existsSync(dir)) {
|
|
85
|
+
mkdirSync(dir, { recursive: true });
|
|
86
|
+
}
|
|
74
87
|
writeFileSync(outputPath, html);
|
|
75
88
|
console.log(chalk.green(`
|
|
76
89
|
\u2713 HTML report saved to ${outputPath}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/context-analyzer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"commander": "^12.1.0",
|
|
51
51
|
"chalk": "^5.3.0",
|
|
52
52
|
"prompts": "^2.4.2",
|
|
53
|
-
"@aiready/core": "0.5.
|
|
53
|
+
"@aiready/core": "0.5.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^22.10.2",
|
package/src/cli.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import { analyzeContext, generateSummary } from './index';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
|
-
import { writeFileSync, existsSync, readFileSync } from 'fs';
|
|
7
|
-
import { join } from 'path';
|
|
8
|
-
import { loadMergedConfig, handleJSONOutput, handleCLIError, getElapsedTime } from '@aiready/core';
|
|
6
|
+
import { writeFileSync, existsSync, readFileSync, mkdirSync } from 'fs';
|
|
7
|
+
import { join, dirname } from 'path';
|
|
8
|
+
import { loadMergedConfig, handleJSONOutput, handleCLIError, getElapsedTime, resolveOutputPath } from '@aiready/core';
|
|
9
9
|
import prompts from 'prompts';
|
|
10
10
|
|
|
11
11
|
const program = new Command();
|
|
@@ -91,14 +91,29 @@ program
|
|
|
91
91
|
analysisTime: elapsedTime,
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
const outputPath = resolveOutputPath(
|
|
95
|
+
options.outputFile,
|
|
96
|
+
`context-report-${new Date().toISOString().split('T')[0]}.json`,
|
|
97
|
+
directory
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
handleJSONOutput(jsonOutput, outputPath, `\n✓ JSON report saved to ${outputPath}`);
|
|
95
101
|
return;
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
if (options.output === 'html') {
|
|
99
105
|
const html = generateHTMLReport(summary, results);
|
|
100
|
-
const outputPath =
|
|
101
|
-
options.outputFile
|
|
106
|
+
const outputPath = resolveOutputPath(
|
|
107
|
+
options.outputFile,
|
|
108
|
+
`context-report-${new Date().toISOString().split('T')[0]}.html`,
|
|
109
|
+
directory
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const dir = dirname(outputPath);
|
|
113
|
+
if (!existsSync(dir)) {
|
|
114
|
+
mkdirSync(dir, { recursive: true });
|
|
115
|
+
}
|
|
116
|
+
|
|
102
117
|
writeFileSync(outputPath, html);
|
|
103
118
|
console.log(chalk.green(`\n✓ HTML report saved to ${outputPath}`));
|
|
104
119
|
return;
|