Problem
The MCP server exposes preview_snapshot to capture a screenshot of a running session, but the CLI run command has no equivalent. The snapshot CLI command is one-shot — it creates its own session, captures, and tears down. There's no way to capture the window from a run session programmatically.
This gap makes it impossible to:
Desired behavior
snapshot should reuse an existing running session when one exists for the same file. If run already has a preview window open, snapshot should capture that window rather than booting a new session. It should only create and tear down its own session when no existing session is running.
Possible approaches
- Session discovery:
run registers its session (e.g., via a pidfile or Unix socket), snapshot checks for it before creating a new one
--snapshot-dir flag on run: dump a PNG to a directory after each reload (automatic, no separate command needed)
- Unix socket:
run listens on a socket, snapshot (or a new capture subcommand) connects and requests a screenshot
Context
Discovered while testing #91 — the setup dylib hot-reload fix couldn't be visually verified via CLI because run has no capture mechanism.
Problem
The MCP server exposes
preview_snapshotto capture a screenshot of a running session, but the CLIruncommand has no equivalent. ThesnapshotCLI command is one-shot — it creates its own session, captures, and tears down. There's no way to capture the window from arunsession programmatically.This gap makes it impossible to:
Desired behavior
snapshotshould reuse an existing running session when one exists for the same file. Ifrunalready has a preview window open,snapshotshould capture that window rather than booting a new session. It should only create and tear down its own session when no existing session is running.Possible approaches
runregisters its session (e.g., via a pidfile or Unix socket),snapshotchecks for it before creating a new one--snapshot-dirflag onrun: dump a PNG to a directory after each reload (automatic, no separate command needed)runlistens on a socket,snapshot(or a newcapturesubcommand) connects and requests a screenshotContext
Discovered while testing #91 — the setup dylib hot-reload fix couldn't be visually verified via CLI because
runhas no capture mechanism.