@aiready/context-analyzer 0.22.6 → 0.22.7
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 +32 -31
- package/.turbo/turbo-test.log +51 -49
- package/CONTRIBUTING.md +1 -1
- package/dist/index.js +10 -9
- package/dist/index.mjs +10 -9
- package/package.json +2 -2
- package/src/scoring.ts +9 -9
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
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
|
-
DTS
|
|
28
|
-
DTS
|
|
29
|
-
DTS dist/
|
|
30
|
-
DTS dist/
|
|
31
|
-
DTS dist/
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @aiready/context-analyzer@0.22.7 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
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m69.59 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m83.38 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 567ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m12.69 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/cli-action-VCXBZGZP.mjs [22m[32m2.86 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/summary-7PZVW72O.mjs [22m[32m119.00 B[39m
|
|
18
|
+
[32mESM[39m [1mdist/chunk-J3SZQZNU.mjs [22m[32m8.11 KB[39m
|
|
19
|
+
[32mESM[39m [1mdist/python-context-BWDC4E5Z.mjs [22m[32m4.48 KB[39m
|
|
20
|
+
[32mESM[39m [1mdist/chunk-M2EGQ36M.mjs [22m[32m41.00 KB[39m
|
|
21
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m1.81 KB[39m
|
|
22
|
+
[32mESM[39m [1mdist/chunk-EMYD7NS6.mjs [22m[32m4.91 KB[39m
|
|
23
|
+
[32mESM[39m [1mdist/chunk-64U3PNO3.mjs [22m[32m2.65 KB[39m
|
|
24
|
+
[32mESM[39m [1mdist/chunk-BQCISA2F.mjs [22m[32m3.35 KB[39m
|
|
25
|
+
[32mESM[39m [1mdist/orchestrator-KMAKMHTD.mjs [22m[32m190.00 B[39m
|
|
26
|
+
[32mESM[39m ⚡️ Build success in 568ms
|
|
27
|
+
DTS Build start
|
|
28
|
+
DTS ⚡️ Build success in 11173ms
|
|
29
|
+
DTS dist/cli.d.ts 20.00 B
|
|
30
|
+
DTS dist/index.d.ts 25.64 KB
|
|
31
|
+
DTS dist/cli.d.mts 20.00 B
|
|
32
|
+
DTS dist/index.d.mts 25.64 KB
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[32m✓[39m src/__tests__/report/console-report.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
10
|
-
[32m✓[39m src/__tests__/
|
|
11
|
-
[32m✓[39m src/__tests__/
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
at
|
|
17
|
-
at
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
[
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
at
|
|
24
|
-
at
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
[32m✓[39m src/__tests__/
|
|
28
|
-
[32m✓[39m src/__tests__/
|
|
29
|
-
[32m✓[39m src/__tests__/
|
|
30
|
-
[32m✓[39m src/__tests__/
|
|
31
|
-
[32m✓[39m src/__tests__/
|
|
32
|
-
[32m✓[39m src/__tests__/
|
|
33
|
-
[32m✓[39m src/__tests__/
|
|
34
|
-
[32m✓[39m src/__tests__/
|
|
35
|
-
[32m✓[39m src/__tests__/
|
|
36
|
-
[32m✓[39m src/__tests__/
|
|
37
|
-
[32m✓[39m src/__tests__/
|
|
38
|
-
[32m✓[39m src/__tests__/
|
|
39
|
-
[32m✓[39m src/__tests__/
|
|
40
|
-
[32m✓[39m src/__tests__/
|
|
41
|
-
[32m✓[39m src/__tests__/
|
|
42
|
-
[32m✓[39m src/__tests__/
|
|
43
|
-
[32m✓[39m src/__tests__/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[2m
|
|
47
|
-
[2m
|
|
48
|
-
[2m
|
|
49
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @aiready/context-analyzer@0.22.6 test /Users/pengcao/projects/aiready/packages/context-analyzer
|
|
4
|
+
> vitest run --exclude "**/dist/**"
|
|
5
|
+
|
|
6
|
+
[?25l
|
|
7
|
+
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/context-analyzer[39m
|
|
8
|
+
|
|
9
|
+
[32m✓[39m src/__tests__/report/console-report.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 62[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/__tests__/remediation.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
11
|
+
[32m✓[39m src/__tests__/report/html-report.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 114[2mms[22m[39m
|
|
12
|
+
[32m✓[39m src/__tests__/domain-inference.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m 14[2mms[22m[39m
|
|
13
|
+
[90mstderr[2m | src/__tests__/python-context.test.ts[2m > [22m[2mpython-context[2m > [22m[2manalyzePythonContext[2m > [22m[2mshould filter for Python files only
|
|
14
|
+
[22m[39mFailed to analyze src/file2.py: TypeError: Cannot read properties of undefined (reading 'split')
|
|
15
|
+
at Module.analyzePythonContext [90m(/Users/pengcao/projects/aiready/packages/context-analyzer/[39msrc/analyzers/python-context.ts:91:32[90m)[39m
|
|
16
|
+
[90m at processTicksAndRejections (node:internal/process/task_queues:104:5)[39m
|
|
17
|
+
at [90m/Users/pengcao/projects/aiready/packages/context-analyzer/[39msrc/__tests__/python-context.test.ts:63:23
|
|
18
|
+
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
|
|
19
|
+
|
|
20
|
+
[90mstderr[2m | src/__tests__/python-context.test.ts[2m > [22m[2mpython-context[2m > [22m[2manalyzePythonContext[2m > [22m[2mshould analyze Python files and return metrics
|
|
21
|
+
[22m[39mFailed to analyze src/test.py: TypeError: Cannot read properties of undefined (reading 'split')
|
|
22
|
+
at Module.analyzePythonContext [90m(/Users/pengcao/projects/aiready/packages/context-analyzer/[39msrc/analyzers/python-context.ts:91:32[90m)[39m
|
|
23
|
+
[90m at processTicksAndRejections (node:internal/process/task_queues:104:5)[39m
|
|
24
|
+
at [90m/Users/pengcao/projects/aiready/packages/context-analyzer/[39msrc/__tests__/python-context.test.ts:84:23
|
|
25
|
+
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
|
|
26
|
+
|
|
27
|
+
[32m✓[39m src/__tests__/python-context.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 55[2mms[22m[39m
|
|
28
|
+
[32m✓[39m src/__tests__/consolidation.test.ts [2m([22m[2m6 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 20[2mms[22m[39m
|
|
30
|
+
[32m✓[39m src/__tests__/boilerplate-barrel.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
31
|
+
[32m✓[39m src/__tests__/orchestrator.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 177[2mms[22m[39m
|
|
32
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 180[2mms[22m[39m
|
|
33
|
+
[32m✓[39m src/__tests__/contract.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
34
|
+
[32m✓[39m src/__tests__/auto-detection.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 186[2mms[22m[39m
|
|
35
|
+
[32m✓[39m src/__tests__/fragmentation-coupling.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 36[2mms[22m[39m
|
|
36
|
+
[32m✓[39m src/__tests__/file-classification.test.ts [2m([22m[2m63 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
37
|
+
[32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
38
|
+
[32m✓[39m src/__tests__/cluster-detector.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
39
|
+
[32m✓[39m src/__tests__/defaults.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
40
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
41
|
+
[32m✓[39m src/__tests__/fragmentation-advanced.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
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 15[2mms[22m[39m
|
|
44
|
+
[32m✓[39m src/__tests__/structural-cohesion.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
45
|
+
|
|
46
|
+
[2m Test Files [22m [1m[32m22 passed[39m[22m[90m (22)[39m
|
|
47
|
+
[2m Tests [22m [1m[32m224 passed[39m[22m[90m (224)[39m
|
|
48
|
+
[2m Start at [22m 22:04:25
|
|
49
|
+
[2m Duration [22m 8.27s[2m (transform 13.02s, setup 0ms, import 52.87s, tests 948ms, environment 34ms)[22m
|
|
50
|
+
|
|
51
|
+
[?25h
|
package/CONTRIBUTING.md
CHANGED
|
@@ -13,7 +13,7 @@ The Context Analyzer measures and optimizes **context window usage** - how much
|
|
|
13
13
|
|
|
14
14
|
## 🐛 Reporting Issues
|
|
15
15
|
|
|
16
|
-
Found a bug or have a feature request? [Open an issue](https://github.com/
|
|
16
|
+
Found a bug or have a feature request? [Open an issue](https://github.com/getaiready/aiready-context-analyzer/issues) with:
|
|
17
17
|
|
|
18
18
|
- Clear description of the problem or feature
|
|
19
19
|
- Sample code that demonstrates the issue
|
package/dist/index.js
CHANGED
|
@@ -1949,15 +1949,16 @@ var WEIGHT_DEPTH = 0.25;
|
|
|
1949
1949
|
var WEIGHT_FRAGMENTATION = 0.25;
|
|
1950
1950
|
function calculateContextScore(summary, costConfig) {
|
|
1951
1951
|
const {
|
|
1952
|
-
avgContextBudget,
|
|
1953
|
-
maxContextBudget,
|
|
1954
|
-
avgImportDepth,
|
|
1955
|
-
maxImportDepth,
|
|
1956
|
-
avgFragmentation,
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1952
|
+
avgContextBudget = 0,
|
|
1953
|
+
maxContextBudget = 0,
|
|
1954
|
+
avgImportDepth = 0,
|
|
1955
|
+
maxImportDepth = 0,
|
|
1956
|
+
avgFragmentation = 0.5,
|
|
1957
|
+
// neutral
|
|
1958
|
+
criticalIssues = 0,
|
|
1959
|
+
majorIssues = 0,
|
|
1960
|
+
totalFiles = 0
|
|
1961
|
+
} = summary || {};
|
|
1961
1962
|
const budgetScore = avgContextBudget < BUDGET_EXCELLENT_THRESHOLD ? 100 : Math.max(
|
|
1962
1963
|
0,
|
|
1963
1964
|
100 - (avgContextBudget - BUDGET_EXCELLENT_THRESHOLD) / BUDGET_PENALTY_RATE
|
package/dist/index.mjs
CHANGED
|
@@ -100,15 +100,16 @@ var WEIGHT_DEPTH = 0.25;
|
|
|
100
100
|
var WEIGHT_FRAGMENTATION = 0.25;
|
|
101
101
|
function calculateContextScore(summary, costConfig) {
|
|
102
102
|
const {
|
|
103
|
-
avgContextBudget,
|
|
104
|
-
maxContextBudget,
|
|
105
|
-
avgImportDepth,
|
|
106
|
-
maxImportDepth,
|
|
107
|
-
avgFragmentation,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
avgContextBudget = 0,
|
|
104
|
+
maxContextBudget = 0,
|
|
105
|
+
avgImportDepth = 0,
|
|
106
|
+
maxImportDepth = 0,
|
|
107
|
+
avgFragmentation = 0.5,
|
|
108
|
+
// neutral
|
|
109
|
+
criticalIssues = 0,
|
|
110
|
+
majorIssues = 0,
|
|
111
|
+
totalFiles = 0
|
|
112
|
+
} = summary || {};
|
|
112
113
|
const budgetScore = avgContextBudget < BUDGET_EXCELLENT_THRESHOLD ? 100 : Math.max(
|
|
113
114
|
0,
|
|
114
115
|
100 - (avgContextBudget - BUDGET_EXCELLENT_THRESHOLD) / BUDGET_PENALTY_RATE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/context-analyzer",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.7",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
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.7"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^24.0.0",
|
package/src/scoring.ts
CHANGED
|
@@ -49,15 +49,15 @@ export function calculateContextScore(
|
|
|
49
49
|
costConfig?: Partial<CostConfig>
|
|
50
50
|
): ToolScoringOutput {
|
|
51
51
|
const {
|
|
52
|
-
avgContextBudget,
|
|
53
|
-
maxContextBudget,
|
|
54
|
-
avgImportDepth,
|
|
55
|
-
maxImportDepth,
|
|
56
|
-
avgFragmentation,
|
|
57
|
-
criticalIssues,
|
|
58
|
-
majorIssues,
|
|
59
|
-
totalFiles,
|
|
60
|
-
} = summary;
|
|
52
|
+
avgContextBudget = 0,
|
|
53
|
+
maxContextBudget = 0,
|
|
54
|
+
avgImportDepth = 0,
|
|
55
|
+
maxImportDepth = 0,
|
|
56
|
+
avgFragmentation = 0.5, // neutral
|
|
57
|
+
criticalIssues = 0,
|
|
58
|
+
majorIssues = 0,
|
|
59
|
+
totalFiles = 0,
|
|
60
|
+
} = summary || {};
|
|
61
61
|
|
|
62
62
|
// More reasonable thresholds for modern codebases
|
|
63
63
|
const budgetScore =
|