chore(tooling): make the screenshot recipe work with no setup
Two things this session depended on lived only in a scratchpad, so the next agent would have had to reinvent them from a prose hint: - scripts/screenshot-fonts.conf, now applied by screenshot.ts itself. Without it this container renders every generic font family as Fira Code and the UI looks monospaced in a way no user sees — a trap that nearly produced a "fix" for a font bug that does not exist. - scripts/demo-data.ts, which seeds a visibly synthetic dataset. Without it every screenshot shows an app full of zeros, because Chrome starts from a fresh profile each run. CLAUDE.md now carries the two-command recipe verbatim instead of "point FONTCONFIG_FILE at an override", and says why --reload is mandatory. Verified from a clean shell with no environment set. Also flags docs/superpowers/plans/2026-09-01-budget-app.md as a historical record: its snippets still show CURRENCIES and CURRENCY_DIGITS, which no longer exist, and an agent reading it as current would be misled. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
151cd530f5
commit
bd5a01e03e
+14
-1
@@ -30,6 +30,19 @@ const width = Number(flag("w", "1280"));
|
||||
const height = Number(flag("h", "900"));
|
||||
const waitMs = Number(flag("wait", "1500"));
|
||||
|
||||
/**
|
||||
* This container's fontconfig resolves EVERY generic family — sans-serif,
|
||||
* system-ui, monospace — to Fira Code, a monospace font. Screenshots then show
|
||||
* the whole UI monospaced in a way no real user sees, and the last agent to
|
||||
* look nearly "fixed" a font bug that did not exist. Applied automatically so
|
||||
* nobody has to know that; set FONTCONFIG_FILE yourself to override.
|
||||
*/
|
||||
const fontConfig = new URL("./screenshot-fonts.conf", import.meta.url).pathname;
|
||||
const fontEnv =
|
||||
process.env.FONTCONFIG_FILE || !(await Bun.file(fontConfig).exists())
|
||||
? {}
|
||||
: { FONTCONFIG_FILE: fontConfig };
|
||||
|
||||
const chrome = Bun.spawn(
|
||||
[
|
||||
process.env.CHROME ?? "google-chrome",
|
||||
@@ -49,7 +62,7 @@ const chrome = Bun.spawn(
|
||||
...(has("dark") ? ["--force-dark-mode", "--enable-features=WebContentsForceDark"] : []),
|
||||
"about:blank",
|
||||
],
|
||||
{ stdout: "ignore", stderr: "pipe" },
|
||||
{ stdout: "ignore", stderr: "pipe", env: { ...process.env, ...fontEnv } },
|
||||
);
|
||||
|
||||
/** Chrome announces its debugging endpoint on stderr, once, at startup. */
|
||||
|
||||
Reference in New Issue
Block a user