@aiready/cli 0.14.1 → 0.14.3

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.
Files changed (33) hide show
  1. package/.aiready/aiready-report-20260314-164626.json +2 -5
  2. package/.aiready/aiready-report-20260314-164741.json +2 -5
  3. package/.turbo/turbo-build.log +7 -7
  4. package/.turbo/turbo-test.log +19 -110
  5. package/dist/cli.js +149 -125
  6. package/dist/cli.mjs +69 -45
  7. package/package.json +12 -12
  8. package/packages/core/src/.aiready/aiready-report-20260314-161145.json +4 -10
  9. package/packages/core/src/.aiready/aiready-report-20260314-161152.json +10 -28
  10. package/packages/pattern-detect/src/.aiready/aiready-report-20260314-161139.json +4 -10
  11. package/src/.aiready/aiready-report-20260312-103623.json +3 -9
  12. package/src/.aiready/aiready-report-20260312-110843.json +3 -9
  13. package/src/.aiready/aiready-report-20260312-110955.json +3 -9
  14. package/src/.aiready/aiready-report-20260314-203209.json +30713 -0
  15. package/src/.aiready/aiready-report-20260314-203736.json +30713 -0
  16. package/src/.aiready/aiready-report-20260314-203857.json +30713 -0
  17. package/src/.aiready/aiready-report-20260314-204047.json +30713 -0
  18. package/src/__tests__/config-shape.test.ts +1 -1
  19. package/src/cli.ts +2 -1
  20. package/src/commands/__tests__/consistency.test.ts +3 -0
  21. package/src/commands/__tests__/extra-commands.test.ts +29 -37
  22. package/src/commands/__tests__/scan.test.ts +3 -1
  23. package/src/commands/__tests__/visualize.test.ts +3 -7
  24. package/src/commands/ai-signal-clarity.ts +1 -56
  25. package/src/commands/deps-health.ts +1 -65
  26. package/src/commands/doc-drift.ts +1 -62
  27. package/src/commands/init.ts +62 -2
  28. package/src/commands/scan.ts +11 -8
  29. package/src/commands/shared/configured-tool-action.ts +35 -0
  30. package/src/commands/shared/standard-tool-actions.ts +126 -0
  31. package/src/commands/visualize.ts +2 -3
  32. package/src/utils/helpers.ts +85 -36
  33. package/vitest.config.ts +5 -12
