@aiready/cli 0.9.47 → 0.10.2

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.
Files changed (55) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-test.log +6 -7
  3. package/dist/{chunk-6FOVC2OE.mjs → chunk-EQ2HQSTJ.mjs} +83 -61
  4. package/dist/{chunk-MEXEG3IJ.mjs → chunk-VUCNUYI7.mjs} +90 -62
  5. package/dist/cli.js +105 -75
  6. package/dist/cli.mjs +30 -25
  7. package/dist/index.js +86 -61
  8. package/dist/index.mjs +1 -1
  9. package/package.json +12 -12
  10. package/src/.aiready/aiready-report-20260305-153847.json +8015 -0
  11. package/src/.aiready/aiready-report-20260305-154121.json +8015 -0
  12. package/src/.aiready/aiready-report-20260305-160026.json +8015 -0
  13. package/src/.aiready/aiready-report-20260305-160752.json +8015 -0
  14. package/src/.aiready/aiready-report-20260305-163858.json +8015 -0
  15. package/src/.aiready/aiready-report-20260305-171001.json +8317 -0
  16. package/src/.aiready/aiready-report-20260305-201337.json +8317 -0
  17. package/src/__tests__/cli.test.ts +6 -6
  18. package/src/commands/scan.ts +27 -22
  19. package/src/commands/visualize.ts +3 -3
  20. package/src/index.ts +109 -90
  21. package/dist/__tests__/cli.test.d.ts +0 -2
  22. package/dist/__tests__/cli.test.d.ts.map +0 -1
  23. package/dist/__tests__/cli.test.js +0 -52
  24. package/dist/__tests__/cli.test.js.map +0 -1
  25. package/dist/agent-grounding-DAOSU4MF.mjs +0 -7
  26. package/dist/chunk-2LXCBVPN.mjs +0 -109
  27. package/dist/chunk-3SG2GLFJ.mjs +0 -118
  28. package/dist/chunk-5GZDRZ3T.mjs +0 -126
  29. package/dist/chunk-DEZVFBPS.mjs +0 -111
  30. package/dist/chunk-G6SDH7ZS.mjs +0 -126
  31. package/dist/chunk-HLBKROD3.mjs +0 -237
  32. package/dist/chunk-JQG7ZATX.mjs +0 -211
  33. package/dist/chunk-LLJMKNBI.mjs +0 -243
  34. package/dist/chunk-M7O2MEM5.mjs +0 -211
  35. package/dist/chunk-N4SLON5K.mjs +0 -152
  36. package/dist/chunk-OVELUOM6.mjs +0 -112
  37. package/dist/chunk-P3XAXCTK.mjs +0 -110
  38. package/dist/chunk-PDOONNSK.mjs +0 -228
  39. package/dist/chunk-QXQP6BMO.mjs +0 -109
  40. package/dist/chunk-RBWLQRKR.mjs +0 -39
  41. package/dist/chunk-XAF2EW5H.mjs +0 -46
  42. package/dist/chunk-Y6FXYEAI.mjs +0 -10
  43. package/dist/chunk-YIS6WTY5.mjs +0 -35
  44. package/dist/cli.d.mts +0 -1
  45. package/dist/cli.d.ts +0 -3
  46. package/dist/cli.d.ts.map +0 -1
  47. package/dist/cli.js.map +0 -1
  48. package/dist/deps-health-UWVYJ7FZ.mjs +0 -47
  49. package/dist/doc-drift-G7MGAZAE.mjs +0 -47
  50. package/dist/hallucination-risk-XU6E7IGN.mjs +0 -7
  51. package/dist/index.d.mts +0 -33
  52. package/dist/index.d.ts +0 -32
  53. package/dist/index.d.ts.map +0 -1
  54. package/dist/index.js.map +0 -1
  55. package/dist/testability-VDZJZ4MF.mjs +0 -7
@@ -30,8 +30,8 @@ describe('CLI Unified Analysis', () => {
30
30
  tools: ['patterns', 'context'],
31
31
  });
32
32
 
