Initial curated projectbrain source from 8a7b1e0651dbdab97d744cbd2e653ab3970ac6c5
This commit is contained in:
commit
5aa3e8d685
700 files changed
+132801
No files matched your search
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { buildOpenApiDocument } from "@projectbrain/contracts";
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const target = resolve(root, "docs/openapi/projectbrain-v1.json");
|
||||
const generated = `${JSON.stringify(buildOpenApiDocument(), null, 2)}\n`;
|
||||
if (process.argv.includes("--check")) {
|
||||
const existing = await readFile(target, "utf8").catch(() => "");
|
||||
if (existing !== generated) { console.error("OpenAPI artifact is stale. Run pnpm docs:openapi."); process.exit(1); }
|
||||
console.log("OpenAPI artifact matches canonical contracts.");
|
||||
} else {
|
||||
await mkdir(dirname(target), { recursive: true });
|
||||
await writeFile(target, generated);
|
||||
console.log(`Wrote ${target}`);
|
||||
}
|
||||
Reference in new issue
Block a user