branding: paint banner hex as truecolor SGR - #727
Conversation
styleText (node:util) validates its format argument at runtime and accepts only named formats, but the type advertises hex — a token file whose banner-green resolves to #00ED64 crashed the first render on runtimes that validate (Bun 1.3.x, ERR_INVALID_ARG_VALUE) and dropped the colour on the lenient ones. The banner now emits the truecolor sequence itself, degrading to plain text under NO_COLOR or a non-TTY stdout, the same rule the frame already follows. The failing check pins the exact escape sequence. Receipt-Id: 1fcddb8b
🌱 graft blast radius1 area changed → 1 area can be affected. 1 dependent symbol, depth 2. flowchart TB
A0(("Command Line Interface<br/>1 symbol"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0 reached;
All 1 dependent symbol, grouped by areaCommand Line Interface — 1 symbol in 1 file
Test signal per changed area — 1 ✓Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
Open the interactive graph → — click an area to see the code that changed, and the line that reaches it. |
|



Cause
styleText(node:util) validates its format argument at runtime and accepts only named formats — but its TypeScript type advertises hex.src/theme.tsemitsBANNER_GREEN = '#00ED64'(generated frombrand/tokens.json→accent), so:ERR_INVALID_ARG_VALUEat the first render —ai-engcrashed on startup. Reported on a fresh macOS install.Fix
src/branding.tspaints the declared hex as a raw truecolor SGR sequence (ESC[38;2;r;g;b) itself, degrading to plain text underNO_COLORor a non-TTY stdout — the same rule the rest of the frame follows. Named formats still route throughstyleText. The generator is untouched: it emitted the hex correctly; the consumer defined the wrong contract.Check
New test in
tests/cli-ux.test.ts: forces TTY, runsshowLogo, asserts the exact escape\x1b[38;2;0;237;100m. Fails deterministically pre-fix on every runtime (strict: crash; lenient: no escape), passes post-fix. Env hygiene: the fixture restoresisTTY(incl. the inherited-getter case viaReflect.deleteProperty) andNO_COLOR— verified that a leakedisTTY: truewas flipping later doctor/uninstall specs.Verification
bun test: 698 pass / 0 fail (clean-tree baseline 697; +1 is the new check)tsc --noEmit: 0 errors in src/tests ·oxlint src tests: clean on touched files