@aiready/consistency 0.2.1 → 0.2.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/consistency@0.2.1 build /Users/pengcao/projects/aiready/packages/consistency
3
+ > @aiready/consistency@0.2.2 build /Users/pengcao/projects/aiready/packages/consistency
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 22.47 KB
13
- CJS dist/index.js 14.13 KB
14
- CJS ⚡️ Build success in 54ms
15
- ESM dist/cli.mjs 8.08 KB
12
+ ESM dist/cli.mjs 8.54 KB
16
13
  ESM dist/index.mjs 220.00 B
17
14
  ESM dist/chunk-CF4LU7KE.mjs 12.90 KB
18
- ESM ⚡️ Build success in 54ms
15
+ ESM ⚡️ Build success in 46ms
16
+ CJS dist/index.js 14.13 KB
17
+ CJS dist/cli.js 23.02 KB
18
+ CJS ⚡️ Build success in 46ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 546ms
20
+ DTS ⚡️ Build success in 544ms
21
21
  DTS dist/cli.d.ts 20.00 B
22
22
  DTS dist/index.d.ts 2.60 KB
23
23
  DTS dist/cli.d.mts 20.00 B
package/README.md CHANGED
@@ -91,13 +91,19 @@ aiready-consistency ./src --no-patterns
91
91
  # Show only major issues
92
92
  aiready-consistency ./src --min-severity major
93
93
 
94
- # Export to JSON
95
- aiready-consistency ./src --output json > report.json
94
+ # Export to JSON (saved to .aiready/ by default)
95
+ aiready-consistency ./src --output json
96
96
 
97
- # Export to Markdown
98
- aiready-consistency ./src --output markdown --output-file report.md
97
+ # Export to Markdown (saved to .aiready/ by default)
98
+ aiready-consistency ./src --output markdown
99
+
100
+ # Or specify custom paths
101
+ aiready-consistency ./src --output json --output-file custom-report.json
102
+ aiready-consistency ./src --output markdown --output-file custom-report.md
99
103
  ```
100
104
 
105
+ > **📁 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`.
106
+
101
107
  ## 🎛️ Options
102
108
 
103
109
  | Option | Description | Default |
