@aiready/cli 0.4.1 → 0.4.2

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.4.1 build /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.4.2 build /Users/pengcao/projects/aiready/packages/cli
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
@@ -9,15 +9,15 @@
9
9
  CLI Target: es2020
10
10
  CJS Build start
11
11
  ESM Build start
12
- CJS dist/cli.js 15.94 KB
13
12
  CJS dist/index.js 3.15 KB
14
- CJS ⚡️ Build success in 48ms
15
- ESM dist/chunk-VOB7SA3E.mjs 2.02 KB
13
+ CJS dist/cli.js 16.87 KB
14
+ CJS ⚡️ Build success in 66ms
16
15
  ESM dist/index.mjs 138.00 B
17
- ESM dist/cli.mjs 12.36 KB
18
- ESM ⚡️ Build success in 49ms
16
+ ESM dist/chunk-VOB7SA3E.mjs 2.02 KB
17
+ ESM dist/cli.mjs 13.23 KB
18
+ ESM ⚡️ Build success in 66ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 554ms
20
+ DTS ⚡️ Build success in 489ms
21
21
  DTS dist/cli.d.ts 20.00 B
22
22
  DTS dist/index.d.ts 991.00 B
23
23
  DTS dist/cli.d.mts 20.00 B
package/README.md CHANGED
@@ -36,7 +36,7 @@ Options:
36
36
  - `--include <patterns>`: File patterns to include (comma-separated)
37
37
  - `--exclude <patterns>`: File patterns to exclude (comma-separated)
38
38
  - `-o, --output <format>`: Output format: console, json (default: console)
39
- - `--output-file <path>`: Output file path (for json)
39
+ - `--output-file <path>`: Output file path (defaults to `.aiready/pattern-report-YYYY-MM-DD.json`)
40
40
 
41
41
  #### Context Analysis
42
42
 
@@ -50,7 +50,7 @@ Options:
50
50
  - `--include <patterns>`: File patterns to include (comma-separated)
51
51
  - `--exclude <patterns>`: File patterns to exclude (comma-separated)
52
52
  - `-o, --output <format>`: Output format: console, json (default: console)
53
- - `--output-file <path>`: Output file path (for json)
53
+ - `--output-file <path>`: Output file path (defaults to `.aiready/context-report-YYYY-MM-DD.json`)
54
54
 
55
55
  ### Unified Scan Options
56
56
 
@@ -63,7 +63,9 @@ Options:
63
63
  - `--include <patterns>`: File patterns to include (comma-separated)
64
64
  - `--exclude <patterns>`: File patterns to exclude (comma-separated)
65
65
  - `-o, --output <format>`: Output format: console, json (default: console)
66
- - `--output-file <path>`: Output file path (for json)
66
+ - `--output-file <path>`: Output file path (defaults to `.aiready/aiready-scan-YYYY-MM-DD.json`)
67
+
68
+ > **📁 Output Files:** By default, all output files are saved to the `.aiready/` directory in your project root with timestamped filenames. You can override this with `--output-file`.
67
69
 
68
70
  ## Examples
69
71
 
@@ -89,8 +91,11 @@ aiready scan ./src --include "**/*.ts,**/*.js"
89
91
  # Exclude test files
90
92
  aiready scan . --exclude "**/*.test.*,**/*.spec.*"
91
93
 
92
- # Save results to JSON file
93
- aiready scan . --output json --output-file results.json
94
+ # Save results to JSON file (.aiready/ directory by default)
95
+ aiready scan . --output json
96
+
97
+ # Save to custom location
98
+ aiready scan . --output json --output-file custom-results.json
94
99
 
95
100
  # Run only pattern analysis with custom similarity threshold
96
101
  aiready patterns . --similarity 0.6 --min-lines 10
package/dist/cli.js CHANGED
@@ -129,7 +129,7 @@ program.command("scan").description("Run unified analysis on a codebase").argume
129
129
  const results = await analyzeUnified(finalOptions);
130
130
  const elapsedTime = (0, import_core.getElapsedTime)(startTime);
131
131
  const outputFormat = options.output || finalOptions.output?.format || "console";
