-
-
Notifications
You must be signed in to change notification settings - Fork 323
docs: add VHS-based interactive screenshot generation #1862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bearomorphism
merged 10 commits into
commitizen-tools:master
from
HankyStyle:feat/interactive-screenshots
Feb 14, 2026
+276
−8
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
858386a
docs: add VHS tape for cz init interactive demo
HankyStyle b7a8604
docs: add VHS tape for cz commit interactive demo
HankyStyle 73dd4e1
ci(gen_cli_help_screenshots): add gen_interactive_screenshots function
HankyStyle 64cce9e
ci(workflow): add VHS support to documentation workflow
HankyStyle 2be501a
style: remove redundant comments
HankyStyle db79593
docs: reorganize interactive CLI GIFs into cli_interactive directory
HankyStyle 263d50e
ci: modify file path
HankyStyle ee149fa
refactor: extract interactive GIF generation into separate script
HankyStyle 92c57a4
build: configure parallel screenshot generation with VHS
HankyStyle 32058e3
docs: update VHS tape output paths to cli_interactive directory
HankyStyle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| Output cli_interactive/commit.gif | ||
|
|
||
| Require cz | ||
|
|
||
| # Use bash for cross-platform compatibility (macOS, Linux, Windows) | ||
| Set Shell bash | ||
|
|
||
| Set FontSize 16 | ||
| Set Width 878 | ||
| Set Height 568 | ||
| Set Padding 20 | ||
| Set TypingSpeed 50ms | ||
|
|
||
| Set Theme { | ||
| "name": "Commitizen", | ||
| "black": "#232628", | ||
| "red": "#fc4384", | ||
| "green": "#b3e33b", | ||
| "yellow": "#ffa727", | ||
| "blue": "#75dff2", | ||
| "magenta": "#ae89fe", | ||
| "cyan": "#708387", | ||
| "white": "#d5d5d0", | ||
| "brightBlack": "#626566", | ||
| "brightRed": "#ff7fac", | ||
| "brightGreen": "#c8ed71", | ||
| "brightYellow": "#ebdf86", | ||
| "brightBlue": "#75dff2", | ||
| "brightMagenta": "#ae89fe", | ||
| "brightCyan": "#b1c6ca", | ||
| "brightWhite": "#f9f9f4", | ||
| "background": "#1e1e2e", | ||
| "foreground": "#afafaf", | ||
| "cursor": "#c7c7c7" | ||
| } | ||
|
|
||
| # Hide initial shell prompt | ||
| Hide | ||
|
|
||
| # Wait for terminal to be ready | ||
| Sleep 1s | ||
|
|
||
| # Set a clean, simple prompt (while hidden) | ||
| Type "PS1='$ '" | ||
| Enter | ||
| Sleep 300ms | ||
|
|
||
| # Create a clean temporary directory for recording | ||
| Type "rm -rf /tmp/commitizen-demo && mkdir -p /tmp/commitizen-demo && cd /tmp/commitizen-demo" | ||
| Enter | ||
| Sleep 500ms | ||
|
|
||
| # Initialize git repository | ||
| Type "git init" | ||
| Enter | ||
| Sleep 500ms | ||
|
|
||
| Type "git checkout -b awesome-feature" | ||
| Enter | ||
| Sleep 500ms | ||
|
|
||
| # Create a dummy file to commit | ||
| Type "echo 'test content' > example.py" | ||
| Enter | ||
| Sleep 300ms | ||
|
|
||
| Type "git add example.py" | ||
| Enter | ||
| Sleep 300ms | ||
|
|
||
| # Clear the screen to start fresh | ||
| Type "clear" | ||
| Enter | ||
| Sleep 500ms | ||
|
|
||
| # Show commands from here | ||
| Show | ||
|
|
||
| # Now run cz commit | ||
| Type "cz commit" | ||
| Sleep 500ms | ||
| Enter | ||
|
|
||
| # Wait for first prompt to appear | ||
| Sleep 1s | ||
|
|
||
| # Question 1: Select the type of change (move down to "feat") | ||
| Down | ||
| Sleep 500ms | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 2: Scope (optional, skip) | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 3: Subject | ||
| Type "awesome new feature" | ||
| Sleep 500ms | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 4: Is this a BREAKING CHANGE? (No) | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 5: Body (optional, skip) | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 6: Footer (optional, skip) | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Wait for commit success message | ||
| Sleep 2s |
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| Output cli_interactive/init.gif | ||
|
|
||
| Require cz | ||
|
|
||
| # Use bash for cross-platform compatibility (macOS, Linux, Windows) | ||
| Set Shell bash | ||
|
|
||
| Set FontSize 16 | ||
| Set Width 878 | ||
| Set Height 568 | ||
| Set Padding 20 | ||
| Set TypingSpeed 50ms | ||
|
|
||
| Set Theme { | ||
| "name": "Commitizen", | ||
| "black": "#232628", | ||
| "red": "#fc4384", | ||
| "green": "#b3e33b", | ||
| "yellow": "#ffa727", | ||
| "blue": "#75dff2", | ||
| "magenta": "#ae89fe", | ||
| "cyan": "#708387", | ||
| "white": "#d5d5d0", | ||
| "brightBlack": "#626566", | ||
| "brightRed": "#ff7fac", | ||
| "brightGreen": "#c8ed71", | ||
| "brightYellow": "#ebdf86", | ||
| "brightBlue": "#75dff2", | ||
| "brightMagenta": "#ae89fe", | ||
| "brightCyan": "#b1c6ca", | ||
| "brightWhite": "#f9f9f4", | ||
| "background": "#1e1e2e", | ||
| "foreground": "#afafaf", | ||
| "cursor": "#c7c7c7" | ||
| } | ||
|
|
||
| # Hide initial shell prompt | ||
| Hide | ||
|
|
||
| # Wait for terminal to be ready | ||
| Sleep 1s | ||
|
|
||
| # Set a clean, simple prompt | ||
| Type "PS1='$ '" | ||
| Enter | ||
| Sleep 300ms | ||
|
|
||
|
|
||
| # Create a clean temporary directory for recording | ||
| Type "rm -rf /tmp/commitizen-example && mkdir -p /tmp/commitizen-example && cd /tmp/commitizen-example" | ||
| Enter | ||
| Sleep 500ms | ||
|
|
||
| # Clear the screen to start fresh | ||
| Type "clear" | ||
| Enter | ||
| Sleep 500ms | ||
|
|
||
| # Show commands from here | ||
| Show | ||
|
|
||
| # Now run cz init in the clean environment | ||
| Type "cz init" | ||
| Sleep 500ms | ||
| Enter | ||
|
|
||
| # Wait for welcome message and first prompt | ||
| Sleep 500ms | ||
| Sleep 1s | ||
| # Question 1: Please choose a supported config file | ||
| # Default is .cz.toml, just press Enter | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 2: Please choose a cz (commit rule) | ||
| # Default is cz_conventional_commits, just press Enter | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 3: Choose the source of the version | ||
| # Default is "commitizen: Fetch and set version in commitizen config, just press Enter" | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 4: Choose version scheme | ||
| # Default is semver, just press Enter | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 5: Please enter the correct version format | ||
| # Default is "$version", just press Enter | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 6: Create changelog automatically on bump | ||
| # Default is Yes, just press Enter | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 7: Keep major version zero (0.x) during breaking changes | ||
| # Default is Yes, just press Enter | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Question 8: What types of pre-commit hook you want to install? | ||
| # Default is [commit-msg], just press Enter to accept | ||
| Enter | ||
| Sleep 1s | ||
|
|
||
| # Wait for completion message | ||
| Sleep 3s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| def gen_cli_interactive_gifs() -> None: | ||
| """Generate GIF screenshots for interactive commands using VHS.""" | ||
| vhs_dir = Path(__file__).parent.parent / "docs" / "images" | ||
| output_dir = Path(__file__).parent.parent / "docs" / "images" / "cli_interactive" | ||
| output_dir.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| vhs_files = list(vhs_dir.glob("*.tape")) | ||
bearomorphism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if not vhs_files: | ||
| print("No VHS tape files found in docs/images/, skipping") | ||
| return | ||
|
|
||
| for vhs_file in vhs_files: | ||
| print(f"Processing: {vhs_file.name}") | ||
| try: | ||
| subprocess.run( | ||
| ["vhs", vhs_file.name], | ||
| check=True, | ||
| cwd=vhs_dir, | ||
| ) | ||
| gif_name = vhs_file.stem + ".gif" | ||
| print(f"✓ Generated {gif_name}") | ||
| except FileNotFoundError: | ||
| print( | ||
| "✗ VHS is not installed. Please install it from: " | ||
| "https://github.com/charmbracelet/vhs" | ||
| ) | ||
| raise | ||
| except subprocess.CalledProcessError as e: | ||
| print(f"✗ Error processing {vhs_file.name}: {e}") | ||
| raise | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| gen_cli_interactive_gifs() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.