Expand description
Core library for Betamax terminal capture.
betamax-core is the reusable engine behind the betamax command-line
application. It parses VHS-style tape source, executes commands in a PTY,
feeds terminal output into libghostty-vt, renders terminal frames, writes
media artifacts, and can return structured terminal state for snapshot tests.
Most applications should start with Tape and Runner:
The full tape language is documented on the Betamax documentation site, including each command’s behavior and each setting’s default value.
use betamax_core::{Runner, Tape};
let tape = Tape::parse(
r#"
Output /tmp/betamax-state.json
Set Shell "bash"
Type "printf 'hello\n'"
Enter
Wait+Screen "hello"
Hide
Type "exit"
Enter
"#,
)?;
let artifacts = Runner::new().run_artifacts(&tape)?;
assert!(artifacts.final_state.is_some());§Module Guide
tapecontains the parser and in-memory command model. Use it when you need to inspect or construct tape commands before execution.runnerexecutes a parsed tape and writes requested outputs.ghosttyexposes the lower-level libghostty-vt session, theme, frame capture, and terminal-state types used by the runner.mediacontains raw frame types and format writers. These are public for embedders that want to render or encode frames directly, but the higher levelRunnerAPI is the stable path for most users.
§Stability Notes
The crate is pre-1.0. The tape parser and runner are intended to become the
primary stable API. Lower-level rendering and media modules are public because
they are useful for tests and tools, but their exact shape may still change as
libghostty exposes more rendering functionality.
Modules§
- ghostty
- libghostty-vt integration and software raster rendering.
- media
- Media file writers and frame conversion.
- runner
- Tape execution orchestration.
- state_
diff - Text-first comparison helpers for Betamax terminal state snapshots.
- tape
- Tape parsing and the in-memory command model.
Structs§
- Error
- Error returned by
betamax-core. - RunArtifacts
- Artifacts and terminal state returned from a completed run.
- Runner
- Runs parsed tapes.
- Tape
- Parsed tape source.
Traits§
- Frame
Capture - Opens terminal sessions for captured tape runs.
- Terminal
Session - Terminal session used by the runner’s capture path.
Type Aliases§
- Result
- Result type returned by
betamax-core.