@aiready/consistency 0.6.1 → 0.6.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.
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-test.log +24 -24
- package/dist/chunk-ON73WHHU.mjs +1310 -0
- package/dist/chunk-W6UGMKRV.mjs +1310 -0
- package/dist/cli.js +15 -2
- package/dist/cli.mjs +2 -2
- package/dist/index.js +15 -2
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
- package/src/analyzer.ts +21 -0
- package/src/analyzers/naming-ast.ts +1 -1
- package/src/analyzers/naming.ts +1 -1
- package/src/cli.ts +1 -1
package/dist/cli.js
CHANGED
|
@@ -818,7 +818,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
818
818
|
async function analyzeNamingAST(files) {
|
|
819
819
|
const issues = [];
|
|
820
820
|
const rootDir = files.length > 0 ? (0, import_path.dirname)(files[0]) : process.cwd();
|
|
821
|
-
const config = (0, import_core.loadConfig)(rootDir);
|
|
821
|
+
const config = await (0, import_core.loadConfig)(rootDir);
|
|
822
822
|
const consistencyConfig = config?.tools?.["consistency"];
|
|
823
823
|
const customAbbreviations = new Set(consistencyConfig?.acceptedAbbreviations || []);
|
|
824
824
|
const customShortWords = new Set(consistencyConfig?.shortWords || []);
|
|
@@ -1256,6 +1256,19 @@ async function analyzeConsistency(options) {
|
|
|
1256
1256
|
}
|
|
1257
1257
|
});
|
|
1258
1258
|
}
|
|
1259
|
+
results.sort((fileResultA, fileResultB) => {
|
|
1260
|
+
const severityOrder = { critical: 0, major: 1, minor: 2, info: 3 };
|
|
1261
|
+
const maxSeverityA = Math.min(
|
|
1262
|
+
...fileResultA.issues.map((i) => severityOrder[i.severity])
|
|
1263
|
+
);
|
|
1264
|
+
const maxSeverityB = Math.min(
|
|
1265
|
+
...fileResultB.issues.map((i) => severityOrder[i.severity])
|
|
1266
|
+
);
|
|
1267
|
+
if (maxSeverityA !== maxSeverityB) {
|
|
1268
|
+
return maxSeverityA - maxSeverityB;
|
|
1269
|
+
}
|
|
1270
|
+
return fileResultB.issues.length - fileResultA.issues.length;
|
|
1271
|
+
});
|
|
1259
1272
|
const recommendations = generateRecommendations(namingIssues, patternIssues);
|
|
1260
1273
|
return {
|
|
1261
1274
|
summary: {
|
|
@@ -1344,7 +1357,7 @@ EXAMPLES:
|
|
|
1344
1357
|
`).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) => {
|
|
1345
1358
|
console.log(import_chalk.default.blue("\u{1F50D} Analyzing consistency...\n"));
|
|
1346
1359
|
const startTime = Date.now();
|
|
1347
|
-
const config = (0, import_core4.loadConfig)(directory);
|
|
1360
|
+
const config = await (0, import_core4.loadConfig)(directory);
|
|
1348
1361
|
const defaults = {
|
|
1349
1362
|
checkNaming: true,
|
|
1350
1363
|
checkPatterns: true,
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
analyzeConsistency
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ON73WHHU.mjs";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -28,7 +28,7 @@ EXAMPLES:
|
|
|
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"));
|
|
30
30
|
const startTime = Date.now();
|
|
31
|
-
const config = loadConfig(directory);
|
|
31
|
+
const config = await loadConfig(directory);
|
|
32
32
|
const defaults = {
|
|
33
33
|
checkNaming: true,
|
|
34
34
|
checkPatterns: true,
|
package/dist/index.js
CHANGED
|
@@ -820,7 +820,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
820
820
|
async function analyzeNamingAST(files) {
|
|
821
821
|
const issues = [];
|
|
822
822
|
const rootDir = files.length > 0 ? (0, import_path.dirname)(files[0]) : process.cwd();
|
|
823
|
-
const config = (0, import_core.loadConfig)(rootDir);
|
|
823
|
+
const config = await (0, import_core.loadConfig)(rootDir);
|
|
824
824
|
const consistencyConfig = config?.tools?.["consistency"];
|
|
825
825
|
const customAbbreviations = new Set(consistencyConfig?.acceptedAbbreviations || []);
|
|
826
826
|
const customShortWords = new Set(consistencyConfig?.shortWords || []);
|
|
@@ -1258,6 +1258,19 @@ async function analyzeConsistency(options) {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
});
|
|
1260
1260
|
}
|
|
1261
|
+
results.sort((fileResultA, fileResultB) => {
|
|
1262
|
+
const severityOrder = { critical: 0, major: 1, minor: 2, info: 3 };
|
|
1263
|
+
const maxSeverityA = Math.min(
|
|
1264
|
+
...fileResultA.issues.map((i) => severityOrder[i.severity])
|
|
1265
|
+
);
|
|
1266
|
+
const maxSeverityB = Math.min(
|
|
1267
|
+
...fileResultB.issues.map((i) => severityOrder[i.severity])
|
|
1268
|
+
);
|
|
1269
|
+
if (maxSeverityA !== maxSeverityB) {
|
|
1270
|
+
return maxSeverityA - maxSeverityB;
|
|
1271
|
+
}
|
|
1272
|
+
return fileResultB.issues.length - fileResultA.issues.length;
|
|
1273
|
+
});
|
|
1261
1274
|
const recommendations = generateRecommendations(namingIssues, patternIssues);
|
|
1262
1275
|
return {
|
|
1263
1276
|
summary: {
|
|
@@ -1710,7 +1723,7 @@ var ACCEPTABLE_ABBREVIATIONS2 = /* @__PURE__ */ new Set([
|
|
|
1710
1723
|
async function analyzeNaming(files) {
|
|
1711
1724
|
const issues = [];
|
|
1712
1725
|
const rootDir = files.length > 0 ? (0, import_path2.dirname)(files[0]) : process.cwd();
|
|
1713
|
-
const config = (0, import_core4.loadConfig)(rootDir);
|
|
1726
|
+
const config = await (0, import_core4.loadConfig)(rootDir);
|
|
1714
1727
|
const consistencyConfig = config?.tools?.["consistency"];
|
|
1715
1728
|
const customAbbreviations = new Set(consistencyConfig?.acceptedAbbreviations || []);
|
|
1716
1729
|
const customShortWords = new Set(consistencyConfig?.shortWords || []);
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
analyzeConsistency,
|
|
3
3
|
analyzeNamingAST,
|
|
4
4
|
analyzePatterns
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ON73WHHU.mjs";
|
|
6
6
|
|
|
7
7
|
// src/analyzers/naming.ts
|
|
8
8
|
import { readFileContent, loadConfig } from "@aiready/core";
|
|
@@ -392,7 +392,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
392
392
|
async function analyzeNaming(files) {
|
|
393
393
|
const issues = [];
|
|
394
394
|
const rootDir = files.length > 0 ? dirname(files[0]) : process.cwd();
|
|
395
|
-
const config = loadConfig(rootDir);
|
|
395
|
+
const config = await loadConfig(rootDir);
|
|
396
396
|
const consistencyConfig = config?.tools?.["consistency"];
|
|
397
397
|
const customAbbreviations = new Set(consistencyConfig?.acceptedAbbreviations || []);
|
|
398
398
|
const customShortWords = new Set(consistencyConfig?.shortWords || []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/consistency",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.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",
|
|
@@ -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.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^22.10.5",
|
package/src/analyzer.ts
CHANGED
|
@@ -94,6 +94,27 @@ export async function analyzeConsistency(
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
// Sort results by severity first, then by issue count per file
|
|
98
|
+
results.sort((fileResultA, fileResultB) => {
|
|
99
|
+
const severityOrder = { critical: 0, major: 1, minor: 2, info: 3 };
|
|
100
|
+
|
|
101
|
+
// Get highest severity in each file
|
|
102
|
+
const maxSeverityA = Math.min(
|
|
103
|
+
...fileResultA.issues.map(i => severityOrder[(i as ConsistencyIssue).severity])
|
|
104
|
+
);
|
|
105
|
+
const maxSeverityB = Math.min(
|
|
106
|
+
...fileResultB.issues.map(i => severityOrder[(i as ConsistencyIssue).severity])
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// Sort by severity first
|
|
110
|
+
if (maxSeverityA !== maxSeverityB) {
|
|
111
|
+
return maxSeverityA - maxSeverityB;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Then by issue count (descending)
|
|
115
|
+
return fileResultB.issues.length - fileResultA.issues.length;
|
|
116
|
+
});
|
|
117
|
+
|
|
97
118
|
// Generate recommendations
|
|
98
119
|
const recommendations = generateRecommendations(namingIssues, patternIssues);
|
|
99
120
|
|
|
@@ -74,7 +74,7 @@ export async function analyzeNamingAST(files: string[]): Promise<NamingIssue[]>
|
|
|
74
74
|
|
|
75
75
|
// Load config
|
|
76
76
|
const rootDir = files.length > 0 ? dirname(files[0]) : process.cwd();
|
|
77
|
-
const config = loadConfig(rootDir);
|
|
77
|
+
const config = await loadConfig(rootDir);
|
|
78
78
|
const consistencyConfig = config?.tools?.['consistency'];
|
|
79
79
|
|
|
80
80
|
// Merge custom configuration
|
package/src/analyzers/naming.ts
CHANGED
|
@@ -82,7 +82,7 @@ export async function analyzeNaming(files: string[]): Promise<NamingIssue[]> {
|
|
|
82
82
|
|
|
83
83
|
// Load config from the first file's directory (or project root)
|
|
84
84
|
const rootDir = files.length > 0 ? dirname(files[0]) : process.cwd();
|
|
85
|
-
const config = loadConfig(rootDir);
|
|
85
|
+
const config = await loadConfig(rootDir);
|
|
86
86
|
const consistencyConfig = config?.tools?.['consistency'];
|
|
87
87
|
|
|
88
88
|
// Merge custom abbreviations and short words with defaults
|