132
- const outputFile = options.outputFile || finalOptions.output?.file;
132
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
133
133
  if (outputFormat === "json") {
134
134
  const outputData = {
135
135
  ...results,
@@ -138,7 +138,12 @@ program.command("scan").description("Run unified analysis on a codebase").argume
138
138
  executionTime: parseFloat(elapsedTime)
139
139
  }
140
140
  };
141
- (0, import_core.handleJSONOutput)(outputData, outputFile, `\u2705 Results saved to ${outputFile}`);
141
+ const outputPath = (0, import_core.resolveOutputPath)(
142
+ userOutputFile,
143
+ `aiready-scan-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
144
+ directory
145
+ );
146
+ (0, import_core.handleJSONOutput)(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
142
147
  } else {
143
148
  console.log(generateUnifiedSummary(results));
144
149
  }
@@ -183,13 +188,18 @@ program.command("patterns").description("Run pattern detection analysis").argume
183
188
  const elapsedTime = (0, import_core.getElapsedTime)(startTime);
184
189
  const summary = generateSummary(results);
185
190
  const outputFormat = options.output || finalOptions.output?.format || "console";
186
- const outputFile = options.outputFile || finalOptions.output?.file;
191
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
187
192
  if (outputFormat === "json") {
188
193
  const outputData = {
189
194
  results,
190
195
  summary: { ...summary, executionTime: parseFloat(elapsedTime) }
191
196
  };
192
- (0, import_core.handleJSONOutput)(outputData, outputFile, `\u2705 Results saved to ${outputFile}`);
197
+ const outputPath = (0, import_core.resolveOutputPath)(
198
+ userOutputFile,
199
+ `pattern-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
200
+ directory
201
+ );
202
+ (0, import_core.handleJSONOutput)(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
193
203
  } else {
194
204
  console.log(`Pattern Analysis Complete (${elapsedTime}s)`);
195
205
  console.log(`Found ${summary.totalPatterns} duplicate patterns`);
@@ -235,13 +245,18 @@ program.command("context").description("Run context window cost analysis").argum
235
245
  const elapsedTime = (0, import_core.getElapsedTime)(startTime);
236
246
  const summary = generateSummary(results);
237
247
  const outputFormat = options.output || finalOptions.output?.format || "console";
238
- const outputFile = options.outputFile || finalOptions.output?.file;
248
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
239
249
  if (outputFormat === "json") {
240
250
  const outputData = {
241
251
  results,
242
252
  summary: { ...summary, executionTime: parseFloat(elapsedTime) }
243
253
  };
244
- (0, import_core.handleJSONOutput)(outputData, outputFile, `\u2705 Results saved to ${outputFile}`);
254
+ const outputPath = (0, import_core.resolveOutputPath)(
255
+ userOutputFile,
256
+ `context-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
257
+ directory
258
+ );
259
+ (0, import_core.handleJSONOutput)(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
245
260
  } else {
246
261
  console.log(`Context Analysis Complete (${elapsedTime}s)`);
247
262
  console.log(`Files analyzed: ${summary.totalFiles}`);
@@ -279,7 +294,7 @@ program.command("consistency").description("Check naming, patterns, and architec
279
294
  const report = await analyzeConsistency2(finalOptions);
280
295
  const elapsedTime = (0, import_core.getElapsedTime)(startTime);
281
296
  const outputFormat = options.output || finalOptions.output?.format || "console";
282
- const outputFile = options.outputFile || finalOptions.output?.file;
297
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
283
298
  if (outputFormat === "json") {
284
299
  const outputData = {
285
300
  ...report,
@@ -288,15 +303,21 @@ program.command("consistency").description("Check naming, patterns, and architec
288
303
  executionTime: parseFloat(elapsedTime)
289
304
  }
290
305
  };
291
- (0, import_core.handleJSONOutput)(outputData, outputFile, `\u2705 Results saved to ${outputFile}`);
306
+ const outputPath = (0, import_core.resolveOutputPath)(
307
+ userOutputFile,
308
+ `consistency-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
309
+ directory
310
+ );
311
+ (0, import_core.handleJSONOutput)(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
292
312
  } else if (outputFormat === "markdown") {
293
313
  const markdown = generateMarkdownReport(report, elapsedTime);
294
- if (outputFile) {
295
- (0, import_fs.writeFileSync)(outputFile, markdown);
296
- console.log(import_chalk.default.green(`\u2705 Report saved to ${outputFile}`));
297
- } else {
298
- console.log(markdown);
299
- }
314
+ const outputPath = (0, import_core.resolveOutputPath)(
315
+ userOutputFile,
316
+ `consistency-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.md`,
317
+ directory
318
+ );
319
+ (0, import_fs.writeFileSync)(outputPath, markdown);
320
+ console.log(import_chalk.default.green(`\u2705 Report saved to ${outputPath}`));
300
321
  } else {
301
322
  console.log(`Consistency Analysis Complete (${elapsedTime}s)`);
302
323
  console.log(`Files analyzed: ${report.summary.filesAnalyzed}`);
package/dist/cli.mjs CHANGED
@@ -9,7 +9,7 @@ import { Command } from "commander";
9
9
  import chalk from "chalk";
10
10
  import { writeFileSync } from "fs";
11
11
  import { join } from "path";
12
- import { loadMergedConfig, handleJSONOutput, handleCLIError, getElapsedTime } from "@aiready/core";
12
+ import { loadMergedConfig, handleJSONOutput, handleCLIError, getElapsedTime, resolveOutputPath } from "@aiready/core";
13
13
  import { readFileSync } from "fs";
14
14
  var packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf8"));
15
15
  var program = new Command();
@@ -41,7 +41,7 @@ program.command("scan").description("Run unified analysis on a codebase").argume
41
41
  const results = await analyzeUnified(finalOptions);
42
42
  const elapsedTime = getElapsedTime(startTime);
43
43
  const outputFormat = options.output || finalOptions.output?.format || "console";
44
- const outputFile = options.outputFile || finalOptions.output?.file;
44
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
45
45
  if (outputFormat === "json") {
46
46
  const outputData = {
47
47
  ...results,
@@ -50,7 +50,12 @@ program.command("scan").description("Run unified analysis on a codebase").argume
50
50
  executionTime: parseFloat(elapsedTime)
51
51
  }
52
52
  };
53
- handleJSONOutput(outputData, outputFile, `\u2705 Results saved to ${outputFile}`);
53
+ const outputPath = resolveOutputPath(
54
+ userOutputFile,
55
+ `aiready-scan-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
56
+ directory
57
+ );
58
+ handleJSONOutput(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
54
59
  } else {
55
60
  console.log(generateUnifiedSummary(results));
56
61
  }
@@ -95,13 +100,18 @@ program.command("patterns").description("Run pattern detection analysis").argume
95
100
  const elapsedTime = getElapsedTime(startTime);
96
101
  const summary = generateSummary(results);
97
102
  const outputFormat = options.output || finalOptions.output?.format || "console";
98
- const outputFile = options.outputFile || finalOptions.output?.file;
103
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
99
104
  if (outputFormat === "json") {
100
105
  const outputData = {
101
106
  results,
102
107
  summary: { ...summary, executionTime: parseFloat(elapsedTime) }
103
108
  };
104
- handleJSONOutput(outputData, outputFile, `\u2705 Results saved to ${outputFile}`);
109
+ const outputPath = resolveOutputPath(
110
+ userOutputFile,
111
+ `pattern-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
112
+ directory
113
+ );
114
+ handleJSONOutput(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
105
115
  } else {
106
116
  console.log(`Pattern Analysis Complete (${elapsedTime}s)`);
107
117
  console.log(`Found ${summary.totalPatterns} duplicate patterns`);
@@ -147,13 +157,18 @@ program.command("context").description("Run context window cost analysis").argum
147
157
  const elapsedTime = getElapsedTime(startTime);
148
158
  const summary = generateSummary(results);
149
159
  const outputFormat = options.output || finalOptions.output?.format || "console";
150
- const outputFile = options.outputFile || finalOptions.output?.file;
160
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
151
161
  if (outputFormat === "json") {
152
162
  const outputData = {
153
163
  results,
154
164
  summary: { ...summary, executionTime: parseFloat(elapsedTime) }
155
165
  };
156
- handleJSONOutput(outputData, outputFile, `\u2705 Results saved to ${outputFile}`);
166
+ const outputPath = resolveOutputPath(
167
+ userOutputFile,
168
+ `context-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
169
+ directory
170
+ );
171
+ handleJSONOutput(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
157
172
  } else {
158
173
  console.log(`Context Analysis Complete (${elapsedTime}s)`);
159
174
  console.log(`Files analyzed: ${summary.totalFiles}`);
@@ -191,7 +206,7 @@ program.command("consistency").description("Check naming, patterns, and architec
191
206
  const report = await analyzeConsistency(finalOptions);
192
207
  const elapsedTime = getElapsedTime(startTime);
193
208
  const outputFormat = options.output || finalOptions.output?.format || "console";
194
- const outputFile = options.outputFile || finalOptions.output?.file;
209
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
195
210
  if (outputFormat === "json") {
196
211
  const outputData = {
197
212
  ...report,
@@ -200,15 +215,21 @@ program.command("consistency").description("Check naming, patterns, and architec
200
215
  executionTime: parseFloat(elapsedTime)
201
216
  }
202
217
  };
203
- handleJSONOutput(outputData, outputFile, `\u2705 Results saved to ${outputFile}`);
218
+ const outputPath = resolveOutputPath(
219
+ userOutputFile,
220
+ `consistency-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
221
+ directory
222
+ );
223
+ handleJSONOutput(outputData, outputPath, `\u2705 Results saved to ${outputPath}`);
204
224
  } else if (outputFormat === "markdown") {
205
225
  const markdown = generateMarkdownReport(report, elapsedTime);
206
- if (outputFile) {
207
- writeFileSync(outputFile, markdown);
208
- console.log(chalk.green(`\u2705 Report saved to ${outputFile}`));
209
- } else {
210
- console.log(markdown);
211
- }
226
+ const outputPath = resolveOutputPath(
227
+ userOutputFile,
228
+ `consistency-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.md`,
229
+ directory
230
+ );
231
+ writeFileSync(outputPath, markdown);
232
+ console.log(chalk.green(`\u2705 Report saved to ${outputPath}`));
212
233
  } else {
213
234
  console.log(`Consistency Analysis Complete (${elapsedTime}s)`);
214
235
  console.log(`Files analyzed: ${report.summary.filesAnalyzed}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Unified CLI for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -11,10 +11,10 @@
11
11
  "dependencies": {
12
12
  "commander": "^12.1.0",
13
13
  "chalk": "^5.3.0",
14
- "@aiready/core": "0.5.1",
15
- "@aiready/context-analyzer": "0.4.1",
16
- "@aiready/pattern-detect": "0.8.1",
17
- "@aiready/consistency": "0.2.1"
14
+ "@aiready/core": "0.5.3",
15
+ "@aiready/pattern-detect": "0.8.2",
16
+ "@aiready/context-analyzer": "0.4.3",
17
+ "@aiready/consistency": "0.2.2"
18
18
  },
19
19
  "devDependencies": {
20
20
  "tsup": "^8.3.5",
package/src/cli.ts CHANGED
@@ -5,7 +5,7 @@ import { analyzeUnified, generateUnifiedSummary } from './index';
5
5
  import chalk from 'chalk';
6
6
  import { writeFileSync } from 'fs';
7
7
  import { join } from 'path';
8
- import { loadMergedConfig, handleJSONOutput, handleCLIError, getElapsedTime } from '@aiready/core';
8
+ import { loadMergedConfig, handleJSONOutput, handleCLIError, getElapsedTime, resolveOutputPath } from '@aiready/core';
9
9
  import { readFileSync } from 'fs';
10
10
 
11
11
  const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'));
@@ -64,7 +64,7 @@ program
64
64
  const elapsedTime = getElapsedTime(startTime);
65
65
 
66
66
  const outputFormat = options.output || finalOptions.output?.format || 'console';
67
- const outputFile = options.outputFile || finalOptions.output?.file;
67
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
68
68
 
69
69
  if (outputFormat === 'json') {
70
70
  const outputData = {
@@ -75,7 +75,13 @@ program
75
75
  },
76
76
  };
77
77
 
78
- handleJSONOutput(outputData, outputFile, `✅ Results saved to ${outputFile}`);
78
+ const outputPath = resolveOutputPath(
79
+ userOutputFile,
80
+ `aiready-scan-${new Date().toISOString().split('T')[0]}.json`,
81
+ directory
82
+ );
83
+
84
+ handleJSONOutput(outputData, outputPath, `✅ Results saved to ${outputPath}`);
79
85
  } else {
80
86
  // Console output
81
87
  console.log(generateUnifiedSummary(results));
@@ -152,7 +158,7 @@ program
152
158
  const summary = generateSummary(results);
153
159
 
154
160
  const outputFormat = options.output || finalOptions.output?.format || 'console';
155
- const outputFile = options.outputFile || finalOptions.output?.file;
161
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
156
162
 
157
163
  if (outputFormat === 'json') {
158
164
  const outputData = {
@@ -160,7 +166,13 @@ program
160
166
  summary: { ...summary, executionTime: parseFloat(elapsedTime) },
161
167
  };
162
168
 
163
- handleJSONOutput(outputData, outputFile, `✅ Results saved to ${outputFile}`);
169
+ const outputPath = resolveOutputPath(
170
+ userOutputFile,
171
+ `pattern-report-${new Date().toISOString().split('T')[0]}.json`,
172
+ directory
173
+ );
174
+
175
+ handleJSONOutput(outputData, outputPath, `✅ Results saved to ${outputPath}`);
164
176
  } else {
165
177
  console.log(`Pattern Analysis Complete (${elapsedTime}s)`);
166
178
  console.log(`Found ${summary.totalPatterns} duplicate patterns`);
@@ -230,7 +242,7 @@ program
230
242
  const summary = generateSummary(results);
231
243
 
232
244
  const outputFormat = options.output || finalOptions.output?.format || 'console';
233
- const outputFile = options.outputFile || finalOptions.output?.file;
245
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
234
246
 
235
247
  if (outputFormat === 'json') {
236
248
  const outputData = {
@@ -238,7 +250,13 @@ program
238
250
  summary: { ...summary, executionTime: parseFloat(elapsedTime) },
239
251
  };
240
252
 
241
- handleJSONOutput(outputData, outputFile, `✅ Results saved to ${outputFile}`);
253
+ const outputPath = resolveOutputPath(
254
+ userOutputFile,
255
+ `context-report-${new Date().toISOString().split('T')[0]}.json`,
256
+ directory
257
+ );
258
+
259
+ handleJSONOutput(outputData, outputPath, `✅ Results saved to ${outputPath}`);
242
260
  } else {
243
261
  console.log(`Context Analysis Complete (${elapsedTime}s)`);
244
262
  console.log(`Files analyzed: ${summary.totalFiles}`);
@@ -299,7 +317,7 @@ program
299
317
  const elapsedTime = getElapsedTime(startTime);
300
318
 
301
319
  const outputFormat = options.output || finalOptions.output?.format || 'console';
302
- const outputFile = options.outputFile || finalOptions.output?.file;
320
+ const userOutputFile = options.outputFile || finalOptions.output?.file;
303
321
 
304
322
  if (outputFormat === 'json') {
305
323
  const outputData = {
@@ -310,16 +328,23 @@ program
310
328
  },
311
329
  };
312
330
 
313
- handleJSONOutput(outputData, outputFile, `✅ Results saved to ${outputFile}`);
331
+ const outputPath = resolveOutputPath(
332
+ userOutputFile,
333
+ `consistency-report-${new Date().toISOString().split('T')[0]}.json`,
334
+ directory
335
+ );
336
+
337
+ handleJSONOutput(outputData, outputPath, `✅ Results saved to ${outputPath}`);
314
338
  } else if (outputFormat === 'markdown') {
315
339
  // Markdown output
316
340
  const markdown = generateMarkdownReport(report, elapsedTime);
317
- if (outputFile) {
318
- writeFileSync(outputFile, markdown);
319
- console.log(chalk.green(`✅ Report saved to ${outputFile}`));
320
- } else {
321
- console.log(markdown);
322
- }
341
+ const outputPath = resolveOutputPath(
342
+ userOutputFile,
343
+ `consistency-report-${new Date().toISOString().split('T')[0]}.md`,
344
+ directory
345
+ );
346
+ writeFileSync(outputPath, markdown);
347
+ console.log(chalk.green(`✅ Report saved to ${outputPath}`));
323
348
  } else {
324
349
  console.log(`Consistency Analysis Complete (${elapsedTime}s)`);
325
350
  console.log(`Files analyzed: ${report.summary.filesAnalyzed}`);