@aiready/cli 0.14.2 → 0.14.4

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 (44) 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 +29 -28
  4. package/.turbo/turbo-lint.log +0 -32
  5. package/.turbo/turbo-test.log +35 -125
  6. package/aiready-report.json +30703 -0
  7. package/dist/cli.js +415 -378
  8. package/dist/cli.mjs +358 -320
  9. package/package.json +12 -12
  10. package/packages/core/src/.aiready/aiready-report-20260314-161145.json +4 -10
  11. package/packages/core/src/.aiready/aiready-report-20260314-161152.json +10 -28
  12. package/packages/pattern-detect/src/.aiready/aiready-report-20260314-161139.json +4 -10
  13. package/src/.aiready/aiready-report-20260312-103623.json +3 -9
  14. package/src/.aiready/aiready-report-20260312-110843.json +3 -9
  15. package/src/.aiready/aiready-report-20260312-110955.json +3 -9
  16. package/src/.aiready/aiready-report-20260314-203209.json +3 -9
  17. package/src/.aiready/aiready-report-20260314-203736.json +3 -9
  18. package/src/.aiready/aiready-report-20260314-203857.json +3 -9
  19. package/src/.aiready/aiready-report-20260314-204047.json +3 -9
  20. package/src/__tests__/cli.test.ts +1 -1
  21. package/src/__tests__/config-shape.test.ts +0 -1
  22. package/src/__tests__/unified.test.ts +1 -1
  23. package/src/cli.ts +2 -1
  24. package/src/commands/__tests__/consistency.test.ts +3 -0
  25. package/src/commands/__tests__/extra-commands.test.ts +29 -38
  26. package/src/commands/__tests__/init.test.ts +56 -0
  27. package/src/commands/__tests__/scan.test.ts +4 -2
  28. package/src/commands/__tests__/upload.test.ts +0 -1
  29. package/src/commands/__tests__/visualize.test.ts +3 -7
  30. package/src/commands/ai-signal-clarity.ts +1 -56
  31. package/src/commands/bug.ts +1 -2
  32. package/src/commands/deps-health.ts +1 -65
  33. package/src/commands/doc-drift.ts +1 -62
  34. package/src/commands/init.ts +58 -2
  35. package/src/commands/patterns.ts +3 -1
  36. package/src/commands/report-formatter.ts +128 -0
  37. package/src/commands/scan.ts +29 -120
  38. package/src/commands/shared/configured-tool-action.ts +35 -0
  39. package/src/commands/shared/standard-tool-actions.ts +126 -0
  40. package/src/commands/upload.ts +15 -13
  41. package/src/commands/visualize.ts +11 -4
  42. package/src/index.ts +18 -3
  43. package/src/utils/helpers.ts +86 -37
  44. package/vitest.config.ts +5 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/cli",
3
- "version": "0.14.2",
3
+ "version": "0.14.4",
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/context-analyzer": "0.21.5",
15
- "@aiready/doc-drift": "0.13.1",
16
- "@aiready/agent-grounding": "0.13.1",
17
- "@aiready/change-amplification": "0.13.1",
18
- "@aiready/ai-signal-clarity": "0.13.1",
19
- "@aiready/pattern-detect": "0.16.1",
20
- "@aiready/deps": "0.13.1",
21
- "@aiready/core": "0.23.1",
22
- "@aiready/consistency": "0.20.1",
23
- "@aiready/visualizer": "0.6.1",
24
- "@aiready/testability": "0.6.1"
14
+ "@aiready/context-analyzer": "0.21.7",
15
+ "@aiready/agent-grounding": "0.13.3",
16
+ "@aiready/core": "0.23.3",
17
+ "@aiready/deps": "0.13.3",
18
+ "@aiready/ai-signal-clarity": "0.13.3",
19
+ "@aiready/doc-drift": "0.13.3",
20
+ "@aiready/testability": "0.6.3",
21
+ "@aiready/visualizer": "0.6.3",
22
+ "@aiready/change-amplification": "0.13.3",
23
+ "@aiready/consistency": "0.20.3",
24
+ "@aiready/pattern-detect": "0.16.3"
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
+ }
@@ -30347,10 +30347,7 @@
30347
30347
  "tokenWastePerFile": 100,
