@aiready/consistency 0.3.3 → 0.3.5

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.3.3 build /Users/pengcao/projects/aiready/packages/consistency
3
+ > @aiready/consistency@0.3.5 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 25.23 KB
13
- CJS dist/index.js 16.34 KB
14
- CJS ⚡️ Build success in 79ms
15
- ESM dist/chunk-LUAREV6A.mjs 15.11 KB
16
12
  ESM dist/cli.mjs 8.54 KB
17
13
  ESM dist/index.mjs 220.00 B
18
- ESM ⚡️ Build success in 79ms
14
+ ESM dist/chunk-2BTBNG6X.mjs 21.88 KB
15
+ ESM ⚡️ Build success in 70ms
16
+ CJS dist/cli.js 32.02 KB
17
+ CJS dist/index.js 23.13 KB
18
+ CJS ⚡️ Build success in 71ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 587ms
20
+ DTS ⚡️ Build success in 683ms
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
@@ -1,20 +1,21 @@
1
1
 
2
2
  
3
- > @aiready/consistency@0.3.3 test /Users/pengcao/projects/aiready/packages/consistency
3
+ > @aiready/consistency@0.3.5 test /Users/pengcao/projects/aiready/packages/consistency
4
4
  > vitest run
5
5
 
6
6
 
7
7
   RUN  v2.1.9 /Users/pengcao/projects/aiready/packages/consistency
8
8
 
