Skip to content

Conversation

@HankyStyle
Copy link
Contributor

@HankyStyle HankyStyle commented Feb 9, 2026

Description

This PR adds support for generating interactive GIF screenshots for cz init and cz commit commands using VHS (Video Home System), a tool for generating terminal GIFs from code.

Why VHS?

VHS is a modern tool for generating terminal recordings as GIFs.
Benefits:

  • Reproducible: Tape files ensure consistent output
  • Version-controlled: Configuration is code
  • Cross-platform: Works on macOS, Linux, and Windows

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (antigravity + Claude Sonnect 4.5)

Code Changes

  • Add test cases to all the changes you introduce
  • Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
      • Tested python scripts/gen_cli_help_screenshots.py locally
      • Verified both init.gif and commit.gif are generated correctly
    • Test edge cases and error conditions
      • Tested with missing VHS installation (proper error message)
      • Tested with missing tape files (proper warning message)
    • Ensure backward compatibility is maintained
      • Existing gen_cli_help_screenshots() function unchanged
    • Document any manual testing steps performed
      • See "Steps to Test This Pull Request" section below
  • Update the documentation for the changes

Expected Behavior

  1. Local Generation: Running python scripts/gen_cli_help_screenshots.py should generate:

    • 11 SVG files in docs/images/cli_help/ (CLI help screenshots)
    • docs/images/init.gif (interactive demo of cz init)
    • docs/images/commit.gif (interactive demo of cz commit)
  2. CI/CD: When documentation workflow runs:

    • VHS is installed automatically
    • GIF screenshots are generated alongside SVG screenshots
    • Both file types are committed to the repository

Steps to Test This Pull Request

Prerequisites

# Install VHS
brew install vhs  # macOS
# or follow: https://github.com/charmbracelet/vhs#installation

Local Testing

# 1. Checkout this branch
git checkout feat/interactive-screenshots

# 2. Run the screenshot generation script
python scripts/gen_cli_help_screenshots.py

# 3. Verify generated files
ls -lh docs/images/*.gif
open docs/images/init.gif
open docs/images/commit.gif

Additional Context

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.98%. Comparing base (dd972c9) to head (64cce9e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1862   +/-   ##
=======================================
  Coverage   97.98%   97.98%           
=======================================
  Files          60       60           
  Lines        2686     2686           
=======================================
  Hits         2632     2632           
  Misses         54       54           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HankyStyle
Copy link
Contributor Author

lol. I found that I can't edit this PR title name after I created it.
Please help me change it to feat(docs): add VHS-based interactive screenshot generation or other better naming.

@Lee-W Lee-W changed the title Feat/interactive screenshots docs: add VHS-based interactive screenshot generation Feb 10, 2026
@Lee-W
Copy link
Member

Lee-W commented Feb 10, 2026

not really a feat (at least not to commitizen itself), so I changed it to docs

@bearomorphism
Copy link
Collaborator

lol. I found that I can't edit this PR title name after I created it. Please help me change it to feat(docs): add VHS-based interactive screenshot generation or other better naming.

I heard from my friend that some github preview features have so terrible UI that people cannot find where to edit the PR title.

@bearomorphism bearomorphism self-requested a review February 10, 2026 15:02
Copy link
Collaborator

@bearomorphism bearomorphism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution of this great documentation improvement! The new gifs look beautiful!

Nothing is really blocking this PR but the comments related to demo.gif.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please replace all occurrences of demo.gif in the docs with this and remove demo.gif.
  2. Maybe put all vhs generated file under some dedicated folder, for example, docs/images/vhs/, and put all *.tape files outside images/ directory since they are just data for generating the .gif files.

git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add docs/images/cli_help
git add docs/images/cli_help docs/images/*.gif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can put all files generated by the command in a dedicated folder.

Comment on lines +1 to +17
# VHS documentation https://github.com/charmbracelet/vhs
#
# Output:
# Output <path>.gif Create a GIF output at the given <path>

#
# Settings:
# Set FontSize <number> Set the font size of the terminal
# Set FontFamily <string> Set the font family of the terminal
# Set Height <number> Set the height of the terminal
# Set Width <number> Set the width of the terminal
# Set LetterSpacing <float> Set the letter spacing of the terminal
# Set LineHeight <float> Set the line height of the terminal
# Set Theme <json|string> Set the theme of the terminal
# Set Padding <number> Set the padding of the terminal
# Set TypingSpeed <time> Set the typing speed of the terminal

Copy link
Collaborator

@bearomorphism bearomorphism Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need these comments?

Comment on lines +1 to +17
# VHS documentation https://github.com/charmbracelet/vhs
#
# Output:
# Output <path>.gif Create a GIF output at the given <path>

#
# Settings:
# Set FontSize <number> Set the font size of the terminal
# Set FontFamily <string> Set the font family of the terminal
# Set Height <number> Set the height of the terminal
# Set Width <number> Set the width of the terminal
# Set LetterSpacing <float> Set the letter spacing of the terminal
# Set LineHeight <float> Set the line height of the terminal
# Set Theme <json|string> Set the theme of the terminal
# Set Padding <number> Set the padding of the terminal
# Set TypingSpeed <time> Set the typing speed of the terminal

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

"""Generate GIF screenshots for interactive commands using VHS."""
images_root = Path(__file__).parent.parent / "docs" / "images"

vhs_files = ["init.tape", "commit.tape"]
Copy link
Collaborator

@bearomorphism bearomorphism Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hard-coding the tape files, we can just list all *.tape files under the dedicated folder and process them. Also, we don't need to check the existence of vhs_path in the following for loop if we use this approach.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can just write a shell script in docspublish.yml

For example,

vhs docs/images/*.tape

(not sure if the above script works, but you probably know what I mean)


for vhs_file in vhs_files:
vhs_path = images_root / vhs_file
if vhs_path.exists():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_file() should be used if you want to check whether a file exists

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either rename this file or make your change a separate script. I prefer to make it a separate script.

@bearomorphism
Copy link
Collaborator

As a follow up, this can also be used to regenerate bump.gif, which can be in a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants