@aiready/cli 0.9.35 → 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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @aiready/cli@0.9.35 build /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.9.38 build /Users/pengcao/projects/aiready/packages/cli
4
4
  > tsup src/index.ts src/cli.ts --format cjs,esm
5
5
 
6
6
  CLI Building entry: src/cli.ts, src/index.ts
@@ -9,10 +9,21 @@
9
9
  CLI Target: es2020
10
10
  CJS Build start
11
11
  ESM Build start
12
- ESM dist/cli.mjs 56.83 KB
12
+
13
+ [10:33:35 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
14
+
15
+ src/cli.ts:22:31:
16
+  22 │ return dirname(fileURLToPath(import.meta.url));
17
+ ╵ ~~~~~~~~~~~
18
+
19
+ You need to set the output format to "esm" for "import.meta" to work correctly.
20
+
21
+
22
+
23
+ CJS dist/cli.js 72.49 KB
24
+ CJS dist/index.js 8.47 KB
25
+ CJS ⚡️ Build success in 31ms
13
26
  ESM dist/index.mjs 138.00 B
14
- ESM dist/chunk-5GZDRZ3T.mjs 4.17 KB
15
- ESM ⚡️ Build success in 19ms
16
- CJS dist/index.js 4.93 KB
17
- CJS dist/cli.js 64.03 KB
18
- CJS ⚡️ Build success in 19ms
27
+ ESM dist/cli.mjs 62.83 KB
28
+ ESM dist/chunk-JQG7ZATX.mjs 7.12 KB
29
+ ESM ⚡️ Build success in 31ms
@@ -1,17 +1,17 @@
1
1
 
2
2
  
3
- > @aiready/cli@0.9.35 test /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.9.38 test /Users/pengcao/projects/aiready/packages/cli
4
4
  > vitest run
5
5
 
6
6
  [?25l
7
7
   RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/cli
8
8
 
9
- ✓ src/__tests__/cli.test.ts (3 tests) 15ms
10
- ✓ dist/__tests__/cli.test.js (3 tests) 2ms
9
+ ✓ src/__tests__/cli.test.ts (3 tests) 6ms
10
+ ✓ dist/__tests__/cli.test.js (3 tests) 3ms
11
11
 
12
12
   Test Files  2 passed (2)
13
13
   Tests  6 passed (6)
14
-  Start at  20:42:26
15
-  Duration  2.30s (transform 486ms, setup 0ms, import 3.28s, tests 17ms, environment 0ms)
14
+  Start at  22:34:03
15
+  Duration  1.10s (transform 479ms, setup 0ms, import 1.68s, tests 8ms, environment 0ms)
16
16
 
17
17
  [?25h
@@ -0,0 +1,7 @@
1
+ import {
2
+ agentGroundingAction
3
+ } from "./chunk-YIS6WTY5.mjs";
4
+ import "./chunk-Y6FXYEAI.mjs";
5
+ export {
6
+ agentGroundingAction
7
+ };
@@ -0,0 +1,126 @@
1
+ // src/index.ts
2
+ import { analyzePatterns } from "@aiready/pattern-detect";
3
+ import { analyzeContext } from "@aiready/context-analyzer";
4
+ import { analyzeConsistency } from "@aiready/consistency";
5
+ var severityOrder = {
6
+ critical: 4,
7
+ major: 3,
8
+ minor: 2,
9
+ info: 1
10
+ };
11
+ function sortBySeverity(results) {
12
+ return results.map((file) => {
13
+ const sortedIssues = [...file.issues].sort((a, b) => {
14
+ const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
15
+ if (severityDiff !== 0) return severityDiff;
16
+ return (a.location?.line || 0) - (b.location?.line || 0);
17
+ });
18
+ return { ...file, issues: sortedIssues };
19
+ }).sort((a, b) => {
20
+ const aMaxSeverity = Math.max(...a.issues.map((i) => severityOrder[i.severity] || 0), 0);
21
+ const bMaxSeverity = Math.max(...b.issues.map((i) => severityOrder[i.severity] || 0), 0);
22
+ if (aMaxSeverity !== bMaxSeverity) {
23
+ return bMaxSeverity - aMaxSeverity;
24
+ }
25
+ if (a.issues.length !== b.issues.length) {
26
+ return b.issues.length - a.issues.length;
27
+ }
28
+ return a.fileName.localeCompare(b.fileName);
29
+ });
30
+ }
31
+ async function analyzeUnified(options) {
32
+ const startTime = Date.now();
33
+ const tools = options.tools || ["patterns", "context", "consistency"];
34
+ const result = {
35
+ summary: {
36
+ totalIssues: 0,
37
+ toolsRun: tools,
38
+ executionTime: 0
39
+ }
40
+ };
41
+ if (tools.includes("patterns")) {
42
+ const patternResult = await analyzePatterns(options);
43
+ if (options.progressCallback) {
44
+ options.progressCallback({ tool: "patterns", data: patternResult });
45
+ }
46
+ result.patterns = sortBySeverity(patternResult.results);
47
+ result.duplicates = patternResult.duplicates;
48
+ result.summary.totalIssues += patternResult.results.reduce(
49
+ (sum, file) => sum + file.issues.length,
50
+ 0
51
+ );
52
+ }
53
+ if (tools.includes("context")) {
54
+ const contextResults = await analyzeContext(options);
55
+ if (options.progressCallback) {
56
+ options.progressCallback({ tool: "context", data: contextResults });
57
+ }
58
+ result.context = contextResults.sort((a, b) => {
59
+ const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
60
+ if (severityDiff !== 0) return severityDiff;
61
+ if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
62
+ return b.fragmentationScore - a.fragmentationScore;
63
+ });
64
+ result.summary.totalIssues += result.context?.length || 0;
65
+ }
66
+ if (tools.includes("consistency")) {
67
+ const consistencyOptions = {
68
+ rootDir: options.rootDir,
69
+ include: options.include,
70
+ exclude: options.exclude,
71
+ ...options.consistency || {}
72
+ };
73
+ const report = await analyzeConsistency(consistencyOptions);
74
+ if (options.progressCallback) {
75
+ options.progressCallback({ tool: "consistency", data: report });
76
+ }
77
+ if (report.results) {
78
+ report.results = sortBySeverity(report.results);
79
+ }
80
+ result.consistency = report;
81
+ result.summary.totalIssues += report.summary.totalIssues;
82
+ }
83
+ result.summary.executionTime = Date.now() - startTime;
84
+ return result;
85
+ }
86
+ function generateUnifiedSummary(result) {
87
+ const { summary } = result;
88
+ let output = `\u{1F680} AIReady Analysis Complete
89
+
90
+ `;
91
+ output += `\u{1F4CA} Summary:
92
+ `;
93
+ output += ` Tools run: ${summary.toolsRun.join(", ")}
94
+ `;
95
+ output += ` Total issues found: ${summary.totalIssues}
96
+ `;
97
+ output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
98
+
99
+ `;
100
+ if (result.patterns) {
101
+ output += `\u{1F50D} Pattern Analysis: ${result.patterns.length} issues
102
+ `;
103
+ }
104
+ if (result.context) {
105
+ output += `\u{1F9E0} Context Analysis: ${result.context.length} issues
106
+ `;
107
+ }
108
+ if (result.consistency) {
109
+ output += `\u{1F3F7}\uFE0F Consistency Analysis: ${result.consistency.summary.totalIssues} issues
110
+ `;
111
+ }
112
+ if (result.docDrift) {
113
+ output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.issues?.length || 0} issues
114
+ `;
115
+ }
116
+ if (result.deps) {
117
+ output += `\u{1F4E6} Dependency Health: ${result.deps.issues?.length || 0} issues
118
+ `;
119
+ }
120
+ return output;
121
+ }
122
+
123
+ export {
124
+ analyzeUnified,
125
+ generateUnifiedSummary
126
+ };
@@ -0,0 +1,211 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/index.ts
9
+ import { analyzePatterns } from "@aiready/pattern-detect";
10
+ import { analyzeContext } from "@aiready/context-analyzer";
11
+ import { analyzeConsistency } from "@aiready/consistency";
12
+ var severityOrder = {
13
+ critical: 4,
14
+ major: 3,
15
+ minor: 2,
16
+ info: 1
17
+ };
18
+ function sortBySeverity(results) {
19
+ return results.map((file) => {
20
+ const sortedIssues = [...file.issues].sort((a, b) => {
21
+ const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
22
+ if (severityDiff !== 0) return severityDiff;
23
+ return (a.location?.line || 0) - (b.location?.line || 0);
24
+ });
25
+ return { ...file, issues: sortedIssues };
26
+ }).sort((a, b) => {
27
+ const aMaxSeverity = Math.max(...a.issues.map((i) => severityOrder[i.severity] || 0), 0);
28
+ const bMaxSeverity = Math.max(...b.issues.map((i) => severityOrder[i.severity] || 0), 0);
29
+ if (aMaxSeverity !== bMaxSeverity) {
30
+ return bMaxSeverity - aMaxSeverity;
31
+ }
32
+ if (a.issues.length !== b.issues.length) {
33
+ return b.issues.length - a.issues.length;
34
+ }
35
+ return a.fileName.localeCompare(b.fileName);
36
+ });
37
+ }
38
+ async function analyzeUnified(options) {
39
+ const startTime = Date.now();
40
+ const tools = options.tools || ["patterns", "context", "consistency"];
41
+ const result = {
42
+ summary: {
43
+ totalIssues: 0,
44
+ toolsRun: tools,
45
+ executionTime: 0
46
+ }
47
+ };
48
+ if (tools.includes("patterns")) {
49
+ const patternResult = await analyzePatterns(options);
50
+ if (options.progressCallback) {
51
+ options.progressCallback({ tool: "patterns", data: patternResult });
52
+ }
53
+ result.patterns = sortBySeverity(patternResult.results);
54
+ result.duplicates = patternResult.duplicates;
55
+ result.summary.totalIssues += patternResult.results.reduce(
56
+ (sum, file) => sum + file.issues.length,
57
+ 0
58
+ );
59
+ }
60
+ if (tools.includes("context")) {
61
+ const contextResults = await analyzeContext(options);
62
+ if (options.progressCallback) {
63
+ options.progressCallback({ tool: "context", data: contextResults });
64
+ }
65
+ result.context = contextResults.sort((a, b) => {
66
+ const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
67
+ if (severityDiff !== 0) return severityDiff;
68
+ if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
69
+ return b.fragmentationScore - a.fragmentationScore;
70
+ });
71
+ result.summary.totalIssues += result.context?.length || 0;
72
+ }
73
+ if (tools.includes("consistency")) {
74
+ const consistencyOptions = {
75
+ rootDir: options.rootDir,
76
+ include: options.include,
77
+ exclude: options.exclude,
78
+ ...options.consistency || {}
79
+ };
80
+ const report = await analyzeConsistency(consistencyOptions);
81
+ if (options.progressCallback) {
82
+ options.progressCallback({ tool: "consistency", data: report });
83
+ }
84
+ if (report.results) {
85
+ report.results = sortBySeverity(report.results);
86
+ }
87
+ result.consistency = report;
88
+ result.summary.totalIssues += report.summary.totalIssues;
89
+ }
90
+ if (tools.includes("doc-drift")) {
91
+ const { analyzeDocDrift } = await import("@aiready/doc-drift");
92
+ const report = await analyzeDocDrift({
93
+ rootDir: options.rootDir,
94
+ include: options.include,
95
+ exclude: options.exclude
96
+ });
97
+ if (options.progressCallback) {
98
+ options.progressCallback({ tool: "doc-drift", data: report });
99
+ }
100
+ result.docDrift = report;
101
+ result.summary.totalIssues += report.issues?.length || 0;
102
+ }
103
+ if (tools.includes("deps-health")) {
104
+ const { analyzeDeps } = await import("@aiready/deps");
105
+ const report = await analyzeDeps({
106
+ rootDir: options.rootDir,
107
+ include: options.include,
108
+ exclude: options.exclude
109
+ });
110
+ if (options.progressCallback) {
111
+ options.progressCallback({ tool: "deps-health", data: report });
112
+ }
113
+ result.deps = report;
114
+ result.summary.totalIssues += report.issues?.length || 0;
115
+ }
116
+ if (tools.includes("hallucination")) {
117
+ const { analyzeHallucinationRisk } = await import("@aiready/hallucination-risk");
118
+ const report = await analyzeHallucinationRisk({
119
+ rootDir: options.rootDir,
120
+ include: options.include,
121
+ exclude: options.exclude
122
+ });
123
+ if (options.progressCallback) {
124
+ options.progressCallback({ tool: "hallucination", data: report });
125
+ }
126
+ result.hallucination = report;
127
+ result.summary.totalIssues += report.results?.reduce((sum, r) => sum + (r.issues?.length || 0), 0) || 0;
128
+ }
129
+ if (tools.includes("grounding")) {
130
+ const { analyzeAgentGrounding } = await import("@aiready/agent-grounding");
131
+ const report = await analyzeAgentGrounding({
132
+ rootDir: options.rootDir,
133
+ include: options.include,
134
+ exclude: options.exclude
135
+ });
136
+ if (options.progressCallback) {
137
+ options.progressCallback({ tool: "grounding", data: report });
138
+ }
139
+ result.grounding = report;
140
+ result.summary.totalIssues += report.issues?.length || 0;
141
+ }
142
+ if (tools.includes("testability")) {
143
+ const { analyzeTestability } = await import("@aiready/testability");
144
+ const report = await analyzeTestability({
145
+ rootDir: options.rootDir,
146
+ include: options.include,
147
+ exclude: options.exclude
148
+ });
149
+ if (options.progressCallback) {
150
+ options.progressCallback({ tool: "testability", data: report });
151
+ }
152
+ result.testability = report;
153
+ result.summary.totalIssues += report.issues?.length || 0;
154
+ }
155
+ result.summary.executionTime = Date.now() - startTime;
156
+ return result;
157
+ }
158
+ function generateUnifiedSummary(result) {
159
+ const { summary } = result;
160
+ let output = `\u{1F680} AIReady Analysis Complete
161
+
162
+ `;
163
+ output += `\u{1F4CA} Summary:
164
+ `;
165
+ output += ` Tools run: ${summary.toolsRun.join(", ")}
166
+ `;
167
+ output += ` Total issues found: ${summary.totalIssues}
168
+ `;
169
+ output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
170
+
171
+ `;
172
+ if (result.patterns) {
173
+ output += `\u{1F50D} Pattern Analysis: ${result.patterns.length} issues
174
+ `;
175
+ }
176
+ if (result.context) {
177
+ output += `\u{1F9E0} Context Analysis: ${result.context.length} issues
178
+ `;
179
+ }
180
+ if (result.consistency) {
181
+ output += `\u{1F3F7}\uFE0F Consistency Analysis: ${result.consistency.summary.totalIssues} issues
182
+ `;
183
+ }
184
+ if (result.docDrift) {
185
+ output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.issues?.length || 0} issues
186
+ `;
187
+ }
188
+ if (result.deps) {
189
+ output += `\u{1F4E6} Dependency Health: ${result.deps.issues?.length || 0} issues
190
+ `;
191
+ }
192
+ if (result.hallucination) {
193
+ output += `\u{1F9E0} Hallucination Risk: ${result.hallucination.summary?.totalSignals || 0} signals
194
+ `;
195
+ }
196
+ if (result.grounding) {
197
+ output += `\u{1F9ED} Agent Grounding: ${result.grounding.issues?.length || 0} issues
198
+ `;
199
+ }
200
+ if (result.testability) {
201
+ output += `\u{1F9EA} Testability Index: ${result.testability.issues?.length || 0} issues
202
+ `;
203
+ }
204
+ return output;
205
+ }
206
+
207
+ export {
208
+ __require,
209
+ analyzeUnified,
210
+ generateUnifiedSummary
211
+ };
@@ -0,0 +1,152 @@
1
+ // src/index.ts
2
+ import { analyzePatterns } from "@aiready/pattern-detect";
3
+ import { analyzeContext } from "@aiready/context-analyzer";
4
+ import { analyzeConsistency } from "@aiready/consistency";
5
+ var severityOrder = {
6
+ critical: 4,
7
+ major: 3,
8
+ minor: 2,
9
+ info: 1
10
+ };
11
+ function sortBySeverity(results) {
12
+ return results.map((file) => {
13
+ const sortedIssues = [...file.issues].sort((a, b) => {
14
+ const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
15
+ if (severityDiff !== 0) return severityDiff;
16
+ return (a.location?.line || 0) - (b.location?.line || 0);
17
+ });
18
+ return { ...file, issues: sortedIssues };
19
+ }).sort((a, b) => {
20
+ const aMaxSeverity = Math.max(...a.issues.map((i) => severityOrder[i.severity] || 0), 0);
21
+ const bMaxSeverity = Math.max(...b.issues.map((i) => severityOrder[i.severity] || 0), 0);
22
+ if (aMaxSeverity !== bMaxSeverity) {
23
+ return bMaxSeverity - aMaxSeverity;
24
+ }
25
+ if (a.issues.length !== b.issues.length) {
26
+ return b.issues.length - a.issues.length;
27
+ }
28
+ return a.fileName.localeCompare(b.fileName);
29
+ });
30
+ }
31
+ async function analyzeUnified(options) {
32
+ const startTime = Date.now();
33
+ const tools = options.tools || ["patterns", "context", "consistency"];
34
+ const result = {
35
+ summary: {
36
+ totalIssues: 0,
37
+ toolsRun: tools,
38
+ executionTime: 0
39
+ }
40
+ };
41
+ if (tools.includes("patterns")) {
42
+ const patternResult = await analyzePatterns(options);
43
+ if (options.progressCallback) {
44
+ options.progressCallback({ tool: "patterns", data: patternResult });
45
+ }
46
+ result.patterns = sortBySeverity(patternResult.results);
47
+ result.duplicates = patternResult.duplicates;
48
+ result.summary.totalIssues += patternResult.results.reduce(
49
+ (sum, file) => sum + file.issues.length,
50
+ 0
51
+ );
52
+ }
53
+ if (tools.includes("context")) {
54
+ const contextResults = await analyzeContext(options);
55
+ if (options.progressCallback) {
56
+ options.progressCallback({ tool: "context", data: contextResults });
57
+ }
58
+ result.context = contextResults.sort((a, b) => {
59
+ const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
60
+ if (severityDiff !== 0) return severityDiff;
61
+ if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
62
+ return b.fragmentationScore - a.fragmentationScore;
63
+ });
64
+ result.summary.totalIssues += result.context?.length || 0;
65
+ }
66
+ if (tools.includes("consistency")) {
67
+ const consistencyOptions = {
68
+ rootDir: options.rootDir,
69
+ include: options.include,
70
+ exclude: options.exclude,
71
+ ...options.consistency || {}
72
+ };
73
+ const report = await analyzeConsistency(consistencyOptions);
74
+ if (options.progressCallback) {
75
+ options.progressCallback({ tool: "consistency", data: report });
76
+ }
77
+ if (report.results) {
78
+ report.results = sortBySeverity(report.results);
79
+ }
80
+ result.consistency = report;
81
+ result.summary.totalIssues += report.summary.totalIssues;
82
+ }
83
+ if (tools.includes("doc-drift")) {
84
+ const { analyzeDocDrift } = await import("@aiready/doc-drift");
85
+ const report = await analyzeDocDrift({
86
+ rootDir: options.rootDir,
87
+ include: options.include,
88
+ exclude: options.exclude
89
+ });
90
+ if (options.progressCallback) {
91
+ options.progressCallback({ tool: "doc-drift", data: report });
92
+ }
93
+ result.docDrift = report;
94
+ result.summary.totalIssues += report.issues?.length || 0;
95
+ }
96
+ if (tools.includes("deps-health")) {
97
+ const { analyzeDeps } = await import("@aiready/deps");
98
+ const report = await analyzeDeps({
99
+ rootDir: options.rootDir,
100
+ include: options.include,
101
+ exclude: options.exclude
102
+ });
103
+ if (options.progressCallback) {
104
+ options.progressCallback({ tool: "deps-health", data: report });
105
+ }
106
+ result.deps = report;
107
+ result.summary.totalIssues += report.issues?.length || 0;
108
+ }
109
+ result.summary.executionTime = Date.now() - startTime;
110
+ return result;
111
+ }
112
+ function generateUnifiedSummary(result) {
113
+ const { summary } = result;
114
+ let output = `\u{1F680} AIReady Analysis Complete
115
+
116
+ `;
117
+ output += `\u{1F4CA} Summary:
118
+ `;
119
+ output += ` Tools run: ${summary.toolsRun.join(", ")}
120
+ `;
121
+ output += ` Total issues found: ${summary.totalIssues}
122
+ `;
123
+ output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
124
+
125
+ `;
126
+ if (result.patterns) {
127
+ output += `\u{1F50D} Pattern Analysis: ${result.patterns.length} issues
128
+ `;
129
+ }
130
+ if (result.context) {
131
+ output += `\u{1F9E0} Context Analysis: ${result.context.length} issues
132
+ `;
133
+ }
134
+ if (result.consistency) {
135
+ output += `\u{1F3F7}\uFE0F Consistency Analysis: ${result.consistency.summary.totalIssues} issues
136
+ `;
137
+ }
138
+ if (result.docDrift) {
139
+ output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.issues?.length || 0} issues
140
+ `;
141
+ }
142
+ if (result.deps) {
143
+ output += `\u{1F4E6} Dependency Health: ${result.deps.issues?.length || 0} issues
144
+ `;
145
+ }
146
+ return output;
147
+ }
148
+
149
+ export {
150
+ analyzeUnified,
151
+ generateUnifiedSummary
152
+ };
@@ -0,0 +1,39 @@
1
+ // src/commands/hallucination-risk.ts
2
+ import chalk from "chalk";
3
+ import { loadConfig, mergeConfigWithDefaults } from "@aiready/core";
4
+ async function hallucinationRiskAction(directory, options) {
5
+ const { analyzeHallucinationRisk, calculateHallucinationScore } = await import("@aiready/hallucination-risk");
6
+ const config = await loadConfig(directory);
7
+ const merged = mergeConfigWithDefaults(config, {
8
+ minSeverity: "info"
9
+ });
10
+ const report = await analyzeHallucinationRisk({
11
+ rootDir: directory,
12
+ minSeverity: options.minSeverity ?? merged.minSeverity ?? "info",
13
+ include: options.include,
14
+ exclude: options.exclude
15
+ });
16
+ const scoring = calculateHallucinationScore(report);
17
+ if (options.output === "json") {
18
+ return scoring;
19
+ }
20
+ const { summary } = report;
21
+ const ratingColors = {
22
+ minimal: chalk.green,
23
+ low: chalk.cyan,
24
+ moderate: chalk.yellow,
25
+ high: chalk.red,
26
+ severe: chalk.bgRed.white
27
+ };
28
+ const color = ratingColors[summary.rating] ?? chalk.white;
29
+ console.log(` \u{1F9E0} Hallucination Risk: ${chalk.bold(scoring.score + "/100")} (${color(summary.rating)})`);
30
+ console.log(` Top Risk: ${chalk.italic(summary.topRisk)}`);
31
+ if (summary.totalSignals > 0) {
32
+ console.log(chalk.dim(` ${summary.criticalSignals} critical ${summary.majorSignals} major ${summary.minorSignals} minor signals`));
33
+ }
34
+ return scoring;
35
+ }
36
+
37
+ export {
38
+ hallucinationRiskAction
39
+ };
@@ -0,0 +1,46 @@
1
+ // src/commands/testability.ts
2
+ import chalk from "chalk";
3
+ import { loadConfig, mergeConfigWithDefaults } from "@aiready/core";
4
+ async function testabilityAction(directory, options) {
5
+ const { analyzeTestability, calculateTestabilityScore } = await import("@aiready/testability");
6
+ const config = await loadConfig(directory);
7
+ const merged = mergeConfigWithDefaults(config, {
8
+ minCoverageRatio: 0.3
9
+ });
10
+ const report = await analyzeTestability({
11
+ rootDir: directory,
12
+ minCoverageRatio: options.minCoverageRatio ?? merged.minCoverageRatio,
13
+ include: options.include,
14
+ exclude: options.exclude
15
+ });
16
+ const scoring = calculateTestabilityScore(report);
17
+ if (options.output === "json") {
18
+ return scoring;
19
+ }
20
+ const safetyIcons = {
21
+ "safe": "\u2705",
22
+ "moderate-risk": "\u26A0\uFE0F ",
23
+ "high-risk": "\u{1F534}",
24
+ "blind-risk": "\u{1F480}"
25
+ };
26
+ const safetyColors = {
27
+ "safe": chalk.green,
28
+ "moderate-risk": chalk.yellow,
29
+ "high-risk": chalk.red,
30
+ "blind-risk": chalk.bgRed.white
31
+ };
32
+ const safety = report.summary.aiChangeSafetyRating;
33
+ const icon = safetyIcons[safety] ?? "\u2753";
34
+ const color = safetyColors[safety] ?? chalk.white;
35
+ console.log(` \u{1F9EA} Testability: ${chalk.bold(scoring.score + "/100")} (${report.summary.rating})`);
36
+ console.log(` AI Change Safety: ${color(`${icon} ${safety.toUpperCase()}`)}`);
37
+ console.log(chalk.dim(` Coverage: ${Math.round(report.summary.coverageRatio * 100)}% (${report.rawData.testFiles} test / ${report.rawData.sourceFiles} source files)`));
38
+ if (safety === "blind-risk") {
39
+ console.log(chalk.red.bold("\n \u26A0\uFE0F NO TESTS \u2014 AI changes to this codebase are completely unverifiable!\n"));
40
+ }
41
+ return scoring;
42
+ }
43
+
44
+ export {
45
+ testabilityAction
46
+ };
@@ -0,0 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ export {
9
+ __require
10
+ };
@@ -0,0 +1,35 @@
1
+ // src/commands/agent-grounding.ts
2
+ import chalk from "chalk";
3
+ import { loadConfig, mergeConfigWithDefaults } from "@aiready/core";
4
+ async function agentGroundingAction(directory, options) {
5
+ const { analyzeAgentGrounding, calculateGroundingScore } = await import("@aiready/agent-grounding");
6
+ const config = await loadConfig(directory);
7
+ const merged = mergeConfigWithDefaults(config, {
8
+ maxRecommendedDepth: 4,
9
+ readmeStaleDays: 90
10
+ });
11
+ const report = await analyzeAgentGrounding({
12
+ rootDir: directory,
13
+ maxRecommendedDepth: options.maxDepth ?? merged.maxRecommendedDepth,
14
+ readmeStaleDays: options.readmeStaleDays ?? merged.readmeStaleDays,
15
+ include: options.include,
16
+ exclude: options.exclude
17
+ });
18
+ const scoring = calculateGroundingScore(report);
19
+ if (options.output === "json") {
20
+ return scoring;
21
+ }
22
+ const scoreColor = (s) => s >= 85 ? chalk.green : s >= 70 ? chalk.cyan : s >= 50 ? chalk.yellow : chalk.red;
23
+ console.log(` \u{1F9ED} Agent Grounding: ${chalk.bold(scoring.score + "/100")} (${report.summary.rating})`);
24
+ const dims = report.summary.dimensions;
25
+ const worstDim = Object.entries(dims).sort(([, a], [, b]) => a - b)[0];
26
+ if (worstDim && worstDim[1] < 70) {
27
+ const name = worstDim[0].replace(/([A-Z])/g, " $1").replace("Score", "").trim();
28
+ console.log(chalk.dim(` Weakest dimension: ${name} (${worstDim[1]}/100)`));
29
+ }
30
+ return scoring;
31
+ }
32
+
33
+ export {
34
+ agentGroundingAction
35
+ };