package/dist/cli.js CHANGED
@@ -409,6 +409,7 @@ function generateRecommendations(namingIssues, patternIssues) {
409
409
  // src/cli.ts
410
410
  var import_chalk = __toESM(require("chalk"));
411
411
  var import_fs = require("fs");
412
+ var import_path = require("path");
412
413
  var import_core4 = require("@aiready/core");
413
414
  var program = new import_commander.Command();
414
415
  program.name("aiready-consistency").description("Detect consistency issues in naming, patterns, and architecture").version("0.1.0").addHelpText("after", `
@@ -452,20 +453,30 @@ EXAMPLES:
452
453
  const elapsedTime = ((Date.now() - startTime) / 1e3).toFixed(2);
453
454
  if (options.output === "json") {
454
455
  const output = JSON.stringify(report, null, 2);
455
- if (options.outputFile) {
456
- (0, import_fs.writeFileSync)(options.outputFile, output);
457
- console.log(import_chalk.default.green(`\u2713 Report saved to ${options.outputFile}`));
458
- } else {
459
- console.log(output);
456
+ const outputPath = (0, import_core4.resolveOutputPath)(
457
+ options.outputFile,
458
+ `consistency-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
459
+ directory
460
+ );
461
+ const dir = (0, import_path.dirname)(outputPath);
462
+ if (!(0, import_fs.existsSync)(dir)) {
463
+ (0, import_fs.mkdirSync)(dir, { recursive: true });
460
464
  }
465
+ (0, import_fs.writeFileSync)(outputPath, output);
466
+ console.log(import_chalk.default.green(`\u2713 Report saved to ${outputPath}`));
461
467
  } else if (options.output === "markdown") {
462
468
  const markdown = generateMarkdownReport(report, elapsedTime);
463
- if (options.outputFile) {
464
- (0, import_fs.writeFileSync)(options.outputFile, markdown);
465
- console.log(import_chalk.default.green(`\u2713 Report saved to ${options.outputFile}`));
466
- } else {
467
- console.log(markdown);
469
+ const outputPath = (0, import_core4.resolveOutputPath)(
470
+ options.outputFile,
471
+ `consistency-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.md`,
472
+ directory
473
+ );
474
+ const dir = (0, import_path.dirname)(outputPath);
475
+ if (!(0, import_fs.existsSync)(dir)) {
476
+ (0, import_fs.mkdirSync)(dir, { recursive: true });
468
477
  }
478
+ (0, import_fs.writeFileSync)(outputPath, markdown);
479
+ console.log(import_chalk.default.green(`\u2713 Report saved to ${outputPath}`));
469
480
  } else {
470
481
  displayConsoleReport(report, elapsedTime);
471
482
  }
package/dist/cli.mjs CHANGED
@@ -6,8 +6,9 @@ import {
6
6
  // src/cli.ts
7
7
  import { Command } from "commander";
8
8
  import chalk from "chalk";
9
- import { writeFileSync } from "fs";
10
- import { loadConfig, mergeConfigWithDefaults } from "@aiready/core";
9
+ import { writeFileSync, mkdirSync, existsSync } from "fs";
10
+ import { dirname } from "path";
11
+ import { loadConfig, mergeConfigWithDefaults, resolveOutputPath } from "@aiready/core";
11
12
  var program = new Command();
12
13
  program.name("aiready-consistency").description("Detect consistency issues in naming, patterns, and architecture").version("0.1.0").addHelpText("after", `
13
14
  CONFIGURATION:
@@ -50,20 +51,30 @@ EXAMPLES:
50
51
  const elapsedTime = ((Date.now() - startTime) / 1e3).toFixed(2);
51
52
  if (options.output === "json") {
52
53
  const output = JSON.stringify(report, null, 2);
53
- if (options.outputFile) {
54
- writeFileSync(options.outputFile, output);
55
- console.log(chalk.green(`\u2713 Report saved to ${options.outputFile}`));
56
- } else {
57
- console.log(output);
54
+ const outputPath = resolveOutputPath(
55
+ options.outputFile,
56
+ `consistency-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`,
57
+ directory
58
+ );
59
+ const dir = dirname(outputPath);
60
+ if (!existsSync(dir)) {
61
+ mkdirSync(dir, { recursive: true });
58
62
  }
63
+ writeFileSync(outputPath, output);
64
+ console.log(chalk.green(`\u2713 Report saved to ${outputPath}`));
59
65
  } else if (options.output === "markdown") {
60
66
  const markdown = generateMarkdownReport(report, elapsedTime);
61
- if (options.outputFile) {
62
- writeFileSync(options.outputFile, markdown);
63
- console.log(chalk.green(`\u2713 Report saved to ${options.outputFile}`));
64
- } else {
65
- console.log(markdown);
67
+ const outputPath = resolveOutputPath(
68
+ options.outputFile,
69
+ `consistency-report-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.md`,
70
+ directory
71
+ );
72
+ const dir = dirname(outputPath);
73
+ if (!existsSync(dir)) {
74
+ mkdirSync(dir, { recursive: true });
66
75
  }
76
+ writeFileSync(outputPath, markdown);
77
+ console.log(chalk.green(`\u2713 Report saved to ${outputPath}`));
67
78
  } else {
68
79
  displayConsoleReport(report, elapsedTime);
69
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/consistency",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Detects consistency issues in naming, patterns, and architecture that confuse AI models",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "chalk": "^5.3.0",
43
43
  "commander": "^12.1.0",
44
- "@aiready/core": "0.5.1"
44
+ "@aiready/core": "0.5.3"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^22.10.5",
package/src/cli.ts CHANGED
@@ -4,9 +4,9 @@ import { Command } from 'commander';
4
4
  import { analyzeConsistency } from './analyzer';
5
5
  import type { ConsistencyOptions } from './types';
6
6
  import chalk from 'chalk';
7
- import { writeFileSync } from 'fs';
8
- import { join } from 'path';
9
- import { loadConfig, mergeConfigWithDefaults } from '@aiready/core';
7
+ import { writeFileSync, mkdirSync, existsSync } from 'fs';
8
+ import { join, dirname } from 'path';
9
+ import { loadConfig, mergeConfigWithDefaults, resolveOutputPath } from '@aiready/core';
10
10
 
11
11
  const program = new Command();
12
12
 
@@ -80,20 +80,34 @@ EXAMPLES:
80
80
  // Output based on format
81
81
  if (options.output === 'json') {
82
82
  const output = JSON.stringify(report, null, 2);
83
- if (options.outputFile) {
84
- writeFileSync(options.outputFile, output);
85
- console.log(chalk.green(`✓ Report saved to ${options.outputFile}`));
86
- } else {
87
- console.log(output);
83
+ const outputPath = resolveOutputPath(
84
+ options.outputFile,
85
+ `consistency-report-${new Date().toISOString().split('T')[0]}.json`,
86
+ directory
87
+ );
88
+
89
+ const dir = dirname(outputPath);
90
+ if (!existsSync(dir)) {
91
+ mkdirSync(dir, { recursive: true });
88
92
  }
93
+
94
+ writeFileSync(outputPath, output);
95
+ console.log(chalk.green(`✓ Report saved to ${outputPath}`));
89
96
  } else if (options.output === 'markdown') {
90
97
  const markdown = generateMarkdownReport(report, elapsedTime);
91
- if (options.outputFile) {
92
- writeFileSync(options.outputFile, markdown);
93
- console.log(chalk.green(`✓ Report saved to ${options.outputFile}`));
94
- } else {
95
- console.log(markdown);
98
+ const outputPath = resolveOutputPath(
99
+ options.outputFile,
100
+ `consistency-report-${new Date().toISOString().split('T')[0]}.md`,
101
+ directory
102
+ );
103
+
104
+ const dir = dirname(outputPath);
105
+ if (!existsSync(dir)) {
106
+ mkdirSync(dir, { recursive: true });
96
107
  }
108
+
109
+ writeFileSync(outputPath, markdown);
110
+ console.log(chalk.green(`✓ Report saved to ${outputPath}`));
97
111
  } else {
98
112
  // Console output
99
113
  displayConsoleReport(report, elapsedTime);