Skip to content
rustcliterminaldevtools

rec

A CLI tool to record, replay and export terminal sessions: every command captured by shell hooks, replayed with safety controls, exported to scripts and CI.

since February 20260Rustpushed 8 months ago

rec

rec records the commands you run in a shell session, then replays them with safety controls or exports them to scripts, CI configs and docs. The deploy you just did by hand is already a runbook, as long as you were recording.

I made it after writing the same "how to deploy" doc for the third time, each copy slightly out of date. Shell hooks capture every command with its working directory, exit code and timing, and nothing runs when you're not recording. Bash, Zsh and Fish are supported natively. Storage is crash-safe NDJSON with an fsync after every command, sessions from a crashed process get recovered on the next start, and every session has a name, generated for you if you don't give one.

Install

cargo install rec-cli
 
# With the interactive TUI (optional)
cargo install rec-cli --features tui

Pre-built binaries for Linux (x86_64, aarch64) and macOS (x86_64, Apple Silicon) are on the releases page.

A session, start to finish

# 1. Set up shell hooks (add to your .bashrc, .zshrc, or config.fish)
eval "$(rec init bash)"   # or: zsh, fish
 
# 2. Record a session
rec start deploy-server
echo "deploying..."
git pull origin main
docker compose up -d
rec stop
 
# 3. Replay it
rec replay deploy-server              # interactive replay
rec replay deploy-server --dry-run    # preview without executing
rec replay deploy-server --step       # one command at a time
 
# 4. Export to a reusable format
rec export deploy-server -f bash -o deploy.sh
rec export deploy-server -f github-action -o .github/workflows/deploy.yml
rec export deploy-server -f dockerfile -o Dockerfile

The dry run and step mode are the safety controls. You see what would run before it runs, one command at a time if you like. It's written in Rust, MSRV 1.85, under the MIT licence. It's in maintenance mode now and not under active development, because it does what I needed.

latest on main

  1. db01749docs: improve demo GIF timing and remove unused assets8 months ago
  2. 55703aedocs: use zsh with rec hooks for accurate command recording in demo8 months ago
  3. 9128bcbdocs: use JetBrains Mono font and Gruvbox Dark theme for demo GIF8 months ago
  4. f46c76bdocs: improve demo GIF with cleaner commands8 months ago
  5. 0551e5ddocs: add demo GIF to README8 months ago
  6. 669e3c0chore: add pre-commit hook setup script8 months ago
  7. all commits →