@maxiaochao/pi-worktree 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +4 -2
- package/TESTING.md +1 -0
- package/bin/pi-worktree +9 -2
- package/bin/pi-worktree-completion.bash +5 -3
- package/package.json +1 -1
- package/skills/pi-worktree/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-10-27 - v0.4.2
|
|
4
|
+
|
|
5
|
+
- support removing multiple worktrees in order
|
|
6
|
+
- Allow removing multiple worktrees in order, retaining individual safety confirmations and stopping on failure.
|
|
7
|
+
|
|
3
8
|
## 2026-10-23 - v0.4.1
|
|
4
9
|
|
|
5
10
|
- return the worktree root from already-active nested directories
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ pi-worktree create feature
|
|
|
17
17
|
pi-worktree create --base main --json feature
|
|
18
18
|
pi-worktree info feature
|
|
19
19
|
pi-worktree out
|
|
20
|
-
pi-worktree remove feature
|
|
20
|
+
pi-worktree remove feature another-feature
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
`create` 从当前分支(或显式 `--base`)创建或复用 `.worktrees/feature` 并记录 base,不启动 Pi。`--json` 提供相同操作的机器可读结果。
|
|
@@ -65,12 +65,14 @@ pi-worktree create [--base <ref>] [--json] <name>
|
|
|
65
65
|
pi-worktree list
|
|
66
66
|
pi-worktree info <name>
|
|
67
67
|
pi-worktree out
|
|
68
|
-
pi-worktree remove <name>
|
|
68
|
+
pi-worktree remove <name> [<name> ...]
|
|
69
69
|
pi-worktree prune
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
`create` 是幂等接口;`create --json` 供 Extension 和其他宿主使用,返回 `created`、`attached`、`reused` 或 `already-active`,以及绝对路径、分支和 dirty 状态。已有 worktree 会复用;已存在但未挂载的同名分支会挂载;stale 注册、非法名称和路径冲突会显式失败。
|
|
73
73
|
|
|
74
|
+
`remove` 按顺序删除指定 worktree;每个脏 worktree 或未合并分支仍需单独确认。遇到错误或拒绝确认时停止,已经删除的 worktree 不会恢复。
|
|
75
|
+
|
|
74
76
|
Agent 用法见 `skills/pi-worktree/SKILL.md`。测试流程、夹具和结果见 [TESTING.md](TESTING.md)。
|
|
75
77
|
|
|
76
78
|
## Already-active paths
|
package/TESTING.md
CHANGED
package/bin/pi-worktree
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# pi-worktree -l | --list # list worktrees (main checkout marked "main checkout")
|
|
7
7
|
# pi-worktree -i <name> # show base commit, ahead/behind, unique commits
|
|
8
8
|
# pi-worktree -o | --out # cd back to the main checkout
|
|
9
|
-
# pi-worktree -r <name>
|
|
9
|
+
# pi-worktree -r <name> [<name> ...] # remove worktrees (confirms dirty or unmerged)
|
|
10
10
|
# pi-worktree -p | --prune # drop stale worktree registrations
|
|
11
11
|
set -euo pipefail
|
|
12
12
|
|
|
@@ -150,7 +150,14 @@ cmd_info() {
|
|
|
150
150
|
|
|
151
151
|
cmd_remove() {
|
|
152
152
|
require_repo
|
|
153
|
-
[[ $# -
|
|
153
|
+
[[ $# -ge 1 ]] || die "usage: pi-worktree -r <name> [<name> ...]"
|
|
154
|
+
local name
|
|
155
|
+
for name in "$@"; do
|
|
156
|
+
remove_one "$name"
|
|
157
|
+
done
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
remove_one() {
|
|
154
161
|
local dir; dir="$(wt_dir "$1")"
|
|
155
162
|
local branch registered rm_anyway=0 force=0
|
|
156
163
|
if [[ ! -d "$dir" ]]; then
|
|
@@ -23,9 +23,11 @@ _pi_worktree() {
|
|
|
23
23
|
fi
|
|
24
24
|
|
|
25
25
|
case "$first" in
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
-r|--remove|remove|rm)
|
|
27
|
+
COMPREPLY=($(compgen -W "$wts" -- "$cur"))
|
|
28
|
+
;;
|
|
29
|
+
-i|--info|info|create)
|
|
30
|
+
# info and create accept one name
|
|
29
31
|
if (( COMP_CWORD == 2 )); then
|
|
30
32
|
COMPREPLY=($(compgen -W "$wts" -- "$cur"))
|
|
31
33
|
else
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ Installed by the package postinstall hook to `~/.local/bin/pi-worktree`, with ba
|
|
|
19
19
|
| `pi-worktree list` | All worktrees; the main checkout is marked `(main checkout)`, stale registrations are flagged. |
|
|
20
20
|
| `pi-worktree info <name>` | Clean/dirty status, branch and HEAD, base commit, ahead/behind `main`, unique commits. |
|
|
21
21
|
| `pi-worktree out` | Open a shell in the main checkout (for merging). |
|
|
22
|
-
| `pi-worktree remove <name
|
|
22
|
+
| `pi-worktree remove <name> [<name> ...]` | Remove worktrees and branches in order; asks before discarding dirty files or unmerged commits. Stops on failure without undoing earlier removals. |
|
|
23
23
|
| `pi-worktree prune` | Drop registrations whose directory was deleted by hand. |
|
|
24
24
|
|
|
25
25
|
## Isolating a task
|