@aiready/consistency 0.21.13 → 0.21.15

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
@@ -794,7 +794,7 @@ async function analyzeNamingGeneralized(files) {
794
794
  "HEAD"
795
795
  ].includes(exp.name))
796
796
  continue;
797
- if (conventions.constantPattern.test(exp.name) || conventions.variablePattern.test(exp.name)) {
797
+ if (conventions.constantPattern.test(exp.name) || conventions.variablePattern.test(exp.name) || /^[A-Z][a-zA-Z0-9]*$/.test(exp.name)) {
798
798
  continue;
799
799
  }
800
800
  pattern = conventions.constantPattern;
@@ -907,6 +907,23 @@ async function analyzePatterns(filePaths) {
907
907
  var import_core5 = require("@aiready/core");
908
908
  function calculateConsistencyScore(issues, totalFilesAnalyzed, costConfig) {
909
909
  void costConfig;
910
+ if (!Array.isArray(issues)) {
911
+ return {
912
+ toolName: import_core5.ToolName.NamingConsistency,
913
+ score: 100,
914
+ rawMetrics: {
915
+ totalIssues: 0,
916
+ criticalIssues: 0,
917
+ majorIssues: 0,
918
+ minorIssues: 0,
919
+ issuesPerFile: 0,
920
+ avgWeightedIssuesPerFile: 0,
921
+ estimatedDeveloperHours: 0
922
+ },
923
+ factors: [],
924
+ recommendations: []
925
+ };
926
+ }
910
927
  const criticalIssues = issues.filter((i) => i.severity === "critical").length;
911
928
  const majorIssues = issues.filter((i) => i.severity === "major").length;
912
929
  const minorIssues = issues.filter((i) => i.severity === "minor").length;
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  analyzeConsistency
4
- } from "./chunk-7DKVZNY7.mjs";
4
+ } from "./chunk-R2WYI6DR.mjs";
5
5
 
6
6
  // src/cli.ts
7
7
  import { Command } from "commander";
package/dist/index.js CHANGED
@@ -813,7 +813,7 @@ async function analyzeNamingGeneralized(files) {
813
813
  "HEAD"
814
814
  ].includes(exp.name))
815
815
  continue;
816
- if (conventions.constantPattern.test(exp.name) || conventions.variablePattern.test(exp.name)) {
816
+ if (conventions.constantPattern.test(exp.name) || conventions.variablePattern.test(exp.name) || /^[A-Z][a-zA-Z0-9]*$/.test(exp.name)) {
817
817
  continue;
818
818
  }
819
819
  pattern = conventions.constantPattern;
@@ -926,6 +926,23 @@ async function analyzePatterns(filePaths) {
926
926
  var import_core5 = require("@aiready/core");
927
927
  function calculateConsistencyScore(issues, totalFilesAnalyzed, costConfig) {
928
928
  void costConfig;
929
+ if (!Array.isArray(issues)) {
930
+ return {
931
+ toolName: import_core5.ToolName.NamingConsistency,
932
+ score: 100,
933
+ rawMetrics: {
934
+ totalIssues: 0,
935
+ criticalIssues: 0,
936
+ majorIssues: 0,
937
+ minorIssues: 0,
938
+ issuesPerFile: 0,
939
+ avgWeightedIssuesPerFile: 0,
940
+ estimatedDeveloperHours: 0
941
+ },
942
+ factors: [],
943
+ recommendations: []
944
+ };
945
+ }
929
946
  const criticalIssues = issues.filter((i) => i.severity === "critical").length;
930
947
  const majorIssues = issues.filter((i) => i.severity === "major").length;
931
948
  const minorIssues = issues.filter((i) => i.severity === "minor").length;
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  analyzePatterns,
7
7
  calculateConsistencyScore,
8
8
  detectNamingConventions
9
- } from "./chunk-7DKVZNY7.mjs";
9
+ } from "./chunk-R2WYI6DR.mjs";
10
10
 
11
11
  // src/index.ts
12
12
  import { ToolRegistry } from "@aiready/core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/consistency",
3
- "version": "0.21.13",
3
+ "version": "0.21.15",
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",
@@ -35,15 +35,15 @@
35
35
  "license": "MIT",
36
36
  "repository": {
37
37
  "type": "git",
38
- "url": "https://github.com/caopengau/aiready-consistency.git"
38
+ "url": "https://github.com/getaiready/aiready-consistency.git"
39
39
  },
40
- "homepage": "https://github.com/caopengau/aiready-consistency",
40
+ "homepage": "https://github.com/getaiready/aiready-consistency",
41
41
  "dependencies": {
42
42
  "@typescript-eslint/types": "^8.53.0",
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.24.14"
46
+ "@aiready/core": "0.24.16"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^24.0.0",
@@ -247,6 +247,22 @@ describe('naming-generalized const naming', () => {
247
247
  }
248
248
  });
249
249
 
250
+ it('should allow PascalCase for exported constants (schemas/mocks)', () => {
251
+ // This test verifies that PascalCase constants like UserSchema or MockData are allowed.
252
+ const pascalCaseConstants = [
253
+ 'UserSchema',
254
+ 'MockData',
255
+ 'ConfigOptions',
256
+ 'AppRoutes',
257
+ 'FeatureToggle',
258
+ ];
259
+
260
+ const pascalCasePattern = /^[A-Z][a-zA-Z0-9]*$/;
261
+ for (const name of pascalCaseConstants) {
262
+ expect(pascalCasePattern.test(name)).toBe(true);
263
+ }
264
+ });
265
+
250
266
  it('should NOT flag SCREAMING_SNAKE_CASE constants as naming issues', async () => {
251
267
  // After the fix, SCREAMING_SNAKE_CASE constants should not generate naming issues
252
268
  const report = await analyzeConsistency({
@@ -112,12 +112,12 @@ export async function analyzeNamingGeneralized(
112
112
  )
113
113
  continue;
114
114
 
115
- // Allow both SCREAMING_SNAKE_CASE and camelCase for exported constants.
116
- // Module-level constants (config objects, paths, etc.) often use SCREAMING_SNAKE_CASE
117
- // which is a valid convention for constants, regardless of whether they are primitives.
115
+ // Allow SCREAMING_SNAKE_CASE, camelCase, or PascalCase for exported constants.
116
+ // PascalCase is common for Zod schemas (UserSchema), mocks (MockData), or configuration objects.
118
117
  if (
119
118
  conventions.constantPattern.test(exp.name) ||
120
- conventions.variablePattern.test(exp.name)
119
+ conventions.variablePattern.test(exp.name) ||
120
+ /^[A-Z][a-zA-Z0-9]*$/.test(exp.name)
121
121
  ) {
122
122
  continue;
123
123
  }
package/src/scoring.ts CHANGED
@@ -18,6 +18,26 @@ export function calculateConsistencyScore(
18
18
  ): ToolScoringOutput {
19
19
  // Parameter reserved for future configuration; reference to avoid lint warnings
20
20
  void costConfig;
21
+
22
+ // Defensive check for issues array to prevent crashes
23
+ if (!Array.isArray(issues)) {
24
+ return {
25
+ toolName: ToolName.NamingConsistency,
26
+ score: 100,
27
+ rawMetrics: {
28
+ totalIssues: 0,
29
+ criticalIssues: 0,
30
+ majorIssues: 0,
31
+ minorIssues: 0,
32
+ issuesPerFile: 0,
33
+ avgWeightedIssuesPerFile: 0,
34
+ estimatedDeveloperHours: 0,
35
+ },
36
+ factors: [],
37
+ recommendations: [],
38
+ };
39
+ }
40
+
21
41
  const criticalIssues = issues.filter((i) => i.severity === 'critical').length;
22
42
  const majorIssues = issues.filter((i) => i.severity === 'major').length;
23
43
  const minorIssues = issues.filter((i) => i.severity === 'minor').length;