@signalridge/pi-worktree 1.4.0 → 1.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 +48 -0
- package/README.md +11 -15
- package/package.json +5 -5
- package/src/session.ts +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.2
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- e939fa0: Fix Pi 0.85.1 tool-approval argument forwarding, ambient-auth and credential-specific model routing, and cross-platform workspace session validation.
|
|
7
|
+
|
|
8
|
+
## 1.4.1
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- d9219d4: Correct shipped documentation that contradicted the code or the manifest.
|
|
12
|
+
|
|
13
|
+
- `pi-subagents`: the summary line still advertised protocol-v3 spawning while
|
|
14
|
+
the feature list and the managed-spawn section described v4.
|
|
15
|
+
- `pi-worktree`: the workspace-switching section named `/tree`; the registered
|
|
16
|
+
command is `/worktree`.
|
|
17
|
+
- `pi-workflows`: removed an orphaned sentence fragment left behind by an edit
|
|
18
|
+
to the saved-workflow paragraph.
|
|
19
|
+
- `pi-plan-mode`, `pi-goal`, `pi-usage-extension`: the stated Pi floor
|
|
20
|
+
(`0.80.6`, `0.42.4+`) contradicted the declared `^0.84.0` peer range, which
|
|
21
|
+
resolves to `0.84.x`. `pi-usage-extension` also carried a "Last updated"
|
|
22
|
+
stamp from a version that predates the workspace baseline.
|
|
23
|
+
- `pi-welcome`: the example card was a real session capture. It is now a
|
|
24
|
+
generic sample, and Install moved above the configuration sections instead of
|
|
25
|
+
sitting below them.
|
|
26
|
+
- 1f586f8: Expand Pi peer support to `^0.84.0 || ^0.85.0`, retaining 0.84 compatibility while admitting 0.85 releases. The previous zero-major caret range excluded Pi 0.85.1. Update existing Pi development dependency pins to 0.85.1.
|
|
27
|
+
- d9219d4: Converge every README on one house style: plain sentence-case headings, no
|
|
28
|
+
decorative emoji.
|
|
29
|
+
|
|
30
|
+
Ten packages carried an emoji heading scheme inherited from their upstream
|
|
31
|
+
forks while the other nineteen used plain headings, so the same monorepo
|
|
32
|
+
rendered as two unrelated projects on npmjs.com. Headings are now emoji-free
|
|
33
|
+
and titles are sentence case.
|
|
34
|
+
|
|
35
|
+
Also removes the `Keywords` section from those ten. It duplicated each
|
|
36
|
+
package's `package.json` `keywords` field, which is what npm actually indexes,
|
|
37
|
+
and no plain-style README carried one. `Installation` is now `Install`
|
|
38
|
+
everywhere.
|
|
39
|
+
|
|
40
|
+
Headings that were Title Case are sentence case too, so one convention now
|
|
41
|
+
covers the whole monorepo. Existing in-page anchor links are unaffected:
|
|
42
|
+
GitHub lowercases heading slugs already.
|
|
43
|
+
|
|
44
|
+
Documentation only — no runtime change.
|
|
45
|
+
- Updated dependencies [1f586f8]
|
|
46
|
+
- Updated dependencies [1f586f8]
|
|
47
|
+
- Updated dependencies [1f586f8]
|
|
48
|
+
- Updated dependencies [1f586f8]
|
|
49
|
+
- @signalridge/pi-ui@1.3.1
|
|
50
|
+
|
|
3
51
|
## 1.4.0
|
|
4
52
|
### Minor Changes
|
|
5
53
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pi-worktree — safe Git worktree management for Pi
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@signalridge/pi-worktree) [](https://pi.dev) [](./LICENSE)
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ Pi cannot change its parent process working directory with `cd`. This extension
|
|
|
8
8
|
|
|
9
9
|
This package is the full interactive worktree manager. It is publishable and stable, and opt-in: install it only if your project allows git worktrees. Some repositories forbid them outright — a worktree placed inside the source tree can be picked up by tooling that scans the tree, so check your repository's own guidance before enabling it.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Features
|
|
12
12
|
|
|
13
13
|
- Shows compact main, linked, current, detached, locked, and prunable state in worktree selectors.
|
|
14
14
|
- Creates a new branch worktree or attaches an existing unoccupied local branch.
|
|
@@ -23,7 +23,7 @@ This package is the full interactive worktree manager. It is publishable and sta
|
|
|
23
23
|
- Always previews stale metadata before pruning it and revalidates the preview after confirmation.
|
|
24
24
|
- Runs Git through argv-based subprocess calls, without interpolating user input into shell commands.
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Install
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
pi install npm:@signalridge/pi-worktree
|
|
@@ -42,7 +42,7 @@ just try worktree
|
|
|
42
42
|
# or: pi -e ./packages/pi-worktree
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
##
|
|
45
|
+
## Usage
|
|
46
46
|
|
|
47
47
|
Run the command without arguments:
|
|
48
48
|
|
|
@@ -65,7 +65,7 @@ RPC dialogs; print and JSON modes reject the command observably. Operation-speci
|
|
|
65
65
|
inputs, worktree identity selectors, preflight previews, and destructive confirmations remain
|
|
66
66
|
extension-owned because they carry Git safety and commit-aware revalidation.
|
|
67
67
|
|
|
68
|
-
##
|
|
68
|
+
## Add defaults
|
|
69
69
|
|
|
70
70
|
For a new branch, the current symbolic branch is the default start point. If Pi is running from detached HEAD, the command requires an explicit commit-ish. Git must resolve the start point to exactly one commit.
|
|
71
71
|
|
|
@@ -84,7 +84,7 @@ Leave the path input blank to accept the suggestion. A custom absolute path is u
|
|
|
84
84
|
|
|
85
85
|
The MVP does not expose `--force`, `-B`, `--detach`, `--orphan`, or lock options.
|
|
86
86
|
|
|
87
|
-
##
|
|
87
|
+
## Worktree root settings
|
|
88
88
|
|
|
89
89
|
The machine-local user settings file is:
|
|
90
90
|
|
|
@@ -106,12 +106,12 @@ A missing `worktreeRoot` uses `~/.worktrees`; the settings file is created only
|
|
|
106
106
|
|
|
107
107
|
Malformed or invalid settings are warned about but never overwritten, including an invalid edit made while a settings action is open. An initial failure uses `~/.worktrees`; a later failure retains the last valid effective root. Interactive configuration remains blocked until the invalid file is fixed manually. Failed publication leaves the prior file and effective runtime root unchanged, and the save queue remains usable after rejection.
|
|
108
108
|
|
|
109
|
-
##
|
|
109
|
+
## Pi workspace switching
|
|
110
110
|
|
|
111
111
|
Switching uses Pi's public `SessionManager` and `ctx.switchSession()` APIs:
|
|
112
112
|
|
|
113
113
|
1. The command waits for Pi to become fully idle so the current assistant/tool results are persisted.
|
|
114
|
-
2. A linear persisted session is forked into the target worktree. If `/
|
|
114
|
+
2. A linear persisted session is forked into the target worktree. If `/worktree` currently points at an older branch, the documented session entries for that active branch are written to the target instead, so switching cannot jump to a newer serialized leaf.
|
|
115
115
|
3. Pi tears down the old cwd-bound runtime and creates the target runtime.
|
|
116
116
|
4. The extension reports success only through the fresh replacement-session context.
|
|
117
117
|
|
|
@@ -119,7 +119,7 @@ If the current session is completely empty, the extension creates a valid empty
|
|
|
119
119
|
|
|
120
120
|
A successfully created Git worktree is never rolled back merely because Pi session switching fails. Re-run `/worktree` and choose **Switch worktree** after resolving the reported Pi/session issue.
|
|
121
121
|
|
|
122
|
-
##
|
|
122
|
+
## Safety boundaries
|
|
123
123
|
|
|
124
124
|
- The main worktree and current worktree cannot be removed.
|
|
125
125
|
- Locked or stale worktrees cannot be removed through this extension.
|
|
@@ -144,7 +144,7 @@ Use Git directly when you intentionally need force removal, branch deletion, cus
|
|
|
144
144
|
- Project trust and cwd-bound extension/resource loading during a switch remain owned by Pi.
|
|
145
145
|
- The extension registers no LLM tool, background watcher, project settings, or statusline item.
|
|
146
146
|
|
|
147
|
-
##
|
|
147
|
+
## Package layout
|
|
148
148
|
|
|
149
149
|
```text
|
|
150
150
|
packages/pi-worktree/
|
|
@@ -168,10 +168,6 @@ packages/pi-worktree/
|
|
|
168
168
|
└── tsconfig.json
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
##
|
|
172
|
-
|
|
173
|
-
`pi-package`, `pi-extension`, `git`, `worktree`, `workspace`, `session`
|
|
174
|
-
|
|
175
|
-
## 📄 License
|
|
171
|
+
## License
|
|
176
172
|
|
|
177
173
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalridge/pi-worktree",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Pi extension for safe interactive Git worktree management and workspace switching.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"lint": "biome check ."
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@earendil-works/pi-coding-agent": "^0.84.0"
|
|
38
|
+
"@earendil-works/pi-coding-agent": "^0.84.0 || ^0.85.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@biomejs/biome": "2.5.7",
|
|
42
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
43
|
-
"@earendil-works/pi-tui": "0.
|
|
42
|
+
"@earendil-works/pi-coding-agent": "0.85.1",
|
|
43
|
+
"@earendil-works/pi-tui": "0.85.1",
|
|
44
44
|
"@types/node": "26.1.2",
|
|
45
45
|
"@types/proper-lockfile": "^4.1.4",
|
|
46
46
|
"typescript": "7.0.2",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@narumitw/pi-tui-kit": "^0.54.0",
|
|
63
|
-
"@signalridge/pi-ui": "^1.3.
|
|
63
|
+
"@signalridge/pi-ui": "^1.3.1",
|
|
64
64
|
"proper-lockfile": "^4.1.2"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/session.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { resolve as normalizeTargetPath } from "node:path";
|
|
2
3
|
import type { ExtensionCommandContext, SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
3
4
|
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
4
5
|
import { stripTerminalControls } from "./git.js";
|
|
@@ -67,6 +68,14 @@ export function createTargetSession(ctx: ExtensionCommandContext, targetPath: st
|
|
|
67
68
|
return writeTargetSession(targetPath, [], undefined, null);
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
export function sessionCwdMatches(
|
|
72
|
+
actual: string,
|
|
73
|
+
expected: string,
|
|
74
|
+
resolvePath: (path: string) => string = normalizeTargetPath,
|
|
75
|
+
): boolean {
|
|
76
|
+
return resolvePath(actual) === resolvePath(expected);
|
|
77
|
+
}
|
|
78
|
+
|
|
70
79
|
function writeTargetSession(
|
|
71
80
|
targetPath: string,
|
|
72
81
|
entries: readonly SessionEntry[],
|
|
@@ -84,7 +93,7 @@ function writeTargetSession(
|
|
|
84
93
|
mode: 0o600,
|
|
85
94
|
});
|
|
86
95
|
const verified = SessionManager.open(targetFile);
|
|
87
|
-
if (verified.getCwd()
|
|
96
|
+
if (!sessionCwdMatches(verified.getCwd(), targetPath) || verified.getLeafId() !== expectedLeaf) {
|
|
88
97
|
throw new Error("Pi could not verify the target session cwd and active branch.");
|
|
89
98
|
}
|
|
90
99
|
return targetFile;
|