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.
22 lines
1.2 KiB
TypeScript
22 lines
1.2 KiB
TypeScript
// Writes crates/ui/src/theme/generated/themes.json: every built-in theme as the V2 document the TypeScript TUI
|
|
// resolves under the `new-designs` experiment, so the Rust resolver starts from the same documents. V1 themes are
|
|
// migrated here, once per migration: `mini` is the `migrateV1` document, as mini parses without the experiment.
|
|
import { DEFAULT_THEMES, getOpenCodeClassicTheme, getOpenCodeTheme, parseTheme } from "../../../tui/src/theme/index.ts"
|
|
|
|
const output = new URL("../../crates/ui/src/theme/generated/themes.json", import.meta.url).pathname
|
|
|
|
// The order of the theme context's list (`allThemes`): the V1 defaults, opencode, then opencode-classic.
|
|
const themes = [
|
|
...Object.entries(DEFAULT_THEMES).map(([name, source]) => ({
|
|
name,
|
|
document: parseTheme(source, name, { newDesigns: true }),
|
|
mini: parseTheme(source, name),
|
|
})),
|
|
{ name: "opencode", document: getOpenCodeTheme() },
|
|
{ name: "opencode-classic", document: getOpenCodeClassicTheme() },
|
|
]
|
|
|
|
// One theme per line keeps the committed file small and its diffs readable.
|
|
const lines = themes.map((theme) => JSON.stringify(theme)).join(",\n")
|
|
await Bun.write(output, `{"themes":[\n${lines}\n]}\n`)
|
|
console.log(`themes: wrote ${themes.length} themes to ${output}`)
|