Skip to content

CLI run command has no way to capture a snapshot of the running preview #92

@obj-p

Description

@obj-p

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions