@aiready/testability 0.1.11 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @aiready/testability@0.1.11 build /Users/pengcao/projects/aiready/packages/testability
3
+ > @aiready/testability@0.1.12 build /Users/pengcao/projects/aiready/packages/testability
4
4
  > tsup src/index.ts src/cli.ts --format cjs,esm --dts
5
5
 
6
6
  CLI Building entry: src/cli.ts, src/index.ts
@@ -11,13 +11,13 @@
11
11
  ESM Build start
12
12
  ESM dist/index.mjs 152.00 B
13
13
  ESM dist/chunk-DDNB7FI4.mjs 10.93 KB
14
- ESM dist/cli.mjs 6.37 KB
15
- ESM ⚡️ Build success in 47ms
14
+ ESM dist/cli.mjs 5.75 KB
15
+ ESM ⚡️ Build success in 117ms
16
16
  CJS dist/index.js 12.12 KB
17
- CJS dist/cli.js 18.89 KB
18
- CJS ⚡️ Build success in 47ms
17
+ CJS dist/cli.js 18.21 KB
18
+ CJS ⚡️ Build success in 117ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 1156ms
20
+ DTS ⚡️ Build success in 3196ms
21
21
  DTS dist/cli.d.ts 20.00 B
22
22
  DTS dist/index.d.ts 2.64 KB
23
23
  DTS dist/cli.d.mts 20.00 B
@@ -1,16 +1,16 @@
1
1
 
2
2
  
3
- > @aiready/testability@0.1.11 test /Users/pengcao/projects/aiready/packages/testability
3
+ > @aiready/testability@0.1.12 test /Users/pengcao/projects/aiready/packages/testability
4
4
  > vitest run
5
5
 
6
6
  [?25l
7
7
   RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/testability
8
8
 
9
- ✓ src/__tests__/analyzer.test.ts (3 tests) 58ms
9
+ ✓ src/__tests__/analyzer.test.ts (3 tests) 344ms
10
10
 
11
11
   Test Files  1 passed (1)
12
12
   Tests  3 passed (3)
13
-  Start at  12:53:40
14
-  Duration  754ms (transform 172ms, setup 0ms, import 499ms, tests 58ms, environment 0ms)
13
+  Start at  16:12:21
14
+  Duration  2.16s (transform 365ms, setup 0ms, import 1.64s, tests 344ms, environment 0ms)
15
15
 
16
16
  [?25h
package/dist/cli.js CHANGED
@@ -424,37 +424,6 @@ EXAMPLES:
424
424
  }
425
425
  });
426
426
  program.parse();
427
- function safetyColor(rating) {
428
- switch (rating) {
429
- case "safe":
430
- return import_chalk.default.green;
431
- case "moderate-risk":
432
- return import_chalk.default.yellow;
433
- case "high-risk":
434
- return import_chalk.default.red;
435
- case "blind-risk":
436
- return import_chalk.default.bgRed.white;
437
- default:
438
- return import_chalk.default.white;
439
- }
440
- }
441
- function safetyIcon(rating) {
442
- switch (rating) {
443
- case "safe":
444
- return "\u2705";
445
- case "moderate-risk":
446
- return "\u26A0\uFE0F ";
447
- case "high-risk":
448
- return "\u{1F534}";
449
- case "blind-risk":
450
- return "\u{1F480}";
451
- default:
452
- return "\u2753";
453
- }
454
- }
455
- function scoreBar(val) {
456
- return "\u2588".repeat(Math.round(val / 10)).padEnd(10, "\u2591");
457
- }
458
427
  function displayConsoleReport(report, scoring, elapsed) {
459
428
  const { summary, rawData, issues, recommendations } = report;
460
429
  const safetyRating = summary.aiChangeSafetyRating;
@@ -474,8 +443,9 @@ function displayConsoleReport(report, scoring, elapsed) {
474
443
  );
475
444
  console.log();
476
445
  }
446
+ const safetyColor = (0, import_core2.getSeverityColor)(safetyRating, import_chalk.default);
477
447
  console.log(
478
- `AI Change Safety: ${safetyColor(safetyRating)(`${safetyIcon(safetyRating)} ${safetyRating.toUpperCase()}`)}`
448
+ `AI Change Safety: ${safetyColor(`${(0, import_core2.getSafetyIcon)(safetyRating)} ${safetyRating.toUpperCase()}`)}`
479
449
  );
