@aiready/context-analyzer 0.4.6 → 0.5.0

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.4.6 build /Users/pengcao/projects/aiready/packages/context-analyzer
3
+ > @aiready/context-analyzer@0.5.0 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
@@ -11,13 +11,13 @@
11
11
  ESM Build start
12
12
  CJS dist/cli.js 39.27 KB
13
13
  CJS dist/index.js 20.62 KB
14
- CJS ⚡️ Build success in 55ms
14
+ CJS ⚡️ Build success in 42ms
15
+ ESM dist/cli.mjs 18.45 KB
15
16
  ESM dist/index.mjs 164.00 B
16
17
  ESM dist/chunk-NJUW6VED.mjs 19.48 KB
17
- ESM dist/cli.mjs 18.45 KB
18
- ESM ⚡️ Build success in 55ms
18
+ ESM ⚡️ Build success in 42ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 703ms
20
+ DTS ⚡️ Build success in 551ms
21
21
  DTS dist/cli.d.ts 20.00 B
22
22
  DTS dist/index.d.ts 2.44 KB
23
23
  DTS dist/cli.d.mts 20.00 B
@@ -1,12 +1,33 @@
1
1
 
2
2
  
3
- > @aiready/context-analyzer@0.4.6 test /Users/pengcao/projects/aiready/packages/context-analyzer
3
+ > @aiready/context-analyzer@0.5.0 test /Users/pengcao/projects/aiready/packages/context-analyzer
4
4
  > vitest run
5
5
 
6
6
 
7
7
   RUN  v2.1.9 /Users/pengcao/projects/aiready/packages/context-analyzer
8
8
 
