@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
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.
|
|
3
|
+
> @aiready/cli@0.10.1 build /Users/pengcao/projects/aiready/packages/cli
|
|
4
4
|
> tsup src/index.ts src/cli.ts --format cjs,esm
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
|
|
13
|
-
[
|
|
13
|
+
[43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m"import.meta" is not available with the "cjs" output format and will be empty[0m [empty-import-meta] [90m8:13:10 pm[39m
|
|
14
14
|
|
|
15
15
|
src/cli.ts:25:31:
|
|
16
16
|
[37m 25 │ return dirname(fileURLToPath([32mimport.meta[37m.url));
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m89.07 KB[39m
|
|
24
|
-
[32mCJS[39m [1mdist/index.js [22m[32m13.89 KB[39m
|
|
25
|
-
[32mCJS[39m ⚡️ Build success in 40ms
|
|
26
23
|
[32mESM[39m [1mdist/index.mjs [22m[32m170.00 B[39m
|
|
27
|
-
[32mESM[39m [1mdist/
|
|
28
|
-
[32mESM[39m [1mdist/
|
|
29
|
-
[32mESM[39m ⚡️ Build success in
|
|
24
|
+
[32mESM[39m [1mdist/chunk-VUCNUYI7.mjs [22m[32m13.44 KB[39m
|
|
25
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m73.88 KB[39m
|
|
26
|
+
[32mESM[39m ⚡️ Build success in 27ms
|
|
27
|
+
[32mCJS[39m [1mdist/index.js [22m[32m14.84 KB[39m
|
|
28
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m90.12 KB[39m
|
|
29
|
+
[32mCJS[39m ⚡️ Build success in 27ms
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.
|
|
3
|
+
> @aiready/cli@0.10.1 test /Users/pengcao/projects/aiready/packages/cli
|
|
4
4
|
> vitest run
|
|
5
5
|
|
|
6
6
|
[?25l
|
|
7
7
|
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/cli[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m src/__tests__/cli.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
10
|
-
[32m✓[39m dist/__tests__/cli.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/__tests__/cli.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
11
10
|
|
|
12
|
-
[2m Test Files [22m [1m[
|
|
13
|
-
[2m Tests [22m [1m[
|
|
14
|
-
[2m Start at [22m
|
|
15
|
-
[2m Duration [22m
|
|
11
|
+
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
12
|
+
[2m Tests [22m [1m[32m3 passed[39m[22m[90m (3)[39m
|
|
13
|
+
[2m Start at [22m 20:13:28
|
|
14
|
+
[2m Duration [22m 377ms[2m (transform 81ms, setup 0ms, import 258ms, tests 2ms, environment 0ms)[22m
|
|
16
15
|
|
|
17
16
|
[?25h
|
|
@@ -60,8 +60,11 @@ async function analyzeUnified(options) {
|
|
|
60
60
|
if (options.progressCallback) {
|
|
61
61
|
options.progressCallback({ tool: "patterns", data: patternResult });
|
|
62
62
|
}
|
|
63
|
-
result.
|
|
64
|
-
|
|
63
|
+
result.patternDetect = {
|
|
64
|
+
results: sortBySeverity(patternResult.results),
|
|
65
|
+
summary: patternResult.summary || {},
|
|
66
|
+
duplicates: patternResult.duplicates || []
|
|
67
|
+
};
|
|
65
68
|
result.summary.totalIssues += patternResult.results.reduce(
|
|
66
69
|
(sum, file) => sum + file.issues.length,
|
|
67
70
|
0
|
|
@@ -72,13 +75,18 @@ async function analyzeUnified(options) {
|
|
|
72
75
|
if (options.progressCallback) {
|
|
73
76
|
options.progressCallback({ tool: "context", data: contextResults });
|
|
74
77
|
}
|
|
75
|
-
|
|
78
|
+
const sorted = contextResults.sort((a, b) => {
|
|
76
79
|
const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
|
|
77
80
|
if (severityDiff !== 0) return severityDiff;
|
|
78
81
|
if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
|
|
79
82
|
return b.fragmentationScore - a.fragmentationScore;
|
|
80
83
|
});
|
|
81
|
-
|
|
84
|
+
const { generateSummary: genContextSummary } = await import("@aiready/context-analyzer");
|
|
85
|
+
result.contextAnalyzer = {
|
|
86
|
+
results: sorted,
|
|
87
|
+
summary: genContextSummary(sorted)
|
|
88
|
+
};
|
|
89
|
+
result.summary.totalIssues += sorted.length;
|
|
82
90
|
}
|
|
83
91
|
if (tools.includes("consistency")) {
|
|
84
92
|
const consistencyOptions = {
|
|
@@ -91,10 +99,10 @@ async function analyzeUnified(options) {
|
|
|
91
99
|
if (options.progressCallback) {
|
|
92
100
|
options.progressCallback({ tool: "consistency", data: report });
|
|
93
101
|
}
|
|
94
|
-
|
|
95
|
-
report.results
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
result.consistency = {
|
|
103
|
+
results: report.results ? sortBySeverity(report.results) : [],
|
|
104
|
+
summary: report.summary
|
|
105
|
+
};
|
|
98
106
|
result.summary.totalIssues += report.summary.totalIssues;
|
|
99
107
|
}
|
|
100
108
|
if (tools.includes("doc-drift")) {
|
|
@@ -108,7 +116,10 @@ async function analyzeUnified(options) {
|
|
|
108
116
|
if (options.progressCallback) {
|
|
109
117
|
options.progressCallback({ tool: "doc-drift", data: report });
|
|
110
118
|
}
|
|
111
|
-
result.docDrift =
|
|
119
|
+
result.docDrift = {
|
|
120
|
+
results: report.results || [],
|
|
121
|
+
summary: report.summary || {}
|
|
122
|
+
};
|
|
112
123
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
113
124
|
}
|
|
114
125
|
if (tools.includes("deps-health")) {
|
|
@@ -122,10 +133,13 @@ async function analyzeUnified(options) {
|
|
|
122
133
|
if (options.progressCallback) {
|
|
123
134
|
options.progressCallback({ tool: "deps-health", data: report });
|
|
124
135
|
}
|
|
125
|
-
result.
|
|
136
|
+
result.dependencyHealth = {
|
|
137
|
+
results: report.results || [],
|
|
138
|
+
summary: report.summary || {}
|
|
139
|
+
};
|
|
126
140
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
127
141
|
}
|
|
128
|
-
if (tools.includes("
|
|
142
|
+
if (tools.includes("ai-signal-clarity")) {
|
|
129
143
|
const { analyzeAiSignalClarity } = await import("@aiready/ai-signal-clarity");
|
|
130
144
|
const report = await analyzeAiSignalClarity({
|
|
131
145
|
rootDir: options.rootDir,
|
|
@@ -134,15 +148,18 @@ async function analyzeUnified(options) {
|
|
|
134
148
|
onProgress: options.onProgress
|
|
135
149
|
});
|
|
136
150
|
if (options.progressCallback) {
|
|
137
|
-
options.progressCallback({ tool: "
|
|
151
|
+
options.progressCallback({ tool: "ai-signal-clarity", data: report });
|
|
138
152
|
}
|
|
139
|
-
result.aiSignalClarity =
|
|
153
|
+
result.aiSignalClarity = {
|
|
154
|
+
results: report.results || [],
|
|
155
|
+
summary: report.summary || {}
|
|
156
|
+
};
|
|
140
157
|
result.summary.totalIssues += report.results?.reduce(
|
|
141
158
|
(sum, r) => sum + (r.issues?.length || 0),
|
|
142
159
|
0
|
|
143
160
|
) || 0;
|
|
144
161
|
}
|
|
145
|
-
if (tools.includes("grounding")) {
|
|
162
|
+
if (tools.includes("agent-grounding")) {
|
|
146
163
|
const { analyzeAgentGrounding } = await import("@aiready/agent-grounding");
|
|
147
164
|
const report = await analyzeAgentGrounding({
|
|
148
165
|
rootDir: options.rootDir,
|
|
@@ -151,9 +168,12 @@ async function analyzeUnified(options) {
|
|
|
151
168
|
onProgress: options.onProgress
|
|
152
169
|
});
|
|
153
170
|
if (options.progressCallback) {
|
|
154
|
-
options.progressCallback({ tool: "grounding", data: report });
|
|
171
|
+
options.progressCallback({ tool: "agent-grounding", data: report });
|
|
155
172
|
}
|
|
156
|
-
result.
|
|
173
|
+
result.agentGrounding = {
|
|
174
|
+
results: report.results || [],
|
|
175
|
+
summary: report.summary || {}
|
|
176
|
+
};
|
|
157
177
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
158
178
|
}
|
|
159
179
|
if (tools.includes("testability")) {
|
|
@@ -167,10 +187,13 @@ async function analyzeUnified(options) {
|
|
|
167
187
|
if (options.progressCallback) {
|
|
168
188
|
options.progressCallback({ tool: "testability", data: report });
|
|
169
189
|
}
|
|
170
|
-
result.testability =
|
|
190
|
+
result.testability = {
|
|
191
|
+
results: report.results || [],
|
|
192
|
+
summary: report.summary || {}
|
|
193
|
+
};
|
|
171
194
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
172
195
|
}
|
|
173
|
-
if (tools.includes("
|
|
196
|
+
if (tools.includes("change-amplification")) {
|
|
174
197
|
const { analyzeChangeAmplification } = await import("@aiready/change-amplification");
|
|
175
198
|
const report = await analyzeChangeAmplification({
|
|
176
199
|
rootDir: options.rootDir,
|
|
@@ -179,9 +202,12 @@ async function analyzeUnified(options) {
|
|
|
179
202
|
onProgress: options.onProgress
|
|
180
203
|
});
|
|
181
204
|
if (options.progressCallback) {
|
|
182
|
-
options.progressCallback({ tool: "
|
|
205
|
+
options.progressCallback({ tool: "change-amplification", data: report });
|
|
183
206
|
}
|
|
184
|
-
result.changeAmplification =
|
|
207
|
+
result.changeAmplification = {
|
|
208
|
+
results: report.results || [],
|
|
209
|
+
summary: report.summary || {}
|
|
210
|
+
};
|
|
185
211
|
result.summary.totalIssues += report.summary?.totalIssues || 0;
|
|
186
212
|
}
|
|
187
213
|
result.summary.executionTime = Date.now() - startTime;
|
|
@@ -189,14 +215,14 @@ async function analyzeUnified(options) {
|
|
|
189
215
|
}
|
|
190
216
|
async function scoreUnified(results, options) {
|
|
191
217
|
const toolScores = /* @__PURE__ */ new Map();
|
|
192
|
-
if (results.
|
|
218
|
+
if (results.patternDetect) {
|
|
193
219
|
const { calculatePatternScore } = await import("@aiready/pattern-detect");
|
|
194
220
|
try {
|
|
195
221
|
const patternScore = calculatePatternScore(
|
|
196
|
-
results.duplicates,
|
|
197
|
-
results.
|
|
222
|
+
results.patternDetect.duplicates,
|
|
223
|
+
results.patternDetect.results?.length || 0
|
|
198
224
|
);
|
|
199
|
-
const wastedTokens = results.duplicates.reduce(
|
|
225
|
+
const wastedTokens = results.patternDetect.duplicates.reduce(
|
|
200
226
|
(sum, d) => sum + (d.tokenCost || 0),
|
|
201
227
|
0
|
|
202
228
|
);
|
|
@@ -214,10 +240,10 @@ async function scoreUnified(results, options) {
|
|
|
214
240
|
void err;
|
|
215
241
|
}
|
|
216
242
|
}
|
|
217
|
-
if (results.
|
|
218
|
-
const {
|
|
243
|
+
if (results.contextAnalyzer) {
|
|
244
|
+
const { calculateContextScore } = await import("@aiready/context-analyzer");
|
|
219
245
|
try {
|
|
220
|
-
const ctxSummary =
|
|
246
|
+
const ctxSummary = results.contextAnalyzer.summary;
|
|
221
247
|
const contextScore = calculateContextScore(ctxSummary);
|
|
222
248
|
contextScore.tokenBudget = calculateTokenBudget({
|
|
223
249
|
totalContextTokens: ctxSummary.totalTokens,
|
|
@@ -252,10 +278,10 @@ async function scoreUnified(results, options) {
|
|
|
252
278
|
void err;
|
|
253
279
|
}
|
|
254
280
|
}
|
|
255
|
-
if (results.
|
|
281
|
+
if (results.agentGrounding) {
|
|
256
282
|
const { calculateGroundingScore } = await import("@aiready/agent-grounding");
|
|
257
283
|
try {
|
|
258
|
-
const agScore = calculateGroundingScore(results.
|
|
284
|
+
const agScore = calculateGroundingScore(results.agentGrounding);
|
|
259
285
|
toolScores.set("agent-grounding", agScore);
|
|
260
286
|
} catch (err) {
|
|
261
287
|
void err;
|
|
@@ -273,10 +299,10 @@ async function scoreUnified(results, options) {
|
|
|
273
299
|
if (results.docDrift) {
|
|
274
300
|
toolScores.set("doc-drift", {
|
|
275
301
|
toolName: "doc-drift",
|
|
276
|
-
score: results.docDrift.summary.score,
|
|
277
|
-
rawMetrics: results.docDrift.
|
|
302
|
+
score: results.docDrift.summary.score || results.docDrift.summary.totalScore || 0,
|
|
303
|
+
rawMetrics: results.docDrift.summary,
|
|
278
304
|
factors: [],
|
|
279
|
-
recommendations: (results.docDrift.recommendations || []).map(
|
|
305
|
+
recommendations: (results.docDrift.summary.recommendations || []).map(
|
|
280
306
|
(action) => ({
|
|
281
307
|
action,
|
|
282
308
|
estimatedImpact: 5,
|
|
@@ -285,34 +311,30 @@ async function scoreUnified(results, options) {
|
|
|
285
311
|
)
|
|
286
312
|
});
|
|
287
313
|
}
|
|
288
|
-
if (results.
|
|
314
|
+
if (results.dependencyHealth) {
|
|
289
315
|
toolScores.set("dependency-health", {
|
|
290
316
|
toolName: "dependency-health",
|
|
291
|
-
score: results.
|
|
292
|
-
rawMetrics: results.
|
|
317
|
+
score: results.dependencyHealth.summary.score || 0,
|
|
318
|
+
rawMetrics: results.dependencyHealth.summary,
|
|
293
319
|
factors: [],
|
|
294
|
-
recommendations: (results.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
})
|
|
300
|
-
)
|
|
320
|
+
recommendations: (results.dependencyHealth.summary.recommendations || []).map((action) => ({
|
|
321
|
+
action,
|
|
322
|
+
estimatedImpact: 5,
|
|
323
|
+
priority: "medium"
|
|
324
|
+
}))
|
|
301
325
|
});
|
|
302
326
|
}
|
|
303
327
|
if (results.changeAmplification) {
|
|
304
328
|
toolScores.set("change-amplification", {
|
|
305
329
|
toolName: "change-amplification",
|
|
306
|
-
score: results.changeAmplification.summary.score,
|
|
307
|
-
rawMetrics: results.changeAmplification.
|
|
330
|
+
score: results.changeAmplification.summary.score || 0,
|
|
331
|
+
rawMetrics: results.changeAmplification.summary,
|
|
308
332
|
factors: [],
|
|
309
|
-
recommendations: (results.changeAmplification.recommendations || []).map(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
})
|
|
315
|
-
)
|
|
333
|
+
recommendations: (results.changeAmplification.summary.recommendations || []).map((action) => ({
|
|
334
|
+
action,
|
|
335
|
+
estimatedImpact: 5,
|
|
336
|
+
priority: "medium"
|
|
337
|
+
}))
|
|
316
338
|
});
|
|
317
339
|
}
|
|
318
340
|
if (toolScores.size === 0) {
|
|
@@ -345,12 +367,12 @@ function generateUnifiedSummary(result) {
|
|
|
345
367
|
output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
|
|
346
368
|
|
|
347
369
|
`;
|
|
348
|
-
if (result.
|
|
349
|
-
output += `\u{1F50D} Pattern Analysis: ${result.
|
|
370
|
+
if (result.patternDetect) {
|
|
371
|
+
output += `\u{1F50D} Pattern Analysis: ${result.patternDetect.results.length} issues
|
|
350
372
|
`;
|
|
351
373
|
}
|
|
352
|
-
if (result.
|
|
353
|
-
output += `\u{1F9E0} Context Analysis: ${result.
|
|
374
|
+
if (result.contextAnalyzer) {
|
|
375
|
+
output += `\u{1F9E0} Context Analysis: ${result.contextAnalyzer.results.length} issues
|
|
354
376
|
`;
|
|
355
377
|
}
|
|
356
378
|
if (result.consistency) {
|
|
@@ -358,23 +380,23 @@ function generateUnifiedSummary(result) {
|
|
|
358
380
|
`;
|
|
359
381
|
}
|
|
360
382
|
if (result.docDrift) {
|
|
361
|
-
output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.
|
|
383
|
+
output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.results?.length || 0} issues
|
|
362
384
|
`;
|
|
363
385
|
}
|
|
364
|
-
if (result.
|
|
365
|
-
output += `\u{1F4E6} Dependency Health: ${result.
|
|
386
|
+
if (result.dependencyHealth) {
|
|
387
|
+
output += `\u{1F4E6} Dependency Health: ${result.dependencyHealth.results?.length || 0} issues
|
|
366
388
|
`;
|
|
367
389
|
}
|
|
368
390
|
if (result.aiSignalClarity) {
|
|
369
391
|
output += `\u{1F9E0} AI Signal Clarity: ${result.aiSignalClarity.summary?.totalSignals || 0} signals
|
|
370
392
|
`;
|
|
371
393
|
}
|
|
372
|
-
if (result.
|
|
373
|
-
output += `\u{1F9ED} Agent Grounding: ${result.
|
|
394
|
+
if (result.agentGrounding) {
|
|
395
|
+
output += `\u{1F9ED} Agent Grounding: ${result.agentGrounding.results?.length || 0} issues
|
|
374
396
|
`;
|
|
375
397
|
}
|
|
376
398
|
if (result.testability) {
|
|
377
|
-
output += `\u{1F9EA} Testability Index: ${result.testability.
|
|
399
|
+
output += `\u{1F9EA} Testability Index: ${result.testability.results?.length || 0} issues
|
|
378
400
|
`;
|
|
379
401
|
}
|
|
380
402
|
if (result.changeAmplification) {
|
|
@@ -9,7 +9,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
9
9
|
import { analyzePatterns } from "@aiready/pattern-detect";
|
|
10
10
|
import { analyzeContext } from "@aiready/context-analyzer";
|
|
11
11
|
import { analyzeConsistency } from "@aiready/consistency";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
calculateOverallScore,
|
|
14
|
+
calculateTokenBudget
|
|
15
|
+
} from "@aiready/core";
|
|
13
16
|
var severityOrder = {
|
|
14
17
|
critical: 4,
|
|
15
18
|
major: 3,
|
|
@@ -57,8 +60,11 @@ async function analyzeUnified(options) {
|
|
|
57
60
|
if (options.progressCallback) {
|
|
58
61
|
options.progressCallback({ tool: "patterns", data: patternResult });
|
|
59
62
|
}
|
|
60
|
-
result.
|
|
61
|
-
|
|
63
|
+
result.patternDetect = {
|
|
64
|
+
results: sortBySeverity(patternResult.results),
|
|
65
|
+
summary: patternResult.summary || {},
|
|
66
|
+
duplicates: patternResult.duplicates || []
|
|
67
|
+
};
|
|
62
68
|
result.summary.totalIssues += patternResult.results.reduce(
|
|
63
69
|
(sum, file) => sum + file.issues.length,
|
|
64
70
|
0
|
|
@@ -69,13 +75,18 @@ async function analyzeUnified(options) {
|
|
|
69
75
|
if (options.progressCallback) {
|
|
70
76
|
options.progressCallback({ tool: "context", data: contextResults });
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
const sorted = contextResults.sort((a, b) => {
|
|
73
79
|
const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
|
|
74
80
|
if (severityDiff !== 0) return severityDiff;
|
|
75
81
|
if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
|
|
76
82
|
return b.fragmentationScore - a.fragmentationScore;
|
|
77
83
|
});
|
|
78
|
-
|
|
84
|
+
const { generateSummary: genContextSummary } = await import("@aiready/context-analyzer");
|
|
85
|
+
result.contextAnalyzer = {
|
|
86
|
+
results: sorted,
|
|
87
|
+
summary: genContextSummary(sorted)
|
|
88
|
+
};
|
|
89
|
+
result.summary.totalIssues += sorted.length;
|
|
79
90
|
}
|
|
80
91
|
if (tools.includes("consistency")) {
|
|
81
92
|
const consistencyOptions = {
|
|
@@ -88,10 +99,10 @@ async function analyzeUnified(options) {
|
|
|
88
99
|
if (options.progressCallback) {
|
|
89
100
|
options.progressCallback({ tool: "consistency", data: report });
|
|
90
101
|
}
|
|
91
|
-
|
|
92
|
-
report.results
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
result.consistency = {
|
|
103
|
+
results: report.results ? sortBySeverity(report.results) : [],
|
|
104
|
+
summary: report.summary
|
|
105
|
+
};
|
|
95
106
|
result.summary.totalIssues += report.summary.totalIssues;
|
|
96
107
|
}
|
|
97
108
|
if (tools.includes("doc-drift")) {
|
|
@@ -105,7 +116,10 @@ async function analyzeUnified(options) {
|
|
|
105
116
|
if (options.progressCallback) {
|
|
106
117
|
options.progressCallback({ tool: "doc-drift", data: report });
|
|
107
118
|
}
|
|
108
|
-
result.docDrift =
|
|
119
|
+
result.docDrift = {
|
|
120
|
+
results: report.results || [],
|
|
121
|
+
summary: report.summary || {}
|
|
122
|
+
};
|
|
109
123
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
110
124
|
}
|
|
111
125
|
if (tools.includes("deps-health")) {
|
|
@@ -119,10 +133,13 @@ async function analyzeUnified(options) {
|
|
|
119
133
|
if (options.progressCallback) {
|
|
120
134
|
options.progressCallback({ tool: "deps-health", data: report });
|
|
121
135
|
}
|
|
122
|
-
result.
|
|
136
|
+
result.dependencyHealth = {
|
|
137
|
+
results: report.results || [],
|
|
138
|
+
summary: report.summary || {}
|
|
139
|
+
};
|
|
123
140
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
124
141
|
}
|
|
125
|
-
if (tools.includes("
|
|
142
|
+
if (tools.includes("ai-signal-clarity")) {
|
|
126
143
|
const { analyzeAiSignalClarity } = await import("@aiready/ai-signal-clarity");
|
|
127
144
|
const report = await analyzeAiSignalClarity({
|
|
128
145
|
rootDir: options.rootDir,
|
|
@@ -131,15 +148,19 @@ async function analyzeUnified(options) {
|
|
|
131
148
|
onProgress: options.onProgress
|
|
132
149
|
});
|
|
133
150
|
if (options.progressCallback) {
|
|
134
|
-
options.progressCallback({ tool: "
|
|
151
|
+
options.progressCallback({ tool: "ai-signal-clarity", data: report });
|
|
135
152
|
}
|
|
136
|
-
result.aiSignalClarity =
|
|
153
|
+
result.aiSignalClarity = {
|
|
154
|
+
...report,
|
|
155
|
+
results: report.results || [],
|
|
156
|
+
summary: report.summary || {}
|
|
157
|
+
};
|
|
137
158
|
result.summary.totalIssues += report.results?.reduce(
|
|
138
159
|
(sum, r) => sum + (r.issues?.length || 0),
|
|
139
160
|
0
|
|
140
161
|
) || 0;
|
|
141
162
|
}
|
|
142
|
-
if (tools.includes("grounding")) {
|
|
163
|
+
if (tools.includes("agent-grounding")) {
|
|
143
164
|
const { analyzeAgentGrounding } = await import("@aiready/agent-grounding");
|
|
144
165
|
const report = await analyzeAgentGrounding({
|
|
145
166
|
rootDir: options.rootDir,
|
|
@@ -148,9 +169,13 @@ async function analyzeUnified(options) {
|
|
|
148
169
|
onProgress: options.onProgress
|
|
149
170
|
});
|
|
150
171
|
if (options.progressCallback) {
|
|
151
|
-
options.progressCallback({ tool: "grounding", data: report });
|
|
172
|
+
options.progressCallback({ tool: "agent-grounding", data: report });
|
|
152
173
|
}
|
|
153
|
-
result.
|
|
174
|
+
result.agentGrounding = {
|
|
175
|
+
...report,
|
|
176
|
+
results: report.results || [],
|
|
177
|
+
summary: report.summary || {}
|
|
178
|
+
};
|
|
154
179
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
155
180
|
}
|
|
156
181
|
if (tools.includes("testability")) {
|
|
@@ -164,10 +189,14 @@ async function analyzeUnified(options) {
|
|
|
164
189
|
if (options.progressCallback) {
|
|
165
190
|
options.progressCallback({ tool: "testability", data: report });
|
|
166
191
|
}
|
|
167
|
-
result.testability =
|
|
192
|
+
result.testability = {
|
|
193
|
+
...report,
|
|
194
|
+
results: report.results || [],
|
|
195
|
+
summary: report.summary || {}
|
|
196
|
+
};
|
|
168
197
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
169
198
|
}
|
|
170
|
-
if (tools.includes("
|
|
199
|
+
if (tools.includes("change-amplification")) {
|
|
171
200
|
const { analyzeChangeAmplification } = await import("@aiready/change-amplification");
|
|
172
201
|
const report = await analyzeChangeAmplification({
|
|
173
202
|
rootDir: options.rootDir,
|
|
@@ -176,9 +205,12 @@ async function analyzeUnified(options) {
|
|
|
176
205
|
onProgress: options.onProgress
|
|
177
206
|
});
|
|
178
207
|
if (options.progressCallback) {
|
|
179
|
-
options.progressCallback({ tool: "
|
|
208
|
+
options.progressCallback({ tool: "change-amplification", data: report });
|
|
180
209
|
}
|
|
181
|
-
result.changeAmplification =
|
|
210
|
+
result.changeAmplification = {
|
|
211
|
+
results: report.results || [],
|
|
212
|
+
summary: report.summary || {}
|
|
213
|
+
};
|
|
182
214
|
result.summary.totalIssues += report.summary?.totalIssues || 0;
|
|
183
215
|
}
|
|
184
216
|
result.summary.executionTime = Date.now() - startTime;
|
|
@@ -186,14 +218,14 @@ async function analyzeUnified(options) {
|
|
|
186
218
|
}
|
|
187
219
|
async function scoreUnified(results, options) {
|
|
188
220
|
const toolScores = /* @__PURE__ */ new Map();
|
|
189
|
-
if (results.
|
|
221
|
+
if (results.patternDetect) {
|
|
190
222
|
const { calculatePatternScore } = await import("@aiready/pattern-detect");
|
|
191
223
|
try {
|
|
192
224
|
const patternScore = calculatePatternScore(
|
|
193
|
-
results.duplicates,
|
|
194
|
-
results.
|
|
225
|
+
results.patternDetect.duplicates,
|
|
226
|
+
results.patternDetect.results?.length || 0
|
|
195
227
|
);
|
|
196
|
-
const wastedTokens = results.duplicates.reduce(
|
|
228
|
+
const wastedTokens = results.patternDetect.duplicates.reduce(
|
|
197
229
|
(sum, d) => sum + (d.tokenCost || 0),
|
|
198
230
|
0
|
|
199
231
|
);
|
|
@@ -211,10 +243,10 @@ async function scoreUnified(results, options) {
|
|
|
211
243
|
void err;
|
|
212
244
|
}
|
|
213
245
|
}
|
|
214
|
-
if (results.
|
|
215
|
-
const {
|
|
246
|
+
if (results.contextAnalyzer) {
|
|
247
|
+
const { calculateContextScore } = await import("@aiready/context-analyzer");
|
|
216
248
|
try {
|
|
217
|
-
const ctxSummary =
|
|
249
|
+
const ctxSummary = results.contextAnalyzer.summary;
|
|
218
250
|
const contextScore = calculateContextScore(ctxSummary);
|
|
219
251
|
contextScore.tokenBudget = calculateTokenBudget({
|
|
220
252
|
totalContextTokens: ctxSummary.totalTokens,
|
|
@@ -249,10 +281,10 @@ async function scoreUnified(results, options) {
|
|
|
249
281
|
void err;
|
|
250
282
|
}
|
|
251
283
|
}
|
|
252
|
-
if (results.
|
|
284
|
+
if (results.agentGrounding) {
|
|
253
285
|
const { calculateGroundingScore } = await import("@aiready/agent-grounding");
|
|
254
286
|
try {
|
|
255
|
-
const agScore = calculateGroundingScore(results.
|
|
287
|
+
const agScore = calculateGroundingScore(results.agentGrounding);
|
|
256
288
|
toolScores.set("agent-grounding", agScore);
|
|
257
289
|
} catch (err) {
|
|
258
290
|
void err;
|
|
@@ -270,10 +302,10 @@ async function scoreUnified(results, options) {
|
|
|
270
302
|
if (results.docDrift) {
|
|
271
303
|
toolScores.set("doc-drift", {
|
|
272
304
|
toolName: "doc-drift",
|
|
273
|
-
score: results.docDrift.summary.score,
|
|
274
|
-
rawMetrics: results.docDrift.
|
|
305
|
+
score: results.docDrift.summary.score || results.docDrift.summary.totalScore || 0,
|
|
306
|
+
rawMetrics: results.docDrift.summary,
|
|
275
307
|
factors: [],
|
|
276
|
-
recommendations: (results.docDrift.recommendations || []).map(
|
|
308
|
+
recommendations: (results.docDrift.summary.recommendations || []).map(
|
|
277
309
|
(action) => ({
|
|
278
310
|
action,
|
|
279
311
|
estimatedImpact: 5,
|
|
@@ -282,34 +314,30 @@ async function scoreUnified(results, options) {
|
|
|
282
314
|
)
|
|
283
315
|
});
|
|
284
316
|
}
|
|
285
|
-
if (results.
|
|
317
|
+
if (results.dependencyHealth) {
|
|
286
318
|
toolScores.set("dependency-health", {
|
|
287
319
|
toolName: "dependency-health",
|
|
288
|
-
score: results.
|
|
289
|
-
rawMetrics: results.
|
|
320
|
+
score: results.dependencyHealth.summary.score || 0,
|
|
321
|
+
rawMetrics: results.dependencyHealth.summary,
|
|
290
322
|
factors: [],
|
|
291
|
-
recommendations: (results.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
})
|
|
297
|
-
)
|
|
323
|
+
recommendations: (results.dependencyHealth.summary.recommendations || []).map((action) => ({
|
|
324
|
+
action,
|
|
325
|
+
estimatedImpact: 5,
|
|
326
|
+
priority: "medium"
|
|
327
|
+
}))
|
|
298
328
|
});
|
|
299
329
|
}
|
|
300
330
|
if (results.changeAmplification) {
|
|
301
331
|
toolScores.set("change-amplification", {
|
|
302
332
|
toolName: "change-amplification",
|
|
303
|
-
score: results.changeAmplification.summary.score,
|
|
304
|
-
rawMetrics: results.changeAmplification.
|
|
333
|
+
score: results.changeAmplification.summary.score || 0,
|
|
334
|
+
rawMetrics: results.changeAmplification.summary,
|
|
305
335
|
factors: [],
|
|
306
|
-
recommendations: (results.changeAmplification.recommendations || []).map(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
})
|
|
312
|
-
)
|
|
336
|
+
recommendations: (results.changeAmplification.summary.recommendations || []).map((action) => ({
|
|
337
|
+
action,
|
|
338
|
+
estimatedImpact: 5,
|
|
339
|
+
priority: "medium"
|
|
340
|
+
}))
|
|
313
341
|
});
|
|
314
342
|
}
|
|
315
343
|
if (toolScores.size === 0) {
|
|
@@ -342,12 +370,12 @@ function generateUnifiedSummary(result) {
|
|
|
342
370
|
output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
|
|
343
371
|
|
|
344
372
|
`;
|
|
345
|
-
if (result.
|
|
346
|
-
output += `\u{1F50D} Pattern Analysis: ${result.
|
|
373
|
+
if (result.patternDetect) {
|
|
374
|
+
output += `\u{1F50D} Pattern Analysis: ${result.patternDetect.results.length} issues
|
|
347
375
|
`;
|
|
348
376
|
}
|
|
349
|
-
if (result.
|
|
350
|
-
output += `\u{1F9E0} Context Analysis: ${result.
|
|
377
|
+
if (result.contextAnalyzer) {
|
|
378
|
+
output += `\u{1F9E0} Context Analysis: ${result.contextAnalyzer.results.length} issues
|
|
351
379
|
`;
|
|
352
380
|
}
|
|
353
381
|
if (result.consistency) {
|
|
@@ -355,23 +383,23 @@ function generateUnifiedSummary(result) {
|
|
|
355
383
|
`;
|
|
356
384
|
}
|
|
357
385
|
if (result.docDrift) {
|
|
358
|
-
output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.
|
|
386
|
+
output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.results?.length || 0} issues
|
|
359
387
|
`;
|
|
360
388
|
}
|
|
361
|
-
if (result.
|
|
362
|
-
output += `\u{1F4E6} Dependency Health: ${result.
|
|
389
|
+
if (result.dependencyHealth) {
|
|
390
|
+
output += `\u{1F4E6} Dependency Health: ${result.dependencyHealth.results?.length || 0} issues
|
|
363
391
|
`;
|
|
364
392
|
}
|
|
365
393
|
if (result.aiSignalClarity) {
|
|
366
394
|
output += `\u{1F9E0} AI Signal Clarity: ${result.aiSignalClarity.summary?.totalSignals || 0} signals
|
|
367
395
|
`;
|
|
368
396
|
}
|
|
369
|
-
if (result.
|
|
370
|
-
output += `\u{1F9ED} Agent Grounding: ${result.
|
|
397
|
+
if (result.agentGrounding) {
|
|
398
|
+
output += `\u{1F9ED} Agent Grounding: ${result.agentGrounding.results?.length || 0} issues
|
|
371
399
|
`;
|
|
372
400
|
}
|
|
373
401
|
if (result.testability) {
|
|
374
|
-
output += `\u{1F9EA} Testability Index: ${result.testability.
|
|
402
|
+
output += `\u{1F9EA} Testability Index: ${result.testability.results?.length || 0} issues
|
|
375
403
|
`;
|
|
376
404
|
}
|
|
377
405
|
if (result.changeAmplification) {
|