33
- expect(results).toHaveProperty('patterns');
34
- expect(results).toHaveProperty('context');
33
+ expect(results).toHaveProperty('patternDetect');
34
+ expect(results).toHaveProperty('contextAnalyzer');
35
35
  expect(results).toHaveProperty('summary');
36
36
  });
37
37
 
@@ -41,8 +41,8 @@ describe('CLI Unified Analysis', () => {
41
41
  tools: ['patterns'],
42
42
  });
43
43
 
44
- expect(results).toHaveProperty('patterns');
45
- expect(results).not.toHaveProperty('context');
44
+ expect(results).toHaveProperty('patternDetect');
45
+ expect(results).not.toHaveProperty('contextAnalyzer');
46
46
  expect(results).toHaveProperty('summary');
47
47
  });
48
48
 
@@ -52,8 +52,8 @@ describe('CLI Unified Analysis', () => {
52
52
  tools: ['context'],
53
53
  });
54
54
 
55
- expect(results).not.toHaveProperty('patterns');
56
- expect(results).toHaveProperty('context');
55
+ expect(results).not.toHaveProperty('patternDetect');
56
+ expect(results).toHaveProperty('contextAnalyzer');
57
57
  expect(results).toHaveProperty('summary');
58
58
  });
59
59
  });
@@ -69,12 +69,12 @@ export async function scanAction(directory: string, options: ScanOptions) {
69
69
  'patterns',
70
70
  'context',
71
71
  'consistency',
72
- 'aiSignalClarity',
73
- 'grounding',
72
+ 'ai-signal-clarity',
73
+ 'agent-grounding',
74
74
  'testability',
75
75
  'doc-drift',
76
76
  'deps-health',
77
- 'changeAmplification',
77
+ 'change-amplification',
78
78
  ],
79
79
  include: undefined,
80
80
  exclude: undefined,
