@bookedsolid/rea 0.10.3 → 0.11.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 (74) hide show
  1. package/.husky/pre-push +22 -167
  2. package/agents/codex-adversarial.md +5 -3
  3. package/commands/codex-review.md +3 -5
  4. package/dist/audit/append.d.ts +7 -32
  5. package/dist/audit/append.js +7 -35
  6. package/dist/cli/audit.d.ts +0 -31
  7. package/dist/cli/audit.js +5 -74
  8. package/dist/cli/doctor.js +6 -16
  9. package/dist/cli/hook.d.ts +48 -0
  10. package/dist/cli/hook.js +127 -0
  11. package/dist/cli/index.js +5 -80
  12. package/dist/cli/init.js +1 -1
  13. package/dist/cli/install/gitignore.d.ts +2 -2
  14. package/dist/cli/install/gitignore.js +3 -3
  15. package/dist/cli/install/pre-push.d.ts +146 -271
  16. package/dist/cli/install/pre-push.js +471 -2633
  17. package/dist/cli/install/settings-merge.d.ts +17 -0
  18. package/dist/cli/install/settings-merge.js +48 -1
  19. package/dist/cli/upgrade.js +131 -3
  20. package/dist/config/tier-map.js +18 -25
  21. package/dist/hooks/push-gate/base.d.ts +57 -0
  22. package/dist/hooks/push-gate/base.js +77 -0
  23. package/dist/hooks/push-gate/codex-runner.d.ts +126 -0
  24. package/dist/hooks/push-gate/codex-runner.js +223 -0
  25. package/dist/hooks/push-gate/findings.d.ts +68 -0
  26. package/dist/hooks/push-gate/findings.js +142 -0
  27. package/dist/hooks/push-gate/halt.d.ts +28 -0
  28. package/dist/hooks/push-gate/halt.js +49 -0
  29. package/dist/hooks/push-gate/index.d.ts +90 -0
  30. package/dist/hooks/push-gate/index.js +351 -0
  31. package/dist/hooks/push-gate/policy.d.ts +41 -0
  32. package/dist/hooks/push-gate/policy.js +55 -0
  33. package/dist/hooks/push-gate/report.d.ts +89 -0
  34. package/dist/hooks/push-gate/report.js +140 -0
  35. package/dist/policy/loader.d.ts +10 -10
  36. package/dist/policy/loader.js +7 -6
  37. package/dist/policy/types.d.ts +31 -22
  38. package/package.json +1 -1
  39. package/dist/cache/review-cache.d.ts +0 -115
  40. package/dist/cache/review-cache.js +0 -200
  41. package/dist/cli/cache.d.ts +0 -84
  42. package/dist/cli/cache.js +0 -150
  43. package/dist/hooks/review-gate/args.d.ts +0 -126
  44. package/dist/hooks/review-gate/args.js +0 -315
  45. package/dist/hooks/review-gate/audit.d.ts +0 -131
  46. package/dist/hooks/review-gate/audit.js +0 -181
  47. package/dist/hooks/review-gate/banner.d.ts +0 -97
  48. package/dist/hooks/review-gate/banner.js +0 -172
  49. package/dist/hooks/review-gate/base-resolve.d.ts +0 -155
  50. package/dist/hooks/review-gate/base-resolve.js +0 -247
  51. package/dist/hooks/review-gate/cache-key.d.ts +0 -55
  52. package/dist/hooks/review-gate/cache-key.js +0 -41
  53. package/dist/hooks/review-gate/cache.d.ts +0 -108
  54. package/dist/hooks/review-gate/cache.js +0 -120
  55. package/dist/hooks/review-gate/constants.d.ts +0 -26
  56. package/dist/hooks/review-gate/constants.js +0 -34
  57. package/dist/hooks/review-gate/diff.d.ts +0 -181
  58. package/dist/hooks/review-gate/diff.js +0 -232
  59. package/dist/hooks/review-gate/errors.d.ts +0 -72
  60. package/dist/hooks/review-gate/errors.js +0 -100
  61. package/dist/hooks/review-gate/hash.d.ts +0 -43
  62. package/dist/hooks/review-gate/hash.js +0 -46
  63. package/dist/hooks/review-gate/index.d.ts +0 -31
  64. package/dist/hooks/review-gate/index.js +0 -35
  65. package/dist/hooks/review-gate/metadata.d.ts +0 -98
  66. package/dist/hooks/review-gate/metadata.js +0 -158
  67. package/dist/hooks/review-gate/policy.d.ts +0 -55
  68. package/dist/hooks/review-gate/policy.js +0 -71
  69. package/dist/hooks/review-gate/protected-paths.d.ts +0 -46
  70. package/dist/hooks/review-gate/protected-paths.js +0 -76
  71. package/hooks/_lib/push-review-core.sh +0 -1250
  72. package/hooks/commit-review-gate.sh +0 -330
  73. package/hooks/push-review-gate-git.sh +0 -94
  74. package/hooks/push-review-gate.sh +0 -92
