@rigour-labs/core 2.21.2 → 3.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.
Files changed (101) hide show
  1. package/README.md +58 -0
  2. package/dist/context.test.js +2 -3
  3. package/dist/environment.test.js +2 -1
  4. package/dist/gates/agent-team.d.ts +2 -1
  5. package/dist/gates/agent-team.js +1 -0
  6. package/dist/gates/base.d.ts +4 -2
  7. package/dist/gates/base.js +5 -1
  8. package/dist/gates/checkpoint.d.ts +2 -1
  9. package/dist/gates/checkpoint.js +3 -2
  10. package/dist/gates/content.js +1 -1
  11. package/dist/gates/context-window-artifacts.d.ts +34 -0
  12. package/dist/gates/context-window-artifacts.js +214 -0
  13. package/dist/gates/context.d.ts +2 -1
  14. package/dist/gates/context.js +4 -3
  15. package/dist/gates/coverage.js +3 -1
  16. package/dist/gates/dependency.js +5 -5
  17. package/dist/gates/duplication-drift.d.ts +33 -0
  18. package/dist/gates/duplication-drift.js +190 -0
  19. package/dist/gates/environment.js +4 -4
  20. package/dist/gates/file.js +1 -1
  21. package/dist/gates/hallucinated-imports.d.ts +63 -0
  22. package/dist/gates/hallucinated-imports.js +406 -0
  23. package/dist/gates/inconsistent-error-handling.d.ts +39 -0
  24. package/dist/gates/inconsistent-error-handling.js +236 -0
  25. package/dist/gates/promise-safety.d.ts +68 -0
  26. package/dist/gates/promise-safety.js +509 -0
  27. package/dist/gates/retry-loop-breaker.d.ts +2 -1
  28. package/dist/gates/retry-loop-breaker.js +2 -1
  29. package/dist/gates/runner.js +62 -1
  30. package/dist/gates/safety.d.ts +2 -1
  31. package/dist/gates/safety.js +2 -1
  32. package/dist/gates/security-patterns.d.ts +2 -1
  33. package/dist/gates/security-patterns.js +2 -1
  34. package/dist/gates/structure.js +1 -1
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +1 -0
  37. package/dist/services/fix-packet-service.d.ts +0 -1
  38. package/dist/services/fix-packet-service.js +9 -14
  39. package/dist/services/score-history.d.ts +54 -0
  40. package/dist/services/score-history.js +122 -0
  41. package/dist/templates/index.js +195 -0
  42. package/dist/types/fix-packet.d.ts +5 -5
  43. package/dist/types/fix-packet.js +1 -1
  44. package/dist/types/index.d.ts +430 -0
  45. package/dist/types/index.js +57 -0
  46. package/package.json +21 -1
  47. package/src/context.test.ts +0 -256
  48. package/src/discovery.test.ts +0 -88
  49. package/src/discovery.ts +0 -112
  50. package/src/environment.test.ts +0 -115
  51. package/src/gates/agent-team.test.ts +0 -134
  52. package/src/gates/agent-team.ts +0 -210
  53. package/src/gates/ast-handlers/base.ts +0 -13
  54. package/src/gates/ast-handlers/python.ts +0 -145
  55. package/src/gates/ast-handlers/python_parser.py +0 -181
  56. package/src/gates/ast-handlers/typescript.ts +0 -264
  57. package/src/gates/ast-handlers/universal.ts +0 -184
  58. package/src/gates/ast.ts +0 -54
  59. package/src/gates/base.ts +0 -27
  60. package/src/gates/checkpoint.test.ts +0 -135
  61. package/src/gates/checkpoint.ts +0 -311
  62. package/src/gates/content.ts +0 -50
  63. package/src/gates/context.ts +0 -267
  64. package/src/gates/coverage.ts +0 -74
  65. package/src/gates/dependency.ts +0 -108
  66. package/src/gates/environment.ts +0 -94
  67. package/src/gates/file.ts +0 -42
  68. package/src/gates/retry-loop-breaker.ts +0 -151
  69. package/src/gates/runner.ts +0 -156
  70. package/src/gates/safety.ts +0 -56
  71. package/src/gates/security-patterns.test.ts +0 -162
  72. package/src/gates/security-patterns.ts +0 -305
  73. package/src/gates/structure.ts +0 -36
  74. package/src/index.ts +0 -13
  75. package/src/pattern-index/embeddings.ts +0 -84
  76. package/src/pattern-index/index.ts +0 -59
  77. package/src/pattern-index/indexer.test.ts +0 -276
  78. package/src/pattern-index/indexer.ts +0 -1023
  79. package/src/pattern-index/matcher.test.ts +0 -293
  80. package/src/pattern-index/matcher.ts +0 -493
  81. package/src/pattern-index/overrides.ts +0 -235
  82. package/src/pattern-index/security.ts +0 -151
  83. package/src/pattern-index/staleness.test.ts +0 -313
  84. package/src/pattern-index/staleness.ts +0 -568
  85. package/src/pattern-index/types.ts +0 -339
  86. package/src/safety.test.ts +0 -53
  87. package/src/services/adaptive-thresholds.test.ts +0 -189
  88. package/src/services/adaptive-thresholds.ts +0 -275
  89. package/src/services/context-engine.ts +0 -104
  90. package/src/services/fix-packet-service.ts +0 -42
  91. package/src/services/state-service.ts +0 -138
  92. package/src/smoke.test.ts +0 -18
  93. package/src/templates/index.ts +0 -312
  94. package/src/types/fix-packet.ts +0 -32
  95. package/src/types/index.ts +0 -159
  96. package/src/utils/logger.ts +0 -43
  97. package/src/utils/scanner.test.ts +0 -37
  98. package/src/utils/scanner.ts +0 -43
  99. package/tsconfig.json +0 -10
  100. package/vitest.config.ts +0 -7
  101. package/vitest.setup.ts +0 -30
