@maxiaochao/pi-toolkit 0.4.0 → 0.5.0
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 +4 -0
- package/README.md +1 -1
- package/bin/pi-worktree +23 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 2026-09-11 - v0.5.0
|
|
2
|
+
|
|
3
|
+
- fix pi-worktree: new worktrees now branch from the current branch instead of a stale origin/main (worktree content no longer misses current work); add start --base <ref> to branch from an explicit ref
|
|
4
|
+
|
|
1
5
|
## 2026-09-11 - v0.4.0
|
|
2
6
|
|
|
3
7
|
- bundle the chrome-cdp skill for attaching to a live Chrome with remote debugging (derived from pasky/chrome-cdp-skill, MIT); pi-worktree: add explicit start subcommand and skip dirty-workspace prompt when reusing an existing worktree
|
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ pi-worktree remove feat-ui # remove the worktree (refuses unmerged branches)
|
|
|
57
57
|
pi-worktree prune # drop stale registrations for manually deleted dirs
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
Typical loop: `pi-worktree start <name>` to start (Tab completes existing worktree names), commit inside Pi, `pi-worktree out` + `git merge <name>` to land the work, `pi-worktree remove <name>` to clean up. New branches are created from
|
|
60
|
+
Typical loop: `pi-worktree start <name>` to start (Tab completes existing worktree names), commit inside Pi, `pi-worktree out` + `git merge <name>` to land the work, `pi-worktree remove <name>` to clean up. New branches are created from the branch you're currently on (or `HEAD` when detached), and the base commit is recorded in `branch.<name>.base` config so `info` can always tell you where the branch came from. Bash completion covers subcommands and existing worktree names (`pi-worktree feat<Tab>`).
|
|
61
61
|
|
|
62
62
|
The bundled `web-browser` skill provides reusable scripts for starting Chrome/Chromium with remote debugging, navigating tabs, evaluating JavaScript, emulating devices, taking screenshots, dismissing cookie dialogs, and inspecting browser logs. It auto-detects common Chrome/Chromium installations on macOS and Linux, including Windows Chrome when Pi runs under WSL; set `BROWSER_BIN` when the binary is elsewhere.
|
|
63
63
|
|
package/bin/pi-worktree
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#
|
|
4
4
|
# Usage:
|
|
5
5
|
# pi-worktree start <name> [pi args...] # enter worktree <name> and start pi
|
|
6
|
+
# pi-worktree start --base <ref> <name> [pi args...] # branch from <ref> instead of current branch
|
|
6
7
|
# pi-worktree -l | --list # list worktrees (main checkout marked "main checkout")
|
|
7
8
|
# pi-worktree -i <name> # show base commit, ahead/behind, unique commits
|
|
8
9
|
# pi-worktree -o | --out # cd back to the main checkout
|
|
@@ -39,17 +40,28 @@ in_linked_worktree() {
|
|
|
39
40
|
|
|
40
41
|
wt_dir() { echo ".worktrees/$1"; }
|
|
41
42
|
|
|
42
|
-
# Best available base ref:
|
|
43
|
+
# Best available base ref: current branch > HEAD (worktrees should branch
|
|
44
|
+
# from where you actually are; a stale origin/main must not win)
|
|
43
45
|
pick_base() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
echo main
|
|
46
|
+
local cur; cur=$(git branch --show-current 2>/dev/null || true)
|
|
47
|
+
if [[ -n "$cur" ]]; then
|
|
48
|
+
echo "$cur"
|
|
48
49
|
else
|
|
49
50
|
echo HEAD
|
|
50
51
|
fi
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
# Resolve base ref for a new worktree: explicit --base wins, else current branch.
|
|
55
|
+
resolve_base() {
|
|
56
|
+
if [[ -n "${BASE_OVERRIDE:-}" ]]; then
|
|
57
|
+
git rev-parse --verify --quiet "${BASE_OVERRIDE}^{commit}" >/dev/null \
|
|
58
|
+
|| die "base ref not found: $BASE_OVERRIDE"
|
|
59
|
+
echo "$BASE_OVERRIDE"
|
|
60
|
+
else
|
|
61
|
+
pick_base
|
|
62
|
+
fi
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
ensure_gitignore() {
|
|
54
66
|
if ! git check-ignore -q .worktrees 2>/dev/null; then
|
|
55
67
|
printf '.worktrees/\n' >> .gitignore
|
|
@@ -177,7 +189,7 @@ cd_wt() {
|
|
|
177
189
|
[[ -n "$mb" ]] && git config "branch.$name.base" "$(git rev-parse --short "$mb")" \
|
|
178
190
|
&& git config "branch.$name.baseRef" main
|
|
179
191
|
else
|
|
180
|
-
local base; base=$(
|
|
192
|
+
local base; base=$(resolve_base)
|
|
181
193
|
git worktree add "$dir" -b "$name" "$base"
|
|
182
194
|
git config "branch.$name.base" "$(git rev-parse --short "$base")"
|
|
183
195
|
git config "branch.$name.baseRef" "$base"
|
|
@@ -197,6 +209,11 @@ case "${1:-}" in
|
|
|
197
209
|
-p|--prune|prune) shift; subcmd_prune ;;
|
|
198
210
|
-h|--help|help) sed -n '2,10p' "$0" | sed 's/^# \{0,1\}//' ;;
|
|
199
211
|
start) shift
|
|
212
|
+
BASE_OVERRIDE=""
|
|
213
|
+
if [[ "${1:-}" == "--base" ]]; then
|
|
214
|
+
shift; [[ $# -ge 2 ]] || die "usage: pi-worktree start --base <ref> <name> [pi args...]"
|
|
215
|
+
BASE_OVERRIDE="$1"; shift
|
|
216
|
+
fi
|
|
200
217
|
[[ $# -ge 1 ]] || die "usage: pi-worktree start <name> [pi args...]"
|
|
201
218
|
name="$1"; shift; cd_wt "$name" "$@" ;;
|
|
202
219
|
"") die "usage: pi-worktree start <name> [pi args...] (or list / info / out / remove / prune)" ;;
|
package/package.json
CHANGED