@aiready/consistency 0.4.1 → 0.5.0
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/PHASE5-RESULTS.md +277 -0
- package/dist/chunk-TXHPUU7A.mjs +863 -0
- package/dist/cli.js +16 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.js +16 -1
- package/dist/index.mjs +1 -1
- package/package.json +13 -12
- package/src/analyzers/naming.ts +12 -1
- package/.turbo/turbo-build.log +0 -24
- package/.turbo/turbo-test.log +0 -81
package/dist/cli.js
CHANGED
|
@@ -401,7 +401,18 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
401
401
|
// Date/Time context (when in date contexts)
|
|
402
402
|
"d",
|
|
403
403
|
"t",
|
|
404
|
-
"dt"
|
|
404
|
+
"dt",
|
|
405
|
+
// Coverage metrics (industry standard: statements/branches/functions/lines)
|
|
406
|
+
"s",
|
|
407
|
+
"b",
|
|
408
|
+
"f",
|
|
409
|
+
"l",
|
|
410
|
+
// Common media/content abbreviations
|
|
411
|
+
"vid",
|
|
412
|
+
"pic",
|
|
413
|
+
"img",
|
|
414
|
+
"doc",
|
|
415
|
+
"msg"
|
|
405
416
|
]);
|
|
406
417
|
async function analyzeNaming(files) {
|
|
407
418
|
const issues = [];
|
|
@@ -449,6 +460,10 @@ function analyzeFileNaming(file, content, customAbbreviations, customShortWords,
|
|
|
449
460
|
const singleLetterMatches = line.matchAll(/\b(?:const|let|var)\s+([a-hm-z])\s*=/gi);
|
|
450
461
|
for (const match of singleLetterMatches) {
|
|
451
462
|
const letter = match[1].toLowerCase();
|
|
463
|
+
const isCoverageContext = /coverage|summary|metrics|pct|percent/i.test(line) || /\.(?:statements|branches|functions|lines)\.pct/i.test(line);
|
|
464
|
+
if (isCoverageContext && ["s", "b", "f", "l"].includes(letter)) {
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
452
467
|
const isInLoopContext = line.includes("for") || /\.(map|filter|forEach|reduce|find|some|every)\s*\(/.test(line) || line.includes("=>") || // Arrow function
|
|
453
468
|
/\w+\s*=>\s*/.test(line);
|
|
454
469
|
const isI18nContext = line.includes("useTranslation") || line.includes("i18n.t") || /\bt\s*\(['"]/.test(line);
|
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -402,7 +402,18 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
402
402
|
// Date/Time context (when in date contexts)
|
|
403
403
|
"d",
|
|
404
404
|
"t",
|
|
405
|
-
"dt"
|
|
405
|
+
"dt",
|
|
406
|
+
// Coverage metrics (industry standard: statements/branches/functions/lines)
|
|
407
|
+
"s",
|
|
408
|
+
"b",
|
|
409
|
+
"f",
|
|
410
|
+
"l",
|
|
411
|
+
// Common media/content abbreviations
|
|
412
|
+
"vid",
|
|
413
|
+
"pic",
|
|
414
|
+
"img",
|
|
415
|
+
"doc",
|
|
416
|
+
"msg"
|
|
406
417
|
]);
|
|
407
418
|
async function analyzeNaming(files) {
|
|
408
419
|
const issues = [];
|
|
@@ -450,6 +461,10 @@ function analyzeFileNaming(file, content, customAbbreviations, customShortWords,
|
|
|
450
461
|
const singleLetterMatches = line.matchAll(/\b(?:const|let|var)\s+([a-hm-z])\s*=/gi);
|
|
451
462
|
for (const match of singleLetterMatches) {
|
|
452
463
|
const letter = match[1].toLowerCase();
|
|
464
|
+
const isCoverageContext = /coverage|summary|metrics|pct|percent/i.test(line) || /\.(?:statements|branches|functions|lines)\.pct/i.test(line);
|
|
465
|
+
if (isCoverageContext && ["s", "b", "f", "l"].includes(letter)) {
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
453
468
|
const isInLoopContext = line.includes("for") || /\.(map|filter|forEach|reduce|find|some|every)\s*\(/.test(line) || line.includes("=>") || // Arrow function
|
|
454
469
|
/\w+\s*=>\s*/.test(line);
|
|
455
470
|
const isI18nContext = line.includes("useTranslation") || line.includes("i18n.t") || /\bt\s*\(['"]/.test(line);
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/consistency",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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",
|
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
"import": "./dist/index.mjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts",
|
|
20
|
+
"dev": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"lint": "eslint src",
|
|
23
|
+
"clean": "rm -rf dist",
|
|
24
|
+
"prepublishOnly": "pnpm build",
|
|
25
|
+
"release": "pnpm build && pnpm publish --no-git-checks"
|
|
26
|
+
},
|
|
18
27
|
"keywords": [
|
|
19
28
|
"aiready",
|
|
20
29
|
"consistency",
|
|
@@ -39,9 +48,9 @@
|
|
|
39
48
|
},
|
|
40
49
|
"homepage": "https://github.com/caopengau/aiready-consistency",
|
|
41
50
|
"dependencies": {
|
|
51
|
+
"@aiready/core": "workspace:*",
|
|
42
52
|
"chalk": "^5.3.0",
|
|
43
|
-
"commander": "^12.1.0"
|
|
44
|
-
"@aiready/core": "0.7.1"
|
|
53
|
+
"commander": "^12.1.0"
|
|
45
54
|
},
|
|
46
55
|
"devDependencies": {
|
|
47
56
|
"@types/node": "^22.10.5",
|
|
@@ -51,13 +60,5 @@
|
|
|
51
60
|
},
|
|
52
61
|
"engines": {
|
|
53
62
|
"node": ">=18.0.0"
|
|
54
|
-
},
|
|
55
|
-
"scripts": {
|
|
56
|
-
"build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts",
|
|
57
|
-
"dev": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch",
|
|
58
|
-
"test": "vitest run",
|
|
59
|
-
"lint": "eslint src",
|
|
60
|
-
"clean": "rm -rf dist",
|
|
61
|
-
"release": "pnpm build && pnpm publish --no-git-checks"
|
|
62
63
|
}
|
|
63
|
-
}
|
|
64
|
+
}
|
package/src/analyzers/naming.ts
CHANGED
|
@@ -67,7 +67,11 @@ const ACCEPTABLE_ABBREVIATIONS = new Set([
|
|
|
67
67
|
// Boolean helpers (these are intentional short names)
|
|
68
68
|
'is', 'has', 'can', 'did', 'was', 'are',
|
|
69
69
|
// Date/Time context (when in date contexts)
|
|
70
|
-
'd', 't', 'dt'
|
|
70
|
+
'd', 't', 'dt',
|
|
71
|
+
// Coverage metrics (industry standard: statements/branches/functions/lines)
|
|
72
|
+
's', 'b', 'f', 'l',
|
|
73
|
+
// Common media/content abbreviations
|
|
74
|
+
'vid', 'pic', 'img', 'doc', 'msg'
|
|
71
75
|
]);
|
|
72
76
|
|
|
73
77
|
/**
|
|
@@ -156,6 +160,13 @@ function analyzeFileNaming(
|
|
|
156
160
|
for (const match of singleLetterMatches) {
|
|
157
161
|
const letter = match[1].toLowerCase();
|
|
158
162
|
|
|
163
|
+
// Coverage metrics context (s/b/f/l are standard for statements/branches/functions/lines)
|
|
164
|
+
const isCoverageContext = /coverage|summary|metrics|pct|percent/i.test(line) ||
|
|
165
|
+
/\.(?:statements|branches|functions|lines)\.pct/i.test(line);
|
|
166
|
+
if (isCoverageContext && ['s', 'b', 'f', 'l'].includes(letter)) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
|
|
159
170
|
// Enhanced loop/iterator context detection
|
|
160
171
|
const isInLoopContext =
|
|
161
172
|
line.includes('for') ||
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> @aiready/consistency@0.4.1 build /Users/pengcao/projects/aiready/packages/consistency
|
|
4
|
-
> tsup src/index.ts src/cli.ts --format cjs,esm --dts
|
|
5
|
-
|
|
6
|
-
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
7
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
-
[34mCLI[39m tsup v8.5.1
|
|
9
|
-
[34mCLI[39m Target: es2020
|
|
10
|
-
[34mCJS[39m Build start
|
|
11
|
-
[34mESM[39m Build start
|
|
12
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m32.93 KB[39m
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[32m24.04 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in 15ms
|
|
15
|
-
[32mESM[39m [1mdist/chunk-CZUJTDNH.mjs [22m[32m22.79 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m220.00 B[39m
|
|
17
|
-
[32mESM[39m [1mdist/cli.mjs [22m[32m8.54 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in 15ms
|
|
19
|
-
DTS Build start
|
|
20
|
-
DTS ⚡️ Build success in 580ms
|
|
21
|
-
DTS dist/cli.d.ts 20.00 B
|
|
22
|
-
DTS dist/index.d.ts 2.60 KB
|
|
23
|
-
DTS dist/cli.d.mts 20.00 B
|
|
24
|
-
DTS dist/index.d.mts 2.60 KB
|
package/.turbo/turbo-test.log
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> @aiready/consistency@0.4.1 test /Users/pengcao/projects/aiready/packages/consistency
|
|
4
|
-
> vitest run
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[1m[7m[36m RUN [39m[27m[22m [36mv2.1.9 [39m[90m/Users/pengcao/projects/aiready/packages/consistency[39m
|
|
8
|
-
|
|
9
|
-
[?25l [90m·[39m should detect minimum severity filtering
|
|
10
|
-
[90m·[39m analyzeNaming[2m (8)[22m
|
|
11
|
-
[90m·[39m should detect single letter variables
|
|
12
|
-
[90m·[39m should NOT flag acceptable abbreviations
|
|
13
|
-
[90m·[39m should NOT flag common short English words
|
|
14
|
-
[90m·[39m should detect snake_case in TypeScript files
|
|
15
|
-
[90m·[39m should detect unclear boolean names
|
|
16
|
-
[90m·[39m should allow common abbreviations
|
|
17
|
-
[90m·[39m should NOT flag multi-line arrow function parameters (Phase 3)
|
|
18
|
-
[90m·[39m should NOT flag short-lived comparison variables (Phase 3)
|
|
19
|
-
[90m·[39m analyzePatterns[2m (3)[22m
|
|
20
|
-
[90m·[39m should detect mixed error handling
|
|
21
|
-
[90m·[39m should detect mixed async patterns
|
|
22
|
-
[90m·[39m should detect mixed import styles
|
|
23
|
-
[90m·[39m consistency scoring[2m (2)[22m
|
|
24
|
-
[90m·[39m should calculate consistency score correctly
|
|
25
|
-
[90m·[39m should weight critical issues more than info
|
|
26
|
-
[90m·[39m recommendations[2m (3)[22m
|
|
27
|
-
[90m·[39m should generate relevant recommendations
|
|
28
|
-
[90m·[39m should suggest standardizing error handling
|
|
29
|
-
[90m·[39m should suggest using async/await consistently
|
|
30
|
-
[?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[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m should detect minimum severity filtering
|
|
31
|
-
[32m✓[39m analyzeNaming[2m (8)[22m
|
|
32
|
-
[32m✓[39m should detect single letter variables
|
|
33
|
-
[32m✓[39m should NOT flag acceptable abbreviations
|
|
34
|
-
[32m✓[39m should NOT flag common short English words
|
|
35
|
-
[32m✓[39m should detect snake_case in TypeScript files
|
|
36
|
-
[32m✓[39m should detect unclear boolean names
|
|
37
|
-
[32m✓[39m should allow common abbreviations
|
|
38
|
-
[32m✓[39m should NOT flag multi-line arrow function parameters (Phase 3)
|
|
39
|
-
[32m✓[39m should NOT flag short-lived comparison variables (Phase 3)
|
|
40
|
-
[32m✓[39m analyzePatterns[2m (3)[22m
|
|
41
|
-
[32m✓[39m should detect mixed error handling
|
|
42
|
-
[32m✓[39m should detect mixed async patterns
|
|
43
|
-
[32m✓[39m should detect mixed import styles
|
|
44
|
-
[32m✓[39m consistency scoring[2m (2)[22m
|
|
45
|
-
[32m✓[39m should calculate consistency score correctly
|
|
46
|
-
[32m✓[39m should weight critical issues more than info
|
|
47
|
-
[32m✓[39m recommendations[2m (3)[22m
|
|
48
|
-
[32m✓[39m should generate relevant recommendations
|
|
49
|
-
[32m✓[39m should suggest standardizing error handling
|
|
50
|
-
[32m✓[39m should suggest using async/await consistently
|
|
51
|
-
[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[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/__tests__/[22manalyzer[2m.test.ts[22m[2m (18)[22m
|
|
52
|
-
[32m✓[39m analyzeConsistency[2m (2)[22m
|
|
53
|
-
[32m✓[39m should analyze naming issues
|
|
54
|
-
[32m✓[39m should detect minimum severity filtering
|
|
55
|
-
[32m✓[39m analyzeNaming[2m (8)[22m
|
|
56
|
-
[32m✓[39m should detect single letter variables
|
|
57
|
-
[32m✓[39m should NOT flag acceptable abbreviations
|
|
58
|
-
[32m✓[39m should NOT flag common short English words
|
|
59
|
-
[32m✓[39m should detect snake_case in TypeScript files
|
|
60
|
-
[32m✓[39m should detect unclear boolean names
|
|
61
|
-
[32m✓[39m should allow common abbreviations
|
|
62
|
-
[32m✓[39m should NOT flag multi-line arrow function parameters (Phase 3)
|
|
63
|
-
[32m✓[39m should NOT flag short-lived comparison variables (Phase 3)
|
|
64
|
-
[32m✓[39m analyzePatterns[2m (3)[22m
|
|
65
|
-
[32m✓[39m should detect mixed error handling
|
|
66
|
-
[32m✓[39m should detect mixed async patterns
|
|
67
|
-
[32m✓[39m should detect mixed import styles
|
|
68
|
-
[32m✓[39m consistency scoring[2m (2)[22m
|
|
69
|
-
[32m✓[39m should calculate consistency score correctly
|
|
70
|
-
[32m✓[39m should weight critical issues more than info
|
|
71
|
-
[32m✓[39m recommendations[2m (3)[22m
|
|
72
|
-
[32m✓[39m should generate relevant recommendations
|
|
73
|
-
[32m✓[39m should suggest standardizing error handling
|
|
74
|
-
[32m✓[39m should suggest using async/await consistently
|
|
75
|
-
|
|
76
|
-
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
77
|
-
[2m Tests [22m [1m[32m18 passed[39m[22m[90m (18)[39m
|
|
78
|
-
[2m Start at [22m 18:50:34
|
|
79
|
-
[2m Duration [22m 494ms[2m (transform 51ms, setup 0ms, collect 206ms, tests 29ms, environment 0ms, prepare 47ms)[22m
|
|
80
|
-
|
|
81
|
-
[?25h[?25h
|