wt
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesewt - Worktree Manager Skill
wt - 工作树管理工具
Manages isolated LlamaFarm development environments using git worktrees. Each worktree has its own services, ports, and data directories - enabling parallel agent sessions without conflicts.
管理基于git worktrees的LlamaFarm隔离开发环境。每个工作树都有独立的服务、端口和数据目录——支持并行运行Agent会话且无冲突。
Full Documentation
完整文档
For complete documentation, architecture details, and advanced usage:
@scripts/wt/README.md
如需完整文档、架构细节和高级用法,请查看:
@scripts/wt/README.md
Quick Reference
快速参考
| Task | Command |
|---|---|
| Create worktree and start services | |
| Create and cd into worktree | |
| List all worktrees with status | |
| Check service health | |
| Start/stop services | |
| View service logs | |
| Delete worktree | |
| Switch to worktree | |
| Open Designer in browser | |
| Diagnose issues | |
| Clean orphaned data | |
| 任务 | 命令 |
|---|---|
| 创建工作树并启动服务 | |
| 创建工作树并进入该目录 | |
| 列出所有工作树及其状态 | |
| 检查服务健康状态 | |
| 启动/停止服务 | |
| 查看服务日志 | |
| 删除工作树 | |
| 切换到指定工作树 | |
| 在浏览器中打开Designer | |
| 诊断问题 | |
| 清理孤立数据 | |
When to Use wt
何时使用wt
Use when:
wt- Starting isolated work on a feature/task that needs running services
- Running parallel coding sessions (multiple agents or terminals)
- Testing changes without affecting the main development environment
- Avoiding port conflicts between concurrent LlamaFarm instances
在以下场景使用:
wt- 开始开发某个功能/任务,需要运行独立的服务
- 进行并行编码会话(多个Agent或终端)
- 在不影响主开发环境的情况下测试变更
- 避免并发LlamaFarm实例之间的端口冲突
Common Workflows
常见工作流
Starting a New Task
启动新任务
bash
undefinedbash
undefinedCreate isolated environment with services running
创建带运行中服务的隔离环境
wt create --go feat/my-task
wt create --go feat/my-task
Work in the worktree...
在工作树中开展工作...
Services are already running on auto-assigned ports
服务已在自动分配的端口上运行
Check status anytime
随时检查状态
wt status
wt status
View logs if needed
必要时查看日志
wt logs server
undefinedwt logs server
undefinedChecking What's Running
查看运行中的实例
bash
undefinedbash
undefinedList all worktrees with their port assignments
列出所有工作树及其端口分配
wt list
wt list
Example output:
示例输出:
NAME STATUS SERVER DESIGNER RUNTIME
NAME STATUS SERVER DESIGNER RUNTIME
feat-my-task running 8150 5150 11150
feat-my-task running 8150 5150 11150
fix-bug stopped 8234 5234 11234
fix-bug stopped 8234 5234 11234
undefinedundefinedCleaning Up
清理资源
bash
undefinedbash
undefinedStop services and remove a worktree
停止服务并删除工作树
wt delete feat-my-task
wt delete feat-my-task
Remove data for worktrees that no longer exist
清理已不存在的工作树对应的数据
wt gc
wt gc
Remove worktrees for branches merged to main
删除已合并到main分支的工作树
wt prune
undefinedwt prune
undefinedTroubleshooting
故障排查
bash
undefinedbash
undefinedDiagnose common issues (ports, stale PIDs, missing tools)
诊断常见问题(端口、过期PID、缺失工具)
wt doctor
wt doctor
Restart stuck services
重启卡住的服务
wt stop && wt start
wt stop && wt start
Force delete if normal delete fails
若常规删除失败,强制删除
wt delete my-worktree --force
---wt delete my-worktree --force
---Service URLs
服务URL
Each worktree gets unique ports. Check URLs with:
bash
wt url每个工作树都有唯一的端口。使用以下命令查看URL:
bash
wt urlOutputs:
输出示例:
Server: http://localhost:8150
Server: http://localhost:8150
Designer: http://localhost:5150
Designer: http://localhost:5150
Runtime: http://localhost:11150
Runtime: http://localhost:11150
If the Caddy proxy is running, use port-free URLs:
---
如果Caddy代理正在运行,可使用无端口URL:
---Key Environment Details
关键环境细节
- Worktrees location:
~/worktrees/llamafarm/ - Data directories:
~/.llamafarm/worktrees/<name>/ - Port allocation: Deterministic hash of worktree name (14345+offset, 5000+offset, 11000+offset)
- Logs:
~/.llamafarm/worktrees/<name>/logs/
- 工作树位置:
~/worktrees/llamafarm/ - 数据目录:
~/.llamafarm/worktrees/<name>/ - 端口分配:基于工作树名称的确定性哈希(14345+偏移量、5000+偏移量、11000+偏移量)
- 日志位置:
~/.llamafarm/worktrees/<name>/logs/
Notes for the Agent
给Agent的注意事项
- Always use when setting up a new task environment - it handles everything (branch, deps, build, services)
wt create --go - Check first before creating a new worktree to see what already exists
wt list - Use to verify services are healthy before running tests or making API calls
wt status - Run when encountering unexplained service issues
wt doctor - Clean up with when a task is complete to free resources
wt delete
- 设置新任务环境时始终使用——它会处理所有事项(分支、依赖、构建、服务)
wt create --go - 创建新工作树前先执行,查看已存在的工作树
wt list - **运行测试或调用API前,使用**验证服务是否健康
wt status - 遇到无法解释的服务问题时,执行
wt doctor - 任务完成后使用清理,释放资源
wt delete