@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/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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  analyzeConsistency
4
- } from "./chunk-CZUJTDNH.mjs";
4
+ } from "./chunk-TXHPUU7A.mjs";
5
5
 
6
6
  // src/cli.ts
7
7
  import { Command } from "commander";
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
@@ -3,7 +3,7 @@ import {
3
3
  analyzeNaming,
4
4
  analyzePatterns,
5
5
  detectNamingConventions
6
- } from "./chunk-CZUJTDNH.mjs";
6
+ } from "./chunk-TXHPUU7A.mjs";
7
7
  export {
8
8
  analyzeConsistency,
9
9
  analyzeNaming,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/consistency",
3
- "version": "0.4.1",
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
+ }
@@ -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') ||
@@ -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
- CLI Building entry: src/cli.ts, src/index.ts
7
- CLI Using tsconfig: tsconfig.json
8
- CLI tsup v8.5.1
9
- CLI Target: es2020
10
- CJS Build start
11
- ESM Build start
12
- CJS dist/cli.js 32.93 KB
13
- CJS dist/index.js 24.04 KB
14
- CJS ⚡️ Build success in 15ms
15
- ESM dist/chunk-CZUJTDNH.mjs 22.79 KB
16
- ESM dist/index.mjs 220.00 B
17
- ESM dist/cli.mjs 8.54 KB
18
- ESM ⚡️ 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
@@ -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
-  RUN  v2.1.9 /Users/pengcao/projects/aiready/packages/consistency
8
-
9
- [?25l · should detect minimum severity filtering
10
- · analyzeNaming (8)
11
- · should detect single letter variables
12
- · should NOT flag acceptable abbreviations
13
- · should NOT flag common short English words
14
- · should detect snake_case in TypeScript files
15
- · should detect unclear boolean names
16
- · should allow common abbreviations
17
- · should NOT flag multi-line arrow function parameters (Phase 3)
18
- · should NOT flag short-lived comparison variables (Phase 3)
19
- · analyzePatterns (3)
20
- · should detect mixed error handling
21
- · should detect mixed async patterns
22
- · should detect mixed import styles
23
- · consistency scoring (2)
24
- · should calculate consistency score correctly
25
- · should weight critical issues more than info
26
- · recommendations (3)
27
- · should generate relevant recommendations
28
- · should suggest standardizing error handling
29
- · should suggest using async/await consistently
30
- [?25l ✓ should detect minimum severity filtering
31
- ✓ analyzeNaming (8)
32
- ✓ should detect single letter variables
33
- ✓ should NOT flag acceptable abbreviations
34
- ✓ should NOT flag common short English words
35
- ✓ should detect snake_case in TypeScript files
36
- ✓ should detect unclear boolean names
37
- ✓ should allow common abbreviations
38
- ✓ should NOT flag multi-line arrow function parameters (Phase 3)
39
- ✓ should NOT flag short-lived comparison variables (Phase 3)
40
- ✓ analyzePatterns (3)
41
- ✓ should detect mixed error handling
42
- ✓ should detect mixed async patterns
43
- ✓ should detect mixed import styles
44
- ✓ consistency scoring (2)
45
- ✓ should calculate consistency score correctly
46
- ✓ should weight critical issues more than info
47
- ✓ recommendations (3)
48
- ✓ should generate relevant recommendations
49
- ✓ should suggest standardizing error handling
50
- ✓ should suggest using async/await consistently
51
-  ✓ src/__tests__/analyzer.test.ts (18)
52
- ✓ analyzeConsistency (2)
53
- ✓ should analyze naming issues
54
- ✓ should detect minimum severity filtering
55
- ✓ analyzeNaming (8)
56
- ✓ should detect single letter variables
57
- ✓ should NOT flag acceptable abbreviations
58
- ✓ should NOT flag common short English words
59
- ✓ should detect snake_case in TypeScript files
60
- ✓ should detect unclear boolean names
61
- ✓ should allow common abbreviations
62
- ✓ should NOT flag multi-line arrow function parameters (Phase 3)
63
- ✓ should NOT flag short-lived comparison variables (Phase 3)
64
- ✓ analyzePatterns (3)
65
- ✓ should detect mixed error handling
66
- ✓ should detect mixed async patterns
67
- ✓ should detect mixed import styles
68
- ✓ consistency scoring (2)
69
- ✓ should calculate consistency score correctly
70
- ✓ should weight critical issues more than info
71
- ✓ recommendations (3)
72
- ✓ should generate relevant recommendations
73
- ✓ should suggest standardizing error handling
74
- ✓ should suggest using async/await consistently
75
-
76
-  Test Files  1 passed (1)
77
-  Tests  18 passed (18)
78
-  Start at  18:50:34
79
-  Duration  494ms (transform 51ms, setup 0ms, collect 206ms, tests 29ms, environment 0ms, prepare 47ms)
80
-
81
- [?25h[?25h