@aiready/context-analyzer 0.9.22 → 0.9.25
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 +11 -11
- package/.turbo/turbo-test.log +24 -20
- package/README.md +51 -0
- package/dist/chunk-HOUDVRG2.mjs +1422 -0
- package/dist/chunk-MBE4AQP5.mjs +1362 -0
- package/dist/chunk-XZ645X5U.mjs +1425 -0
- package/dist/cli.js +184 -5
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +188 -5
- package/dist/index.mjs +5 -1
- package/package.json +1 -1
- package/src/__tests__/file-classification.test.ts +251 -0
- package/src/analyzer.ts +281 -0
- package/src/index.ts +52 -5
- package/src/types.ts +14 -0
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.23 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,18 +9,18 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mCJS[39m [1mdist/
|
|
13
|
-
[32mCJS[39m [1mdist/
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m55.45 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m67.03 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 162ms
|
|
15
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m18.53 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/chunk-MBE4AQP5.mjs [22m[32m47.02 KB[39m
|
|
15
17
|
[32mESM[39m [1mdist/python-context-UOPTQH44.mjs [22m[32m5.64 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/chunk-VTALAPQZ.mjs [22m[32m42.65 KB[39m
|
|
17
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m585.00 B[39m
|
|
18
18
|
[32mESM[39m [1mdist/chunk-Y6FXYEAI.mjs [22m[32m390.00 B[39m
|
|
19
|
-
[32mESM[39m [1mdist/
|
|
20
|
-
[32mESM[39m ⚡️ Build success in
|
|
19
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m697.00 B[39m
|
|
20
|
+
[32mESM[39m ⚡️ Build success in 162ms
|
|
21
21
|
DTS Build start
|
|
22
|
-
DTS ⚡️ Build success in
|
|
22
|
+
DTS ⚡️ Build success in 7868ms
|
|
23
23
|
DTS dist/cli.d.ts 20.00 B
|
|
24
|
-
DTS dist/index.d.ts
|
|
24
|
+
DTS dist/index.d.ts 7.37 KB
|
|
25
25
|
DTS dist/cli.d.mts 20.00 B
|
|
26
|
-
DTS dist/index.d.mts
|
|
26
|
+
DTS dist/index.d.mts 7.37 KB
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/context-analyzer@0.9.
|
|
3
|
+
> @aiready/context-analyzer@0.9.23 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
|
-
|
|
13
|
-
[32m✓[39m
|
|
14
|
-
[32m✓[39m
|
|
15
|
-
|
|
16
|
-
[32m✓[39m
|
|
17
|
-
[32m✓[39m src/__tests__/fragmentation-
|
|
18
|
-
[32m✓[39m dist/__tests__/
|
|
19
|
-
[32m✓[39m
|
|
20
|
-
|
|
21
|
-
[32m✓[39m
|
|
22
|
-
[32m✓[39m
|
|
9
|
+
[32m✓[39m dist/__tests__/scoring.test.js [2m([22m[2m7 tests[22m[2m)[22m[32m 27[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
11
|
+
[32m✓[39m src/__tests__/auto-detection.test.ts [2m([22m[2m8 tests[22m[2m)[22m[33m 612[2mms[22m[39m
|
|
12
|
+
[33m[2m✓[22m[39m should auto-detect domain keywords from folder paths [33m 315[2mms[22m[39m
|
|
13
|
+
[32m✓[39m src/__tests__/file-classification.test.ts [2m([22m[2m17 tests[22m[2m)[22m[32m 242[2mms[22m[39m
|
|
14
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m14 tests[22m[2m)[22m[33m 491[2mms[22m[39m
|
|
15
|
+
[33m[2m✓[22m[39m should build a basic dependency graph [33m 379[2mms[22m[39m
|
|
16
|
+
[32m✓[39m dist/__tests__/fragmentation-coupling.test.js [2m([22m[2m2 tests[22m[2m)[22m[32m 38[2mms[22m[39m
|
|
17
|
+
[32m✓[39m src/__tests__/fragmentation-coupling.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 271[2mms[22m[39m
|
|
18
|
+
[32m✓[39m dist/__tests__/fragmentation-log.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
19
|
+
[32m✓[39m dist/__tests__/analyzer.test.js [2m([22m[2m14 tests[22m[2m)[22m[33m 542[2mms[22m[39m
|
|
20
|
+
[33m[2m✓[22m[39m should calculate import depth correctly [33m 314[2mms[22m[39m
|
|
21
|
+
[32m✓[39m dist/__tests__/auto-detection.test.js [2m([22m[2m8 tests[22m[2m)[22m[33m 536[2mms[22m[39m
|
|
22
|
+
[32m✓[39m src/__tests__/fragmentation-advanced.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 111[2mms[22m[39m
|
|
23
|
+
[32m✓[39m dist/__tests__/enhanced-cohesion.test.js [2m([22m[2m6 tests[22m[2m)[22m[32m 24[2mms[22m[39m
|
|
23
24
|
[32m✓[39m dist/__tests__/structural-cohesion.test.js [2m([22m[2m4 tests[22m[2m)[22m[32m 1[2mms[22m[39m
|
|
24
|
-
[32m✓[39m src/__tests__/
|
|
25
|
+
[32m✓[39m src/__tests__/enhanced-cohesion.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 31[2mms[22m[39m
|
|
26
|
+
[32m✓[39m src/__tests__/fragmentation-log.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
27
|
+
[32m✓[39m src/__tests__/structural-cohesion.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 240[2mms[22m[39m
|
|
28
|
+
[32m✓[39m dist/__tests__/fragmentation-advanced.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
25
29
|
|
|
26
|
-
[2m Test Files [22m [1m[
|
|
27
|
-
[2m Tests [22m [1m[
|
|
28
|
-
[2m Start at [22m
|
|
29
|
-
[2m Duration [22m
|
|
30
|
+
[2m Test Files [22m [1m[32m17 passed[39m[22m[90m (17)[39m
|
|
31
|
+
[2m Tests [22m [1m[32m111 passed[39m[22m[90m (111)[39m
|
|
32
|
+
[2m Start at [22m 11:30:31
|
|
33
|
+
[2m Duration [22m 10.28s[2m (transform 3.68s, setup 0ms, import 60.43s, tests 3.19s, environment 12ms)[22m
|
|
30
34
|
|
|
31
35
|
[?25h
|
package/README.md
CHANGED
|
@@ -290,6 +290,57 @@ These signals are included in the JSON summary (`fragmentedModules` entries) so
|
|
|
290
290
|
|
|
291
291
|
---
|
|
292
292
|
|
|
293
|
+
### 🏷️ File Classification (Reducing False Positives)
|
|
294
|
+
|
|
295
|
+
**What it measures:** The tool now classifies files into categories to distinguish real issues from acceptable patterns:
|
|
296
|
+
|
|
297
|
+
| Classification | Description | Fragmentation Treatment |
|
|
298
|
+
|---------------|-------------|------------------------|
|
|
299
|
+
| **barrel-export** | Re-exports from other modules (index.ts) | 0% (expected behavior) |
|
|
300
|
+
| **type-definition** | Primarily type/interface definitions | 0% (centralized types are good) |
|
|
301
|
+
| **cohesive-module** | Single domain, high cohesion (≥70%) | 30% of original (large but focused is OK) |
|
|
302
|
+
| **mixed-concerns** | Multiple domains, low cohesion | 100% (real issue) |
|
|
303
|
+
| **unknown** | Doesn't fit other categories | 70% of original (benefit of doubt) |
|
|
304
|
+
|
|
305
|
+
**Why it matters:** Previous versions could flag files that were actually well-designed:
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
// ❌ Old behavior: Flagged as "high fragmentation (99%)"
|
|
309
|
+
// shared/src/index.ts - barrel export with 6 domains
|
|
310
|
+
export * from './user';
|
|
311
|
+
export * from './order';
|
|
312
|
+
export * from './product';
|
|
313
|
+
// ... more re-exports
|
|
314
|
+
|
|
315
|
+
// ✅ New behavior: Classified as "barrel-export"
|
|
316
|
+
// Fragmentation score: 0% (this is what barrel files DO)
|
|
317
|
+
// Recommendation: "Barrel export file detected - multiple domains are expected here"
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
// ❌ Old behavior: Flagged as "high fragmentation (98%)"
|
|
322
|
+
// gst-calculator/client.tsx - 346 lines, 7 dependencies, 1 domain
|
|
323
|
+
|
|
324
|
+
// ✅ New behavior: Classified as "cohesive-module"
|
|
325
|
+
// Fragmentation score: 29% (reduced from 98%)
|
|
326
|
+
// Recommendation: "Module has good cohesion despite its size"
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**🎯 Benefit:** Focus on real issues while accepting legitimate patterns.
|
|
330
|
+
|
|
331
|
+
**JSON Output includes classification:**
|
|
332
|
+
|
|
333
|
+
```json
|
|
334
|
+
{
|
|
335
|
+
"file": "src/index.ts",
|
|
336
|
+
"fileClassification": "barrel-export",
|
|
337
|
+
"fragmentationScore": 0,
|
|
338
|
+
"severity": "info"
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
293
344
|
### ⚖️ The Tradeoff: Splitting vs. Consolidating
|
|
294
345
|
|
|
295
346
|
**Important:** These metrics can pull in opposite directions!
|