fapony 0.2.1 → 0.3.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.
Files changed (54) hide show
  1. package/README.md +95 -72
  2. package/fapony.ts +12 -5
  3. package/package.json +5 -4
  4. package/skill/define-convention/SKILL.md +77 -0
  5. package/skill/lookup-before-edit/SKILL.md +48 -0
  6. package/skill/move-to-done/SKILL.md +19 -30
  7. package/skill/review-pony/SKILL.md +38 -61
  8. package/src/analyze.ts +1 -1
  9. package/src/debt/cli.ts +193 -0
  10. package/src/debt/format.ts +107 -0
  11. package/src/debt/index.ts +19 -0
  12. package/src/debt/load.ts +92 -0
  13. package/src/debt/promotion.ts +152 -0
  14. package/src/debt/scan.ts +214 -0
  15. package/src/debt/types.ts +79 -0
  16. package/src/detect.ts +92 -0
  17. package/src/gate.ts +3 -3
  18. package/src/hook.ts +349 -100
  19. package/src/init-mem.ts +57 -71
  20. package/src/init.ts +12 -16
  21. package/src/install/antigravity.ts +112 -0
  22. package/src/install/claude.ts +16 -123
  23. package/src/install/codex.ts +58 -19
  24. package/src/install/detect.ts +17 -7
  25. package/src/install/opencode.ts +131 -6
  26. package/src/install.ts +12 -3
  27. package/src/lint-baseline.ts +2 -2
  28. package/src/mcp/primitives.ts +1 -1
  29. package/src/mcp/tools/index.ts +13 -102
  30. package/src/mcp/tools/mem.ts +71 -0
  31. package/src/mcp/transport.ts +8 -94
  32. package/src/mcp/worktree.ts +1 -1
  33. package/src/mem/commands/read.ts +231 -141
  34. package/src/mem/index.ts +4 -13
  35. package/src/memory.ts +17 -8
  36. package/src/{plan-seed.ts → seed/plan-seed.ts} +14 -32
  37. package/src/seed/primitives.ts +66 -0
  38. package/src/{review-seed.ts → seed/review-seed.ts} +7 -54
  39. package/src/session/helpers.ts +1 -1
  40. package/src/session/registry.ts +3 -6
  41. package/src/setup.ts +1 -1
  42. package/src/stats/data.ts +1 -1
  43. package/src/telemetry.ts +1 -1
  44. package/src/util.ts +61 -0
  45. package/templates/SPEC.md +8 -1
  46. package/images/logo.png +0 -0
  47. package/images/logo.webp +0 -0
  48. package/images/logo@400.webp +0 -0
  49. package/images/sample.webp +0 -0
  50. package/images/summary.webp +0 -0
  51. package/src/debt.ts +0 -811
  52. package/src/math.ts +0 -13
  53. package/src/mcp/tools/usage.ts +0 -211
  54. package/src/mcp/tools/verdict.ts +0 -161
