#!/usr/bin/env bun // Writes src/gui/icon-name.ts: the icon names 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). 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.", "", "/** An icon from the app's catalog, for SDK fields such as `SessionPanelMenuItem.icon`. */", "export type IconName =", ...names.map((name) => ` | ${JSON.stringify(name)}`), "", ].join("\n"), )