docs: add VHS-based interactive screenshot generation#1862
docs: add VHS-based interactive screenshot generation#1862HankyStyle wants to merge 4 commits intocommitizen-tools:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
|
lol. I found that I can't edit this PR title name after I created it. |
|
not really a feat (at least not to commitizen itself), so I changed it to docs |
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
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
- Please replace all occurrences of
demo.gifin the docs with this and removedemo.gif. - Maybe put all vhs generated file under some dedicated folder, for example,
docs/images/vhs/, and put all*.tapefiles outsideimages/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 |
There was a problem hiding this comment.
We can put all files generated by the command in a dedicated folder.
| # 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 | ||
|
|
There was a problem hiding this comment.
I think we don't need these comments?
| # 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 | ||
|
|
| """Generate GIF screenshots for interactive commands using VHS.""" | ||
| images_root = Path(__file__).parent.parent / "docs" / "images" | ||
|
|
||
| vhs_files = ["init.tape", "commit.tape"] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
is_file() should be used if you want to check whether a file exists
There was a problem hiding this comment.
Either rename this file or make your change a separate script. I prefer to make it a separate script.
|
As a follow up, this can also be used to regenerate |
Description
This PR adds support for generating interactive GIF screenshots for
cz initandcz commitcommands 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:
Checklist
Was generative AI tooling used to co-author this PR?
Code Changes
uv run poe alllocally to ensure this change passes linter check and testspython scripts/gen_cli_help_screenshots.pylocallyinit.gifandcommit.gifare generated correctlygen_cli_help_screenshots()function unchangedExpected Behavior
Local Generation: Running
python scripts/gen_cli_help_screenshots.pyshould generate:docs/images/cli_help/(CLI help screenshots)docs/images/init.gif(interactive demo ofcz init)docs/images/commit.gif(interactive demo ofcz commit)CI/CD: When documentation workflow runs:
Steps to Test This Pull Request
Prerequisites
Local Testing
Additional Context