@aiready/consistency 0.20.5 → 0.20.6

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.20.5 build /Users/pengcao/projects/aiready/packages/consistency
3
+ > @aiready/consistency@0.20.6 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,16 +9,16 @@
9
9
  CLI Target: es2020
10
10
  CJS Build start
11
11
  ESM Build start
12
- CJS dist/index.js 30.95 KB
13
- CJS dist/cli.js 33.06 KB
14
- CJS ⚡️ Build success in 51ms
15
12
  ESM dist/cli.mjs 8.83 KB
16
13
  ESM dist/index.mjs 7.04 KB
17
14
  ESM dist/chunk-S6BZVTWN.mjs 22.19 KB
18
- ESM ⚡️ Build success in 82ms
15
+ ESM ⚡️ Build success in 120ms
16
+ CJS dist/cli.js 33.06 KB
17
+ CJS dist/index.js 30.95 KB
18
+ CJS ⚡️ Build success in 120ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 6676ms
20
+ DTS ⚡️ Build success in 2903ms
21
21
  DTS dist/cli.d.ts 20.00 B
22
- DTS dist/index.d.ts 3.65 KB
22
+ DTS dist/index.d.ts 3.87 KB
23
23
  DTS dist/cli.d.mts 20.00 B
24
- DTS dist/index.d.mts 3.65 KB
24
+ DTS dist/index.d.mts 3.87 KB
@@ -1,27 +1,31 @@
1
1
 
2
2
  
3
- > @aiready/consistency@0.20.3 test /Users/pengcao/projects/aiready/packages/consistency
3
+ > @aiready/consistency@0.20.5 test /Users/pengcao/projects/aiready/packages/consistency
4
4
  > vitest run
5
5
 
