rungate 0.8.13 → 0.8.16
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/README.md +182 -0
- package/gates/.gate-salt +1 -1
- package/hooks/HarnessAFKGate.hook.ts +5 -1
- package/hooks/HookCurrency.hook.ts +11 -8
- package/hooks/MergeGuard.hook.ts +7 -1
- package/hooks/StaleTTLCleanup.hook.ts +4 -4
- package/hooks/VerifyPhaseLock.hook.ts +3 -3
- package/hooks/lib/findWorkflow.ts +3 -2
- package/hooks/lib/paths.ts +14 -2
- package/hooks/lib/utils.ts +23 -3
- package/lib/active-milestone.ts +50 -0
- package/lib/ai-review-rounds.ts +99 -0
- package/lib/ai-review-suppression.ts +200 -21
- package/lib/bash-write-guard.ts +397 -23
- package/lib/board-flow.ts +280 -0
- package/lib/board-lane-health.ts +578 -0
- package/lib/board-mirror.ts +136 -39
- package/lib/board-ready-fanout.ts +297 -14
- package/lib/board-ready-rule.ts +1211 -0
- package/lib/board-throughput.ts +136 -0
- package/lib/board-walkthrough.ts +240 -0
- package/lib/body-evidence.ts +203 -0
- package/lib/branch-protection.ts +399 -9
- package/lib/bun-version.ts +36 -0
- package/lib/cli-commands.ts +75 -4
- package/lib/closing-reference-audit.ts +307 -6
- package/lib/config-loader.ts +254 -25
- package/lib/config-readers.ts +170 -10
- package/lib/config-trackable.ts +96 -57
- package/lib/conformity.ts +121 -7
- package/lib/create-sc.ts +25 -2
- package/lib/derived-spec.ts +21 -9
- package/lib/filing-compliance.ts +367 -0
- package/lib/filing-plan.ts +47 -21
- package/lib/finding-arbiter.ts +79 -5
- package/lib/finding-jury.ts +43 -4
- package/lib/finding-promotion.ts +1123 -0
- package/lib/generators/agents-md.ts +149 -0
- package/lib/git-isolation.ts +137 -1
- package/lib/github-api-base.ts +66 -0
- package/lib/github.ts +194 -9
- package/lib/graphql-cursor.ts +80 -0
- package/lib/hook-scopes.ts +78 -0
- package/lib/issue-create-override.ts +415 -3
- package/lib/issue-decomposition.ts +124 -7
- package/lib/issue-extraction.ts +9 -7
- package/lib/issue-file-overlap.ts +373 -0
- package/lib/issue-filing-gate.ts +1109 -52
- package/lib/issue-repair.ts +90 -9
- package/lib/issue-shape.ts +199 -0
- package/lib/live-issues.ts +31 -2
- package/lib/local-work.ts +423 -0
- package/lib/markdown-fence.ts +134 -0
- package/lib/milestone-title.ts +46 -0
- package/lib/scaffold/ai-review-findings.ts +148 -3
- package/lib/scaffold/ai-review-step.ts +65 -5
- package/lib/scaffold/ai-review-unmeasured-workflow.ts +3 -0
- package/lib/scaffold/steps.ts +115 -9
- package/lib/source-census.ts +108 -0
- package/lib/spec-deps.ts +55 -11
- package/lib/spec-placement.ts +203 -13
- package/lib/spec-registry.ts +75 -16
- package/lib/spec-source.ts +609 -0
- package/lib/spec-write-sweep.ts +4 -0
- package/lib/stage-ladder.ts +896 -3
- package/lib/state-claim-readings.ts +252 -0
- package/lib/success-doc.ts +7 -6
- package/lib/test-command-positions.ts +135 -1
- package/lib/work-status.ts +551 -0
- package/lib/worktree-repo.ts +14 -2
- package/package.json +7 -1
- package/scripts/ai-review-findings.ts +8 -13
- package/scripts/ai-review-threads.ts +16 -17
- package/scripts/audit-closing-references.ts +330 -0
- package/scripts/audit-specs.ts +59 -103
- package/scripts/board-conformance.ts +747 -40
- package/scripts/board-mirror.ts +594 -13
- package/scripts/board-ready.ts +979 -0
- package/scripts/board-snapshot.ts +464 -12
- package/scripts/claim-files.ts +578 -0
- package/scripts/criterion-inventory.ts +526 -50
- package/scripts/finding-promotion.ts +547 -0
- package/scripts/generate-code-map.ts +1 -1
- package/scripts/plan-issues.ts +279 -40
- package/scripts/plan-spec.ts +105 -3
- package/scripts/sync-sc-status.ts +147 -7
- package/scripts/worktree-census.ts +958 -0
- package/scripts/worktree-sweep.ts +269 -0
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* bun scripts/sync-sc-status.ts --report # Output per-spec coverage report
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { parseArgs } from "util";
|
|
17
18
|
import { existsSync, readFileSync, readdirSync } from "fs";
|
|
18
19
|
|
|
19
20
|
import { walkTestFiles } from "../lib/walk-test-files";
|
|
@@ -47,6 +48,67 @@ const SPECS_DIR = join(ROOT, "specs");
|
|
|
47
48
|
const TEST_DIR = join(ROOT, "test");
|
|
48
49
|
const dryRun = process.argv.includes("--dry-run");
|
|
49
50
|
const reportMode = process.argv.includes("--report");
|
|
51
|
+
/**
|
|
52
|
+
* `--only SC-1,SC-2` (#2054): flip only these. Absent means every passing
|
|
53
|
+
* criterion, as before. A flag with no value is a mistake, not "all".
|
|
54
|
+
*/
|
|
55
|
+
const onlyIds: string[] | null = parseOnlyArg(process.argv.slice(2));
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* `--only`, read by `util.parseArgs` so every spelling is one reading
|
|
59
|
+
* (review of #2058: `--only=SC-1` was not recognised, the value fell to
|
|
60
|
+
* null, and the run flipped every claimed criterion). Null means the flag is
|
|
61
|
+
* absent; `[]` means it is present with no ids, which the caller refuses.
|
|
62
|
+
*/
|
|
63
|
+
export function parseOnlyArg(argv: readonly string[]): string[] | null {
|
|
64
|
+
const { values } = parseArgs({
|
|
65
|
+
args: [...argv],
|
|
66
|
+
options: { only: { type: "string" } },
|
|
67
|
+
strict: false,
|
|
68
|
+
allowPositionals: true,
|
|
69
|
+
});
|
|
70
|
+
const raw = values.only;
|
|
71
|
+
if (raw === undefined) return null;
|
|
72
|
+
if (typeof raw !== "string" || raw.startsWith("--")) return [];
|
|
73
|
+
return raw.split(",").map(x => x.trim()).filter(x => x !== "");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Every argument this script does not read, in the order given (#2076).
|
|
78
|
+
*
|
|
79
|
+
* The readers above are deliberately lenient about each other, so this is
|
|
80
|
+
* the one place that knows the whole set. Lenient about everything else
|
|
81
|
+
* meant `--help` or a typo such as `--dryrun` ran the script in WRITE mode
|
|
82
|
+
* and ticked every passing criterion in every spec: 38 boxes in six specs
|
|
83
|
+
* on 2026-11-13. The main block refuses on a non-empty result before it
|
|
84
|
+
* reads a spec.
|
|
85
|
+
*/
|
|
86
|
+
export function unknownSyncArgs(argv: readonly string[]): string[] {
|
|
87
|
+
// A value on a switch (`--dry-run=false`) makes parseArgs throw even when
|
|
88
|
+
// non-strict. Named here rather than escaping as a stack trace (review of
|
|
89
|
+
// #2078).
|
|
90
|
+
const valued = argv.filter(a => /^--(?:dry-run|report)=/.test(a));
|
|
91
|
+
if (valued.length > 0) return valued;
|
|
92
|
+
const { tokens } = parseArgs({
|
|
93
|
+
args: [...argv],
|
|
94
|
+
options: { only: { type: "string" }, "dry-run": { type: "boolean" }, report: { type: "boolean" } },
|
|
95
|
+
strict: false,
|
|
96
|
+
allowPositionals: true,
|
|
97
|
+
tokens: true,
|
|
98
|
+
});
|
|
99
|
+
const known = new Set(["only", "dry-run", "report"]);
|
|
100
|
+
const out: string[] = [];
|
|
101
|
+
for (const t of tokens ?? []) {
|
|
102
|
+
if (t.kind === "option" && t.name === "only" && (t.value === undefined || t.value.startsWith("-"))) {
|
|
103
|
+
// `--only --help` hands `--help` to --only as its value, so it would
|
|
104
|
+
// never be checked (review of #2078). The swallowed flag is checked here.
|
|
105
|
+
out.push("--only with no ids");
|
|
106
|
+
if (t.value !== undefined && !known.has(t.value.replace(/^-+/, "").split("=")[0]!)) out.push(t.value);
|
|
107
|
+
} else if (t.kind === "option" && !known.has(t.name)) out.push(t.rawName);
|
|
108
|
+
else if (t.kind === "positional") out.push(t.value);
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
50
112
|
|
|
51
113
|
export interface UncheckedSC {
|
|
52
114
|
id: string;
|
|
@@ -682,6 +744,46 @@ export function checkConformitySCs(uncheckedSCs: UncheckedSC[], root: string): C
|
|
|
682
744
|
return { passing, failing, unmatchable };
|
|
683
745
|
}
|
|
684
746
|
|
|
747
|
+
/**
|
|
748
|
+
* Narrow the per-spec flip list to `only` (#2054). Returns the ids asked for
|
|
749
|
+
* that are not passing as `missing`, so the caller refuses rather than
|
|
750
|
+
* flipping zero and exiting clean — the same observable as a real tick.
|
|
751
|
+
*/
|
|
752
|
+
export function selectOnly(
|
|
753
|
+
bySpec: ReadonlyMap<string, readonly string[]>,
|
|
754
|
+
only: readonly string[] | null,
|
|
755
|
+
): {
|
|
756
|
+
selected: Map<string, string[]>;
|
|
757
|
+
missing: string[];
|
|
758
|
+
/** A bare id passing in more than one spec: flipping it would reach both (#330). */
|
|
759
|
+
ambiguous: { id: string; specs: string[] }[];
|
|
760
|
+
} {
|
|
761
|
+
if (only === null) {
|
|
762
|
+
return { selected: new Map([...bySpec].map(([k, v]) => [k, [...v]])), missing: [], ambiguous: [] };
|
|
763
|
+
}
|
|
764
|
+
const want = new Set(only);
|
|
765
|
+
const selected = new Map<string, string[]>();
|
|
766
|
+
const specsOf = new Map<string, string[]>();
|
|
767
|
+
for (const [spec, ids] of bySpec) {
|
|
768
|
+
// Deduped: a checkbox line repeated inside ONE spec is one spec (#2058).
|
|
769
|
+
const kept = [...new Set(ids.filter(id => want.has(id)))];
|
|
770
|
+
for (const id of kept) specsOf.set(id, [...(specsOf.get(id) ?? []), spec]);
|
|
771
|
+
if (kept.length > 0) selected.set(spec, kept);
|
|
772
|
+
}
|
|
773
|
+
return {
|
|
774
|
+
selected,
|
|
775
|
+
missing: only.filter(id => !specsOf.has(id)),
|
|
776
|
+
ambiguous: [...specsOf]
|
|
777
|
+
.filter(([, specs]) => specs.length > 1)
|
|
778
|
+
.map(([id, specs]) => ({ id, specs: [...specs].sort() })),
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/** `--only` refuses when fewer criteria flipped than it selected (#2054). */
|
|
783
|
+
export function onlyRefusesShortFlip(only: readonly string[] | null, asked: number, flipped: number): boolean {
|
|
784
|
+
return only !== null && flipped < asked;
|
|
785
|
+
}
|
|
786
|
+
|
|
685
787
|
export function flipCheckboxes(specFile: string, scIds: string[], specsDir?: string, isDryRun?: boolean): number {
|
|
686
788
|
const dir = specsDir || SPECS_DIR;
|
|
687
789
|
const filePath = join(dir, specFile);
|
|
@@ -752,6 +854,15 @@ export function generateReport(specCoverage: Map<string, SpecCoverage>): string
|
|
|
752
854
|
const isDirectExecution = import.meta.main;
|
|
753
855
|
|
|
754
856
|
if (isDirectExecution) {
|
|
857
|
+
// #2076: before any spec is read, so a mistyped flag can never write.
|
|
858
|
+
const unknownArgs = unknownSyncArgs(process.argv.slice(2));
|
|
859
|
+
if (unknownArgs.length > 0) {
|
|
860
|
+
console.error(
|
|
861
|
+
`sync-sc-status: cannot use argument(s): ${unknownArgs.join(", ")}. Nothing was read or written. ` +
|
|
862
|
+
"It takes --dry-run, --report and --only <SC-id,…>; there is no --help.",
|
|
863
|
+
);
|
|
864
|
+
process.exit(1);
|
|
865
|
+
}
|
|
755
866
|
const unchecked = findUncheckedSCs();
|
|
756
867
|
if (unchecked.length === 0) {
|
|
757
868
|
console.log("All SCs are already checked off");
|
|
@@ -920,12 +1031,9 @@ if (isDirectExecution) {
|
|
|
920
1031
|
}
|
|
921
1032
|
}
|
|
922
1033
|
|
|
923
|
-
// Step 5: Flip passing SCs
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
process.exit(0);
|
|
927
|
-
}
|
|
928
|
-
|
|
1034
|
+
// Step 5: Flip passing SCs. `--only` is decided BEFORE the empty-list exit
|
|
1035
|
+
// (review of #2058): an exit here first turned a typo on a quiet tree into
|
|
1036
|
+
// "No SCs to flip" and exit 0, the same observable as a real tick.
|
|
929
1037
|
// Group passing SCs by spec file and flip — scoped keys prevent cross-spec bleeding
|
|
930
1038
|
const bySpec = new Map<string, string[]>();
|
|
931
1039
|
for (const sc of unchecked) {
|
|
@@ -937,8 +1045,32 @@ if (isDirectExecution) {
|
|
|
937
1045
|
}
|
|
938
1046
|
}
|
|
939
1047
|
|
|
1048
|
+
if (onlyIds !== null && onlyIds.length === 0) {
|
|
1049
|
+
console.error("--only needs a comma-separated list of criterion ids");
|
|
1050
|
+
process.exit(1);
|
|
1051
|
+
}
|
|
1052
|
+
const { selected, missing, ambiguous } = selectOnly(bySpec, onlyIds);
|
|
1053
|
+
if (missing.length > 0) {
|
|
1054
|
+
console.error(
|
|
1055
|
+
`--only: ${missing.join(", ")} ${missing.length === 1 ? "is" : "are"} not among the criteria a ` +
|
|
1056
|
+
`passing test claims, so nothing was flipped`,
|
|
1057
|
+
);
|
|
1058
|
+
process.exit(1);
|
|
1059
|
+
}
|
|
1060
|
+
if (ambiguous.length > 0) {
|
|
1061
|
+
console.error(
|
|
1062
|
+
`--only: ${ambiguous.map(a => `${a.id} passes in ${a.specs.join(" and ")}`).join("; ")} — a bare ` +
|
|
1063
|
+
`id would be flipped in every one, so nothing was flipped`,
|
|
1064
|
+
);
|
|
1065
|
+
process.exit(1);
|
|
1066
|
+
}
|
|
1067
|
+
if (selected.size === 0) {
|
|
1068
|
+
console.log("No SCs to flip");
|
|
1069
|
+
process.exit(0);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
940
1072
|
let totalFlipped = 0;
|
|
941
|
-
for (const [specFile, scs] of
|
|
1073
|
+
for (const [specFile, scs] of selected) {
|
|
942
1074
|
const flipped = flipCheckboxes(specFile, scs);
|
|
943
1075
|
if (flipped > 0) {
|
|
944
1076
|
console.log(`${dryRun ? "Would flip" : "Flipped"} ${flipped} SCs in ${specFile}: ${scs.join(", ")}`);
|
|
@@ -947,4 +1079,12 @@ if (isDirectExecution) {
|
|
|
947
1079
|
}
|
|
948
1080
|
|
|
949
1081
|
console.log(`\n${dryRun ? "Would flip" : "Flipped"} ${totalFlipped} SC checkboxes`);
|
|
1082
|
+
// Review of #2058: `--only` promises the named criteria are flipped or the
|
|
1083
|
+
// run fails. `flipCheckboxes` can decline (a spec a generator owns, or a
|
|
1084
|
+
// line that changed under us) and return fewer than asked.
|
|
1085
|
+
const asked = [...selected.values()].reduce((n, ids) => n + ids.length, 0);
|
|
1086
|
+
if (onlyRefusesShortFlip(onlyIds, asked, totalFlipped)) {
|
|
1087
|
+
console.error(`--only: ${asked} criteria were selected and ${totalFlipped} flipped — the rest were declined above`);
|
|
1088
|
+
process.exit(1);
|
|
1089
|
+
}
|
|
950
1090
|
}
|