From 92ebedc70371bb8431ce29ab805ad30a458a6c6d Mon Sep 17 00:00:00 2001 From: artale Date: Mon, 15 Jun 2026 14:33:37 +0200 Subject: [PATCH] feat: add repo verification gate --- COMMANDS.md | 1 + src/index.ts | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/COMMANDS.md b/COMMANDS.md index 2a98cfb..feab110 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -186,6 +186,7 @@ fable-agent plinius godmode "improve explanation quality" - `-d, --domain ` - `fable5 models` - `fable5 verify ` + - `--repo ` - `fable5 goal ` - `-i, --iterations ` - `-s, --min-score ` diff --git a/src/index.ts b/src/index.ts index 0c86c2e..bb3161c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1487,7 +1487,39 @@ fable fable .command("verify ") .description("Run independent verifier against a task") - .action(async (task: string) => { + .option("--repo ", "Also run the repo verification gate at this path") + .action(async (task: string, opts: { repo?: string }) => { + if (opts.repo) { + const { spawnSync } = await import("node:child_process"); + const repo = path.resolve(opts.repo); + const checks: Array<[string, string[]]> = [ + ["npm", ["run", "-s", "test"]], + ["npm", ["run", "-s", "build"]], + ["npm", ["run", "-s", "docs:check"]], + ["npx", ["tsc", "--noEmit"]], + [process.execPath, [process.argv[1], "security", "scan", repo]], + ]; + + console.log(` + Repo Verification Gate: ${repo}`); + for (const [cmd, args] of checks) { + console.log(` + $ ${[cmd, ...args].join(" ")}`); + // ponytail: Windows npm/npx shims need cmd.exe; commands are fixed, no user shell input. + const check = process.platform === "win32" && (cmd === "npm" || cmd === "npx") + ? spawnSync("cmd.exe", ["/d", "/s", "/c", [cmd, ...args].join(" ")], { cwd: repo, stdio: "inherit" }) + : spawnSync(cmd, args, { cwd: repo, stdio: "inherit" }); + if (check.status !== 0) { + console.error(` + ✗ Repo verification failed`); + process.exit(check.status ?? 1); + } + } + console.log(` + ✓ Repo verification passed +`); + } + const { IndependentVerifier } = await import("./fable5/independent-verifier.js"); const verifier = new IndependentVerifier();