@@ -232,6 +232,89 @@ export declare const GatesSchema: z.ZodObject<{
232
232
  auto_detect_tier?: boolean | undefined;
233
233
  forced_tier?: "hobby" | "startup" | "enterprise" | undefined;
234
234
  }>>>;
235
+ duplication_drift: z.ZodDefault<z.ZodOptional<z.ZodObject<{
236
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
237
+ similarity_threshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
238
+ min_body_lines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
239
+ }, "strip", z.ZodTypeAny, {
240
+ enabled: boolean;
241
+ similarity_threshold: number;
242
+ min_body_lines: number;
243
+ }, {
244
+ enabled?: boolean | undefined;
245
+ similarity_threshold?: number | undefined;
246
+ min_body_lines?: number | undefined;
247
+ }>>>;
248
+ hallucinated_imports: z.ZodDefault<z.ZodOptional<z.ZodObject<{
249
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
250
+ check_relative: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
251
+ check_packages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
252
+ ignore_patterns: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
253
+ }, "strip", z.ZodTypeAny, {
254
+ enabled: boolean;
255
+ check_relative: boolean;
256
+ check_packages: boolean;
257
+ ignore_patterns: string[];
258
+ }, {
259
+ enabled?: boolean | undefined;
260
+ check_relative?: boolean | undefined;
261
+ check_packages?: boolean | undefined;
262
+ ignore_patterns?: string[] | undefined;
263
+ }>>>;
264
+ inconsistent_error_handling: z.ZodDefault<z.ZodOptional<z.ZodObject<{
265
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
266
+ max_strategies_per_type: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
267
+ min_occurrences: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
268
+ ignore_empty_catches: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
269
+ }, "strip", z.ZodTypeAny, {
270
+ enabled: boolean;
271
+ max_strategies_per_type: number;
272
+ min_occurrences: number;
273
+ ignore_empty_catches: boolean;
274
+ }, {
275
+ enabled?: boolean | undefined;
276
+ max_strategies_per_type?: number | undefined;
277
+ min_occurrences?: number | undefined;
278
+ ignore_empty_catches?: boolean | undefined;
279
+ }>>>;
280
+ context_window_artifacts: z.ZodDefault<z.ZodOptional<z.ZodObject<{
281
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
282
+ min_file_lines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
283
+ degradation_threshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
284
+ signals_required: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
285
+ }, "strip", z.ZodTypeAny, {
286
+ enabled: boolean;
287
+ min_file_lines: number;
288
+ degradation_threshold: number;
289
+ signals_required: number;
290
+ }, {
291
+ enabled?: boolean | undefined;
292
+ min_file_lines?: number | undefined;
293
+ degradation_threshold?: number | undefined;
294
+ signals_required?: number | undefined;
295
+ }>>>;
296
+ promise_safety: z.ZodDefault<z.ZodOptional<z.ZodObject<{
297
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
298
+ check_unhandled_then: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
299
+ check_unsafe_parse: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
300
+ check_async_without_await: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
301
+ check_unsafe_fetch: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
302
+ ignore_patterns: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
303
+ }, "strip", z.ZodTypeAny, {
304
+ enabled: boolean;
305
+ ignore_patterns: string[];
306
+ check_unhandled_then: boolean;
307
+ check_unsafe_parse: boolean;
308
+ check_async_without_await: boolean;
309
+ check_unsafe_fetch: boolean;
310
+ }, {
311
+ enabled?: boolean | undefined;
312
+ ignore_patterns?: string[] | undefined;
313
+ check_unhandled_then?: boolean | undefined;
314
+ check_unsafe_parse?: boolean | undefined;
315
+ check_async_without_await?: boolean | undefined;
316
+ check_unsafe_fetch?: boolean | undefined;
317
+ }>>>;
235
318
  }, "strip", z.ZodTypeAny, {
236
319
  max_file_lines: number;
237
320
  forbid_todos: boolean;
@@ -319,6 +402,37 @@ export declare const GatesSchema: z.ZodObject<{
319
402
  auto_detect_tier: boolean;
320
403
  forced_tier?: "hobby" | "startup" | "enterprise" | undefined;
321
404
  };
405
+ duplication_drift: {
406
+ enabled: boolean;
407
+ similarity_threshold: number;
408
+ min_body_lines: number;
409
+ };
410
+ hallucinated_imports: {
411
+ enabled: boolean;
412
+ check_relative: boolean;
413
+ check_packages: boolean;
414
+ ignore_patterns: string[];
415
+ };
416
+ inconsistent_error_handling: {
417
+ enabled: boolean;
418
+ max_strategies_per_type: number;
419
+ min_occurrences: number;
420
+ ignore_empty_catches: boolean;
421
+ };
422
+ context_window_artifacts: {
423
+ enabled: boolean;
424
+ min_file_lines: number;
425
+ degradation_threshold: number;
426
+ signals_required: number;
427
+ };
428
+ promise_safety: {
429
+ enabled: boolean;
430
+ ignore_patterns: string[];
431
+ check_unhandled_then: boolean;
432
+ check_unsafe_parse: boolean;
433
+ check_async_without_await: boolean;
434
+ check_unsafe_fetch: boolean;
435
+ };
322
436
  }, {
323
437
  max_file_lines?: number | undefined;
324
438
  forbid_todos?: boolean | undefined;
@@ -406,6 +520,37 @@ export declare const GatesSchema: z.ZodObject<{
406
520
  auto_detect_tier?: boolean | undefined;
407
521
  forced_tier?: "hobby" | "startup" | "enterprise" | undefined;
408
522
  } | undefined;
523
+ duplication_drift?: {
524
+ enabled?: boolean | undefined;
525
+ similarity_threshold?: number | undefined;
526
+ min_body_lines?: number | undefined;
527
+ } | undefined;
528
+ hallucinated_imports?: {
529
+ enabled?: boolean | undefined;
530
+ check_relative?: boolean | undefined;
531
+ check_packages?: boolean | undefined;
532
+ ignore_patterns?: string[] | undefined;
533
+ } | undefined;
534
+ inconsistent_error_handling?: {
535
+ enabled?: boolean | undefined;
536
+ max_strategies_per_type?: number | undefined;
537
+ min_occurrences?: number | undefined;
538
+ ignore_empty_catches?: boolean | undefined;
539
+ } | undefined;
540
+ context_window_artifacts?: {
541
+ enabled?: boolean | undefined;
542
+ min_file_lines?: number | undefined;
543
+ degradation_threshold?: number | undefined;
544
+ signals_required?: number | undefined;
545
+ } | undefined;
546
+ promise_safety?: {
547
+ enabled?: boolean | undefined;
548
+ ignore_patterns?: string[] | undefined;
549
+ check_unhandled_then?: boolean | undefined;
550
+ check_unsafe_parse?: boolean | undefined;
551
+ check_async_without_await?: boolean | undefined;
552
+ check_unsafe_fetch?: boolean | undefined;
553
+ } | undefined;
409
554
  }>;
