Skip to content
Open
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
.DS_Store
.DS_Store

# Local OMX session artifacts
.omx/
findings.md
progress.md
task_plan.md
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ wt add 3000
# - Installs dependencies
# - Starts dev server on port 3000

# Names with trailing digits also set the dev PORT
wt add ui9083
# - Creates branch feat/ui9083
# - Starts the configured dev command with PORT=9083

# 3. Navigate between worktrees
wt 3000 # Jump to feature worktree
wt main # Return to main repository
Expand Down Expand Up @@ -97,9 +102,15 @@ wt rm 3000
| `wt lang` | Set CLI language (en/zh) | `wt lang set zh` |
| `wt theme` | Switch `wt list` theme (`box`\|`sage`\|`archer`) | `wt theme set box` |
| `wt help` | Show command reference | `wt help` |
| `wt help <command>` | Show subcommand help | `wt help add` |
| `wt reinstall` | Update to latest version | `wt reinstall` |
| `wt uninstall` | Remove worktree.sh | `wt uninstall` |

## Help and Naming Rules

- Every core command supports `wt <command> --help`, and `wt help <command>` is the equivalent long form.
- `wt add <name>` uses trailing digits as the dev `PORT`. For example, `wt add ui9083` keeps the worktree name `ui9083`, creates branch `feat/ui9083`, and runs the configured dev command with `PORT=9083`.

## Advanced Features

### Broadcasting Changes Across Worktrees
Expand All @@ -122,6 +133,12 @@ wt sync 3000 3001
# Disable auto dev server
wt config set add.serve-dev.enabled false

# Wait longer for a slow startup script before reporting success
wt config set add.serve-dev.ready-timeout 120

# Keep a short post-ready observation window for launcher scripts
wt config set add.serve-dev.settle-timeout 8

# Change branch prefix
wt config set add.branch-prefix "feature/"

Expand All @@ -131,6 +148,9 @@ wt config list

Configuration is stored per-project in `~/.worktree.sh/projects/<slug>/config.kv`.

- `add.serve-dev.ready-timeout` controls how long `wt add` waits for the inferred port to start listening.
- `add.serve-dev.settle-timeout` keeps watching briefly after readiness so wrapper scripts like `start-smart.sh` can exit without causing a false failure.

## Use Cases

### Multiple UI Iterations
Expand Down
20 changes: 20 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ wt add 3000
# - 安装依赖
# - 在端口 3000 上启动开发服务器

# 名称以数字结尾时,也会把这些数字当作 dev PORT
wt add ui9083
# - 创建分支 feat/ui9083
# - 以 PORT=9083 启动配置好的 dev 命令

# 3. 在 worktree 之间导航
wt 3000 # 跳转到功能 worktree
wt main # 返回主仓库
Expand Down Expand Up @@ -97,9 +102,15 @@ wt rm 3000
| `wt lang` | 设置 CLI 语言(en/zh) | `wt lang set zh` |
| `wt theme` | 切换 `wt list` 主题(`box`\|`sage`\|`archer`) | `wt theme set box` |
| `wt help` | 显示命令参考 | `wt help` |
| `wt help <command>` | 显示子命令帮助 | `wt help add` |
| `wt reinstall` | 更新到最新版本 | `wt reinstall` |
| `wt uninstall` | 删除 worktree.sh | `wt uninstall` |

## Help 与命名规则

- 所有核心命令都支持 `wt <command> --help`,而 `wt help <command>` 是等价的长写法。
- `wt add <name>` 会把名称末尾的数字当作 dev `PORT`。例如 `wt add ui9083` 会保留 worktree 名称 `ui9083`、创建分支 `feat/ui9083`,并以 `PORT=9083` 启动已配置的 dev 命令。

## 高级功能

### 跨 Worktree 广播更改
Expand All @@ -122,6 +133,12 @@ wt sync 3000 3001
# 禁用自动开发服务器
wt config set add.serve-dev.enabled false

# 启动脚本较慢时,延长端口就绪等待时间
wt config set add.serve-dev.ready-timeout 120

# 对启动器脚本保留一个短暂的就绪后观察窗口
wt config set add.serve-dev.settle-timeout 8

# 更改分支前缀
wt config set add.branch-prefix "feature/"

Expand All @@ -131,6 +148,9 @@ wt config list

配置按项目存储在 `~/.worktree.sh/projects/<slug>/config.kv` 中。

- `add.serve-dev.ready-timeout` 控制 `wt add` 等待目标端口开始监听的最长秒数。
- `add.serve-dev.settle-timeout` 会在端口就绪后再短暂观察一段时间,避免 `start-smart.sh` 这类包装启动脚本被误判为失败。

## 使用场景

### 多开 UI 抽卡
Expand Down
Loading