@rigour-labs/core 6.2.4 → 6.3.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 (180) hide show
  1. package/README.md +2 -0
  2. package/dist/deep/code-context.d.ts +28 -0
  3. package/dist/deep/code-context.js +93 -0
  4. package/dist/deep/code-context.test.d.ts +1 -0
  5. package/dist/deep/code-context.test.js +48 -0
  6. package/dist/deep/code-pass.d.ts +15 -0
  7. package/dist/deep/code-pass.js +44 -0
  8. package/dist/deep/code-review-prompt.d.ts +17 -0
  9. package/dist/deep/code-review-prompt.js +30 -0
  10. package/dist/deep/code-review-prompt.test.d.ts +1 -0
  11. package/dist/deep/code-review-prompt.test.js +20 -0
  12. package/dist/deep/code-verifier.d.ts +19 -0
  13. package/dist/deep/code-verifier.js +48 -0
  14. package/dist/deep/code-verifier.test.d.ts +1 -0
  15. package/dist/deep/code-verifier.test.js +46 -0
  16. package/dist/deep/fact-extractor.d.ts +7 -1
  17. package/dist/deep/fact-extractor.js +16 -8
  18. package/dist/deep/fact-extractor.test.js +34 -1
  19. package/dist/deep/facts-pass.d.ts +24 -0
  20. package/dist/deep/facts-pass.js +69 -0
  21. package/dist/deep/index.d.ts +6 -1
  22. package/dist/deep/index.js +5 -1
  23. package/dist/deep/parse-findings.d.ts +12 -0
  24. package/dist/deep/parse-findings.js +73 -0
  25. package/dist/deep/parse-findings.test.d.ts +1 -0
  26. package/dist/deep/parse-findings.test.js +25 -0
  27. package/dist/deep/prompts.d.ts +1 -1
  28. package/dist/deep/prompts.js +7 -8
  29. package/dist/deep/prompts.test.js +15 -0
  30. package/dist/discovery-signals.d.ts +27 -0
  31. package/dist/discovery-signals.js +96 -0
  32. package/dist/discovery.d.ts +1 -2
  33. package/dist/discovery.js +36 -49
  34. package/dist/discovery.test.js +84 -71
  35. package/dist/gates/context.js +7 -0
  36. package/dist/gates/deep-analysis.d.ts +33 -8
  37. package/dist/gates/deep-analysis.js +169 -306
  38. package/dist/gates/deep-analysis.test.d.ts +1 -0
  39. package/dist/gates/deep-analysis.test.js +86 -0
  40. package/dist/gates/deep-intent.d.ts +3 -0
  41. package/dist/gates/deep-intent.js +57 -0
  42. package/dist/gates/deep-intent.test.d.ts +1 -0
  43. package/dist/gates/deep-intent.test.js +51 -0
  44. package/dist/gates/deep-runner.d.ts +15 -0
  45. package/dist/gates/deep-runner.js +66 -0
  46. package/dist/gates/dependency.js +4 -0
  47. package/dist/gates/deprecated-apis-ast.d.ts +8 -0
  48. package/dist/gates/deprecated-apis-ast.js +25 -0
  49. package/dist/gates/deprecated-apis-rules-node.js +2 -8
  50. package/dist/gates/deprecated-apis.js +5 -1
  51. package/dist/gates/deprecated-apis.test.js +30 -0
  52. package/dist/gates/frontend-secret-exposure.js +5 -1
  53. package/dist/gates/frontend-secret-exposure.test.js +20 -0
  54. package/dist/gates/hallucinated-imports/framework-modules.d.ts +14 -0
  55. package/dist/gates/hallucinated-imports/framework-modules.js +75 -0
  56. package/dist/gates/hallucinated-imports/index.js +14 -6
  57. package/dist/gates/hallucinated-imports/js-resolver.d.ts +16 -12
  58. package/dist/gates/hallucinated-imports/js-resolver.js +65 -153
  59. package/dist/gates/hallucinated-imports/ts-path-target.js +16 -0
  60. package/dist/gates/hallucinated-imports/tsconfig-paths.d.ts +16 -0
  61. package/dist/gates/hallucinated-imports/tsconfig-paths.js +120 -0
  62. package/dist/gates/hallucinated-imports-sveltekit.test.d.ts +1 -0
  63. package/dist/gates/hallucinated-imports-sveltekit.test.js +108 -0
  64. package/dist/gates/logic-drift.js +7 -1
  65. package/dist/gates/runner.js +10 -40
  66. package/dist/gates/runner.test.js +37 -25
  67. package/dist/gates/scoped-gates.test.d.ts +1 -0
  68. package/dist/gates/scoped-gates.test.js +52 -0
  69. package/dist/gates/semantic-bugs.d.ts +23 -0
  70. package/dist/gates/semantic-bugs.js +48 -0
  71. package/dist/gates/semantic-bugs.test.d.ts +1 -0
  72. package/dist/gates/semantic-bugs.test.js +70 -0
  73. package/dist/gates/side-effect-analysis/index.js +11 -1
  74. package/dist/gates/side-effect-analysis.test.d.ts +1 -0
  75. package/dist/gates/side-effect-analysis.test.js +162 -0
  76. package/dist/gates/side-effect-helpers/pattern-detection.js +35 -7
  77. package/dist/gates/side-effect-helpers/resource-tracking.js +17 -10
  78. package/dist/gates/side-effect-helpers/scope-analysis.d.ts +6 -0
  79. package/dist/gates/side-effect-helpers/scope-analysis.js +20 -0
  80. package/dist/gates/style-drift.js +3 -0
  81. package/dist/index.d.ts +11 -2
  82. package/dist/index.js +10 -2
  83. package/dist/inference/http-download.d.ts +22 -0
  84. package/dist/inference/http-download.js +132 -0
  85. package/dist/inference/http-download.test.d.ts +1 -0
  86. package/dist/inference/http-download.test.js +109 -0
  87. package/dist/inference/index.d.ts +5 -1
  88. package/dist/inference/index.js +2 -1
  89. package/dist/inference/llama-engine.d.ts +27 -0
  90. package/dist/inference/llama-engine.js +152 -0
  91. package/dist/inference/llama-engine.test.d.ts +1 -0
  92. package/dist/inference/llama-engine.test.js +51 -0
  93. package/dist/inference/llama-process.d.ts +72 -0
  94. package/dist/inference/llama-process.js +126 -0
  95. package/dist/inference/llama-process.test.d.ts +1 -0
  96. package/dist/inference/llama-process.test.js +61 -0
  97. package/dist/inference/model-download.test.d.ts +1 -0
  98. package/dist/inference/model-download.test.js +73 -0
  99. package/dist/inference/model-manager.d.ts +14 -1
  100. package/dist/inference/model-manager.js +65 -80
  101. package/dist/inference/sidecar-provider.d.ts +19 -10
  102. package/dist/inference/sidecar-provider.js +125 -342
  103. package/dist/inference/types.d.ts +2 -0
  104. package/dist/semantic/ast.d.ts +29 -0
  105. package/dist/semantic/ast.js +122 -0
  106. package/dist/semantic/benchmark.d.ts +16 -0
  107. package/dist/semantic/benchmark.js +31 -0
  108. package/dist/semantic/benchmark.test.d.ts +1 -0
  109. package/dist/semantic/benchmark.test.js +18 -0
  110. package/dist/semantic/engine.d.ts +8 -0
  111. package/dist/semantic/engine.js +45 -0
  112. package/dist/semantic/intent/benchmark.d.ts +31 -0
  113. package/dist/semantic/intent/benchmark.js +74 -0
  114. package/dist/semantic/intent/intent-check.d.ts +43 -0
  115. package/dist/semantic/intent/intent-check.js +72 -0
  116. package/dist/semantic/intent/intent.test.d.ts +1 -0
  117. package/dist/semantic/intent/intent.test.js +46 -0
  118. package/dist/semantic/intent/parallel-reads.d.ts +23 -0
  119. package/dist/semantic/intent/parallel-reads.js +59 -0
  120. package/dist/semantic/learn/benchmark.d.ts +20 -0
  121. package/dist/semantic/learn/benchmark.js +71 -0
  122. package/dist/semantic/learn/compile.d.ts +4 -0
  123. package/dist/semantic/learn/compile.js +56 -0
  124. package/dist/semantic/learn/conditions.d.ts +22 -0
  125. package/dist/semantic/learn/conditions.js +93 -0
  126. package/dist/semantic/learn/extract.d.ts +30 -0
  127. package/dist/semantic/learn/extract.js +122 -0
  128. package/dist/semantic/learn/git-trees.d.ts +8 -0
  129. package/dist/semantic/learn/git-trees.js +32 -0
  130. package/dist/semantic/learn/identity.d.ts +18 -0
  131. package/dist/semantic/learn/identity.js +97 -0
  132. package/dist/semantic/learn/learn.d.ts +25 -0
  133. package/dist/semantic/learn/learn.js +109 -0
  134. package/dist/semantic/learn/learn.test.d.ts +1 -0
  135. package/dist/semantic/learn/learn.test.js +67 -0
  136. package/dist/semantic/learn/store.d.ts +4 -0
  137. package/dist/semantic/learn/store.js +39 -0
  138. package/dist/semantic/learn/types.d.ts +468 -0
  139. package/dist/semantic/learn/types.js +55 -0
  140. package/dist/semantic/origins.d.ts +42 -0
  141. package/dist/semantic/origins.js +149 -0
  142. package/dist/semantic/origins.test.d.ts +1 -0
  143. package/dist/semantic/origins.test.js +77 -0
  144. package/dist/semantic/program.d.ts +13 -0
  145. package/dist/semantic/program.js +62 -0
  146. package/dist/semantic/rules/credential-redirect.d.ts +2 -0
  147. package/dist/semantic/rules/credential-redirect.js +209 -0
  148. package/dist/semantic/rules/degraded-response-cached.d.ts +2 -0
  149. package/dist/semantic/rules/degraded-response-cached.js +271 -0
  150. package/dist/semantic/rules/in-memory-aggregation.d.ts +2 -0
  151. package/dist/semantic/rules/in-memory-aggregation.js +179 -0
  152. package/dist/semantic/summaries.d.ts +18 -0
  153. package/dist/semantic/summaries.js +33 -0
  154. package/dist/semantic/types.d.ts +32 -0
  155. package/dist/semantic/types.js +1 -0
  156. package/dist/storage/index.d.ts +1 -0
  157. package/dist/storage/index.js +1 -0
  158. package/dist/storage/team-diagnostics.d.ts +22 -0
  159. package/dist/storage/team-diagnostics.js +58 -0
  160. package/dist/storage/team-diagnostics.test.d.ts +1 -0
  161. package/dist/storage/team-diagnostics.test.js +51 -0
  162. package/dist/storage/team-schema.d.ts +6 -0
  163. package/dist/storage/team-schema.js +82 -0
  164. package/dist/storage/team-store.js +25 -72
  165. package/dist/templates/universal-config.js +4 -2
  166. package/dist/types/index.d.ts +114 -14
  167. package/dist/types/index.js +16 -2
  168. package/dist/utils/deep-status.d.ts +7 -0
  169. package/dist/utils/deep-status.js +11 -0
  170. package/dist/utils/diff.d.ts +3 -0
  171. package/dist/utils/diff.js +52 -0
  172. package/dist/utils/diff.test.d.ts +1 -0
  173. package/dist/utils/diff.test.js +38 -0
  174. package/dist/utils/scanner.js +13 -2
  175. package/dist/utils/scanner.test.js +22 -8
  176. package/dist/utils/scope.d.ts +15 -0
  177. package/dist/utils/scope.js +51 -0
  178. package/dist/utils/scope.test.d.ts +1 -0
  179. package/dist/utils/scope.test.js +38 -0
  180. package/package.json +6 -6
@@ -495,6 +495,16 @@ export declare const GatesSchema: z.ZodObject<{
495
495
  custom_patterns?: string[] | undefined;
496
496
  audit_log?: boolean | undefined;
497
497
  }>>>;
498
+ semantic_bugs: z.ZodDefault<z.ZodOptional<z.ZodObject<{
499
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
500
+ rules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
501
+ }, "strip", z.ZodTypeAny, {
502
+ enabled: boolean;
503
+ rules?: string[] | undefined;
504
+ }, {
505
+ enabled?: boolean | undefined;
506
+ rules?: string[] | undefined;
507
+ }>>>;
498
508
  side_effect_analysis: z.ZodDefault<z.ZodOptional<z.ZodObject<{
499
509
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
500
510
  check_unbounded_timers: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -573,9 +583,10 @@ export declare const GatesSchema: z.ZodObject<{
573
583
  model_name: z.ZodOptional<z.ZodString>;
574
584
  model_path: z.ZodOptional<z.ZodString>;
575
585
  threads: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
576
- max_tokens: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
586
+ max_tokens: z.ZodOptional<z.ZodNumber>;
577
587
  temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
578
- timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
588
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
589
+ intent_checks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
579
590
  checks: z.ZodDefault<z.ZodOptional<z.ZodObject<{
580
591
  solid: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
581
592
  dry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -609,9 +620,8 @@ export declare const GatesSchema: z.ZodObject<{
609
620
  pro: boolean;
610
621
  provider: string;
611
622
  threads: number;
612
- max_tokens: number;
613
623
  temperature: number;
614
- timeout_ms: number;
624
+ intent_checks: boolean;
615
625
  checks: {
616
626
  architecture: boolean;
617
627
  test_quality: boolean;
@@ -626,6 +636,8 @@ export declare const GatesSchema: z.ZodObject<{
626
636
  api_base_url?: string | undefined;
627
637
  model_name?: string | undefined;
628
638
  model_path?: string | undefined;
639
+ max_tokens?: number | undefined;
640
+ timeout_ms?: number | undefined;
629
641
  }, {
630
642
  enabled?: boolean | undefined;
631
643
  pro?: boolean | undefined;
@@ -638,6 +650,7 @@ export declare const GatesSchema: z.ZodObject<{
638
650
  max_tokens?: number | undefined;
639
651
  temperature?: number | undefined;
640
652
  timeout_ms?: number | undefined;
653
+ intent_checks?: boolean | undefined;
641
654
  checks?: {
642
655
  architecture?: boolean | undefined;
643
656
  test_quality?: boolean | undefined;
@@ -655,9 +668,8 @@ export declare const GatesSchema: z.ZodObject<{
655
668
  pro: boolean;
656
669
  provider: string;
657
670
  threads: number;
658
- max_tokens: number;
659
671
  temperature: number;
660
- timeout_ms: number;
672
+ intent_checks: boolean;
661
673
  checks: {
662
674
  architecture: boolean;
663
675
  test_quality: boolean;
@@ -672,6 +684,8 @@ export declare const GatesSchema: z.ZodObject<{
672
684
  api_base_url?: string | undefined;
673
685
  model_name?: string | undefined;
674
686
  model_path?: string | undefined;
687
+ max_tokens?: number | undefined;
688
+ timeout_ms?: number | undefined;
675
689
  };
676
690
  max_file_lines: number;
677
691
  forbid_todos: boolean;
@@ -852,6 +866,10 @@ export declare const GatesSchema: z.ZodObject<{
852
866
  custom_patterns: string[];
853
867
  audit_log: boolean;
854
868
  };
869
+ semantic_bugs: {
870
+ enabled: boolean;
871
+ rules?: string[] | undefined;
872
+ };
855
873
  side_effect_analysis: {
856
874
  enabled: boolean;
857
875
  ignore_patterns: string[];
@@ -890,6 +908,7 @@ export declare const GatesSchema: z.ZodObject<{
890
908
  max_tokens?: number | undefined;
891
909
  temperature?: number | undefined;
892
910
  timeout_ms?: number | undefined;
911
+ intent_checks?: boolean | undefined;
893
912
  checks?: {
894
913
  architecture?: boolean | undefined;
895
914
  test_quality?: boolean | undefined;
@@ -1080,6 +1099,10 @@ export declare const GatesSchema: z.ZodObject<{
1080
1099
  custom_patterns?: string[] | undefined;
1081
1100
  audit_log?: boolean | undefined;
1082
1101
  } | undefined;
1102
+ semantic_bugs?: {
1103
+ enabled?: boolean | undefined;
1104
+ rules?: string[] | undefined;
1105
+ } | undefined;
1083
1106
  side_effect_analysis?: {
1084
1107
  enabled?: boolean | undefined;
1085
1108
  ignore_patterns?: string[] | undefined;
@@ -1661,6 +1684,16 @@ export declare const ConfigSchema: z.ZodObject<{
1661
1684
  custom_patterns?: string[] | undefined;
1662
1685
  audit_log?: boolean | undefined;
1663
1686
  }>>>;
1687
+ semantic_bugs: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1688
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1689
+ rules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1690
+ }, "strip", z.ZodTypeAny, {
1691
+ enabled: boolean;
1692
+ rules?: string[] | undefined;
1693
+ }, {
1694
+ enabled?: boolean | undefined;
1695
+ rules?: string[] | undefined;
1696
+ }>>>;
1664
1697
  side_effect_analysis: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1665
1698
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1666
1699
  check_unbounded_timers: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -1739,9 +1772,10 @@ export declare const ConfigSchema: z.ZodObject<{
1739
1772
  model_name: z.ZodOptional<z.ZodString>;
1740
1773
  model_path: z.ZodOptional<z.ZodString>;
1741
1774
  threads: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1742
- max_tokens: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1775
+ max_tokens: z.ZodOptional<z.ZodNumber>;
1743
1776
  temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1744
- timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1777
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
1778
+ intent_checks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1745
1779
  checks: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1746
1780
  solid: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1747
1781
  dry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -1775,9 +1809,8 @@ export declare const ConfigSchema: z.ZodObject<{
1775
1809
  pro: boolean;
1776
1810
  provider: string;
1777
1811
  threads: number;
1778
- max_tokens: number;
1779
1812
  temperature: number;
1780
- timeout_ms: number;
1813
+ intent_checks: boolean;
1781
1814
  checks: {
1782
1815
  architecture: boolean;
1783
1816
  test_quality: boolean;
@@ -1792,6 +1825,8 @@ export declare const ConfigSchema: z.ZodObject<{
1792
1825
  api_base_url?: string | undefined;
1793
1826
  model_name?: string | undefined;
1794
1827
  model_path?: string | undefined;
1828
+ max_tokens?: number | undefined;
1829
+ timeout_ms?: number | undefined;
1795
1830
  }, {
1796
1831
  enabled?: boolean | undefined;
1797
1832
  pro?: boolean | undefined;
@@ -1804,6 +1839,7 @@ export declare const ConfigSchema: z.ZodObject<{
1804
1839
  max_tokens?: number | undefined;
1805
1840
  temperature?: number | undefined;
1806
1841
  timeout_ms?: number | undefined;
1842
+ intent_checks?: boolean | undefined;
1807
1843
  checks?: {
1808
1844
  architecture?: boolean | undefined;
1809
1845
  test_quality?: boolean | undefined;
@@ -1821,9 +1857,8 @@ export declare const ConfigSchema: z.ZodObject<{
1821
1857
  pro: boolean;
1822
1858
  provider: string;
1823
1859
  threads: number;
1824
- max_tokens: number;
1825
1860
  temperature: number;
1826
- timeout_ms: number;
1861
+ intent_checks: boolean;
1827
1862
  checks: {
1828
1863
  architecture: boolean;
1829
1864
  test_quality: boolean;
@@ -1838,6 +1873,8 @@ export declare const ConfigSchema: z.ZodObject<{
1838
1873
  api_base_url?: string | undefined;
1839
1874
  model_name?: string | undefined;
1840
1875
  model_path?: string | undefined;
1876
+ max_tokens?: number | undefined;
1877
+ timeout_ms?: number | undefined;
1841
1878
  };
1842
1879
  max_file_lines: number;
1843
1880
  forbid_todos: boolean;
@@ -2018,6 +2055,10 @@ export declare const ConfigSchema: z.ZodObject<{
2018
2055
  custom_patterns: string[];
2019
2056
  audit_log: boolean;
2020
2057
  };
2058
+ semantic_bugs: {
2059
+ enabled: boolean;
2060
+ rules?: string[] | undefined;
2061
+ };
2021
2062
  side_effect_analysis: {
2022
2063
  enabled: boolean;
2023
2064
  ignore_patterns: string[];
@@ -2056,6 +2097,7 @@ export declare const ConfigSchema: z.ZodObject<{
2056
2097
  max_tokens?: number | undefined;
2057
2098
  temperature?: number | undefined;
2058
2099
  timeout_ms?: number | undefined;
2100
+ intent_checks?: boolean | undefined;
2059
2101
  checks?: {
2060
2102
  architecture?: boolean | undefined;
2061
2103
  test_quality?: boolean | undefined;
@@ -2246,6 +2288,10 @@ export declare const ConfigSchema: z.ZodObject<{
2246
2288
  custom_patterns?: string[] | undefined;
2247
2289
  audit_log?: boolean | undefined;
2248
2290
  } | undefined;
2291
+ semantic_bugs?: {
2292
+ enabled?: boolean | undefined;
2293
+ rules?: string[] | undefined;
2294
+ } | undefined;
2249
2295
  side_effect_analysis?: {
2250
2296
  enabled?: boolean | undefined;
2251
2297
  ignore_patterns?: string[] | undefined;
@@ -2319,9 +2365,8 @@ export declare const ConfigSchema: z.ZodObject<{
2319
2365
  pro: boolean;
2320
2366
  provider: string;
2321
2367
  threads: number;
2322
- max_tokens: number;
2323
2368
  temperature: number;
2324
- timeout_ms: number;
2369
+ intent_checks: boolean;
2325
2370
  checks: {
2326
2371
  architecture: boolean;
2327
2372
  test_quality: boolean;
@@ -2336,6 +2381,8 @@ export declare const ConfigSchema: z.ZodObject<{
2336
2381
  api_base_url?: string | undefined;
2337
2382
  model_name?: string | undefined;
2338
2383
  model_path?: string | undefined;
2384
+ max_tokens?: number | undefined;
2385
+ timeout_ms?: number | undefined;
2339
2386
  };
2340
2387
  max_file_lines: number;
2341
2388
  forbid_todos: boolean;
@@ -2516,6 +2563,10 @@ export declare const ConfigSchema: z.ZodObject<{
2516
2563
  custom_patterns: string[];
2517
2564
  audit_log: boolean;
2518
2565
  };
2566
+ semantic_bugs: {
2567
+ enabled: boolean;
2568
+ rules?: string[] | undefined;
2569
+ };
2519
2570
  side_effect_analysis: {
2520
2571
  enabled: boolean;
2521
2572
  ignore_patterns: string[];
@@ -2580,6 +2631,7 @@ export declare const ConfigSchema: z.ZodObject<{
2580
2631
  max_tokens?: number | undefined;
2581
2632
  temperature?: number | undefined;
2582
2633
  timeout_ms?: number | undefined;
2634
+ intent_checks?: boolean | undefined;
2583
2635
  checks?: {
2584
2636
  architecture?: boolean | undefined;
2585
2637
  test_quality?: boolean | undefined;
@@ -2770,6 +2822,10 @@ export declare const ConfigSchema: z.ZodObject<{
2770
2822
  custom_patterns?: string[] | undefined;
2771
2823
  audit_log?: boolean | undefined;
2772
2824
  } | undefined;
2825
+ semantic_bugs?: {
2826
+ enabled?: boolean | undefined;
2827
+ rules?: string[] | undefined;
2828
+ } | undefined;
2773
2829
  side_effect_analysis?: {
2774
2830
  enabled?: boolean | undefined;
2775
2831
  ignore_patterns?: string[] | undefined;
@@ -2944,26 +3000,45 @@ export declare const ReportSchema: z.ZodObject<{
2944
3000
  }>>;
2945
3001
  deep: z.ZodOptional<z.ZodObject<{
2946
3002
  enabled: z.ZodBoolean;
3003
+ /** ok: every inference ran; partial: some failed; error: deep did not run. */
3004
+ status: z.ZodOptional<z.ZodEnum<["ok", "partial", "error"]>>;
3005
+ mode: z.ZodOptional<z.ZodEnum<["facts", "code"]>>;
2947
3006
  tier: z.ZodOptional<z.ZodEnum<["deep", "lite", "legacy", "cloud"]>>;
2948
3007
  model: z.ZodOptional<z.ZodString>;
3008
+ model_fallback: z.ZodOptional<z.ZodBoolean>;
2949
3009
  total_ms: z.ZodOptional<z.ZodNumber>;
2950
3010
  files_analyzed: z.ZodOptional<z.ZodNumber>;
3011
+ chunks_total: z.ZodOptional<z.ZodNumber>;
3012
+ chunks_failed: z.ZodOptional<z.ZodNumber>;
3013
+ error: z.ZodOptional<z.ZodString>;
2951
3014
  findings_count: z.ZodOptional<z.ZodNumber>;
2952
3015
  findings_verified: z.ZodOptional<z.ZodNumber>;
2953
3016
  }, "strip", z.ZodTypeAny, {
2954
3017
  enabled: boolean;
3018
+ status?: "ok" | "partial" | "error" | undefined;
3019
+ mode?: "code" | "facts" | undefined;
3020
+ error?: string | undefined;
2955
3021
  tier?: "deep" | "lite" | "legacy" | "cloud" | undefined;
2956
3022
  model?: string | undefined;
3023
+ model_fallback?: boolean | undefined;
2957
3024
  total_ms?: number | undefined;
2958
3025
  files_analyzed?: number | undefined;
3026
+ chunks_total?: number | undefined;
3027
+ chunks_failed?: number | undefined;
2959
3028
  findings_count?: number | undefined;
2960
3029
  findings_verified?: number | undefined;
2961
3030
  }, {
2962
3031
  enabled: boolean;
3032
+ status?: "ok" | "partial" | "error" | undefined;
3033
+ mode?: "code" | "facts" | undefined;
3034
+ error?: string | undefined;
2963
3035
  tier?: "deep" | "lite" | "legacy" | "cloud" | undefined;
2964
3036
  model?: string | undefined;
3037
+ model_fallback?: boolean | undefined;
2965
3038
  total_ms?: number | undefined;
2966
3039
  files_analyzed?: number | undefined;
3040
+ chunks_total?: number | undefined;
3041
+ chunks_failed?: number | undefined;
2967
3042
  findings_count?: number | undefined;
2968
3043
  findings_verified?: number | undefined;
2969
3044
  }>>;
@@ -2971,10 +3046,16 @@ export declare const ReportSchema: z.ZodObject<{
2971
3046
  duration_ms: number;
2972
3047
  deep?: {
2973
3048
  enabled: boolean;
3049
+ status?: "ok" | "partial" | "error" | undefined;
3050
+ mode?: "code" | "facts" | undefined;
3051
+ error?: string | undefined;
2974
3052
  tier?: "deep" | "lite" | "legacy" | "cloud" | undefined;
2975
3053
  model?: string | undefined;
3054
+ model_fallback?: boolean | undefined;
2976
3055
  total_ms?: number | undefined;
2977
3056
  files_analyzed?: number | undefined;
3057
+ chunks_total?: number | undefined;
3058
+ chunks_failed?: number | undefined;
2978
3059
  findings_count?: number | undefined;
2979
3060
  findings_verified?: number | undefined;
2980
3061
  } | undefined;
@@ -2994,10 +3075,16 @@ export declare const ReportSchema: z.ZodObject<{
2994
3075
  duration_ms: number;
2995
3076
  deep?: {
2996
3077
  enabled: boolean;
3078
+ status?: "ok" | "partial" | "error" | undefined;
3079
+ mode?: "code" | "facts" | undefined;
3080
+ error?: string | undefined;
2997
3081
  tier?: "deep" | "lite" | "legacy" | "cloud" | undefined;
2998
3082
  model?: string | undefined;
3083
+ model_fallback?: boolean | undefined;
2999
3084
  total_ms?: number | undefined;
3000
3085
  files_analyzed?: number | undefined;
3086
+ chunks_total?: number | undefined;
3087
+ chunks_failed?: number | undefined;
3001
3088
  findings_count?: number | undefined;
3002
3089
  findings_verified?: number | undefined;
3003
3090
  } | undefined;
@@ -3019,10 +3106,16 @@ export declare const ReportSchema: z.ZodObject<{
3019
3106
  duration_ms: number;
3020
3107
  deep?: {
3021
3108
  enabled: boolean;
3109
+ status?: "ok" | "partial" | "error" | undefined;
3110
+ mode?: "code" | "facts" | undefined;
3111
+ error?: string | undefined;
3022
3112
  tier?: "deep" | "lite" | "legacy" | "cloud" | undefined;
3023
3113
  model?: string | undefined;
3114
+ model_fallback?: boolean | undefined;
3024
3115
  total_ms?: number | undefined;
3025
3116
  files_analyzed?: number | undefined;
3117
+ chunks_total?: number | undefined;
3118
+ chunks_failed?: number | undefined;
3026
3119
  findings_count?: number | undefined;
3027
3120
  findings_verified?: number | undefined;
3028
3121
  } | undefined;
@@ -3061,10 +3154,16 @@ export declare const ReportSchema: z.ZodObject<{
3061
3154
  duration_ms: number;
3062
3155
  deep?: {
3063
3156
  enabled: boolean;
3157
+ status?: "ok" | "partial" | "error" | undefined;
3158
+ mode?: "code" | "facts" | undefined;
3159
+ error?: string | undefined;
3064
3160
  tier?: "deep" | "lite" | "legacy" | "cloud" | undefined;
3065
3161
  model?: string | undefined;
3162
+ model_fallback?: boolean | undefined;
3066
3163
  total_ms?: number | undefined;
3067
3164
  files_analyzed?: number | undefined;
3165
+ chunks_total?: number | undefined;
3166
+ chunks_failed?: number | undefined;
3068
3167
  findings_count?: number | undefined;
3069
3168
  findings_verified?: number | undefined;
3070
3169
  } | undefined;
@@ -3110,4 +3209,5 @@ export interface DeepOptions {
3110
3209
  modelName?: string;
3111
3210
  agents?: number;
3112
3211
  maxFiles?: number;
3212
+ focusLines?: Record<string, number[]>;
3113
3213
  }
@@ -266,6 +266,10 @@ export const GatesSchema = z.object({
266
266
  audit_log: z.boolean().optional().default(true),
267
267
  }).optional().default({}),
268
268
  // v4.3+ Side-Effect Safety Analysis
269
+ semantic_bugs: z.object({
270
+ enabled: z.boolean().optional().default(false),
271
+ rules: z.array(z.string()).optional(),
272
+ }).optional().default({}),
269
273
  side_effect_analysis: z.object({
270
274
  enabled: z.boolean().optional().default(true),
271
275
  check_unbounded_timers: z.boolean().optional().default(true),
@@ -303,9 +307,12 @@ export const GatesSchema = z.object({
303
307
  model_name: z.string().optional(), // cloud model name override (e.g. 'gpt-4o', 'claude-sonnet-4-5-20250929', 'gemini-pro')
304
308
  model_path: z.string().optional(), // custom local GGUF model path override
305
309
  threads: z.number().optional().default(4),
306
- max_tokens: z.number().optional().default(512),
310
+ max_tokens: z.number().optional(), // default per provider: local 1024, cloud 4096
307
311
  temperature: z.number().optional().default(0.1),
308
- timeout_ms: z.number().optional().default(60000),
312
+ timeout_ms: z.number().optional(), // per inference call; default per provider: local 60s, cloud 120s
313
+ // Intent questions at engine-proven sites (optional-read-no-fallback) in scoped reviews.
314
+ // Off: the stock local models failed the zero-false-finding bar (docs/DEEP_ANALYSIS.md).
315
+ intent_checks: z.boolean().optional().default(false),
309
316
  checks: z.object({
310
317
  solid: z.boolean().optional().default(true),
311
318
  dry: z.boolean().optional().default(true),
@@ -402,10 +409,17 @@ export const ReportSchema = z.object({
402
409
  }).optional(),
403
410
  deep: z.object({
404
411
  enabled: z.boolean(),
412
+ /** ok: every inference ran; partial: some failed; error: deep did not run. */
413
+ status: z.enum(['ok', 'partial', 'error']).optional(),
414
+ mode: z.enum(['facts', 'code']).optional(),
405
415
  tier: z.enum(['deep', 'lite', 'legacy', 'cloud']).optional(),
406
416
  model: z.string().optional(),
417
+ model_fallback: z.boolean().optional(),
407
418
  total_ms: z.number().optional(),
408
419
  files_analyzed: z.number().optional(),
420
+ chunks_total: z.number().optional(),
421
+ chunks_failed: z.number().optional(),
422
+ error: z.string().optional(),
409
423
  findings_count: z.number().optional(),
410
424
  findings_verified: z.number().optional(),
411
425
  }).optional(),
@@ -0,0 +1,7 @@
1
+ import type { Report } from '../types/index.js';
2
+ /**
3
+ * Why deep analysis did not run, or undefined when it ran (fully or
4
+ * partially) or was not requested. Callers use this to fail loudly instead
5
+ * of presenting an empty deep result as a clean pass.
6
+ */
7
+ export declare function deepAnalysisError(report: Pick<Report, 'stats'>): string | undefined;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Why deep analysis did not run, or undefined when it ran (fully or
3
+ * partially) or was not requested. Callers use this to fail loudly instead
4
+ * of presenting an empty deep result as a clean pass.
5
+ */
6
+ export function deepAnalysisError(report) {
7
+ const deep = report.stats.deep;
8
+ if (deep?.status !== 'error')
9
+ return undefined;
10
+ return deep.error || 'unknown error';
11
+ }
@@ -0,0 +1,3 @@
1
+ export declare function parseDiff(diff: string): Record<string, Set<number>>;
2
+ /** Changed lines as sorted arrays, the shape DeepOptions.focusLines takes. */
3
+ export declare function changedLinesByFile(mapping: Record<string, Set<number>>): Record<string, number[]>;
@@ -0,0 +1,52 @@
1
+ export function parseDiff(diff) {
2
+ const state = { mapping: {}, file: '', newLine: 0, oldLeft: 0, newLeft: 0 };
3
+ for (const line of diff.split('\n')) {
4
+ if (state.oldLeft > 0 || state.newLeft > 0)
5
+ readHunkLine(state, line);
6
+ else
7
+ readHeaderLine(state, line);
8
+ }
9
+ return state.mapping;
10
+ }
11
+ function readHunkLine(state, line) {
12
+ if (line.startsWith('\\'))
13
+ return; // ""
14
+ if (line.startsWith('-')) {
15
+ state.oldLeft--;
16
+ return;
17
+ }
18
+ if (line.startsWith('+')) {
19
+ if (state.file)
20
+ state.mapping[state.file].add(state.newLine);
21
+ }
22
+ else {
23
+ state.oldLeft--;
24
+ }
25
+ state.newLine++;
26
+ state.newLeft--;
27
+ }
28
+ function readHeaderLine(state, line) {
29
+ if (line.startsWith('diff --git ')) {
30
+ state.file = '';
31
+ }
32
+ else if (line.startsWith('+++ ')) {
33
+ state.file = line.startsWith('+++ b/') ? line.slice(6).trim() : '';
34
+ if (state.file)
35
+ state.mapping[state.file] ??= new Set();
36
+ }
37
+ else if (line.startsWith('@@')) {
38
+ readHunkHeader(state, line);
39
+ }
40
+ }
41
+ function readHunkHeader(state, line) {
42
+ const hunk = line.match(/^@@ -\d+(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
43
+ if (!hunk)
44
+ return;
45
+ state.oldLeft = hunk[1] === undefined ? 1 : parseInt(hunk[1], 10);
46
+ state.newLine = parseInt(hunk[2], 10);
47
+ state.newLeft = hunk[3] === undefined ? 1 : parseInt(hunk[3], 10);
48
+ }
49
+ /** Changed lines as sorted arrays, the shape DeepOptions.focusLines takes. */
50
+ export function changedLinesByFile(mapping) {
51
+ return Object.fromEntries(Object.entries(mapping).map(([file, lines]) => [file, [...lines].sort((a, b) => a - b)]));
52
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { changedLinesByFile, parseDiff } from './diff.js';
3
+ const lines = (m) => changedLinesByFile(m);
4
+ describe('parseDiff', () => {
5
+ it('maps added lines to new-side line numbers', () => {
6
+ const diff = [
7
+ 'diff --git a/src/a.ts b/src/a.ts',
8
+ '--- a/src/a.ts',
9
+ '+++ b/src/a.ts',
10
+ '@@ -1,3 +1,4 @@',
11
+ ' const a = 1;',
12
+ '-const b = 2;',
13
+ '+const b = 3;',
14
+ '+const c = 4;',
15
+ ' export { a };',
16
+ ].join('\n');
17
+ expect(lines(parseDiff(diff))).toEqual({ 'src/a.ts': [2, 3] });
18
+ });
19
+ it('handles several files and hunks', () => {
20
+ const diff = [
21
+ '+++ b/a.ts', '@@ -10,2 +10,3 @@', ' x', '+y', ' z',
22
+ '+++ b/b.ts', '@@ -1 +1 @@', '-old', '+new',
23
+ ].join('\n');
24
+ expect(lines(parseDiff(diff))).toEqual({ 'a.ts': [11], 'b.ts': [1] });
25
+ });
26
+ it('does not mistake content lines starting with +++ or --- for headers', () => {
27
+ const diff = ['+++ b/a.ts', '@@ -1,2 +1,3 @@', ' let i = 0;', '+++i;', '---j;', ' done();'].join('\n');
28
+ expect(lines(parseDiff(diff))).toEqual({ 'a.ts': [2] });
29
+ });
30
+ it('does not count "No newline at end of file" as a line', () => {
31
+ const diff = ['+++ b/a.ts', '@@ -1,1 +1,2 @@', ' a', '\', '+b'].join('\n');
32
+ expect(lines(parseDiff(diff))).toEqual({ 'a.ts': [2] });
33
+ });
34
+ it('ignores deleted files', () => {
35
+ const diff = ['diff --git a/gone.ts b/gone.ts', '--- a/gone.ts', '+++ /dev/null', '@@ -1,2 +0,0 @@', '-a', '-b'].join('\n');
36
+ expect(parseDiff(diff)).toEqual({});
37
+ });
38
+ });
@@ -1,6 +1,17 @@
1
1
  import { globby } from 'globby';
2
2
  import fs from 'fs-extra';
3
3
  import path from 'path';
4
+ /**
5
+ * Glob patterns use `/` as the separator and `\` as the escape character.
6
+ * Only on Windows can a backslash be a path separator, and even there one
7
+ * that escapes a glob character (`\[` in `app/\[key\]/route.ts`) must stay.
8
+ * Same rule as fast-glob's convertPathToPattern for Windows paths.
9
+ */
10
+ function toGlobSeparators(pattern) {
11
+ if (process.platform !== 'win32')
12
+ return pattern;
13
+ return pattern.replace(/\\(?![!()+@[\]{}])/g, '/');
14
+ }
4
15
  export class FileScanner {
5
16
  static DEFAULT_PATTERNS = ['**/*.{ts,tsx,js,jsx,mjs,cjs,py,go,rs,rb,cs,java,kt,css,html,md,yaml,yml,toml,json}'];
6
17
  static DEFAULT_IGNORE = [
@@ -18,9 +29,9 @@ export class FileScanner {
18
29
  'rigour-report.json'
19
30
  ];
20
31
  static async findFiles(options) {
21
- const patterns = (options.patterns || this.DEFAULT_PATTERNS).map(p => p.replace(/\\/g, '/'));
32
+ const patterns = (options.patterns || this.DEFAULT_PATTERNS).map(toGlobSeparators);
22
33
  const userIgnore = options.ignore || [];
23
- const ignore = [...new Set([...this.DEFAULT_IGNORE, ...userIgnore])].map(p => p.replace(/\\/g, '/'));
34
+ const ignore = [...new Set([...this.DEFAULT_IGNORE, ...userIgnore])].map(toGlobSeparators);
24
35
  const normalizedCwd = options.cwd.replace(/\\/g, '/');
25
36
  return globby(patterns, {
26
37
  cwd: normalizedCwd,
@@ -16,14 +16,28 @@ describe('FileScanner', () => {
16
16
  expect(ignore).toContain('**/node_modules/**');
17
17
  expect(ignore).toContain('custom-ignore');
18
18
  });
19
- it('should normalize paths to forward slashes', async () => {
20
- const options = {
21
- cwd: 'C:\\test\\path',
22
- patterns: ['**\\*.ts']
23
- };
24
- await FileScanner.findFiles(options);
25
- const call = vi.mocked(globby).mock.calls[1];
26
- expect(call[0][0]).toBe('**/*.ts');
19
+ it('should normalize Windows paths to forward slashes', async () => {
20
+ const platform = Object.getOwnPropertyDescriptor(process, 'platform');
21
+ Object.defineProperty(process, 'platform', { value: 'win32' });
22
+ try {
23
+ await FileScanner.findFiles({ cwd: 'C:\\test\\path', patterns: ['**\\*.ts', 'app\\\\[key\\]\\route.ts'] });
24
+ }
25
+ finally {
26
+ Object.defineProperty(process, 'platform', platform);
27
+ }
28
+ const call = vi.mocked(globby).mock.calls.at(-1);
29
+ expect(call[0]).toEqual(['**/*.ts', 'app/\\[key\\]/route.ts']);
27
30
  expect(call[1]?.cwd).toBe('C:/test/path');
28
31
  });
32
+ it('should keep glob escapes on POSIX', async () => {
33
+ const platform = Object.getOwnPropertyDescriptor(process, 'platform');
34
+ Object.defineProperty(process, 'platform', { value: 'linux' });
35
+ try {
36
+ await FileScanner.findFiles({ cwd: '/repo', patterns: ['src/app/\\[key\\]/route.ts'] });
37
+ }
38
+ finally {
39
+ Object.defineProperty(process, 'platform', platform);
40
+ }
41
+ expect(vi.mocked(globby).mock.calls.at(-1)[0]).toEqual(['src/app/\\[key\\]/route.ts']);
42
+ });
29
43
  });
@@ -0,0 +1,15 @@
1
+ /** Convert CLI path arguments into cwd-relative, escaped glob patterns. */
2
+ export declare function normalizeScopePatterns(cwd: string, inputs: string[]): Promise<string[]>;
3
+ /** True when a gate context carries an explicit file scope. */
4
+ export declare function isScoped(patterns: string[] | undefined): patterns is string[];
5
+ /** True when any of `files` is in the scoped file set (paths compared cwd-relative). */
6
+ export declare function touchesScope(files: string[] | undefined, scopedFiles: Set<string>): boolean;
7
+ /** The concrete cwd-relative files matched by a scoped run's patterns. */
8
+ export declare function resolveScopedFiles(cwd: string, patterns: string[], ignore?: string[]): Promise<Set<string>>;
9
+ /** True when a scoped run does not include `file` (a manifest such as package.json). */
10
+ export declare function scopeExcludes(context: {
11
+ cwd: string;
12
+ patterns?: string[];
13
+ ignore?: string[];
14
+ }, file: string): Promise<boolean>;
15
+ export declare function toPosix(p: string): string;