@aiready/context-analyzer 0.9.35 → 0.9.38
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/.github/FUNDING.yml +2 -2
- package/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-lint.log +6 -0
- package/.turbo/turbo-test.log +23 -22
- package/CONTRIBUTING.md +10 -2
- package/dist/chunk-7LUSCLGR.mjs +2058 -0
- package/dist/chunk-EBXG2Q5Y.mjs +2059 -0
- package/dist/cli.js +351 -86
- package/dist/cli.mjs +137 -33
- package/dist/index.js +236 -59
- package/dist/index.mjs +1 -1
- package/dist/python-context-GOH747QU.mjs +202 -0
- package/dist/python-context-TBI5FVFY.mjs +203 -0
- package/package.json +2 -2
- package/src/__tests__/analyzer.test.ts +69 -17
- package/src/__tests__/auto-detection.test.ts +1 -1
- package/src/__tests__/enhanced-cohesion.test.ts +19 -7
- package/src/__tests__/file-classification.test.ts +189 -54
- package/src/__tests__/fragmentation-advanced.test.ts +2 -11
- package/src/__tests__/fragmentation-coupling.test.ts +8 -2
- package/src/__tests__/fragmentation-log.test.ts +9 -9
- package/src/__tests__/scoring.test.ts +19 -7
- package/src/__tests__/structural-cohesion.test.ts +33 -21
- package/src/analyzer.ts +727 -375
- package/src/analyzers/python-context.ts +34 -10
- package/src/cli.ts +223 -59
- package/src/index.ts +112 -55
- package/src/scoring.ts +53 -43
- package/src/semantic-analysis.ts +75 -56
- package/src/types.ts +12 -13
package/.github/FUNDING.yml
CHANGED
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/context-analyzer@0.9.
|
|
3
|
+
> @aiready/context-analyzer@0.9.38 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,16 +9,16 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m75.45 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m87.04 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 279ms
|
|
13
15
|
[32mESM[39m [1mdist/index.mjs [22m[32m666.00 B[39m
|
|
14
|
-
[32mESM[39m [1mdist/
|
|
15
|
-
[32mESM[39m [1mdist/
|
|
16
|
-
[32mESM[39m
|
|
17
|
-
[
|
|
18
|
-
[32mCJS[39m [1mdist/index.js [22m[32m74.12 KB[39m
|
|
19
|
-
[32mCJS[39m ⚡️ Build success in 1680ms
|
|
16
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m19.14 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/python-context-TBI5FVFY.mjs [22m[32m5.66 KB[39m
|
|
18
|
+
[32mESM[39m [1mdist/chunk-EBXG2Q5Y.mjs [22m[32m66.77 KB[39m
|
|
19
|
+
[32mESM[39m ⚡️ Build success in 280ms
|
|
20
20
|
DTS Build start
|
|
21
|
-
DTS ⚡️ Build success in
|
|
21
|
+
DTS ⚡️ Build success in 10724ms
|
|
22
22
|
DTS dist/cli.d.ts 20.00 B
|
|
23
23
|
DTS dist/index.d.ts 8.07 KB
|
|
24
24
|
DTS dist/cli.d.mts 20.00 B
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/context-analyzer@0.9.
|
|
3
|
+
> @aiready/context-analyzer@0.9.38 test /Users/pengcao/projects/aiready/packages/context-analyzer
|
|
4
4
|
> vitest run
|
|
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 dist/__tests__/scoring.test.js [2m([22m[2m7 tests[22m[2m)[22m[32m
|
|
10
|
-
[32m✓[39m src/__tests__/fragmentation-log.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
11
|
-
[32m✓[39m
|
|
12
|
-
[32m✓[39m src/__tests__/fragmentation-
|
|
13
|
-
[32m✓[39m src/__tests__/
|
|
14
|
-
|
|
15
|
-
[32m✓[39m dist/__tests__/analyzer.test.js [2m([22m[2m14 tests[22m[2m)[22m[33m
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
[32m✓[39m
|
|
19
|
-
|
|
20
|
-
[32m✓[39m dist/__tests__/fragmentation-
|
|
21
|
-
[32m✓[39m src/__tests__/
|
|
22
|
-
|
|
23
|
-
[32m✓[39m dist/__tests__/
|
|
24
|
-
[32m✓[39m dist/__tests__/
|
|
25
|
-
[32m✓[39m src/__tests__/
|
|
26
|
-
[32m✓[39m dist/__tests__/
|
|
27
|
-
[32m✓[39m
|
|
9
|
+
[32m✓[39m dist/__tests__/scoring.test.js [2m([22m[2m7 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/__tests__/fragmentation-log.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
11
|
+
[32m✓[39m src/__tests__/structural-cohesion.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
12
|
+
[32m✓[39m src/__tests__/fragmentation-coupling.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 60[2mms[22m[39m
|
|
13
|
+
[32m✓[39m src/__tests__/file-classification.test.ts [2m([22m[2m63 tests[22m[2m)[22m[32m 36[2mms[22m[39m
|
|
14
|
+
[32m✓[39m dist/__tests__/auto-detection.test.js [2m([22m[2m8 tests[22m[2m)[22m[32m 283[2mms[22m[39m
|
|
15
|
+
[32m✓[39m dist/__tests__/analyzer.test.js [2m([22m[2m14 tests[22m[2m)[22m[33m 520[2mms[22m[39m
|
|
16
|
+
[32m✓[39m src/__tests__/auto-detection.test.ts [2m([22m[2m8 tests[22m[2m)[22m[33m 418[2mms[22m[39m
|
|
17
|
+
[33m[2m✓[22m[39m should auto-detect domain keywords from folder paths [33m 367[2mms[22m[39m
|
|
18
|
+
[32m✓[39m dist/__tests__/fragmentation-coupling.test.js [2m([22m[2m2 tests[22m[2m)[22m[33m 499[2mms[22m[39m
|
|
19
|
+
[33m[2m✓[22m[39m does not apply discount when files have no shared imports [33m 475[2mms[22m[39m
|
|
20
|
+
[32m✓[39m dist/__tests__/fragmentation-advanced.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
21
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m14 tests[22m[2m)[22m[33m 760[2mms[22m[39m
|
|
22
|
+
[33m[2m✓[22m[39m should build a basic dependency graph [33m 427[2mms[22m[39m
|
|
23
|
+
[32m✓[39m dist/__tests__/structural-cohesion.test.js [2m([22m[2m4 tests[22m[2m)[22m[32m 96[2mms[22m[39m
|
|
24
|
+
[32m✓[39m dist/__tests__/fragmentation-log.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
25
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
26
|
+
[32m✓[39m dist/__tests__/enhanced-cohesion.test.js [2m([22m[2m6 tests[22m[2m)[22m[32m 38[2mms[22m[39m
|
|
27
|
+
[32m✓[39m src/__tests__/enhanced-cohesion.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 27[2mms[22m[39m
|
|
28
|
+
[32m✓[39m src/__tests__/fragmentation-advanced.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 54[2mms[22m[39m
|
|
28
29
|
|
|
29
30
|
[2m Test Files [22m [1m[32m17 passed[39m[22m[90m (17)[39m
|
|
30
31
|
[2m Tests [22m [1m[32m157 passed[39m[22m[90m (157)[39m
|
|
31
|
-
[2m Start at [22m
|
|
32
|
-
[2m Duration [22m
|
|
32
|
+
[2m Start at [22m 00:56:30
|
|
33
|
+
[2m Duration [22m 15.56s[2m (transform 16.50s, setup 0ms, import 90.61s, tests 2.83s, environment 29ms)[22m
|
|
33
34
|
|
|
34
35
|
[?25h
|
package/CONTRIBUTING.md
CHANGED
|
@@ -14,6 +14,7 @@ The Context Analyzer measures and optimizes **context window usage** - how much
|
|
|
14
14
|
## 🐛 Reporting Issues
|
|
15
15
|
|
|
16
16
|
Found a bug or have a feature request? [Open an issue](https://github.com/caopengau/aiready-context-analyzer/issues) with:
|
|
17
|
+
|
|
17
18
|
- Clear description of the problem or feature
|
|
18
19
|
- Sample code that demonstrates the issue
|
|
19
20
|
- Expected vs actual behavior
|
|
@@ -42,6 +43,7 @@ pnpm test
|
|
|
42
43
|
## 📝 Making Changes
|
|
43
44
|
|
|
44
45
|
1. **Fork the repository** and create a new branch:
|
|
46
|
+
|
|
45
47
|
```bash
|
|
46
48
|
git checkout -b fix/import-depth-calculation
|
|
47
49
|
# or
|
|
@@ -55,15 +57,17 @@ pnpm test
|
|
|
55
57
|
- Keep analysis logic modular and focused
|
|
56
58
|
|
|
57
59
|
3. **Test your changes**:
|
|
60
|
+
|
|
58
61
|
```bash
|
|
59
62
|
pnpm build
|
|
60
63
|
pnpm test
|
|
61
|
-
|
|
64
|
+
|
|
62
65
|
# Test on real codebases
|
|
63
66
|
./dist/cli.js /path/to/test-repo
|
|
64
67
|
```
|
|
65
68
|
|
|
66
69
|
4. **Commit using conventional commits**:
|
|
70
|
+
|
|
67
71
|
```bash
|
|
68
72
|
git commit -m "fix: accurate import depth calculation"
|
|
69
73
|
git commit -m "feat: add cohesion metric"
|
|
@@ -93,6 +97,7 @@ We use [Conventional Commits](https://www.conventionalcommits.org/):
|
|
|
93
97
|
- Verify output formats (console, JSON)
|
|
94
98
|
|
|
95
99
|
Example test:
|
|
100
|
+
|
|
96
101
|
```typescript
|
|
97
102
|
test('calculates import depth correctly', () => {
|
|
98
103
|
const result = analyzeFile('src/utils/helper.ts', [...files]);
|
|
@@ -121,9 +126,10 @@ src/
|
|
|
121
126
|
### Adding a New Metric
|
|
122
127
|
|
|
123
128
|
1. Create `src/metrics/your-metric.ts`:
|
|
129
|
+
|
|
124
130
|
```typescript
|
|
125
131
|
import type { FileAnalysis } from '../types';
|
|
126
|
-
|
|
132
|
+
|
|
127
133
|
export function calculateYourMetric(file: FileAnalysis): number {
|
|
128
134
|
// Your calculation logic
|
|
129
135
|
return metricValue;
|
|
@@ -143,6 +149,7 @@ src/
|
|
|
143
149
|
## 🎯 Areas for Contribution
|
|
144
150
|
|
|
145
151
|
Great places to start:
|
|
152
|
+
|
|
146
153
|
- **New metrics**: Add new context quality measurements
|
|
147
154
|
- **Better calculations**: Improve token estimation accuracy
|
|
148
155
|
- **Language support**: Add analysis for more file types
|
|
@@ -167,6 +174,7 @@ Great places to start:
|
|
|
167
174
|
## 💡 Feature Ideas
|
|
168
175
|
|
|
169
176
|
Looking for inspiration? Consider:
|
|
177
|
+
|
|
170
178
|
- Language-specific context costs (TypeScript vs Python)
|
|
171
179
|
- Framework-aware analysis (React hooks, Vue composables)
|
|
172
180
|
- Bundle size estimation
|