@@ -0,0 +1,152 @@
1
+ // src/debt/promotion.ts — promotion signal: "this recurred N times, time for a checker?"
2
+ //
3
+ // "I'll write eslint when I think of it" — the "think of it" moment is what goes
4
+ // missing (SPEC §3) · fapony sees history across sessions (mem + verdicts), so it
5
+ // can count how often the same thing was fixed, then put the question to a human —
6
+ // it does not decide, does not write the eslint rule itself (SPEC §6 fail list)
7
+ //
8
+ // Matching "the same thing" — only as precise as the data allows (SPEC §7: old rows
9
+ // lack files[], still undecided): a row with files[] must intersect the debt list ·
10
+ // the text must mention a convention symbol (ok such as fmtMoney, or an identifier
11
+ // ≥ 6 chars from stale such as toLocaleString/useMutation — "throw"/"Error" are too
12
+ // short and don't count, to avoid over-matching)
13
+
14
+ import { openDb } from "../db/index.js";
15
+ import { readMemLog } from "../memory.js";
16
+ import {
17
+ type Convention,
18
+ type DebtReport,
19
+ PROMOTION_MAX,
20
+ PROMOTION_THRESHOLD,
21
+ type Promotion,
22
+ WORD_MIN,
23
+ } from "./types.js";
24
+
25
+ export type { Promotion };
26
+
27
+ function conventionWords(conv: Convention): string[] {
28
+ const words = new Set<string>();
29
+ for (const src of [conv.ok, conv.stale]) {
30
+ if (!src) continue;
31
+ for (const m of src.matchAll(/[A-Za-z_$][\w$]*/g)) {
32
+ if (m[0].length >= WORD_MIN) words.add(m[0]);
33
+ }
34
+ }
35
+ return [...words];
36
+ }
37
+
38
+ function rowMatchesConv(
39
+ hay: string,
40
+ files: string[] | undefined,
41
+ debtFiles: Set<string>,
42
+ words: string[],
43
+ ): boolean {
44
+ if (files && files.length > 0) {
45
+ if (files.some((f) => debtFiles.has(f))) return true;
46
+ }
47
+ const lower = hay.toLowerCase();
48
+ return words.some((w) => lower.includes(w.toLowerCase()));
49
+ }
50
+
51
+ interface EvidenceRow {
52
+ ts: string;
53
+ files?: string[];
54
+ hay: string;
55
+ }
56
+
57
+ function gatherEvidence(worktree: string): EvidenceRow[] {
58
+ const out: EvidenceRow[] = [];
59
+ try {
60
+ for (const r of readMemLog(worktree).rows) {
61
+ if (r.kind !== "bug" && r.kind !== "decision") continue;
62
+ out.push({ ts: r.ts, files: r.files, hay: `${r.text}\n${r.spec ?? ""}` });
63
+ }
64
+ } catch {
65
+ // mem missing — verdicts alone still count
66
+ }
67
+ try {
68
+ const db = openDb();
69
+ const events = db
70
+ .prepare(
71
+ `SELECT e.ts AS ts, e.data AS data FROM events e
72
+ JOIN runs r ON r.id = e.run_id
73
+ WHERE r.worktree = ? AND e.kind = 'gate' ORDER BY e.id`,
74
+ )
75
+ .all(worktree) as { ts: string; data: string | null }[];
76
+ for (const e of events) {
77
+ if (!e.data) continue;
78
+ try {
79
+ const d = JSON.parse(e.data) as {
80
+ verdict?: string;
81
+ reason_code?: string;
82
+ note?: string;
83
+ files?: string[];
84
+ };
85
+ const countsAsFix =
86
+ d.verdict === "fail" ||
87
+ d.reason_code === "scope_mismatch" ||
88
+ d.reason_code === "spec_gap";
89
+ if (!countsAsFix) continue;
90
+ out.push({ ts: e.ts, files: d.files, hay: d.note ?? "" });
91
+ } catch {}
92
+ }
93
+ } catch {
94
+ // no ledger yet — mem alone still counts
95
+ }
96
+ return out;
97
+ }
98
+
99
+ /** Repeated-fix questions for conventions that have no checker and no "no-checker" decision. */
100
+ export function findPromotions(
101
+ worktree: string,
102
+ report: DebtReport,
103
+ ): Promotion[] {
104
+ const evidence = gatherEvidence(worktree);
105
+ if (evidence.length === 0) return [];
106
+ const out: Promotion[] = [];
107
+ for (const entry of report.entries) {
108
+ const { conv } = entry;
109
+ if (conv.checker || conv.decided === "no-checker") continue;
110
+ if (entry.files.length === 0) continue;
111
+ const debtFiles = new Set(entry.files);
112
+ const words = conventionWords(conv);
113
+ const hits = evidence.filter((r) =>
114
+ rowMatchesConv(r.hay, r.files, debtFiles, words),
115
+ );
116
+ if (hits.length < PROMOTION_THRESHOLD) continue;
117
+ const dates = [...new Set(hits.map((h) => h.ts.slice(0, 10)))].sort();
118
+ out.push({
119
+ convId: conv.id,
120
+ rule: conv.rule,
121
+ occurrences: hits.length,
122
+ dates,
123
+ debtCount: entry.files.length,
124
+ });
125
+ }
126
+ // Newest first, capped — three questions are already a conversation.
127
+ out.sort((a, b) => b.occurrences - a.occurrences);
128
+ return out.slice(0, PROMOTION_MAX);
129
+ }
130
+
131
+ export function formatPromotions(promotions: Promotion[]): string[] {
132
+ if (promotions.length === 0) return [];
133
+ const lines: string[] = [
134
+ "",
135
+ "promotion — repeated fixes on conventions with no checker:",
136
+ ];
137
+ for (const p of promotions) {
138
+ lines.push(
139
+ `\n"${p.convId}" (${p.debtCount} file(s) still wrong) came up ${p.occurrences}× ` +
140
+ `(${p.dates.slice(0, 3).join(", ")}${p.dates.length > 3 ? ", …" : ""})`,
141
+ );
142
+ lines.push(` ${p.rule}`);
143
+ lines.push(
144
+ " [1] make a checker — an agent drafts the eslint rule in this repo, you review",
145
+ );
146
+ lines.push(
147
+ ' [2] one-off, no checker — record "decided": "no-checker" on this entry, never asked again',
148
+ );
149
+ lines.push(" [3] later — ask again when this comes up a few more times");
150
+ }
151
+ return lines;
152
+ }
@@ -0,0 +1,214 @@
1
+ // src/debt/scan.ts — the scan (fresh every call — derive, never store).
2
+ //
3
+ // Debt is computed live every time, never written anywhere (same as analyze:
4
+ // a cache is pure debt — a frozen list goes stale silently like MASTER.md).
5
+
6
+ import { existsSync, readFileSync } from "node:fs";
7
+ import { isAbsolute, join, relative } from "node:path";
8
+ import { collectSourceFiles } from "../analyze.js";
9
+ import {
10
+ type Convention,
11
+ DEBT_FILE_CAP,
12
+ type DebtEntry,
13
+ type DebtReport,
14
+ type LoadedConventions,
15
+ } from "./types.js";
16
+
17
+ interface Compiled {
18
+ conv: Convention;
19
+ staleRe: RegExp | null;
20
+ okRe: RegExp | null;
21
+ guardRe: RegExp | null;
22
+ whereDir: string;
23
+ }
24
+
25
+ function compile(conv: Convention): { c: Compiled; error?: string } {
26
+ const re = (
27
+ src: string | null | undefined,
28
+ what: string,
29
+ ): { re: RegExp | null; error?: string } => {
30
+ if (!src) return { re: null };
31
+ try {
32
+ return { re: new RegExp(src) };
33
+ } catch (e) {
34
+ return {
35
+ re: null,
36
+ error: `${what} regex broken (${e instanceof Error ? e.message.split("\n")[0] : "?"})`,
37
+ };
38
+ }
39
+ };
40
+ const stale = re(conv.stale, `${conv.id}: stale`);
41
+ if (stale.error)
42
+ return {
43
+ c: {
44
+ conv,
45
+ staleRe: null,
46
+ okRe: null,
47
+ guardRe: null,
48
+ whereDir: conv.where,
49
+ },
50
+ error: stale.error,
51
+ };
52
+ const ok = re(conv.ok, `${conv.id}: ok`);
53
+ if (ok.error)
54
+ return {
55
+ c: {
56
+ conv,
57
+ staleRe: null,
58
+ okRe: null,
59
+ guardRe: null,
60
+ whereDir: conv.where,
61
+ },
62
+ error: ok.error,
63
+ };
64
+ const guard = re(conv.guard, `${conv.id}: guard`);
65
+ if (guard.error)
66
+ return {
67
+ c: {
68
+ conv,
69
+ staleRe: null,
70
+ okRe: null,
71
+ guardRe: null,
72
+ whereDir: conv.where,
73
+ },
74
+ error: guard.error,
75
+ };
76
+ return {
77
+ c: {
78
+ conv,
79
+ staleRe: stale.re,
80
+ okRe: ok.re,
81
+ guardRe: guard.re,
82
+ // where="src" must scope src/ and src/x/y.ts but not src-other/;
83
+ // where="." scopes everything.
84
+ whereDir: conv.where === "." ? "" : conv.where.replace(/\/+$/, ""),
85
+ },
86
+ };
87
+ }
88
+
89
+ function inScope(whereDir: string, file: string): boolean {
90
+ return whereDir === "" || file.startsWith(`${whereDir}/`);
91
+ }
92
+
93
+ export function debtScan(
94
+ worktree: string,
95
+ loaded: LoadedConventions,
96
+ ): DebtReport {
97
+ const t0 = performance.now();
98
+ const entries: DebtEntry[] = [];
99
+ const declared: Convention[] = [];
100
+ const dropped: { id: string; reason: string }[] = [];
101
+ let checkedCount = 0;
102
+
103
+ const compiled: Compiled[] = [];
104
+ for (const conv of loaded.convs) {
105
+ if (conv.checker) {
106
+ // Iron rule — fapony stays silent, leave it to the checker (SPEC §2)
107
+ checkedCount++;
108
+ continue;
109
+ }
110
+ if (!conv.stale) {
111
+ // The one slot a human fills (SPEC §2.2) — show it as pending, don't guess
112
+ declared.push(conv);
113
+ continue;
114
+ }
115
+ const { c, error } = compile(conv);
116
+ if (error || !c.staleRe) {
117
+ dropped.push({ id: conv.id, reason: error ?? "uncompilable" });
118
+ continue;
119
+ }
120
+ if (!existsSync(join(worktree, c.whereDir || "."))) {
121
+ dropped.push({
122
+ id: conv.id,
123
+ reason: `where: ${conv.where} does not exist`,
124
+ });
125
+ continue;
126
+ }
127
+ compiled.push(c);
128
+ }
129
+
130
+ const files = collectSourceFiles(worktree);
131
+ const debt: Map<string, string[]> = new Map(
132
+ compiled.map((c) => [c.conv.id, []]),
133
+ );
134
+ const moved: Map<string, number> = new Map(
135
+ compiled.map((c) => [c.conv.id, 0]),
136
+ );
137
+ const tooBroad: Map<string, number> = new Map();
138
+
139
+ for (const rel of files) {
140
+ let content: string;
141
+ try {
142
+ content = readFileSync(join(worktree, rel), "utf-8");
143
+ } catch {
144
+ continue;
145
+ }
146
+ for (const c of compiled) {
147
+ if (!c.staleRe) continue; // filtered at compile; narrows the type
148
+ if (!inScope(c.whereDir, rel)) continue;
149
+ if (c.guardRe && !c.guardRe.test(content)) continue;
150
+ if (c.staleRe.test(content)) {
151
+ const cur = debt.get(c.conv.id) ?? [];
152
+ cur.push(rel);
153
+ debt.set(c.conv.id, cur);
154
+ // Stop counting a runaway regex early — the entry will be dropped.
155
+ if (cur.length > DEBT_FILE_CAP) tooBroad.set(c.conv.id, cur.length);
156
+ }
157
+ if (c.okRe?.test(content)) {
158
+ moved.set(c.conv.id, (moved.get(c.conv.id) ?? 0) + 1);
159
+ }
160
+ }
161
+ }
162
+
163
+ for (const c of compiled) {
164
+ const n = tooBroad.get(c.conv.id);
165
+ if (n !== undefined) {
166
+ dropped.push({
167
+ id: c.conv.id,
168
+ reason: `stale regex matches ${n}+ files — too broad, entry dropped (narrow stale/where/guard)`,
169
+ });
170
+ continue;
171
+ }
172
+ entries.push({
173
+ conv: c.conv,
174
+ files: (debt.get(c.conv.id) ?? []).sort(),
175
+ movedCount: c.okRe ? (moved.get(c.conv.id) ?? 0) : null,
176
+ });
177
+ }
178
+
179
+ return {
180
+ worktree,
181
+ scannedFiles: files.length,
182
+ ms: Math.round(performance.now() - t0),
183
+ entries,
184
+ declared,
185
+ dropped,
186
+ checkedCount,
187
+ };
188
+ }
189
+
190
+ /** Per-file lookup (hook-read-hint + --files): which conventions flag this file. */
191
+ export function debtForFile(
192
+ worktree: string,
193
+ absFile: string,
194
+ loaded: LoadedConventions,
195
+ ): Convention[] {
196
+ const rel = relative(worktree, absFile).split("\\").join("/");
197
+ if (rel.startsWith("..") || isAbsolute(rel)) return [];
198
+ let content: string;
199
+ try {
200
+ content = readFileSync(absFile, "utf-8");
201
+ } catch {
202
+ return [];
203
+ }
204
+ const out: Convention[] = [];
205
+ for (const conv of loaded.convs) {
206
+ if (conv.checker || !conv.stale) continue;
207
+ const { c, error } = compile(conv);
208
+ if (error || !c.staleRe) continue;
209
+ if (!inScope(c.whereDir, rel)) continue;
210
+ if (c.guardRe && !c.guardRe.test(content)) continue;
211
+ if (c.staleRe.test(content)) out.push(conv);
212
+ }
213
+ return out;
214
+ }
@@ -0,0 +1,79 @@
1
+ // src/debt/types.ts — shared types + caps for `fapony debt`.
2
+ //
3
+ // One convention = pattern to use (ok) + pattern meaning not-yet-migrated
4
+ // (stale) + scope (where) + file condition (guard). Iron rule: checker not
5
+ // null = fapony never reports that debt item — reporting twice with eslint
6
+ // is an abstraction with one implementation (rule 1).
7
+
8
+ export interface Convention {
9
+ id: string;
10
+ rule: string;
11
+ /** Repo-relative dir scope ("." = whole repo). */
12
+ where: string;
13
+ /** Regex source: a match means the file still has the debt. null = not derivable (checker rows) or not filled in yet. */
14
+ stale: string | null;
15
+ /** Regex source: files that already moved (informational count). */
16
+ ok?: string;
17
+ /** Regex source a file must ALSO match to be in scope (e.g. "extends Base"). */
18
+ guard?: string;
19
+ /** Non-null = a checker (eslint rule / script) exists → fapony never reports this debt. */
20
+ checker?: string | null;
21
+ /** Human answered "no checker" on the promotion question — never ask again. */
22
+ decided?: "no-checker" | null;
23
+ }
24
+
25
+ export interface LoadedConventions {
26
+ path: string | null;
27
+ convs: Convention[];
28
+ /** Rows kept for display but not scannable, plus invalid rows — said out loud, never silent. */
29
+ warnings: string[];
30
+ }
31
+
32
+ export interface DebtEntry {
33
+ conv: Convention;
34
+ /** Files with the debt (stale match), sorted. */
35
+ files: string[];
36
+ /** Files that already moved (ok match) — null when ok is not set. */
37
+ movedCount: number | null;
38
+ }
39
+
40
+ export interface DebtReport {
41
+ worktree: string;
42
+ scannedFiles: number;
43
+ ms: number;
44
+ /** Scannable conventions with their debt list (checker rows never land here). */
45
+ entries: DebtEntry[];
46
+ /** Declared but not fillable by fapony: checker null + no stale — the human/agent fills `stale`. */
47
+ declared: Convention[];
48
+ /** Skipped-with-reason: checker rows are silent by design (not dropped), these are real drops. */
49
+ dropped: { id: string; reason: string }[];
50
+ /** Silent-by-design count: checker non-null — reported as a number, not a list. */
51
+ checkedCount: number;
52
+ }
53
+
54
+ export interface Promotion {
55
+ convId: string;
56
+ rule: string;
57
+ occurrences: number;
58
+ dates: string[];
59
+ debtCount: number;
60
+ }
61
+
62
+ // A stale regex matching more than this many files is not a convention — it is
63
+ // a broken/wide regex (stale="e" would flag the repo). SPEC §6: drop the entry
64
+ // and say so, never report 600 files.
65
+ export const DEBT_FILE_CAP = 250;
66
+
67
+ export const PROMOTION_THRESHOLD = 3;
68
+ export const PROMOTION_MAX = 3;
69
+ /** Identifiers shorter than this are too generic to match prose on ("throw", "Error"). */
70
+ export const WORD_MIN = 6;
71
+
72
+ // Zone grouping: a zone is a file's *directory*, capped at this many leading
73
+ // segments — never a fixed-depth prefix of the path (which would cut into the
74
+ // filename) and never the filename itself. SPEC §4 shows zones at depth 5
75
+ // (`apps/mdl/src/server/services`) and depth 3 (`packages/cache/src`) in the
76
+ // same report, so the cap must follow the directory, not a constant.
77
+ export const ZONE_DEPTH = 5;
78
+ // Default cap on zones shown per convention — more than this is a wall, not an answer.
79
+ export const ZONE_CAP = 6;
package/src/detect.ts ADDED
@@ -0,0 +1,92 @@
1
+ // src/detect.ts — read a repo's package.json to detect its test runner.
2
+ //
3
+ // The Stop hook fires in every repo but used to hardcode fapony-specific
4
+ // commands in its block message (bug class: setup.ts, hook.ts). Now the message
5
+ // derives the command from the worktree at runtime — one source of truth, reused
6
+ // by the hook (decideStop) and by install (what it reports).
7
+
8
+ import { existsSync, readFileSync } from "node:fs";
9
+ import { join } from "node:path";
10
+
11
+ export type TestRunner = "bun" | "npm" | "pnpm" | "yarn";
12
+
13
+ export interface TestRunnerInfo {
14
+ runner: TestRunner;
15
+ testCmd: string;
16
+ typecheckCmd: string | null;
17
+ lockfile: string;
18
+ }
19
+
20
+ const RUNNER_LOCKFILE: Record<TestRunner, string> = {
21
+ bun: "bun.lock",
22
+ npm: "package-lock.json",
23
+ pnpm: "pnpm-lock.yaml",
24
+ yarn: "yarn.lock",
25
+ };
26
+
27
+ const RUNNER_TEST_CMD: Record<TestRunner, string> = {
28
+ bun: "bun test",
29
+ npm: "npm test",
30
+ pnpm: "pnpm test",
31
+ yarn: "yarn test",
32
+ };
33
+
34
+ const RUNNER_TYPECHECK_CMD: Record<TestRunner, string> = {
35
+ bun: "bun run typecheck",
36
+ npm: "npm run typecheck",
37
+ pnpm: "pnpm run typecheck",
38
+ yarn: "yarn run typecheck",
39
+ };
40
+
41
+ /**
42
+ * Detect a repo's test runner from its package.json + lockfile.
43
+ * Returns null when the worktree has no package.json or no recognizable runner.
44
+ *
45
+ * Priority: `packageManager` field (explicit) → lockfile presence (fallback).
46
+ * A repo with neither is foreign to us — the caller falls back to a generic
47
+ * "this repo's test suite" message rather than guessing.
48
+ */
49
+ export function detectTestRunner(worktree: string): TestRunnerInfo | null {
50
+ const pkgPath = join(worktree, "package.json");
51
+ if (!existsSync(pkgPath)) return null;
52
+
53
+ let pkg: { packageManager?: string; scripts?: Record<string, string> };
54
+ try {
55
+ pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
56
+ } catch {
57
+ return null;
58
+ }
59
+
60
+ const runner = detectRunner(worktree, pkg);
61
+ if (!runner) return null;
62
+
63
+ const scripts = pkg.scripts ?? {};
64
+ const typecheckCmd =
65
+ "typecheck" in scripts ? RUNNER_TYPECHECK_CMD[runner] : null;
66
+
67
+ return {
68
+ runner,
69
+ testCmd: RUNNER_TEST_CMD[runner],
70
+ typecheckCmd,
71
+ lockfile: RUNNER_LOCKFILE[runner],
72
+ };
73
+ }
74
+
75
+ function detectRunner(
76
+ worktree: string,
77
+ pkg: { packageManager?: string },
78
+ ): TestRunner | null {
79
+ const pm = pkg.packageManager;
80
+ if (typeof pm === "string") {
81
+ if (pm.startsWith("bun@")) return "bun";
82
+ if (pm.startsWith("pnpm@")) return "pnpm";
83
+ if (pm.startsWith("yarn@")) return "yarn";
84
+ if (pm.startsWith("npm@")) return "npm";
85
+ }
86
+ if (existsSync(join(worktree, "bun.lock"))) return "bun";
87
+ if (existsSync(join(worktree, "bun.lockb"))) return "bun";
88
+ if (existsSync(join(worktree, "pnpm-lock.yaml"))) return "pnpm";
89
+ if (existsSync(join(worktree, "yarn.lock"))) return "yarn";
90
+ if (existsSync(join(worktree, "package-lock.json"))) return "npm";
91
+ return null;
92
+ }
package/src/gate.ts CHANGED
@@ -1,6 +1,6 @@
1
- // gateOnce is the core review-verdict logic — still live, called by the MCP
2
- // verdict_submit tool (src/mcp/tools/verdict.ts). The CLI wrapper (cmdGate)
3
- // was removed with the rest of the execute→review→fix loop (Wave 2).
1
+ // gateOnce is the core review-verdict logic — still live, called by the CLI
2
+ // wrapper (cmdGate) was removed with the rest of the execute→review→fix loop
3
+ // (Wave 2). The MCP verdict_submit tool was removed in PLAN-verdict-to-mem.
4
4
  import {
5
5
  addEvent,
6
6
  getRun,