@aiready/cli 0.14.10 → 0.14.12

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,28 +1,29 @@
1
-
2
- > @aiready/cli@0.14.10 build /Users/pengcao/projects/aiready/packages/cli
3
- > tsup src/index.ts src/cli.ts --format cjs,esm
4
-
5
- CLI Building entry: src/cli.ts, src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Target: es2020
9
- CJS Build start
10
- ESM Build start
11
-
12
- WARN ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
13
-
14
- src/cli.ts:29:31:
15
-  29 │ return dirname(fileURLToPath(import.meta.url));
16
- ~~~~~~~~~~~
17
-
18
- You need to set the output format to "esm" for "import.meta" to work correctly.
19
-
20
-
21
-
22
- CJS dist/cli.js 84.95 KB
23
- CJS dist/index.js 10.87 KB
24
- CJS ⚡️ Build success in 42ms
25
- ESM dist/index.mjs 170.00 B
26
- ESM dist/chunk-JRRBBFYB.mjs 9.77 KB
27
- ESM dist/cli.mjs 70.91 KB
28
- ESM ⚡️ Build success in 42ms
1
+
2
+ 
3
+ > @aiready/cli@0.14.12 build /Users/pengcao/projects/aiready/packages/cli
4
+ > tsup src/index.ts src/cli.ts --format cjs,esm
5
+
6
+ CLI Building entry: src/cli.ts, src/index.ts
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.5.1
9
+ CLI Target: es2020
10
+ CJS Build start
11
+ ESM Build start
12
+
13
+  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta] 12:03:29 am
14
+
15
+ src/cli.ts:29:31:
16
+  29 │ 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/index.js 10.87 KB
24
+ CJS dist/cli.js 88.84 KB
25
+ CJS ⚡️ Build success in 49ms
26
+ ESM dist/index.mjs 170.00 B
27
+ ESM dist/cli.mjs 74.59 KB
28
+ ESM dist/chunk-JRRBBFYB.mjs 9.77 KB
29
+ ESM ⚡️ Build success in 49ms
@@ -1,74 +1,76 @@
1
-
2
- > @aiready/cli@0.14.9 test /Users/pengcao/projects/aiready/packages/cli
3
- > vitest run
4
-
5
-
6
-  RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/cli
7
-
8
- stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should generate HTML from specified report
9
- Building graph from report...
10
-
11
- ✓ src/commands/__tests__/agent-grounding.test.ts (1 test) 11ms
12
- ✓ src/commands/__tests__/testability.test.ts (2 tests) 12ms
13
- stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should generate HTML from specified report
14
- Generating HTML...
15
- Visualization written to: /Users/pengcao/projects/aiready/packages/cli/visualization.html
16
-
17
- stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should find latest report if none specified
18
- Found latest report: latest.json
19
- Building graph from report...
20
-
21
- stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should find latest report if none specified
22
- Generating HTML...
23
- Visualization written to: /Users/pengcao/projects/aiready/packages/cli/visualization.html
24
-
25
- stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should handle missing reports
26
- 
27
- Generate a report with:
28
- aiready scan --output json
29
-
30
- Or specify a custom report:
31
- aiready visualise --report <path-to-report.json>
32
-
33
- stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should attempt to open visualization if requested
34
- Building graph from report...
35
-
36
- stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should attempt to open visualization if requested
37
- Generating HTML...
38
- ✅ Visualization written to: /Users/pengcao/projects/aiready/packages/cli/visualization.html
39
-
40
- ✓ src/commands/__tests__/doc-drift.test.ts (1 test) 7ms
41
- ✓ src/commands/__tests__/ai-signal-clarity.test.ts (1 test) 8ms
42
- ✓ src/commands/__tests__/visualize.test.ts (4 tests) 27ms
43
- ✓ src/commands/__tests__/deps-health.test.ts (1 test) 9ms
44
- stdout | src/commands/__tests__/upload.test.ts > Upload CLI Action > should fail if API key is missing
45
-  Set AIREADY_API_KEY environment variable or use --api-key flag.
46
- Get an API key from https://platform.getaiready.dev/dashboard
47
- 🚀 Uploading report to https://dev.platform.getaiready.dev...
48
- Reading report from /Users/pengcao/projects/aiready/packages/cli/report.json...
49
- Successfully parsed report JSON.
50
-
51
- stdout | src/commands/__tests__/upload.test.ts > Upload CLI Action > should fail if API key is missing
52
- 
53
- ✅ Upload successful! (0.00s)
54
- View results: https://dev.platform.getaiready.dev/dashboard
55
- Analysis ID: 123
56
- Score: 80/100
57
-
58
- ✓ src/commands/__tests__/upload.test.ts (2 tests) 4ms
59
- ✓ src/utils/__tests__/helpers.test.ts (3 tests) 2ms
60
- ✓ src/commands/__tests__/init.test.ts (3 tests) 5ms
61
- ✓ src/commands/__tests__/consistency.test.ts (4 tests) 4ms
62
- ✓ src/commands/__tests__/scan.test.ts (6 tests) 94ms
63
- ✓ src/commands/__tests__/extra-commands.test.ts (8 tests) 122ms
64
- ✓ src/__tests__/unified.test.ts (4 tests) 3ms
65
- ✓ src/__tests__/cli.test.ts (3 tests) 4113ms
66
- ✓ should run unified analysis with both tools  4112ms
67
- ✓ src/__tests__/config-shape.test.ts (3 tests) 4113ms
68
- ✓ should generate a strictly portable AIReadyConfig in summary  4112ms
69
-
70
-  Test Files  15 passed (15)
71
-  Tests  46 passed (46)
72
-  Start at  15:39:46
73
-  Duration  5.18s (transform 2.58s, setup 0ms, import 5.99s, tests 8.53s, environment 2ms)
74
-
1
+
2
+ 
3
+ > @aiready/cli@0.14.11 test /Users/pengcao/projects/aiready/packages/cli
4
+ > vitest run
5
+
6
+ [?25l
7
+  RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/cli
8
+
9
+ stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should generate HTML from specified report
10
+ Building graph from report...
11
+
12
+ stdout | src/commands/__tests__/upload.test.ts > Upload CLI Action > should fail if API key is missing
13
+  Set AIREADY_API_KEY environment variable or use --api-key flag.
14
+ Get an API key from https://platform.getaiready.dev/dashboard
15
+ 🚀 Uploading report to https://dev.platform.getaiready.dev...
16
+ Reading report from /Users/pengcao/projects/aiready/packages/cli/report.json...
17
+ Successfully parsed report JSON.
18
+
19
+ stdout | src/commands/__tests__/upload.test.ts > Upload CLI Action > should fail if API key is missing
20
+ 
21
+ Upload successful! (0.00s)
22
+ View results: https://dev.platform.getaiready.dev/dashboard
23
+ Analysis ID: 123
24
+ Score: 80/100
25
+
26
+ ✓ src/commands/__tests__/upload.test.ts (2 tests) 4ms
27
+ stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should generate HTML from specified report
28
+ Generating HTML...
29
+ ✅ Visualization written to: /Users/pengcao/projects/aiready/packages/cli/visualization.html
30
+
31
+ stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should find latest report if none specified
32
+ Found latest report: latest.json
33
+ Building graph from report...
34
+
35
+ stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should find latest report if none specified
36
+ Generating HTML...
37
+ Visualization written to: /Users/pengcao/projects/aiready/packages/cli/visualization.html
38
+
39
+ stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should handle missing reports
40
+ 
41
+ Generate a report with:
42
+ aiready scan --output json
43
+
44
+ Or specify a custom report:
45
+ aiready visualise --report <path-to-report.json>
46
+
47
+ stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should attempt to open visualization if requested
48
+ Building graph from report...
49
+
50
+ stdout | src/commands/__tests__/visualize.test.ts > Visualize CLI Action > should attempt to open visualization if requested
51
+ Generating HTML...
52
+ ✅ Visualization written to: /Users/pengcao/projects/aiready/packages/cli/visualization.html
53
+
54
+ ✓ src/commands/__tests__/visualize.test.ts (4 tests) 24ms
55
+ ✓ src/commands/__tests__/agent-grounding.test.ts (1 test) 21ms
56
+ ✓ src/commands/__tests__/testability.test.ts (2 tests) 9ms
57
+ ✓ src/commands/__tests__/deps-health.test.ts (1 test) 11ms
58
+ ✓ src/commands/__tests__/ai-signal-clarity.test.ts (1 test) 12ms
59
+ ✓ src/commands/__tests__/doc-drift.test.ts (1 test) 13ms
60
+ ✓ src/utils/__tests__/helpers.test.ts (3 tests) 2ms
61
+ ✓ src/commands/__tests__/init.test.ts (2 tests) 4ms
62
+ ✓ src/commands/__tests__/consistency.test.ts (4 tests) 4ms
63
+ ✓ src/commands/__tests__/scan.test.ts (6 tests) 81ms
64
+ ✓ src/__tests__/unified.test.ts (4 tests) 3ms
65
+ ✓ src/commands/__tests__/extra-commands.test.ts (8 tests) 117ms
66
+ ✓ src/__tests__/cli.test.ts (3 tests) 2506ms
67
+ ✓ should run unified analysis with both tools  2505ms
68
+ ✓ src/__tests__/config-shape.test.ts (3 tests) 2506ms
69
+ ✓ should generate a strictly portable AIReadyConfig in summary  2505ms
70
+
71
+  Test Files  15 passed (15)
72
+  Tests  45 passed (45)
73
+  Start at  00:01:59
74
+  Duration  3.47s (transform 2.12s, setup 0ms, import 5.20s, tests 5.32s, environment 1ms)
75
+
76
+ [?25h
package/dist/cli.js CHANGED
@@ -394,13 +394,91 @@ function generateMarkdownReport(report, elapsedTime) {
394
394
  // src/commands/report-formatter.ts
395
395
  var import_chalk2 = __toESM(require("chalk"));
396
396
  var import_core4 = require("@aiready/core");
397
+ function generateProgressBar(score, width = 20) {
398
+ const filled = Math.round(score / 100 * width);
399
+ const empty = width - filled;
400
+ let color = import_chalk2.default.red;
401
+ if (score >= 90) color = import_chalk2.default.green;
402
+ else if (score >= 75) color = import_chalk2.default.cyan;
403
+ else if (score >= 60) color = import_chalk2.default.yellow;
404
+ const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
405
+ return color(bar);
406
+ }
407
+ function countIssuesBySeverity(results) {
408
+ let critical = 0;
409
+ let major = 0;
410
+ let minor = 0;
411
+ if (results.summary?.toolsRun) {
412
+ for (const toolId of results.summary.toolsRun) {
413
+ const toolRes = results[toolId];
414
+ if (toolRes?.results) {
415
+ for (const fileRes of toolRes.results) {
416
+ if (fileRes.issues) {
417
+ for (const issue of fileRes.issues) {
418
+ const sev = issue.severity?.toLowerCase();
419
+ if (sev === "critical") critical++;
420
+ else if (sev === "major") major++;
421
+ else minor++;
422
+ }
423
+ }
424
+ }
425
+ }
426
+ }
427
+ }
428
+ return { critical, major, minor };
429
+ }
430
+ function getTopFilesWithIssues(results, limit = 5) {
431
+ const fileCounts = /* @__PURE__ */ new Map();
432
+ if (results.summary?.toolsRun) {
433
+ for (const toolId of results.summary.toolsRun) {
434
+ const toolRes = results[toolId];
435
+ if (toolRes?.results) {
436
+ for (const fileRes of toolRes.results) {
437
+ if (fileRes.issues?.length > 0) {
438
+ const current = fileCounts.get(fileRes.fileName) || 0;
439
+ fileCounts.set(fileRes.fileName, current + fileRes.issues.length);
440
+ }
441
+ }
442
+ }
443
+ }
444
+ }
445
+ return Array.from(fileCounts.entries()).map(([file, count]) => ({ file, count })).sort((a, b) => b.count - a.count).slice(0, limit);
446
+ }
397
447
  function printScanSummary(results, startTime) {
448
+ const severity = countIssuesBySeverity(results);
449
+ const totalIssues = severity.critical + severity.major + severity.minor;
450
+ const topFiles = getTopFilesWithIssues(results);
398
451
  console.log(import_chalk2.default.cyan("\n=== AIReady Run Summary ==="));
452
+ console.log(` Total issues: ${import_chalk2.default.bold(String(totalIssues))}`);
453
+ if (totalIssues > 0) {
454
+ console.log(import_chalk2.default.dim(" Severity breakdown:"));
455
+ if (severity.critical > 0) {
456
+ console.log(
457
+ ` ${import_chalk2.default.red("\u25CF")} Critical: ${import_chalk2.default.bold(severity.critical)}`
458
+ );
459
+ }
460
+ if (severity.major > 0) {
461
+ console.log(
462
+ ` ${import_chalk2.default.yellow("\u25CF")} Major: ${import_chalk2.default.bold(severity.major)}`
463
+ );
464
+ }
465
+ if (severity.minor > 0) {
466
+ console.log(
467
+ ` ${import_chalk2.default.blue("\u25CF")} Minor: ${import_chalk2.default.bold(severity.minor)}`
468
+ );
469
+ }
470
+ }
471
+ if (topFiles.length > 0) {
472
+ console.log(import_chalk2.default.dim("\n Top files with issues:"));
473
+ topFiles.forEach((item) => {
474
+ console.log(
475
+ ` ${import_chalk2.default.yellow("\u2192")} ${item.file}: ${import_chalk2.default.bold(item.count)} issues`
476
+ );
477
+ });
478
+ }
399
479
  console.log(
400
- ` Total issues (all tools): ${import_chalk2.default.bold(String(results.summary.totalIssues ?? 0))}`
401
- );
402
- console.log(
403
- ` Execution time: ${import_chalk2.default.bold(((Date.now() - startTime) / 1e3).toFixed(2) + "s")}`
480
+ `
481
+ Execution time: ${import_chalk2.default.bold(((Date.now() - startTime) / 1e3).toFixed(2) + "s")}`
404
482
  );
405
483
  }
406
484
  function printBusinessImpact(roi, unifiedBudget) {
@@ -427,13 +505,14 @@ function printScoring(scoringResult, scoringProfile) {
427
505
  scoringResult.breakdown.forEach((tool) => {
428
506
  const rating = (0, import_core4.getRating)(tool.score);
429
507
  const emoji = (0, import_core4.getRatingDisplay)(rating).emoji;
508
+ const progressBar = generateProgressBar(tool.score, 15);
430
509
  console.log(
431
- ` - ${tool.toolName}: ${tool.score}/100 (${rating}) ${emoji}`
510
+ ` ${progressBar} ${tool.score}/100 (${rating}) ${emoji} ${tool.toolName}`
432
511
  );
433
512
  });
434
513
  const allRecs = scoringResult.breakdown.flatMap(
435
514
  (t) => (t.recommendations ?? []).map((r) => ({ ...r, tool: t.toolName }))
436
- ).sort((a, b) => b.estimatedImpact - a.estimatedImpact).slice(0, 3);
515
+ ).sort((a, b) => b.estimatedImpact - a.estimatedImpact).slice(0, 5);
437
516
  if (allRecs.length > 0) {
438
517
  console.log(import_chalk2.default.bold("\n\u{1F3AF} Top Actionable Recommendations:"));
439
518
  allRecs.forEach((rec, i) => {
@@ -917,6 +996,9 @@ async function initAction(options) {
917
996
  process.exit(1);
918
997
  }
919
998
  const baseConfig = {
999
+ // Target quality score threshold (0-100)
1000
+ threshold: 75,
1001
+ // Global scan settings
920
1002
  scan: {
921
1003
  include: [
922
1004
  "src/**/*.ts",
@@ -943,80 +1025,125 @@ async function initAction(options) {
943
1025
  import_core7.ToolName.ChangeAmplification
944
1026
  ]
945
1027
  },
1028
+ // Output preferences
1029
+ output: {
1030
+ format: "console",
1031
+ showBreakdown: true,
1032
+ saveTo: "aiready-report.json"
1033
+ },
1034
+ // Scoring profile and weights
1035
+ scoring: {
1036
+ profile: "balanced"
1037
+ },
1038
+ // Tool-specific configurations
946
1039
  tools: {
947
1040
  [import_core7.ToolName.PatternDetect]: {
948
1041
  minSimilarity: 0.8,
949
1042
  minLines: 5,
1043
+ minSharedTokens: 10,
1044
+ approx: true,
950
1045
  ...options.full ? {
951
- batchSize: 50,
952
- approx: true,
953
- minSharedTokens: 10,
954
- maxCandidatesPerBlock: 100
1046
+ batchSize: 300,
1047
+ maxCandidatesPerBlock: 500,
1048
+ minClusterFiles: 3,
1049
+ minClusterTokenCost: 1e3
955
1050
  } : {}
956
1051
  },
957
1052
  [import_core7.ToolName.ContextAnalyzer]: {
958
1053
  maxContextBudget: 128e3,
959
1054
  minCohesion: 0.6,
960
- ...options.full ? {
961
- maxDepth: 7,
962
- maxFragmentation: 0.4,
963
- focus: "all",
964
- includeNodeModules: false
965
- } : {}
1055
+ maxDepth: 7,
1056
+ maxFragmentation: 0.4,
1057
+ focus: "all",
1058
+ includeNodeModules: false
966
1059
  },
967
1060
  [import_core7.ToolName.NamingConsistency]: {
1061
+ checkNaming: true,
1062
+ checkPatterns: true,
1063
+ checkArchitecture: true,
968
1064
  shortWords: ["id", "db", "ui", "ai"],
969
- ...options.full ? { acceptedAbbreviations: [], disableChecks: [] } : {}
1065
+ acceptedAbbreviations: [
1066
+ "API",
1067
+ "JSON",
1068
+ "CSV",
1069
+ "HTML",
1070
+ "CSS",
1071
+ "HTTP",
1072
+ "URL",
1073
+ "SDK",
1074
+ "CLI",
1075
+ "AI",
1076
+ "ML",
1077
+ "ID",
1078
+ "DB",
1079
+ "UI",
1080
+ "UX",
1081
+ "DOM",
1082
+ "UUID",
1083
+ "GUID",
1084
+ "DEFAULT",
1085
+ "MAX",
1086
+ "MIN",
1087
+ "config",
1088
+ "INIT",
1089
+ "SKILL",
1090
+ "ENV",
1091
+ "DEV",
1092
+ "PROD",
1093
+ "AWS",
1094
+ "S3",
1095
+ "ARN"
1096
+ ],
1097
+ ...options.full ? { disableChecks: [] } : {}
970
1098
  },
971
1099
  [import_core7.ToolName.AiSignalClarity]: {
972
1100
  checkMagicLiterals: true,
973
1101
  checkBooleanTraps: true,
974
1102
  checkAmbiguousNames: true,
975
1103
  checkUndocumentedExports: true,
976
- ...options.full ? { checkImplicitSideEffects: false, checkDeepCallbacks: false } : {}
1104
+ checkImplicitSideEffects: true,
1105
+ checkDeepCallbacks: true,
1106
+ checkOverloadedSymbols: true,
1107
+ checkLargeFiles: true
977
1108
  },
978
- ...options.full ? {
979
- [import_core7.ToolName.AgentGrounding]: {
980
- maxRecommendedDepth: 5,
981
- readmeStaleDays: 30
982
- },
983
- [import_core7.ToolName.TestabilityIndex]: {
984
- minCoverageRatio: 0.7,
985
- testPatterns: ["**/*.test.ts", "**/__tests__/**"]
986
- },
987
- [import_core7.ToolName.DocDrift]: {
988
- maxCommits: 50,
989
- staleMonths: 3
990
- },
991
- [import_core7.ToolName.DependencyHealth]: {
992
- trainingCutoffYear: 2023
993
- }
994
- } : {}
995
- },
996
- scoring: {
997
- threshold: 70,
998
- showBreakdown: true,
999
- ...options.full ? { profile: "default" } : {}
1109
+ [import_core7.ToolName.AgentGrounding]: {
1110
+ maxRecommendedDepth: 5,
1111
+ readmeStaleDays: 30,
1112
+ additionalVagueNames: ["stuff", "misc", "temp", "test"]
1113
+ },
1114
+ [import_core7.ToolName.TestabilityIndex]: {
1115
+ minCoverageRatio: 0.7,
1116
+ testPatterns: ["**/*.test.ts", "**/__tests__/**", "**/*.spec.ts"],
1117
+ maxDepth: 10
1118
+ },
1119
+ [import_core7.ToolName.DocDrift]: {
1120
+ maxCommits: 50,
1121
+ staleMonths: 3
1122
+ },
1123
+ [import_core7.ToolName.DependencyHealth]: {
1124
+ trainingCutoffYear: 2023
1125
+ },
1126
+ [import_core7.ToolName.ChangeAmplification]: {
1127
+ // Change amplification primarily relies on global scan settings
1128
+ }
1000
1129
  },
1001
- ...options.full ? {
1002
- visualizer: {
1003
- groupingDirs: ["packages", "src", "lib"],
1004
- graph: {
1005
- maxNodes: 5e3,
1006
- maxEdges: 1e4
1007
- }
1130
+ // Visualizer settings (interactive graph)
1131
+ visualizer: {
1132
+ groupingDirs: ["packages", "src", "lib"],
1133
+ graph: {
1134
+ maxNodes: 5e3,
1135
+ maxEdges: 1e4
1008
1136
  }
1009
- } : {}
1137
+ }
1010
1138
  };
1011
1139
  const defaultConfig = baseConfig;
1012
1140
  let content;
1013
1141
  if (fileExt === "js") {
1014
- content = `/** @type {import('@aiready/core').AIReadyConfig} */
1015
- module.exports = ${JSON.stringify(
1016
- defaultConfig,
1017
- null,
1018
- 2
1019
- )};
1142
+ content = `/**
1143
+ * AIReady Configuration
1144
+ * @type {import('@aiready/core').AIReadyConfig}
1145
+ */
1146
+ module.exports = ${JSON.stringify(defaultConfig, null, 2)};
1020
1147
  `;
1021
1148
  } else {
1022
1149
  content = JSON.stringify(defaultConfig, null, 2);