Tape files
The CLI (tui-test tape) and the Rust tui_test::tape module compile and run a subset of Charmbracelet VHS’s supported tape commands to export a GIF from an isolated shell session. Python, JavaScript, and Go bindings do not expose a tape API; use session recordings when driving captures from code.
Write a tape
Section titled “Write a tape”Save the following script as demo.tape:
Output demo.gifSet Columns 48Set Rows 8Set Padding 16Set FontSize 18Set CursorBlink falseHideType@0 'echo Hello from tui-test'ShowEnter@200msSleep 1sHideOnly run .tape files you trust. Tape scripts execute real commands in a local shell without sandboxing, and tape check validates syntax and preflight requirements rather than command safety.
Validate and run
Section titled “Validate and run”tui-test tape check demo.tape --jsontui-test tape run demo.tapetape check parses the file, resolves Source imports, compiles the execution plan, and verifies Require binaries and output paths without starting a shell or writing files. tape run performs the same validation, runs the plan in an isolated session (defaulting to bash on Unix or PowerShell on Windows), writes demo.gif, and tears down the session. Both commands report grid dimensions, pixel dimensions, and source-located warnings.
To try the checked-in fixture from a source checkout:
tui-test tape check crates/tui-test/tests/fixtures/tape/run.tape --jsontui-test tape run crates/tui-test/tests/fixtures/tape/run.tapePath resolution and CLI behavior
Section titled “Path resolution and CLI behavior”- Root tape paths,
Sourceincludes,Requirelookups, andOutputpaths resolve relative to the caller’s working directory, not the directory containing the.tapefile. - Tape delays (
Sleep,@duration) are fixed timers and do not wait for shell commands to finish; reaching the end of the tape closes the shell even if a background command is still running. Use regulartui-testsessions when you need state-based waits or assertions. - Tape commands run standalone without CLI daemons,
tui-test.toml, orTUI_TEST_SESSION. Only the global--jsonflag is accepted;--session,--verbose,--failure-artifacts,--diagnostic-context,--context-file, and--operation-nameare rejected with exit code2.
Rust tui_test::tape module
Section titled “Rust tui_test::tape module”In Rust, tui_test::tape exposes parse, load, compile, check, and run. Parsing and compilation work without optional Cargo features; check and run require recording-raster (plus recording-font-jetbrains-mono to bundle the default font). tui-test implements a subset of the VHS command reference (based on VHS v0.12.1) rather than every VHS directive; see references/tape.md and docs.rs/tui-test-rs/latest/tui_test/tape for the exact supported commands, settings, and differences.