@@ -1,46 +0,0 @@
1
- /**
2
- * Protected-path detection. Given a `git diff --name-status` output blob,
3
- * return true iff any change touches one of the prefixes in
4
- * `PROTECTED_PATH_PREFIXES`.
5
- *
6
- * ## Why this is a dedicated module
7
- *
8
- * The bash core uses `awk -v re='^(src/gateway/...)' '{...}'` inline in
9
- * the main gate loop (push-review-core.sh:904-923). That regex is
10
- * duplicated in `.husky/pre-push` (the native-git shim) and in at least
11
- * two places in THREAT_MODEL.md. A single TS helper with a grep-able
12
- * constant in `constants.ts` removes the drift risk.
13
- *
14
- * ## Input shape
15
- *
16
- * `git diff --name-status <merge_base>..<local_sha>` output. Each line is:
17
- * <STATUS>\t<path1>[\t<path2>]
18
- * STATUS is one letter, possibly followed by a similarity score for
19
- * rename/copy (`R100`, `C95`). STATUS letters we care about: A, C, D, M,
20
- * R, T, U — the bash core's `status !~ /^[ACDMRTU]/` filter. We match
21
- * that exactly.
22
- */
23
- /**
24
- * Parse a single `git diff --name-status` line and extract the paths that
25
- * matter for protected-path detection. Rename (`R`) and copy (`C`) lines
26
- * carry two paths separated by tabs; both are checked against the
27
- * protected-path set.
28
- *
29
- * Returns an empty array for irrelevant status letters or malformed lines.
30
- */
31
- export declare function extractPathsFromStatusLine(line: string): string[];
32
- /**
33
- * True iff `path` starts with one of the protected-path prefixes. Exported
34
- * for unit tests; callers should usually use `diffTouchesProtectedPaths`.
35
- */
36
- export declare function isProtectedPath(filePath: string): boolean;
37
- /**
38
- * True iff the given `git diff --name-status` output contains at least
39
- * one protected-path hit. Returns the set of hit paths (deduped) for
40
- * audit-record metadata.
41
- */
42
- export interface ProtectedPathScanResult {
43
- hit: boolean;
44
- paths: string[];
45
- }
46
- export declare function scanNameStatusForProtectedPaths(nameStatusOutput: string): ProtectedPathScanResult;
@@ -1,76 +0,0 @@
1
- /**
2
- * Protected-path detection. Given a `git diff --name-status` output blob,
3
- * return true iff any change touches one of the prefixes in
4
- * `PROTECTED_PATH_PREFIXES`.
5
- *
6
- * ## Why this is a dedicated module
7
- *
8
- * The bash core uses `awk -v re='^(src/gateway/...)' '{...}'` inline in
9
- * the main gate loop (push-review-core.sh:904-923). That regex is
10
- * duplicated in `.husky/pre-push` (the native-git shim) and in at least
11
- * two places in THREAT_MODEL.md. A single TS helper with a grep-able
12
- * constant in `constants.ts` removes the drift risk.
13
- *
14
- * ## Input shape
15
- *
16
- * `git diff --name-status <merge_base>..<local_sha>` output. Each line is:
17
- * <STATUS>\t<path1>[\t<path2>]
18
- * STATUS is one letter, possibly followed by a similarity score for
19
- * rename/copy (`R100`, `C95`). STATUS letters we care about: A, C, D, M,
20
- * R, T, U — the bash core's `status !~ /^[ACDMRTU]/` filter. We match
21
- * that exactly.
22
- */
23
- import { PROTECTED_PATH_PREFIXES } from './constants.js';
24
- /** Set of single-letter status codes the gate cares about. */
25
- const RELEVANT_STATUS = new Set(['A', 'C', 'D', 'M', 'R', 'T', 'U']);
26
- /**
27
- * Parse a single `git diff --name-status` line and extract the paths that
28
- * matter for protected-path detection. Rename (`R`) and copy (`C`) lines
29
- * carry two paths separated by tabs; both are checked against the
30
- * protected-path set.
31
- *
32
- * Returns an empty array for irrelevant status letters or malformed lines.
33
- */
34
- export function extractPathsFromStatusLine(line) {
35
- if (line.length === 0)
36
- return [];
37
- const parts = line.split('\t');
38
- if (parts.length < 2)
39
- return [];
40
- const status = parts[0] ?? '';
41
- if (status.length === 0)
42
- return [];
43
- const statusLetter = status[0];
44
- if (statusLetter === undefined || !RELEVANT_STATUS.has(statusLetter)) {
45
- return [];
46
- }
47
- return parts.slice(1).filter((p) => p.length > 0);
48
- }
49
- /**
50
- * True iff `path` starts with one of the protected-path prefixes. Exported
51
- * for unit tests; callers should usually use `diffTouchesProtectedPaths`.
52
- */
53
- export function isProtectedPath(filePath) {
54
- for (const prefix of PROTECTED_PATH_PREFIXES) {
55
- if (filePath.startsWith(prefix))
56
- return true;
57
- // A bare `.rea` or `hooks` path (no trailing slash) is a directory
58
- // boundary match — `.rea/audit.jsonl` passes, `my-rea.config` does
59
- // not. startsWith on the prefix-with-slash enforces that naturally.
60
- }
61
- return false;
62
- }
63
- export function scanNameStatusForProtectedPaths(nameStatusOutput) {
64
- if (nameStatusOutput.length === 0) {
65
- return { hit: false, paths: [] };
66
- }
67
- const hits = new Set();
68
- for (const line of nameStatusOutput.split('\n')) {
69
- const paths = extractPathsFromStatusLine(line);
70
- for (const p of paths) {
71
- if (isProtectedPath(p))
72
- hits.add(p);
73
- }
74
- }
75
- return { hit: hits.size > 0, paths: Array.from(hits).sort() };
76
- }