410
555
  export declare const CommandsSchema: z.ZodObject<{
411
556
  format: z.ZodOptional<z.ZodString>;
@@ -676,6 +821,89 @@ export declare const ConfigSchema: z.ZodObject<{
676
821
  auto_detect_tier?: boolean | undefined;
677
822
  forced_tier?: "hobby" | "startup" | "enterprise" | undefined;
678
823
  }>>>;
824
+ duplication_drift: z.ZodDefault<z.ZodOptional<z.ZodObject<{
825
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
826
+ similarity_threshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
827
+ min_body_lines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
828
+ }, "strip", z.ZodTypeAny, {
829
+ enabled: boolean;
830
+ similarity_threshold: number;
831
+ min_body_lines: number;
832
+ }, {
833
+ enabled?: boolean | undefined;
834
+ similarity_threshold?: number | undefined;
835
+ min_body_lines?: number | undefined;
836
+ }>>>;
837
+ hallucinated_imports: z.ZodDefault<z.ZodOptional<z.ZodObject<{
838
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
839
+ check_relative: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
840
+ check_packages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
841
+ ignore_patterns: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
842
+ }, "strip", z.ZodTypeAny, {
843
+ enabled: boolean;
844
+ check_relative: boolean;
845
+ check_packages: boolean;
846
+ ignore_patterns: string[];
847
+ }, {
848
+ enabled?: boolean | undefined;
849
+ check_relative?: boolean | undefined;
850
+ check_packages?: boolean | undefined;
851
+ ignore_patterns?: string[] | undefined;
852
+ }>>>;
853
+ inconsistent_error_handling: z.ZodDefault<z.ZodOptional<z.ZodObject<{
854
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
855
+ max_strategies_per_type: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
856
+ min_occurrences: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
857
+ ignore_empty_catches: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
858
+ }, "strip", z.ZodTypeAny, {
859
+ enabled: boolean;
860
+ max_strategies_per_type: number;
861
+ min_occurrences: number;
862
+ ignore_empty_catches: boolean;
863
+ }, {
864
+ enabled?: boolean | undefined;
865
+ max_strategies_per_type?: number | undefined;
866
+ min_occurrences?: number | undefined;
867
+ ignore_empty_catches?: boolean | undefined;
868
+ }>>>;
869
+ context_window_artifacts: z.ZodDefault<z.ZodOptional<z.ZodObject<{
870
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
871
+ min_file_lines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
872
+ degradation_threshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
873
+ signals_required: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
874
+ }, "strip", z.ZodTypeAny, {
875
+ enabled: boolean;
876
+ min_file_lines: number;
877
+ degradation_threshold: number;
878
+ signals_required: number;
879
+ }, {
880
+ enabled?: boolean | undefined;
881
+ min_file_lines?: number | undefined;
882
+ degradation_threshold?: number | undefined;
883
+ signals_required?: number | undefined;
884
+ }>>>;
885
+ promise_safety: z.ZodDefault<z.ZodOptional<z.ZodObject<{
886
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
887
+ check_unhandled_then: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
888
+ check_unsafe_parse: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
889
+ check_async_without_await: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
890
+ check_unsafe_fetch: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
891
+ ignore_patterns: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
892
+ }, "strip", z.ZodTypeAny, {
893
+ enabled: boolean;
894
+ ignore_patterns: string[];
895
+ check_unhandled_then: boolean;
896
+ check_unsafe_parse: boolean;
897
+ check_async_without_await: boolean;
898
+ check_unsafe_fetch: boolean;
899
+ }, {
900
+ enabled?: boolean | undefined;
901
+ ignore_patterns?: string[] | undefined;
902
+ check_unhandled_then?: boolean | undefined;
903
+ check_unsafe_parse?: boolean | undefined;
904
+ check_async_without_await?: boolean | undefined;
905
+ check_unsafe_fetch?: boolean | undefined;
906
+ }>>>;
679
907
  }, "strip", z.ZodTypeAny, {
680
908
  max_file_lines: number;
681
909
  forbid_todos: boolean;
@@ -763,6 +991,37 @@ export declare const ConfigSchema: z.ZodObject<{
763
991
  auto_detect_tier: boolean;
764
992
  forced_tier?: "hobby" | "startup" | "enterprise" | undefined;
765
993
  };
994
+ duplication_drift: {
995
+ enabled: boolean;
996
+ similarity_threshold: number;
997
+ min_body_lines: number;
998
+ };
999
+ hallucinated_imports: {
1000
+ enabled: boolean;
1001
+ check_relative: boolean;
1002
+ check_packages: boolean;
1003
+ ignore_patterns: string[];
1004
+ };
1005
+ inconsistent_error_handling: {
1006
+ enabled: boolean;
1007
+ max_strategies_per_type: number;
1008
+ min_occurrences: number;
1009
+ ignore_empty_catches: boolean;
1010
+ };
1011
+ context_window_artifacts: {
1012
+ enabled: boolean;
1013
+ min_file_lines: number;
1014
+ degradation_threshold: number;
1015
+ signals_required: number;
1016
+ };
1017
+ promise_safety: {
1018
+ enabled: boolean;
1019
+ ignore_patterns: string[];
1020
+ check_unhandled_then: boolean;
1021
+ check_unsafe_parse: boolean;
1022
+ check_async_without_await: boolean;
1023
+ check_unsafe_fetch: boolean;
1024
+ };
766
1025
  }, {
767
1026
  max_file_lines?: number | undefined;
768
1027
  forbid_todos?: boolean | undefined;
@@ -850,6 +1109,37 @@ export declare const ConfigSchema: z.ZodObject<{
850
1109
  auto_detect_tier?: boolean | undefined;
851
1110
  forced_tier?: "hobby" | "startup" | "enterprise" | undefined;
852
1111
  } | undefined;
1112
+ duplication_drift?: {
1113
+ enabled?: boolean | undefined;
1114
+ similarity_threshold?: number | undefined;
1115
+ min_body_lines?: number | undefined;
1116
+ } | undefined;
1117
+ hallucinated_imports?: {
1118
+ enabled?: boolean | undefined;
1119
+ check_relative?: boolean | undefined;
1120
+ check_packages?: boolean | undefined;
1121
+ ignore_patterns?: string[] | undefined;
1122
+ } | undefined;
1123
+ inconsistent_error_handling?: {
1124
+ enabled?: boolean | undefined;
1125
+ max_strategies_per_type?: number | undefined;
1126
+ min_occurrences?: number | undefined;
1127
+ ignore_empty_catches?: boolean | undefined;
1128
+ } | undefined;
1129
+ context_window_artifacts?: {
1130
+ enabled?: boolean | undefined;
1131
+ min_file_lines?: number | undefined;
1132
+ degradation_threshold?: number | undefined;
1133
+ signals_required?: number | undefined;
1134
+ } | undefined;
1135
+ promise_safety?: {
1136
+ enabled?: boolean | undefined;
1137
+ ignore_patterns?: string[] | undefined;
1138
+ check_unhandled_then?: boolean | undefined;
1139
+ check_unsafe_parse?: boolean | undefined;
1140
+ check_async_without_await?: boolean | undefined;
1141
+ check_unsafe_fetch?: boolean | undefined;
1142
+ } | undefined;
853
1143
  }>>>;