480
450
  console.log(
481
451
  `Score: ${import_chalk.default.bold(summary.score + "/100")} (${summary.rating})`
@@ -498,12 +468,12 @@ function displayConsoleReport(report, scoring, elapsed) {
498
468
  ];
499
469
  for (const [name, val] of dims) {
500
470
  const color = val >= 70 ? import_chalk.default.green : val >= 50 ? import_chalk.default.yellow : import_chalk.default.red;
501
- console.log(` ${name.padEnd(22)} ${color(scoreBar(val))} ${val}/100`);
471
+ console.log(` ${name.padEnd(22)} ${color((0, import_core2.getScoreBar)(val))} ${val}/100`);
502
472
  }
503
473
  if (issues.length > 0) {
504
474
  console.log(import_chalk.default.bold("\n\u26A0\uFE0F Issues\n"));
505
475
  for (const issue of issues) {
506
- const sev = issue.severity === "critical" ? import_chalk.default.red : issue.severity === "major" ? import_chalk.default.yellow : import_chalk.default.blue;
476
+ const sev = (0, import_core2.getSeverityColor)(issue.severity, import_chalk.default);
507
477
  console.log(`${sev(issue.severity.toUpperCase())} ${issue.message}`);
508
478
  if (issue.suggestion)
509
479
  console.log(
package/dist/cli.mjs CHANGED
@@ -12,7 +12,10 @@ import { dirname } from "path";
12
12
  import {
13
13
  loadConfig,
14
14
  mergeConfigWithDefaults,
15
- resolveOutputPath
15
+ resolveOutputPath,
16
+ getScoreBar,
17
+ getSafetyIcon,
18
+ getSeverityColor
16
19
  } from "@aiready/core";
17
20
  var program = new Command();
18
21
  program.name("aiready-testability").description(
@@ -78,37 +81,6 @@ EXAMPLES:
78
81
  }
79
82
  });
80
83
  program.parse();
81
- function safetyColor(rating) {
82
- switch (rating) {
83
- case "safe":
84
- return chalk.green;
85
- case "moderate-risk":
86
- return chalk.yellow;
87
- case "high-risk":
88
- return chalk.red;
89
- case "blind-risk":
90
- return chalk.bgRed.white;
91
- default:
92
- return chalk.white;
93
- }
94
- }
95
- function safetyIcon(rating) {
96
- switch (rating) {
97
- case "safe":
98
- return "\u2705";
99
- case "moderate-risk":
100
- return "\u26A0\uFE0F ";
101
- case "high-risk":
102
- return "\u{1F534}";
103
- case "blind-risk":
104
- return "\u{1F480}";
105
- default:
106
- return "\u2753";
107
- }
108
- }
109
- function scoreBar(val) {
110
- return "\u2588".repeat(Math.round(val / 10)).padEnd(10, "\u2591");
111
- }
112
84
  function displayConsoleReport(report, scoring, elapsed) {
113
85
  const { summary, rawData, issues, recommendations } = report;
114
86
  const safetyRating = summary.aiChangeSafetyRating;
@@ -128,8 +100,9 @@ function displayConsoleReport(report, scoring, elapsed) {
128
100
  );
129
101
  console.log();
130
102
  }
103
+ const safetyColor = getSeverityColor(safetyRating, chalk);
131
104
  console.log(
132
- `AI Change Safety: ${safetyColor(safetyRating)(`${safetyIcon(safetyRating)} ${safetyRating.toUpperCase()}`)}`
105
+ `AI Change Safety: ${safetyColor(`${getSafetyIcon(safetyRating)} ${safetyRating.toUpperCase()}`)}`
133
106
  );
134
107
  console.log(
135
108
  `Score: ${chalk.bold(summary.score + "/100")} (${summary.rating})`
@@ -152,12 +125,12 @@ function displayConsoleReport(report, scoring, elapsed) {
152
125
  ];
153
126
  for (const [name, val] of dims) {
154
127
  const color = val >= 70 ? chalk.green : val >= 50 ? chalk.yellow : chalk.red;
155
- console.log(` ${name.padEnd(22)} ${color(scoreBar(val))} ${val}/100`);
128
+ console.log(` ${name.padEnd(22)} ${color(getScoreBar(val))} ${val}/100`);
156
129
  }
157
130
  if (issues.length > 0) {
158
131
  console.log(chalk.bold("\n\u26A0\uFE0F Issues\n"));
159
132
  for (const issue of issues) {
160
- const sev = issue.severity === "critical" ? chalk.red : issue.severity === "major" ? chalk.yellow : chalk.blue;
133
+ const sev = getSeverityColor(issue.severity, chalk);
161
134
  console.log(`${sev(issue.severity.toUpperCase())} ${issue.message}`);
162
135
  if (issue.suggestion)
163
136
  console.log(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/testability",
3
- "version": "0.1.11",
3
+ "version": "0.2.0",
4
4
  "description": "Measures how safely and verifiably AI-generated changes can be made to your codebase",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -40,7 +40,7 @@
40
40
  "chalk": "^5.3.0",
41
41
  "commander": "^14.0.0",
42
42
  "glob": "^13.0.0",
43
- "@aiready/core": "0.9.38"
43
+ "@aiready/core": "0.19.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^24.0.0",
package/src/cli.ts CHANGED
@@ -11,6 +11,9 @@ import {
11
11
  loadConfig,
12
12
  mergeConfigWithDefaults,
13
13
  resolveOutputPath,
14
+ getScoreBar,
15
+ getSafetyIcon,
16
+ getSeverityColor,
14
17
  } from '@aiready/core';
15
18
 
16
19
  const program = new Command();
@@ -98,40 +101,6 @@ EXAMPLES:
98
101
 
99
102
  program.parse();
100
103
 
101
- function safetyColor(rating: string) {
102
- switch (rating) {
103
- case 'safe':
104
- return chalk.green;
105
- case 'moderate-risk':
106
- return chalk.yellow;
107
- case 'high-risk':
108
- return chalk.red;
109
- case 'blind-risk':
110
- return chalk.bgRed.white;
111
- default:
112
- return chalk.white;
113
- }
114
- }
115
-
116
- function safetyIcon(rating: string) {
117
- switch (rating) {
118
- case 'safe':
119
- return '✅';
120
- case 'moderate-risk':
121
- return '⚠️ ';
122
- case 'high-risk':
123
- return '🔴';
124
- case 'blind-risk':
125
- return '💀';
126
- default:
127
- return '❓';
128
- }
129
- }
130
-
131
- function scoreBar(val: number): string {
132
- return '█'.repeat(Math.round(val / 10)).padEnd(10, '░');
133
- }
134
-
135
104
  function displayConsoleReport(report: any, scoring: any, elapsed: string) {
136
105
  const { summary, rawData, issues, recommendations } = report;
137
106
 
@@ -155,8 +124,9 @@ function displayConsoleReport(report: any, scoring: any, elapsed: string) {
155
124
  console.log();
156
125
  }
157
126
 
127
+ const safetyColor = getSeverityColor(safetyRating, chalk);
158
128
  console.log(
159
- `AI Change Safety: ${safetyColor(safetyRating)(`${safetyIcon(safetyRating)} ${safetyRating.toUpperCase()}`)}`
129
+ `AI Change Safety: ${safetyColor(`${getSafetyIcon(safetyRating)} ${safetyRating.toUpperCase()}`)}`
160
130
  );
161
131
  console.log(
162
132
  `Score: ${chalk.bold(summary.score + '/100')} (${summary.rating})`
@@ -180,18 +150,13 @@ function displayConsoleReport(report: any, scoring: any, elapsed: string) {
180
150
  for (const [name, val] of dims) {
181
151
  const color =
182
152
  val >= 70 ? chalk.green : val >= 50 ? chalk.yellow : chalk.red;
183
- console.log(` ${name.padEnd(22)} ${color(scoreBar(val))} ${val}/100`);
153
+ console.log(` ${name.padEnd(22)} ${color(getScoreBar(val))} ${val}/100`);
184
154
  }
185
155
 
186
156
  if (issues.length > 0) {
187
157
  console.log(chalk.bold('\n⚠️ Issues\n'));
188
158
  for (const issue of issues) {
189
- const sev =
190
- issue.severity === 'critical'
191
- ? chalk.red
192
- : issue.severity === 'major'
193
- ? chalk.yellow
194
- : chalk.blue;
159
+ const sev = getSeverityColor(issue.severity, chalk);
195
160
  console.log(`${sev(issue.severity.toUpperCase())} ${issue.message}`);
196
161
  if (issue.suggestion)
197
162
  console.log(