rungate 0.8.1 → 0.8.3
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/bin/rungate.ts +11 -6
- package/config/prove-evidence.schema.json +21 -3
- package/gates/.gate-salt +1 -1
- package/gates/gate-executor.ts +153 -1
- package/gates/prove.test.ts +12 -6
- package/gates/schema.ts +69 -6
- package/gates/workflow.test.ts +12 -5
- package/hooks/BashWriteGuard.hook.ts +19 -0
- package/hooks/DocHygiene.hook.ts +2 -1
- package/hooks/GateResultProtection.hook.ts +28 -7
- package/hooks/HookCurrency.hook.ts +48 -1
- package/hooks/VerifyPhaseLock.hook.ts +68 -11
- package/hooks/WorkflowStateGuard.hook.ts +24 -7
- package/lib/ai-review-jury.ts +725 -0
- package/lib/ai-review-rounds.ts +1249 -0
- package/lib/ai-review-unmeasured.ts +361 -0
- package/lib/bash-file-read.ts +17 -3
- package/lib/bash-write-guard.ts +2165 -51
- package/lib/cli-commands.ts +252 -11
- package/lib/closing-reference-audit.ts +163 -0
- package/lib/conformity.ts +12 -0
- package/lib/create-sc.ts +45 -12
- package/lib/derived-spec.ts +206 -0
- package/lib/distribution-standing.ts +75 -4
- package/lib/failure-intake.ts +12 -4
- package/lib/file-claims.ts +335 -0
- package/lib/file-extensions.ts +81 -0
- package/lib/finding-arbiter.ts +1489 -0
- package/lib/finding-jury.ts +584 -0
- package/lib/finding-pr-routing.ts +333 -0
- package/lib/frontmatter.ts +16 -0
- package/lib/gate-check-audit.ts +259 -0
- package/lib/generators/agents-md.ts +29 -0
- package/lib/github.ts +160 -0
- package/lib/hook-tree-currency.ts +494 -0
- package/lib/interpreters.ts +64 -0
- package/lib/issue-closure-audit.ts +161 -14
- package/lib/issue-create-override.ts +122 -11
- package/lib/issue-filing-gate.ts +1602 -0
- package/lib/local-review-rounds.ts +523 -0
- package/lib/organize.ts +10 -0
- package/lib/project-state-shape.ts +56 -5
- package/lib/publish-window.ts +287 -0
- package/lib/repo-path.ts +94 -0
- package/lib/report-provenance.ts +65 -3
- package/lib/risk-tier.ts +302 -0
- package/lib/rounds-to-pass.ts +274 -0
- package/lib/rule-row-drift.ts +199 -0
- package/lib/sc-claim-forms.ts +33 -5
- package/lib/sc-guard.ts +11 -1
- package/lib/sc-id-cross-tree.ts +17 -2
- package/lib/sc-ids.ts +71 -6
- package/lib/sc-reservations.ts +158 -14
- package/lib/scaffold/ai-review-findings.ts +1157 -18
- package/lib/scaffold/ai-review-step.ts +4672 -85
- package/lib/scaffold/ai-review-unmeasured-workflow.ts +243 -0
- package/lib/scaffold/managed-workflow.ts +163 -4
- package/lib/scaffold/owned-files.ts +14 -0
- package/lib/scaffold/steps.ts +462 -108
- package/lib/scanner.ts +10 -3
- package/lib/scratch-roots.ts +93 -3
- package/lib/spec-updater.ts +16 -0
- package/lib/ticked-sc-symbols.ts +361 -0
- package/lib/validators/spec-validators.ts +28 -2
- package/lib/workflow-actions.ts +18 -0
- package/package.json +3 -1
- package/scripts/ai-review-findings.ts +41 -1
- package/scripts/arbitrate-finding.ts +542 -0
- package/scripts/audit-specs.ts +225 -23
- package/scripts/create-sc.ts +11 -0
- package/scripts/detect-sc-drift.ts +10 -2
- package/scripts/generate-code-map.ts +6 -3
- package/scripts/record-ai-review-unmeasured.ts +370 -0
- package/scripts/split-spec.ts +12 -0
- package/scripts/sync-sc-status.ts +93 -8
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The file extensions under a directory (#1200).
|
|
3
|
+
*
|
|
4
|
+
* A LEAF module, in the shape `lib/local-calendar-day.ts` and
|
|
5
|
+
* `lib/readdir-sorted.ts` established: one exported binding, no relative
|
|
6
|
+
* imports, so there is exactly one thing to mutate and every call site names
|
|
7
|
+
* the same rule.
|
|
8
|
+
*
|
|
9
|
+
* ## Why this exists
|
|
10
|
+
*
|
|
11
|
+
* This was four lines, copied into all three of the scanners that build
|
|
12
|
+
* CODE-MAP.md's `## Directory Structure` table —
|
|
13
|
+
* `scripts/generate-code-map.ts`, `lib/scanner.ts` and
|
|
14
|
+
* `generateCodeMapInline` in `lib/scaffold/steps.ts`:
|
|
15
|
+
*
|
|
16
|
+
* const files = readdirSync(full, { recursive: true }).map(String);
|
|
17
|
+
* const exts = new Set(files.map(f => f.split(".").pop()).filter(Boolean));
|
|
18
|
+
* dirs.push({ name: entry, types: [...exts].slice(0, 5) });
|
|
19
|
+
*
|
|
20
|
+
* Every clause of that is wrong, and the shipped `CODE-MAP.md` said so:
|
|
21
|
+
*
|
|
22
|
+
* | test/ | ts, unit, types, json, fixtures |
|
|
23
|
+
* | evals/ | marcus-tdd-order, marcus-tdd-vs-speed, marcus-surgical, … |
|
|
24
|
+
* | scripts/| ts, sh, git-hooks, lib, git-hooks/pre-push |
|
|
25
|
+
*
|
|
26
|
+
* - `readdirSync(…, { recursive: true })` returns **directories as well as
|
|
27
|
+
* files**, and `"unit".split(".").pop()` is `"unit"`. So every
|
|
28
|
+
* extensionless entry — every directory, every `LICENSE`, every
|
|
29
|
+
* `Makefile` — contributed its own name as a "type", and not one entry in
|
|
30
|
+
* the `evals/` row was a file type.
|
|
31
|
+
* - Without `withFileTypes` the strings are **relative paths**, so the split
|
|
32
|
+
* ran on `git-hooks/pre-push` rather than on a basename.
|
|
33
|
+
* - A leading dot does not open an extension. `.gitignore` yielded
|
|
34
|
+
* `gitignore`.
|
|
35
|
+
* - `.slice(0, 5)` over a `Set` fed by a raw `readdirSync` is
|
|
36
|
+
* **filesystem-ordered**: five of N chosen by APFS or ext4, which is the
|
|
37
|
+
* defect `lib/readdir-sorted.ts` exists for, one indirection further in.
|
|
38
|
+
* Sorting here rather than at the three call sites is the same argument
|
|
39
|
+
* that file makes — one binding is one thing to forget.
|
|
40
|
+
*
|
|
41
|
+
* Measured on this repository, 10 of the 14 rows changed; `evals/` went from
|
|
42
|
+
* five directory names to `json, md, sh, ts, yaml`.
|
|
43
|
+
*
|
|
44
|
+
* ## Why the cap stays
|
|
45
|
+
*
|
|
46
|
+
* `MAX_TYPES` bounds a table cell, and #1200 asked only that the five be
|
|
47
|
+
* chosen deterministically rather than that they be all of them. Ascending
|
|
48
|
+
* order is also the drift-resistant key: a file added to a directory cannot
|
|
49
|
+
* move it, and only a brand-new extension can — unlike a frequency ranking,
|
|
50
|
+
* which is the per-directory census #1163 removed wearing an indirection.
|
|
51
|
+
*
|
|
52
|
+
* Errors are NOT caught here. An unreadable tree is the caller's to decide
|
|
53
|
+
* about, and all three callers already wrap this in the `try` that used to
|
|
54
|
+
* hold the four lines; swallowing it would turn "could not read" into "has
|
|
55
|
+
* no files", which is `.claude/rules/checks-must-be-able-to-fail.md`'s
|
|
56
|
+
* fail-open shape.
|
|
57
|
+
*/
|
|
58
|
+
import { readdirSync } from "fs";
|
|
59
|
+
|
|
60
|
+
/** How many extensions a `Types` cell carries, at most. */
|
|
61
|
+
export const MAX_TYPES = 5;
|
|
62
|
+
|
|
63
|
+
export function fileExtensions(dir: string, limit: number = MAX_TYPES): string[] {
|
|
64
|
+
const exts = new Set<string>();
|
|
65
|
+
for (const entry of readdirSync(dir, { recursive: true, withFileTypes: true })) {
|
|
66
|
+
if (!entry.isFile()) continue;
|
|
67
|
+
// `entry.name` is a basename even under `recursive` — the directory part
|
|
68
|
+
// is on `parentPath` — so this cannot pick up a path separator.
|
|
69
|
+
const dot = entry.name.lastIndexOf(".");
|
|
70
|
+
// `<= 0` covers both "no dot at all" and a dotfile like `.gitignore`,
|
|
71
|
+
// whose leading dot does not open an extension.
|
|
72
|
+
if (dot <= 0) continue;
|
|
73
|
+
const ext = entry.name.slice(dot + 1);
|
|
74
|
+
if (ext) exts.add(ext);
|
|
75
|
+
}
|
|
76
|
+
// Plain `.sort()`: lexicographic over UTF-16 code units is
|
|
77
|
+
// locale-independent, unlike `localeCompare`. A generated file whose
|
|
78
|
+
// contents depend on the runner's locale is the same defect in a different
|
|
79
|
+
// coat (`lib/readdir-sorted.ts`).
|
|
80
|
+
return [...exts].sort().slice(0, limit);
|
|
81
|
+
}
|