mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
Add packages/cli-rs, an OpenCode client written in Rust on OpenTUI's Rust crates. It is a client only.
13 lines
692 B
TypeScript
13 lines
692 B
TypeScript
// Generates the plugin contract schema from its Rust types.
|
|
import { format, resolveConfig } from "prettier"
|
|
|
|
const root = new URL("../..", import.meta.url).pathname
|
|
const proc = Bun.spawnSync(
|
|
["cargo", "run", "-q", "-p", "opencode-plugin-abi", "--example", "schema"],
|
|
{ cwd: root, stdout: "pipe", stderr: "inherit" },
|
|
)
|
|
if (proc.exitCode !== 0) process.exit(proc.exitCode ?? 1)
|
|
const file = new URL("../../crates/plugin-abi/schema/v2.json", import.meta.url).pathname
|
|
const text = proc.stdout.toString()
|
|
await Bun.write(file, await format(text, { ...(await resolveConfig(file)), parser: "json" }))
|
|
console.log(`plugin-schema: ${Object.keys(JSON.parse(text).$defs).length} definitions`)
|