@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.
- package/.husky/pre-push +22 -167
- package/agents/codex-adversarial.md +5 -3
- package/commands/codex-review.md +3 -5
- package/dist/audit/append.d.ts +7 -32
- package/dist/audit/append.js +7 -35
- package/dist/cli/audit.d.ts +0 -31
- package/dist/cli/audit.js +5 -74
- package/dist/cli/doctor.js +6 -16
- package/dist/cli/hook.d.ts +48 -0
- package/dist/cli/hook.js +127 -0
- package/dist/cli/index.js +5 -80
- package/dist/cli/init.js +1 -1
- package/dist/cli/install/gitignore.d.ts +2 -2
- package/dist/cli/install/gitignore.js +3 -3
- package/dist/cli/install/pre-push.d.ts +146 -271
- package/dist/cli/install/pre-push.js +471 -2633
- package/dist/cli/install/settings-merge.d.ts +17 -0
- package/dist/cli/install/settings-merge.js +48 -1
- package/dist/cli/upgrade.js +131 -3
- package/dist/config/tier-map.js +18 -25
- package/dist/hooks/push-gate/base.d.ts +57 -0
- package/dist/hooks/push-gate/base.js +77 -0
- package/dist/hooks/push-gate/codex-runner.d.ts +126 -0
- package/dist/hooks/push-gate/codex-runner.js +223 -0
- package/dist/hooks/push-gate/findings.d.ts +68 -0
- package/dist/hooks/push-gate/findings.js +142 -0
- package/dist/hooks/push-gate/halt.d.ts +28 -0
- package/dist/hooks/push-gate/halt.js +49 -0
- package/dist/hooks/push-gate/index.d.ts +90 -0
- package/dist/hooks/push-gate/index.js +351 -0
- package/dist/hooks/push-gate/policy.d.ts +41 -0
- package/dist/hooks/push-gate/policy.js +55 -0
- package/dist/hooks/push-gate/report.d.ts +89 -0
- package/dist/hooks/push-gate/report.js +140 -0
- package/dist/policy/loader.d.ts +10 -10
- package/dist/policy/loader.js +7 -6
- package/dist/policy/types.d.ts +31 -22
- package/package.json +1 -1
- package/dist/cache/review-cache.d.ts +0 -115
- package/dist/cache/review-cache.js +0 -200
- package/dist/cli/cache.d.ts +0 -84
- package/dist/cli/cache.js +0 -150
- package/dist/hooks/review-gate/args.d.ts +0 -126
- package/dist/hooks/review-gate/args.js +0 -315
- package/dist/hooks/review-gate/audit.d.ts +0 -131
- package/dist/hooks/review-gate/audit.js +0 -181
- package/dist/hooks/review-gate/banner.d.ts +0 -97
- package/dist/hooks/review-gate/banner.js +0 -172
- package/dist/hooks/review-gate/base-resolve.d.ts +0 -155
- package/dist/hooks/review-gate/base-resolve.js +0 -247
- package/dist/hooks/review-gate/cache-key.d.ts +0 -55
- package/dist/hooks/review-gate/cache-key.js +0 -41
- package/dist/hooks/review-gate/cache.d.ts +0 -108
- package/dist/hooks/review-gate/cache.js +0 -120
- package/dist/hooks/review-gate/constants.d.ts +0 -26
- package/dist/hooks/review-gate/constants.js +0 -34
- package/dist/hooks/review-gate/diff.d.ts +0 -181
- package/dist/hooks/review-gate/diff.js +0 -232
- package/dist/hooks/review-gate/errors.d.ts +0 -72
- package/dist/hooks/review-gate/errors.js +0 -100
- package/dist/hooks/review-gate/hash.d.ts +0 -43
- package/dist/hooks/review-gate/hash.js +0 -46
- package/dist/hooks/review-gate/index.d.ts +0 -31
- package/dist/hooks/review-gate/index.js +0 -35
- package/dist/hooks/review-gate/metadata.d.ts +0 -98
- package/dist/hooks/review-gate/metadata.js +0 -158
- package/dist/hooks/review-gate/policy.d.ts +0 -55
- package/dist/hooks/review-gate/policy.js +0 -71
- package/dist/hooks/review-gate/protected-paths.d.ts +0 -46
- package/dist/hooks/review-gate/protected-paths.js +0 -76
- package/hooks/_lib/push-review-core.sh +0 -1250
- package/hooks/commit-review-gate.sh +0 -330
- package/hooks/push-review-gate-git.sh +0 -94
- 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
|
-
}
|