854
1144
  output: z.ZodDefault<z.ZodOptional<z.ZodObject<{
855
1145
  report_path: z.ZodDefault<z.ZodString>;
@@ -956,6 +1246,37 @@ export declare const ConfigSchema: z.ZodObject<{
956
1246
  auto_detect_tier: boolean;
957
1247
  forced_tier?: "hobby" | "startup" | "enterprise" | undefined;
958
1248
  };
1249
+ duplication_drift: {
1250
+ enabled: boolean;
1251
+ similarity_threshold: number;
1252
+ min_body_lines: number;
1253
+ };
1254
+ hallucinated_imports: {
1255
+ enabled: boolean;
1256
+ check_relative: boolean;
1257
+ check_packages: boolean;
1258
+ ignore_patterns: string[];
1259
+ };
1260
+ inconsistent_error_handling: {
1261
+ enabled: boolean;
1262
+ max_strategies_per_type: number;
1263
+ min_occurrences: number;
1264
+ ignore_empty_catches: boolean;
1265
+ };
1266
+ context_window_artifacts: {
1267
+ enabled: boolean;
1268
+ min_file_lines: number;
1269
+ degradation_threshold: number;
1270
+ signals_required: number;
1271
+ };
1272
+ promise_safety: {
1273
+ enabled: boolean;
1274
+ ignore_patterns: string[];
1275
+ check_unhandled_then: boolean;
1276
+ check_unsafe_parse: boolean;
1277
+ check_async_without_await: boolean;
1278
+ check_unsafe_fetch: boolean;
1279
+ };
959
1280
  };