6
6
  [?25l
7
7
   RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/consistency
8
8
 
9
- ✓ dist/__tests__/scoring.test.js (8 tests) 3ms
9
+ ✓ dist/__tests__/scoring.test.js (8 tests) 19ms
10
+ ✓ src/__tests__/provider.test.ts (2 tests) 3ms
11
+ ✓ src/__tests__/scoring.test.ts (8 tests) 33ms
12
+ ✓ src/__tests__/language-filter.test.ts (3 tests) 34ms
13
+ Sourcemap for "/Users/pengcao/projects/aiready/packages/consistency/dist/analyzers/naming-python.js" points to missing source files
10
14
  stderr | src/__tests__/contract.test.ts > Consistency Spoke Contract Validation > should produce output matching the SpokeOutput contract
11
15
  Consistency: Failed to analyze file1.ts: Error: ENOENT: no such file or directory, open 'file1.ts'
12
16
 
13
- ✓ src/__tests__/contract.test.ts (1 test) 6ms
14
- ✓ src/__tests__/language-filter.test.ts (3 tests) 7ms
15
- ✓ src/__tests__/provider.test.ts (2 tests) 7ms
16
- Sourcemap for "/Users/pengcao/projects/aiready/packages/consistency/dist/analyzers/naming-python.js" points to missing source files
17
- ✓ src/__tests__/scoring.test.ts (8 tests) 5ms
18
- ✓ dist/__tests__/language-filter.test.js (3 tests) 4ms
19
- ✓ dist/__tests__/analyzer.test.js (18 tests) 190ms
20
- ✓ src/__tests__/analyzer.test.ts (18 tests) 236ms
17
+ ✓ src/__tests__/contract.test.ts (1 test) 8ms
18
+ ✓ dist/__tests__/language-filter.test.js (3 tests) 8ms
19
+ ✓ src/__tests__/analyzer.test.ts (18 tests) 1247ms
20
+ ✓ should analyze naming issues  713ms
21
+ ✓ should generate relevant recommendations  409ms
22
+ ✓ dist/__tests__/analyzer.test.js (18 tests) 1196ms
23
+ ✓ should analyze naming issues  611ms
24
+ ✓ should detect minimum severity filtering  314ms
21
25
 
22
26
   Test Files  8 passed (8)
23
27
   Tests  61 passed (61)
24
-  Start at  10:36:28
25
-  Duration  1.30s (transform 1.29s, setup 0ms, import 4.87s, tests 458ms, environment 1ms)
28
+  Start at  10:12:34
29
+  Duration  6.71s (transform 7.21s, setup 0ms, import 27.92s, tests 2.55s, environment 1ms)
26
30
 
27
31
  [?25h
package/dist/index.d.mts CHANGED
@@ -61,8 +61,12 @@ interface ConsistencyReport {
61
61
  }
62
62
 
63
63
  /**
64
- * Main consistency analyzer that orchestrates all analysis types
65
- * Supports: TypeScript, JavaScript, Python, Java, C#, Go
64
+ * Main consistency analyzer that orchestrates all analysis types.
65
+ * Supports: TypeScript, JavaScript, Python, Java, C#, Go.
66
+ *
67
+ * @param options - Configuration for consistency analysis and file scanning.
68
+ * @returns Promise resolving to the comprehensive consistency report.
69
+ * @lastUpdated 2026-03-18
66
70
  */
67
71
  declare function analyzeConsistency(options: ConsistencyOptions): Promise<ConsistencyReport>;
68
72
 
@@ -96,15 +100,13 @@ declare function detectNamingConventions(files: string[], allIssues: Array<{
96
100
  declare function analyzePatterns(filePaths: string[]): Promise<PatternIssue[]>;
97
101
 
98
102
  /**
99
- * Calculate AI Readiness Score for code consistency (0-100)
100
- *
101
- * Based on:
102
- * - Issue density (issues per file)
103
- * - Weighted severity (critical: 10pts, major: 3pts, minor: 0.5pts)
104
- * - Pattern consistency across codebase
103
+ * Calculate AI Readiness Score for code consistency (0-100).
105
104
  *
106
- * Includes business value metrics:
107
- * - Estimated developer hours to fix consistency issues
105
+ * @param issues - Array of detected consistency issues.
106
+ * @param totalFilesAnalyzed - Total number of files scanned.
107
+ * @param costConfig - Optional configuration for productivity cost calculation.
108
+ * @returns Standardized scoring output for the consistency tool.
109
+ * @lastUpdated 2026-03-18
108
110
  */
109
111
  declare function calculateConsistencyScore(issues: ConsistencyIssue[], totalFilesAnalyzed: number, costConfig?: Partial<CostConfig>): ToolScoringOutput;
110
112
 
package/dist/index.d.ts CHANGED
@@ -61,8 +61,12 @@ interface ConsistencyReport {
61
61
  }
62
62
 
63
63
  /**
64
- * Main consistency analyzer that orchestrates all analysis types
65
- * Supports: TypeScript, JavaScript, Python, Java, C#, Go
64
+ * Main consistency analyzer that orchestrates all analysis types.
65
+ * Supports: TypeScript, JavaScript, Python, Java, C#, Go.
66
+ *
67
+ * @param options - Configuration for consistency analysis and file scanning.
68
+ * @returns Promise resolving to the comprehensive consistency report.
69
+ * @lastUpdated 2026-03-18
66
70
  */
67
71
  declare function analyzeConsistency(options: ConsistencyOptions): Promise<ConsistencyReport>;
68
72
 
@@ -96,15 +100,13 @@ declare function detectNamingConventions(files: string[], allIssues: Array<{
96
100
  declare function analyzePatterns(filePaths: string[]): Promise<PatternIssue[]>;
97
101
 
98
102
  /**
99
- * Calculate AI Readiness Score for code consistency (0-100)
100
- *
101
- * Based on:
102
- * - Issue density (issues per file)
103
- * - Weighted severity (critical: 10pts, major: 3pts, minor: 0.5pts)
104
- * - Pattern consistency across codebase
103
+ * Calculate AI Readiness Score for code consistency (0-100).
105
104
  *
106
- * Includes business value metrics:
107
- * - Estimated developer hours to fix consistency issues
105
+ * @param issues - Array of detected consistency issues.
106
+ * @param totalFilesAnalyzed - Total number of files scanned.
107
+ * @param costConfig - Optional configuration for productivity cost calculation.
108
+ * @returns Standardized scoring output for the consistency tool.
109
+ * @lastUpdated 2026-03-18
108
110
  */
109
111
  declare function calculateConsistencyScore(issues: ConsistencyIssue[], totalFilesAnalyzed: number, costConfig?: Partial<CostConfig>): ToolScoringOutput;
110
112
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/consistency",
3
- "version": "0.20.5",
3
+ "version": "0.20.6",
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": "^14.0.0",
46
- "@aiready/core": "0.23.6"
46
+ "@aiready/core": "0.23.7"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^24.0.0",
package/src/analyzer.ts CHANGED
@@ -15,8 +15,12 @@ import { analyzeNamingGeneralized } from './analyzers/naming-generalized';
15
15
  import { analyzePatterns } from './analyzers/patterns';
16
16
 
17
17
  /**
18
- * Main consistency analyzer that orchestrates all analysis types
19
- * Supports: TypeScript, JavaScript, Python, Java, C#, Go
18
+ * Main consistency analyzer that orchestrates all analysis types.
19
+ * Supports: TypeScript, JavaScript, Python, Java, C#, Go.
20
+ *
21
+ * @param options - Configuration for consistency analysis and file scanning.
22
+ * @returns Promise resolving to the comprehensive consistency report.
23
+ * @lastUpdated 2026-03-18
20
24
  */
21
25
  export async function analyzeConsistency(
22
26
  options: ConsistencyOptions
@@ -126,6 +130,13 @@ export async function analyzeConsistency(
126
130
  } as unknown as ConsistencyReport;
127
131
  }
128
132
 
133
+ /**
134
+ * Check if an issue severity meets the minimum threshold.
135
+ *
136
+ * @param severity - The severity of the issue.
137
+ * @param minSeverity - The minimum severity threshold.
138
+ * @returns True if severity is greater than or equal to minSeverity.
139
+ */
129
140
  function shouldIncludeSeverity(
130
141
  severity: Severity | string,
131
142
  minSeverity: Severity | string
@@ -134,7 +145,10 @@ function shouldIncludeSeverity(
134
145
  }
135
146
 
136
147
  /**
137
- * Map string type to IssueType enum value
148
+ * Map string type to IssueType enum value.
149
+ *
150
+ * @param type - The raw issue type string.
151
+ * @returns Normalized IssueType enum.
138
152
  */
139
153
  function getIssueType(type: string | undefined): IssueType {
140
154
  if (!type) return IssueType.NamingInconsistency;
@@ -155,7 +169,10 @@ function getIssueType(type: string | undefined): IssueType {
155
169
  }
156
170
 
157
171
  /**
158
- * Transform NamingIssue or PatternIssue to the required Issue format
172
+ * Transform NamingIssue or PatternIssue to the required Issue format.
173
+ *
174
+ * @param i - The raw issue object to transform.
175
+ * @returns Standardized Issue object.
159
176
  */
160
177
  function transformToIssue(i: any): Issue {
161
178
  // If already has message and location, return as is
package/src/scoring.ts CHANGED
@@ -3,15 +3,13 @@ import type { ToolScoringOutput, CostConfig } from '@aiready/core';
3
3
  import type { ConsistencyIssue } from './types';
4
4
 
5
5
  /**
6
- * Calculate AI Readiness Score for code consistency (0-100)
6
+ * Calculate AI Readiness Score for code consistency (0-100).
7
7
  *
8
- * Based on:
9
- * - Issue density (issues per file)
10
- * - Weighted severity (critical: 10pts, major: 3pts, minor: 0.5pts)
11
- * - Pattern consistency across codebase
12
- *
13
- * Includes business value metrics:
14
- * - Estimated developer hours to fix consistency issues
8
+ * @param issues - Array of detected consistency issues.
9
+ * @param totalFilesAnalyzed - Total number of files scanned.
10
+ * @param costConfig - Optional configuration for productivity cost calculation.
11
+ * @returns Standardized scoring output for the consistency tool.
12
+ * @lastUpdated 2026-03-18
15
13
  */
16
14
  export function calculateConsistencyScore(
17
15
  issues: ConsistencyIssue[],