@aiready/consistency 0.6.8 → 0.6.10
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.
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-test.log +49 -6
- package/dist/cli.js +14 -14
- package/dist/cli.mjs +14 -14
- package/package.json +2 -2
- package/src/cli.ts +16 -16
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/consistency@0.6.
|
|
3
|
+
> @aiready/consistency@0.6.10 build /Users/pengcao/projects/aiready/packages/consistency
|
|
4
4
|
> tsup src/index.ts src/cli.ts --format cjs,esm --dts
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m46.58 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in 99ms
|
|
15
|
-
[32mESM[39m [1mdist/cli.mjs [22m[32m8.55 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m9.40 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m8.62 KB[39m
|
|
17
13
|
[32mESM[39m [1mdist/chunk-HPG7P6PD.mjs [22m[32m36.87 KB[39m
|
|
18
|
-
[32mESM[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m9.40 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 214ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m47.29 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m46.65 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 216ms
|
|
19
19
|
DTS Build start
|
|
20
|
-
DTS ⚡️ Build success in
|
|
20
|
+
DTS ⚡️ Build success in 2193ms
|
|
21
21
|
DTS dist/cli.d.ts 20.00 B
|
|
22
22
|
DTS dist/index.d.ts 2.77 KB
|
|
23
23
|
DTS dist/cli.d.mts 20.00 B
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/consistency@0.6.
|
|
3
|
+
> @aiready/consistency@0.6.10 test /Users/pengcao/projects/aiready/packages/consistency
|
|
4
4
|
> vitest run
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
[1m[7m[36m RUN [39m[27m[22m [36mv2.1.9 [39m[90m/Users/pengcao/projects/aiready/packages/consistency[39m
|
|
8
8
|
|
|
9
|
-
[?25l [90m·[39m should
|
|
9
|
+
[?25l [90m·[39m should NOT flag common short English words
|
|
10
|
+
[90m·[39m should detect snake_case in TypeScript files
|
|
11
|
+
[90m·[39m should detect unclear boolean names
|
|
10
12
|
[90m·[39m should allow common abbreviations
|
|
11
13
|
[90m·[39m should NOT flag multi-line arrow function parameters (Phase 3)
|
|
12
14
|
[90m·[39m should NOT flag short-lived comparison variables (Phase 3)
|
|
@@ -21,7 +23,9 @@
|
|
|
21
23
|
[90m·[39m should generate relevant recommendations
|
|
22
24
|
[90m·[39m should suggest standardizing error handling
|
|
23
25
|
[90m·[39m should suggest using async/await consistently
|
|
24
|
-
[?25l[?25l[?25l[?25l[?25l[?25l[?25l[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m should
|
|
26
|
+
[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m should NOT flag common short English words
|
|
27
|
+
[32m✓[39m should detect snake_case in TypeScript files
|
|
28
|
+
[32m✓[39m should detect unclear boolean names
|
|
25
29
|
[32m✓[39m should allow common abbreviations
|
|
26
30
|
[32m✓[39m should NOT flag multi-line arrow function parameters (Phase 3)
|
|
27
31
|
[32m✓[39m should NOT flag short-lived comparison variables (Phase 3)
|
|
@@ -36,7 +40,46 @@
|
|
|
36
40
|
[33m⠙[39m should generate relevant recommendations
|
|
37
41
|
[90m·[39m should suggest standardizing error handling
|
|
38
42
|
[90m·[39m should suggest using async/await consistently
|
|
39
|
-
[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/__tests__/[22manalyzer[2m.test.ts[22m[2m (18)[22m
|
|
43
|
+
[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/__tests__/[22manalyzer[2m.test.ts[22m[2m (18)[22m
|
|
44
|
+
[32m✓[39m analyzeConsistency[2m (2)[22m
|
|
45
|
+
[32m✓[39m should analyze naming issues
|
|
46
|
+
[32m✓[39m should detect minimum severity filtering
|
|
47
|
+
[32m✓[39m analyzeNaming[2m (8)[22m
|
|
48
|
+
[32m✓[39m should detect single letter variables
|
|
49
|
+
[32m✓[39m should NOT flag acceptable abbreviations
|
|
50
|
+
[32m✓[39m should NOT flag common short English words
|
|
51
|
+
[32m✓[39m should detect snake_case in TypeScript files
|
|
52
|
+
[32m✓[39m should detect unclear boolean names
|
|
53
|
+
[32m✓[39m should allow common abbreviations
|
|
54
|
+
[32m✓[39m should NOT flag multi-line arrow function parameters (Phase 3)
|
|
55
|
+
[32m✓[39m should NOT flag short-lived comparison variables (Phase 3)
|
|
56
|
+
[32m✓[39m analyzePatterns[2m (3)[22m
|
|
57
|
+
[32m✓[39m should detect mixed error handling
|
|
58
|
+
[32m✓[39m should detect mixed async patterns
|
|
59
|
+
[32m✓[39m should detect mixed import styles
|
|
60
|
+
[32m✓[39m consistency scoring[2m (2)[22m
|
|
61
|
+
[32m✓[39m should calculate consistency score correctly
|
|
62
|
+
[32m✓[39m should weight critical issues more than info
|
|
63
|
+
[32m✓[39m recommendations[2m (3)[22m
|
|
64
|
+
[32m✓[39m should generate relevant recommendations
|
|
65
|
+
[32m✓[39m should suggest standardizing error handling
|
|
66
|
+
[32m✓[39m should suggest using async/await consistently
|
|
67
|
+
|
|
68
|
+
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
69
|
+
[2m Tests [22m [1m[32m18 passed[39m[22m[90m (18)[39m
|
|
70
|
+
[2m Start at [22m 19:03:23
|
|
71
|
+
[2m Duration [22m 2.62s[2m (transform 200ms, setup 0ms, collect 845ms, tests 224ms, environment 0ms, prepare 205ms)[22m
|
|
72
|
+
|
|
73
|
+
[?25h[?25h
|
|
74
|
+
[32m✓[39m should detect mixed import styles
|
|
75
|
+
[32m✓[39m consistency scoring[2m (2)[22m
|
|
76
|
+
[32m✓[39m should calculate consistency score correctly
|
|
77
|
+
[32m✓[39m should weight critical issues more than info
|
|
78
|
+
[32m✓[39m recommendations[2m (3)[22m
|
|
79
|
+
[32m✓[39m should generate relevant recommendations
|
|
80
|
+
[32m✓[39m should suggest standardizing error handling
|
|
81
|
+
[32m✓[39m should suggest using async/await consistently
|
|
82
|
+
[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/__tests__/[22manalyzer[2m.test.ts[22m[2m (18)[22m
|
|
40
83
|
[32m✓[39m analyzeConsistency[2m (2)[22m
|
|
41
84
|
[32m✓[39m should analyze naming issues
|
|
42
85
|
[32m✓[39m should detect minimum severity filtering
|
|
@@ -63,7 +106,7 @@
|
|
|
63
106
|
|
|
64
107
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
65
108
|
[2m Tests [22m [1m[32m18 passed[39m[22m[90m (18)[39m
|
|
66
|
-
[2m Start at [22m
|
|
67
|
-
[2m Duration [22m
|
|
109
|
+
[2m Start at [22m 19:03:23
|
|
110
|
+
[2m Duration [22m 2.34s[2m (transform 239ms, setup 0ms, collect 994ms, tests 252ms, environment 0ms, prepare 141ms)[22m
|
|
68
111
|
|
|
69
112
|
[?25h[?25h
|
package/dist/cli.js
CHANGED
|
@@ -1387,7 +1387,7 @@ var import_fs2 = require("fs");
|
|
|
1387
1387
|
var import_path2 = require("path");
|
|
1388
1388
|
var import_core4 = require("@aiready/core");
|
|
1389
1389
|
var program = new import_commander.Command();
|
|
1390
|
-
program.name("aiready-consistency").description("Detect consistency
|
|
1390
|
+
program.name("aiready-consistency").description("Detect consistency patterns in naming, code structure, and architecture").version("0.1.0").addHelpText("after", `
|
|
1391
1391
|
CONFIGURATION:
|
|
1392
1392
|
Supports config files: aiready.json, aiready.config.json, .aiready.json, .aireadyrc.json
|
|
1393
1393
|
CLI options override config file settings
|
|
@@ -1400,7 +1400,7 @@ ANALYSIS CATEGORIES:
|
|
|
1400
1400
|
EXAMPLES:
|
|
1401
1401
|
aiready-consistency . # Full analysis
|
|
1402
1402
|
aiready-consistency . --no-naming # Skip naming checks
|
|
1403
|
-
aiready-consistency . --min-severity major # Only show major+
|
|
1403
|
+
aiready-consistency . --min-severity major # Only show major+ patterns
|
|
1404
1404
|
aiready-consistency . --output json > report.json # JSON export
|
|
1405
1405
|
`).argument("<directory>", "Directory to analyze").option("--naming", "Check naming conventions and quality (default: true)").option("--no-naming", "Skip naming analysis").option("--patterns", "Check code pattern consistency (default: true)").option("--no-patterns", "Skip pattern analysis").option("--architecture", "Check architectural consistency (not yet implemented)").option("--min-severity <level>", "Minimum severity: info|minor|major|critical. Default: info").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console|json|markdown", "console").option("--output-file <path>", "Output file path (for json/markdown)").action(async (directory, options) => {
|
|
1406
1406
|
console.log(import_chalk.default.blue("\u{1F50D} Analyzing consistency...\n"));
|
|
@@ -1461,14 +1461,14 @@ function displayConsoleReport(report, elapsedTime) {
|
|
|
1461
1461
|
const { summary, results, recommendations } = report;
|
|
1462
1462
|
console.log(import_chalk.default.bold("\n\u{1F4CA} Summary\n"));
|
|
1463
1463
|
console.log(`Files Analyzed: ${import_chalk.default.cyan(summary.filesAnalyzed)}`);
|
|
1464
|
-
console.log(`Total
|
|
1464
|
+
console.log(`Total Patterns Found: ${import_chalk.default.yellow(summary.totalIssues)}`);
|
|
1465
1465
|
console.log(` Naming: ${import_chalk.default.yellow(summary.namingIssues)}`);
|
|
1466
|
-
console.log(` Patterns: ${import_chalk.default.yellow(summary.patternIssues)}`);
|
|
1466
|
+
console.log(` Code Patterns: ${import_chalk.default.yellow(summary.patternIssues)}`);
|
|
1467
1467
|
console.log(` Architecture: ${import_chalk.default.yellow(summary.architectureIssues)}`);
|
|
1468
1468
|
console.log(`Analysis Time: ${import_chalk.default.gray(elapsedTime + "s")}
|
|
1469
1469
|
`);
|
|
1470
1470
|
if (summary.totalIssues === 0) {
|
|
1471
|
-
console.log(import_chalk.default.green("\u2728 No consistency
|
|
1471
|
+
console.log(import_chalk.default.green("\u2728 No consistency patterns found! Your codebase is AI-friendly.\n"));
|
|
1472
1472
|
return;
|
|
1473
1473
|
}
|
|
1474
1474
|
const namingResults = results.filter(
|
|
@@ -1478,11 +1478,11 @@ function displayConsoleReport(report, elapsedTime) {
|
|
|
1478
1478
|
(r) => r.issues.some((i) => i.category === "patterns")
|
|
1479
1479
|
);
|
|
1480
1480
|
if (namingResults.length > 0) {
|
|
1481
|
-
console.log(import_chalk.default.bold("\u{1F3F7}\uFE0F Naming
|
|
1481
|
+
console.log(import_chalk.default.bold("\u{1F3F7}\uFE0F Naming Patterns\n"));
|
|
1482
1482
|
displayCategoryIssues(namingResults, 5);
|
|
1483
1483
|
}
|
|
1484
1484
|
if (patternResults.length > 0) {
|
|
1485
|
-
console.log(import_chalk.default.bold("\n\u{1F504}
|
|
1485
|
+
console.log(import_chalk.default.bold("\n\u{1F504} Code Patterns\n"));
|
|
1486
1486
|
displayCategoryIssues(patternResults, 5);
|
|
1487
1487
|
}
|
|
1488
1488
|
console.log(import_chalk.default.bold("\n\u{1F4A1} Recommendations\n"));
|
|
@@ -1513,7 +1513,7 @@ function displayCategoryIssues(results, maxToShow) {
|
|
|
1513
1513
|
}
|
|
1514
1514
|
const remaining = results.reduce((sum, r) => sum + r.issues.length, 0) - shown;
|
|
1515
1515
|
if (remaining > 0) {
|
|
1516
|
-
console.log(import_chalk.default.dim(` ... and ${remaining} more
|
|
1516
|
+
console.log(import_chalk.default.dim(` ... and ${remaining} more patterns
|
|
1517
1517
|
`));
|
|
1518
1518
|
}
|
|
1519
1519
|
}
|
|
@@ -1532,28 +1532,28 @@ function generateMarkdownReport(report, elapsedTime) {
|
|
|
1532
1532
|
`;
|
|
1533
1533
|
markdown += `- **Files Analyzed:** ${summary.filesAnalyzed}
|
|
1534
1534
|
`;
|
|
1535
|
-
markdown += `- **Total
|
|
1535
|
+
markdown += `- **Total Patterns Found:** ${summary.totalIssues}
|
|
1536
1536
|
`;
|
|
1537
1537
|
markdown += ` - Naming: ${summary.namingIssues}
|
|
1538
1538
|
`;
|
|
1539
|
-
markdown += ` - Patterns: ${summary.patternIssues}
|
|
1539
|
+
markdown += ` - Code Patterns: ${summary.patternIssues}
|
|
1540
1540
|
`;
|
|
1541
1541
|
markdown += ` - Architecture: ${summary.architectureIssues}
|
|
1542
1542
|
|
|
1543
1543
|
`;
|
|
1544
1544
|
if (summary.totalIssues === 0) {
|
|
1545
|
-
markdown += `\u2728 No consistency
|
|
1545
|
+
markdown += `\u2728 No consistency patterns found! Your codebase is AI-friendly.
|
|
1546
1546
|
`;
|
|
1547
1547
|
return markdown;
|
|
1548
1548
|
}
|
|
1549
|
-
markdown += `##
|
|
1549
|
+
markdown += `## Patterns by Category
|
|
1550
1550
|
|
|
1551
1551
|
`;
|
|
1552
1552
|
const namingResults = results.filter(
|
|
1553
1553
|
(r) => r.issues.some((i) => i.category === "naming")
|
|
1554
1554
|
);
|
|
1555
1555
|
if (namingResults.length > 0) {
|
|
1556
|
-
markdown += `### \u{1F3F7}\uFE0F Naming
|
|
1556
|
+
markdown += `### \u{1F3F7}\uFE0F Naming Patterns
|
|
1557
1557
|
|
|
1558
1558
|
`;
|
|
1559
1559
|
for (const result of namingResults) {
|
|
@@ -1576,7 +1576,7 @@ function generateMarkdownReport(report, elapsedTime) {
|
|
|
1576
1576
|
(r) => r.issues.some((i) => i.category === "patterns")
|
|
1577
1577
|
);
|
|
1578
1578
|
if (patternResults.length > 0) {
|
|
1579
|
-
markdown += `### \u{1F504}
|
|
1579
|
+
markdown += `### \u{1F504} Code Patterns
|
|
1580
1580
|
|
|
1581
1581
|
`;
|
|
1582
1582
|
for (const result of patternResults) {
|
package/dist/cli.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { writeFileSync, mkdirSync, existsSync } from "fs";
|
|
|
10
10
|
import { dirname } from "path";
|
|
11
11
|
import { loadConfig, mergeConfigWithDefaults, resolveOutputPath } from "@aiready/core";
|
|
12
12
|
var program = new Command();
|
|
13
|
-
program.name("aiready-consistency").description("Detect consistency
|
|
13
|
+
program.name("aiready-consistency").description("Detect consistency patterns in naming, code structure, and architecture").version("0.1.0").addHelpText("after", `
|
|
14
14
|
CONFIGURATION:
|
|
15
15
|
Supports config files: aiready.json, aiready.config.json, .aiready.json, .aireadyrc.json
|
|
16
16
|
CLI options override config file settings
|
|
@@ -23,7 +23,7 @@ ANALYSIS CATEGORIES:
|
|
|
23
23
|
EXAMPLES:
|
|
24
24
|
aiready-consistency . # Full analysis
|
|
25
25
|
aiready-consistency . --no-naming # Skip naming checks
|
|
26
|
-
aiready-consistency . --min-severity major # Only show major+
|
|
26
|
+
aiready-consistency . --min-severity major # Only show major+ patterns
|
|
27
27
|
aiready-consistency . --output json > report.json # JSON export
|
|
28
28
|
`).argument("<directory>", "Directory to analyze").option("--naming", "Check naming conventions and quality (default: true)").option("--no-naming", "Skip naming analysis").option("--patterns", "Check code pattern consistency (default: true)").option("--no-patterns", "Skip pattern analysis").option("--architecture", "Check architectural consistency (not yet implemented)").option("--min-severity <level>", "Minimum severity: info|minor|major|critical. Default: info").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console|json|markdown", "console").option("--output-file <path>", "Output file path (for json/markdown)").action(async (directory, options) => {
|
|
29
29
|
console.log(chalk.blue("\u{1F50D} Analyzing consistency...\n"));
|
|
@@ -84,14 +84,14 @@ function displayConsoleReport(report, elapsedTime) {
|
|
|
84
84
|
const { summary, results, recommendations } = report;
|
|
85
85
|
console.log(chalk.bold("\n\u{1F4CA} Summary\n"));
|
|
86
86
|
console.log(`Files Analyzed: ${chalk.cyan(summary.filesAnalyzed)}`);
|
|
87
|
-
console.log(`Total
|
|
87
|
+
console.log(`Total Patterns Found: ${chalk.yellow(summary.totalIssues)}`);
|
|
88
88
|
console.log(` Naming: ${chalk.yellow(summary.namingIssues)}`);
|
|
89
|
-
console.log(` Patterns: ${chalk.yellow(summary.patternIssues)}`);
|
|
89
|
+
console.log(` Code Patterns: ${chalk.yellow(summary.patternIssues)}`);
|
|
90
90
|
console.log(` Architecture: ${chalk.yellow(summary.architectureIssues)}`);
|
|
91
91
|
console.log(`Analysis Time: ${chalk.gray(elapsedTime + "s")}
|
|
92
92
|
`);
|
|
93
93
|
if (summary.totalIssues === 0) {
|
|
94
|
-
console.log(chalk.green("\u2728 No consistency
|
|
94
|
+
console.log(chalk.green("\u2728 No consistency patterns found! Your codebase is AI-friendly.\n"));
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
const namingResults = results.filter(
|
|
@@ -101,11 +101,11 @@ function displayConsoleReport(report, elapsedTime) {
|
|
|
101
101
|
(r) => r.issues.some((i) => i.category === "patterns")
|
|
102
102
|
);
|
|
103
103
|
if (namingResults.length > 0) {
|
|
104
|
-
console.log(chalk.bold("\u{1F3F7}\uFE0F Naming
|
|
104
|
+
console.log(chalk.bold("\u{1F3F7}\uFE0F Naming Patterns\n"));
|
|
105
105
|
displayCategoryIssues(namingResults, 5);
|
|
106
106
|
}
|
|
107
107
|
if (patternResults.length > 0) {
|
|
108
|
-
console.log(chalk.bold("\n\u{1F504}
|
|
108
|
+
console.log(chalk.bold("\n\u{1F504} Code Patterns\n"));
|
|
109
109
|
displayCategoryIssues(patternResults, 5);
|
|
110
110
|
}
|
|
111
111
|
console.log(chalk.bold("\n\u{1F4A1} Recommendations\n"));
|
|
@@ -136,7 +136,7 @@ function displayCategoryIssues(results, maxToShow) {
|
|
|
136
136
|
}
|
|
137
137
|
const remaining = results.reduce((sum, r) => sum + r.issues.length, 0) - shown;
|
|
138
138
|
if (remaining > 0) {
|
|
139
|
-
console.log(chalk.dim(` ... and ${remaining} more
|
|
139
|
+
console.log(chalk.dim(` ... and ${remaining} more patterns
|
|
140
140
|
`));
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -155,28 +155,28 @@ function generateMarkdownReport(report, elapsedTime) {
|
|
|
155
155
|
`;
|
|
156
156
|
markdown += `- **Files Analyzed:** ${summary.filesAnalyzed}
|
|
157
157
|
`;
|
|
158
|
-
markdown += `- **Total
|
|
158
|
+
markdown += `- **Total Patterns Found:** ${summary.totalIssues}
|
|
159
159
|
`;
|
|
160
160
|
markdown += ` - Naming: ${summary.namingIssues}
|
|
161
161
|
`;
|
|
162
|
-
markdown += ` - Patterns: ${summary.patternIssues}
|
|
162
|
+
markdown += ` - Code Patterns: ${summary.patternIssues}
|
|
163
163
|
`;
|
|
164
164
|
markdown += ` - Architecture: ${summary.architectureIssues}
|
|
165
165
|
|
|
166
166
|
`;
|
|
167
167
|
if (summary.totalIssues === 0) {
|
|
168
|
-
markdown += `\u2728 No consistency
|
|
168
|
+
markdown += `\u2728 No consistency patterns found! Your codebase is AI-friendly.
|
|
169
169
|
`;
|
|
170
170
|
return markdown;
|
|
171
171
|
}
|
|
172
|
-
markdown += `##
|
|
172
|
+
markdown += `## Patterns by Category
|
|
173
173
|
|
|
174
174
|
`;
|
|
175
175
|
const namingResults = results.filter(
|
|
176
176
|
(r) => r.issues.some((i) => i.category === "naming")
|
|
177
177
|
);
|
|
178
178
|
if (namingResults.length > 0) {
|
|
179
|
-
markdown += `### \u{1F3F7}\uFE0F Naming
|
|
179
|
+
markdown += `### \u{1F3F7}\uFE0F Naming Patterns
|
|
180
180
|
|
|
181
181
|
`;
|
|
182
182
|
for (const result of namingResults) {
|
|
@@ -199,7 +199,7 @@ function generateMarkdownReport(report, elapsedTime) {
|
|
|
199
199
|
(r) => r.issues.some((i) => i.category === "patterns")
|
|
200
200
|
);
|
|
201
201
|
if (patternResults.length > 0) {
|
|
202
|
-
markdown += `### \u{1F504}
|
|
202
|
+
markdown += `### \u{1F504} Code Patterns
|
|
203
203
|
|
|
204
204
|
`;
|
|
205
205
|
for (const result of patternResults) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/consistency",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@typescript-eslint/typescript-estree": "^8.53.0",
|
|
44
44
|
"chalk": "^5.3.0",
|
|
45
45
|
"commander": "^12.1.0",
|
|
46
|
-
"@aiready/core": "0.7.
|
|
46
|
+
"@aiready/core": "0.7.7"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^22.10.5",
|
package/src/cli.ts
CHANGED
|
@@ -12,7 +12,7 @@ const program = new Command();
|
|
|
12
12
|
|
|
13
13
|
program
|
|
14
14
|
.name('aiready-consistency')
|
|
15
|
-
.description('Detect consistency
|
|
15
|
+
.description('Detect consistency patterns in naming, code structure, and architecture')
|
|
16
16
|
.version('0.1.0')
|
|
17
17
|
.addHelpText('after', `
|
|
18
18
|
CONFIGURATION:
|
|
@@ -27,7 +27,7 @@ ANALYSIS CATEGORIES:
|
|
|
27
27
|
EXAMPLES:
|
|
28
28
|
aiready-consistency . # Full analysis
|
|
29
29
|
aiready-consistency . --no-naming # Skip naming checks
|
|
30
|
-
aiready-consistency . --min-severity major # Only show major+
|
|
30
|
+
aiready-consistency . --min-severity major # Only show major+ patterns
|
|
31
31
|
aiready-consistency . --output json > report.json # JSON export
|
|
32
32
|
`)
|
|
33
33
|
.argument('<directory>', 'Directory to analyze')
|
|
@@ -121,14 +121,14 @@ function displayConsoleReport(report: any, elapsedTime: string): void {
|
|
|
121
121
|
|
|
122
122
|
console.log(chalk.bold('\n📊 Summary\n'));
|
|
123
123
|
console.log(`Files Analyzed: ${chalk.cyan(summary.filesAnalyzed)}`);
|
|
124
|
-
console.log(`Total
|
|
124
|
+
console.log(`Total Patterns Found: ${chalk.yellow(summary.totalIssues)}`);
|
|
125
125
|
console.log(` Naming: ${chalk.yellow(summary.namingIssues)}`);
|
|
126
|
-
console.log(` Patterns: ${chalk.yellow(summary.patternIssues)}`);
|
|
126
|
+
console.log(` Code Patterns: ${chalk.yellow(summary.patternIssues)}`);
|
|
127
127
|
console.log(` Architecture: ${chalk.yellow(summary.architectureIssues)}`);
|
|
128
128
|
console.log(`Analysis Time: ${chalk.gray(elapsedTime + 's')}\n`);
|
|
129
129
|
|
|
130
130
|
if (summary.totalIssues === 0) {
|
|
131
|
-
console.log(chalk.green('✨ No consistency
|
|
131
|
+
console.log(chalk.green('✨ No consistency patterns found! Your codebase is AI-friendly.\n'));
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -141,12 +141,12 @@ function displayConsoleReport(report: any, elapsedTime: string): void {
|
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
if (namingResults.length > 0) {
|
|
144
|
-
console.log(chalk.bold('🏷️ Naming
|
|
144
|
+
console.log(chalk.bold('🏷️ Naming Patterns\n'));
|
|
145
145
|
displayCategoryIssues(namingResults, 5);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
if (patternResults.length > 0) {
|
|
149
|
-
console.log(chalk.bold('\n🔄
|
|
149
|
+
console.log(chalk.bold('\n🔄 Code Patterns\n'));
|
|
150
150
|
displayCategoryIssues(patternResults, 5);
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -191,7 +191,7 @@ function displayCategoryIssues(results: any[], maxToShow: number): void {
|
|
|
191
191
|
|
|
192
192
|
const remaining = results.reduce((sum, r) => sum + r.issues.length, 0) - shown;
|
|
193
193
|
if (remaining > 0) {
|
|
194
|
-
console.log(chalk.dim(` ... and ${remaining} more
|
|
194
|
+
console.log(chalk.dim(` ... and ${remaining} more patterns\n`));
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -204,24 +204,24 @@ function generateMarkdownReport(report: any, elapsedTime: string): string {
|
|
|
204
204
|
|
|
205
205
|
markdown += `## Summary\n\n`;
|
|
206
206
|
markdown += `- **Files Analyzed:** ${summary.filesAnalyzed}\n`;
|
|
207
|
-
markdown += `- **Total
|
|
207
|
+
markdown += `- **Total Patterns Found:** ${summary.totalIssues}\n`;
|
|
208
208
|
markdown += ` - Naming: ${summary.namingIssues}\n`;
|
|
209
|
-
markdown += ` - Patterns: ${summary.patternIssues}\n`;
|
|
209
|
+
markdown += ` - Code Patterns: ${summary.patternIssues}\n`;
|
|
210
210
|
markdown += ` - Architecture: ${summary.architectureIssues}\n\n`;
|
|
211
211
|
|
|
212
212
|
if (summary.totalIssues === 0) {
|
|
213
|
-
markdown += `✨ No consistency
|
|
213
|
+
markdown += `✨ No consistency patterns found! Your codebase is AI-friendly.\n`;
|
|
214
214
|
return markdown;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
markdown += `##
|
|
217
|
+
markdown += `## Patterns by Category\n\n`;
|
|
218
218
|
|
|
219
|
-
// Naming
|
|
219
|
+
// Naming patterns
|
|
220
220
|
const namingResults = results.filter((r: any) =>
|
|
221
221
|
r.issues.some((i: any) => i.category === 'naming')
|
|
222
222
|
);
|
|
223
223
|
if (namingResults.length > 0) {
|
|
224
|
-
markdown += `### 🏷️ Naming
|
|
224
|
+
markdown += `### 🏷️ Naming Patterns\n\n`;
|
|
225
225
|
for (const result of namingResults) {
|
|
226
226
|
for (const issue of result.issues) {
|
|
227
227
|
if (issue.category !== 'naming') continue;
|
|
@@ -235,12 +235,12 @@ function generateMarkdownReport(report: any, elapsedTime: string): string {
|
|
|
235
235
|
markdown += `\n`;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
//
|
|
238
|
+
// Code patterns
|
|
239
239
|
const patternResults = results.filter((r: any) =>
|
|
240
240
|
r.issues.some((i: any) => i.category === 'patterns')
|
|
241
241
|
);
|
|
242
242
|
if (patternResults.length > 0) {
|
|
243
|
-
markdown += `### 🔄
|
|
243
|
+
markdown += `### 🔄 Code Patterns\n\n`;
|
|
244
244
|
for (const result of patternResults) {
|
|
245
245
|
for (const issue of result.issues) {
|
|
246
246
|
if (issue.category !== 'patterns') continue;
|