package/dist/cli.mjs CHANGED
@@ -32,36 +32,15 @@ import {
32
32
 
33
33
  // src/utils/helpers.ts
34
34
  import { resolve as resolvePath } from "path";
35
- import { existsSync, readdirSync, statSync, readFileSync } from "fs";
35
+ import { existsSync, readFileSync } from "fs";
36
36
  import chalk from "chalk";
37
+ import { loadConfig, mergeConfigWithDefaults } from "@aiready/core";
38
+ import { findLatestReport } from "@aiready/core";
37
39
  function getReportTimestamp() {
38
40
  const now = /* @__PURE__ */ new Date();
39
41
  const pad = (n) => String(n).padStart(2, "0");
40
42
  return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
41
43
  }
42
- function findLatestScanReport(dirPath) {
43
- const aireadyDir = resolvePath(dirPath, ".aiready");
44
- if (!existsSync(aireadyDir)) {
45
- return null;
46
- }
47
- let files = readdirSync(aireadyDir).filter(
48
- (f) => f.startsWith("aiready-report-") && f.endsWith(".json")
49
- );
50
- if (files.length === 0) {
51
- files = readdirSync(aireadyDir).filter(
52
- (f) => f.startsWith("aiready-scan-") && f.endsWith(".json")
53
- );
54
- }
55
- if (files.length === 0) {
56
- return null;
57
- }
58
- const sortedFiles = files.map((f) => ({
59
- name: f,
60
- path: resolvePath(aireadyDir, f),
61
- mtime: statSync(resolvePath(aireadyDir, f)).mtime
62
- })).sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
63
- return sortedFiles[0].path;
64
- }
65
44
  async function warnIfGraphCapExceeded(report, dirPath) {
66
45
  try {
67
46
  const { loadConfig: loadConfig4 } = await import("@aiready/core");
@@ -340,7 +319,7 @@ async function scanAction(directory, options) {
340
319
  defaults,
341
320
  cliOverrides
342
321
  );
343
- let finalOptions = { ...baseOptions };
322
+ const finalOptions = { ...baseOptions };
344
323
  if (baseOptions.tools.includes(ToolName.PatternDetect) || baseOptions.tools.includes("patterns")) {
345
324
  const { getSmartDefaults } = await import("@aiready/pattern-detect");
346
325
  const patternSmartDefaults = await getSmartDefaults(
@@ -600,14 +579,14 @@ async function scanAction(directory, options) {
600
579
  });
601
580
  }
602
581
  await warnIfGraphCapExceeded(outputData, resolvedDir);
603
- const isCI = options.ci || process.env.CI === "true";
604
- if (isCI && scoringResult) {
582
+ if (scoringResult) {
605
583
  const threshold = options.threshold ? parseInt(options.threshold) : void 0;
606
584
  const failOnLevel = options.failOn || "critical";
585
+ const isCI = options.ci || process.env.CI === "true";
607
586
  let shouldFail = false;
608
587
  let failReason = "";
609
588
  const report = mapToUnifiedReport(results, scoringResult);
610
- if (report.results && report.results.length > 0) {
589
+ if (isCI && report.results && report.results.length > 0) {
611
590
  console.log(
612
591
  chalk3.cyan(
613
592
  `
@@ -631,10 +610,10 @@ async function scanAction(directory, options) {
631
610
  }
632
611
  if (shouldFail) {
633
612
  console.log(chalk3.red(`
634
- \u{1F6AB} PR BLOCKED: ${failReason}`));
613
+ \u{1F6AB} SCAN FAILED: ${failReason}`));
635
614
  process.exit(1);
636
615
  } else {
637
- console.log(chalk3.green("\n\u2705 PR PASSED"));
616
+ console.log(chalk3.green("\n\u2705 SCAN PASSED"));
638
617
  }
639
618
  }
640
619
  } catch (error) {
@@ -658,7 +637,7 @@ async function initAction(options) {
658
637
  );
659
638
  process.exit(1);
660
639
  }
661
- const defaultConfig = {
640
+ const baseConfig = {
662
641
  scan: {
663
642
  include: [
664
643
  "src/**/*.ts",
@@ -688,28 +667,74 @@ async function initAction(options) {
688
667
  tools: {
689
668
  [ToolName2.PatternDetect]: {
690
669
  minSimilarity: 0.8,
691
- minLines: 5
670
+ minLines: 5,
671
+ ...options.full ? {
672
+ batchSize: 50,
673
+ approx: true,
674
+ minSharedTokens: 10,
675
+ maxCandidatesPerBlock: 100
676
+ } : {}
692
677
  },
693
678
  [ToolName2.ContextAnalyzer]: {
694
679
  maxContextBudget: 128e3,
695
- minCohesion: 0.6
680
+ minCohesion: 0.6,
681
+ ...options.full ? {
682
+ maxDepth: 7,
683
+ maxFragmentation: 0.4,
684
+ focus: "all",
685
+ includeNodeModules: false
686
+ } : {}
696
687
  },
697
688
  [ToolName2.NamingConsistency]: {
698
- shortWords: ["id", "db", "ui", "ai"]
689
+ shortWords: ["id", "db", "ui", "ai"],
690
+ ...options.full ? { acceptedAbbreviations: [], disableChecks: [] } : {}
699
691
  },
700
692
  [ToolName2.AiSignalClarity]: {
701
693
  checkMagicLiterals: true,
702
694
  checkBooleanTraps: true,
703
695
  checkAmbiguousNames: true,
704
- checkUndocumentedExports: true
705
- }
696
+ checkUndocumentedExports: true,
697
+ ...options.full ? { checkImplicitSideEffects: false, checkDeepCallbacks: false } : {}
698
+ },
699
+ ...options.full ? {
700
+ [ToolName2.AgentGrounding]: {
701
+ maxRecommendedDepth: 5,
702
+ readmeStaleDays: 30
703
+ },
704
+ [ToolName2.TestabilityIndex]: {
705
+ minCoverageRatio: 0.7,
706
+ testPatterns: ["**/*.test.ts", "**/__tests__/**"]
707
+ },
708
+ [ToolName2.DocDrift]: {
709
+ maxCommits: 50,
710
+ staleMonths: 3
711
+ },
712
+ [ToolName2.DependencyHealth]: {
713
+ trainingCutoffYear: 2023
714
+ }
715
+ } : {}
706
716
  },
707
717
  scoring: {
708
718
  threshold: 70,
709
- showBreakdown: true
710
- }
719
+ showBreakdown: true,
720
+ ...options.full ? { profile: "default" } : {}
721
+ },
722
+ ...options.full ? {
723
+ output: {
724
+ format: fileExt,
725
+ file: "aiready-report.json"
726
+ },
727
+ visualizer: {
728
+ groupingDirs: ["packages", "src", "lib"],
729
+ graph: {
730
+ maxNodes: 5e3,
731
+ maxEdges: 1e4
732
+ }
733
+ }
734
+ } : {}
711
735
  };
712
- let content = "";
736
+ const defaultConfig = baseConfig;
737
+ let content;
713
738
  if (fileExt === "js") {
714
739
  content = `/** @type {import('@aiready/core').AIReadyConfig} */
715
740
  module.exports = ${JSON.stringify(
@@ -1277,13 +1302,13 @@ import { writeFileSync as writeFileSync4, readFileSync as readFileSync3, existsS
1277
1302
  import { resolve as resolvePath7 } from "path";
1278
1303
  import { spawn } from "child_process";
1279
1304
  import { handleCLIError as handleCLIError6 } from "@aiready/core";
1280
- import { generateHTML } from "@aiready/core";
1305
+ import { generateHTML, findLatestReport as findLatestReport2 } from "@aiready/core";
1281
1306
  async function visualizeAction(directory, options) {
1282
1307
  try {
1283
1308
  const dirPath = resolvePath7(process.cwd(), directory || ".");
1284
1309
  let reportPath = options.report ? resolvePath7(dirPath, options.report) : null;
1285
1310
  if (!reportPath || !existsSync3(reportPath)) {
1286
- const latestScan = findLatestScanReport(dirPath);
1311
+ const latestScan = findLatestReport2(dirPath);
1287
1312
  if (latestScan) {
1288
1313
  reportPath = latestScan;
1289
1314
  console.log(
@@ -1520,9 +1545,8 @@ NOTES:
1520
1545
  - Same options as 'visualize'. Use --serve to host the static HTML, or --dev for live reload.
1521
1546
  `;
1522
1547
 
1523
- // src/commands/ai-signal-clarity.ts
1548
+ // src/commands/shared/standard-tool-actions.ts
1524
1549
  import chalk9 from "chalk";
1525
- import { loadConfig, mergeConfigWithDefaults } from "@aiready/core";
1526
1550
 
1527
1551
  // src/commands/agent-grounding.ts
1528
1552
  import chalk10 from "chalk";
@@ -1734,9 +1758,9 @@ program.command("scan").description(
1734
1758
  program.command("init").description("Generate a default configuration (aiready.json)").option("-f, --force", "Overwrite existing configuration file").option(
1735
1759
  "--js",
1736
1760
  "Generate configuration as a JavaScript file (aiready.config.js)"
1737
- ).action(async (options) => {
1761
+ ).option("--full", "Generate a full configuration with all available options").action(async (options) => {
1738
1762
  const format = options.js ? "js" : "json";
1739
- await initAction({ force: options.force, format });
1763
+ await initAction({ force: options.force, format, full: options.full });
1740
1764
  });
1741
1765
  program.command("patterns").description("Detect duplicate code patterns that confuse AI models").argument("[directory]", "Directory to analyze", ".").option("-s, --similarity <number>", "Minimum similarity score (0-1)", "0.40").option("-l, --min-lines <number>", "Minimum lines to consider", "5").option(
1742
1766
  "--max-candidates <number>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/cli",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
4
4
  "description": "Unified CLI for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -11,17 +11,17 @@
11
11
  "dependencies": {
12
12
  "chalk": "^5.3.0",
13
13
  "commander": "^14.0.0",
14
- "@aiready/core": "0.23.1",
15
- "@aiready/agent-grounding": "0.13.1",
16
- "@aiready/context-analyzer": "0.21.1",
17
- "@aiready/consistency": "0.20.1",
18
- "@aiready/deps": "0.13.1",
19
- "@aiready/doc-drift": "0.13.1",
20
- "@aiready/change-amplification": "0.13.1",
21
- "@aiready/ai-signal-clarity": "0.13.1",
22
- "@aiready/pattern-detect": "0.16.1",
23
- "@aiready/testability": "0.6.1",
24
- "@aiready/visualizer": "0.6.1"
14
+ "@aiready/agent-grounding": "0.13.2",
15
+ "@aiready/consistency": "0.20.2",
16
+ "@aiready/context-analyzer": "0.21.6",
17
+ "@aiready/core": "0.23.2",
18
+ "@aiready/doc-drift": "0.13.2",
19
+ "@aiready/change-amplification": "0.13.2",
20
+ "@aiready/deps": "0.13.2",
21
+ "@aiready/testability": "0.6.2",
22
+ "@aiready/pattern-detect": "0.16.2",
23
+ "@aiready/visualizer": "0.6.2",
24
+ "@aiready/ai-signal-clarity": "0.13.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^24.0.0",
@@ -4,15 +4,11 @@
4
4
  "criticalIssues": 0,
5
5
  "majorIssues": 0,
6
6
  "totalFiles": 0,
7
- "toolsRun": [
8
- "pattern-detect"
9
- ],
7
+ "toolsRun": ["pattern-detect"],
10
8
  "executionTime": 5,
11
9
  "config": {
12
10
  "scan": {
13
- "tools": [
14
- "patterns"
15
- ]
11
+ "tools": ["patterns"]
16
12
  },
17
13
  "tools": {
18
14
  "pattern-detect": {
@@ -201,9 +197,7 @@
201
197
  "overall": 100,
202
198
  "rating": "Excellent",
203
199
  "timestamp": "2026-03-14T05:11:45.608Z",
204
- "toolsUsed": [
205
- "pattern-detect"
206
- ],
200
+ "toolsUsed": ["pattern-detect"],
207
201
  "breakdown": [
208
202
  {
209
203
  "toolName": "pattern-detect",
@@ -227,4 +221,4 @@
227
221
  }
228
222
  },
229
223
  "repository": {}
230
- }
224
+ }
@@ -4,18 +4,12 @@
4
4
  "criticalIssues": 0,
5
5
  "majorIssues": 0,
6
6
  "totalFiles": 0,
7
- "toolsRun": [
8
- "pattern-detect"
9
- ],
7
+ "toolsRun": ["pattern-detect"],
10
8
  "executionTime": 5,
11
9
  "config": {
12
10
  "scan": {
13
- "tools": [
14
- "patterns"
15
- ],
16
- "include": [
17
- "**/*.ts"
18
- ]
11
+ "tools": ["patterns"],
12
+ "include": ["**/*.ts"]
19
13
  },
20
14
  "tools": {
21
15
  "pattern-detect": {
@@ -61,9 +55,7 @@
61
55
  "version": "0.12.5",
62
56
  "timestamp": "2026-03-14T05:11:52.041Z",
63
57
  "config": {
64
- "include": [
65
- "**/*.ts"
66
- ],
58
+ "include": ["**/*.ts"],
67
59
  "minSimilarity": 0.5,
68
60
  "minLines": 6,
69
61
  "approx": true,
@@ -96,9 +88,7 @@
96
88
  "version": "0.12.5",
97
89
  "timestamp": "2026-03-14T05:11:52.041Z",
98
90
  "config": {
99
- "include": [
100
- "**/*.ts"
101
- ],
91
+ "include": ["**/*.ts"],
102
92
  "minSimilarity": 0.5,
103
93
  "minLines": 6,
104
94
  "approx": true,
@@ -131,9 +121,7 @@
131
121
  "version": "0.12.5",
132
122
  "timestamp": "2026-03-14T05:11:52.041Z",
133
123
  "config": {
134
- "include": [
135
- "**/*.ts"
136
- ],
124
+ "include": ["**/*.ts"],
137
125
  "minSimilarity": 0.5,
138
126
  "minLines": 6,
139
127
  "approx": true,
@@ -166,9 +154,7 @@
166
154
  "version": "0.12.5",
167
155
  "timestamp": "2026-03-14T05:11:52.041Z",
168
156
  "config": {
169
- "include": [
170
- "**/*.ts"
171
- ],
157
+ "include": ["**/*.ts"],
172
158
  "minSimilarity": 0.5,
173
159
  "minLines": 6,
174
160
  "approx": true,
@@ -201,9 +187,7 @@
201
187
  "version": "0.12.5",
202
188
  "timestamp": "2026-03-14T05:11:52.041Z",
203
189
  "config": {
204
- "include": [
205
- "**/*.ts"
206
- ],
190
+ "include": ["**/*.ts"],
207
191
  "minSimilarity": 0.5,
208
192
  "minLines": 6,
209
193
  "approx": true,
@@ -219,9 +203,7 @@
219
203
  "overall": 100,
220
204
  "rating": "Excellent",
221
205
  "timestamp": "2026-03-14T05:11:52.043Z",
222
- "toolsUsed": [
223
- "pattern-detect"
224
- ],
206
+ "toolsUsed": ["pattern-detect"],
225
207
  "breakdown": [
226
208
  {
227
209
  "toolName": "pattern-detect",
@@ -250,4 +232,4 @@
250
232
  "commit": "d18009e9c1b30c7efd1afef5569b0aca40ccabf5",
251
233
  "author": "caopengau@gmail.com"
252
234
  }
253
- }
235
+ }
@@ -4,15 +4,11 @@
4
4
  "criticalIssues": 0,
5
5
  "majorIssues": 0,
6
6
  "totalFiles": 0,
7
- "toolsRun": [
8
- "pattern-detect"
9
- ],
7
+ "toolsRun": ["pattern-detect"],
10
8
  "executionTime": 7,
11
9
  "config": {
12
10
  "scan": {
13
- "tools": [
14
- "patterns"
15
- ]
11
+ "tools": ["patterns"]
16
12
  },
17
13
  "tools": {
18
14
  "pattern-detect": {
@@ -201,9 +197,7 @@
201
197
  "overall": 100,
202
198
  "rating": "Excellent",
203
199
  "timestamp": "2026-03-14T05:11:39.975Z",
204
- "toolsUsed": [
205
- "pattern-detect"
206
- ],
200
+ "toolsUsed": ["pattern-detect"],
207
201
  "breakdown": [
208
202
  {
209
203
  "toolName": "pattern-detect",
@@ -227,4 +221,4 @@
227
221
  }
228
222
  },
229
223
  "repository": {}
230
- }
224
+ }
@@ -32213,10 +32213,7 @@
32213
32213
  "tokenWastePerFile": 0,
32214
32214
  "estimatedMonthlyCost": {
32215
32215
  "total": 0,
32216
- "range": [
32217
- 0,
32218
- 0
32219
- ],
32216
+ "range": [0, 0],
32220
32217
  "confidence": 0.7
32221
32218
  },
32222
32219
  "estimatedDeveloperHours": 0
@@ -32253,10 +32250,7 @@
32253
32250
  "majorIssues": 0,
32254
32251
  "estimatedMonthlyCost": {
32255
32252
  "total": 1198.21,
32256
- "range": [
32257
- 898.66,
32258
- 1497.77
32259
- ],
32253
+ "range": [898.66, 1497.77],
32260
32254
  "confidence": 0.7
32261
32255
  },
32262
32256
  "estimatedDeveloperHours": 0
@@ -32577,4 +32571,4 @@
32577
32571
  "commit": "120f596977ae37fe4d6d5cc97c3be987a4d92717",
32578
32572
  "author": "caopengau@gmail.com"
32579
32573
  }
32580
- }
32574
+ }
@@ -28379,10 +28379,7 @@
28379
28379
  "tokenWastePerFile": 0,
28380
28380
  "estimatedMonthlyCost": {
28381
28381
  "total": 0,
28382
- "range": [
28383
- 0,
28384
- 0
28385
- ],
28382
+ "range": [0, 0],
28386
28383
  "confidence": 0.7
28387
28384
  },
28388
28385
  "estimatedDeveloperHours": 0
@@ -28419,10 +28416,7 @@
28419
28416
  "majorIssues": 0,
28420
28417
  "estimatedMonthlyCost": {
28421
28418
  "total": 1198.21,
28422
- "range": [
28423
- 898.66,
28424
- 1497.77
28425
- ],
28419
+ "range": [898.66, 1497.77],
28426
28420
  "confidence": 0.7
28427
28421
  },
28428
28422
  "estimatedDeveloperHours": 0
@@ -28743,4 +28737,4 @@
28743
28737
  "commit": "483846fbe79dfdde25557a61e09ab7689fc2c35c",
28744
28738
  "author": "caopengau@gmail.com"
28745
28739
  }
28746
- }
28740
+ }
@@ -28379,10 +28379,7 @@
28379
28379
  "tokenWastePerFile": 0,
28380
28380
  "estimatedMonthlyCost": {
28381
28381
  "total": 0,
28382
- "range": [
28383
- 0,
28384
- 0
28385
- ],
28382
+ "range": [0, 0],
28386
28383
  "confidence": 0.7
28387
28384
  },
28388
28385
  "estimatedDeveloperHours": 0
@@ -28419,10 +28416,7 @@
28419
28416
  "majorIssues": 0,
28420
28417
  "estimatedMonthlyCost": {
28421
28418
  "total": 1198.21,
28422
- "range": [
28423
- 898.66,
28424
- 1497.77
28425
- ],
28419
+ "range": [898.66, 1497.77],
28426
28420
  "confidence": 0.7
28427
28421
  },
28428
28422
  "estimatedDeveloperHours": 0
@@ -28743,4 +28737,4 @@
28743
28737
  "commit": "d09e2f3fe2dd251089c71aa7edf36f2b2e9ab6a1",
28744
28738
  "author": "caopengau@gmail.com"
28745
28739
  }
28746
- }
28740
+ }