960
1281
  output: {
961
1282
  report_path: string;
@@ -1061,6 +1382,37 @@ export declare const ConfigSchema: z.ZodObject<{
1061
1382
  auto_detect_tier?: boolean | undefined;
1062
1383
  forced_tier?: "hobby" | "startup" | "enterprise" | undefined;
1063
1384
  } | undefined;
1385
+ duplication_drift?: {
1386
+ enabled?: boolean | undefined;
1387
+ similarity_threshold?: number | undefined;
1388
+ min_body_lines?: number | undefined;
1389
+ } | undefined;
1390
+ hallucinated_imports?: {
1391
+ enabled?: boolean | undefined;
1392
+ check_relative?: boolean | undefined;
1393
+ check_packages?: boolean | undefined;
1394
+ ignore_patterns?: string[] | undefined;
1395
+ } | undefined;
1396
+ inconsistent_error_handling?: {
1397
+ enabled?: boolean | undefined;
1398
+ max_strategies_per_type?: number | undefined;
1399
+ min_occurrences?: number | undefined;
1400
+ ignore_empty_catches?: boolean | undefined;
1401
+ } | undefined;
1402
+ context_window_artifacts?: {
1403
+ enabled?: boolean | undefined;
1404
+ min_file_lines?: number | undefined;
1405
+ degradation_threshold?: number | undefined;
1406
+ signals_required?: number | undefined;
1407
+ } | undefined;
1408
+ promise_safety?: {
1409
+ enabled?: boolean | undefined;
1410
+ ignore_patterns?: string[] | undefined;
1411
+ check_unhandled_then?: boolean | undefined;
1412
+ check_unsafe_parse?: boolean | undefined;
1413
+ check_async_without_await?: boolean | undefined;
1414
+ check_unsafe_fetch?: boolean | undefined;
1415
+ } | undefined;
1064
1416
  } | undefined;
