--- name: preview description: Renders a ChatKit widget JSON file to a PNG image or a self-contained HTML file locally. Use when the user wants to see a saved widget JSON, needs a shareable/openable HTML version of a widget, or wants a dark-mode PNG. --- # Preview a widget file Renders saved widget JSON (a bare tree, or any JSON with a `widget` field — `generate_widget`/`widget-generate --out` output works as-is) without calling any API. The CLI is `widget-render`, on PATH in plugin sessions (bare checkout: `node scripts/render-widget.mjs` from the repo). ```bash widget-render --in widget.json --png widget.png # light PNG, 2x scale widget-render --in widget.json --png widget-dark.png --theme dark widget-render --in widget.json --html preview.html # self-contained HTML, opens anywhere ``` - `--in -` reads stdin, so you can pipe edited JSON without a temp file. - `--theme` affects PNGs only. The HTML output has no baked-in theme — it follows the viewer's system light/dark preference when opened. - Both outputs are dependency-free (PNG rendering is bundled — no browser needed). If rendering errors, run `/widget-studio:doctor`. - Show the result: attach the PNG, or point the user at the HTML file.