vhs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCharmbracelet VHS Best Practices
Charmbracelet VHS最佳实践
Comprehensive best practices guide for VHS terminal recordings, maintained by Charmbracelet. Contains 47 rules across 8 categories, prioritized by impact to guide creation of professional, portable, and optimized terminal demos.
由Charmbracelet维护的VHS终端录制全面最佳实践指南,包含8个类别共47条规则,按影响优先级排序,指导用户创建专业、可移植、经过优化的终端演示。
When to Apply
适用场景
Reference these guidelines when:
- Writing new VHS tape files
- Creating terminal demos for documentation
- Setting up CI/CD for automated GIF generation
- Optimizing recording file size and quality
- Troubleshooting tape file issues
- Reviewing tape files for best practices
在以下场景可参考这些指南:
- 编写新的VHS tape文件
- 为文档创建终端演示
- 配置CI/CD实现GIF自动生成
- 优化录制文件的大小和质量
- 排查tape文件相关问题
- 评审tape文件是否符合最佳实践
Rule Categories by Priority
按优先级排序的规则类别
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Configuration Structure | CRITICAL | |
| 2 | Dependency Management | CRITICAL | |
| 3 | Command Syntax | HIGH | |
| 4 | Timing & Synchronization | HIGH | |
| 5 | Output Optimization | MEDIUM-HIGH | |
| 6 | Visual Quality | MEDIUM | |
| 7 | CI/Automation | MEDIUM | |
| 8 | Advanced Patterns | LOW | |
| 优先级 | 类别 | 影响程度 | 前缀 |
|---|---|---|---|
| 1 | 配置结构 | CRITICAL | |
| 2 | 依赖管理 | CRITICAL | |
| 3 | 命令语法 | HIGH | |
| 4 | 时序与同步 | HIGH | |
| 5 | 输出优化 | MEDIUM-HIGH | |
| 6 | 视觉质量 | MEDIUM | |
| 7 | CI/自动化 | MEDIUM | |
| 8 | 高级模式 | LOW | |
Quick Reference
快速参考
1. Configuration Structure (CRITICAL)
1. 配置结构(CRITICAL)
- - Place all settings before commands
config-settings-order - - Declare output at file start
config-output-first - - Explicitly set shell type
config-shell-explicit - - Set global TypingSpeed early
config-typing-speed-global - - Set explicit terminal dimensions
config-dimensions-explicit - - Use comments to document tape structure
config-comments-document
- - 所有设置项要放在命令之前
config-settings-order - - 在文件开头声明输出配置
config-output-first - - 显式设置shell类型
config-shell-explicit - - 提前设置全局TypingSpeed
config-typing-speed-global - - 设置明确的终端尺寸
config-dimensions-explicit - - 使用注释说明tape文件结构
config-comments-document
2. Dependency Management (CRITICAL)
2. 依赖管理(CRITICAL)
- - Use Require for dependency validation
deps-require-early - - Place Require before settings
deps-require-order - - Require all external commands
deps-require-all - - Verify system dependencies
deps-system-requirements
- - 使用Require做依赖校验
deps-require-early - - 将Require放在设置项之前
deps-require-order - - 声明所有需要的外部命令
deps-require-all - - 校验系统依赖
deps-system-requirements
3. Command Syntax (HIGH)
3. 命令语法(HIGH)
- - Use correct Type command syntax
cmd-type-syntax - - Always follow Type with Enter
cmd-enter-explicit - - Use key repeat counts
cmd-key-repeat - - Use Ctrl combinations for terminal control
cmd-ctrl-combinations - - Use Hide/Show for sensitive operations
cmd-hide-show - - Use Env for environment variables
cmd-env-variables - - Use Screenshot for static captures
cmd-screenshot - - Handle multiline commands properly
cmd-multiline-type
- - 使用正确的Type命令语法
cmd-type-syntax - - Type命令后必须跟随Enter
cmd-enter-explicit - - 使用按键重复计数
cmd-key-repeat - - 使用Ctrl组合键进行终端控制
cmd-ctrl-combinations - - 对敏感操作使用Hide/Show
cmd-hide-show - - 使用Env配置环境变量
cmd-env-variables - - 使用Screenshot捕获静态截图
cmd-screenshot - - 正确处理多行命令
cmd-multiline-type
4. Timing & Synchronization (HIGH)
4. 时序与同步(HIGH)
- - Add Sleep after commands for output
timing-sleep-after-enter - - Use Wait for dynamic command completion
timing-wait-pattern - - Override TypingSpeed for emphasis
timing-type-speed-override - - Use explicit time units
timing-sleep-units - - End recordings with final Sleep
timing-final-sleep - - Add natural pauses between actions
timing-natural-pauses - - Set appropriate Wait timeouts
timing-wait-timeout - - Use PlaybackSpeed for final adjustments
timing-playback-speed
- - 命令执行后添加Sleep等待输出
timing-sleep-after-enter - - 使用Wait等待动态命令执行完成
timing-wait-pattern - - 局部覆盖TypingSpeed突出重点
timing-type-speed-override - - 使用明确的时间单位
timing-sleep-units - - 录制末尾添加最终Sleep
timing-final-sleep - - 在操作之间添加自然停顿
timing-natural-pauses - - 设置合理的Wait超时时间
timing-wait-timeout - - 使用PlaybackSpeed做最终播放速度调整
timing-playback-speed
5. Output Optimization (MEDIUM-HIGH)
5. 输出优化(MEDIUM-HIGH)
- - Choose output format based on use case
output-format-selection - - Optimize framerate for file size
output-framerate - - Right-size terminal dimensions
output-dimensions-optimize - - Use LoopOffset for seamless loops
output-loop-offset - - Generate multiple output formats
output-multiple-formats - - Use relative paths for portability
output-relative-paths
- - 根据使用场景选择输出格式
output-format-selection - - 优化帧率减小文件体积
output-framerate - - 合理设置终端尺寸
output-dimensions-optimize - - 使用LoopOffset实现无缝循环
output-loop-offset - - 生成多种输出格式
output-multiple-formats - - 使用相对路径提升可移植性
output-relative-paths
6. Visual Quality (MEDIUM)
6. 视觉质量(MEDIUM)
- - Choose readable font settings
visual-font-readable - - Select appropriate theme
visual-theme-selection - - Add window decorations for polish
visual-window-decoration - - Adjust letter and line spacing
visual-spacing - - Use padding and margins effectively
visual-padding-margin - - Ensure cursor visibility
visual-cursor-visibility
- - 选择易读的字体设置
visual-font-readable - - 选择合适的主题
visual-theme-selection - - 添加窗口装饰提升精致度
visual-window-decoration - - 调整字符和行间距
visual-spacing - - 合理使用内边距和外边距
visual-padding-margin - - 确保光标可见
visual-cursor-visibility
7. CI/Automation (MEDIUM)
7. CI/自动化(MEDIUM)
- - Use official VHS GitHub Action
ci-github-action - - Auto-commit generated assets
ci-auto-commit - - Use golden files for integration testing
ci-golden-files - - Generate platform-specific demos
ci-matrix-builds - - Cache VHS dependencies in CI
ci-caching
- - 使用官方VHS GitHub Action
ci-github-action - - 自动提交生成的资源文件
ci-auto-commit - - 使用基准文件做集成测试
ci-golden-files - - 生成平台专属演示
ci-matrix-builds - - 在CI中缓存VHS依赖
ci-caching
8. Advanced Patterns (LOW)
8. 高级模式(LOW)
- - Use Source for reusable tape components
advanced-source-include - - Use Copy and Paste for complex input
advanced-clipboard - - Record live sessions then edit
advanced-recording-live - - Use server mode for remote access
advanced-server-mode
- - 使用Source引用可复用的tape组件
advanced-source-include - - 使用Copy和Paste处理复杂输入
advanced-clipboard - - 录制实时会话后再编辑
advanced-recording-live - - 使用服务端模式实现远程访问
advanced-server-mode
How to Use
如何使用
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
阅读单个参考文件获取详细说明和代码示例:
- 章节定义 - 类别结构和影响等级说明
- 规则模板 - 新增规则的模板
Reference Files
参考文件
| File | Description |
|---|---|
| AGENTS.md | Complete compiled guide with all rules |
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |
| 文件 | 描述 |
|---|---|
| AGENTS.md | 整合所有规则的完整指南 |
| references/_sections.md | 类别定义和排序说明 |
| assets/templates/_template.md | 新增规则的模板 |
| metadata.json | 版本和参考信息 |