mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-31 16:03:36 +00:00
16 lines
561 B
TypeScript
16 lines
561 B
TypeScript
import { OpenApi } from "effect/unstable/httpapi"
|
|
import { fileURLToPath } from "url"
|
|
import { ClientApi } from "../src/client.js"
|
|
|
|
const document = JSON.stringify(OpenApi.fromApi(ClientApi), null, 2) + "\n"
|
|
const target = fileURLToPath(new URL("../openapi.json", import.meta.url))
|
|
|
|
if (process.argv.includes("--check")) {
|
|
if ((await Bun.file(target).text()) !== document) {
|
|
console.error("Generated OpenAPI document is stale. Run `bun run generate` from packages/protocol.")
|
|
process.exit(1)
|
|
}
|
|
process.exit(0)
|
|
}
|
|
|
|
await Bun.write(target, document)
|