#!/usr/bin/env bun // Writes src/gui/icon-name.ts: the names of the app's own icons that GUI SDK fields accept, from the app's icon catalog // in packages/ui. The published SDK cannot depend on @opencode/ui, so it carries the names; packages/gui-plugins fails // its typecheck when they drift (src/icon-name.typecheck.ts). A plugin's own icons are not listed here: it declares // them in `Plugin.define({ icons })`. import { fileURLToPath } from "node:url" import { iconNames } from "../../ui/src/icons/catalog" const names = iconNames().toSorted() await Bun.write( fileURLToPath(new URL("../src/gui/icon-name.ts", import.meta.url)), [ "// Generated by `bun run generate` (script/icon-name.ts) from the app's icon catalog. Do not edit.", "", "/** One of the app's own icons, by its name in the app's icon catalog. */", "export type AppIconName =", ...names.map((name) => ` | ${JSON.stringify(name)}`), "", ].join("\n"), )