Skip to content

feat: add from-readme command for README-driven GIF generation#739

Open
israkir wants to merge 1 commit intocharmbracelet:mainfrom
israkir:feat/from-readme-command
Open

feat: add from-readme command for README-driven GIF generation#739
israkir wants to merge 1 commit intocharmbracelet:mainfrom
israkir:feat/from-readme-command

Conversation

@israkir
Copy link
Copy Markdown

@israkir israkir commented Mar 31, 2026

Summary

  • add a new vhs from-readme command that extracts shell commands from Markdown fenced blocks and records them into a GIF
  • support focused extraction with --section and --command, plus safer execution controls (--wait-timeout, --wait-pattern) and a --dry-run/--tape-out workflow
  • register the new command in the root CLI and document usage, flags, and examples in README.md
  • add unit tests for README discovery, Markdown parsing, command filtering, duration formatting, and tape generation

Why

Creating demos from documentation currently requires manually rewriting commands into a tape. This feature turns README command examples into a reproducible recording flow, reducing copy/paste overhead and helping keep docs and demos aligned.

PS. I just needed this feature for my own project and thought it would be cool to share with the users of this project :)

Implementation Details

  • introduces fromreadme.go with:
    • CLI option parsing (fromReadmeOptions)
    • README auto-discovery (findREADME)
    • Markdown shell command extraction (extractShellCommands)
    • optional command filtering (filterByCommand)
    • tape generation (buildFromReadmeTape)
  • wires fromReadmeCmd into main.go
  • extends README.md with a dedicated From README section and full flag table
  • adds fromreadme_test.go to cover core behavior and edge cases

Test Plan

  • go test ./...
  • vhs from-readme README.md --dry-run
  • vhs from-readme README.md --command copinance --dry-run
  • vhs from-readme README.md --section "Using the CLI" --dry-run
  • vhs from-readme README.md --command copinance --output demo.gif and verify GIF is created

@israkir israkir requested a review from a team as a code owner March 31, 2026 16:05
@israkir israkir requested review from aymanbagabas and meowgorithm and removed request for a team March 31, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant