MCPcopy
hub / github.com/charmbracelet/vhs

github.com/charmbracelet/vhs @v0.11.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.11.0 ↗
255 symbols 674 edges 41 files 187 documented · 73%
README

VHS

Latest Release Go Docs Build Status

Write terminal GIFs as code for integration testing and demoing your CLI tools.

Welcome to VHS

The above example was generated with VHS (view source).

Tutorial

To get started, install VHS and create a new .tape file.

vhs new demo.tape

Open the .tape file with your favorite $EDITOR.

vim demo.tape

Tape files consist of a series of commands. The commands are instructions for VHS to perform on its virtual terminal. For a list of all possible commands see the command reference.

# Where should we write the GIF?
Output demo.gif

# Set up a 1200x600 terminal with 46px font.
Set FontSize 46
Set Width 1200
Set Height 600

# Type a command in the terminal.
Type "echo 'Welcome to VHS!'"

# Pause for dramatic effect...
Sleep 500ms

# Run the command by pressing enter.
Enter

# Admire the output for a bit.
Sleep 5s

Once you've finished, save the file and feed it into VHS.

vhs demo.tape

All done! You should see a new file called demo.gif (or whatever you named the Output) in the directory.

A GIF produced by the VHS code above

For more examples see the examples/ directory.

Installation

[!NOTE] VHS requires ttyd and ffmpeg to be installed and available on your PATH.

Use a package manager:

# macOS or Linux
brew install vhs

# Arch Linux (btw)
pacman -S vhs

# Nix
nix-env -iA nixpkgs.vhs

# Windows using scoop
scoop install vhs

Or, use Docker to run VHS directly, dependencies included:

docker run --rm -v $PWD:/vhs ghcr.io/charmbracelet/vhs <cassette>.tape

Or, download it:

  • Packages are available in Debian and RPM formats
  • Binaries are available for Linux, macOS, and Windows

Or, just install it with go:

go install github.com/charmbracelet/vhs@latest

Windows, Debian, Ubuntu, Fedora, RHEL, Void Instructions

  • Debian / Ubuntu
# Debian/Ubuntu
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
# Install ttyd from https://github.com/tsl0922/ttyd/releases
sudo apt update && sudo apt install vhs ffmpeg
  • Fedora / RHEL
echo '[charm]
name=Charm
baseurl=https://repo.charm.sh/yum/
enabled=1
gpgcheck=1
gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
# Install ttyd from https://github.com/tsl0922/ttyd/releases
sudo yum install vhs ffmpeg
  • Void
sudo xbps-install vhs
  • Windows
winget install charmbracelet.vhs
# or scoop
scoop install vhs

Record Tapes

VHS has the ability to generate tape files from your terminal actions!

To record to a tape file, run:

vhs record > cassette.tape

Perform any actions you want and then exit the terminal session to stop recording. You may want to manually edit the generated .tape file to add settings or modify actions. Then, you can generate the GIF:

vhs cassette.tape

Publish Tapes

VHS allows you to publish your GIFs to our servers for easy sharing with your friends and colleagues. Specify which file you want to share, then use the publish sub-command to host it on vhs.charm.sh. The output will provide you with links to share your GIF via browser, HTML, and Markdown.

vhs publish demo.gif

The VHS Server

VHS has an SSH server built in! When you self-host VHS you can access it as though it were installed locally. VHS will have access to commands and applications on the host, so you don't need to install them on your machine.

To start the server run:

vhs serve