@@ -95,7 +95,11 @@ export async function scanAction(directory: string, options: ScanOptions) {
95
95
  if (options.profile) {
96
96
  switch (options.profile.toLowerCase()) {
97
97
  case 'agentic':
98
- profileTools = ['aiSignalClarity', 'grounding', 'testability'];
98
+ profileTools = [
99
+ 'ai-signal-clarity',
100
+ 'agent-grounding',
101
+ 'testability',
102
+ ];
99
103
  break;
100
104
  case 'cost':
101
105
  profileTools = ['patterns', 'context'];
@@ -104,7 +108,7 @@ export async function scanAction(directory: string, options: ScanOptions) {
104
108
  profileTools = ['consistency', 'testability'];
105
109
  break;
106
110
  case 'onboarding':
107
- profileTools = ['context', 'consistency', 'grounding'];
111
+ profileTools = ['context', 'consistency', 'agent-grounding'];
108
112
  break;
109
113
  default:
110
114
  console.log(
@@ -463,21 +467,22 @@ export async function scanAction(directory: string, options: ScanOptions) {
463
467
  console.log(
464
468
  ` Total issues (all tools): ${chalk.bold(String(results.summary.totalIssues || 0))}`
465
469
  );
466
- if (results.duplicates)
470
+ if (results.patternDetect) {
467
471
  console.log(
468
- ` Duplicate patterns found: ${chalk.bold(String(results.duplicates.length || 0))}`
472
+ ` Duplicate patterns found: ${chalk.bold(String(results.patternDetect.duplicates?.length || 0))}`
469
473
  );
470
- if (results.patterns)
471
474
  console.log(
472
- ` Pattern files with issues: ${chalk.bold(String(results.patterns.length || 0))}`
475
+ ` Pattern files with issues: ${chalk.bold(String(results.patternDetect.results.length || 0))}`
473
476
  );
474
- if (results.context)
477
+ }
478
+ if (results.contextAnalyzer)
475
479
  console.log(
476
- ` Context issues: ${chalk.bold(String(results.context.length || 0))}`
480
+ ` Context issues: ${chalk.bold(String(results.contextAnalyzer.results.length || 0))}`
481
+ );
482
+ if (results.consistency)
483
+ console.log(
484
+ ` Consistency issues: ${chalk.bold(String(results.consistency.summary?.totalIssues || 0))}`
477
485
  );
478
- console.log(
479
- ` Consistency issues: ${chalk.bold(String(results.consistency?.summary?.totalIssues || 0))}`
480
- );
481
486
  if (results.changeAmplification)
482
487
  console.log(
483
488
  ` Change amplification: ${chalk.bold(String(results.changeAmplification.summary?.score || 0))}/100`
@@ -750,9 +755,9 @@ export async function scanAction(directory: string, options: ScanOptions) {
750
755
  }
751
756
 
752
757
  // Output annotations for critical issues
753
- if (results.patterns) {
754
- const criticalPatterns = results.patterns.flatMap((p: any) =>
755
- p.issues.filter((i: any) => i.severity === 'critical')
758
+ if (results.patternDetect) {
759
+ const criticalPatterns = results.patternDetect.results.flatMap(
760
+ (p: any) => p.issues.filter((i: any) => i.severity === 'critical')
756
761
  );
757
762
  criticalPatterns.slice(0, 10).forEach((issue: any) => {
758
763
  console.log(
@@ -781,21 +786,21 @@ export async function scanAction(directory: string, options: ScanOptions) {
781
786
  let criticalCount = 0;
782
787
  let majorCount = 0;
783
788
 
784
- if (results.patterns) {
785
- results.patterns.forEach((p: any) => {
789
+ if (results.patternDetect) {
790
+ results.patternDetect.results.forEach((p: any) => {
786
791
  p.issues.forEach((i: any) => {
787
792
  if (i.severity === 'critical') criticalCount++;
788
793
  if (i.severity === 'major') majorCount++;
789
794
  });
790
795
  });
791
796
  }
792
- if (results.context) {
793
- results.context.forEach((c: any) => {
797
+ if (results.contextAnalyzer) {
798
+ results.contextAnalyzer.results.forEach((c: any) => {
794
799
  if (c.severity === 'critical') criticalCount++;
795
800
  if (c.severity === 'major') majorCount++;
796
801
  });
797
802
  }
798
- if (results.consistency?.results) {
803
+ if (results.consistency) {
799
804
  results.consistency.results.forEach((r: any) => {
800
805
  r.issues?.forEach((i: any) => {
801
806
  if (i.severity === 'critical') criticalCount++;
@@ -85,12 +85,12 @@ export async function visualizeAction(
85
85
 
86
86
  if (useDevMode) {
87
87
  try {
88
- const monorepoWebDir = resolvePath(dirPath, 'packages/visualizer');
88
+ const localWebDir = resolvePath(dirPath, 'packages/visualizer');
89
89
  let webDir = '';
90
90
  let visualizerAvailable = false;
91
91
 
92
- if (existsSync(monorepoWebDir)) {
93
- webDir = monorepoWebDir;
92
+ if (existsSync(localWebDir)) {
93
+ webDir = localWebDir;
94
94
  visualizerAvailable = true;
95
95
  } else {
96
96
  // Try to resolve installed @aiready/visualizer package from node_modules
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { analyzePatterns } from '@aiready/pattern-detect';
2
2
  import { analyzeContext } from '@aiready/context-analyzer';
3
3
  import { analyzeConsistency } from '@aiready/consistency';
4
- import type { AnalysisResult, ScanOptions } from '@aiready/core';
4
+ import type { AnalysisResult, ScanOptions, SpokeOutput } from '@aiready/core';
5
5
  import {
6
6
  calculateOverallScore,
7
7
  type ToolScoringOutput,
@@ -9,12 +9,6 @@ import {
9
9
  calculateTokenBudget,
10
10
  } from '@aiready/core';
11
11
  export type { ToolScoringOutput, ScoringResult };
12
- import type { ContextAnalysisResult } from '@aiready/context-analyzer';
13
- import type { DuplicatePattern } from '@aiready/pattern-detect';
14
- import type {
15
- ConsistencyReport,
16
- ConsistencyOptions,
17
- } from '@aiready/consistency';
18
12
 
19
13
  export interface UnifiedAnalysisOptions extends ScanOptions {
20
14
  tools?: (
@@ -23,31 +17,32 @@ export interface UnifiedAnalysisOptions extends ScanOptions {
23
17
  | 'consistency'
24
18
  | 'doc-drift'
25
19
  | 'deps-health'
26
- | 'aiSignalClarity'
27
- | 'grounding'
20
+ | 'ai-signal-clarity'
21
+ | 'agent-grounding'
28
22
  | 'testability'
29
- | 'changeAmplification'
23
+ | 'change-amplification'
30
24
  )[];
31
25
  minSimilarity?: number;
32
26
  minLines?: number;
33
27
  maxCandidatesPerBlock?: number;
34
28
  minSharedTokens?: number;
35
29
  useSmartDefaults?: boolean;
36
- consistency?: Partial<ConsistencyOptions>;
30
+ consistency?: any;
37
31
  progressCallback?: (event: { tool: string; data: any }) => void;
38
32
  }
39
33
 
40
34
  export interface UnifiedAnalysisResult {
41
- patterns?: AnalysisResult[];
42
- duplicates?: DuplicatePattern[]; // Store actual duplicates for scoring
43
- context?: ContextAnalysisResult[];
44
- consistency?: ConsistencyReport;
45
- docDrift?: any;
46
- deps?: any;
35
+ // Standardized keys matching tool names
36
+ patternDetect?: SpokeOutput & { duplicates: any[] };
37
+ contextAnalyzer?: SpokeOutput;
38
+ consistency?: SpokeOutput;
39
+ docDrift?: SpokeOutput;
40
+ dependencyHealth?: SpokeOutput;
47
41
  aiSignalClarity?: any;
48
- grounding?: any;
42
+ agentGrounding?: any;
49
43
  testability?: any;
50
- changeAmplification?: any;
44
+ changeAmplification?: SpokeOutput;
45
+
51
46
  summary: {
52
47
  totalIssues: number;
53
48
  toolsRun: string[];
@@ -116,15 +111,14 @@ export async function analyzeUnified(
116
111
  // Run pattern detection
117
112
  if (tools.includes('patterns')) {
118
113
  const patternResult = await analyzePatterns(options);
119
- // Emit progress for patterns
120
114
  if (options.progressCallback) {
121
115
  options.progressCallback({ tool: 'patterns', data: patternResult });
122
116
  }
123
- // Sort results by severity
124
- result.patterns = sortBySeverity(patternResult.results);
125
- // Store duplicates for scoring
126
- result.duplicates = patternResult.duplicates;
127
- // Count actual issues, not file count
117
+ result.patternDetect = {
118
+ results: sortBySeverity(patternResult.results),
119
+ summary: patternResult.summary || {},
120
+ duplicates: patternResult.duplicates || [],
121
+ };
128
122
  result.summary.totalIssues += patternResult.results.reduce(
129
123
  (sum, file) => sum + file.issues.length,
130
124
  0
@@ -137,22 +131,25 @@ export async function analyzeUnified(
137
131
  if (options.progressCallback) {
138
132
  options.progressCallback({ tool: 'context', data: contextResults });
139
133
  }
140
- // Sort context results by severity (most severe first)
141
- result.context = contextResults.sort((a, b) => {
134
+ const sorted = contextResults.sort((a, b) => {
142
135
  const severityDiff =
143
136
  (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
144
137
  if (severityDiff !== 0) return severityDiff;
145
- // If same severity, sort by token cost (higher cost first)
146
138
  if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
147
- // Finally, sort by fragmentation score (higher fragmentation first)
148
139
  return b.fragmentationScore - a.fragmentationScore;
149
140
  });
150
- result.summary.totalIssues += result.context?.length || 0;
141
+
142
+ const { generateSummary: genContextSummary } =
143
+ await import('@aiready/context-analyzer');
144
+ result.contextAnalyzer = {
145
+ results: sorted,
146
+ summary: genContextSummary(sorted),
147
+ };
148
+ result.summary.totalIssues += sorted.length;
151
149
  }
152
150
 
153
151
  // Run consistency analysis
154
152
  if (tools.includes('consistency')) {
155
- // Use config fields if present, fallback to defaults
156
153
  const consistencyOptions = {
157
154
  rootDir: options.rootDir,
158
155
  include: options.include,
@@ -163,11 +160,10 @@ export async function analyzeUnified(
163
160
  if (options.progressCallback) {
164
161
  options.progressCallback({ tool: 'consistency', data: report });
165
162
  }
166
- // Sort consistency results by severity
167
- if (report.results) {
168
- report.results = sortBySeverity(report.results);
169
- }
170
- result.consistency = report;
163
+ result.consistency = {
164
+ results: report.results ? sortBySeverity(report.results) : [],
165
+ summary: report.summary,
166
+ };
171
167
  result.summary.totalIssues += report.summary.totalIssues;
172
168
  }
173
169
 
@@ -183,7 +179,10 @@ export async function analyzeUnified(
183
179
  if (options.progressCallback) {
184
180
  options.progressCallback({ tool: 'doc-drift', data: report });
185
181
  }
186
- result.docDrift = report;
182
+ result.docDrift = {
183
+ results: report.results || [],
184
+ summary: report.summary || {},
185
+ };
187
186
  result.summary.totalIssues += report.issues?.length || 0;
188
187
  }
189
188
 
@@ -199,12 +198,15 @@ export async function analyzeUnified(
199
198
  if (options.progressCallback) {
200
199
  options.progressCallback({ tool: 'deps-health', data: report });
201
200
  }
202
- result.deps = report;
201
+ result.dependencyHealth = {
202
+ results: report.results || [],
203
+ summary: report.summary || {},
204
+ };
203
205
  result.summary.totalIssues += report.issues?.length || 0;
204
206
  }
205
207
 
206
208
  // Run AI Signal Clarity analysis
207
- if (tools.includes('aiSignalClarity')) {
209
+ if (tools.includes('ai-signal-clarity')) {
208
210
  const { analyzeAiSignalClarity } =
209
211
  await import('@aiready/ai-signal-clarity');
210
212
  const report = await analyzeAiSignalClarity({
@@ -214,9 +216,13 @@ export async function analyzeUnified(
214
216
  onProgress: options.onProgress,
215
217
  });
216
218
  if (options.progressCallback) {
217
- options.progressCallback({ tool: 'aiSignalClarity', data: report });
219
+ options.progressCallback({ tool: 'ai-signal-clarity', data: report });
218
220
  }
219
- result.aiSignalClarity = report;
221
+ result.aiSignalClarity = {
222
+ ...report,
223
+ results: report.results || [],
224
+ summary: report.summary || {},
225
+ };
220
226
  result.summary.totalIssues +=
221
227
  report.results?.reduce(
222
228
  (sum: number, r: any) => sum + (r.issues?.length || 0),
@@ -225,7 +231,7 @@ export async function analyzeUnified(
225
231
  }
226
232
 
227
233
  // Run Agent Grounding analysis
228
- if (tools.includes('grounding')) {
234
+ if (tools.includes('agent-grounding')) {
229
235
  const { analyzeAgentGrounding } = await import('@aiready/agent-grounding');
230
236
  const report = await analyzeAgentGrounding({
231
237
  rootDir: options.rootDir,
@@ -234,9 +240,13 @@ export async function analyzeUnified(
234
240
  onProgress: options.onProgress,
235
241
  });
236
242
  if (options.progressCallback) {
237
- options.progressCallback({ tool: 'grounding', data: report });
243
+ options.progressCallback({ tool: 'agent-grounding', data: report });
238
244
  }
239
- result.grounding = report;
245
+ result.agentGrounding = {
246
+ ...report,
247
+ results: report.results || [],
248
+ summary: report.summary || {},
249
+ };
240
250
  result.summary.totalIssues += report.issues?.length || 0;
241
251
  }
242
252
 
@@ -252,12 +262,16 @@ export async function analyzeUnified(
252
262
  if (options.progressCallback) {
253
263
  options.progressCallback({ tool: 'testability', data: report });
254
264
  }
255
- result.testability = report;
265
+ result.testability = {
266
+ ...report,
267
+ results: report.results || [],
268
+ summary: report.summary || {},
269
+ };
256
270
  result.summary.totalIssues += report.issues?.length || 0;
257
271
  }
258
272
 
259
273
  // Run Change Amplification analysis
260
- if (tools.includes('changeAmplification')) {
274
+ if (tools.includes('change-amplification')) {
261
275
  const { analyzeChangeAmplification } =
262
276
  await import('@aiready/change-amplification');
263
277
  const report = await analyzeChangeAmplification({
@@ -267,9 +281,12 @@ export async function analyzeUnified(
267
281
  onProgress: options.onProgress,
268
282
  });
269
283
  if (options.progressCallback) {
270
- options.progressCallback({ tool: 'changeAmplification', data: report });
284
+ options.progressCallback({ tool: 'change-amplification', data: report });
271
285
  }
272
- result.changeAmplification = report;
286
+ result.changeAmplification = {
287
+ results: report.results || [],
288
+ summary: report.summary || {},
289
+ };
273
290
  result.summary.totalIssues += report.summary?.totalIssues || 0;
274
291
  }
275
292
 
@@ -284,16 +301,16 @@ export async function scoreUnified(
284
301
  const toolScores: Map<string, ToolScoringOutput> = new Map();
285
302
 
286
303
  // Patterns score
287
- if (results.duplicates) {
304
+ if (results.patternDetect) {
288
305
  const { calculatePatternScore } = await import('@aiready/pattern-detect');
289
306
  try {
290
307
  const patternScore = calculatePatternScore(
291
- results.duplicates,
292
- results.patterns?.length || 0
308
+ results.patternDetect.duplicates,
309
+ results.patternDetect.results?.length || 0
293
310
  );
294
311
 
295
312
  // Calculate token budget for patterns (waste = duplication)
296
- const wastedTokens = results.duplicates.reduce(
313
+ const wastedTokens = results.patternDetect.duplicates.reduce(
297
314
  (sum: number, d: any) => sum + (d.tokenCost || 0),
298
315
  0
299
316
  );
@@ -313,11 +330,10 @@ export async function scoreUnified(
313
330
  }
314
331
 
315
332
  // Context score
316
- if (results.context) {
317
- const { generateSummary: genContextSummary, calculateContextScore } =
318
- await import('@aiready/context-analyzer');
333
+ if (results.contextAnalyzer) {
334
+ const { calculateContextScore } = await import('@aiready/context-analyzer');
319
335
  try {
320
- const ctxSummary = genContextSummary(results.context);
336
+ const ctxSummary = results.contextAnalyzer.summary;
321
337
  const contextScore = calculateContextScore(ctxSummary);
322
338
 
323
339
  // Calculate token budget for context (waste = fragmentation + depth overhead)
@@ -363,11 +379,11 @@ export async function scoreUnified(
363
379
  }
364
380
 
365
381
  // Agent grounding score
366
- if (results.grounding) {
382
+ if (results.agentGrounding) {
367
383
  const { calculateGroundingScore } =
368
384
  await import('@aiready/agent-grounding');
369
385
  try {
370
- const agScore = calculateGroundingScore(results.grounding);
386
+ const agScore = calculateGroundingScore(results.agentGrounding);
371
387
  toolScores.set('agent-grounding', agScore);
372
388
  } catch (err) {
373
389
  void err;
@@ -389,10 +405,13 @@ export async function scoreUnified(
389
405
  if (results.docDrift) {
390
406
  toolScores.set('doc-drift', {
391
407
  toolName: 'doc-drift',
392
- score: results.docDrift.summary.score,
393
- rawMetrics: results.docDrift.rawData,
408
+ score:
409
+ results.docDrift.summary.score ||
410
+ results.docDrift.summary.totalScore ||
411
+ 0,
412
+ rawMetrics: results.docDrift.summary,
394
413
  factors: [],
395
- recommendations: (results.docDrift.recommendations || []).map(
414
+ recommendations: (results.docDrift.summary.recommendations || []).map(
396
415
  (action: string) => ({
397
416
  action,
398
417
  estimatedImpact: 5,
@@ -403,19 +422,19 @@ export async function scoreUnified(
403
422
  }
404
423
 
405
424
  // Dependency Health score
406
- if (results.deps) {
425
+ if (results.dependencyHealth) {
407
426
  toolScores.set('dependency-health', {
408
427
  toolName: 'dependency-health',
409
- score: results.deps.summary.score,
410
- rawMetrics: results.deps.rawData,
428
+ score: results.dependencyHealth.summary.score || 0,
429
+ rawMetrics: results.dependencyHealth.summary,
411
430
  factors: [],
412
- recommendations: (results.deps.recommendations || []).map(
413
- (action: string) => ({
414
- action,
415
- estimatedImpact: 5,
416
- priority: 'medium',
417
- })
418
- ),
431
+ recommendations: (
432
+ results.dependencyHealth.summary.recommendations || []
433
+ ).map((action: string) => ({
434
+ action,
435
+ estimatedImpact: 5,
436
+ priority: 'medium',
437
+ })),
419
438
  });
420
439
  }
421
440
 
@@ -423,16 +442,16 @@ export async function scoreUnified(
423
442
  if (results.changeAmplification) {
424
443
  toolScores.set('change-amplification', {
425
444
  toolName: 'change-amplification',
426
- score: results.changeAmplification.summary.score,
427
- rawMetrics: results.changeAmplification.rawData,
445
+ score: results.changeAmplification.summary.score || 0,
446
+ rawMetrics: results.changeAmplification.summary,
428
447
  factors: [],
429
- recommendations: (results.changeAmplification.recommendations || []).map(
430
- (action: string) => ({
431
- action,
432
- estimatedImpact: 5,
433
- priority: 'medium',
434
- })
435
- ),
448
+ recommendations: (
449
+ results.changeAmplification.summary.recommendations || []
450
+ ).map((action: string) => ({
451
+ action,
452
+ estimatedImpact: 5,
453
+ priority: 'medium',
454
+ })),
436
455
  });
437
456
  }
438
457
 
@@ -463,12 +482,12 @@ export function generateUnifiedSummary(result: UnifiedAnalysisResult): string {
463
482
  output += ` Total issues found: ${summary.totalIssues}\n`;
464
483
  output += ` Execution time: ${(summary.executionTime / 1000).toFixed(2)}s\n\n`;
465
484
 
466
- if (result.patterns) {
467
- output += `🔍 Pattern Analysis: ${result.patterns.length} issues\n`;
485
+ if (result.patternDetect) {
486
+ output += `🔍 Pattern Analysis: ${result.patternDetect.results.length} issues\n`;
468
487
  }
469
488
 
470
- if (result.context) {
471
- output += `🧠 Context Analysis: ${result.context.length} issues\n`;
489
+ if (result.contextAnalyzer) {
490
+ output += `🧠 Context Analysis: ${result.contextAnalyzer.results.length} issues\n`;
472
491
  }
473
492
 
474
493
  if (result.consistency) {
@@ -476,23 +495,23 @@ export function generateUnifiedSummary(result: UnifiedAnalysisResult): string {
476
495
  }
477
496
 
478
497
  if (result.docDrift) {
479
- output += `📝 Doc Drift Analysis: ${result.docDrift.issues?.length || 0} issues\n`;
498
+ output += `📝 Doc Drift Analysis: ${result.docDrift.results?.length || 0} issues\n`;
480
499
  }
481
500
 
482
- if (result.deps) {
483
- output += `📦 Dependency Health: ${result.deps.issues?.length || 0} issues\n`;
501
+ if (result.dependencyHealth) {
502
+ output += `📦 Dependency Health: ${result.dependencyHealth.results?.length || 0} issues\n`;
484
503
  }
485
504
 
486
505
  if (result.aiSignalClarity) {
487
506
  output += `🧠 AI Signal Clarity: ${result.aiSignalClarity.summary?.totalSignals || 0} signals\n`;
488
507
  }
489
508
 
490
- if (result.grounding) {
491
- output += `🧭 Agent Grounding: ${result.grounding.issues?.length || 0} issues\n`;
509
+ if (result.agentGrounding) {
510
+ output += `🧭 Agent Grounding: ${result.agentGrounding.results?.length || 0} issues\n`;
492
511
  }
493
512
 
494
513
  if (result.testability) {
495
- output += `🧪 Testability Index: ${result.testability.issues?.length || 0} issues\n`;
514
+ output += `🧪 Testability Index: ${result.testability.results?.length || 0} issues\n`;
496
515
  }
497
516
 
498
517
  if (result.changeAmplification) {
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=cli.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/cli.test.ts"],"names":[],"mappings":""}
@@ -1,52 +0,0 @@
1
- import { describe, it, expect, vi } from 'vitest';
2
- import { analyzeUnified } from '../index';
3
- // Mock the individual tools
4
- vi.mock('@aiready/pattern-detect', () => ({
5
- analyzePatterns: vi.fn().mockResolvedValue({
6
- results: [],
7
- duplicates: [],
8
- files: [],
9
- }),
10
- generateSummary: vi.fn().mockReturnValue({
11
- totalDuplicateLines: 0,
12
- potentialSavings: 0,
13
- }),
14
- }));
15
- vi.mock('@aiready/context-analyzer', () => ({
16
- analyzeContext: vi.fn().mockResolvedValue([]),
17
- generateSummary: vi.fn().mockReturnValue({
18
- totalFiles: 0,
19
- averageCohesion: 0,
20
- averageFragmentation: 0,
21
- }),
22
- }));
23
- describe('CLI Unified Analysis', () => {
24
- it('should run unified analysis with both tools', async () => {
25
- const results = await analyzeUnified({
26
- rootDir: '/test',
27
- tools: ['patterns', 'context'],
28
- });
29
- expect(results).toHaveProperty('patterns');
30
- expect(results).toHaveProperty('context');
31
- expect(results).toHaveProperty('summary');
32
- });
33
- it('should run analysis with only patterns tool', async () => {
34
- const results = await analyzeUnified({
35
- rootDir: '/test',
36
- tools: ['patterns'],
37
- });
38
- expect(results).toHaveProperty('patterns');
39
- expect(results).not.toHaveProperty('context');
40
- expect(results).toHaveProperty('summary');
41
- });
42
- it('should run analysis with only context tool', async () => {
43
- const results = await analyzeUnified({
44
- rootDir: '/test',
45
- tools: ['context'],
46
- });
47
- expect(results).not.toHaveProperty('patterns');
48
- expect(results).toHaveProperty('context');
49
- expect(results).toHaveProperty('summary');
50
- });
51
- });
52
- //# sourceMappingURL=cli.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.test.js","sourceRoot":"","sources":["../../src/__tests__/cli.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,4BAA4B;AAC5B,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC;IACxC,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC;QACzC,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,KAAK,EAAE,EAAE;KACV,CAAC;IACF,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;QACvC,mBAAmB,EAAE,CAAC;QACtB,gBAAgB,EAAE,CAAC;KACpB,CAAC;CACH,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAC7C,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;QACvC,UAAU,EAAE,CAAC;QACb,eAAe,EAAE,CAAC;QAClB,oBAAoB,EAAE,CAAC;KACxB,CAAC;CACH,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC3D,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC;YACnC,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;SAC/B,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC3D,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC;YACnC,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,CAAC,UAAU,CAAC;SACpB,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC9C,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QAC1D,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC;YACnC,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,CAAC,SAAS,CAAC;SACnB,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,7 +0,0 @@
1
- import {
2
- agentGroundingAction
3
- } from "./chunk-YIS6WTY5.mjs";
4
- import "./chunk-Y6FXYEAI.mjs";
5
- export {
6
- agentGroundingAction
7
- };