30348
30348
  "estimatedMonthlyCost": {
30349
30349
  "total": 89.28,
30350
- "range": [
30351
- 66.96,
30352
- 111.6
30353
- ],
30350
+ "range": [66.96, 111.6],
30354
30351
  "confidence": 0.7
30355
30352
  },
30356
30353
  "estimatedDeveloperHours": 2
@@ -30387,10 +30384,7 @@
30387
30384
  "majorIssues": 0,
30388
30385
  "estimatedMonthlyCost": {
30389
30386
  "total": 1768.1,
30390
- "range": [
30391
- 1326.07,
30392
- 2210.12
30393
- ],
30387
+ "range": [1326.07, 2210.12],
30394
30388
  "confidence": 0.7
30395
30389
  },
30396
30390
  "estimatedDeveloperHours": 0
@@ -30716,4 +30710,4 @@
30716
30710
  "commit": "48c4320fe8d22e39ac7f20f8db337e4727c5b379",
30717
30711
  "author": "caopengau@gmail.com"
30718
30712
  }
30719
- }
30713
+ }
@@ -30347,10 +30347,7 @@
30347
30347
  "tokenWastePerFile": 100,
30348
30348
  "estimatedMonthlyCost": {
30349
30349
  "total": 89.28,
30350
- "range": [
30351
- 66.96,
30352
- 111.6
30353
- ],
30350
+ "range": [66.96, 111.6],
30354
30351
  "confidence": 0.7
30355
30352
  },
30356
30353
  "estimatedDeveloperHours": 2
@@ -30387,10 +30384,7 @@
30387
30384
  "majorIssues": 0,
30388
30385
  "estimatedMonthlyCost": {
30389
30386
  "total": 1768.1,
30390
- "range": [
30391
- 1326.07,
30392
- 2210.12
30393
- ],
30387
+ "range": [1326.07, 2210.12],
30394
30388
  "confidence": 0.7
30395
30389
  },
30396
30390
  "estimatedDeveloperHours": 0
@@ -30716,4 +30710,4 @@
30716
30710
  "commit": "479afa71f97fb36b3a58457ef9329d8e6490a8be",
30717
30711
  "author": "caopengau@gmail.com"
30718
30712
  }
30719
- }
30713
+ }
@@ -30347,10 +30347,7 @@
30347
30347
  "tokenWastePerFile": 100,
30348
30348
  "estimatedMonthlyCost": {
30349
30349
  "total": 89.28,
30350
- "range": [
30351
- 66.96,
30352
- 111.6
30353
- ],
30350
+ "range": [66.96, 111.6],
30354
30351
  "confidence": 0.7
30355
30352
  },
30356
30353
  "estimatedDeveloperHours": 2
@@ -30387,10 +30384,7 @@
30387
30384
  "majorIssues": 0,
30388
30385
  "estimatedMonthlyCost": {
30389
30386
  "total": 1768.1,
30390
- "range": [
30391
- 1326.07,
30392
- 2210.12
30393
- ],
30387
+ "range": [1326.07, 2210.12],
30394
30388
  "confidence": 0.7
30395
30389
  },
30396
30390
  "estimatedDeveloperHours": 0
@@ -30716,4 +30710,4 @@
30716
30710
  "commit": "2b3cc3360b013172089def69b7ab8cb21f07ea83",
30717
30711
  "author": "caopengau@gmail.com"
30718
30712
  }
30719
- }
30713
+ }
@@ -30347,10 +30347,7 @@
30347
30347
  "tokenWastePerFile": 100,
30348
30348
  "estimatedMonthlyCost": {
30349
30349
  "total": 89.28,
30350
- "range": [
30351
- 66.96,
30352
- 111.6
30353
- ],
30350
+ "range": [66.96, 111.6],
30354
30351
  "confidence": 0.7
30355
30352
  },
