@aiready/cli 0.9.47 โ 0.10.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.
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-test.log +5 -6
- package/dist/{chunk-6FOVC2OE.mjs โ chunk-EQ2HQSTJ.mjs} +83 -61
- package/dist/cli.js +102 -75
- package/dist/cli.mjs +30 -25
- package/dist/index.js +83 -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/__tests__/cli.test.ts +6 -6
- package/src/commands/scan.ts +27 -22
- package/src/commands/visualize.ts +3 -3
- package/src/index.ts +108 -92
- 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-MEXEG3IJ.mjs +0 -389
- 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
|
-
|
|
47
|
-
aiSignalClarity?:
|
|
48
|
-
|
|
49
|
-
testability?:
|
|
50
|
-
changeAmplification?:
|
|
35
|
+
// Standardized keys matching tool names
|
|
36
|
+
patternDetect?: SpokeOutput & { duplicates: any[] };
|
|
37
|
+
contextAnalyzer?: SpokeOutput;
|
|
38
|
+
consistency?: SpokeOutput;
|
|
39
|
+
docDrift?: SpokeOutput;
|
|
40
|
+
dependencyHealth?: SpokeOutput;
|
|
41
|
+
aiSignalClarity?: SpokeOutput;
|
|
42
|
+
agentGrounding?: SpokeOutput;
|
|
43
|
+
testability?: SpokeOutput;
|
|
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,12 @@ 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
|
+
results: report.results || [],
|
|
223
|
+
summary: report.summary || {},
|
|
224
|
+
};
|
|
220
225
|
result.summary.totalIssues +=
|
|
221
226
|
report.results?.reduce(
|
|
222
227
|
(sum: number, r: any) => sum + (r.issues?.length || 0),
|
|
@@ -225,7 +230,7 @@ export async function analyzeUnified(
|
|
|
225
230
|
}
|
|
226
231
|
|
|
227
232
|
// Run Agent Grounding analysis
|
|
228
|
-
if (tools.includes('grounding')) {
|
|
233
|
+
if (tools.includes('agent-grounding')) {
|
|
229
234
|
const { analyzeAgentGrounding } = await import('@aiready/agent-grounding');
|
|
230
235
|
const report = await analyzeAgentGrounding({
|
|
231
236
|
rootDir: options.rootDir,
|
|
@@ -234,9 +239,12 @@ export async function analyzeUnified(
|
|
|
234
239
|
onProgress: options.onProgress,
|
|
235
240
|
});
|
|
236
241
|
if (options.progressCallback) {
|
|
237
|
-
options.progressCallback({ tool: 'grounding', data: report });
|
|
242
|
+
options.progressCallback({ tool: 'agent-grounding', data: report });
|
|
238
243
|
}
|
|
239
|
-
result.
|
|
244
|
+
result.agentGrounding = {
|
|
245
|
+
results: report.results || [],
|
|
246
|
+
summary: report.summary || {},
|
|
247
|
+
};
|
|
240
248
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
241
249
|
}
|
|
242
250
|
|
|
@@ -252,12 +260,15 @@ export async function analyzeUnified(
|
|
|
252
260
|
if (options.progressCallback) {
|
|
253
261
|
options.progressCallback({ tool: 'testability', data: report });
|
|
254
262
|
}
|
|
255
|
-
result.testability =
|
|
263
|
+
result.testability = {
|
|
264
|
+
results: report.results || [],
|
|
265
|
+
summary: report.summary || {},
|
|
266
|
+
};
|
|
256
267
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
257
268
|
}
|
|
258
269
|
|
|
259
270
|
// Run Change Amplification analysis
|
|
260
|
-
if (tools.includes('
|
|
271
|
+
if (tools.includes('change-amplification')) {
|
|
261
272
|
const { analyzeChangeAmplification } =
|
|
262
273
|
await import('@aiready/change-amplification');
|
|
263
274
|
const report = await analyzeChangeAmplification({
|
|
@@ -267,9 +278,12 @@ export async function analyzeUnified(
|
|
|
267
278
|
onProgress: options.onProgress,
|
|
268
279
|
});
|
|
269
280
|
if (options.progressCallback) {
|
|
270
|
-
options.progressCallback({ tool: '
|
|
281
|
+
options.progressCallback({ tool: 'change-amplification', data: report });
|
|
271
282
|
}
|
|
272
|
-
result.changeAmplification =
|
|
283
|
+
result.changeAmplification = {
|
|
284
|
+
results: report.results || [],
|
|
285
|
+
summary: report.summary || {},
|
|
286
|
+
};
|
|
273
287
|
result.summary.totalIssues += report.summary?.totalIssues || 0;
|
|
274
288
|
}
|
|
275
289
|
|
|
@@ -284,16 +298,16 @@ export async function scoreUnified(
|
|
|
284
298
|
const toolScores: Map<string, ToolScoringOutput> = new Map();
|
|
285
299
|
|
|
286
300
|
// Patterns score
|
|
287
|
-
if (results.
|
|
301
|
+
if (results.patternDetect) {
|
|
288
302
|
const { calculatePatternScore } = await import('@aiready/pattern-detect');
|
|
289
303
|
try {
|
|
290
304
|
const patternScore = calculatePatternScore(
|
|
291
|
-
results.duplicates,
|
|
292
|
-
results.
|
|
305
|
+
results.patternDetect.duplicates,
|
|
306
|
+
results.patternDetect.results?.length || 0
|
|
293
307
|
);
|
|
294
308
|
|
|
295
309
|
// Calculate token budget for patterns (waste = duplication)
|
|
296
|
-
const wastedTokens = results.duplicates.reduce(
|
|
310
|
+
const wastedTokens = results.patternDetect.duplicates.reduce(
|
|
297
311
|
(sum: number, d: any) => sum + (d.tokenCost || 0),
|
|
298
312
|
0
|
|
299
313
|
);
|
|
@@ -313,11 +327,10 @@ export async function scoreUnified(
|
|
|
313
327
|
}
|
|
314
328
|
|
|
315
329
|
// Context score
|
|
316
|
-
if (results.
|
|
317
|
-
const {
|
|
318
|
-
await import('@aiready/context-analyzer');
|
|
330
|
+
if (results.contextAnalyzer) {
|
|
331
|
+
const { calculateContextScore } = await import('@aiready/context-analyzer');
|
|
319
332
|
try {
|
|
320
|
-
const ctxSummary =
|
|
333
|
+
const ctxSummary = results.contextAnalyzer.summary;
|
|
321
334
|
const contextScore = calculateContextScore(ctxSummary);
|
|
322
335
|
|
|
323
336
|
// Calculate token budget for context (waste = fragmentation + depth overhead)
|
|
@@ -363,11 +376,11 @@ export async function scoreUnified(
|
|
|
363
376
|
}
|
|
364
377
|
|
|
365
378
|
// Agent grounding score
|
|
366
|
-
if (results.
|
|
379
|
+
if (results.agentGrounding) {
|
|
367
380
|
const { calculateGroundingScore } =
|
|
368
381
|
await import('@aiready/agent-grounding');
|
|
369
382
|
try {
|
|
370
|
-
const agScore = calculateGroundingScore(results.
|
|
383
|
+
const agScore = calculateGroundingScore(results.agentGrounding);
|
|
371
384
|
toolScores.set('agent-grounding', agScore);
|
|
372
385
|
} catch (err) {
|
|
373
386
|
void err;
|
|
@@ -389,10 +402,13 @@ export async function scoreUnified(
|
|
|
389
402
|
if (results.docDrift) {
|
|
390
403
|
toolScores.set('doc-drift', {
|
|
391
404
|
toolName: 'doc-drift',
|
|
392
|
-
score:
|
|
393
|
-
|
|
405
|
+
score:
|
|
406
|
+
results.docDrift.summary.score ||
|
|
407
|
+
results.docDrift.summary.totalScore ||
|
|
408
|
+
0,
|
|
409
|
+
rawMetrics: results.docDrift.summary,
|
|
394
410
|
factors: [],
|
|
395
|
-
recommendations: (results.docDrift.recommendations || []).map(
|
|
411
|
+
recommendations: (results.docDrift.summary.recommendations || []).map(
|
|
396
412
|
(action: string) => ({
|
|
397
413
|
action,
|
|
398
414
|
estimatedImpact: 5,
|
|
@@ -403,19 +419,19 @@ export async function scoreUnified(
|
|
|
403
419
|
}
|
|
404
420
|
|
|
405
421
|
// Dependency Health score
|
|
406
|
-
if (results.
|
|
422
|
+
if (results.dependencyHealth) {
|
|
407
423
|
toolScores.set('dependency-health', {
|
|
408
424
|
toolName: 'dependency-health',
|
|
409
|
-
score: results.
|
|
410
|
-
rawMetrics: results.
|
|
425
|
+
score: results.dependencyHealth.summary.score || 0,
|
|
426
|
+
rawMetrics: results.dependencyHealth.summary,
|
|
411
427
|
factors: [],
|
|
412
|
-
recommendations: (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
),
|
|
428
|
+
recommendations: (
|
|
429
|
+
results.dependencyHealth.summary.recommendations || []
|
|
430
|
+
).map((action: string) => ({
|
|
431
|
+
action,
|
|
432
|
+
estimatedImpact: 5,
|
|
433
|
+
priority: 'medium',
|
|
434
|
+
})),
|
|
419
435
|
});
|
|
420
436
|
}
|
|
421
437
|
|
|
@@ -423,16 +439,16 @@ export async function scoreUnified(
|
|
|
423
439
|
if (results.changeAmplification) {
|
|
424
440
|
toolScores.set('change-amplification', {
|
|
425
441
|
toolName: 'change-amplification',
|
|
426
|
-
score: results.changeAmplification.summary.score,
|
|
427
|
-
rawMetrics: results.changeAmplification.
|
|
442
|
+
score: results.changeAmplification.summary.score || 0,
|
|
443
|
+
rawMetrics: results.changeAmplification.summary,
|
|
428
444
|
factors: [],
|
|
429
|
-
recommendations: (
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
),
|
|
445
|
+
recommendations: (
|
|
446
|
+
results.changeAmplification.summary.recommendations || []
|
|
447
|
+
).map((action: string) => ({
|
|
448
|
+
action,
|
|
449
|
+
estimatedImpact: 5,
|
|
450
|
+
priority: 'medium',
|
|
451
|
+
})),
|
|
436
452
|
});
|
|
437
453
|
}
|
|
438
454
|
|
|
@@ -463,12 +479,12 @@ export function generateUnifiedSummary(result: UnifiedAnalysisResult): string {
|
|
|
463
479
|
output += ` Total issues found: ${summary.totalIssues}\n`;
|
|
464
480
|
output += ` Execution time: ${(summary.executionTime / 1000).toFixed(2)}s\n\n`;
|
|
465
481
|
|
|
466
|
-
if (result.
|
|
467
|
-
output += `๐ Pattern Analysis: ${result.
|
|
482
|
+
if (result.patternDetect) {
|
|
483
|
+
output += `๐ Pattern Analysis: ${result.patternDetect.results.length} issues\n`;
|
|
468
484
|
}
|
|
469
485
|
|
|
470
|
-
if (result.
|
|
471
|
-
output += `๐ง Context Analysis: ${result.
|
|
486
|
+
if (result.contextAnalyzer) {
|
|
487
|
+
output += `๐ง Context Analysis: ${result.contextAnalyzer.results.length} issues\n`;
|
|
472
488
|
}
|
|
473
489
|
|
|
474
490
|
if (result.consistency) {
|
|
@@ -476,23 +492,23 @@ export function generateUnifiedSummary(result: UnifiedAnalysisResult): string {
|
|
|
476
492
|
}
|
|
477
493
|
|
|
478
494
|
if (result.docDrift) {
|
|
479
|
-
output += `๐ Doc Drift Analysis: ${result.docDrift.
|
|
495
|
+
output += `๐ Doc Drift Analysis: ${result.docDrift.results?.length || 0} issues\n`;
|
|
480
496
|
}
|
|
481
497
|
|
|
482
|
-
if (result.
|
|
483
|
-
output += `๐ฆ Dependency Health: ${result.
|
|
498
|
+
if (result.dependencyHealth) {
|
|
499
|
+
output += `๐ฆ Dependency Health: ${result.dependencyHealth.results?.length || 0} issues\n`;
|
|
484
500
|
}
|
|
485
501
|
|
|
486
502
|
if (result.aiSignalClarity) {
|
|
487
503
|
output += `๐ง AI Signal Clarity: ${result.aiSignalClarity.summary?.totalSignals || 0} signals\n`;
|
|
488
504
|
}
|
|
489
505
|
|
|
490
|
-
if (result.
|
|
491
|
-
output += `๐งญ Agent Grounding: ${result.
|
|
506
|
+
if (result.agentGrounding) {
|
|
507
|
+
output += `๐งญ Agent Grounding: ${result.agentGrounding.results?.length || 0} issues\n`;
|
|
492
508
|
}
|
|
493
509
|
|
|
494
510
|
if (result.testability) {
|
|
495
|
-
output += `๐งช Testability Index: ${result.testability.
|
|
511
|
+
output += `๐งช Testability Index: ${result.testability.results?.length || 0} issues\n`;
|
|
496
512
|
}
|
|
497
513
|
|
|
498
514
|
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"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EA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