@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.
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-test.log +16 -12
- package/dist/index.d.mts +12 -10
- package/dist/index.d.ts +12 -10
- package/package.json +2 -2
- package/src/analyzer.ts +21 -4
- package/src/scoring.ts +6 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/consistency@0.20.
|
|
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
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mCJS[39m [1mdist/index.js [22m[32m30.95 KB[39m
|
|
13
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m33.06 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in 51ms
|
|
15
12
|
[32mESM[39m [1mdist/cli.mjs [22m[32m8.83 KB[39m
|
|
16
13
|
[32mESM[39m [1mdist/index.mjs [22m[32m7.04 KB[39m
|
|
17
14
|
[32mESM[39m [1mdist/chunk-S6BZVTWN.mjs [22m[32m22.19 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 120ms
|
|
16
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m33.06 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js [22m[32m30.95 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 120ms
|
|
19
19
|
DTS Build start
|
|
20
|
-
DTS ⚡️ Build success in
|
|
20
|
+
DTS ⚡️ Build success in 2903ms
|
|
21
21
|
DTS dist/cli.d.ts 20.00 B
|
|
22
|
-
DTS dist/index.d.ts 3.
|
|
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.
|
|
24
|
+
DTS dist/index.d.mts 3.87 KB
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/consistency@0.20.
|
|
3
|
+
> @aiready/consistency@0.20.5 test /Users/pengcao/projects/aiready/packages/consistency
|
|
4
4
|
> vitest run
|
|
5
5
|
|
|
6
6
|
[?25l
|
|
7
7
|
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/consistency[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m dist/__tests__/scoring.test.js [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
9
|
+
[32m✓[39m dist/__tests__/scoring.test.js [2m([22m[2m8 tests[22m[2m)[22m[32m 19[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
11
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 33[2mms[22m[39m
|
|
12
|
+
[32m✓[39m src/__tests__/language-filter.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 34[2mms[22m[39m
|
|
13
|
+
Sourcemap for "/Users/pengcao/projects/aiready/packages/consistency/dist/analyzers/naming-python.js" points to missing source files
|
|
10
14
|
[90mstderr[2m | src/__tests__/contract.test.ts[2m > [22m[2mConsistency Spoke Contract Validation[2m > [22m[2mshould produce output matching the SpokeOutput contract
|
|
11
15
|
[22m[39mConsistency: Failed to analyze file1.ts: Error: ENOENT: no such file or directory, open 'file1.ts'
|
|
12
16
|
|
|
13
|
-
[32m✓[39m src/__tests__/contract.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
14
|
-
[32m✓[39m
|
|
15
|
-
[32m✓[39m src/__tests__/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
[32m✓[39m dist/__tests__/
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
[32m✓[39m src/__tests__/contract.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
18
|
+
[32m✓[39m dist/__tests__/language-filter.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
19
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m18 tests[22m[2m)[22m[33m 1247[2mms[22m[39m
|
|
20
|
+
[33m[2m✓[22m[39m should analyze naming issues [33m 713[2mms[22m[39m
|
|
21
|
+
[33m[2m✓[22m[39m should generate relevant recommendations [33m 409[2mms[22m[39m
|
|
22
|
+
[32m✓[39m dist/__tests__/analyzer.test.js [2m([22m[2m18 tests[22m[2m)[22m[33m 1196[2mms[22m[39m
|
|
23
|
+
[33m[2m✓[22m[39m should analyze naming issues [33m 611[2mms[22m[39m
|
|
24
|
+
[33m[2m✓[22m[39m should detect minimum severity filtering [33m 314[2mms[22m[39m
|
|
21
25
|
|
|
22
26
|
[2m Test Files [22m [1m[32m8 passed[39m[22m[90m (8)[39m
|
|
23
27
|
[2m Tests [22m [1m[32m61 passed[39m[22m[90m (61)[39m
|
|
24
|
-
[2m Start at [22m 10:
|
|
25
|
-
[2m Duration [22m
|
|
28
|
+
[2m Start at [22m 10:12:34
|
|
29
|
+
[2m Duration [22m 6.71s[2m (transform 7.21s, setup 0ms, import 27.92s, tests 2.55s, environment 1ms)[22m
|
|
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
|
-
*
|
|
107
|
-
*
|
|
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
|
-
*
|
|
107
|
-
*
|
|
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.
|
|
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.
|
|
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
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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[],
|