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文件
- 为文档创建终端演示
- 搭建用于自动生成GIF的CI/CD流程
- 优化录制文件的大小和质量
- 排查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 | 配置结构 | 关键 | |
| 2 | 依赖管理 | 关键 | |
| 3 | 命令语法 | 高 | |
| 4 | 时序与同步 | 高 | |
| 5 | 输出优化 | 中高 | |
| 6 | 视觉质量 | 中 | |
| 7 | CI/自动化 | 中 | |
| 8 | 高级模式 | 低 | |
Quick Reference
快速参考
1. Configuration Structure (CRITICAL)
1. 配置结构(关键)
- - 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 - - 尽早设置全局打字速度
config-typing-speed-global - - 设置明确的终端尺寸
config-dimensions-explicit - - 使用注释说明tape文件结构
config-comments-document
2. Dependency Management (CRITICAL)
2. 依赖管理(关键)
- - 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. 命令语法(高)
- - 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. 时序与同步(高)
- - 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 - - 临时覆盖打字速度以突出重点
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. 输出优化(中高)
- - 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. 视觉质量(中)
- - 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/自动化(中)
- - 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. 高级模式(低)
- - 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
阅读单个参考文件获取详细说明和代码示例:
- Section definitions - 类别结构和影响级别说明
- Rule template - 添加新规则的模板
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 | 版本和参考信息 |