@aiready/context-analyzer 0.9.34 → 0.9.36
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-test.log +19 -19
- package/CONTRIBUTING.md +10 -2
- package/dist/chunk-7LUSCLGR.mjs +2058 -0
- package/dist/cli.js +346 -83
- package/dist/cli.mjs +137 -33
- package/dist/index.js +231 -56
- package/dist/index.mjs +1 -1
- package/dist/python-context-GOH747QU.mjs +202 -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 +188 -53
- 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 +724 -376
- package/src/analyzers/python-context.ts +33 -10
- package/src/cli.ts +223 -59
- package/src/index.ts +112 -55
- package/src/scoring.ts +53 -43
- package/src/semantic-analysis.ts +73 -55
- 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.36 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
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m86.96 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m75.38 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 118ms
|
|
15
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m19.14 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/chunk-7LUSCLGR.mjs [22m[32m66.72 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/python-context-GOH747QU.mjs [22m[32m5.64 KB[39m
|
|
12
18
|
[32mESM[39m [1mdist/index.mjs [22m[32m666.00 B[39m
|
|
13
|
-
[32mESM[39m
|
|
14
|
-
[32mESM[39m [1mdist/python-context-PAETRLDY.mjs [22m[32m5.48 KB[39m
|
|
15
|
-
[32mESM[39m [1mdist/chunk-EVX2W2BK.mjs [22m[32m65.61 KB[39m
|
|
16
|
-
[32mESM[39m ⚡️ Build success in 234ms
|
|
17
|
-
[32mCJS[39m [1mdist/index.js [22m[32m74.12 KB[39m
|
|
18
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m85.15 KB[39m
|
|
19
|
-
[32mCJS[39m ⚡️ Build success in 235ms
|
|
19
|
+
[32mESM[39m ⚡️ Build success in 118ms
|
|
20
20
|
DTS Build start
|
|
21
|
-
DTS ⚡️ Build success in
|
|
21
|
+
DTS ⚡️ Build success in 3938ms
|
|
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,32 +1,32 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/context-analyzer@0.9.
|
|
3
|
+
> @aiready/context-analyzer@0.9.36 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
|
|
10
|
-
[32m✓[39m
|
|
11
|
-
[32m✓[39m src/__tests__/
|
|
12
|
-
[32m✓[39m dist/__tests__/
|
|
13
|
-
[32m✓[39m src/__tests__/
|
|
14
|
-
[32m✓[39m src/__tests__/
|
|
15
|
-
[32m✓[39m
|
|
16
|
-
[32m✓[39m
|
|
17
|
-
[32m✓[39m
|
|
18
|
-
[32m✓[39m
|
|
19
|
-
[32m✓[39m
|
|
20
|
-
[32m✓[39m dist/__tests__/scoring.test.js [2m([22m[2m7 tests[22m[2m)[22m[32m
|
|
21
|
-
[32m✓[39m
|
|
22
|
-
[32m✓[39m src/__tests__/structural-cohesion.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
23
|
-
[32m✓[39m src/__tests__/fragmentation-log.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
24
|
-
[32m✓[39m dist/__tests__/fragmentation-advanced.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/__tests__/fragmentation-coupling.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/__tests__/structural-cohesion.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
11
|
+
[32m✓[39m src/__tests__/enhanced-cohesion.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
12
|
+
[32m✓[39m dist/__tests__/fragmentation-advanced.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
13
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
14
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 250[2mms[22m[39m
|
|
15
|
+
[32m✓[39m dist/__tests__/auto-detection.test.js [2m([22m[2m8 tests[22m[2m)[22m[32m 65[2mms[22m[39m
|
|
16
|
+
[32m✓[39m src/__tests__/file-classification.test.ts [2m([22m[2m63 tests[22m[2m)[22m[32m 52[2mms[22m[39m
|
|
17
|
+
[32m✓[39m src/__tests__/auto-detection.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 71[2mms[22m[39m
|
|
18
|
+
[32m✓[39m dist/__tests__/analyzer.test.js [2m([22m[2m14 tests[22m[2m)[22m[32m 250[2mms[22m[39m
|
|
19
|
+
[32m✓[39m dist/__tests__/fragmentation-coupling.test.js [2m([22m[2m2 tests[22m[2m)[22m[32m 172[2mms[22m[39m
|
|
20
|
+
[32m✓[39m dist/__tests__/scoring.test.js [2m([22m[2m7 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
21
|
+
[32m✓[39m dist/__tests__/structural-cohesion.test.js [2m([22m[2m4 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
25
22
|
[32m✓[39m dist/__tests__/fragmentation-log.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
23
|
+
[32m✓[39m src/__tests__/fragmentation-advanced.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
24
|
+
[32m✓[39m dist/__tests__/enhanced-cohesion.test.js [2m([22m[2m6 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
25
|
+
[32m✓[39m src/__tests__/fragmentation-log.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
26
26
|
|
|
27
27
|
[2m Test Files [22m [1m[32m17 passed[39m[22m[90m (17)[39m
|
|
28
28
|
[2m Tests [22m [1m[32m157 passed[39m[22m[90m (157)[39m
|
|
29
|
-
[2m Start at [22m
|
|
30
|
-
[2m Duration [22m
|
|
29
|
+
[2m Start at [22m 22:19:18
|
|
30
|
+
[2m Duration [22m 2.50s[2m (transform 2.90s, setup 0ms, import 16.52s, tests 914ms, environment 1ms)[22m
|
|
31
31
|
|
|
32
32
|
[?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
|