1065
1417
  output?: {
1066
1418
  report_path?: string | undefined;
@@ -1075,10 +1427,19 @@ export type RawCommands = z.input<typeof CommandsSchema>;
1075
1427
  export type RawConfig = z.input<typeof ConfigSchema>;
1076
1428
  export declare const StatusSchema: z.ZodEnum<["PASS", "FAIL", "SKIP", "ERROR"]>;
1077
1429
  export type Status = z.infer<typeof StatusSchema>;
1430
+ export declare const SeveritySchema: z.ZodEnum<["critical", "high", "medium", "low", "info"]>;
1431
+ export type Severity = z.infer<typeof SeveritySchema>;
1432
+ /** Provenance tags — lets dashboards/agents filter by what matters */
1433
+ export declare const ProvenanceSchema: z.ZodEnum<["ai-drift", "traditional", "security", "governance"]>;
1434
+ export type Provenance = z.infer<typeof ProvenanceSchema>;
1435
+ /** Severity weights for score calculation */
1436
+ export declare const SEVERITY_WEIGHTS: Record<Severity, number>;
1078
1437
  export declare const FailureSchema: z.ZodObject<{
1079
1438
  id: z.ZodString;
1080
1439
  title: z.ZodString;
1081
1440
  details: z.ZodString;
1441
+ severity: z.ZodOptional<z.ZodEnum<["critical", "high", "medium", "low", "info"]>>;
1442
+ provenance: z.ZodOptional<z.ZodEnum<["ai-drift", "traditional", "security", "governance"]>>;
1082
1443
  files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1083
1444
  line: z.ZodOptional<z.ZodNumber>;
1084
1445
  endLine: z.ZodOptional<z.ZodNumber>;
@@ -1087,6 +1448,8 @@ export declare const FailureSchema: z.ZodObject<{
1087
1448
  id: string;
1088
1449
  title: string;
1089
1450
  details: string;
1451
+ severity?: "critical" | "high" | "medium" | "low" | "info" | undefined;
1452
+ provenance?: "security" | "ai-drift" | "traditional" | "governance" | undefined;
1090
1453
  files?: string[] | undefined;
1091
1454
  line?: number | undefined;
1092
1455
  endLine?: number | undefined;
@@ -1095,6 +1458,8 @@ export declare const FailureSchema: z.ZodObject<{
1095
1458
  id: string;
1096
1459
  title: string;
1097
1460
  details: string;
1461
+ severity?: "critical" | "high" | "medium" | "low" | "info" | undefined;
1462
+ provenance?: "security" | "ai-drift" | "traditional" | "governance" | undefined;
1098
1463
  files?: string[] | undefined;
1099
1464
  line?: number | undefined;
1100
1465
  endLine?: number | undefined;
@@ -1108,6 +1473,8 @@ export declare const ReportSchema: z.ZodObject<{
1108
1473
  id: z.ZodString;
1109
1474
  title: z.ZodString;
1110
1475
  details: z.ZodString;
1476
+ severity: z.ZodOptional<z.ZodEnum<["critical", "high", "medium", "low", "info"]>>;
1477
+ provenance: z.ZodOptional<z.ZodEnum<["ai-drift", "traditional", "security", "governance"]>>;
1111
1478
  files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1112
1479
  line: z.ZodOptional<z.ZodNumber>;
1113
1480
  endLine: z.ZodOptional<z.ZodNumber>;
@@ -1116,6 +1483,8 @@ export declare const ReportSchema: z.ZodObject<{
1116
1483
  id: string;
1117
1484
  title: string;
1118
1485
  details: string;
1486
+ severity?: "critical" | "high" | "medium" | "low" | "info" | undefined;
1487
+ provenance?: "security" | "ai-drift" | "traditional" | "governance" | undefined;
1119
1488
  files?: string[] | undefined;
1120
1489
  line?: number | undefined;
1121
1490
  endLine?: number | undefined;
@@ -1124,6 +1493,8 @@ export declare const ReportSchema: z.ZodObject<{
1124
1493
  id: string;
1125
1494
  title: string;
1126
1495
  details: string;
1496
+ severity?: "critical" | "high" | "medium" | "low" | "info" | undefined;
1497
+ provenance?: "security" | "ai-drift" | "traditional" | "governance" | undefined;
1127
1498
  files?: string[] | undefined;
1128
1499
  line?: number | undefined;
1129
1500
  endLine?: number | undefined;
@@ -1132,17 +1503,63 @@ export declare const ReportSchema: z.ZodObject<{
1132
1503
  stats: z.ZodObject<{
1133
1504
  duration_ms: z.ZodNumber;
1134
1505
  score: z.ZodOptional<z.ZodNumber>;
1506
+ ai_health_score: z.ZodOptional<z.ZodNumber>;
1507
+ structural_score: z.ZodOptional<z.ZodNumber>;
1508
+ severity_breakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1509
+ provenance_breakdown: z.ZodOptional<z.ZodObject<{
1510
+ 'ai-drift': z.ZodNumber;
1511
+ traditional: z.ZodNumber;
1512
+ security: z.ZodNumber;
1513
+ governance: z.ZodNumber;
1514
+ }, "strip", z.ZodTypeAny, {
1515
+ security: number;
1516
+ 'ai-drift': number;
1517
+ traditional: number;
1518
+ governance: number;
1519
+ }, {
1520
+ security: number;
1521
+ 'ai-drift': number;
1522
+ traditional: number;
1523
+ governance: number;
1524
+ }>>;
1135
1525
  }, "strip", z.ZodTypeAny, {
1136
1526
  duration_ms: number;
1137
1527
  score?: number | undefined;
1528
+ ai_health_score?: number | undefined;
1529
+ structural_score?: number | undefined;
1530
+ severity_breakdown?: Record<string, number> | undefined;
1531
+ provenance_breakdown?: {
1532
+ security: number;
1533
+ 'ai-drift': number;
1534
+ traditional: number;
1535
+ governance: number;
1536
+ } | undefined;
1138
1537
  }, {
1139
1538
  duration_ms: number;
1140
1539
  score?: number | undefined;
1540
+ ai_health_score?: number | undefined;
1541
+ structural_score?: number | undefined;
1542
+ severity_breakdown?: Record<string, number> | undefined;
1543
+ provenance_breakdown?: {
1544
+ security: number;
1545
+ 'ai-drift': number;
1546
+ traditional: number;
1547
+ governance: number;
1548
+ } | undefined;
1141
1549
  }>;
1142
1550
  }, "strip", z.ZodTypeAny, {
1143
1551
  stats: {
1144
1552
  duration_ms: number;
1145
1553
  score?: number | undefined;
1554
+ ai_health_score?: number | undefined;
1555
+ structural_score?: number | undefined;
1556
+ severity_breakdown?: Record<string, number> | undefined;
1557
+ provenance_breakdown?: {
1558
+ security: number;
1559
+ 'ai-drift': number;
1560
+ traditional: number;
1561
+ governance: number;
1562
+ } | undefined;
1146
1563
  };
1147
1564
  status: "PASS" | "FAIL" | "SKIP" | "ERROR";
1148
1565
  summary: Record<string, "PASS" | "FAIL" | "SKIP" | "ERROR">;
@@ -1150,6 +1567,8 @@ export declare const ReportSchema: z.ZodObject<{
1150
1567
  id: string;
1151
1568
  title: string;
1152
1569
  details: string;
1570
+ severity?: "critical" | "high" | "medium" | "low" | "info" | undefined;
1571
+ provenance?: "security" | "ai-drift" | "traditional" | "governance" | undefined;
1153
1572
  files?: string[] | undefined;
1154
1573
  line?: number | undefined;
1155
1574
  endLine?: number | undefined;
@@ -1159,6 +1578,15 @@ export declare const ReportSchema: z.ZodObject<{
1159
1578
  stats: {
1160
1579
  duration_ms: number;
1161
1580
  score?: number | undefined;
1581
+ ai_health_score?: number | undefined;
1582
+ structural_score?: number | undefined;
1583
+ severity_breakdown?: Record<string, number> | undefined;
1584
+ provenance_breakdown?: {
1585
+ security: number;
1586
+ 'ai-drift': number;
1587
+ traditional: number;
1588
+ governance: number;
1589
+ } | undefined;
1162
1590
  };
1163
1591
  status: "PASS" | "FAIL" | "SKIP" | "ERROR";
1164
1592
  summary: Record<string, "PASS" | "FAIL" | "SKIP" | "ERROR">;
@@ -1166,6 +1594,8 @@ export declare const ReportSchema: z.ZodObject<{
1166
1594
  id: string;
1167
1595
  title: string;
1168
1596
  details: string;
1597
+ severity?: "critical" | "high" | "medium" | "low" | "info" | undefined;
1598
+ provenance?: "security" | "ai-drift" | "traditional" | "governance" | undefined;
1169
1599
  files?: string[] | undefined;
1170
1600
  line?: number | undefined;
1171
1601
  endLine?: number | undefined;
@@ -102,6 +102,41 @@ export const GatesSchema = z.object({
102
102
  auto_detect_tier: z.boolean().optional().default(true),
103
103
  forced_tier: z.enum(['hobby', 'startup', 'enterprise']).optional(),
104
104
  }).optional().default({}),
105
+ // v2.16+ AI-Native Drift Detection Gates
106
+ duplication_drift: z.object({
107
+ enabled: z.boolean().optional().default(true),
108
+ similarity_threshold: z.number().min(0).max(1).optional().default(0.8),
109
+ min_body_lines: z.number().optional().default(5),
110
+ }).optional().default({}),
111
+ hallucinated_imports: z.object({
112
+ enabled: z.boolean().optional().default(true),
113
+ check_relative: z.boolean().optional().default(true),
114
+ check_packages: z.boolean().optional().default(true),
115
+ ignore_patterns: z.array(z.string()).optional().default([
116
+ '\\.css$', '\\.scss$', '\\.less$', '\\.svg$', '\\.png$', '\\.jpg$',
117
+ '\\.json$', '\\.wasm$', '\\.graphql$', '\\.gql$',
118
+ ]),
119
+ }).optional().default({}),
120
+ inconsistent_error_handling: z.object({
121
+ enabled: z.boolean().optional().default(true),
122
+ max_strategies_per_type: z.number().optional().default(2),
123
+ min_occurrences: z.number().optional().default(3),
124
+ ignore_empty_catches: z.boolean().optional().default(false),
125
+ }).optional().default({}),
126
+ context_window_artifacts: z.object({
127
+ enabled: z.boolean().optional().default(true),
128
+ min_file_lines: z.number().optional().default(100),
129
+ degradation_threshold: z.number().min(0).max(1).optional().default(0.4),
130
+ signals_required: z.number().optional().default(2),
131
+ }).optional().default({}),
132
+ promise_safety: z.object({
133
+ enabled: z.boolean().optional().default(true),
134
+ check_unhandled_then: z.boolean().optional().default(true),
135
+ check_unsafe_parse: z.boolean().optional().default(true),
136
+ check_async_without_await: z.boolean().optional().default(true),
137
+ check_unsafe_fetch: z.boolean().optional().default(true),
138
+ ignore_patterns: z.array(z.string()).optional().default([]),
139
+ }).optional().default({}),
105
140
  });
106
141
  export const CommandsSchema = z.object({
107
142
  format: z.string().optional(),
@@ -122,10 +157,23 @@ export const ConfigSchema = z.object({
122
157
  ignore: z.array(z.string()).optional().default([]),
123
158
  });
124
159
  export const StatusSchema = z.enum(['PASS', 'FAIL', 'SKIP', 'ERROR']);
160
+ export const SeveritySchema = z.enum(['critical', 'high', 'medium', 'low', 'info']);
161
+ /** Provenance tags — lets dashboards/agents filter by what matters */
162
+ export const ProvenanceSchema = z.enum(['ai-drift', 'traditional', 'security', 'governance']);
163
+ /** Severity weights for score calculation */
164
+ export const SEVERITY_WEIGHTS = {
165
+ critical: 20,
166
+ high: 10,
167
+ medium: 5,
168
+ low: 2,
169
+ info: 0,
170
+ };
125
171
  export const FailureSchema = z.object({
126
172
  id: z.string(),
127
173
  title: z.string(),
128
174
  details: z.string(),
175
+ severity: SeveritySchema.optional(),
176
+ provenance: ProvenanceSchema.optional(),
129
177
  files: z.array(z.string()).optional(),
130
178
  line: z.number().optional(),
131
179
  endLine: z.number().optional(),
@@ -138,5 +186,14 @@ export const ReportSchema = z.object({
138
186
  stats: z.object({
139
187
  duration_ms: z.number(),
140
188
  score: z.number().optional(),
189
+ ai_health_score: z.number().optional(),
190
+ structural_score: z.number().optional(),
191
+ severity_breakdown: z.record(z.number()).optional(),
192
+ provenance_breakdown: z.object({
193
+ 'ai-drift': z.number(),
194
+ traditional: z.number(),
195
+ security: z.number(),
196
+ governance: z.number(),
197
+ }).optional(),
141
198
  }),
142
199
  });
package/package.json CHANGED
@@ -1,7 +1,27 @@
1
1
  {
2
2
  "name": "@rigour-labs/core",
3
- "version": "2.21.2",
3
+ "version": "3.0.0",
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
+ "license": "MIT",
6
+ "homepage": "https://rigour.run",
7
+ "keywords": [
8
+ "quality-gates",
9
+ "ai-code-quality",
10
+ "static-analysis",
11
+ "ast",
12
+ "drift-detection",
13
+ "code-review",
14
+ "linter",
15
+ "typescript",
16
+ "python",
17
+ "golang",
18
+ "csharp"
19
+ ],
4
20
  "type": "module",
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
5
25
  "main": "dist/index.js",
6
26
  "types": "dist/index.d.ts",
7
27
  "exports": {