@aiready/cli 0.10.6 → 0.12.1
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-lint.log +9 -1
- package/.turbo/turbo-test.log +43 -4
- package/dist/chunk-LTUQDJPO.mjs +229 -0
- package/dist/chunk-N56YAZVN.mjs +194 -0
- package/dist/chunk-YBZKPKW3.mjs +161 -0
- package/dist/cli.js +237 -910
- package/dist/cli.mjs +92 -584
- package/dist/index.js +149 -369
- package/dist/index.mjs +1 -1
- package/package.json +12 -12
- package/src/.aiready/aiready-report-20260307-092852.json +50609 -0
- package/src/.aiready/aiready-report-20260307-094301.json +50609 -0
- package/src/.aiready/aiready-report-20260307-094831.json +50609 -0
- package/src/.aiready/aiready-report-20260307-100539.json +50609 -0
- package/src/.aiready/aiready-report-20260307-103508.json +51329 -0
- package/src/__tests__/cli.test.ts +55 -29
- package/src/commands/scan.ts +116 -700
- package/src/index.ts +191 -455
- package/dist/chunk-EQ2HQSTJ.mjs +0 -414
- package/dist/chunk-R3O7QPKD.mjs +0 -419
- package/dist/chunk-VQCWYJYJ.mjs +0 -438
- package/dist/chunk-VUCNUYI7.mjs +0 -417
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
@@ -35,357 +25,172 @@ __export(index_exports, {
|
|
|
35
25
|
scoreUnified: () => scoreUnified
|
|
36
26
|
});
|
|
37
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
var import_core = require("@aiready/core");
|
|
38
29
|
var import_pattern_detect = require("@aiready/pattern-detect");
|
|
39
30
|
var import_context_analyzer = require("@aiready/context-analyzer");
|
|
40
31
|
var import_consistency = require("@aiready/consistency");
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
var import_ai_signal_clarity = require("@aiready/ai-signal-clarity");
|
|
33
|
+
var import_agent_grounding = require("@aiready/agent-grounding");
|
|
34
|
+
var import_testability = require("@aiready/testability");
|
|
35
|
+
var import_doc_drift = require("@aiready/doc-drift");
|
|
36
|
+
var import_deps = require("@aiready/deps");
|
|
37
|
+
var import_change_amplification = require("@aiready/change-amplification");
|
|
38
|
+
var TOOL_PACKAGE_MAP = {
|
|
39
|
+
[import_core.ToolName.PatternDetect]: "@aiready/pattern-detect",
|
|
40
|
+
[import_core.ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
|
|
41
|
+
[import_core.ToolName.NamingConsistency]: "@aiready/consistency",
|
|
42
|
+
[import_core.ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
|
|
43
|
+
[import_core.ToolName.AgentGrounding]: "@aiready/agent-grounding",
|
|
44
|
+
[import_core.ToolName.TestabilityIndex]: "@aiready/testability",
|
|
45
|
+
[import_core.ToolName.DocDrift]: "@aiready/doc-drift",
|
|
46
|
+
[import_core.ToolName.DependencyHealth]: "@aiready/deps",
|
|
47
|
+
[import_core.ToolName.ChangeAmplification]: "@aiready/change-amplification",
|
|
48
|
+
// Aliases handled by registry
|
|
49
|
+
patterns: "@aiready/pattern-detect",
|
|
50
|
+
duplicates: "@aiready/pattern-detect",
|
|
51
|
+
context: "@aiready/context-analyzer",
|
|
52
|
+
fragmentation: "@aiready/context-analyzer",
|
|
53
|
+
consistency: "@aiready/consistency",
|
|
54
|
+
"naming-consistency": "@aiready/consistency",
|
|
55
|
+
"ai-signal": "@aiready/ai-signal-clarity",
|
|
56
|
+
"ai-signal-clarity": "@aiready/ai-signal-clarity",
|
|
57
|
+
grounding: "@aiready/agent-grounding",
|
|
58
|
+
"agent-grounding": "@aiready/agent-grounding",
|
|
59
|
+
testability: "@aiready/testability",
|
|
60
|
+
"testability-index": "@aiready/testability",
|
|
61
|
+
"doc-drift": "@aiready/doc-drift",
|
|
62
|
+
"deps-health": "@aiready/deps",
|
|
63
|
+
"dependency-health": "@aiready/deps",
|
|
64
|
+
"change-amp": "@aiready/change-amplification",
|
|
65
|
+
"change-amplification": "@aiready/change-amplification"
|
|
47
66
|
};
|
|
48
|
-
function sortBySeverity(results) {
|
|
49
|
-
return results.map((file) => {
|
|
50
|
-
const sortedIssues = [...file.issues].sort((a, b) => {
|
|
51
|
-
const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
|
|
52
|
-
if (severityDiff !== 0) return severityDiff;
|
|
53
|
-
return (a.location?.line || 0) - (b.location?.line || 0);
|
|
54
|
-
});
|
|
55
|
-
return { ...file, issues: sortedIssues };
|
|
56
|
-
}).sort((a, b) => {
|
|
57
|
-
const aMaxSeverity = Math.max(
|
|
58
|
-
...a.issues.map((i) => severityOrder[i.severity] || 0),
|
|
59
|
-
0
|
|
60
|
-
);
|
|
61
|
-
const bMaxSeverity = Math.max(
|
|
62
|
-
...b.issues.map((i) => severityOrder[i.severity] || 0),
|
|
63
|
-
0
|
|
64
|
-
);
|
|
65
|
-
if (aMaxSeverity !== bMaxSeverity) {
|
|
66
|
-
return bMaxSeverity - aMaxSeverity;
|
|
67
|
-
}
|
|
68
|
-
if (a.issues.length !== b.issues.length) {
|
|
69
|
-
return b.issues.length - a.issues.length;
|
|
70
|
-
}
|
|
71
|
-
return a.fileName.localeCompare(b.fileName);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
67
|
async function analyzeUnified(options) {
|
|
75
68
|
const startTime = Date.now();
|
|
76
|
-
const
|
|
69
|
+
const requestedTools = options.tools || [
|
|
70
|
+
"patterns",
|
|
71
|
+
"context",
|
|
72
|
+
"consistency"
|
|
73
|
+
];
|
|
77
74
|
const result = {
|
|
78
75
|
summary: {
|
|
79
76
|
totalIssues: 0,
|
|
80
|
-
toolsRun:
|
|
77
|
+
toolsRun: [],
|
|
81
78
|
executionTime: 0
|
|
82
79
|
}
|
|
83
80
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const sorted = contextResults.sort((a, b) => {
|
|
107
|
-
const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
|
|
108
|
-
if (severityDiff !== 0) return severityDiff;
|
|
109
|
-
if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
|
|
110
|
-
return b.fragmentationScore - a.fragmentationScore;
|
|
111
|
-
});
|
|
112
|
-
const { generateSummary: genContextSummary } = await import("@aiready/context-analyzer");
|
|
113
|
-
const output = {
|
|
114
|
-
results: sorted,
|
|
115
|
-
summary: genContextSummary(sorted)
|
|
116
|
-
};
|
|
117
|
-
result[import_core.ToolName.ContextAnalyzer] = output;
|
|
118
|
-
result.contextAnalyzer = output;
|
|
119
|
-
result.summary.totalIssues += sorted.length;
|
|
120
|
-
}
|
|
121
|
-
if (tools.includes("consistency")) {
|
|
122
|
-
const consistencyOptions = {
|
|
123
|
-
rootDir: options.rootDir,
|
|
124
|
-
include: options.include,
|
|
125
|
-
exclude: options.exclude,
|
|
126
|
-
...options.consistency || {}
|
|
127
|
-
};
|
|
128
|
-
const report = await (0, import_consistency.analyzeConsistency)(consistencyOptions);
|
|
129
|
-
if (options.progressCallback) {
|
|
130
|
-
options.progressCallback({ tool: "consistency", data: report });
|
|
131
|
-
}
|
|
132
|
-
result[import_core.ToolName.NamingConsistency] = {
|
|
133
|
-
results: report.results ? sortBySeverity(report.results) : [],
|
|
134
|
-
summary: report.summary
|
|
135
|
-
};
|
|
136
|
-
result.summary.totalIssues += report.summary.totalIssues;
|
|
137
|
-
}
|
|
138
|
-
if (tools.includes("doc-drift")) {
|
|
139
|
-
const { analyzeDocDrift } = await import("@aiready/doc-drift");
|
|
140
|
-
const report = await analyzeDocDrift({
|
|
141
|
-
rootDir: options.rootDir,
|
|
142
|
-
include: options.include,
|
|
143
|
-
exclude: options.exclude,
|
|
144
|
-
onProgress: options.onProgress
|
|
145
|
-
});
|
|
146
|
-
if (options.progressCallback) {
|
|
147
|
-
options.progressCallback({ tool: "doc-drift", data: report });
|
|
148
|
-
}
|
|
149
|
-
result[import_core.ToolName.DocDrift] = {
|
|
150
|
-
results: report.results || report.issues || [],
|
|
151
|
-
summary: report.summary || {}
|
|
152
|
-
};
|
|
153
|
-
const issueCount = report.issues?.length || (report.results ? report.results.length : 0);
|
|
154
|
-
result.summary.totalIssues += issueCount;
|
|
155
|
-
}
|
|
156
|
-
if (tools.includes("deps-health")) {
|
|
157
|
-
const { analyzeDeps } = await import("@aiready/deps");
|
|
158
|
-
const report = await analyzeDeps({
|
|
159
|
-
rootDir: options.rootDir,
|
|
160
|
-
include: options.include,
|
|
161
|
-
exclude: options.exclude,
|
|
162
|
-
onProgress: options.onProgress
|
|
163
|
-
});
|
|
164
|
-
if (options.progressCallback) {
|
|
165
|
-
options.progressCallback({ tool: "deps-health", data: report });
|
|
166
|
-
}
|
|
167
|
-
result[import_core.ToolName.DependencyHealth] = {
|
|
168
|
-
results: report.results || report.issues || [],
|
|
169
|
-
summary: report.summary || {}
|
|
170
|
-
};
|
|
171
|
-
const issueCount = report.issues?.length || (report.results ? report.results.length : 0);
|
|
172
|
-
result.summary.totalIssues += issueCount;
|
|
173
|
-
}
|
|
174
|
-
if (tools.includes("ai-signal-clarity")) {
|
|
175
|
-
const { analyzeAiSignalClarity } = await import("@aiready/ai-signal-clarity");
|
|
176
|
-
const report = await analyzeAiSignalClarity({
|
|
177
|
-
rootDir: options.rootDir,
|
|
178
|
-
include: options.include,
|
|
179
|
-
exclude: options.exclude,
|
|
180
|
-
onProgress: options.onProgress
|
|
181
|
-
});
|
|
182
|
-
if (options.progressCallback) {
|
|
183
|
-
options.progressCallback({ tool: "ai-signal-clarity", data: report });
|
|
184
|
-
}
|
|
185
|
-
result[import_core.ToolName.AiSignalClarity] = {
|
|
186
|
-
...report,
|
|
187
|
-
results: report.results || report.issues || [],
|
|
188
|
-
summary: report.summary || {}
|
|
189
|
-
};
|
|
190
|
-
result.summary.totalIssues += (report.results || report.issues)?.reduce(
|
|
191
|
-
(sum, r) => sum + (r.issues?.length || 1),
|
|
192
|
-
0
|
|
193
|
-
) || 0;
|
|
194
|
-
}
|
|
195
|
-
if (tools.includes("agent-grounding")) {
|
|
196
|
-
const { analyzeAgentGrounding } = await import("@aiready/agent-grounding");
|
|
197
|
-
const report = await analyzeAgentGrounding({
|
|
198
|
-
rootDir: options.rootDir,
|
|
199
|
-
include: options.include,
|
|
200
|
-
exclude: options.exclude,
|
|
201
|
-
onProgress: options.onProgress
|
|
202
|
-
});
|
|
203
|
-
if (options.progressCallback) {
|
|
204
|
-
options.progressCallback({ tool: "agent-grounding", data: report });
|
|
205
|
-
}
|
|
206
|
-
result[import_core.ToolName.AgentGrounding] = {
|
|
207
|
-
...report,
|
|
208
|
-
results: report.results || report.issues || [],
|
|
209
|
-
summary: report.summary || {}
|
|
210
|
-
};
|
|
211
|
-
result.summary.totalIssues += (report.issues || report.results || []).length;
|
|
212
|
-
}
|
|
213
|
-
if (tools.includes("testability")) {
|
|
214
|
-
const { analyzeTestability } = await import("@aiready/testability");
|
|
215
|
-
const report = await analyzeTestability({
|
|
216
|
-
rootDir: options.rootDir,
|
|
217
|
-
include: options.include,
|
|
218
|
-
exclude: options.exclude,
|
|
219
|
-
onProgress: options.onProgress
|
|
220
|
-
});
|
|
221
|
-
if (options.progressCallback) {
|
|
222
|
-
options.progressCallback({ tool: "testability", data: report });
|
|
223
|
-
}
|
|
224
|
-
result[import_core.ToolName.TestabilityIndex] = {
|
|
225
|
-
...report,
|
|
226
|
-
results: report.results || report.issues || [],
|
|
227
|
-
summary: report.summary || {}
|
|
228
|
-
};
|
|
229
|
-
result.summary.totalIssues += (report.issues || report.results || []).length;
|
|
230
|
-
}
|
|
231
|
-
if (tools.includes("change-amplification")) {
|
|
232
|
-
const { analyzeChangeAmplification } = await import("@aiready/change-amplification");
|
|
233
|
-
const report = await analyzeChangeAmplification({
|
|
234
|
-
rootDir: options.rootDir,
|
|
235
|
-
include: options.include,
|
|
236
|
-
exclude: options.exclude,
|
|
237
|
-
onProgress: options.onProgress
|
|
238
|
-
});
|
|
239
|
-
if (options.progressCallback) {
|
|
240
|
-
options.progressCallback({ tool: "change-amplification", data: report });
|
|
81
|
+
for (const toolName of requestedTools) {
|
|
82
|
+
let provider = import_core.ToolRegistry.find(toolName);
|
|
83
|
+
if (!provider) {
|
|
84
|
+
const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
|
|
85
|
+
try {
|
|
86
|
+
await import(packageName);
|
|
87
|
+
provider = import_core.ToolRegistry.find(toolName);
|
|
88
|
+
if (provider) {
|
|
89
|
+
console.log(
|
|
90
|
+
`\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`
|
|
91
|
+
);
|
|
92
|
+
} else {
|
|
93
|
+
console.log(
|
|
94
|
+
`\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.log(
|
|
99
|
+
`\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
|
|
100
|
+
err.message
|
|
101
|
+
);
|
|
102
|
+
}
|
|
241
103
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
};
|
|
246
|
-
result.summary.totalIssues += report.summary?.totalIssues || 0;
|
|
247
|
-
}
|
|
248
|
-
result.summary.executionTime = Date.now() - startTime;
|
|
249
|
-
return result;
|
|
250
|
-
}
|
|
251
|
-
async function scoreUnified(results, options) {
|
|
252
|
-
const toolScores = /* @__PURE__ */ new Map();
|
|
253
|
-
if (results[import_core.ToolName.PatternDetect]) {
|
|
254
|
-
const data = results[import_core.ToolName.PatternDetect];
|
|
255
|
-
const { calculatePatternScore } = await import("@aiready/pattern-detect");
|
|
256
|
-
try {
|
|
257
|
-
const patternScore = calculatePatternScore(
|
|
258
|
-
data.duplicates,
|
|
259
|
-
data.results?.length || 0
|
|
260
|
-
);
|
|
261
|
-
const wastedTokens = data.duplicates.reduce(
|
|
262
|
-
(sum, d) => sum + (d.tokenCost || 0),
|
|
263
|
-
0
|
|
104
|
+
if (!provider) {
|
|
105
|
+
console.warn(
|
|
106
|
+
`\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
|
|
264
107
|
);
|
|
265
|
-
|
|
266
|
-
totalContextTokens: wastedTokens * 2,
|
|
267
|
-
// Estimated context
|
|
268
|
-
wastedTokens: {
|
|
269
|
-
duplication: wastedTokens,
|
|
270
|
-
fragmentation: 0,
|
|
271
|
-
chattiness: 0
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
toolScores.set(import_core.ToolName.PatternDetect, patternScore);
|
|
275
|
-
} catch (err) {
|
|
276
|
-
void err;
|
|
108
|
+
continue;
|
|
277
109
|
}
|
|
278
|
-
}
|
|
279
|
-
if (results[import_core.ToolName.ContextAnalyzer]) {
|
|
280
|
-
const data = results[import_core.ToolName.ContextAnalyzer];
|
|
281
|
-
const { calculateContextScore } = await import("@aiready/context-analyzer");
|
|
282
110
|
try {
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
111
|
+
const output = await provider.analyze({
|
|
112
|
+
...options,
|
|
113
|
+
onProgress: (processed, total, message) => {
|
|
114
|
+
if (options.progressCallback) {
|
|
115
|
+
options.progressCallback({
|
|
116
|
+
tool: provider.id,
|
|
117
|
+
processed,
|
|
118
|
+
total,
|
|
119
|
+
message
|
|
120
|
+
});
|
|
121
|
+
}
|
|
291
122
|
}
|
|
292
123
|
});
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
try {
|
|
302
|
-
const issues = data.results?.flatMap((r) => r.issues) || [];
|
|
303
|
-
const totalFiles = data.summary?.filesAnalyzed || 0;
|
|
304
|
-
const consistencyScore = calculateConsistencyScore(issues, totalFiles);
|
|
305
|
-
toolScores.set(import_core.ToolName.NamingConsistency, consistencyScore);
|
|
306
|
-
} catch (err) {
|
|
307
|
-
void err;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
if (results[import_core.ToolName.AiSignalClarity]) {
|
|
311
|
-
const { calculateAiSignalClarityScore } = await import("@aiready/ai-signal-clarity");
|
|
312
|
-
try {
|
|
313
|
-
const hrScore = calculateAiSignalClarityScore(
|
|
314
|
-
results[import_core.ToolName.AiSignalClarity]
|
|
124
|
+
if (options.progressCallback) {
|
|
125
|
+
options.progressCallback({ tool: provider.id, data: output });
|
|
126
|
+
}
|
|
127
|
+
result[provider.id] = output;
|
|
128
|
+
result.summary.toolsRun.push(provider.id);
|
|
129
|
+
const issueCount = output.results.reduce(
|
|
130
|
+
(sum, file) => sum + (file.issues?.length || 0),
|
|
131
|
+
0
|
|
315
132
|
);
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const
|
|
325
|
-
|
|
133
|
+
result.summary.totalIssues += issueCount;
|
|
134
|
+
if (provider.alias && Array.isArray(provider.alias)) {
|
|
135
|
+
for (const alias of provider.alias) {
|
|
136
|
+
if (!result[alias]) {
|
|
137
|
+
result[alias] = output;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const camelCaseId = provider.id.replace(
|
|
142
|
+
/-([a-z])/g,
|
|
143
|
+
(g) => g[1].toUpperCase()
|
|
144
|
+
);
|
|
145
|
+
if (camelCaseId !== provider.id && !result[camelCaseId]) {
|
|
146
|
+
result[camelCaseId] = output;
|
|
147
|
+
}
|
|
326
148
|
} catch (err) {
|
|
327
|
-
|
|
149
|
+
console.error(`\u274C Error running tool '${provider.id}':`, err);
|
|
328
150
|
}
|
|
329
151
|
}
|
|
330
|
-
|
|
331
|
-
|
|
152
|
+
result.summary.executionTime = Date.now() - startTime;
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
async function scoreUnified(results, options) {
|
|
156
|
+
const toolScores = /* @__PURE__ */ new Map();
|
|
157
|
+
for (const toolId of results.summary.toolsRun) {
|
|
158
|
+
const provider = import_core.ToolRegistry.get(toolId);
|
|
159
|
+
if (!provider) continue;
|
|
160
|
+
const output = results[toolId];
|
|
161
|
+
if (!output) continue;
|
|
332
162
|
try {
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
163
|
+
const toolScore = provider.score(output, options);
|
|
164
|
+
if (!toolScore.tokenBudget) {
|
|
165
|
+
if (toolId === import_core.ToolName.PatternDetect && output.duplicates) {
|
|
166
|
+
const wastedTokens = output.duplicates.reduce(
|
|
167
|
+
(sum, d) => sum + (d.tokenCost || 0),
|
|
168
|
+
0
|
|
169
|
+
);
|
|
170
|
+
toolScore.tokenBudget = (0, import_core.calculateTokenBudget)({
|
|
171
|
+
totalContextTokens: wastedTokens * 2,
|
|
172
|
+
wastedTokens: {
|
|
173
|
+
duplication: wastedTokens,
|
|
174
|
+
fragmentation: 0,
|
|
175
|
+
chattiness: 0
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
} else if (toolId === import_core.ToolName.ContextAnalyzer && output.summary) {
|
|
179
|
+
toolScore.tokenBudget = (0, import_core.calculateTokenBudget)({
|
|
180
|
+
totalContextTokens: output.summary.totalTokens,
|
|
181
|
+
wastedTokens: {
|
|
182
|
+
duplication: 0,
|
|
183
|
+
fragmentation: output.summary.totalPotentialSavings || 0,
|
|
184
|
+
chattiness: 0
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
toolScores.set(toolId, toolScore);
|
|
337
190
|
} catch (err) {
|
|
338
|
-
|
|
191
|
+
console.error(`\u274C Error scoring tool '${toolId}':`, err);
|
|
339
192
|
}
|
|
340
193
|
}
|
|
341
|
-
if (results[import_core.ToolName.DocDrift]) {
|
|
342
|
-
const data = results[import_core.ToolName.DocDrift];
|
|
343
|
-
toolScores.set(import_core.ToolName.DocDrift, {
|
|
344
|
-
toolName: import_core.ToolName.DocDrift,
|
|
345
|
-
score: data.summary.score || data.summary.totalScore || 0,
|
|
346
|
-
rawMetrics: data.summary,
|
|
347
|
-
factors: [],
|
|
348
|
-
recommendations: (data.summary.recommendations || []).map(
|
|
349
|
-
(action) => ({
|
|
350
|
-
action,
|
|
351
|
-
estimatedImpact: 5,
|
|
352
|
-
priority: "medium"
|
|
353
|
-
})
|
|
354
|
-
)
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
if (results[import_core.ToolName.DependencyHealth]) {
|
|
358
|
-
const data = results[import_core.ToolName.DependencyHealth];
|
|
359
|
-
toolScores.set(import_core.ToolName.DependencyHealth, {
|
|
360
|
-
toolName: import_core.ToolName.DependencyHealth,
|
|
361
|
-
score: data.summary.score || 0,
|
|
362
|
-
rawMetrics: data.summary,
|
|
363
|
-
factors: [],
|
|
364
|
-
recommendations: (data.summary.recommendations || []).map(
|
|
365
|
-
(action) => ({
|
|
366
|
-
action,
|
|
367
|
-
estimatedImpact: 5,
|
|
368
|
-
priority: "medium"
|
|
369
|
-
})
|
|
370
|
-
)
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
if (results[import_core.ToolName.ChangeAmplification]) {
|
|
374
|
-
const data = results[import_core.ToolName.ChangeAmplification];
|
|
375
|
-
toolScores.set(import_core.ToolName.ChangeAmplification, {
|
|
376
|
-
toolName: import_core.ToolName.ChangeAmplification,
|
|
377
|
-
score: data.summary.score || 0,
|
|
378
|
-
rawMetrics: data.summary,
|
|
379
|
-
factors: [],
|
|
380
|
-
recommendations: (data.summary.recommendations || []).map(
|
|
381
|
-
(action) => ({
|
|
382
|
-
action,
|
|
383
|
-
estimatedImpact: 5,
|
|
384
|
-
priority: "medium"
|
|
385
|
-
})
|
|
386
|
-
)
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
194
|
if (toolScores.size === 0) {
|
|
390
195
|
return {
|
|
391
196
|
overall: 0,
|
|
@@ -416,41 +221,16 @@ function generateUnifiedSummary(result) {
|
|
|
416
221
|
output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
|
|
417
222
|
|
|
418
223
|
`;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
if (result[import_core.ToolName.NamingConsistency]) {
|
|
428
|
-
output += `\u{1F3F7}\uFE0F Consistency Analysis: ${result[import_core.ToolName.NamingConsistency].summary.totalIssues} issues
|
|
429
|
-
`;
|
|
430
|
-
}
|
|
431
|
-
if (result[import_core.ToolName.DocDrift]) {
|
|
432
|
-
output += `\u{1F4DD} Doc Drift Analysis: ${result[import_core.ToolName.DocDrift].results?.length || 0} issues
|
|
433
|
-
`;
|
|
434
|
-
}
|
|
435
|
-
if (result[import_core.ToolName.DependencyHealth]) {
|
|
436
|
-
output += `\u{1F4E6} Dependency Health: ${result[import_core.ToolName.DependencyHealth].results?.length || 0} issues
|
|
437
|
-
`;
|
|
438
|
-
}
|
|
439
|
-
if (result[import_core.ToolName.AiSignalClarity]) {
|
|
440
|
-
output += `\u{1F9E0} AI Signal Clarity: ${result[import_core.ToolName.AiSignalClarity].summary?.totalSignals || 0} signals
|
|
441
|
-
`;
|
|
442
|
-
}
|
|
443
|
-
if (result[import_core.ToolName.AgentGrounding]) {
|
|
444
|
-
output += `\u{1F9ED} Agent Grounding: ${result[import_core.ToolName.AgentGrounding].results?.length || 0} issues
|
|
445
|
-
`;
|
|
446
|
-
}
|
|
447
|
-
if (result[import_core.ToolName.TestabilityIndex]) {
|
|
448
|
-
output += `\u{1F9EA} Testability Index: ${result[import_core.ToolName.TestabilityIndex].results?.length || 0} issues
|
|
449
|
-
`;
|
|
450
|
-
}
|
|
451
|
-
if (result[import_core.ToolName.ChangeAmplification]) {
|
|
452
|
-
output += `\u{1F4A5} Change Amplification: ${result[import_core.ToolName.ChangeAmplification].summary?.totalIssues || 0} cascading risks
|
|
224
|
+
for (const provider of import_core.ToolRegistry.getAll()) {
|
|
225
|
+
const toolResult = result[provider.id];
|
|
226
|
+
if (toolResult) {
|
|
227
|
+
const issueCount = toolResult.results.reduce(
|
|
228
|
+
(sum, r) => sum + (r.issues?.length || 0),
|
|
229
|
+
0
|
|
230
|
+
);
|
|
231
|
+
output += `\u2022 ${provider.id}: ${issueCount} issues
|
|
453
232
|
`;
|
|
233
|
+
}
|
|
454
234
|
}
|
|
455
235
|
return output;
|
|
456
236
|
}
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Unified CLI for AIReady analysis tools",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "^5.3.0",
|
|
13
13
|
"commander": "^14.0.0",
|
|
14
|
-
"@aiready/
|
|
15
|
-
"@aiready/
|
|
16
|
-
"@aiready/
|
|
17
|
-
"@aiready/
|
|
18
|
-
"@aiready/
|
|
19
|
-
"@aiready/
|
|
20
|
-
"@aiready/
|
|
21
|
-
"@aiready/visualizer": "0.
|
|
22
|
-
"@aiready/
|
|
23
|
-
"@aiready/
|
|
24
|
-
"@aiready/
|
|
14
|
+
"@aiready/agent-grounding": "0.11.1",
|
|
15
|
+
"@aiready/consistency": "0.18.1",
|
|
16
|
+
"@aiready/context-analyzer": "0.19.1",
|
|
17
|
+
"@aiready/deps": "0.11.1",
|
|
18
|
+
"@aiready/core": "0.21.1",
|
|
19
|
+
"@aiready/testability": "0.4.1",
|
|
20
|
+
"@aiready/pattern-detect": "0.14.1",
|
|
21
|
+
"@aiready/visualizer": "0.4.1",
|
|
22
|
+
"@aiready/change-amplification": "0.11.1",
|
|
23
|
+
"@aiready/ai-signal-clarity": "0.11.1",
|
|
24
|
+
"@aiready/doc-drift": "0.11.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^24.0.0",
|