9
- [?25l ❯ analyzeConsistency (2)
10
- ⠙ should analyze naming issues
11
- · should detect minimum severity filtering
12
- · analyzeNaming (5)
9
+ [?25l · should detect minimum severity filtering
10
+ · analyzeNaming (8)
13
11
  · should detect single letter variables
14
12
  · should NOT flag acceptable abbreviations
13
+ · should NOT flag common short English words
15
14
  · should detect snake_case in TypeScript files
16
15
  · should detect unclear boolean names
17
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)
18
19
  · analyzePatterns (3)
19
20
  · should detect mixed error handling
20
21
  · should detect mixed async patterns
@@ -26,15 +27,16 @@
26
27
  · should generate relevant recommendations
27
28
  · should suggest standardizing error handling
28
29
  · should suggest using async/await consistently
29
- [?25l ✓ analyzeConsistency (2)
30
- ✓ should analyze naming issues
31
- ✓ should detect minimum severity filtering
32
- ✓ analyzeNaming (5)
30
+ [?25l ✓ should detect minimum severity filtering
31
+ ✓ analyzeNaming (8)
33
32
  ✓ should detect single letter variables
34
33
  ✓ should NOT flag acceptable abbreviations
34
+ ✓ should NOT flag common short English words
35
35
  ✓ should detect snake_case in TypeScript files
36
36
  ✓ should detect unclear boolean names
37
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)
38
40
  ✓ analyzePatterns (3)
39
41
  ✓ should detect mixed error handling
40
42
  ✓ should detect mixed async patterns
@@ -46,16 +48,19 @@
46
48
  ✓ should generate relevant recommendations
47
49
  ✓ should suggest standardizing error handling
48
50
  ✓ should suggest using async/await consistently
49
-  ✓ src/__tests__/analyzer.test.ts (15)
51
+  ✓ src/__tests__/analyzer.test.ts (18)
50
52
  ✓ analyzeConsistency (2)
51
53
  ✓ should analyze naming issues
52
54
  ✓ should detect minimum severity filtering
53
- ✓ analyzeNaming (5)
55
+ ✓ analyzeNaming (8)
54
56
  ✓ should detect single letter variables
55
57
  ✓ should NOT flag acceptable abbreviations
58
+ ✓ should NOT flag common short English words
56
59
  ✓ should detect snake_case in TypeScript files
57
60
  ✓ should detect unclear boolean names
58
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)
59
64
  ✓ analyzePatterns (3)
60
65
  ✓ should detect mixed error handling
61
66
  ✓ should detect mixed async patterns
@@ -69,8 +74,8 @@
69
74
  ✓ should suggest using async/await consistently
70
75
 
71
76
   Test Files  1 passed (1)
72
-  Tests  15 passed (15)
73
-  Start at  15:32:25
74
-  Duration  519ms (transform 74ms, setup 0ms, collect 251ms, tests 24ms, environment 0ms, prepare 54ms)
77
+  Tests  18 passed (18)
78
+  Start at  18:28:56
79
+  Duration  729ms (transform 144ms, setup 0ms, collect 339ms, tests 28ms, environment 0ms, prepare 61ms)
75
80
 
76
81
  [?25h[?25h
package/README.md CHANGED
@@ -32,11 +32,15 @@ Inconsistent code patterns confuse AI models and reduce their effectiveness. Thi
32
32
  - **Function naming** - Checks for action verbs while allowing factory patterns and descriptive names
33
33
 
34
34
  **Smart Detection:** The tool understands context and won't flag:
35
- - Common abbreviations (env, api, url, max, min, now, etc.)
35
+ - Common abbreviations (env, api, url, max, min, now, etc.) - 100+ built-in
36
36
  - Boolean prefixes (is, has, can used as variables)
37
- - Loop iterators in appropriate contexts
37
+ - Loop iterators (i, j, k) in appropriate contexts
38
+ - Arrow function parameters in callbacks (`.map(s => ...)`)
39
+ - Multi-line arrow functions (detects across 3-5 line context)
40
+ - Short-lived comparison variables (used within 5 lines)
38
41
  - Factory/builder patterns
39
42
  - Long descriptive function names
43
+ - Project-specific abbreviations via configuration
40
44
 
41
45
  ### 🔄 Pattern Consistency
42
46
  - **Error handling strategies** - Detects mixed approaches (try-catch vs returns vs throws)
@@ -127,7 +131,7 @@ aiready-consistency ./src --output markdown --output-file custom-report.md
127
131
 
128
132
  ## 📝 Configuration File
129
133
 
130
- Create `aiready.json` in your project root:
134
+ Create `.airreadyrc.json`, `aiready.json`, or `aiready.config.json` in your project root:
131
135
 
132
136
  ```json
133
137
  {
@@ -139,7 +143,10 @@ Create `aiready.json` in your project root:
139
143
  "consistency": {
140
144
  "checkNaming": true,
141
145
  "checkPatterns": true,
142
- "minSeverity": "minor"
146
+ "minSeverity": "minor",
147
+ "acceptedAbbreviations": ["ses", "gst", "cdk"],
148
+ "shortWords": ["oak", "elm"],
149
+ "disableChecks": []
143
150
  }
144
151
  },
145
152
  "output": {
@@ -155,17 +162,58 @@ Create `aiready.json` in your project root:
155
162
  | `checkNaming` | boolean | `true` | Check naming conventions |
156
163
  | `checkPatterns` | boolean | `true` | Check code pattern consistency |
157
164
  | `minSeverity` | string | `'info'` | Filter: `'info'`, `'minor'`, `'major'`, `'critical'` |
165
+ | `acceptedAbbreviations` | string[] | `[]` | Custom abbreviations to accept (e.g., domain-specific terms) |
166
+ | `shortWords` | string[] | `[]` | Additional full English words to accept |
167
+ | `disableChecks` | string[] | `[]` | Disable specific checks: `'single-letter'`, `'abbreviation'`, `'convention-mix'`, `'unclear'`, `'poor-naming'` |
168
+
169
+ ### Project-Specific Configuration Examples
170
+
171
+ **React/Next.js Projects:**
172
+ ```json
173
+ {
174
+ "tools": {
175
+ "consistency": {
176
+ "acceptedAbbreviations": ["jsx", "tsx", "ref", "ctx", "req", "res"]
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ **AWS/Cloud Projects:**
183
+ ```json
184
+ {
185
+ "tools": {
186
+ "consistency": {
187
+ "acceptedAbbreviations": ["ses", "sns", "sqs", "ec2", "vpc", "iam"]
188
+ }
189
+ }
190
+ }
191
+ ```
192
+
193
+ **E-commerce Projects:**
194
+ ```json
195
+ {
196
+ "tools": {
197
+ "consistency": {
198
+ "acceptedAbbreviations": ["gst", "vat", "sku", "upc"],
199
+ "shortWords": ["tax", "buy", "pay", "cart"]
200
+ }
201
+ }
202
+ }
203
+ ```
158
204
 
159
205
  ### Acceptable Abbreviations
160
206
 
161
- The tool recognizes 60+ standard abbreviations and won't flag them:
207
+ The tool recognizes 100+ standard abbreviations and won't flag them:
162
208
 
163
- **Web/Network:** url, uri, api, cdn, dns, ip, http, utm, seo, xhr
209
+ **Web/Network:** url, uri, api, cdn, dns, ip, http, utm, seo, xhr, cors, ws, wss
164
210
  **Data:** json, xml, yaml, csv, html, css, svg, pdf, dto, dao
165
211
  **System:** env, os, fs, cli, tmp, src, dst, bin, lib, pkg
166
212
  **Request/Response:** req, res, ctx, err, msg
167
213
  **Math:** max, min, avg, sum, abs, cos, sin, log, sqrt
168
- **Time:** now, utc, ms, sec
214
+ **Time:** now, utc, ms, sec, hr, yr, mo
215
+ **Loop Counters:** i, j, k, n, m
216
+ **Cloud/Infrastructure:** s3, ec2, sqs, sns, vpc, ami, iam, aws
169
217
  **Common:** id, uid, db, sql, orm, ui, ux, dom, ref, val, str, obj, arr, cfg, init
170
218
 
171
219
  See [naming.ts](src/analyzers/naming.ts) for the complete list.