Configuration Options

  • VHS_PORT: The port to listen on (1976)
  • VHS_HOST: The host to listen on (localhost)
  • VHS_GID: The Group ID to run the server as (current user's GID)
  • VHS_UID: The User ID to run the server as (current user's UID)
  • VHS_KEY_PATH: The path to the SSH key to use (.ssh/vhs_ed25519)
  • VHS_AUTHORIZED_KEYS_PATH: The path to the authorized keys file (empty, publicly accessible)

Then, simply access VHS from a different machine via ssh:

ssh vhs.example.com < demo.tape > demo.gif

VHS Command Reference

[!NOTE] You can view all VHS documentation on the command line with vhs manual.

There are a few basic types of VHS commands:

Output

The Output command allows you to specify the location and file format of the render. You can specify more than one output in a tape file which will render them to the respective locations.

Output out.gif
Output out.mp4
Output out.webm
Output frames/ # a directory of frames as a PNG sequence

Require

The Require command allows you to specify dependencies for your tape file. These are useful to fail early if a required program is missing from the $PATH, and it is certain that the VHS execution will not work as expected.

Require commands must be defined at the top of a tape file, before any non- setting or non-output command.

# A tape file that requires gum and glow to be in the $PATH
Require gum
Require glow

Settings

The Set command allows you to change global aspects of the terminal, such as the font settings, window dimensions, and GIF output location.

Setting must be administered at the top of the tape file. Any setting (except TypingSpeed) applied after a non-setting or non-output command will be ignored.

Set Shell

Set the shell with the Set Shell <shell> command

Set Shell fish

Set Font Size

Set the font size with the Set FontSize <number> command.

Set FontSize 10
Set FontSize 20
Set FontSize 40

Example of setting the font size to 10 pixels

Example of setting the font size to 20 pixels

Example of setting the font size to 40 pixels

Set Font Family

Set the font family with the Set FontFamily "<font>" command

Set FontFamily "Monoflow"

Example of changing the font family to Monoflow

Set Width

Set the width of the terminal with the Set Width command.

Set Width 300

Example of changing the width of the terminal

Set Height

Set the height of the terminal with the Set Height command.

Set Height 1000

Example of changing the height of the terminal

Set Letter Spacing

Set the spacing between letters (tracking) with the Set LetterSpacing Command.

Set LetterSpacing 20

Example of changing the letter spacing to 20 pixels between characters

Set Line Height

Set the spacing between lines with the Set LineHeight Command.

Set LineHeight 1.8

Example of changing the line height to 1.8

Set Typing Speed

Set TypingSpeed 500ms # 500ms
Set TypingSpeed 1s    # 1s

Set the typing speed of seconds per key press. For example, a typing speed of 0.1 would result in a 0.1s (100ms) delay between each character being typed.

This setting can also be overwritten per command with the @<time> syntax.

Set TypingSpeed 0.1
Type "100ms delay per character"
Type@500ms "500ms delay per character"

Example of using the Type command in VHS

Set Theme

Set the theme of the terminal with the Set Theme command. The theme value should be a JSON string with the base 16 colors and foreground + background.

Set Theme { "name": "Whimsy", "black": "#535178", "red": "#ef6487", "green": "#5eca89", "yellow": "#fdd877", "blue": "#65aef7", "magenta": "#aa7ff0", "cyan": "#43c1be", "white": "#ffffff", "brightBlack": "#535178", "brightRed": "#ef6487", "brightGreen": "#5eca89", "brightYellow": "#fdd877", "brightBlue": "#65aef7", "brightMagenta": "#aa7ff0", "brightCyan": "#43c1be", "brightWhite": "#ffffff", "background": "#29283b", "foreground": "#b3b0d6", "selection": "#3d3c58", "cursor": "#b3b0d6" }

Example of changing the theme to Whimsy

You can also set themes by name:

Set Theme "Catppuccin Frappe"

See the full list by running vhs themes, or in THEMES.md.

Set Padding

Set the padding (in pixels) of the terminal frame with the Set Padding command.

Set Padding 0

<source media="(prefers-color-scheme: light)" srcset="h

Extension points exported contracts — how you extend this code

EvaluatorOption (FuncType)
EvaluatorOption is a function that can be used to modify the VHS instance.
evaluator.go
CommandFunc (FuncType)
CommandFunc is a function that executes a command on a running instance of vhs.
command.go

Core symbols most depended-on inside this repo

Render
called by 50
vhs.go
shift
called by 47
keys.go
nextToken
called by 45
parser/parser.go
NewError
called by 31
parser/parser.go
readChar
called by 24
lexer/lexer.go
double
called by 17
draw.go
ExecuteKey
called by 13
command.go
String
called by 11
themes.go

Shape

Function 146
Method 81
Struct 24
FuncType 2
TypeAlias 2

Languages

Go100%

Modules by API surface

command.go43 symbols
parser/parser.go35 symbols
lexer/lexer.go22 symbols
draw.go19 symbols
ffmpeg.go17 symbols
vhs.go15 symbols
video.go11 symbols
themes.go10 symbols
parser/parser_test.go10 symbols
token/token.go8 symbols
command_test.go7 symbols
screenshot.go6 symbols

Dependencies from manifests, versioned

github.com/agnivade/levenshteinv1.2.1 · 1×
github.com/anmitsu/go-shlexv0.0.0-2020051411343 · 1×
github.com/atotto/clipboardv0.1.4 · 1×
github.com/aymanbagabas/go-osc52/v2v2.0.1 · 1×
github.com/aymerick/douceurv0.2.0 · 1×
github.com/charmbracelet/colorprofilev0.2.3-0.20250311203 · 1×
github.com/charmbracelet/keygenv0.5.4 · 1×
github.com/charmbracelet/lipglossv1.1.1-0.20250404203 · 1×

For agents

$ claude mcp add vhs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact