@rigour-labs/core 4.3.6 → 5.0.0

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.
@@ -43,12 +43,24 @@ export declare const GatesSchema: z.ZodObject<{
43
43
  dependencies: z.ZodDefault<z.ZodOptional<z.ZodObject<{
44
44
  forbid: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
45
45
  trusted_registry: z.ZodOptional<z.ZodString>;
46
+ detect_unused: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
47
+ detect_heavy_alternatives: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
48
+ detect_duplicate_purpose: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
49
+ unused_allowlist: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
46
50
  }, "strip", z.ZodTypeAny, {
47
51
  forbid: string[];
52
+ detect_unused: boolean;
53
+ detect_heavy_alternatives: boolean;
54
+ detect_duplicate_purpose: boolean;
55
+ unused_allowlist: string[];
48
56
  trusted_registry?: string | undefined;
49
57
  }, {
50
58
  forbid?: string[] | undefined;
51
59
  trusted_registry?: string | undefined;
60
+ detect_unused?: boolean | undefined;
61
+ detect_heavy_alternatives?: boolean | undefined;
62
+ detect_duplicate_purpose?: boolean | undefined;
63
+ unused_allowlist?: string[] | undefined;
52
64
  }>>>;
53
65
  architecture: z.ZodDefault<z.ZodOptional<z.ZodObject<{
54
66
  boundaries: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -517,6 +529,41 @@ export declare const GatesSchema: z.ZodObject<{
517
529
  check_circular_triggers?: boolean | undefined;
518
530
  check_auto_restart?: boolean | undefined;
519
531
  }>>>;
532
+ style_drift: z.ZodDefault<z.ZodOptional<z.ZodObject<{
533
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
534
+ deviation_threshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
535
+ sample_size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
536
+ baseline_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
537
+ }, "strip", z.ZodTypeAny, {
538
+ enabled: boolean;
539
+ deviation_threshold: number;
540
+ sample_size: number;
541
+ baseline_path: string;
542
+ }, {
543
+ enabled?: boolean | undefined;
544
+ deviation_threshold?: number | undefined;
545
+ sample_size?: number | undefined;
546
+ baseline_path?: string | undefined;
547
+ }>>>;
548
+ logic_drift: z.ZodDefault<z.ZodOptional<z.ZodObject<{
549
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
550
+ baseline_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
551
+ track_operators: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
552
+ track_branches: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
553
+ track_returns: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
554
+ }, "strip", z.ZodTypeAny, {
555
+ enabled: boolean;
556
+ baseline_path: string;
557
+ track_operators: boolean;
558
+ track_branches: boolean;
559
+ track_returns: boolean;
560
+ }, {
561
+ enabled?: boolean | undefined;
562
+ baseline_path?: string | undefined;
563
+ track_operators?: boolean | undefined;
564
+ track_branches?: boolean | undefined;
565
+ track_returns?: boolean | undefined;
566
+ }>>>;
520
567
  deep: z.ZodDefault<z.ZodOptional<z.ZodObject<{
521
568
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
522
569
  pro: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -646,6 +693,10 @@ export declare const GatesSchema: z.ZodObject<{
646
693
  };
647
694
  dependencies: {
648
695
  forbid: string[];
696
+ detect_unused: boolean;
697
+ detect_heavy_alternatives: boolean;
698
+ detect_duplicate_purpose: boolean;
699
+ unused_allowlist: string[];
649
700
  trusted_registry?: string | undefined;
650
701
  };
651
702
  architecture: {
@@ -813,6 +864,19 @@ export declare const GatesSchema: z.ZodObject<{
813
864
  check_circular_triggers: boolean;
814
865
  check_auto_restart: boolean;
815
866
  };
867
+ style_drift: {
868
+ enabled: boolean;
869
+ deviation_threshold: number;
870
+ sample_size: number;
871
+ baseline_path: string;
872
+ };
873
+ logic_drift: {
874
+ enabled: boolean;
875
+ baseline_path: string;
876
+ track_operators: boolean;
877
+ track_branches: boolean;
878
+ track_returns: boolean;
879
+ };
816
880
  }, {
817
881
  deep?: {
818
882
  enabled?: boolean | undefined;
@@ -858,6 +922,10 @@ export declare const GatesSchema: z.ZodObject<{
858
922
  dependencies?: {
859
923
  forbid?: string[] | undefined;
860
924
  trusted_registry?: string | undefined;
925
+ detect_unused?: boolean | undefined;
926
+ detect_heavy_alternatives?: boolean | undefined;
927
+ detect_duplicate_purpose?: boolean | undefined;
928
+ unused_allowlist?: string[] | undefined;
861
929
  } | undefined;
862
930
  architecture?: {
863
931
  boundaries?: {
@@ -1024,6 +1092,19 @@ export declare const GatesSchema: z.ZodObject<{
1024
1092
  check_circular_triggers?: boolean | undefined;
1025
1093
  check_auto_restart?: boolean | undefined;
1026
1094
  } | undefined;
1095
+ style_drift?: {
1096
+ enabled?: boolean | undefined;
1097
+ deviation_threshold?: number | undefined;
1098
+ sample_size?: number | undefined;
1099
+ baseline_path?: string | undefined;
1100
+ } | undefined;
1101
+ logic_drift?: {
1102
+ enabled?: boolean | undefined;
1103
+ baseline_path?: string | undefined;
1104
+ track_operators?: boolean | undefined;
1105
+ track_branches?: boolean | undefined;
1106
+ track_returns?: boolean | undefined;
1107
+ } | undefined;
1027
1108
  }>;
1028
1109
  export declare const CommandsSchema: z.ZodObject<{
1029
1110
  format: z.ZodOptional<z.ZodString>;
@@ -1128,12 +1209,24 @@ export declare const ConfigSchema: z.ZodObject<{
1128
1209
  dependencies: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1129
1210
  forbid: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1130
1211
  trusted_registry: z.ZodOptional<z.ZodString>;
1212
+ detect_unused: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1213
+ detect_heavy_alternatives: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1214
+ detect_duplicate_purpose: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1215
+ unused_allowlist: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1131
1216
  }, "strip", z.ZodTypeAny, {
1132
1217
  forbid: string[];
1218
+ detect_unused: boolean;
1219
+ detect_heavy_alternatives: boolean;
1220
+ detect_duplicate_purpose: boolean;
1221
+ unused_allowlist: string[];
1133
1222
  trusted_registry?: string | undefined;
1134
1223
  }, {
1135
1224
  forbid?: string[] | undefined;
1136
1225
  trusted_registry?: string | undefined;
1226
+ detect_unused?: boolean | undefined;
1227
+ detect_heavy_alternatives?: boolean | undefined;
1228
+ detect_duplicate_purpose?: boolean | undefined;
1229
+ unused_allowlist?: string[] | undefined;
1137
1230
  }>>>;
1138
1231
  architecture: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1139
1232
  boundaries: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1602,6 +1695,41 @@ export declare const ConfigSchema: z.ZodObject<{
1602
1695
  check_circular_triggers?: boolean | undefined;
1603
1696
  check_auto_restart?: boolean | undefined;
1604
1697
  }>>>;
1698
+ style_drift: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1699
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1700
+ deviation_threshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1701
+ sample_size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1702
+ baseline_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1703
+ }, "strip", z.ZodTypeAny, {
1704
+ enabled: boolean;
1705
+ deviation_threshold: number;
1706
+ sample_size: number;
1707
+ baseline_path: string;
1708
+ }, {
1709
+ enabled?: boolean | undefined;
1710
+ deviation_threshold?: number | undefined;
1711
+ sample_size?: number | undefined;
1712
+ baseline_path?: string | undefined;
1713
+ }>>>;
1714
+ logic_drift: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1715
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1716
+ baseline_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1717
+ track_operators: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1718
+ track_branches: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1719
+ track_returns: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1720
+ }, "strip", z.ZodTypeAny, {
1721
+ enabled: boolean;
1722
+ baseline_path: string;
1723
+ track_operators: boolean;
1724
+ track_branches: boolean;
1725
+ track_returns: boolean;
1726
+ }, {
1727
+ enabled?: boolean | undefined;
1728
+ baseline_path?: string | undefined;
1729
+ track_operators?: boolean | undefined;
1730
+ track_branches?: boolean | undefined;
1731
+ track_returns?: boolean | undefined;
1732
+ }>>>;
1605
1733
  deep: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1606
1734
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1607
1735
  pro: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -1731,6 +1859,10 @@ export declare const ConfigSchema: z.ZodObject<{
1731
1859
  };
1732
1860
  dependencies: {
1733
1861
  forbid: string[];
1862
+ detect_unused: boolean;
1863
+ detect_heavy_alternatives: boolean;
1864
+ detect_duplicate_purpose: boolean;
1865
+ unused_allowlist: string[];
1734
1866
  trusted_registry?: string | undefined;
1735
1867
  };
1736
1868
  architecture: {
@@ -1898,6 +2030,19 @@ export declare const ConfigSchema: z.ZodObject<{
1898
2030
  check_circular_triggers: boolean;
1899
2031
  check_auto_restart: boolean;
1900
2032
  };
2033
+ style_drift: {
2034
+ enabled: boolean;
2035
+ deviation_threshold: number;
2036
+ sample_size: number;
2037
+ baseline_path: string;
2038
+ };
2039
+ logic_drift: {
2040
+ enabled: boolean;
2041
+ baseline_path: string;
2042
+ track_operators: boolean;
2043
+ track_branches: boolean;
2044
+ track_returns: boolean;
2045
+ };
1901
2046
  }, {
1902
2047
  deep?: {
1903
2048
  enabled?: boolean | undefined;
@@ -1943,6 +2088,10 @@ export declare const ConfigSchema: z.ZodObject<{
1943
2088
  dependencies?: {
1944
2089
  forbid?: string[] | undefined;
1945
2090
  trusted_registry?: string | undefined;
2091
+ detect_unused?: boolean | undefined;
2092
+ detect_heavy_alternatives?: boolean | undefined;
2093
+ detect_duplicate_purpose?: boolean | undefined;
2094
+ unused_allowlist?: string[] | undefined;
1946
2095
  } | undefined;
1947
2096
  architecture?: {
1948
2097
  boundaries?: {
@@ -2109,6 +2258,19 @@ export declare const ConfigSchema: z.ZodObject<{
2109
2258
  check_circular_triggers?: boolean | undefined;
2110
2259
  check_auto_restart?: boolean | undefined;
2111
2260
  } | undefined;
2261
+ style_drift?: {
2262
+ enabled?: boolean | undefined;
2263
+ deviation_threshold?: number | undefined;
2264
+ sample_size?: number | undefined;
2265
+ baseline_path?: string | undefined;
2266
+ } | undefined;
2267
+ logic_drift?: {
2268
+ enabled?: boolean | undefined;
2269
+ baseline_path?: string | undefined;
2270
+ track_operators?: boolean | undefined;
2271
+ track_branches?: boolean | undefined;
2272
+ track_returns?: boolean | undefined;
2273
+ } | undefined;
2112
2274
  }>>>;
2113
2275
  hooks: z.ZodDefault<z.ZodOptional<z.ZodObject<{
2114
2276
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -2195,6 +2357,10 @@ export declare const ConfigSchema: z.ZodObject<{
2195
2357
  };
2196
2358
  dependencies: {
2197
2359
  forbid: string[];
2360
+ detect_unused: boolean;
2361
+ detect_heavy_alternatives: boolean;
2362
+ detect_duplicate_purpose: boolean;
2363
+ unused_allowlist: string[];
2198
2364
  trusted_registry?: string | undefined;
2199
2365
  };
2200
2366
  architecture: {
@@ -2362,6 +2528,19 @@ export declare const ConfigSchema: z.ZodObject<{
2362
2528
  check_circular_triggers: boolean;
2363
2529
  check_auto_restart: boolean;
2364
2530
  };
2531
+ style_drift: {
2532
+ enabled: boolean;
2533
+ deviation_threshold: number;
2534
+ sample_size: number;
2535
+ baseline_path: string;
2536
+ };
2537
+ logic_drift: {
2538
+ enabled: boolean;
2539
+ baseline_path: string;
2540
+ track_operators: boolean;
2541
+ track_branches: boolean;
2542
+ track_returns: boolean;
2543
+ };
2365
2544
  };
2366
2545
  hooks: {
2367
2546
  enabled: boolean;
@@ -2433,6 +2612,10 @@ export declare const ConfigSchema: z.ZodObject<{
2433
2612
  dependencies?: {
2434
2613
  forbid?: string[] | undefined;
2435
2614
  trusted_registry?: string | undefined;
2615
+ detect_unused?: boolean | undefined;
2616
+ detect_heavy_alternatives?: boolean | undefined;
2617
+ detect_duplicate_purpose?: boolean | undefined;
2618
+ unused_allowlist?: string[] | undefined;
2436
2619
  } | undefined;
2437
2620
  architecture?: {
2438
2621
  boundaries?: {
@@ -2599,6 +2782,19 @@ export declare const ConfigSchema: z.ZodObject<{
2599
2782
  check_circular_triggers?: boolean | undefined;
2600
2783
  check_auto_restart?: boolean | undefined;
2601
2784
  } | undefined;
2785
+ style_drift?: {
2786
+ enabled?: boolean | undefined;
2787
+ deviation_threshold?: number | undefined;
2788
+ sample_size?: number | undefined;
2789
+ baseline_path?: string | undefined;
2790
+ } | undefined;
2791
+ logic_drift?: {
2792
+ enabled?: boolean | undefined;
2793
+ baseline_path?: string | undefined;
2794
+ track_operators?: boolean | undefined;
2795
+ track_branches?: boolean | undefined;
2796
+ track_returns?: boolean | undefined;
2797
+ } | undefined;
2602
2798
  } | undefined;
2603
2799
  hooks?: {
2604
2800
  enabled?: boolean | undefined;
@@ -36,6 +36,10 @@ export const GatesSchema = z.object({
36
36
  dependencies: z.object({
37
37
  forbid: z.array(z.string()).optional().default([]),
38
38
  trusted_registry: z.string().optional(),
39
+ detect_unused: z.boolean().optional().default(true),
40
+ detect_heavy_alternatives: z.boolean().optional().default(true),
41
+ detect_duplicate_purpose: z.boolean().optional().default(true),
42
+ unused_allowlist: z.array(z.string()).optional().default([]),
39
43
  }).optional().default({}),
40
44
  architecture: z.object({
41
45
  boundaries: z.array(z.object({
@@ -274,6 +278,21 @@ export const GatesSchema = z.object({
274
278
  check_auto_restart: z.boolean().optional().default(true),
275
279
  ignore_patterns: z.array(z.string()).optional().default([]),
276
280
  }).optional().default({}),
281
+ // v5.1+ Style Drift Detection
282
+ style_drift: z.object({
283
+ enabled: z.boolean().optional().default(true),
284
+ deviation_threshold: z.number().min(0).max(1).optional().default(0.25),
285
+ sample_size: z.number().optional().default(100),
286
+ baseline_path: z.string().optional().default('.rigour/style-baseline.json'),
287
+ }).optional().default({}),
288
+ // v5.1+ Logic Drift Foundation
289
+ logic_drift: z.object({
290
+ enabled: z.boolean().optional().default(true),
291
+ baseline_path: z.string().optional().default('.rigour/logic-baseline.json'),
292
+ track_operators: z.boolean().optional().default(true),
293
+ track_branches: z.boolean().optional().default(true),
294
+ track_returns: z.boolean().optional().default(true),
295
+ }).optional().default({}),
277
296
  // v4.0+ Deep Analysis (LLM-powered)
278
297
  deep: z.object({
279
298
  enabled: z.boolean().optional().default(false),
@@ -1,3 +1,4 @@
1
+ import type { FileSystemCache } from '../services/filesystem-cache.js';
1
2
  export interface ScannerOptions {
2
3
  cwd: string;
3
4
  patterns?: string[];
@@ -7,5 +8,9 @@ export declare class FileScanner {
7
8
  private static DEFAULT_PATTERNS;
8
9
  private static DEFAULT_IGNORE;
9
10
  static findFiles(options: ScannerOptions): Promise<string[]>;
10
- static readFiles(cwd: string, files: string[]): Promise<Map<string, string>>;
11
+ /**
12
+ * Read file contents. When a FileSystemCache is provided, uses it for
13
+ * shared caching across gates (avoids re-loading per gate).
14
+ */
15
+ static readFiles(cwd: string, files: string[], cache?: FileSystemCache): Promise<Map<string, string>>;
11
16
  }
@@ -27,7 +27,14 @@ export class FileScanner {
27
27
  ignore: ignore,
28
28
  });
29
29
  }
30
- static async readFiles(cwd, files) {
30
+ /**
31
+ * Read file contents. When a FileSystemCache is provided, uses it for
32
+ * shared caching across gates (avoids re-loading per gate).
33
+ */
34
+ static async readFiles(cwd, files, cache) {
35
+ if (cache) {
36
+ return cache.getFiles(cwd, files);
37
+ }
31
38
  const contents = new Map();
32
39
  for (const file of files) {
33
40
  const normalizedFile = file.replace(/\//g, path.sep);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigour-labs/core",
3
- "version": "4.3.6",
3
+ "version": "5.0.0",
4
4
  "description": "Deterministic quality gate engine for AI-generated code. AST analysis, drift detection, and Fix Packet generation across TypeScript, JavaScript, Python, Go, Ruby, and C#.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rigour.run",
@@ -59,11 +59,11 @@
59
59
  "@xenova/transformers": "^2.17.2",
60
60
  "better-sqlite3": "^11.0.0",
61
61
  "openai": "^4.104.0",
62
- "@rigour-labs/brain-darwin-arm64": "4.3.6",
63
- "@rigour-labs/brain-darwin-x64": "4.3.6",
64
- "@rigour-labs/brain-linux-arm64": "4.3.6",
65
- "@rigour-labs/brain-win-x64": "4.3.6",
66
- "@rigour-labs/brain-linux-x64": "4.3.6"
62
+ "@rigour-labs/brain-darwin-arm64": "5.0.0",
63
+ "@rigour-labs/brain-linux-arm64": "5.0.0",
64
+ "@rigour-labs/brain-darwin-x64": "5.0.0",
65
+ "@rigour-labs/brain-linux-x64": "5.0.0",
66
+ "@rigour-labs/brain-win-x64": "5.0.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/better-sqlite3": "^7.6.12",