@aiready/cli 0.9.36 → 0.9.38
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 +9 -16
- package/.turbo/turbo-test.log +4 -4
- package/dist/chunk-JQG7ZATX.mjs +211 -0
- package/dist/cli.js +263 -365
- package/dist/cli.mjs +27 -20
- package/dist/index.js +51 -0
- package/dist/index.mjs +1 -2
- package/package.json +11 -11
- package/src/commands/scan.ts +15 -15
- package/src/index.ts +61 -1
package/dist/cli.js
CHANGED
|
@@ -6,13 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __esm = (fn, res) => function __init() {
|
|
10
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
-
};
|
|
12
|
-
var __export = (target, all) => {
|
|
13
|
-
for (var name in all)
|
|
14
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
-
};
|
|
16
9
|
var __copyProps = (to, from, except, desc) => {
|
|
17
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
11
|
for (let key of __getOwnPropNames(from))
|
|
@@ -30,147 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
23
|
mod
|
|
31
24
|
));
|
|
32
25
|
|
|
33
|
-
// src/commands/hallucination-risk.ts
|
|
34
|
-
var hallucination_risk_exports = {};
|
|
35
|
-
__export(hallucination_risk_exports, {
|
|
36
|
-
hallucinationRiskAction: () => hallucinationRiskAction
|
|
37
|
-
});
|
|
38
|
-
async function hallucinationRiskAction(directory, options) {
|
|
39
|
-
const { analyzeHallucinationRisk, calculateHallucinationScore } = await import("@aiready/hallucination-risk");
|
|
40
|
-
const config = await (0, import_core.loadConfig)(directory);
|
|
41
|
-
const merged = (0, import_core.mergeConfigWithDefaults)(config, {
|
|
42
|
-
minSeverity: "info"
|
|
43
|
-
});
|
|
44
|
-
const report = await analyzeHallucinationRisk({
|
|
45
|
-
rootDir: directory,
|
|
46
|
-
minSeverity: options.minSeverity ?? merged.minSeverity ?? "info",
|
|
47
|
-
include: options.include,
|
|
48
|
-
exclude: options.exclude
|
|
49
|
-
});
|
|
50
|
-
const scoring = calculateHallucinationScore(report);
|
|
51
|
-
if (options.output === "json") {
|
|
52
|
-
return scoring;
|
|
53
|
-
}
|
|
54
|
-
const { summary } = report;
|
|
55
|
-
const ratingColors = {
|
|
56
|
-
minimal: import_chalk2.default.green,
|
|
57
|
-
low: import_chalk2.default.cyan,
|
|
58
|
-
moderate: import_chalk2.default.yellow,
|
|
59
|
-
high: import_chalk2.default.red,
|
|
60
|
-
severe: import_chalk2.default.bgRed.white
|
|
61
|
-
};
|
|
62
|
-
const color = ratingColors[summary.rating] ?? import_chalk2.default.white;
|
|
63
|
-
console.log(` \u{1F9E0} Hallucination Risk: ${import_chalk2.default.bold(scoring.score + "/100")} (${color(summary.rating)})`);
|
|
64
|
-
console.log(` Top Risk: ${import_chalk2.default.italic(summary.topRisk)}`);
|
|
65
|
-
if (summary.totalSignals > 0) {
|
|
66
|
-
console.log(import_chalk2.default.dim(` ${summary.criticalSignals} critical ${summary.majorSignals} major ${summary.minorSignals} minor signals`));
|
|
67
|
-
}
|
|
68
|
-
return scoring;
|
|
69
|
-
}
|
|
70
|
-
var import_chalk2, import_core;
|
|
71
|
-
var init_hallucination_risk = __esm({
|
|
72
|
-
"src/commands/hallucination-risk.ts"() {
|
|
73
|
-
"use strict";
|
|
74
|
-
import_chalk2 = __toESM(require("chalk"));
|
|
75
|
-
import_core = require("@aiready/core");
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// src/commands/agent-grounding.ts
|
|
80
|
-
var agent_grounding_exports = {};
|
|
81
|
-
__export(agent_grounding_exports, {
|
|
82
|
-
agentGroundingAction: () => agentGroundingAction
|
|
83
|
-
});
|
|
84
|
-
async function agentGroundingAction(directory, options) {
|
|
85
|
-
const { analyzeAgentGrounding, calculateGroundingScore } = await import("@aiready/agent-grounding");
|
|
86
|
-
const config = await (0, import_core2.loadConfig)(directory);
|
|
87
|
-
const merged = (0, import_core2.mergeConfigWithDefaults)(config, {
|
|
88
|
-
maxRecommendedDepth: 4,
|
|
89
|
-
readmeStaleDays: 90
|
|
90
|
-
});
|
|
91
|
-
const report = await analyzeAgentGrounding({
|
|
92
|
-
rootDir: directory,
|
|
93
|
-
maxRecommendedDepth: options.maxDepth ?? merged.maxRecommendedDepth,
|
|
94
|
-
readmeStaleDays: options.readmeStaleDays ?? merged.readmeStaleDays,
|
|
95
|
-
include: options.include,
|
|
96
|
-
exclude: options.exclude
|
|
97
|
-
});
|
|
98
|
-
const scoring = calculateGroundingScore(report);
|
|
99
|
-
if (options.output === "json") {
|
|
100
|
-
return scoring;
|
|
101
|
-
}
|
|
102
|
-
const scoreColor = (s) => s >= 85 ? import_chalk3.default.green : s >= 70 ? import_chalk3.default.cyan : s >= 50 ? import_chalk3.default.yellow : import_chalk3.default.red;
|
|
103
|
-
console.log(` \u{1F9ED} Agent Grounding: ${import_chalk3.default.bold(scoring.score + "/100")} (${report.summary.rating})`);
|
|
104
|
-
const dims = report.summary.dimensions;
|
|
105
|
-
const worstDim = Object.entries(dims).sort(([, a], [, b]) => a - b)[0];
|
|
106
|
-
if (worstDim && worstDim[1] < 70) {
|
|
107
|
-
const name = worstDim[0].replace(/([A-Z])/g, " $1").replace("Score", "").trim();
|
|
108
|
-
console.log(import_chalk3.default.dim(` Weakest dimension: ${name} (${worstDim[1]}/100)`));
|
|
109
|
-
}
|
|
110
|
-
return scoring;
|
|
111
|
-
}
|
|
112
|
-
var import_chalk3, import_core2;
|
|
113
|
-
var init_agent_grounding = __esm({
|
|
114
|
-
"src/commands/agent-grounding.ts"() {
|
|
115
|
-
"use strict";
|
|
116
|
-
import_chalk3 = __toESM(require("chalk"));
|
|
117
|
-
import_core2 = require("@aiready/core");
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
// src/commands/testability.ts
|
|
122
|
-
var testability_exports = {};
|
|
123
|
-
__export(testability_exports, {
|
|
124
|
-
testabilityAction: () => testabilityAction
|
|
125
|
-
});
|
|
126
|
-
async function testabilityAction(directory, options) {
|
|
127
|
-
const { analyzeTestability, calculateTestabilityScore } = await import("@aiready/testability");
|
|
128
|
-
const config = await (0, import_core3.loadConfig)(directory);
|
|
129
|
-
const merged = (0, import_core3.mergeConfigWithDefaults)(config, {
|
|
130
|
-
minCoverageRatio: 0.3
|
|
131
|
-
});
|
|
132
|
-
const report = await analyzeTestability({
|
|
133
|
-
rootDir: directory,
|
|
134
|
-
minCoverageRatio: options.minCoverageRatio ?? merged.minCoverageRatio,
|
|
135
|
-
include: options.include,
|
|
136
|
-
exclude: options.exclude
|
|
137
|
-
});
|
|
138
|
-
const scoring = calculateTestabilityScore(report);
|
|
139
|
-
if (options.output === "json") {
|
|
140
|
-
return scoring;
|
|
141
|
-
}
|
|
142
|
-
const safetyIcons = {
|
|
143
|
-
"safe": "\u2705",
|
|
144
|
-
"moderate-risk": "\u26A0\uFE0F ",
|
|
145
|
-
"high-risk": "\u{1F534}",
|
|
146
|
-
"blind-risk": "\u{1F480}"
|
|
147
|
-
};
|
|
148
|
-
const safetyColors = {
|
|
149
|
-
"safe": import_chalk4.default.green,
|
|
150
|
-
"moderate-risk": import_chalk4.default.yellow,
|
|
151
|
-
"high-risk": import_chalk4.default.red,
|
|
152
|
-
"blind-risk": import_chalk4.default.bgRed.white
|
|
153
|
-
};
|
|
154
|
-
const safety = report.summary.aiChangeSafetyRating;
|
|
155
|
-
const icon = safetyIcons[safety] ?? "\u2753";
|
|
156
|
-
const color = safetyColors[safety] ?? import_chalk4.default.white;
|
|
157
|
-
console.log(` \u{1F9EA} Testability: ${import_chalk4.default.bold(scoring.score + "/100")} (${report.summary.rating})`);
|
|
158
|
-
console.log(` AI Change Safety: ${color(`${icon} ${safety.toUpperCase()}`)}`);
|
|
159
|
-
console.log(import_chalk4.default.dim(` Coverage: ${Math.round(report.summary.coverageRatio * 100)}% (${report.rawData.testFiles} test / ${report.rawData.sourceFiles} source files)`));
|
|
160
|
-
if (safety === "blind-risk") {
|
|
161
|
-
console.log(import_chalk4.default.red.bold("\n \u26A0\uFE0F NO TESTS \u2014 AI changes to this codebase are completely unverifiable!\n"));
|
|
162
|
-
}
|
|
163
|
-
return scoring;
|
|
164
|
-
}
|
|
165
|
-
var import_chalk4, import_core3;
|
|
166
|
-
var init_testability = __esm({
|
|
167
|
-
"src/commands/testability.ts"() {
|
|
168
|
-
"use strict";
|
|
169
|
-
import_chalk4 = __toESM(require("chalk"));
|
|
170
|
-
import_core3 = require("@aiready/core");
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
|
|
174
26
|
// src/cli.ts
|
|
175
27
|
var import_commander = require("commander");
|
|
176
28
|
var import_fs5 = require("fs");
|
|
@@ -178,10 +30,10 @@ var import_path7 = require("path");
|
|
|
178
30
|
var import_url = require("url");
|
|
179
31
|
|
|
180
32
|
// src/commands/scan.ts
|
|
181
|
-
var
|
|
33
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
182
34
|
var import_fs2 = require("fs");
|
|
183
35
|
var import_path2 = require("path");
|
|
184
|
-
var
|
|
36
|
+
var import_core = require("@aiready/core");
|
|
185
37
|
|
|
186
38
|
// src/index.ts
|
|
187
39
|
var import_pattern_detect = require("@aiready/pattern-detect");
|
|
@@ -291,6 +143,45 @@ async function analyzeUnified(options) {
|
|
|
291
143
|
result.deps = report;
|
|
292
144
|
result.summary.totalIssues += report.issues?.length || 0;
|
|
293
145
|
}
|
|
146
|
+
if (tools.includes("hallucination")) {
|
|
147
|
+
const { analyzeHallucinationRisk } = await import("@aiready/hallucination-risk");
|
|
148
|
+
const report = await analyzeHallucinationRisk({
|
|
149
|
+
rootDir: options.rootDir,
|
|
150
|
+
include: options.include,
|
|
151
|
+
exclude: options.exclude
|
|
152
|
+
});
|
|
153
|
+
if (options.progressCallback) {
|
|
154
|
+
options.progressCallback({ tool: "hallucination", data: report });
|
|
155
|
+
}
|
|
156
|
+
result.hallucination = report;
|
|
157
|
+
result.summary.totalIssues += report.results?.reduce((sum, r) => sum + (r.issues?.length || 0), 0) || 0;
|
|
158
|
+
}
|
|
159
|
+
if (tools.includes("grounding")) {
|
|
160
|
+
const { analyzeAgentGrounding } = await import("@aiready/agent-grounding");
|
|
161
|
+
const report = await analyzeAgentGrounding({
|
|
162
|
+
rootDir: options.rootDir,
|
|
163
|
+
include: options.include,
|
|
164
|
+
exclude: options.exclude
|
|
165
|
+
});
|
|
166
|
+
if (options.progressCallback) {
|
|
167
|
+
options.progressCallback({ tool: "grounding", data: report });
|
|
168
|
+
}
|
|
169
|
+
result.grounding = report;
|
|
170
|
+
result.summary.totalIssues += report.issues?.length || 0;
|
|
171
|
+
}
|
|
172
|
+
if (tools.includes("testability")) {
|
|
173
|
+
const { analyzeTestability } = await import("@aiready/testability");
|
|
174
|
+
const report = await analyzeTestability({
|
|
175
|
+
rootDir: options.rootDir,
|
|
176
|
+
include: options.include,
|
|
177
|
+
exclude: options.exclude
|
|
178
|
+
});
|
|
179
|
+
if (options.progressCallback) {
|
|
180
|
+
options.progressCallback({ tool: "testability", data: report });
|
|
181
|
+
}
|
|
182
|
+
result.testability = report;
|
|
183
|
+
result.summary.totalIssues += report.issues?.length || 0;
|
|
184
|
+
}
|
|
294
185
|
result.summary.executionTime = Date.now() - startTime;
|
|
295
186
|
return result;
|
|
296
187
|
}
|
|
@@ -402,7 +293,7 @@ function truncateArray(arr, cap = 8) {
|
|
|
402
293
|
|
|
403
294
|
// src/commands/scan.ts
|
|
404
295
|
async function scanAction(directory, options) {
|
|
405
|
-
console.log(
|
|
296
|
+
console.log(import_chalk2.default.blue("\u{1F680} Starting AIReady unified analysis...\n"));
|
|
406
297
|
const startTime = Date.now();
|
|
407
298
|
const resolvedDir = (0, import_path2.resolve)(process.cwd(), directory || ".");
|
|
408
299
|
try {
|
|
@@ -431,11 +322,11 @@ async function scanAction(directory, options) {
|
|
|
431
322
|
profileTools = ["context", "consistency", "grounding"];
|
|
432
323
|
break;
|
|
433
324
|
default:
|
|
434
|
-
console.log(
|
|
325
|
+
console.log(import_chalk2.default.yellow(`
|
|
435
326
|
\u26A0\uFE0F Unknown profile '${options.profile}'. Using specified tools or defaults.`));
|
|
436
327
|
}
|
|
437
328
|
}
|
|
438
|
-
const baseOptions = await (0,
|
|
329
|
+
const baseOptions = await (0, import_core.loadMergedConfig)(resolvedDir, defaults, {
|
|
439
330
|
tools: profileTools,
|
|
440
331
|
include: options.include?.split(","),
|
|
441
332
|
exclude: options.exclude?.split(",")
|
|
@@ -446,13 +337,13 @@ async function scanAction(directory, options) {
|
|
|
446
337
|
const patternSmartDefaults = await getSmartDefaults(resolvedDir, baseOptions);
|
|
447
338
|
finalOptions = { ...patternSmartDefaults, ...finalOptions, ...baseOptions };
|
|
448
339
|
}
|
|
449
|
-
console.log(
|
|
450
|
-
console.log(
|
|
451
|
-
console.log(
|
|
452
|
-
console.log(
|
|
453
|
-
if (finalOptions.rootDir) console.log(` rootDir: ${
|
|
454
|
-
if (finalOptions.include) console.log(` include: ${
|
|
455
|
-
if (finalOptions.exclude) console.log(` exclude: ${
|
|
340
|
+
console.log(import_chalk2.default.cyan("\n=== AIReady Run Preview ==="));
|
|
341
|
+
console.log(import_chalk2.default.white("Tools to run:"), (finalOptions.tools || ["patterns", "context", "consistency"]).join(", "));
|
|
342
|
+
console.log(import_chalk2.default.white("Will use settings from config and defaults."));
|
|
343
|
+
console.log(import_chalk2.default.white("\nGeneral settings:"));
|
|
344
|
+
if (finalOptions.rootDir) console.log(` rootDir: ${import_chalk2.default.bold(String(finalOptions.rootDir))}`);
|
|
345
|
+
if (finalOptions.include) console.log(` include: ${import_chalk2.default.bold(truncateArray(finalOptions.include, 6))}`);
|
|
346
|
+
if (finalOptions.exclude) console.log(` exclude: ${import_chalk2.default.bold(truncateArray(finalOptions.exclude, 6))}`);
|
|
456
347
|
if (finalOptions["pattern-detect"] || finalOptions.minSimilarity) {
|
|
457
348
|
const patternDetectConfig = finalOptions["pattern-detect"] || {
|
|
458
349
|
minSimilarity: finalOptions.minSimilarity,
|
|
@@ -465,16 +356,16 @@ async function scanAction(directory, options) {
|
|
|
465
356
|
severity: finalOptions.severity,
|
|
466
357
|
includeTests: finalOptions.includeTests
|
|
467
358
|
};
|
|
468
|
-
console.log(
|
|
469
|
-
console.log(` minSimilarity: ${
|
|
470
|
-
console.log(` minLines: ${
|
|
471
|
-
if (patternDetectConfig.approx !== void 0) console.log(` approx: ${
|
|
472
|
-
if (patternDetectConfig.minSharedTokens !== void 0) console.log(` minSharedTokens: ${
|
|
473
|
-
if (patternDetectConfig.maxCandidatesPerBlock !== void 0) console.log(` maxCandidatesPerBlock: ${
|
|
474
|
-
if (patternDetectConfig.batchSize !== void 0) console.log(` batchSize: ${
|
|
475
|
-
if (patternDetectConfig.streamResults !== void 0) console.log(` streamResults: ${
|
|
476
|
-
if (patternDetectConfig.severity !== void 0) console.log(` severity: ${
|
|
477
|
-
if (patternDetectConfig.includeTests !== void 0) console.log(` includeTests: ${
|
|
359
|
+
console.log(import_chalk2.default.white("\nPattern-detect settings:"));
|
|
360
|
+
console.log(` minSimilarity: ${import_chalk2.default.bold(patternDetectConfig.minSimilarity ?? "default")}`);
|
|
361
|
+
console.log(` minLines: ${import_chalk2.default.bold(patternDetectConfig.minLines ?? "default")}`);
|
|
362
|
+
if (patternDetectConfig.approx !== void 0) console.log(` approx: ${import_chalk2.default.bold(String(patternDetectConfig.approx))}`);
|
|
363
|
+
if (patternDetectConfig.minSharedTokens !== void 0) console.log(` minSharedTokens: ${import_chalk2.default.bold(String(patternDetectConfig.minSharedTokens))}`);
|
|
364
|
+
if (patternDetectConfig.maxCandidatesPerBlock !== void 0) console.log(` maxCandidatesPerBlock: ${import_chalk2.default.bold(String(patternDetectConfig.maxCandidatesPerBlock))}`);
|
|
365
|
+
if (patternDetectConfig.batchSize !== void 0) console.log(` batchSize: ${import_chalk2.default.bold(String(patternDetectConfig.batchSize))}`);
|
|
366
|
+
if (patternDetectConfig.streamResults !== void 0) console.log(` streamResults: ${import_chalk2.default.bold(String(patternDetectConfig.streamResults))}`);
|
|
367
|
+
if (patternDetectConfig.severity !== void 0) console.log(` severity: ${import_chalk2.default.bold(String(patternDetectConfig.severity))}`);
|
|
368
|
+
if (patternDetectConfig.includeTests !== void 0) console.log(` includeTests: ${import_chalk2.default.bold(String(patternDetectConfig.includeTests))}`);
|
|
478
369
|
}
|
|
479
370
|
if (finalOptions["context-analyzer"] || finalOptions.maxDepth) {
|
|
480
371
|
const ca = finalOptions["context-analyzer"] || {
|
|
@@ -484,32 +375,32 @@ async function scanAction(directory, options) {
|
|
|
484
375
|
maxFragmentation: finalOptions.maxFragmentation,
|
|
485
376
|
includeNodeModules: finalOptions.includeNodeModules
|
|
486
377
|
};
|
|
487
|
-
console.log(
|
|
488
|
-
console.log(` maxDepth: ${
|
|
489
|
-
console.log(` maxContextBudget: ${
|
|
490
|
-
if (ca.minCohesion !== void 0) console.log(` minCohesion: ${
|
|
491
|
-
if (ca.maxFragmentation !== void 0) console.log(` maxFragmentation: ${
|
|
492
|
-
if (ca.includeNodeModules !== void 0) console.log(` includeNodeModules: ${
|
|
378
|
+
console.log(import_chalk2.default.white("\nContext-analyzer settings:"));
|
|
379
|
+
console.log(` maxDepth: ${import_chalk2.default.bold(ca.maxDepth ?? "default")}`);
|
|
380
|
+
console.log(` maxContextBudget: ${import_chalk2.default.bold(ca.maxContextBudget ?? "default")}`);
|
|
381
|
+
if (ca.minCohesion !== void 0) console.log(` minCohesion: ${import_chalk2.default.bold(String(ca.minCohesion))}`);
|
|
382
|
+
if (ca.maxFragmentation !== void 0) console.log(` maxFragmentation: ${import_chalk2.default.bold(String(ca.maxFragmentation))}`);
|
|
383
|
+
if (ca.includeNodeModules !== void 0) console.log(` includeNodeModules: ${import_chalk2.default.bold(String(ca.includeNodeModules))}`);
|
|
493
384
|
}
|
|
494
385
|
if (finalOptions.consistency) {
|
|
495
386
|
const c = finalOptions.consistency;
|
|
496
|
-
console.log(
|
|
497
|
-
console.log(` checkNaming: ${
|
|
498
|
-
console.log(` checkPatterns: ${
|
|
499
|
-
console.log(` checkArchitecture: ${
|
|
500
|
-
if (c.minSeverity) console.log(` minSeverity: ${
|
|
501
|
-
if (c.acceptedAbbreviations) console.log(` acceptedAbbreviations: ${
|
|
502
|
-
if (c.shortWords) console.log(` shortWords: ${
|
|
387
|
+
console.log(import_chalk2.default.white("\nConsistency settings:"));
|
|
388
|
+
console.log(` checkNaming: ${import_chalk2.default.bold(String(c.checkNaming ?? true))}`);
|
|
389
|
+
console.log(` checkPatterns: ${import_chalk2.default.bold(String(c.checkPatterns ?? true))}`);
|
|
390
|
+
console.log(` checkArchitecture: ${import_chalk2.default.bold(String(c.checkArchitecture ?? false))}`);
|
|
391
|
+
if (c.minSeverity) console.log(` minSeverity: ${import_chalk2.default.bold(c.minSeverity)}`);
|
|
392
|
+
if (c.acceptedAbbreviations) console.log(` acceptedAbbreviations: ${import_chalk2.default.bold(truncateArray(c.acceptedAbbreviations, 8))}`);
|
|
393
|
+
if (c.shortWords) console.log(` shortWords: ${import_chalk2.default.bold(truncateArray(c.shortWords, 8))}`);
|
|
503
394
|
}
|
|
504
|
-
console.log(
|
|
395
|
+
console.log(import_chalk2.default.white("\nStarting analysis..."));
|
|
505
396
|
const progressCallback = (event) => {
|
|
506
|
-
console.log(
|
|
397
|
+
console.log(import_chalk2.default.cyan(`
|
|
507
398
|
--- ${event.tool.toUpperCase()} RESULTS ---`));
|
|
508
399
|
try {
|
|
509
400
|
if (event.tool === "patterns") {
|
|
510
401
|
const pr = event.data;
|
|
511
|
-
console.log(` Duplicate patterns: ${
|
|
512
|
-
console.log(` Files with pattern issues: ${
|
|
402
|
+
console.log(` Duplicate patterns: ${import_chalk2.default.bold(String(pr.duplicates?.length || 0))}`);
|
|
403
|
+
console.log(` Files with pattern issues: ${import_chalk2.default.bold(String(pr.results?.length || 0))}`);
|
|
513
404
|
if (pr.duplicates && pr.duplicates.length > 0) {
|
|
514
405
|
pr.duplicates.slice(0, 5).forEach((d, i) => {
|
|
515
406
|
console.log(` ${i + 1}. ${d.file1.split("/").pop()} \u2194 ${d.file2.split("/").pop()} (sim=${(d.similarity * 100).toFixed(1)}%)`);
|
|
@@ -523,10 +414,10 @@ async function scanAction(directory, options) {
|
|
|
523
414
|
});
|
|
524
415
|
}
|
|
525
416
|
if (pr.groups && pr.groups.length >= 0) {
|
|
526
|
-
console.log(` \u2705 Grouped ${
|
|
417
|
+
console.log(` \u2705 Grouped ${import_chalk2.default.bold(String(pr.duplicates?.length || 0))} duplicates into ${import_chalk2.default.bold(String(pr.groups.length))} file pairs`);
|
|
527
418
|
}
|
|
528
419
|
if (pr.clusters && pr.clusters.length >= 0) {
|
|
529
|
-
console.log(` \u2705 Created ${
|
|
420
|
+
console.log(` \u2705 Created ${import_chalk2.default.bold(String(pr.clusters.length))} refactor clusters`);
|
|
530
421
|
pr.clusters.slice(0, 3).forEach((cl, idx) => {
|
|
531
422
|
const files = (cl.files || []).map((f) => f.path.split("/").pop()).join(", ");
|
|
532
423
|
console.log(` ${idx + 1}. ${files} (${cl.tokenCost || "n/a"} tokens)`);
|
|
@@ -534,14 +425,14 @@ async function scanAction(directory, options) {
|
|
|
534
425
|
}
|
|
535
426
|
} else if (event.tool === "context") {
|
|
536
427
|
const cr = event.data;
|
|
537
|
-
console.log(` Context issues found: ${
|
|
428
|
+
console.log(` Context issues found: ${import_chalk2.default.bold(String(cr.length || 0))}`);
|
|
538
429
|
cr.slice(0, 5).forEach((c, i) => {
|
|
539
430
|
const msg = c.message ? ` - ${c.message}` : "";
|
|
540
431
|
console.log(` ${i + 1}. ${c.file} (${c.severity || "n/a"})${msg}`);
|
|
541
432
|
});
|
|
542
433
|
} else if (event.tool === "consistency") {
|
|
543
434
|
const rep = event.data;
|
|
544
|
-
console.log(` Consistency totalIssues: ${
|
|
435
|
+
console.log(` Consistency totalIssues: ${import_chalk2.default.bold(String(rep.summary?.totalIssues || 0))}`);
|
|
545
436
|
if (rep.results && rep.results.length > 0) {
|
|
546
437
|
const fileMap = /* @__PURE__ */ new Map();
|
|
547
438
|
rep.results.forEach((r) => {
|
|
@@ -565,38 +456,38 @@ async function scanAction(directory, options) {
|
|
|
565
456
|
});
|
|
566
457
|
const remaining = files.length - topFiles.length;
|
|
567
458
|
if (remaining > 0) {
|
|
568
|
-
console.log(
|
|
459
|
+
console.log(import_chalk2.default.dim(` ... and ${remaining} more files with issues (use --output json for full details)`));
|
|
569
460
|
}
|
|
570
461
|
}
|
|
571
462
|
} else if (event.tool === "doc-drift") {
|
|
572
463
|
const dr = event.data;
|
|
573
|
-
console.log(` Issues found: ${
|
|
464
|
+
console.log(` Issues found: ${import_chalk2.default.bold(String(dr.issues?.length || 0))}`);
|
|
574
465
|
if (dr.rawData) {
|
|
575
|
-
console.log(` Signature Mismatches: ${
|
|
576
|
-
console.log(` Undocumented Complexity: ${
|
|
466
|
+
console.log(` Signature Mismatches: ${import_chalk2.default.bold(dr.rawData.outdatedComments || 0)}`);
|
|
467
|
+
console.log(` Undocumented Complexity: ${import_chalk2.default.bold(dr.rawData.undocumentedComplexity || 0)}`);
|
|
577
468
|
}
|
|
578
469
|
} else if (event.tool === "deps-health") {
|
|
579
470
|
const dr = event.data;
|
|
580
|
-
console.log(` Packages Analyzed: ${
|
|
471
|
+
console.log(` Packages Analyzed: ${import_chalk2.default.bold(String(dr.summary?.packagesAnalyzed || 0))}`);
|
|
581
472
|
if (dr.rawData) {
|
|
582
|
-
console.log(` Deprecated Packages: ${
|
|
583
|
-
console.log(` AI Cutoff Skew Score: ${
|
|
473
|
+
console.log(` Deprecated Packages: ${import_chalk2.default.bold(dr.rawData.deprecatedPackages || 0)}`);
|
|
474
|
+
console.log(` AI Cutoff Skew Score: ${import_chalk2.default.bold(dr.rawData.trainingCutoffSkew?.toFixed(1) || 0)}`);
|
|
584
475
|
}
|
|
585
476
|
}
|
|
586
477
|
} catch (err) {
|
|
587
478
|
}
|
|
588
479
|
};
|
|
589
480
|
const results = await analyzeUnified({ ...finalOptions, progressCallback, suppressToolConfig: true });
|
|
590
|
-
console.log(
|
|
591
|
-
console.log(
|
|
592
|
-
console.log(
|
|
593
|
-
console.log(` Total issues (all tools): ${
|
|
594
|
-
if (results.duplicates) console.log(` Duplicate patterns found: ${
|
|
595
|
-
if (results.patterns) console.log(` Pattern files with issues: ${
|
|
596
|
-
if (results.context) console.log(` Context issues: ${
|
|
597
|
-
if (results.consistency) console.log(` Consistency issues: ${
|
|
598
|
-
console.log(
|
|
599
|
-
const elapsedTime = (0,
|
|
481
|
+
console.log(import_chalk2.default.cyan("\n=== AIReady Run Summary ==="));
|
|
482
|
+
console.log(import_chalk2.default.white("Tools run:"), (finalOptions.tools || ["patterns", "context", "consistency"]).join(", "));
|
|
483
|
+
console.log(import_chalk2.default.cyan("\nResults summary:"));
|
|
484
|
+
console.log(` Total issues (all tools): ${import_chalk2.default.bold(String(results.summary.totalIssues || 0))}`);
|
|
485
|
+
if (results.duplicates) console.log(` Duplicate patterns found: ${import_chalk2.default.bold(String(results.duplicates.length || 0))}`);
|
|
486
|
+
if (results.patterns) console.log(` Pattern files with issues: ${import_chalk2.default.bold(String(results.patterns.length || 0))}`);
|
|
487
|
+
if (results.context) console.log(` Context issues: ${import_chalk2.default.bold(String(results.context.length || 0))}`);
|
|
488
|
+
if (results.consistency) console.log(` Consistency issues: ${import_chalk2.default.bold(String(results.consistency.summary.totalIssues || 0))}`);
|
|
489
|
+
console.log(import_chalk2.default.cyan("===========================\n"));
|
|
490
|
+
const elapsedTime = (0, import_core.getElapsedTime)(startTime);
|
|
600
491
|
let scoringResult;
|
|
601
492
|
if (options.score || finalOptions.scoring?.showBreakdown) {
|
|
602
493
|
const toolScores = /* @__PURE__ */ new Map();
|
|
@@ -627,27 +518,27 @@ async function scanAction(directory, options) {
|
|
|
627
518
|
} catch (err) {
|
|
628
519
|
}
|
|
629
520
|
}
|
|
630
|
-
if (
|
|
521
|
+
if (results.hallucination) {
|
|
522
|
+
const { calculateHallucinationScore } = await import("@aiready/hallucination-risk");
|
|
631
523
|
try {
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
if (hrScore) toolScores.set("hallucination-risk", hrScore);
|
|
524
|
+
const hrScore = calculateHallucinationScore(results.hallucination);
|
|
525
|
+
toolScores.set("hallucination-risk", hrScore);
|
|
635
526
|
} catch (err) {
|
|
636
527
|
}
|
|
637
528
|
}
|
|
638
|
-
if (
|
|
529
|
+
if (results.grounding) {
|
|
530
|
+
const { calculateGroundingScore } = await import("@aiready/agent-grounding");
|
|
639
531
|
try {
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
if (agScore) toolScores.set("agent-grounding", agScore);
|
|
532
|
+
const agScore = calculateGroundingScore(results.grounding);
|
|
533
|
+
toolScores.set("agent-grounding", agScore);
|
|
643
534
|
} catch (err) {
|
|
644
535
|
}
|
|
645
536
|
}
|
|
646
|
-
if (
|
|
537
|
+
if (results.testability) {
|
|
538
|
+
const { calculateTestabilityScore } = await import("@aiready/testability");
|
|
647
539
|
try {
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
if (tbScore) toolScores.set("testability", tbScore);
|
|
540
|
+
const tbScore = calculateTestabilityScore(results.testability);
|
|
541
|
+
toolScores.set("testability", tbScore);
|
|
651
542
|
} catch (err) {
|
|
652
543
|
}
|
|
653
544
|
}
|
|
@@ -669,11 +560,11 @@ async function scanAction(directory, options) {
|
|
|
669
560
|
recommendations: results.deps.recommendations.map((action) => ({ action, estimatedImpact: 5, priority: "medium" }))
|
|
670
561
|
});
|
|
671
562
|
}
|
|
672
|
-
const cliWeights = (0,
|
|
563
|
+
const cliWeights = (0, import_core.parseWeightString)(options.weights);
|
|
673
564
|
if (toolScores.size > 0) {
|
|
674
|
-
scoringResult = (0,
|
|
675
|
-
console.log(
|
|
676
|
-
console.log(` ${(0,
|
|
565
|
+
scoringResult = (0, import_core.calculateOverallScore)(toolScores, finalOptions, cliWeights.size ? cliWeights : void 0);
|
|
566
|
+
console.log(import_chalk2.default.bold("\n\u{1F4CA} AI Readiness Overall Score"));
|
|
567
|
+
console.log(` ${(0, import_core.formatScore)(scoringResult)}`);
|
|
677
568
|
if (options.compareTo) {
|
|
678
569
|
try {
|
|
679
570
|
const prevReportStr = (0, import_fs2.readFileSync)((0, import_path2.resolve)(process.cwd(), options.compareTo), "utf8");
|
|
@@ -684,37 +575,37 @@ async function scanAction(directory, options) {
|
|
|
684
575
|
const diffStr = diff > 0 ? `+${diff}` : String(diff);
|
|
685
576
|
console.log();
|
|
686
577
|
if (diff > 0) {
|
|
687
|
-
console.log(
|
|
578
|
+
console.log(import_chalk2.default.green(` \u{1F4C8} Trend: ${diffStr} compared to ${options.compareTo} (${prevScore} \u2192 ${scoringResult.overall})`));
|
|
688
579
|
} else if (diff < 0) {
|
|
689
|
-
console.log(
|
|
580
|
+
console.log(import_chalk2.default.red(` \u{1F4C9} Trend: ${diffStr} compared to ${options.compareTo} (${prevScore} \u2192 ${scoringResult.overall})`));
|
|
690
581
|
} else {
|
|
691
|
-
console.log(
|
|
582
|
+
console.log(import_chalk2.default.blue(` \u2796 Trend: No change compared to ${options.compareTo} (${prevScore} \u2192 ${scoringResult.overall})`));
|
|
692
583
|
}
|
|
693
584
|
scoringResult.trend = {
|
|
694
585
|
previousScore: prevScore,
|
|
695
586
|
difference: diff
|
|
696
587
|
};
|
|
697
588
|
} else {
|
|
698
|
-
console.log(
|
|
589
|
+
console.log(import_chalk2.default.yellow(`
|
|
699
590
|
\u26A0\uFE0F Previous report at ${options.compareTo} does not contain an overall score.`));
|
|
700
591
|
}
|
|
701
592
|
} catch (e) {
|
|
702
|
-
console.log(
|
|
593
|
+
console.log(import_chalk2.default.yellow(`
|
|
703
594
|
\u26A0\uFE0F Could not read or parse previous report at ${options.compareTo}.`));
|
|
704
595
|
}
|
|
705
596
|
}
|
|
706
597
|
if (scoringResult.breakdown && scoringResult.breakdown.length > 0) {
|
|
707
|
-
console.log(
|
|
598
|
+
console.log(import_chalk2.default.bold("\nTool breakdown:"));
|
|
708
599
|
scoringResult.breakdown.forEach((tool) => {
|
|
709
|
-
const rating = (0,
|
|
710
|
-
const rd = (0,
|
|
600
|
+
const rating = (0, import_core.getRating)(tool.score);
|
|
601
|
+
const rd = (0, import_core.getRatingDisplay)(rating);
|
|
711
602
|
console.log(` - ${tool.toolName}: ${tool.score}/100 (${rating}) ${rd.emoji}`);
|
|
712
603
|
});
|
|
713
604
|
console.log();
|
|
714
605
|
if (finalOptions.scoring?.showBreakdown) {
|
|
715
|
-
console.log(
|
|
606
|
+
console.log(import_chalk2.default.bold("Detailed tool breakdown:"));
|
|
716
607
|
scoringResult.breakdown.forEach((tool) => {
|
|
717
|
-
console.log((0,
|
|
608
|
+
console.log((0, import_core.formatToolScore)(tool));
|
|
718
609
|
});
|
|
719
610
|
console.log();
|
|
720
611
|
}
|
|
@@ -726,9 +617,9 @@ async function scanAction(directory, options) {
|
|
|
726
617
|
if (outputFormat === "json") {
|
|
727
618
|
const timestamp = getReportTimestamp();
|
|
728
619
|
const defaultFilename = `aiready-report-${timestamp}.json`;
|
|
729
|
-
const outputPath = (0,
|
|
620
|
+
const outputPath = (0, import_core.resolveOutputPath)(userOutputFile, defaultFilename, resolvedDir);
|
|
730
621
|
const outputData = { ...results, scoring: scoringResult };
|
|
731
|
-
(0,
|
|
622
|
+
(0, import_core.handleJSONOutput)(outputData, outputPath, `\u2705 Report saved to ${outputPath}`);
|
|
732
623
|
warnIfGraphCapExceeded(outputData, resolvedDir);
|
|
733
624
|
}
|
|
734
625
|
const isCI = options.ci || process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
|
|
@@ -801,23 +692,23 @@ async function scanAction(directory, options) {
|
|
|
801
692
|
}
|
|
802
693
|
}
|
|
803
694
|
if (shouldFail) {
|
|
804
|
-
console.log(
|
|
805
|
-
console.log(
|
|
806
|
-
console.log(
|
|
807
|
-
console.log(
|
|
808
|
-
console.log(
|
|
809
|
-
console.log(
|
|
695
|
+
console.log(import_chalk2.default.red("\n\u{1F6AB} PR BLOCKED: AI Readiness Check Failed"));
|
|
696
|
+
console.log(import_chalk2.default.red(` Reason: ${failReason}`));
|
|
697
|
+
console.log(import_chalk2.default.dim("\n Remediation steps:"));
|
|
698
|
+
console.log(import_chalk2.default.dim(" 1. Run `aiready scan` locally to see detailed issues"));
|
|
699
|
+
console.log(import_chalk2.default.dim(" 2. Fix the critical issues before merging"));
|
|
700
|
+
console.log(import_chalk2.default.dim(" 3. Consider upgrading to Team plan for historical tracking: https://getaiready.dev/pricing"));
|
|
810
701
|
process.exit(1);
|
|
811
702
|
} else {
|
|
812
|
-
console.log(
|
|
703
|
+
console.log(import_chalk2.default.green("\n\u2705 PR PASSED: AI Readiness Check"));
|
|
813
704
|
if (threshold) {
|
|
814
|
-
console.log(
|
|
705
|
+
console.log(import_chalk2.default.green(` Score: ${scoringResult.overall}/100 (threshold: ${threshold})`));
|
|
815
706
|
}
|
|
816
|
-
console.log(
|
|
707
|
+
console.log(import_chalk2.default.dim("\n \u{1F4A1} Track historical trends: https://getaiready.dev \u2014 Team plan $99/mo"));
|
|
817
708
|
}
|
|
818
709
|
}
|
|
819
710
|
} catch (error) {
|
|
820
|
-
(0,
|
|
711
|
+
(0, import_core.handleCLIError)(error, "Analysis");
|
|
821
712
|
}
|
|
822
713
|
}
|
|
823
714
|
var scanHelpText = `
|
|
@@ -850,11 +741,11 @@ CI/CD INTEGRATION (Gatekeeper Mode):
|
|
|
850
741
|
`;
|
|
851
742
|
|
|
852
743
|
// src/commands/patterns.ts
|
|
853
|
-
var
|
|
744
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
854
745
|
var import_path3 = require("path");
|
|
855
|
-
var
|
|
746
|
+
var import_core2 = require("@aiready/core");
|
|
856
747
|
async function patternsAction(directory, options) {
|
|
857
|
-
console.log(
|
|
748
|
+
console.log(import_chalk3.default.blue("\u{1F50D} Analyzing patterns...\n"));
|
|
858
749
|
const startTime = Date.now();
|
|
859
750
|
const resolvedDir = (0, import_path3.resolve)(process.cwd(), directory || ".");
|
|
860
751
|
try {
|
|
@@ -885,10 +776,10 @@ async function patternsAction(directory, options) {
|
|
|
885
776
|
if (options.minSharedTokens) {
|
|
886
777
|
cliOptions.minSharedTokens = parseInt(options.minSharedTokens);
|
|
887
778
|
}
|
|
888
|
-
const finalOptions = await (0,
|
|
779
|
+
const finalOptions = await (0, import_core2.loadMergedConfig)(resolvedDir, defaults, cliOptions);
|
|
889
780
|
const { analyzePatterns: analyzePatterns2, generateSummary, calculatePatternScore } = await import("@aiready/pattern-detect");
|
|
890
781
|
const { results, duplicates } = await analyzePatterns2(finalOptions);
|
|
891
|
-
const elapsedTime = (0,
|
|
782
|
+
const elapsedTime = (0, import_core2.getElapsedTime)(startTime);
|
|
892
783
|
const summary = generateSummary(results);
|
|
893
784
|
let patternScore;
|
|
894
785
|
if (options.score) {
|
|
@@ -902,60 +793,60 @@ async function patternsAction(directory, options) {
|
|
|
902
793
|
summary: { ...summary, executionTime: parseFloat(elapsedTime) },
|
|
903
794
|
...patternScore && { scoring: patternScore }
|
|
904
795
|
};
|
|
905
|
-
const outputPath = (0,
|
|
796
|
+
const outputPath = (0, import_core2.resolveOutputPath)(
|
|
906
797
|
userOutputFile,
|
|
907
798
|
`aiready-report-${getReportTimestamp()}.json`,
|
|
908
799
|
resolvedDir
|
|
909
800
|
);
|
|
910
|
-
(0,
|
|
801
|
+
(0, import_core2.handleJSONOutput)(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
|
|
911
802
|
} else {
|
|
912
803
|
const terminalWidth = process.stdout.columns || 80;
|
|
913
804
|
const dividerWidth = Math.min(60, terminalWidth - 2);
|
|
914
805
|
const divider = "\u2501".repeat(dividerWidth);
|
|
915
|
-
console.log(
|
|
916
|
-
console.log(
|
|
917
|
-
console.log(
|
|
918
|
-
console.log(
|
|
919
|
-
console.log(
|
|
920
|
-
console.log(
|
|
921
|
-
console.log(
|
|
806
|
+
console.log(import_chalk3.default.cyan(divider));
|
|
807
|
+
console.log(import_chalk3.default.bold.white(" PATTERN ANALYSIS SUMMARY"));
|
|
808
|
+
console.log(import_chalk3.default.cyan(divider) + "\n");
|
|
809
|
+
console.log(import_chalk3.default.white(`\u{1F4C1} Files analyzed: ${import_chalk3.default.bold(results.length)}`));
|
|
810
|
+
console.log(import_chalk3.default.yellow(`\u26A0 Duplicate patterns found: ${import_chalk3.default.bold(summary.totalPatterns)}`));
|
|
811
|
+
console.log(import_chalk3.default.red(`\u{1F4B0} Token cost (wasted): ${import_chalk3.default.bold(summary.totalTokenCost.toLocaleString())}`));
|
|
812
|
+
console.log(import_chalk3.default.gray(`\u23F1 Analysis time: ${import_chalk3.default.bold(elapsedTime + "s")}`));
|
|
922
813
|
const sortedTypes = Object.entries(summary.patternsByType || {}).filter(([, count]) => count > 0).sort(([, a], [, b]) => b - a);
|
|
923
814
|
if (sortedTypes.length > 0) {
|
|
924
|
-
console.log(
|
|
925
|
-
console.log(
|
|
926
|
-
console.log(
|
|
815
|
+
console.log(import_chalk3.default.cyan("\n" + divider));
|
|
816
|
+
console.log(import_chalk3.default.bold.white(" PATTERNS BY TYPE"));
|
|
817
|
+
console.log(import_chalk3.default.cyan(divider) + "\n");
|
|
927
818
|
sortedTypes.forEach(([type, count]) => {
|
|
928
|
-
console.log(` ${
|
|
819
|
+
console.log(` ${import_chalk3.default.white(type.padEnd(15))} ${import_chalk3.default.bold(count)}`);
|
|
929
820
|
});
|
|
930
821
|
}
|
|
931
822
|
if (summary.totalPatterns > 0 && duplicates.length > 0) {
|
|
932
|
-
console.log(
|
|
933
|
-
console.log(
|
|
934
|
-
console.log(
|
|
823
|
+
console.log(import_chalk3.default.cyan("\n" + divider));
|
|
824
|
+
console.log(import_chalk3.default.bold.white(" TOP DUPLICATE PATTERNS"));
|
|
825
|
+
console.log(import_chalk3.default.cyan(divider) + "\n");
|
|
935
826
|
const topDuplicates = [...duplicates].sort((a, b) => b.similarity - a.similarity).slice(0, 10);
|
|
936
827
|
topDuplicates.forEach((dup) => {
|
|
937
828
|
const severity = dup.similarity > 0.95 ? "CRITICAL" : dup.similarity > 0.9 ? "HIGH" : "MEDIUM";
|
|
938
829
|
const severityIcon = dup.similarity > 0.95 ? "\u{1F534}" : dup.similarity > 0.9 ? "\u{1F7E1}" : "\u{1F535}";
|
|
939
830
|
const file1Name = dup.file1.split("/").pop() || dup.file1;
|
|
940
831
|
const file2Name = dup.file2.split("/").pop() || dup.file2;
|
|
941
|
-
console.log(`${severityIcon} ${severity}: ${
|
|
942
|
-
console.log(` Similarity: ${
|
|
943
|
-
console.log(` Lines: ${
|
|
832
|
+
console.log(`${severityIcon} ${severity}: ${import_chalk3.default.bold(file1Name)} \u2194 ${import_chalk3.default.bold(file2Name)}`);
|
|
833
|
+
console.log(` Similarity: ${import_chalk3.default.bold(Math.round(dup.similarity * 100) + "%")} | Wasted: ${import_chalk3.default.bold(dup.tokenCost.toLocaleString())} tokens each`);
|
|
834
|
+
console.log(` Lines: ${import_chalk3.default.cyan(dup.line1 + "-" + dup.endLine1)} \u2194 ${import_chalk3.default.cyan(dup.line2 + "-" + dup.endLine2)}
|
|
944
835
|
`);
|
|
945
836
|
});
|
|
946
837
|
} else {
|
|
947
|
-
console.log(
|
|
838
|
+
console.log(import_chalk3.default.green("\n\u2728 Great! No duplicate patterns detected.\n"));
|
|
948
839
|
}
|
|
949
840
|
if (patternScore) {
|
|
950
|
-
console.log(
|
|
951
|
-
console.log(
|
|
952
|
-
console.log(
|
|
953
|
-
console.log((0,
|
|
841
|
+
console.log(import_chalk3.default.cyan(divider));
|
|
842
|
+
console.log(import_chalk3.default.bold.white(" AI READINESS SCORE (Patterns)"));
|
|
843
|
+
console.log(import_chalk3.default.cyan(divider) + "\n");
|
|
844
|
+
console.log((0, import_core2.formatToolScore)(patternScore));
|
|
954
845
|
console.log();
|
|
955
846
|
}
|
|
956
847
|
}
|
|
957
848
|
} catch (error) {
|
|
958
|
-
(0,
|
|
849
|
+
(0, import_core2.handleCLIError)(error, "Pattern analysis");
|
|
959
850
|
}
|
|
960
851
|
}
|
|
961
852
|
var patternsHelpText = `
|
|
@@ -966,11 +857,11 @@ EXAMPLES:
|
|
|
966
857
|
`;
|
|
967
858
|
|
|
968
859
|
// src/commands/context.ts
|
|
969
|
-
var
|
|
860
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
970
861
|
var import_path4 = require("path");
|
|
971
|
-
var
|
|
862
|
+
var import_core3 = require("@aiready/core");
|
|
972
863
|
async function contextAction(directory, options) {
|
|
973
|
-
console.log(
|
|
864
|
+
console.log(import_chalk4.default.blue("\u{1F9E0} Analyzing context costs...\n"));
|
|
974
865
|
const startTime = Date.now();
|
|
975
866
|
const resolvedDir = (0, import_path4.resolve)(process.cwd(), directory || ".");
|
|
976
867
|
try {
|
|
@@ -984,7 +875,7 @@ async function contextAction(directory, options) {
|
|
|
984
875
|
file: void 0
|
|
985
876
|
}
|
|
986
877
|
};
|
|
987
|
-
let baseOptions = await (0,
|
|
878
|
+
let baseOptions = await (0, import_core3.loadMergedConfig)(resolvedDir, defaults, {
|
|
988
879
|
maxDepth: options.maxDepth ? parseInt(options.maxDepth) : void 0,
|
|
989
880
|
maxContextBudget: options.maxContext ? parseInt(options.maxContext) : void 0,
|
|
990
881
|
include: options.include?.split(","),
|
|
@@ -1003,7 +894,7 @@ async function contextAction(directory, options) {
|
|
|
1003
894
|
console.log("");
|
|
1004
895
|
const { analyzeContext: analyzeContext2, generateSummary, calculateContextScore } = await import("@aiready/context-analyzer");
|
|
1005
896
|
const results = await analyzeContext2(finalOptions);
|
|
1006
|
-
const elapsedTime = (0,
|
|
897
|
+
const elapsedTime = (0, import_core3.getElapsedTime)(startTime);
|
|
1007
898
|
const summary = generateSummary(results);
|
|
1008
899
|
let contextScore;
|
|
1009
900
|
if (options.score) {
|
|
@@ -1017,104 +908,104 @@ async function contextAction(directory, options) {
|
|
|
1017
908
|
summary: { ...summary, executionTime: parseFloat(elapsedTime) },
|
|
1018
909
|
...contextScore && { scoring: contextScore }
|
|
1019
910
|
};
|
|
1020
|
-
const outputPath = (0,
|
|
911
|
+
const outputPath = (0, import_core3.resolveOutputPath)(
|
|
1021
912
|
userOutputFile,
|
|
1022
913
|
`aiready-report-${getReportTimestamp()}.json`,
|
|
1023
914
|
resolvedDir
|
|
1024
915
|
);
|
|
1025
|
-
(0,
|
|
916
|
+
(0, import_core3.handleJSONOutput)(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
|
|
1026
917
|
} else {
|
|
1027
918
|
const terminalWidth = process.stdout.columns || 80;
|
|
1028
919
|
const dividerWidth = Math.min(60, terminalWidth - 2);
|
|
1029
920
|
const divider = "\u2501".repeat(dividerWidth);
|
|
1030
|
-
console.log(
|
|
1031
|
-
console.log(
|
|
1032
|
-
console.log(
|
|
1033
|
-
console.log(
|
|
1034
|
-
console.log(
|
|
1035
|
-
console.log(
|
|
1036
|
-
console.log(
|
|
921
|
+
console.log(import_chalk4.default.cyan(divider));
|
|
922
|
+
console.log(import_chalk4.default.bold.white(" CONTEXT ANALYSIS SUMMARY"));
|
|
923
|
+
console.log(import_chalk4.default.cyan(divider) + "\n");
|
|
924
|
+
console.log(import_chalk4.default.white(`\u{1F4C1} Files analyzed: ${import_chalk4.default.bold(summary.totalFiles)}`));
|
|
925
|
+
console.log(import_chalk4.default.white(`\u{1F4CA} Total tokens: ${import_chalk4.default.bold(summary.totalTokens.toLocaleString())}`));
|
|
926
|
+
console.log(import_chalk4.default.yellow(`\u{1F4B0} Avg context budget: ${import_chalk4.default.bold(summary.avgContextBudget.toFixed(0))} tokens/file`));
|
|
927
|
+
console.log(import_chalk4.default.white(`\u23F1 Analysis time: ${import_chalk4.default.bold(elapsedTime + "s")}
|
|
1037
928
|
`));
|
|
1038
929
|
const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
|
|
1039
930
|
if (totalIssues > 0) {
|
|
1040
|
-
console.log(
|
|
931
|
+
console.log(import_chalk4.default.bold("\u26A0\uFE0F Issues Found:\n"));
|
|
1041
932
|
if (summary.criticalIssues > 0) {
|
|
1042
|
-
console.log(
|
|
933
|
+
console.log(import_chalk4.default.red(` \u{1F534} Critical: ${import_chalk4.default.bold(summary.criticalIssues)}`));
|
|
1043
934
|
}
|
|
1044
935
|
if (summary.majorIssues > 0) {
|
|
1045
|
-
console.log(
|
|
936
|
+
console.log(import_chalk4.default.yellow(` \u{1F7E1} Major: ${import_chalk4.default.bold(summary.majorIssues)}`));
|
|
1046
937
|
}
|
|
1047
938
|
if (summary.minorIssues > 0) {
|
|
1048
|
-
console.log(
|
|
939
|
+
console.log(import_chalk4.default.blue(` \u{1F535} Minor: ${import_chalk4.default.bold(summary.minorIssues)}`));
|
|
1049
940
|
}
|
|
1050
|
-
console.log(
|
|
1051
|
-
\u{1F4A1} Potential savings: ${
|
|
941
|
+
console.log(import_chalk4.default.green(`
|
|
942
|
+
\u{1F4A1} Potential savings: ${import_chalk4.default.bold(summary.totalPotentialSavings.toLocaleString())} tokens
|
|
1052
943
|
`));
|
|
1053
944
|
} else {
|
|
1054
|
-
console.log(
|
|
945
|
+
console.log(import_chalk4.default.green("\u2705 No significant issues found!\n"));
|
|
1055
946
|
}
|
|
1056
947
|
if (summary.deepFiles.length > 0) {
|
|
1057
|
-
console.log(
|
|
1058
|
-
console.log(
|
|
1059
|
-
console.log(
|
|
948
|
+
console.log(import_chalk4.default.bold("\u{1F4CF} Deep Import Chains:\n"));
|
|
949
|
+
console.log(import_chalk4.default.gray(` Average depth: ${summary.avgImportDepth.toFixed(1)}`));
|
|
950
|
+
console.log(import_chalk4.default.gray(` Maximum depth: ${summary.maxImportDepth}
|
|
1060
951
|
`));
|
|
1061
952
|
summary.deepFiles.slice(0, 10).forEach((item) => {
|
|
1062
953
|
const fileName = item.file.split("/").slice(-2).join("/");
|
|
1063
|
-
console.log(` ${
|
|
954
|
+
console.log(` ${import_chalk4.default.cyan("\u2192")} ${import_chalk4.default.white(fileName)} ${import_chalk4.default.dim(`(depth: ${item.depth})`)}`);
|
|
1064
955
|
});
|
|
1065
956
|
console.log();
|
|
1066
957
|
}
|
|
1067
958
|
if (summary.fragmentedModules.length > 0) {
|
|
1068
|
-
console.log(
|
|
1069
|
-
console.log(
|
|
959
|
+
console.log(import_chalk4.default.bold("\u{1F9E9} Fragmented Modules:\n"));
|
|
960
|
+
console.log(import_chalk4.default.gray(` Average fragmentation: ${(summary.avgFragmentation * 100).toFixed(0)}%
|
|
1070
961
|
`));
|
|
1071
962
|
summary.fragmentedModules.slice(0, 10).forEach((module2) => {
|
|
1072
|
-
console.log(` ${
|
|
1073
|
-
console.log(
|
|
963
|
+
console.log(` ${import_chalk4.default.yellow("\u25CF")} ${import_chalk4.default.white(module2.domain)} - ${import_chalk4.default.dim(`${module2.files.length} files, ${(module2.fragmentationScore * 100).toFixed(0)}% scattered`)}`);
|
|
964
|
+
console.log(import_chalk4.default.dim(` Token cost: ${module2.totalTokens.toLocaleString()}, Cohesion: ${(module2.avgCohesion * 100).toFixed(0)}%`));
|
|
1074
965
|
});
|
|
1075
966
|
console.log();
|
|
1076
967
|
}
|
|
1077
968
|
if (summary.lowCohesionFiles.length > 0) {
|
|
1078
|
-
console.log(
|
|
1079
|
-
console.log(
|
|
969
|
+
console.log(import_chalk4.default.bold("\u{1F500} Low Cohesion Files:\n"));
|
|
970
|
+
console.log(import_chalk4.default.gray(` Average cohesion: ${(summary.avgCohesion * 100).toFixed(0)}%
|
|
1080
971
|
`));
|
|
1081
972
|
summary.lowCohesionFiles.slice(0, 10).forEach((item) => {
|
|
1082
973
|
const fileName = item.file.split("/").slice(-2).join("/");
|
|
1083
974
|
const scorePercent = (item.score * 100).toFixed(0);
|
|
1084
|
-
const color = item.score < 0.4 ?
|
|
1085
|
-
console.log(` ${color("\u25CB")} ${
|
|
975
|
+
const color = item.score < 0.4 ? import_chalk4.default.red : import_chalk4.default.yellow;
|
|
976
|
+
console.log(` ${color("\u25CB")} ${import_chalk4.default.white(fileName)} ${import_chalk4.default.dim(`(${scorePercent}% cohesion)`)}`);
|
|
1086
977
|
});
|
|
1087
978
|
console.log();
|
|
1088
979
|
}
|
|
1089
980
|
if (summary.topExpensiveFiles.length > 0) {
|
|
1090
|
-
console.log(
|
|
981
|
+
console.log(import_chalk4.default.bold("\u{1F4B8} Most Expensive Files (Context Budget):\n"));
|
|
1091
982
|
summary.topExpensiveFiles.slice(0, 10).forEach((item) => {
|
|
1092
983
|
const fileName = item.file.split("/").slice(-2).join("/");
|
|
1093
|
-
const severityColor = item.severity === "critical" ?
|
|
1094
|
-
console.log(` ${severityColor("\u25CF")} ${
|
|
984
|
+
const severityColor = item.severity === "critical" ? import_chalk4.default.red : item.severity === "major" ? import_chalk4.default.yellow : import_chalk4.default.blue;
|
|
985
|
+
console.log(` ${severityColor("\u25CF")} ${import_chalk4.default.white(fileName)} ${import_chalk4.default.dim(`(${item.contextBudget.toLocaleString()} tokens)`)}`);
|
|
1095
986
|
});
|
|
1096
987
|
console.log();
|
|
1097
988
|
}
|
|
1098
989
|
if (contextScore) {
|
|
1099
|
-
console.log(
|
|
1100
|
-
console.log(
|
|
1101
|
-
console.log(
|
|
1102
|
-
console.log((0,
|
|
990
|
+
console.log(import_chalk4.default.cyan(divider));
|
|
991
|
+
console.log(import_chalk4.default.bold.white(" AI READINESS SCORE (Context)"));
|
|
992
|
+
console.log(import_chalk4.default.cyan(divider) + "\n");
|
|
993
|
+
console.log((0, import_core3.formatToolScore)(contextScore));
|
|
1103
994
|
console.log();
|
|
1104
995
|
}
|
|
1105
996
|
}
|
|
1106
997
|
} catch (error) {
|
|
1107
|
-
(0,
|
|
998
|
+
(0, import_core3.handleCLIError)(error, "Context analysis");
|
|
1108
999
|
}
|
|
1109
1000
|
}
|
|
1110
1001
|
|
|
1111
1002
|
// src/commands/consistency.ts
|
|
1112
|
-
var
|
|
1003
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
1113
1004
|
var import_fs3 = require("fs");
|
|
1114
1005
|
var import_path5 = require("path");
|
|
1115
|
-
var
|
|
1006
|
+
var import_core4 = require("@aiready/core");
|
|
1116
1007
|
async function consistencyAction(directory, options) {
|
|
1117
|
-
console.log(
|
|
1008
|
+
console.log(import_chalk5.default.blue("\u{1F50D} Analyzing consistency...\n"));
|
|
1118
1009
|
const startTime = Date.now();
|
|
1119
1010
|
const resolvedDir = (0, import_path5.resolve)(process.cwd(), directory || ".");
|
|
1120
1011
|
try {
|
|
@@ -1129,7 +1020,7 @@ async function consistencyAction(directory, options) {
|
|
|
1129
1020
|
file: void 0
|
|
1130
1021
|
}
|
|
1131
1022
|
};
|
|
1132
|
-
const finalOptions = await (0,
|
|
1023
|
+
const finalOptions = await (0, import_core4.loadMergedConfig)(resolvedDir, defaults, {
|
|
1133
1024
|
checkNaming: options.naming !== false,
|
|
1134
1025
|
checkPatterns: options.patterns !== false,
|
|
1135
1026
|
minSeverity: options.minSeverity,
|
|
@@ -1138,7 +1029,7 @@ async function consistencyAction(directory, options) {
|
|
|
1138
1029
|
});
|
|
1139
1030
|
const { analyzeConsistency: analyzeConsistency2, calculateConsistencyScore } = await import("@aiready/consistency");
|
|
1140
1031
|
const report = await analyzeConsistency2(finalOptions);
|
|
1141
|
-
const elapsedTime = (0,
|
|
1032
|
+
const elapsedTime = (0, import_core4.getElapsedTime)(startTime);
|
|
1142
1033
|
let consistencyScore;
|
|
1143
1034
|
if (options.score) {
|
|
1144
1035
|
const issues = report.results?.flatMap((r) => r.issues) || [];
|
|
@@ -1155,32 +1046,32 @@ async function consistencyAction(directory, options) {
|
|
|
1155
1046
|
},
|
|
1156
1047
|
...consistencyScore && { scoring: consistencyScore }
|
|
1157
1048
|
};
|
|
1158
|
-
const outputPath = (0,
|
|
1049
|
+
const outputPath = (0, import_core4.resolveOutputPath)(
|
|
1159
1050
|
userOutputFile,
|
|
1160
1051
|
`aiready-report-${getReportTimestamp()}.json`,
|
|
1161
1052
|
resolvedDir
|
|
1162
1053
|
);
|
|
1163
|
-
(0,
|
|
1054
|
+
(0, import_core4.handleJSONOutput)(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
|
|
1164
1055
|
} else if (outputFormat === "markdown") {
|
|
1165
1056
|
const markdown = generateMarkdownReport(report, elapsedTime);
|
|
1166
|
-
const outputPath = (0,
|
|
1057
|
+
const outputPath = (0, import_core4.resolveOutputPath)(
|
|
1167
1058
|
userOutputFile,
|
|
1168
1059
|
`aiready-report-${getReportTimestamp()}.md`,
|
|
1169
1060
|
resolvedDir
|
|
1170
1061
|
);
|
|
1171
1062
|
(0, import_fs3.writeFileSync)(outputPath, markdown);
|
|
1172
|
-
console.log(
|
|
1063
|
+
console.log(import_chalk5.default.green(`\u2705 Report saved to ${outputPath}`));
|
|
1173
1064
|
} else {
|
|
1174
|
-
console.log(
|
|
1175
|
-
console.log(`Files Analyzed: ${
|
|
1176
|
-
console.log(`Total Issues: ${
|
|
1177
|
-
console.log(` Naming: ${
|
|
1178
|
-
console.log(` Patterns: ${
|
|
1179
|
-
console.log(` Architecture: ${
|
|
1180
|
-
console.log(`Analysis Time: ${
|
|
1065
|
+
console.log(import_chalk5.default.bold("\n\u{1F4CA} Summary\n"));
|
|
1066
|
+
console.log(`Files Analyzed: ${import_chalk5.default.cyan(report.summary.filesAnalyzed)}`);
|
|
1067
|
+
console.log(`Total Issues: ${import_chalk5.default.yellow(report.summary.totalIssues)}`);
|
|
1068
|
+
console.log(` Naming: ${import_chalk5.default.yellow(report.summary.namingIssues)}`);
|
|
1069
|
+
console.log(` Patterns: ${import_chalk5.default.yellow(report.summary.patternIssues)}`);
|
|
1070
|
+
console.log(` Architecture: ${import_chalk5.default.yellow(report.summary.architectureIssues || 0)}`);
|
|
1071
|
+
console.log(`Analysis Time: ${import_chalk5.default.gray(elapsedTime + "s")}
|
|
1181
1072
|
`);
|
|
1182
1073
|
if (report.summary.totalIssues === 0) {
|
|
1183
|
-
console.log(
|
|
1074
|
+
console.log(import_chalk5.default.green("\u2728 No consistency issues found! Your codebase is well-maintained.\n"));
|
|
1184
1075
|
} else {
|
|
1185
1076
|
const namingResults = report.results.filter(
|
|
1186
1077
|
(r) => r.issues.some((i) => i.category === "naming")
|
|
@@ -1189,17 +1080,17 @@ async function consistencyAction(directory, options) {
|
|
|
1189
1080
|
(r) => r.issues.some((i) => i.category === "patterns")
|
|
1190
1081
|
);
|
|
1191
1082
|
if (namingResults.length > 0) {
|
|
1192
|
-
console.log(
|
|
1083
|
+
console.log(import_chalk5.default.bold("\u{1F3F7}\uFE0F Naming Issues\n"));
|
|
1193
1084
|
let shown = 0;
|
|
1194
1085
|
for (const result of namingResults) {
|
|
1195
1086
|
if (shown >= 5) break;
|
|
1196
1087
|
for (const issue of result.issues) {
|
|
1197
1088
|
if (shown >= 5) break;
|
|
1198
|
-
const severityColor = issue.severity === "critical" ?
|
|
1199
|
-
console.log(`${severityColor(issue.severity.toUpperCase())} ${
|
|
1089
|
+
const severityColor = issue.severity === "critical" ? import_chalk5.default.red : issue.severity === "major" ? import_chalk5.default.yellow : issue.severity === "minor" ? import_chalk5.default.blue : import_chalk5.default.gray;
|
|
1090
|
+
console.log(`${severityColor(issue.severity.toUpperCase())} ${import_chalk5.default.dim(`${issue.location.file}:${issue.location.line}`)}`);
|
|
1200
1091
|
console.log(` ${issue.message}`);
|
|
1201
1092
|
if (issue.suggestion) {
|
|
1202
|
-
console.log(` ${
|
|
1093
|
+
console.log(` ${import_chalk5.default.dim("\u2192")} ${import_chalk5.default.italic(issue.suggestion)}`);
|
|
1203
1094
|
}
|
|
1204
1095
|
console.log();
|
|
1205
1096
|
shown++;
|
|
@@ -1207,22 +1098,22 @@ async function consistencyAction(directory, options) {
|
|
|
1207
1098
|
}
|
|
1208
1099
|
const remaining = namingResults.reduce((sum, r) => sum + r.issues.length, 0) - shown;
|
|
1209
1100
|
if (remaining > 0) {
|
|
1210
|
-
console.log(
|
|
1101
|
+
console.log(import_chalk5.default.dim(` ... and ${remaining} more issues
|
|
1211
1102
|
`));
|
|
1212
1103
|
}
|
|
1213
1104
|
}
|
|
1214
1105
|
if (patternResults.length > 0) {
|
|
1215
|
-
console.log(
|
|
1106
|
+
console.log(import_chalk5.default.bold("\u{1F504} Pattern Issues\n"));
|
|
1216
1107
|
let shown = 0;
|
|
1217
1108
|
for (const result of patternResults) {
|
|
1218
1109
|
if (shown >= 5) break;
|
|
1219
1110
|
for (const issue of result.issues) {
|
|
1220
1111
|
if (shown >= 5) break;
|
|
1221
|
-
const severityColor = issue.severity === "critical" ?
|
|
1222
|
-
console.log(`${severityColor(issue.severity.toUpperCase())} ${
|
|
1112
|
+
const severityColor = issue.severity === "critical" ? import_chalk5.default.red : issue.severity === "major" ? import_chalk5.default.yellow : issue.severity === "minor" ? import_chalk5.default.blue : import_chalk5.default.gray;
|
|
1113
|
+
console.log(`${severityColor(issue.severity.toUpperCase())} ${import_chalk5.default.dim(`${issue.location.file}:${issue.location.line}`)}`);
|
|
1223
1114
|
console.log(` ${issue.message}`);
|
|
1224
1115
|
if (issue.suggestion) {
|
|
1225
|
-
console.log(` ${
|
|
1116
|
+
console.log(` ${import_chalk5.default.dim("\u2192")} ${import_chalk5.default.italic(issue.suggestion)}`);
|
|
1226
1117
|
}
|
|
1227
1118
|
console.log();
|
|
1228
1119
|
shown++;
|
|
@@ -1230,12 +1121,12 @@ async function consistencyAction(directory, options) {
|
|
|
1230
1121
|
}
|
|
1231
1122
|
const remaining = patternResults.reduce((sum, r) => sum + r.issues.length, 0) - shown;
|
|
1232
1123
|
if (remaining > 0) {
|
|
1233
|
-
console.log(
|
|
1124
|
+
console.log(import_chalk5.default.dim(` ... and ${remaining} more issues
|
|
1234
1125
|
`));
|
|
1235
1126
|
}
|
|
1236
1127
|
}
|
|
1237
1128
|
if (report.recommendations.length > 0) {
|
|
1238
|
-
console.log(
|
|
1129
|
+
console.log(import_chalk5.default.bold("\u{1F4A1} Recommendations\n"));
|
|
1239
1130
|
report.recommendations.forEach((rec, i) => {
|
|
1240
1131
|
console.log(`${i + 1}. ${rec}`);
|
|
1241
1132
|
});
|
|
@@ -1243,23 +1134,23 @@ async function consistencyAction(directory, options) {
|
|
|
1243
1134
|
}
|
|
1244
1135
|
}
|
|
1245
1136
|
if (consistencyScore) {
|
|
1246
|
-
console.log(
|
|
1247
|
-
console.log((0,
|
|
1137
|
+
console.log(import_chalk5.default.bold("\n\u{1F4CA} AI Readiness Score (Consistency)\n"));
|
|
1138
|
+
console.log((0, import_core4.formatToolScore)(consistencyScore));
|
|
1248
1139
|
console.log();
|
|
1249
1140
|
}
|
|
1250
1141
|
}
|
|
1251
1142
|
} catch (error) {
|
|
1252
|
-
(0,
|
|
1143
|
+
(0, import_core4.handleCLIError)(error, "Consistency analysis");
|
|
1253
1144
|
}
|
|
1254
1145
|
}
|
|
1255
1146
|
|
|
1256
1147
|
// src/commands/visualize.ts
|
|
1257
|
-
var
|
|
1148
|
+
var import_chalk6 = __toESM(require("chalk"));
|
|
1258
1149
|
var import_fs4 = require("fs");
|
|
1259
1150
|
var import_path6 = require("path");
|
|
1260
1151
|
var import_child_process = require("child_process");
|
|
1261
|
-
var
|
|
1262
|
-
var
|
|
1152
|
+
var import_core5 = require("@aiready/core");
|
|
1153
|
+
var import_core6 = require("@aiready/core");
|
|
1263
1154
|
async function visualizeAction(directory, options) {
|
|
1264
1155
|
try {
|
|
1265
1156
|
const dirPath = (0, import_path6.resolve)(process.cwd(), directory || ".");
|
|
@@ -1268,10 +1159,10 @@ async function visualizeAction(directory, options) {
|
|
|
1268
1159
|
const latestScan = findLatestScanReport(dirPath);
|
|
1269
1160
|
if (latestScan) {
|
|
1270
1161
|
reportPath = latestScan;
|
|
1271
|
-
console.log(
|
|
1162
|
+
console.log(import_chalk6.default.dim(`Found latest report: ${latestScan.split("/").pop()}`));
|
|
1272
1163
|
} else {
|
|
1273
|
-
console.error(
|
|
1274
|
-
console.log(
|
|
1164
|
+
console.error(import_chalk6.default.red("\u274C No AI readiness report found"));
|
|
1165
|
+
console.log(import_chalk6.default.dim(`
|
|
1275
1166
|
Generate a report with:
|
|
1276
1167
|
aiready scan --output json
|
|
1277
1168
|
|
|
@@ -1380,22 +1271,22 @@ Or specify a custom report:
|
|
|
1380
1271
|
devServerStarted = true;
|
|
1381
1272
|
return;
|
|
1382
1273
|
} else {
|
|
1383
|
-
console.log(
|
|
1384
|
-
console.log(
|
|
1274
|
+
console.log(import_chalk6.default.yellow("\u26A0\uFE0F Dev server not available (requires local @aiready/visualizer with web assets)."));
|
|
1275
|
+
console.log(import_chalk6.default.cyan(" Falling back to static HTML generation...\n"));
|
|
1385
1276
|
useDevMode = false;
|
|
1386
1277
|
}
|
|
1387
1278
|
} catch (err) {
|
|
1388
1279
|
console.error("Failed to start dev server:", err);
|
|
1389
|
-
console.log(
|
|
1280
|
+
console.log(import_chalk6.default.cyan(" Falling back to static HTML generation...\n"));
|
|
1390
1281
|
useDevMode = false;
|
|
1391
1282
|
}
|
|
1392
1283
|
}
|
|
1393
1284
|
console.log("Generating HTML...");
|
|
1394
|
-
const html = (0,
|
|
1285
|
+
const html = (0, import_core6.generateHTML)(graph);
|
|
1395
1286
|
const defaultOutput = "visualization.html";
|
|
1396
1287
|
const outPath = (0, import_path6.resolve)(dirPath, options.output || defaultOutput);
|
|
1397
1288
|
(0, import_fs4.writeFileSync)(outPath, html, "utf8");
|
|
1398
|
-
console.log(
|
|
1289
|
+
console.log(import_chalk6.default.green(`\u2705 Visualization written to: ${outPath}`));
|
|
1399
1290
|
if (options.open || options.serve) {
|
|
1400
1291
|
const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
1401
1292
|
if (options.serve) {
|
|
@@ -1421,7 +1312,7 @@ Or specify a custom report:
|
|
|
1421
1312
|
});
|
|
1422
1313
|
server.listen(port, () => {
|
|
1423
1314
|
const addr = `http://localhost:${port}/`;
|
|
1424
|
-
console.log(
|
|
1315
|
+
console.log(import_chalk6.default.cyan(`\u{1F310} Local visualization server running at ${addr}`));
|
|
1425
1316
|
(0, import_child_process.spawn)(opener, [`"${addr}"`], { shell: true });
|
|
1426
1317
|
});
|
|
1427
1318
|
process.on("SIGINT", () => {
|
|
@@ -1436,7 +1327,7 @@ Or specify a custom report:
|
|
|
1436
1327
|
}
|
|
1437
1328
|
}
|
|
1438
1329
|
} catch (err) {
|
|
1439
|
-
(0,
|
|
1330
|
+
(0, import_core5.handleCLIError)(err, "Visualization");
|
|
1440
1331
|
}
|
|
1441
1332
|
}
|
|
1442
1333
|
var visualizeHelpText = `
|
|
@@ -1466,10 +1357,17 @@ NOTES:
|
|
|
1466
1357
|
- Same options as 'visualize'. Use --serve to host the static HTML, or --dev for live reload.
|
|
1467
1358
|
`;
|
|
1468
1359
|
|
|
1469
|
-
// src/commands/
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1360
|
+
// src/commands/hallucination-risk.ts
|
|
1361
|
+
var import_chalk7 = __toESM(require("chalk"));
|
|
1362
|
+
var import_core7 = require("@aiready/core");
|
|
1363
|
+
|
|
1364
|
+
// src/commands/agent-grounding.ts
|
|
1365
|
+
var import_chalk8 = __toESM(require("chalk"));
|
|
1366
|
+
var import_core8 = require("@aiready/core");
|
|
1367
|
+
|
|
1368
|
+
// src/commands/testability.ts
|
|
1369
|
+
var import_chalk9 = __toESM(require("chalk"));
|
|
1370
|
+
var import_core9 = require("@aiready/core");
|
|
1473
1371
|
|
|
1474
1372
|
// src/cli.ts
|
|
1475
1373
|
var import_meta = {};
|