@aiready/consistency 0.20.1 → 0.20.2
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 +10 -10
- package/.turbo/turbo-test.log +11 -140
- package/dist/chunk-5UFRGXSB.mjs +783 -0
- package/dist/chunk-UMBBTNQN.mjs +787 -0
- package/dist/cli.js +5 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +18 -16
- package/dist/index.mjs +16 -18
- package/package.json +2 -2
- package/src/__tests__/provider.test.ts +1 -1
- package/src/analyzers/naming-generalized.ts +5 -1
- package/src/provider.ts +15 -24
package/dist/cli.js
CHANGED
|
@@ -475,9 +475,13 @@ async function analyzeNamingGeneralized(files) {
|
|
|
475
475
|
const conventions = parser.getNamingConventions();
|
|
476
476
|
for (const exp of result.exports) {
|
|
477
477
|
let pattern;
|
|
478
|
-
|
|
478
|
+
const typeName = exp.type;
|
|
479
479
|
if (exp.type === "class") {
|
|
480
480
|
pattern = conventions.classPattern;
|
|
481
|
+
} else if (exp.type === "interface" && conventions.interfacePattern) {
|
|
482
|
+
pattern = conventions.interfacePattern;
|
|
483
|
+
} else if (exp.type === "type" && conventions.typePattern) {
|
|
484
|
+
pattern = conventions.typePattern;
|
|
481
485
|
} else if (exp.type === "function") {
|
|
482
486
|
pattern = conventions.functionPattern;
|
|
483
487
|
} else if (exp.type === "const") {
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _aiready_core from '@aiready/core';
|
|
2
|
+
import { Severity, Issue, IssueType, ScanOptions, AnalysisResult, CostConfig, ToolScoringOutput } from '@aiready/core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Consistency Tool Provider
|
|
5
6
|
*/
|
|
6
|
-
declare const ConsistencyProvider: ToolProvider;
|
|
7
|
+
declare const ConsistencyProvider: _aiready_core.ToolProvider;
|
|
7
8
|
|
|
8
9
|
interface ConsistencyOptions extends ScanOptions {
|
|
9
10
|
/** Check naming conventions and quality */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _aiready_core from '@aiready/core';
|
|
2
|
+
import { Severity, Issue, IssueType, ScanOptions, AnalysisResult, CostConfig, ToolScoringOutput } from '@aiready/core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Consistency Tool Provider
|
|
5
6
|
*/
|
|
6
|
-
declare const ConsistencyProvider: ToolProvider;
|
|
7
|
+
declare const ConsistencyProvider: _aiready_core.ToolProvider;
|
|
7
8
|
|
|
8
9
|
interface ConsistencyOptions extends ScanOptions {
|
|
9
10
|
/** Check naming conventions and quality */
|
package/dist/index.js
CHANGED
|
@@ -483,9 +483,13 @@ async function analyzeNamingGeneralized(files) {
|
|
|
483
483
|
const conventions = parser.getNamingConventions();
|
|
484
484
|
for (const exp of result.exports) {
|
|
485
485
|
let pattern;
|
|
486
|
-
|
|
486
|
+
const typeName = exp.type;
|
|
487
487
|
if (exp.type === "class") {
|
|
488
488
|
pattern = conventions.classPattern;
|
|
489
|
+
} else if (exp.type === "interface" && conventions.interfacePattern) {
|
|
490
|
+
pattern = conventions.interfacePattern;
|
|
491
|
+
} else if (exp.type === "type" && conventions.typePattern) {
|
|
492
|
+
pattern = conventions.typePattern;
|
|
489
493
|
} else if (exp.type === "function") {
|
|
490
494
|
pattern = conventions.functionPattern;
|
|
491
495
|
} else if (exp.type === "const") {
|
|
@@ -904,20 +908,19 @@ function calculateConsistencyScore2(issues, totalFilesAnalyzed, costConfig) {
|
|
|
904
908
|
}
|
|
905
909
|
|
|
906
910
|
// src/provider.ts
|
|
907
|
-
var ConsistencyProvider = {
|
|
911
|
+
var ConsistencyProvider = (0, import_core7.createProvider)({
|
|
908
912
|
id: import_core7.ToolName.NamingConsistency,
|
|
909
913
|
alias: ["consistency", "naming", "standards"],
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
});
|
|
914
|
+
version: "0.16.5",
|
|
915
|
+
defaultWeight: 14,
|
|
916
|
+
async analyzeReport(options) {
|
|
917
|
+
return analyzeConsistency(options);
|
|
918
|
+
},
|
|
919
|
+
getResults(report) {
|
|
920
|
+
return report.results;
|
|
921
|
+
},
|
|
922
|
+
getSummary(report) {
|
|
923
|
+
return report.summary;
|
|
921
924
|
},
|
|
922
925
|
score(output, options) {
|
|
923
926
|
const results = output.results;
|
|
@@ -928,9 +931,8 @@ var ConsistencyProvider = {
|
|
|
928
931
|
totalFiles,
|
|
929
932
|
options.costConfig
|
|
930
933
|
);
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
};
|
|
934
|
+
}
|
|
935
|
+
});
|
|
934
936
|
|
|
935
937
|
// src/analyzers/naming.ts
|
|
936
938
|
var import_fs4 = require("fs");
|
package/dist/index.mjs
CHANGED
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
analyzeConsistency,
|
|
3
3
|
analyzeNamingAST,
|
|
4
4
|
analyzePatterns
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UMBBTNQN.mjs";
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
import { ToolRegistry } from "@aiready/core";
|
|
9
9
|
|
|
10
10
|
// src/provider.ts
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
createProvider,
|
|
13
|
+
ToolName as ToolName2
|
|
14
14
|
} from "@aiready/core";
|
|
15
15
|
|
|
16
16
|
// src/scoring.ts
|
|
@@ -110,20 +110,19 @@ function calculateConsistencyScore(issues, totalFilesAnalyzed, costConfig) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// src/provider.ts
|
|
113
|
-
var ConsistencyProvider = {
|
|
113
|
+
var ConsistencyProvider = createProvider({
|
|
114
114
|
id: ToolName2.NamingConsistency,
|
|
115
115
|
alias: ["consistency", "naming", "standards"],
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
});
|
|
116
|
+
version: "0.16.5",
|
|
117
|
+
defaultWeight: 14,
|
|
118
|
+
async analyzeReport(options) {
|
|
119
|
+
return analyzeConsistency(options);
|
|
120
|
+
},
|
|
121
|
+
getResults(report) {
|
|
122
|
+
return report.results;
|
|
123
|
+
},
|
|
124
|
+
getSummary(report) {
|
|
125
|
+
return report.summary;
|
|
127
126
|
},
|
|
128
127
|
score(output, options) {
|
|
129
128
|
const results = output.results;
|
|
@@ -134,9 +133,8 @@ var ConsistencyProvider = {
|
|
|
134
133
|
totalFiles,
|
|
135
134
|
options.costConfig
|
|
136
135
|
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
140
138
|
|
|
141
139
|
// src/analyzers/naming.ts
|
|
142
140
|
import { readFileSync } from "fs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/consistency",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
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.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^24.0.0",
|
|
@@ -23,7 +23,7 @@ describe('Consistency Provider', () => {
|
|
|
23
23
|
const output = await ConsistencyProvider.analyze({ rootDir: '.' });
|
|
24
24
|
|
|
25
25
|
expect(output.summary.filesAnalyzed).toBe(1);
|
|
26
|
-
expect(output.metadata
|
|
26
|
+
expect(output.metadata!.toolName).toBe('naming-consistency');
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
it('should score an output', () => {
|
|
@@ -31,10 +31,14 @@ export async function analyzeNamingGeneralized(
|
|
|
31
31
|
// 1. Check Exports
|
|
32
32
|
for (const exp of result.exports) {
|
|
33
33
|
let pattern: RegExp | undefined;
|
|
34
|
-
|
|
34
|
+
const typeName = exp.type;
|
|
35
35
|
|
|
36
36
|
if (exp.type === 'class') {
|
|
37
37
|
pattern = conventions.classPattern;
|
|
38
|
+
} else if (exp.type === 'interface' && conventions.interfacePattern) {
|
|
39
|
+
pattern = conventions.interfacePattern;
|
|
40
|
+
} else if (exp.type === 'type' && conventions.typePattern) {
|
|
41
|
+
pattern = conventions.typePattern;
|
|
38
42
|
} else if (exp.type === 'function') {
|
|
39
43
|
pattern = conventions.functionPattern;
|
|
40
44
|
} else if (exp.type === 'const') {
|
package/src/provider.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AnalysisResult,
|
|
3
|
+
createProvider,
|
|
3
4
|
ToolName,
|
|
4
|
-
SpokeOutput,
|
|
5
5
|
ScanOptions,
|
|
6
|
-
ToolScoringOutput,
|
|
7
|
-
AnalysisResult,
|
|
8
|
-
SpokeOutputSchema,
|
|
9
6
|
} from '@aiready/core';
|
|
10
7
|
import { analyzeConsistency } from './analyzer';
|
|
11
8
|
import { calculateConsistencyScore } from './scoring';
|
|
@@ -14,25 +11,21 @@ import { ConsistencyOptions, ConsistencyIssue } from './types';
|
|
|
14
11
|
/**
|
|
15
12
|
* Consistency Tool Provider
|
|
16
13
|
*/
|
|
17
|
-
export const ConsistencyProvider
|
|
14
|
+
export const ConsistencyProvider = createProvider({
|
|
18
15
|
id: ToolName.NamingConsistency,
|
|
19
16
|
alias: ['consistency', 'naming', 'standards'],
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return SpokeOutputSchema.parse({
|
|
25
|
-
results: report.results as AnalysisResult[],
|
|
26
|
-
summary: report.summary,
|
|
27
|
-
metadata: {
|
|
28
|
-
toolName: ToolName.NamingConsistency,
|
|
29
|
-
version: '0.16.5',
|
|
30
|
-
timestamp: new Date().toISOString(),
|
|
31
|
-
},
|
|
32
|
-
});
|
|
17
|
+
version: '0.16.5',
|
|
18
|
+
defaultWeight: 14,
|
|
19
|
+
async analyzeReport(options: ScanOptions) {
|
|
20
|
+
return analyzeConsistency(options as ConsistencyOptions);
|
|
33
21
|
},
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
getResults(report) {
|
|
23
|
+
return report.results as AnalysisResult[];
|
|
24
|
+
},
|
|
25
|
+
getSummary(report) {
|
|
26
|
+
return report.summary;
|
|
27
|
+
},
|
|
28
|
+
score(output, options) {
|
|
36
29
|
const results = output.results as AnalysisResult[];
|
|
37
30
|
const allIssues = results.flatMap((r) => r.issues as ConsistencyIssue[]);
|
|
38
31
|
const totalFiles = (output.summary as any).filesAnalyzed || results.length;
|
|
@@ -43,6 +36,4 @@ export const ConsistencyProvider: ToolProvider = {
|
|
|
43
36
|
(options as any).costConfig
|
|
44
37
|
);
|
|
45
38
|
},
|
|
46
|
-
|
|
47
|
-
defaultWeight: 14,
|
|
48
|
-
};
|
|
39
|
+
});
|