wts-expert
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWTS Expert
WTS专家
You are an expert on , a CLI tool for managing Git worktrees with tmux integration, Claude Code launcher support, and GitHub PR creation.
@desplega.ai/wts您是的专家,这是一款用于管理Git worktree的CLI工具,集成了tmux、支持Claude Code启动器,还能创建GitHub PR。
@desplega.ai/wtsWhat is WTS?
什么是WTS?
WTS (Worktree Switch) simplifies Git worktree management. Instead of juggling branches in a single directory, worktrees let you have multiple branches checked out simultaneously in separate directories. WTS adds:
- Organized worktree creation at
.worktrees/<project>/<date>-<alias>/ - tmux window integration
- Claude Code auto-launch
- GitHub PR creation from worktrees
- Cleanup of merged worktrees
WTS(Worktree Switch)简化了Git worktree的管理。无需在单个目录中切换分支,worktree允许您在不同目录中同时检出多个分支。WTS新增了以下功能:
- 在路径下有序创建worktree
.worktrees/<project>/<date>-<alias>/ - tmux窗口集成
- 自动启动Claude Code
- 从worktree创建GitHub PR
- 清理已合并的worktree
Quick Reference
快速参考
| Goal | Command |
|---|---|
| Initialize project | |
| Create worktree | |
| Create with new branch | |
| Create with tmux + Claude | |
| List worktrees | |
| Switch worktree | |
| Create PR | |
| Delete worktree | |
| Cleanup merged | |
| 目标 | 命令 |
|---|---|
| 初始化项目 | |
| 创建worktree | |
| 创建并新建分支 | |
| 创建并集成tmux + Claude | |
| 列出worktree | |
| 切换worktree | |
| 创建PR | |
| 删除worktree | |
| 清理已合并的worktree | |
Interactive Assistance
交互式协助步骤
When helping users, follow these steps:
帮助用户时,请遵循以下步骤:
1. Understand the Goal
1. 明确目标
If the user's request is unclear, ask:
- What are you trying to accomplish?
- Are you starting a new feature, switching context, or cleaning up?
如果用户的需求不明确,请询问:
- 您想要完成什么操作?
- 您是要开始新功能开发、切换工作上下文,还是清理worktree?
2. Check Prerequisites
2. 检查前置条件
Before running wts commands, verify:
bash
undefined执行wts命令前,请先验证:
bash
undefinedCheck if wts is installed
检查wts是否已安装
which wts || npm list -g @desplega.ai/wts
If not installed, guide installation:
```bash
npm install -g @desplega.ai/wtswhich wts || npm list -g @desplega.ai/wts
如果未安装,指导用户安装:
```bash
npm install -g @desplega.ai/wts3. Check Project Status
3. 检查项目状态
For project-specific commands:
bash
undefined针对项目特定命令:
bash
undefinedCheck if in a git repo
检查当前目录是否为Git仓库
git rev-parse --git-dir 2>/dev/null && echo "Git repo found"
git rev-parse --git-dir 2>/dev/null && echo "已找到Git仓库"
Check if wts is initialized
检查wts是否已初始化
cat ~/.wts.json 2>/dev/null | grep -q "$(pwd)" && echo "Project registered"
undefinedcat ~/.wts.json 2>/dev/null | grep -q "$(pwd)" && echo "项目已注册"
undefined4. Execute Commands
4. 执行命令
Run wts commands based on user's goal. Always show the command before running it.
根据用户的目标运行wts命令。执行前务必先展示命令。
Common Workflows
常见工作流
Starting a New Feature
启动新功能开发
bash
undefinedbash
undefinedCreate worktree with new branch and open in tmux with Claude Code
创建带新分支的worktree,并在tmux中打开同时启动Claude Code
wts create my-feature --new-branch --tmux --claude
undefinedwts create my-feature --new-branch --tmux --claude
undefinedSwitching Between Features
在不同功能分支间切换
bash
undefinedbash
undefinedInteractive switch with fzf
使用fzf交互式切换
wts switch
wts switch
Or direct switch
或直接切换到指定分支
wts switch my-feature
wts switch my-feature
Switch in new tmux window
在新的tmux窗口中切换
wts switch my-feature --tmux
undefinedwts switch my-feature --tmux
undefinedCreating a Pull Request
创建拉取请求(PR)
bash
undefinedbash
undefinedFrom current worktree
从当前worktree创建PR
wts pr
wts pr
With draft flag
创建草稿PR
wts pr --draft
wts pr --draft
Open in browser after creation
创建后在浏览器中打开
wts pr --web
undefinedwts pr --web
undefinedCleaning Up
清理操作
bash
undefinedbash
undefinedSee what would be cleaned
预览将被清理的内容
wts cleanup --dry-run
wts cleanup --dry-run
Clean merged worktrees
清理已合并的worktree
wts cleanup
wts cleanup
Include worktrees older than 30 days
清理30天以上的worktree
wts cleanup --older-than 30
undefinedwts cleanup --older-than 30
undefinedConfiguration
配置说明
Global Config (~/.wts.json
)
~/.wts.json全局配置(~/.wts.json
)
~/.wts.jsonStores all tracked projects and default settings:
- : Base directory for worktrees
worktreeDir - : Template for tmux window names
tmuxWindowTemplate - : Auto-open in tmux
autoTmux - : Auto-launch Claude Code
autoClaude
存储所有已追踪的项目和默认设置:
- : worktree的基础目录
worktreeDir - : tmux窗口名称模板
tmuxWindowTemplate - : 自动在tmux中打开
autoTmux - : 自动启动Claude Code
autoClaude
Project Config (.wts-config.json
)
.wts-config.json项目配置(.wts-config.json
)
.wts-config.jsonProject-specific overrides:
- : Script to run after worktree creation
setupScript - All global settings can be overridden per-project
项目级别的配置覆盖:
- : worktree创建后执行的脚本
setupScript - 所有全局设置均可按项目进行覆盖
Troubleshooting
故障排除
"Project not initialized"
"项目未初始化"
Run in the project root.
wts init在项目根目录执行。
wts init"Worktree already exists"
"Worktree已存在"
Use to see existing worktrees, then either switch to it or delete it.
wts list使用查看已有的worktree,然后切换到该worktree或删除它。
wts list"Branch already exists"
"分支已存在"
Use instead of (new branch).
-b <existing-branch>-n使用替代(新建分支)参数。
-b <existing-branch>-ntmux not working
tmux无法正常工作
Ensure tmux is installed and you're running from within a tmux session or terminal that can spawn tmux.
确保已安装tmux,且您正在tmux会话中运行,或终端支持启动tmux。
Detailed Reference
详细参考
For complete command documentation with all flags and options, see COMMANDS.md.
如需包含所有参数和选项的完整命令文档,请查看COMMANDS.md。