30356
30353
  "estimatedDeveloperHours": 2
@@ -30387,10 +30384,7 @@
30387
30384
  "majorIssues": 0,
30388
30385
  "estimatedMonthlyCost": {
30389
30386
  "total": 1768.1,
30390
- "range": [
30391
- 1326.07,
30392
- 2210.12
30393
- ],
30387
+ "range": [1326.07, 2210.12],
30394
30388
  "confidence": 0.7
30395
30389
  },
30396
30390
  "estimatedDeveloperHours": 0
@@ -30716,4 +30710,4 @@
30716
30710
  "commit": "2c5867d7c07a535df4f0b922881b6d84d47ca570",
30717
30711
  "author": "caopengau@gmail.com"
30718
30712
  }
30719
- }
30713
+ }
@@ -1,4 +1,4 @@
1
- import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
1
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
2
  import { analyzeUnified } from '../index';
3
3
  import { ToolRegistry, ToolName, SpokeOutputSchema } from '@aiready/core';
4
4
 
@@ -76,7 +76,6 @@ describe('CLI Configuration Shape', () => {
76
76
  rootDir: '/test',
77
77
  tools: [ToolName.PatternDetect],
78
78
  useSmartDefaults: true,
79
- // @ts-ignore - testing internal key stripping
80
79
  batchSize: 50,
81
80
  });
82
81
 
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { analyzeUnified, scoreUnified, generateUnifiedSummary } from '../index';
3
- import { ToolRegistry, ToolName } from '@aiready/core';
3
+ import { ToolRegistry } from '@aiready/core';
4
4
 
