@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.
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-test.log +6 -7
- package/dist/{chunk-6FOVC2OE.mjs → chunk-EQ2HQSTJ.mjs} +83 -61
- package/dist/{chunk-MEXEG3IJ.mjs → chunk-VUCNUYI7.mjs} +90 -62
- package/dist/cli.js +105 -75
- package/dist/cli.mjs +30 -25
- package/dist/index.js +86 -61
- package/dist/index.mjs +1 -1
- package/package.json +12 -12
- package/src/.aiready/aiready-report-20260305-153847.json +8015 -0
- package/src/.aiready/aiready-report-20260305-154121.json +8015 -0
- package/src/.aiready/aiready-report-20260305-160026.json +8015 -0
- package/src/.aiready/aiready-report-20260305-160752.json +8015 -0
- package/src/.aiready/aiready-report-20260305-163858.json +8015 -0
- package/src/.aiready/aiready-report-20260305-171001.json +8317 -0
- package/src/.aiready/aiready-report-20260305-201337.json +8317 -0
- package/src/__tests__/cli.test.ts +6 -6
- package/src/commands/scan.ts +27 -22
- package/src/commands/visualize.ts +3 -3
- package/src/index.ts +109 -90
- package/dist/__tests__/cli.test.d.ts +0 -2
- package/dist/__tests__/cli.test.d.ts.map +0 -1
- package/dist/__tests__/cli.test.js +0 -52
- package/dist/__tests__/cli.test.js.map +0 -1
- package/dist/agent-grounding-DAOSU4MF.mjs +0 -7
- package/dist/chunk-2LXCBVPN.mjs +0 -109
- package/dist/chunk-3SG2GLFJ.mjs +0 -118
- package/dist/chunk-5GZDRZ3T.mjs +0 -126
- package/dist/chunk-DEZVFBPS.mjs +0 -111
- package/dist/chunk-G6SDH7ZS.mjs +0 -126
- package/dist/chunk-HLBKROD3.mjs +0 -237
- package/dist/chunk-JQG7ZATX.mjs +0 -211
- package/dist/chunk-LLJMKNBI.mjs +0 -243
- package/dist/chunk-M7O2MEM5.mjs +0 -211
- package/dist/chunk-N4SLON5K.mjs +0 -152
- package/dist/chunk-OVELUOM6.mjs +0 -112
- package/dist/chunk-P3XAXCTK.mjs +0 -110
- package/dist/chunk-PDOONNSK.mjs +0 -228
- package/dist/chunk-QXQP6BMO.mjs +0 -109
- package/dist/chunk-RBWLQRKR.mjs +0 -39
- package/dist/chunk-XAF2EW5H.mjs +0 -46
- package/dist/chunk-Y6FXYEAI.mjs +0 -10
- package/dist/chunk-YIS6WTY5.mjs +0 -35
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/deps-health-UWVYJ7FZ.mjs +0 -47
- package/dist/doc-drift-G7MGAZAE.mjs +0 -47
- package/dist/hallucination-risk-XU6E7IGN.mjs +0 -7
- package/dist/index.d.mts +0 -33
- package/dist/index.d.ts +0 -32
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- 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('
|
|
34
|
-
expect(results).toHaveProperty('
|
|
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('
|
|
45
|
-
expect(results).not.toHaveProperty('
|
|
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('
|
|
56
|
-
expect(results).toHaveProperty('
|
|
55
|
+
expect(results).not.toHaveProperty('patternDetect');
|
|
56
|
+
expect(results).toHaveProperty('contextAnalyzer');
|
|
57
57
|
expect(results).toHaveProperty('summary');
|
|
58
58
|
});
|
|
59
59
|
});
|
package/src/commands/scan.ts
CHANGED
|
@@ -69,12 +69,12 @@ export async function scanAction(directory: string, options: ScanOptions) {
|
|
|
69
69
|
'patterns',
|
|
70
70
|
'context',
|
|
71
71
|
'consistency',
|
|
72
|
-
'
|
|
73
|
-
'grounding',
|
|
72
|
+
'ai-signal-clarity',
|
|
73
|
+
'agent-grounding',
|
|
74
74
|
'testability',
|
|
75
75
|
'doc-drift',
|
|
76
76
|
'deps-health',
|
|
77
|
-
'
|
|
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 = [
|
|
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.
|
|
470
|
+
if (results.patternDetect) {
|
|
467
471
|
console.log(
|
|
468
|
-
` Duplicate patterns found: ${chalk.bold(String(results.duplicates
|
|
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.
|
|
475
|
+
` Pattern files with issues: ${chalk.bold(String(results.patternDetect.results.length || 0))}`
|
|
473
476
|
);
|
|
474
|
-
|
|
477
|
+
}
|
|
478
|
+
if (results.contextAnalyzer)
|
|
475
479
|
console.log(
|
|
476
|
-
` Context issues: ${chalk.bold(String(results.
|
|
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.
|
|
754
|
-
const criticalPatterns = results.
|
|
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.
|
|
785
|
-
results.
|
|
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.
|
|
793
|
-
results.
|
|
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
|
|
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
|
|
88
|
+
const localWebDir = resolvePath(dirPath, 'packages/visualizer');
|
|
89
89
|
let webDir = '';
|
|
90
90
|
let visualizerAvailable = false;
|
|
91
91
|
|
|
92
|
-
if (existsSync(
|
|
93
|
-
webDir =
|
|
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
|
-
| '
|
|
27
|
-
| 'grounding'
|
|
20
|
+
| 'ai-signal-clarity'
|
|
21
|
+
| 'agent-grounding'
|
|
28
22
|
| 'testability'
|
|
29
|
-
| '
|
|
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?:
|
|
30
|
+
consistency?: any;
|
|
37
31
|
progressCallback?: (event: { tool: string; data: any }) => void;
|
|
38
32
|
}
|
|
39
33
|
|
|
40
34
|
export interface UnifiedAnalysisResult {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
consistency?:
|
|
45
|
-
docDrift?:
|
|
46
|
-
|
|
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
|
-
|
|
42
|
+
agentGrounding?: any;
|
|
49
43
|
testability?: any;
|
|
50
|
-
changeAmplification?:
|
|
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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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 =
|
|
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.
|
|
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('
|
|
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: '
|
|
219
|
+
options.progressCallback({ tool: 'ai-signal-clarity', data: report });
|
|
218
220
|
}
|
|
219
|
-
result.aiSignalClarity =
|
|
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.
|
|
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 =
|
|
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('
|
|
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: '
|
|
284
|
+
options.progressCallback({ tool: 'change-amplification', data: report });
|
|
271
285
|
}
|
|
272
|
-
result.changeAmplification =
|
|
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.
|
|
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.
|
|
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.
|
|
317
|
-
const {
|
|
318
|
-
await import('@aiready/context-analyzer');
|
|
333
|
+
if (results.contextAnalyzer) {
|
|
334
|
+
const { calculateContextScore } = await import('@aiready/context-analyzer');
|
|
319
335
|
try {
|
|
320
|
-
const ctxSummary =
|
|
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.
|
|
382
|
+
if (results.agentGrounding) {
|
|
367
383
|
const { calculateGroundingScore } =
|
|
368
384
|
await import('@aiready/agent-grounding');
|
|
369
385
|
try {
|
|
370
|
-
const agScore = calculateGroundingScore(results.
|
|
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:
|
|
393
|
-
|
|
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.
|
|
425
|
+
if (results.dependencyHealth) {
|
|
407
426
|
toolScores.set('dependency-health', {
|
|
408
427
|
toolName: 'dependency-health',
|
|
409
|
-
score: results.
|
|
410
|
-
rawMetrics: results.
|
|
428
|
+
score: results.dependencyHealth.summary.score || 0,
|
|
429
|
+
rawMetrics: results.dependencyHealth.summary,
|
|
411
430
|
factors: [],
|
|
412
|
-
recommendations: (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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.
|
|
445
|
+
score: results.changeAmplification.summary.score || 0,
|
|
446
|
+
rawMetrics: results.changeAmplification.summary,
|
|
428
447
|
factors: [],
|
|
429
|
-
recommendations: (
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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.
|
|
467
|
-
output += `🔍 Pattern Analysis: ${result.
|
|
485
|
+
if (result.patternDetect) {
|
|
486
|
+
output += `🔍 Pattern Analysis: ${result.patternDetect.results.length} issues\n`;
|
|
468
487
|
}
|
|
469
488
|
|
|
470
|
-
if (result.
|
|
471
|
-
output += `🧠 Context Analysis: ${result.
|
|
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.
|
|
498
|
+
output += `📝 Doc Drift Analysis: ${result.docDrift.results?.length || 0} issues\n`;
|
|
480
499
|
}
|
|
481
500
|
|
|
482
|
-
if (result.
|
|
483
|
-
output += `📦 Dependency Health: ${result.
|
|
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.
|
|
491
|
-
output += `🧭 Agent Grounding: ${result.
|
|
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.
|
|
514
|
+
output += `🧪 Testability Index: ${result.testability.results?.length || 0} issues\n`;
|
|
496
515
|
}
|
|
497
516
|
|
|
498
517
|
if (result.changeAmplification) {
|
|
@@ -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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