feat: add factory repo gate

This commit is contained in:
artale 2026-06-15 17:45:57 +02:00
parent 4b19e7f518
commit c7b50d867f
2 changed files with 37 additions and 11 deletions

View File

@ -154,6 +154,8 @@ fable-agent plinius godmode "improve explanation quality"
### `factory`
- `factory check`
- `factory gate <task>`
- `--repo <path>`
### `familiar`

View File

@ -1426,23 +1426,47 @@ const factory = program
.command("factory")
.description("Factory/VPS status and deployment guards");
async function printFactoryCheck(): Promise<void> {
const { formatFactoryCheck } = await import("./fable5/factory-status.js");
const getJson = async (url: string) => {
const res = await fetch(url);
if (!res.ok) throw new Error(url + " returned " + res.status);
return res.json();
};
const [factoryStatus, deployHealth] = await Promise.all([
getJson("http://77.42.112.29:8099/factory-status"),
getJson("http://77.42.112.29:8098/health"),
]);
console.log(formatFactoryCheck(factoryStatus, deployHealth));
}
factory
.command("check")
.description("Check factory status and deploy-webhook health")
.action(async () => {
const { formatFactoryCheck } = await import("./fable5/factory-status.js");
const getJson = async (url: string) => {
const res = await fetch(url);
if (!res.ok) throw new Error(url + " returned " + res.status);
return res.json();
};
await printFactoryCheck();
});
const [factoryStatus, deployHealth] = await Promise.all([
getJson("http://77.42.112.29:8099/factory-status"),
getJson("http://77.42.112.29:8098/health"),
]);
factory
.command("gate <task>")
.description("Run factory check plus local ZTE/repo verification gate")
.option("--repo <path>", "Repo path to verify", ".")
.action(async (task: string, opts: { repo?: string }) => {
const { spawnSync } = await import("node:child_process");
await printFactoryCheck();
console.log(formatFactoryCheck(factoryStatus, deployHealth));
const repo = path.resolve(opts.repo ?? ".");
console.log(` ZTE Gate: ${task}`);
console.log(` Repo: ${repo}`);
console.log(``);
const args = [process.argv[1], "fable5", "verify", task, "--repo", repo];
const check = spawnSync(process.execPath, args, { cwd: repo, stdio: "inherit" });
if (check.status !== 0) process.exit(check.status ?? 1);
console.log(` ✓ Factory gate passed; deploy still requires explicit token/contract.`);
console.log(``);
});
// ── Fable 5 ─────────────────────────────────────────────────