5
5
  vi.mock('@aiready/core', async () => {
6
6
  const actual = await vi.importActual('@aiready/core');
package/src/cli.ts CHANGED
@@ -132,9 +132,10 @@ program
132
132
  '--js',
133
133
  'Generate configuration as a JavaScript file (aiready.config.js)'
134
134
  )
135
+ .option('--full', 'Generate a full configuration with all available options')
135
136
  .action(async (options) => {
136
137
  const format = options.js ? 'js' : 'json';
137
- await initAction({ force: options.force, format });
138
+ await initAction({ force: options.force, format, full: options.full });
138
139
  });
139
140
 
140
141
  // Patterns command - Detect duplicate code patterns
@@ -60,6 +60,7 @@ describe('Consistency CLI Action', () => {
60
60
  consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
61
61
  vi.mocked(core.loadMergedConfig).mockResolvedValue({
62
62
  output: { format: 'console' },
63
+ rootDir: '/test',
63
64
  });
64
65
  });
65
66
 
@@ -75,6 +76,7 @@ describe('Consistency CLI Action', () => {
75
76
  it('supports JSON output', async () => {
76
77
  vi.mocked(core.loadMergedConfig).mockResolvedValue({
77
78
  output: { format: 'json' },
79
+ rootDir: '/test',
78
80
  });
79
81
  await consistencyAction('.', {});
80
82
  expect(core.handleJSONOutput).toHaveBeenCalled();
@@ -83,6 +85,7 @@ describe('Consistency CLI Action', () => {
83
85
  it('supports Markdown output', async () => {
84
86
  vi.mocked(core.loadMergedConfig).mockResolvedValue({
85
87
  output: { format: 'markdown' },
88
+ rootDir: '/test',
86
89
  });
87
90
  await consistencyAction('.', {});
88
91
  expect(fs.writeFileSync).toHaveBeenCalled();
@@ -7,7 +7,6 @@ import { testabilityAction } from '../testability';
7
7
  import { depsHealthAction } from '../deps-health';
8
8
  import { patternsAction } from '../patterns';
9
9
  import { contextAction } from '../context';
10
- import * as core from '@aiready/core';
11
10
 
12
11
  vi.mock('@aiready/core', async () => {
13
12
  const actual = await vi.importActual('@aiready/core');
@@ -18,7 +17,7 @@ vi.mock('@aiready/core', async () => {
18
17
  .fn()
19
18
  .mockImplementation((c, d) => ({ ...d, ...c })),
20
19
  loadMergedConfig: vi.fn().mockResolvedValue({
21
- rootDir: '.',
20
+ rootDir: '/test',
22
21
  output: { format: 'console' },
23
22
  checkNaming: true,
24
23
  checkPatterns: true,
@@ -33,13 +32,11 @@ vi.mock('@aiready/core', async () => {
33
32
 
34
33
  // Mock all spokes
35
34
  vi.mock('@aiready/change-amplification', () => ({
36
- analyzeChangeAmplification: vi
37
- .fn()
38
- .mockResolvedValue({
39
- results: [],
40
- summary: { rating: 'contained' },
41
- recommendations: [],
42
- }),
35
+ analyzeChangeAmplification: vi.fn().mockResolvedValue({
36
+ results: [],
37
+ summary: { rating: 'contained' },
38
+ recommendations: [],
39
+ }),
43
40
  calculateChangeAmplificationScore: vi.fn().mockReturnValue({ score: 80 }),
44
41
  }));
45
42
  vi.mock('@aiready/agent-grounding', () => ({
@@ -91,39 +88,33 @@ vi.mock('@aiready/deps', () => ({
91
88
  calculateDepsScore: vi.fn().mockReturnValue({ score: 80 }),
92
89
  }));
93
90
  vi.mock('@aiready/pattern-detect', () => ({
94
- analyzePatterns: vi
95
- .fn()
96
- .mockResolvedValue({
97
- results: [],
98
- summary: { totalPatterns: 0 },
99
- config: {},
100
- }),
101
- generateSummary: vi
102
- .fn()
103
- .mockReturnValue({
104
- totalPatterns: 0,
105
- totalTokenCost: 0,
106
- patternsByType: {},
107
- topDuplicates: [],
108
- }),
91
+ analyzePatterns: vi.fn().mockResolvedValue({
92
+ results: [],
93
+ summary: { totalPatterns: 0 },
94
+ config: {},
95
+ }),
96
+ generateSummary: vi.fn().mockReturnValue({
97
+ totalPatterns: 0,
98
+ totalTokenCost: 0,
99
+ patternsByType: {},
100
+ topDuplicates: [],
101
+ }),
109
102
  getSmartDefaults: vi.fn().mockResolvedValue({}),
110
103
  }));
111
104
  vi.mock('@aiready/context-analyzer', () => ({
112
105
  analyzeContext: vi.fn().mockResolvedValue([]),
113
- generateSummary: vi
114
- .fn()
115
- .mockReturnValue({
116
- score: 80,
117
- rating: 'good',
118
- totalFiles: 0,
119
- totalTokens: 0,
120
- avgImportDepth: 0,
121
- maxImportDepth: 0,
122
- avgFragmentation: 0,
123
- criticalIssues: 0,
124
- majorIssues: 0,
125
- totalPotentialSavings: 0,
126
- }),
106
+ generateSummary: vi.fn().mockReturnValue({
107
+ score: 80,
108
+ rating: 'good',
109
+ totalFiles: 0,
110
+ totalTokens: 0,
111
+ avgImportDepth: 0,
112
+ maxImportDepth: 0,
113
+ avgFragmentation: 0,
114
+ criticalIssues: 0,
115
+ majorIssues: 0,
116
+ totalPotentialSavings: 0,
117
+ }),
127
118
  getSmartDefaults: vi.fn().mockResolvedValue({}),
128
119
  }));
129
120
 
@@ -0,0 +1,56 @@
1
+ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
2
+ import { existsSync, readFileSync, unlinkSync, mkdirSync, rmSync } from 'fs';
3
+ import { join } from 'path';
4
+ import { initAction } from '../init';
5
+
6
+ describe('initAction', () => {
7
+ const testDir = join(process.cwd(), 'temp-test-init');
8
+ const configPath = join(testDir, 'aiready.json');
9
+
10
+ beforeEach(() => {
11
+ if (!existsSync(testDir)) {
12
+ mkdirSync(testDir, { recursive: true });
13
+ }
14
+ // Mock process.cwd to use our test directory
15
+ vi.spyOn(process, 'cwd').mockReturnValue(testDir);
16
+ // Mock console.log to avoid noise
17
+ vi.spyOn(console, 'log').mockImplementation(() => {});
18
+ vi.spyOn(console, 'error').mockImplementation(() => {});
19
+ });
20
+
21
+ afterEach(() => {
22
+ vi.restoreAllMocks();
23
+ if (existsSync(configPath)) {
24
+ unlinkSync(configPath);
25
+ }
26
+ if (existsSync(testDir)) {
27
+ rmSync(testDir, { recursive: true, force: true });
28
+ }
29
+ });
30
+
31
+ it('should generate aiready.json without output field by default', async () => {
32
+ await initAction({});
33
+
34
+ expect(existsSync(configPath)).toBe(true);
35
+ const config = JSON.parse(readFileSync(configPath, 'utf8'));
36
+ expect(config).not.toHaveProperty('output');
37
+ });
38
+
39
+ it('should generate aiready.json without output field even with --full flag', async () => {
40
+ await initAction({ full: true });
41
+
42
+ expect(existsSync(configPath)).toBe(true);
43
+ const config = JSON.parse(readFileSync(configPath, 'utf8'));
44
+ expect(config).not.toHaveProperty('output');
45
+ });
46
+
47
+ it('should include scan, tools, and scoring sections', async () => {
48
+ await initAction({ full: true });
49
+
50
+ const config = JSON.parse(readFileSync(configPath, 'utf8'));
51
+ expect(config).toHaveProperty('scan');
52
+ expect(config).toHaveProperty('tools');
53
+ expect(config).toHaveProperty('scoring');
54
+ expect(config).toHaveProperty('visualizer');
55
+ });
56
+ });
@@ -3,7 +3,7 @@ import { scanAction } from '../scan';
3
3
  import * as core from '@aiready/core';
4
4
  import * as index from '../../index';
5
5
  import * as upload from '../upload';
6
- import { writeFileSync, readFileSync, existsSync } from 'fs';
6
+ import { readFileSync } from 'fs';
7
7
  import { Severity } from '@aiready/core';
8
8
 
9
9
  vi.mock('../../index', () => ({
@@ -58,6 +58,7 @@ describe('Scan CLI Action', () => {
58
58
  vi.mocked(core.loadMergedConfig).mockResolvedValue({
59
59
  tools: ['pattern-detect'],
60
60
  output: { format: 'console' },
61
+ rootDir: '/test',
61
62
  });
62
63
  vi.mocked(index.analyzeUnified).mockResolvedValue({
63
64
  summary: {
@@ -126,7 +127,7 @@ describe('Scan CLI Action', () => {
126
127
 
127
128
  expect(exitSpy).toHaveBeenCalledWith(1);
128
129
  expect(consoleSpy).toHaveBeenCalledWith(
129
- expect.stringContaining('PR BLOCKED')
130
+ expect.stringContaining('SCAN FAILED')
130
131
  );
131
132
  // Verify annotations are emitted
132
133
  expect(consoleSpy).toHaveBeenCalledWith(
@@ -144,6 +145,7 @@ describe('Scan CLI Action', () => {
144
145
  vi.mocked(core.loadMergedConfig).mockResolvedValue({
145
146
  tools: ['pattern-detect'],
146
147
  output: { format: 'json', file: 'out.json' },
148
+ rootDir: '/test',
147
149
  });
148
150
  await scanAction('.', {});
149
151
  expect(core.handleJSONOutput).toHaveBeenCalled();
@@ -1,6 +1,5 @@
1
1
  import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { uploadAction } from '../upload';
3
- import fs from 'fs';
4
3
 
5
4
  vi.mock('fs', () => ({
6
5
  default: {