The open source coding agent.
TypeScript
ci: generate config schema as part of build
Dax Raad5c626e0a2fb7
diff --git a/packages/opencode/script/schema.ts b/packages/opencode/script/schema.tsindex 4aa1d982374..008c168cbd4 100755--- a/packages/opencode/script/schema.ts+++ b/packages/opencode/script/schema.ts@@ -4,6 +4,8 @@ import "zod-openapi/extend"import { Config } from "../src/config/config"import { zodToJsonSchema } from "zod-to-json-schema"+const file = process.argv[2]+const result = zodToJsonSchema(Config.Info, {/*** We'll use the `default` values of the field as the only value in `examples`.@@ -30,4 +32,4 @@ const result = zodToJsonSchema(Config.Info, {return jsonSchema},})-await Bun.write("config.schema.json", JSON.stringify(result, null, 2))+await Bun.write(file, JSON.stringify(result, null, 2))diff --git a/packages/web/astro.config.mjs b/packages/web/astro.config.mjsindex aea32caec14..38a339c7411 100644--- a/packages/web/astro.config.mjs+++ b/packages/web/astro.config.mjs@@ -7,6 +7,7 @@ import theme from "toolbeam-docs-theme"import config from "./config.mjs"import { rehypeHeadingIds } from "@astrojs/markdown-remark"import rehypeAutolinkHeadings from "rehype-autolink-headings"+import { spawnSync } from "child_process"const github = "https://github.com/sst/opencode"@@ -26,7 +27,9 @@ export default defineConfig({markdown: {rehypePlugins: [rehypeHeadingIds, [rehypeAutolinkHeadings, { behavior: "wrap" }]],},+ build: {},integrations: [+ configSchema(),solidJs(),starlight({title: "opencode",@@ -83,3 +86,15 @@ export default defineConfig({"/discord": "https://discord.com/invite/opencode",},})++function configSchema() {+ return {+ name: "configSchema",+ hooks: {+ "astro:build:done": async () => {+ console.log("generating config schema")+ spawnSync("../opencode/script/schema.ts", ["./dist/config.json"])+ },+ },+ }+}