Skip to main content

Crate betamax_core

Crate betamax_core 

Source
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

  • tape contains the parser and in-memory command model. Use it when you need to inspect or construct tape commands before execution.
  • runner executes a parsed tape and writes requested outputs.
  • ghostty exposes the lower-level libghostty-vt session, theme, frame capture, and terminal-state types used by the runner.
  • media contains raw frame types and format writers. These are public for embedders that want to render or encode frames directly, but the higher level Runner API 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§

FrameCapture
Opens terminal sessions for captured tape runs.
TerminalSession
Terminal session used by the runner’s capture path.

Type Aliases§

Result
Result type returned by betamax-core.