@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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @aiready/context-analyzer@0.9.22 build /Users/pengcao/projects/aiready/packages/context-analyzer
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
  CLI Building entry: src/cli.ts, src/index.ts
@@ -9,18 +9,18 @@
9
9
  CLI Target: es2020
10
10
  CJS Build start
11
11
  ESM Build start
12
- CJS dist/cli.js 62.68 KB
13
- CJS dist/index.js 50.93 KB
14
- CJS ⚡️ Build success in 36ms
12
+ CJS dist/index.js 55.45 KB
13
+ CJS dist/cli.js 67.03 KB
14
+ CJS ⚡️ Build success in 162ms
15
+ ESM dist/cli.mjs 18.53 KB
16
+ ESM dist/chunk-MBE4AQP5.mjs 47.02 KB
15
17
  ESM dist/python-context-UOPTQH44.mjs 5.64 KB
16
- ESM dist/chunk-VTALAPQZ.mjs 42.65 KB
17
- ESM dist/index.mjs 585.00 B
18
18
  ESM dist/chunk-Y6FXYEAI.mjs 390.00 B
19
- ESM dist/cli.mjs 18.53 KB
20
- ESM ⚡️ Build success in 37ms
19
+ ESM dist/index.mjs 697.00 B
20
+ ESM ⚡️ Build success in 162ms
21
21
  DTS Build start
22
- DTS ⚡️ Build success in 1637ms
22
+ DTS ⚡️ Build success in 7868ms
23
23
  DTS dist/cli.d.ts 20.00 B
24
- DTS dist/index.d.ts 6.03 KB
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 6.03 KB
26
+ DTS dist/index.d.mts 7.37 KB
@@ -1,31 +1,35 @@
1
1
 
2
2
  
3
- > @aiready/context-analyzer@0.9.22 test /Users/pengcao/projects/aiready/packages/context-analyzer
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
   RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/context-analyzer
8
8
 
9
- ✓ src/__tests__/scoring.test.ts (7 tests) 4ms
10
- ✓ dist/__tests__/scoring.test.js (7 tests) 2ms
11
- ✓ src/__tests__/analyzer.test.ts (14 tests) 17ms
12
- ✓ dist/__tests__/enhanced-cohesion.test.js (6 tests) 2ms
13
- ✓ dist/__tests__/fragmentation-advanced.test.js (3 tests) 14ms
14
- ✓ dist/__tests__/fragmentation-coupling.test.js (2 tests) 130ms
15
- ✓ dist/__tests__/auto-detection.test.js (8 tests) 230ms
16
- ✓ src/__tests__/fragmentation-coupling.test.ts (2 tests) 69ms
17
- ✓ src/__tests__/fragmentation-advanced.test.ts (3 tests) 4ms
18
- ✓ dist/__tests__/analyzer.test.js (14 tests) 191ms
19
- ✓ src/__tests__/structural-cohesion.test.ts (4 tests) 2ms
20
- ✓ src/__tests__/auto-detection.test.ts (8 tests) 30ms
21
- ✓ src/__tests__/enhanced-cohesion.test.ts (6 tests) 4ms
22
- ✓ dist/__tests__/fragmentation-log.test.js (3 tests) 3ms
9
+ ✓ dist/__tests__/scoring.test.js (7 tests) 27ms
10
+ ✓ src/__tests__/scoring.test.ts (7 tests) 11ms
11
+ ✓ src/__tests__/auto-detection.test.ts (8 tests) 612ms
12
+ ✓ should auto-detect domain keywords from folder paths  315ms
13
+ ✓ src/__tests__/file-classification.test.ts (17 tests) 242ms
14
+ ✓ src/__tests__/analyzer.test.ts (14 tests) 491ms
15
+ ✓ should build a basic dependency graph  379ms
16
+ ✓ dist/__tests__/fragmentation-coupling.test.js (2 tests) 38ms
17
+ ✓ src/__tests__/fragmentation-coupling.test.ts (2 tests) 271ms
18
+ ✓ dist/__tests__/fragmentation-log.test.js (3 tests) 6ms
19
+ ✓ dist/__tests__/analyzer.test.js (14 tests) 542ms
20
+ ✓ should calculate import depth correctly  314ms
21
+ ✓ dist/__tests__/auto-detection.test.js (8 tests) 536ms
22
+ ✓ src/__tests__/fragmentation-advanced.test.ts (3 tests) 111ms
23
+ ✓ dist/__tests__/enhanced-cohesion.test.js (6 tests) 24ms
23
24
  ✓ dist/__tests__/structural-cohesion.test.js (4 tests) 1ms
24
- ✓ src/__tests__/fragmentation-log.test.ts (3 tests) 1ms
25
+ ✓ src/__tests__/enhanced-cohesion.test.ts (6 tests) 31ms
26
+ ✓ src/__tests__/fragmentation-log.test.ts (3 tests) 4ms
27
+ ✓ src/__tests__/structural-cohesion.test.ts (4 tests) 240ms
28
+ ✓ dist/__tests__/fragmentation-advanced.test.js (3 tests) 6ms
25
29
 
26
-  Test Files  16 passed (16)
27
-  Tests  94 passed (94)
28
-  Start at  00:46:20
29
-  Duration  2.34s (transform 4.67s, setup 0ms, import 14.26s, tests 706ms, environment 2ms)
30
+  Test Files  17 passed (17)
31
+  Tests  111 passed (111)
32
+  Start at  11:30:31
33
+  Duration  10.28s (transform 3.68s, setup 0ms, import 60.43s, tests 3.19s, environment 12ms)
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!