Today — the crate ships one runnable tool, examples/inspect.rs, which spawns a program and prints its screen. Measured against 0.9.0: it takes --size, --timeout and --idle, prints text only, and has no notion of a saved screen. Two .snap files — the one in the repository and the .snap.new insta wrote on a failure — can be compared only by cargo insta review, on the machine that ran the tests, in text.
Why it is worth fixing — a coloured, cell-aware diff of two saved screens is useful in three places cargo insta review does not reach: a shell (termlens diff a.snap b.snap after pulling a colleague's failing branch), a CI step (the report action, #251, wants exactly this rendering), and as a dogfooding target — a TUI written and tested with termlens, in this repository, exercising the crate the way its users do. cargo insta review remains the review workflow; this renders a diff, it does not review one.
Fix — grow inspect into a small binary crate, crates/termlens-cli, published as termlens-cli, with subcommands:
Parsing the text format back into a Screen is the one genuinely new piece and belongs in the library behind a parse function so the format is round-trippable; DESIGN §3 already specifies it precisely enough. The example stays until the crate is published, then becomes a two-line pointer.
Done when — cargo install termlens-cli provides inspect, diff and render; termlens diff renders Screen::diff of two .snap files with colour on a TTY and exits non-zero on a difference; the text format round-trips through parse; and the CLI's own tests drive it with termlens.
Today — the crate ships one runnable tool,
examples/inspect.rs, which spawns a program and prints its screen. Measured against 0.9.0: it takes--size,--timeoutand--idle, prints text only, and has no notion of a saved screen. Two.snapfiles — the one in the repository and the.snap.newinsta wrote on a failure — can be compared only bycargo insta review, on the machine that ran the tests, in text.Why it is worth fixing — a coloured, cell-aware diff of two saved screens is useful in three places
cargo insta reviewdoes not reach: a shell (termlens diff a.snap b.snapafter pulling a colleague's failing branch), a CI step (the report action, #251, wants exactly this rendering), and as a dogfooding target — a TUI written and tested with termlens, in this repository, exercising the crate the way its users do.cargo insta reviewremains the review workflow; this renders a diff, it does not review one.Fix — grow
inspectinto a small binary crate,crates/termlens-cli, published astermlens-cli, with subcommands:termlens inspect [--size] [--timeout] [--idle] [--ansi] <program> [args…]— today's example, plus colour.termlens diff <a> <b>— parse two saved screens (theDisplaytext format ofdocs/DESIGN.md§3 including thestyles:block; JSON once Noserdefeature, so aScreencannot be exported as JSON or read back #247 exists) and renderScreen::diff(Two screens that differ print as two whole grids; there is noScreen::diff#246) in colour on a TTY, plain otherwise, exit 1 when they differ.termlens render --svg|--html|--ansi <snap>— the renderers (A failing screen can only be read as text; there is no ANSI, SVG or HTML rendering of aScreen#248), for scripts.Parsing the text format back into a
Screenis the one genuinely new piece and belongs in the library behind aparsefunction so the format is round-trippable; DESIGN §3 already specifies it precisely enough. The example stays until the crate is published, then becomes a two-line pointer.Done when —
cargo install termlens-cliprovidesinspect,diffandrender;termlens diffrendersScreen::diffof two.snapfiles with colour on a TTY and exits non-zero on a difference; the text format round-trips throughparse; and the CLI's own tests drive it with termlens.