@rigour-labs/core 6.7.2 → 6.7.5

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 (77) hide show
  1. package/dist/hooks/index.d.ts +3 -3
  2. package/dist/hooks/index.js +2 -2
  3. package/dist/hooks/session-state.d.ts +3 -0
  4. package/dist/hooks/session-state.js +10 -0
  5. package/dist/hooks/stop-review.d.ts +8 -15
  6. package/dist/hooks/stop-review.js +36 -2
  7. package/dist/index.d.ts +4 -2
  8. package/dist/index.js +4 -2
  9. package/dist/review/backtest-init.js +13 -11
  10. package/dist/review/backtest-init.test.js +26 -2
  11. package/dist/review/backtest.js +35 -3
  12. package/dist/review/backtest.test.js +44 -2
  13. package/dist/review/dead-code.test.js +13 -0
  14. package/dist/review/orphan-files.js +3 -2
  15. package/dist/review/quiet.d.ts +1 -1
  16. package/dist/review/quiet.js +3 -1
  17. package/dist/review/review-task.d.ts +2 -6
  18. package/dist/review/review-task.js +2 -2
  19. package/dist/review/reviewer/adapters.d.ts +21 -0
  20. package/dist/review/reviewer/adapters.js +70 -15
  21. package/dist/review/reviewer/adapters.test.js +22 -0
  22. package/dist/review/reviewer/background.test.js +1 -1
  23. package/dist/review/reviewer/context.d.ts +3 -0
  24. package/dist/review/reviewer/context.js +14 -5
  25. package/dist/review/reviewer/context.test.js +26 -1
  26. package/dist/review/reviewer/exec.d.ts +9 -0
  27. package/dist/review/reviewer/exec.js +28 -1
  28. package/dist/review/reviewer/exec.test.js +38 -2
  29. package/dist/review/reviewer/inputs.d.ts +6 -0
  30. package/dist/review/reviewer/inputs.js +26 -0
  31. package/dist/review/reviewer/judge-env.d.ts +3 -0
  32. package/dist/review/reviewer/judge-env.js +10 -0
  33. package/dist/review/reviewer/prompt.js +68 -12
  34. package/dist/review/reviewer/rule-writer.d.ts +10 -0
  35. package/dist/review/reviewer/rule-writer.js +30 -0
  36. package/dist/review/reviewer/rule-writer.test.d.ts +1 -0
  37. package/dist/review/reviewer/rule-writer.test.js +52 -0
  38. package/dist/review/reviewer/settings.d.ts +4 -0
  39. package/dist/review/reviewer/settings.js +2 -1
  40. package/dist/review/reviewer/verdict.d.ts +71 -9
  41. package/dist/review/reviewer/verdict.js +102 -10
  42. package/dist/review/reviewer.d.ts +5 -2
  43. package/dist/review/reviewer.js +56 -41
  44. package/dist/review/reviewer.test.js +170 -17
  45. package/dist/review/typed/constant-inputs.d.ts +35 -0
  46. package/dist/review/typed/constant-inputs.js +168 -0
  47. package/dist/review/typed/dead-null-guards.d.ts +34 -0
  48. package/dist/review/typed/dead-null-guards.js +147 -0
  49. package/dist/review/typed/redundancy.js +6 -0
  50. package/dist/review/typed/redundancy.test.js +136 -0
  51. package/dist/review/unused-exports.js +3 -2
  52. package/dist/review-learning/acted-on.d.ts +23 -3
  53. package/dist/review-learning/acted-on.js +25 -13
  54. package/dist/review-learning/human-edits.d.ts +7 -0
  55. package/dist/review-learning/human-edits.js +99 -0
  56. package/dist/review-learning/human-edits.test.d.ts +1 -0
  57. package/dist/review-learning/human-edits.test.js +47 -0
  58. package/dist/review-learning/learn-from-reviews.d.ts +37 -4
  59. package/dist/review-learning/learn-from-reviews.js +128 -12
  60. package/dist/review-learning/lessons.d.ts +62 -9
  61. package/dist/review-learning/lessons.js +132 -21
  62. package/dist/review-learning/outcomes.d.ts +26 -0
  63. package/dist/review-learning/outcomes.js +73 -0
  64. package/dist/review-learning/review-learning.test.js +158 -22
  65. package/dist/review-learning/review-points.d.ts +4 -0
  66. package/dist/review-learning/review-points.js +14 -0
  67. package/dist/review-learning/rules-from-reviews.d.ts +14 -0
  68. package/dist/review-learning/rules-from-reviews.js +86 -0
  69. package/dist/review-learning/team-lessons.d.ts +17 -1
  70. package/dist/review-learning/team-lessons.js +29 -5
  71. package/dist/templates/universal-config.js +3 -0
  72. package/dist/types/index.d.ts +63 -0
  73. package/dist/types/index.js +11 -0
  74. package/dist/utils/profile.d.ts +5 -1
  75. package/dist/utils/profile.js +7 -1
  76. package/dist/utils/profile.test.js +10 -0
  77. package/package.json +6 -6
@@ -426,12 +426,15 @@ export declare const GatesSchema: z.ZodObject<{
426
426
  unused_exports: z.ZodDefault<z.ZodOptional<z.ZodObject<{
427
427
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
428
428
  allow: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
429
+ block: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
429
430
  }, "strip", z.ZodTypeAny, {
430
431
  enabled: boolean;
431
432
  allow: string[];
433
+ block: boolean;
432
434
  }, {
433
435
  enabled?: boolean | undefined;
434
436
  allow?: string[] | undefined;
437
+ block?: boolean | undefined;
435
438
  }>>>;
436
439
  /** Query shapes that cost production: offset paging in a loop, a time window with no upper bound (review/query-patterns.ts). */
437
440
  query_patterns: z.ZodDefault<z.ZodOptional<z.ZodObject<{
@@ -490,12 +493,15 @@ export declare const GatesSchema: z.ZodObject<{
490
493
  orphan_files: z.ZodDefault<z.ZodOptional<z.ZodObject<{
491
494
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
492
495
  allow: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
496
+ block: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
493
497
  }, "strip", z.ZodTypeAny, {
494
498
  enabled: boolean;
495
499
  allow: string[];
500
+ block: boolean;
496
501
  }, {
497
502
  enabled?: boolean | undefined;
498
503
  allow?: string[] | undefined;
504
+ block?: boolean | undefined;
499
505
  }>>>;
500
506
  migration_order: z.ZodDefault<z.ZodOptional<z.ZodObject<{
501
507
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -867,6 +873,7 @@ export declare const GatesSchema: z.ZodObject<{
867
873
  unused_exports: {
868
874
  enabled: boolean;
869
875
  allow: string[];
876
+ block: boolean;
870
877
  };
871
878
  query_patterns: {
872
879
  enabled: boolean;
@@ -888,6 +895,7 @@ export declare const GatesSchema: z.ZodObject<{
888
895
  orphan_files: {
889
896
  enabled: boolean;
890
897
  allow: string[];
898
+ block: boolean;
891
899
  };
892
900
  migration_order: {
893
901
  enabled: boolean;
@@ -1104,6 +1112,7 @@ export declare const GatesSchema: z.ZodObject<{
1104
1112
  unused_exports?: {
1105
1113
  enabled?: boolean | undefined;
1106
1114
  allow?: string[] | undefined;
1115
+ block?: boolean | undefined;
1107
1116
  } | undefined;
1108
1117
  query_patterns?: {
1109
1118
  enabled?: boolean | undefined;
@@ -1125,6 +1134,7 @@ export declare const GatesSchema: z.ZodObject<{
1125
1134
  orphan_files?: {
1126
1135
  enabled?: boolean | undefined;
1127
1136
  allow?: string[] | undefined;
1137
+ block?: boolean | undefined;
1128
1138
  } | undefined;
1129
1139
  migration_order?: {
1130
1140
  enabled?: boolean | undefined;
@@ -1630,12 +1640,15 @@ export declare const ConfigSchema: z.ZodObject<{
1630
1640
  unused_exports: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1631
1641
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1632
1642
  allow: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1643
+ block: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1633
1644
  }, "strip", z.ZodTypeAny, {
1634
1645
  enabled: boolean;
1635
1646
  allow: string[];
1647
+ block: boolean;
1636
1648
  }, {
1637
1649
  enabled?: boolean | undefined;
1638
1650
  allow?: string[] | undefined;
1651
+ block?: boolean | undefined;
1639
1652
  }>>>;
1640
1653
  /** Query shapes that cost production: offset paging in a loop, a time window with no upper bound (review/query-patterns.ts). */
1641
1654
  query_patterns: z.ZodDefault<z.ZodOptional<z.ZodObject<{
@@ -1694,12 +1707,15 @@ export declare const ConfigSchema: z.ZodObject<{
1694
1707
  orphan_files: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1695
1708
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1696
1709
  allow: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1710
+ block: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1697
1711
  }, "strip", z.ZodTypeAny, {
1698
1712
  enabled: boolean;
1699
1713
  allow: string[];
1714
+ block: boolean;
1700
1715
  }, {
1701
1716
  enabled?: boolean | undefined;
1702
1717
  allow?: string[] | undefined;
1718
+ block?: boolean | undefined;
1703
1719
  }>>>;
1704
1720
  migration_order: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1705
1721
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -2071,6 +2087,7 @@ export declare const ConfigSchema: z.ZodObject<{
2071
2087
  unused_exports: {
2072
2088
  enabled: boolean;
2073
2089
  allow: string[];
2090
+ block: boolean;
2074
2091
  };
2075
2092
  query_patterns: {
2076
2093
  enabled: boolean;
@@ -2092,6 +2109,7 @@ export declare const ConfigSchema: z.ZodObject<{
2092
2109
  orphan_files: {
2093
2110
  enabled: boolean;
2094
2111
  allow: string[];
2112
+ block: boolean;
2095
2113
  };
2096
2114
  migration_order: {
2097
2115
  enabled: boolean;
@@ -2308,6 +2326,7 @@ export declare const ConfigSchema: z.ZodObject<{
2308
2326
  unused_exports?: {
2309
2327
  enabled?: boolean | undefined;
2310
2328
  allow?: string[] | undefined;
2329
+ block?: boolean | undefined;
2311
2330
  } | undefined;
2312
2331
  query_patterns?: {
2313
2332
  enabled?: boolean | undefined;
@@ -2329,6 +2348,7 @@ export declare const ConfigSchema: z.ZodObject<{
2329
2348
  orphan_files?: {
2330
2349
  enabled?: boolean | undefined;
2331
2350
  allow?: string[] | undefined;
2351
+ block?: boolean | undefined;
2332
2352
  } | undefined;
2333
2353
  migration_order?: {
2334
2354
  enabled?: boolean | undefined;
@@ -2437,6 +2457,17 @@ export declare const ConfigSchema: z.ZodObject<{
2437
2457
  escalate: z.ZodDefault<z.ZodOptional<z.ZodEnum<["always", "risk"]>>>;
2438
2458
  /** A model per reviewer name for cross-examination (a narrow verification task), e.g. { claude: "haiku" }. */
2439
2459
  cross_models: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
2460
+ /**
2461
+ * Environment variables a judge's CLI must not see, per reviewer name, e.g. { codex: { unset: [OPENAI_API_KEY] } }
2462
+ * when that variable holds a key meant for another service. RIGOUR_API_KEY is never passed to a judge.
2463
+ */
2464
+ judge_env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2465
+ unset: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
2466
+ }, "strip", z.ZodTypeAny, {
2467
+ unset: string[];
2468
+ }, {
2469
+ unset?: string[] | undefined;
2470
+ }>>>>;
2440
2471
  }, "strip", z.ZodTypeAny, {
2441
2472
  enabled: boolean;
2442
2473
  mode: "single" | "cross" | "full";
@@ -2451,6 +2482,9 @@ export declare const ConfigSchema: z.ZodObject<{
2451
2482
  judges: 2 | 3;
2452
2483
  escalate: "always" | "risk";
2453
2484
  cross_models: Record<string, string>;
2485
+ judge_env: Record<string, {
2486
+ unset: string[];
2487
+ }>;
2454
2488
  model?: string | undefined;
2455
2489
  max_runs_per_day?: number | undefined;
2456
2490
  max_usd_per_day?: number | undefined;
@@ -2471,6 +2505,9 @@ export declare const ConfigSchema: z.ZodObject<{
2471
2505
  judges?: 2 | 3 | undefined;
2472
2506
  escalate?: "always" | "risk" | undefined;
2473
2507
  cross_models?: Record<string, string> | undefined;
2508
+ judge_env?: Record<string, {
2509
+ unset?: string[] | undefined;
2510
+ }> | undefined;
2474
2511
  }>>>;
2475
2512
  }, "strip", z.ZodTypeAny, {
2476
2513
  include_heuristics: boolean;
@@ -2489,6 +2526,9 @@ export declare const ConfigSchema: z.ZodObject<{
2489
2526
  judges: 2 | 3;
2490
2527
  escalate: "always" | "risk";
2491
2528
  cross_models: Record<string, string>;
2529
+ judge_env: Record<string, {
2530
+ unset: string[];
2531
+ }>;
2492
2532
  model?: string | undefined;
2493
2533
  max_runs_per_day?: number | undefined;
2494
2534
  max_usd_per_day?: number | undefined;
@@ -2515,6 +2555,9 @@ export declare const ConfigSchema: z.ZodObject<{
2515
2555
  judges?: 2 | 3 | undefined;
2516
2556
  escalate?: "always" | "risk" | undefined;
2517
2557
  cross_models?: Record<string, string> | undefined;
2558
+ judge_env?: Record<string, {
2559
+ unset?: string[] | undefined;
2560
+ }> | undefined;
2518
2561
  } | undefined;
2519
2562
  }>>>;
2520
2563
  ignore: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
@@ -2708,6 +2751,7 @@ export declare const ConfigSchema: z.ZodObject<{
2708
2751
  unused_exports: {
2709
2752
  enabled: boolean;
2710
2753
  allow: string[];
2754
+ block: boolean;
2711
2755
  };
2712
2756
  query_patterns: {
2713
2757
  enabled: boolean;
@@ -2729,6 +2773,7 @@ export declare const ConfigSchema: z.ZodObject<{
2729
2773
  orphan_files: {
2730
2774
  enabled: boolean;
2731
2775
  allow: string[];
2776
+ block: boolean;
2732
2777
  };
2733
2778
  migration_order: {
2734
2779
  enabled: boolean;
@@ -2787,6 +2832,9 @@ export declare const ConfigSchema: z.ZodObject<{
2787
2832
  judges: 2 | 3;
2788
2833
  escalate: "always" | "risk";
2789
2834
  cross_models: Record<string, string>;
2835
+ judge_env: Record<string, {
2836
+ unset: string[];
2837
+ }>;
2790
2838
  model?: string | undefined;
2791
2839
  max_runs_per_day?: number | undefined;
2792
2840
  max_usd_per_day?: number | undefined;
@@ -2987,6 +3035,7 @@ export declare const ConfigSchema: z.ZodObject<{
2987
3035
  unused_exports?: {
2988
3036
  enabled?: boolean | undefined;
2989
3037
  allow?: string[] | undefined;
3038
+ block?: boolean | undefined;
2990
3039
  } | undefined;
2991
3040
  query_patterns?: {
2992
3041
  enabled?: boolean | undefined;
@@ -3008,6 +3057,7 @@ export declare const ConfigSchema: z.ZodObject<{
3008
3057
  orphan_files?: {
3009
3058
  enabled?: boolean | undefined;
3010
3059
  allow?: string[] | undefined;
3060
+ block?: boolean | undefined;
3011
3061
  } | undefined;
3012
3062
  migration_order?: {
3013
3063
  enabled?: boolean | undefined;
@@ -3070,6 +3120,9 @@ export declare const ConfigSchema: z.ZodObject<{
3070
3120
  judges?: 2 | 3 | undefined;
3071
3121
  escalate?: "always" | "risk" | undefined;
3072
3122
  cross_models?: Record<string, string> | undefined;
3123
+ judge_env?: Record<string, {
3124
+ unset?: string[] | undefined;
3125
+ }> | undefined;
3073
3126
  } | undefined;
3074
3127
  } | undefined;
3075
3128
  }>;
@@ -3106,6 +3159,8 @@ export declare const FailureSchema: z.ZodObject<{
3106
3159
  source: z.ZodOptional<z.ZodEnum<["ast", "llm", "hybrid"]>>;
3107
3160
  category: z.ZodOptional<z.ZodString>;
3108
3161
  verified: z.ZodOptional<z.ZodBoolean>;
3162
+ /** A proven check the team keeps as a note (its `block: false`): shown, never blocking. */
3163
+ advisory: z.ZodOptional<z.ZodBoolean>;
3109
3164
  }, "strip", z.ZodTypeAny, {
3110
3165
  id: string;
3111
3166
  title: string;
@@ -3121,6 +3176,7 @@ export declare const FailureSchema: z.ZodObject<{
3121
3176
  confidence?: number | undefined;
3122
3177
  source?: "ast" | "llm" | "hybrid" | undefined;
3123
3178
  category?: string | undefined;
3179
+ advisory?: boolean | undefined;
3124
3180
  }, {
3125
3181
  id: string;
3126
3182
  title: string;
@@ -3136,6 +3192,7 @@ export declare const FailureSchema: z.ZodObject<{
3136
3192
  confidence?: number | undefined;
3137
3193
  source?: "ast" | "llm" | "hybrid" | undefined;
3138
3194
  category?: string | undefined;
3195
+ advisory?: boolean | undefined;
3139
3196
  }>;
3140
3197
  export type Failure = z.infer<typeof FailureSchema>;
3141
3198
  export declare const ReportSchema: z.ZodObject<{
@@ -3157,6 +3214,8 @@ export declare const ReportSchema: z.ZodObject<{
3157
3214
  source: z.ZodOptional<z.ZodEnum<["ast", "llm", "hybrid"]>>;
3158
3215
  category: z.ZodOptional<z.ZodString>;
3159
3216
  verified: z.ZodOptional<z.ZodBoolean>;
3217
+ /** A proven check the team keeps as a note (its `block: false`): shown, never blocking. */
3218
+ advisory: z.ZodOptional<z.ZodBoolean>;
3160
3219
  }, "strip", z.ZodTypeAny, {
3161
3220
  id: string;
3162
3221
  title: string;
@@ -3172,6 +3231,7 @@ export declare const ReportSchema: z.ZodObject<{
3172
3231
  confidence?: number | undefined;
3173
3232
  source?: "ast" | "llm" | "hybrid" | undefined;
3174
3233
  category?: string | undefined;
3234
+ advisory?: boolean | undefined;
3175
3235
  }, {
3176
3236
  id: string;
3177
3237
  title: string;
@@ -3187,6 +3247,7 @@ export declare const ReportSchema: z.ZodObject<{
3187
3247
  confidence?: number | undefined;
3188
3248
  source?: "ast" | "llm" | "hybrid" | undefined;
3189
3249
  category?: string | undefined;
3250
+ advisory?: boolean | undefined;
3190
3251
  }>, "many">;
3191
3252
  stats: z.ZodObject<{
3192
3253
  duration_ms: z.ZodNumber;
@@ -3464,6 +3525,7 @@ export declare const ReportSchema: z.ZodObject<{
3464
3525
  confidence?: number | undefined;
3465
3526
  source?: "ast" | "llm" | "hybrid" | undefined;
3466
3527
  category?: string | undefined;
3528
+ advisory?: boolean | undefined;
3467
3529
  }[];
3468
3530
  }, {
3469
3531
  stats: {
@@ -3527,6 +3589,7 @@ export declare const ReportSchema: z.ZodObject<{
3527
3589
  confidence?: number | undefined;
3528
3590
  source?: "ast" | "llm" | "hybrid" | undefined;
3529
3591
  category?: string | undefined;
3592
+ advisory?: boolean | undefined;
3530
3593
  }[];
3531
3594
  }>;
3532
3595
  export type Report = z.infer<typeof ReportSchema>;
@@ -251,6 +251,8 @@ export const GatesSchema = z.object({
251
251
  unused_exports: z.object({
252
252
  enabled: z.boolean().optional().default(true),
253
253
  allow: z.array(z.string()).optional().default([]), // export names a tool loads by name
254
+ // Block on them. Off by default: teams routinely approve exports kept for tests or for a signature; a team whose reviewers block on them turns it on.
255
+ block: z.boolean().optional().default(false),
254
256
  }).optional().default({}),
255
257
  /** Query shapes that cost production: offset paging in a loop, a time window with no upper bound (review/query-patterns.ts). */
256
258
  query_patterns: z.object({ enabled: z.boolean().optional().default(true) }).optional().default({}),
@@ -277,6 +279,8 @@ export const GatesSchema = z.object({
277
279
  orphan_files: z.object({
278
280
  enabled: z.boolean().optional().default(true),
279
281
  allow: z.array(z.string()).optional().default([]), // globs for files a tool loads by path
282
+ // Block on them. Off by default, like unused_exports.block: a team whose reviewers block on dead files turns it on.
283
+ block: z.boolean().optional().default(false),
280
284
  }).optional().default({}),
281
285
  migration_order: z.object({
282
286
  enabled: z.boolean().optional().default(false),
@@ -419,6 +423,11 @@ export const ConfigSchema = z.object({
419
423
  escalate: z.enum(['always', 'risk']).optional().default('always'),
420
424
  /** A model per reviewer name for cross-examination (a narrow verification task), e.g. { claude: "haiku" }. */
421
425
  cross_models: z.record(ModelName).optional().default({}),
426
+ /**
427
+ * Environment variables a judge's CLI must not see, per reviewer name, e.g. { codex: { unset: [OPENAI_API_KEY] } }
428
+ * when that variable holds a key meant for another service. RIGOUR_API_KEY is never passed to a judge.
429
+ */
430
+ judge_env: z.record(z.object({ unset: z.array(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'an environment variable name')).optional().default([]) })).optional().default({}),
422
431
  }).optional().default({}),
423
432
  }).optional().default({}),
424
433
  ignore: z.array(z.string()).optional().default([]),
@@ -452,6 +461,8 @@ export const FailureSchema = z.object({
452
461
  source: z.enum(['ast', 'llm', 'hybrid']).optional(), // Finding source
453
462
  category: z.string().optional(), // e.g. 'srp_violation', 'god_function'
454
463
  verified: z.boolean().optional(), // AST-verified LLM finding
464
+ /** A proven check the team keeps as a note (its `block: false`): shown, never blocking. */
465
+ advisory: z.boolean().optional(),
455
466
  });
456
467
  export const ReportSchema = z.object({
457
468
  status: StatusSchema,
@@ -22,7 +22,11 @@ export declare function readProfiles(): RigourProfile[];
22
22
  export declare function writeProfiles(profiles: RigourProfile[]): void;
23
23
  /** The first profile whose match fits `cwd`, by path or by origin remote. */
24
24
  export declare function profileFor(cwd: string, profiles?: RigourProfile[]): RigourProfile | undefined;
25
- /** Apply the profile for `cwd` to this process's environment; returns it, or undefined when none matches. */
25
+ /**
26
+ * Apply the profile for `cwd` to this process's environment; returns it, or undefined when none matches.
27
+ * A RIGOUR_HOME you set yourself (not one a profile set: RIGOUR_PROFILE is unset) is a home you chose, so
28
+ * no profile replaces it or brings its team: an isolated run stays isolated.
29
+ */
26
30
  export declare function applyProfile(cwd: string, profiles?: RigourProfile[]): RigourProfile | undefined;
27
31
  /** Why this process must not act for `cwd` (it belongs to another profile than the one applied at start), or null. */
28
32
  export declare function profileMismatch(cwd: string, profiles?: RigourProfile[]): string | null;
@@ -44,8 +44,14 @@ export function profileFor(cwd, profiles = readProfiles()) {
44
44
  ? !!remote && remoteMatches(remote, entry)
45
45
  : isInside(where, real(expandHome(entry)))));
46
46
  }
47
- /** Apply the profile for `cwd` to this process's environment; returns it, or undefined when none matches. */
47
+ /**
48
+ * Apply the profile for `cwd` to this process's environment; returns it, or undefined when none matches.
49
+ * A RIGOUR_HOME you set yourself (not one a profile set: RIGOUR_PROFILE is unset) is a home you chose, so
50
+ * no profile replaces it or brings its team: an isolated run stays isolated.
51
+ */
48
52
  export function applyProfile(cwd, profiles) {
53
+ if (process.env.RIGOUR_HOME && !process.env.RIGOUR_PROFILE)
54
+ return undefined;
49
55
  const profile = profileFor(cwd, profiles);
50
56
  if (!profile)
51
57
  return undefined;
@@ -33,6 +33,7 @@ describe('profiles', () => {
33
33
  });
34
34
  it("applies the profile's home and team, clearing team settings inherited from the shell", () => {
35
35
  const dir = repo('work/acme/api');
36
+ delete process.env.RIGOUR_HOME; // no home of your own: the profile chooses it
36
37
  process.env.RIGOUR_TEAM_DATABASE_URL = 'postgres://other-org';
37
38
  process.env.RIGOUR_ORGANIZATION_ID = 'other-org';
38
39
  applyProfile(dir, [{ name: 'acme', match: [path.join(root, 'work/acme')], home: path.join(root, 'acme-home'), githubAccount: 'acme-dev' }]);
@@ -44,6 +45,15 @@ describe('profiles', () => {
44
45
  applyProfile(dir, [{ name: 'acme', match: [dir], team: { organization: 'acme', team: 'web', actor: 'dev', repositories: ['github.com/acme/*'], databaseUrlCommand: 'echo url' } }]);
45
46
  expect([process.env.RIGOUR_ORGANIZATION_ID, process.env.RIGOUR_TEAM_REPOSITORIES, process.env.RIGOUR_TEAM_DATABASE_URL_COMMAND]).toEqual(['acme', 'github.com/acme/*', 'echo url']);
46
47
  });
48
+ it('leaves a RIGOUR_HOME you set yourself alone: no profile replaces it or brings its team', () => {
49
+ const dir = repo('work/acme/api');
50
+ delete process.env.RIGOUR_PROFILE;
51
+ process.env.RIGOUR_HOME = path.join(root, 'isolated');
52
+ const applied = applyProfile(dir, [{ name: 'acme', match: [path.join(root, 'work/acme')], home: path.join(root, 'acme-home'), team: { organization: 'acme', team: 'web', actor: 'dev' } }]);
53
+ expect(applied).toBeUndefined();
54
+ expect(process.env.RIGOUR_HOME).toBe(path.join(root, 'isolated'));
55
+ expect(process.env.RIGOUR_ORGANIZATION_ID).toBeUndefined();
56
+ });
47
57
  it('refuses to act for a repository of another profile than the one the process started with', () => {
48
58
  const acme = repo('work/acme/api');
49
59
  const mine = repo('personal/tool');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigour-labs/core",
3
- "version": "6.7.2",
3
+ "version": "6.7.5",
4
4
  "description": "Rigour's review engine: deterministic gates on changed lines, rules and lessons learned from your team's fixes, and per-check precision from what you fix versus dismiss, across TypeScript, JavaScript, Python, Go, Ruby and C#.",
5
5
  "engines": {
6
6
  "node": ">=22.13"
@@ -72,11 +72,11 @@
72
72
  "@anthropic-ai/sdk": "^0.30.1",
73
73
  "pg": "^8.16.3",
74
74
  "openai": "^5.23.2",
75
- "@rigour-labs/brain-darwin-x64": "6.7.2",
76
- "@rigour-labs/brain-linux-x64": "6.7.2",
77
- "@rigour-labs/brain-win-x64": "6.7.2",
78
- "@rigour-labs/brain-darwin-arm64": "6.7.2",
79
- "@rigour-labs/brain-linux-arm64": "6.7.2"
75
+ "@rigour-labs/brain-darwin-x64": "6.7.5",
76
+ "@rigour-labs/brain-linux-arm64": "6.7.5",
77
+ "@rigour-labs/brain-win-x64": "6.7.5",
78
+ "@rigour-labs/brain-darwin-arm64": "6.7.5",
79
+ "@rigour-labs/brain-linux-x64": "6.7.5"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@types/fs-extra": "^11.0.4",