Motivation
preview snapshot currently writes a PNG to disk and prints the path. For users on terminals that support inline images, we could render the snapshot directly in the terminal after (or instead of) writing the file — a much tighter feedback loop for iterating on UI.
Candidate protocols
- iTerm2 inline images — base64-encoded OSC 1337 escape (
ESC ] 1337 ; File=...). Widely supported by iTerm2, WezTerm.
- Kitty graphics protocol — chunked OSC escape with broader capabilities; supported by Kitty, WezTerm, Ghostty.
- Sixel — older standard; supported by mlterm, foot, some xterm builds.
Open questions
- How do we detect terminal capability? (
$TERM_PROGRAM, $TERM, $KITTY_WINDOW_ID, terminfo queries via XTGETTCAP?)
- Opt-in flag, opt-out flag, or auto-detect with override?
- Behavior when piping stdout (e.g.
preview snapshot | jq) — should suppress images.
- Behavior in
--json mode — keep path-only, or embed base64?
- Downscale large snapshots before emitting so we don't blow up the scrollback? What's the right max width?
- Does this fit in
PreviewsCLI directly, or warrant a small helper module?
Acceptance criteria (tentative)
Motivation
preview snapshotcurrently writes a PNG to disk and prints the path. For users on terminals that support inline images, we could render the snapshot directly in the terminal after (or instead of) writing the file — a much tighter feedback loop for iterating on UI.Candidate protocols
ESC ] 1337 ; File=...). Widely supported by iTerm2, WezTerm.Open questions
$TERM_PROGRAM,$TERM,$KITTY_WINDOW_ID, terminfo queries viaXTGETTCAP?)preview snapshot | jq) — should suppress images.--jsonmode — keep path-only, or embed base64?PreviewsCLIdirectly, or warrant a small helper module?Acceptance criteria (tentative)
--json/ scripting workflows