9
- ✓ src/__tests__/analyzer.test.ts (13)
9
+ [?25l · src/__tests__/analyzer.test.ts (13)
10
+ · buildDependencyGraph (1)
11
+ · should build a basic dependency graph
12
+ · calculateImportDepth (2)
13
+ · should calculate import depth correctly
14
+ · should handle circular dependencies gracefully
15
+ · getTransitiveDependencies (1)
16
+ · should get all transitive dependencies
17
+ · calculateContextBudget (1)
18
+ · should calculate total token cost including dependencies
19
+ · detectCircularDependencies (2)
20
+ · should detect circular dependencies
21
+ · should return empty for no circular dependencies
22
+ · calculateCohesion (3)
23
+ · should return 1 for single export
24
+ · should return high cohesion for related exports
25
+ · should return low cohesion for mixed exports
26
+ · calculateFragmentation (3)
27
+ · should return 0 for single file
28
+ · should return 0 for files in same directory
29
+ · should return high fragmentation for scattered files
30
+ [?25l ✓ src/__tests__/analyzer.test.ts (13)
10
31
  ✓ buildDependencyGraph (1)
11
32
  ✓ should build a basic dependency graph
12
33
  ✓ calculateImportDepth (2)
@@ -30,7 +51,7 @@
30
51
 
31
52
   Test Files  1 passed (1)
32
53
   Tests  13 passed (13)
33
-  Start at  07:25:31
34
-  Duration  318ms (transform 56ms, setup 0ms, collect 64ms, tests 3ms, environment 0ms, prepare 40ms)
54
+  Start at  07:46:59
55
+  Duration  394ms (transform 66ms, setup 0ms, collect 75ms, tests 41ms, environment 0ms, prepare 42ms)
35
56
 
36
- [?25h
57
+ [?25h[?25h
package/README.md CHANGED
@@ -67,6 +67,9 @@ npx @aiready/context-analyzer ./src
67
67
  # Basic usage
68
68
  aiready-context ./src
69
69
 
70
+ # Show more results in console (default: 10)
71
+ aiready-context ./src --max-results 25
72
+
70
73
  # Focus on specific concerns
71
74
  aiready-context ./src --focus fragmentation
72
75
  aiready-context ./src --focus cohesion
@@ -75,7 +78,7 @@ aiready-context ./src --focus depth
75
78
  # Set thresholds
76
79
  aiready-context ./src --max-depth 5 --max-context 10000 --min-cohesion 0.6
77
80
 
78
- # Export to JSON (saved to .aiready/ by default)
81
+ # Export to JSON for full details (saved to .aiready/ by default)
79
82
  aiready-context ./src --output json
80
83
 
81
84
  # Or specify custom path
@@ -88,6 +91,8 @@ aiready-context ./src --output json --output-file custom-report.json
88
91
 
89
92
  **Smart defaults automatically adjust based on your repository size** to show ~10 most serious issues.
90
93
 
94
+ > **💡 Tip:** By default, console output shows the top 10 results per category. Use `--max-results <number>` to see more, or use `--output json` to get complete details of all issues.
95
+
91
96
  ### Getting More/Fewer Results
92
97
 
93
98
  **Want to catch MORE potential issues?** (More sensitive, shows smaller problems)
@@ -132,9 +137,47 @@ aiready-context ./src --max-depth 5 --max-context 15000
132
137
  aiready-context ./src --max-depth 8 --max-context 25000 --min-cohesion 0.3
133
138
  ```
134
139
 
140
+ ## 📤 Output Options
141
+
142
+ ### Console Output (Default)
143
+
144
+ Shows a summary with top 10 results per category:
145
+
146
+ ```bash
147
+ # Default - shows top 10 items
148
+ aiready-context ./src
149
+
150
+ # Show more items (e.g., top 25)
151
+ aiready-context ./src --max-results 25
152
+
153
+ # Show all items (use a large number)
154
+ aiready-context ./src --max-results 999
155
+ ```
156
+
157
+ ### JSON Output
158
+
159
+ Get complete details of **all** issues (not limited to 10):
160
+
161
+ ```bash
162
+ # Generate JSON with all issues
163
+ aiready-context ./src --output json
164
+
165
+ # Custom output path
166
+ aiready-context ./src --output json --output-file reports/analysis.json
167
+ ```
168
+
169
+ ### HTML Report
170
+
171
+ Visual report with charts and detailed breakdown:
172
+
173
+ ```bash
135
174
  # Generate HTML report
136
175
  aiready-context ./src --output html --output-file report.html
176
+ ```
177
+
178
+ ### Include/Exclude Patterns
137
179
 
180
+ ```bash
138
181
  # Include/exclude patterns
139
182
  aiready-context ./src --exclude "**/test/**,**/*.test.ts"
140
183
  ```
@@ -154,12 +197,29 @@ Create an `aiready.json` or `aiready.config.json` file in your project root:
154
197
  "maxDepth": 4,
155
198
  "maxContextBudget": 8000,
156
199
  "minCohesion": 0.7,
157
- "includeNodeModules": false
200
+ "maxFragmentation": 0.6,
201
+ "focus": "all",
202
+ "maxResults": 10
158
203
  }
204
+ },
205
+ "output": {
206
+ "format": "console"
159
207
  }
160
208
  }
161
209
  ```
162
210
 
211
+ **Configuration Options:**
212
+
213
+ | Option | Type | Default | Description |
214
+ |--------|------|---------|-------------|
215
+ | `maxDepth` | number | `5` | Max acceptable import depth |
216
+ | `maxContextBudget` | number | `10000` | Max acceptable token budget |
217
+ | `minCohesion` | number | `0.6` | Min acceptable cohesion score (0-1) |
218
+ | `maxFragmentation` | number | `0.5` | Max acceptable fragmentation (0-1) |
219
+ | `focus` | string | `'all'` | Focus: `'fragmentation'`, `'cohesion'`, `'depth'`, `'all'` |
220
+ | `maxResults` | number | `10` | Max results per category in console |
221
+ | `includeNodeModules` | boolean | `false` | Include node_modules in analysis |
222
+
163
223
  ### Sample Output
164
224
 
165
225
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/context-analyzer",
3
- "version": "0.4.6",
3
+ "version": "0.5.0",
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",