pi-odd-worktree 1.2.0 → 2.1.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/README.md +65 -26
- package/extensions/odd-worktree-tools.ts +576 -119
- package/lib/odd-prompt/odd-worktrees.with-codegraph.md +19 -0
- package/lib/odd-prompt/odd-worktrees.without-codegraph.md +15 -0
- package/lib/odd-worktrees-prompt.js +25 -28
- package/lib/warp-delete-confirm.js +1 -1
- package/lib/worktree-card.js +7 -7
- package/lib/worktree-close-herdr.js +1 -1
- package/lib/worktree-hooks.js +7 -6
- package/lib/worktree-model-result.js +2 -2
- package/lib/worktree-session-guard.js +1 -1
- package/lib/worktree-warp-busy.js +488 -43
- package/package.json +1 -1
- package/tools/odd-worktrees-prompt.test.js +36 -29
- package/tools/package-surface.test.js +7 -4
- package/tools/t5-session-identity.test.js +4 -4
- package/tools/warp-busy-guard.test.js +812 -172
- package/tools/warp-delete-confirm.test.js +1 -1
- package/tools/worktree-close-herdr-async.test.js +2 -2
- package/tools/worktree-session-guard.test.js +1 -1
- package/tools/worktree-tools.test.js +177 -13
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ alone; Herdr is optional.
|
|
|
14
14
|
| `worktree_list` | tool | Lists the principal checkout, then this session's own checkout, then the rest, cross-checked against live git checkouts. Rows whose path is gone are excluded and pruned from the registry. |
|
|
15
15
|
| `worktree_create` | tool | Creates a branch and its checkout from the **local** `main`, registers it, runs the creation hooks, and copies the pending changes you name. |
|
|
16
16
|
| `worktree_warp` | tool | Queues the session move to another checkout as a `/warp` handoff; the command performs the move when the turn ends. |
|
|
17
|
-
| `
|
|
17
|
+
| `worktree_delete` | tool | Removes a registered checkout with `git worktree remove`, keeping the branch, and refuses while a live Pi session is working in it. |
|
|
18
18
|
| `/warp` | panel | Moves this session to another checkout: no argument opens the selector (list, create, delete, extended list); `/warp <name>` jumps straight there. A session with no conversation yet changes checkout **silently** — no fork, no `Warp · moved` card, nothing to carry — and warping back from it is the same empty case. |
|
|
19
19
|
| `/odd-list` | panel | Two-pane reader of this checkout's `odd/tasks/*.md`: list on the left, styled markdown on the right. |
|
|
20
20
|
| `/issues` | panel | Full-screen reader of this checkout's repository issues — My issues / Assigned / Involved / All — with preview, comments, labels, assignees and close, gated on your repository role. |
|
|
@@ -26,7 +26,7 @@ A checkout's **name** is the slug of its branch, and its path is
|
|
|
26
26
|
`<repo-parent>/<repo-name>-worktrees/<slug>`: the slug lowercases the branch and
|
|
27
27
|
turns every non-alphanumeric run into `-` (`feat/login` → `feat-login`). The
|
|
28
28
|
principal checkout is `principal`. Names, paths and branches are accepted
|
|
29
|
-
interchangeably by `
|
|
29
|
+
interchangeably by `worktree_delete`, and by `/warp`.
|
|
30
30
|
|
|
31
31
|
## Quick Start
|
|
32
32
|
|
|
@@ -66,15 +66,21 @@ as commands, and the four `worktree_*` tools are offered to the agent.
|
|
|
66
66
|
`worktree_create` needs a `branch` and a mandatory `changes` selection:
|
|
67
67
|
`"all"`, `"none"`, or a list of checkout-relative paths. It never guesses,
|
|
68
68
|
and a repository with no local `main` is refused before anything is written.
|
|
69
|
-
An existing branch is adopted as-is instead of being recreated.
|
|
69
|
+
An existing branch is adopted as-is instead of being recreated. **A create is
|
|
70
|
+
instant**: the checkout and its registry row are the answer, and the slow half
|
|
71
|
+
of the setup — dependency install, `codegraph init` — continues in a tracked
|
|
72
|
+
background task on both fronts. The panel notifies you when it finishes; the
|
|
73
|
+
tool says `setup: running in the background (install, codegraph)` and a later
|
|
74
|
+
`worktree_create` for the same checkout reports how it ended. Nothing is
|
|
75
|
+
skipped, and a deferred setup never turns a successful create into an error.
|
|
70
76
|
2. **List** — `worktree_list`, or open `/warp`. Pass `all: true` to the tool (or
|
|
71
77
|
`v` in the panel) to also see live checkouts the registry does not know.
|
|
72
78
|
3. **Move** — `/warp <name>`, the selector's `enter`, or `worktree_warp`. The
|
|
73
79
|
selector never offers the checkout you are already in; the exclusion is by
|
|
74
80
|
resolved real path, so a differently-spelled path to the same checkout is
|
|
75
81
|
excluded too.
|
|
76
|
-
4. **
|
|
77
|
-
plus `force: true` for a dirty checkout.
|
|
82
|
+
4. **Delete** — `worktree_delete` with exactly one of `name`, `path` or `branch`,
|
|
83
|
+
plus `force: true` for a dirty checkout. Deleting asks for approval when the
|
|
78
84
|
host offers dialog UI; creating never does, because it touches no existing
|
|
79
85
|
data.
|
|
80
86
|
|
|
@@ -127,7 +133,7 @@ attempted.
|
|
|
127
133
|
### The deletion guard, and its honest limit
|
|
128
134
|
|
|
129
135
|
Deleting a checkout is refused while a live Pi session is working in it, and
|
|
130
|
-
the **same** check runs for `
|
|
136
|
+
the **same** check runs for `worktree_delete` and for the panel's `ctrl+d`, both
|
|
131
137
|
before the pending-change question and again immediately before the removal.
|
|
132
138
|
This session's own checkout is refused with "warp first"; another session's is
|
|
133
139
|
refused naming its real session id, resolved by joining the published presence
|
|
@@ -153,23 +159,54 @@ Removal is `git worktree remove <absolute path>`, with `--force` only when the
|
|
|
153
159
|
caller asked for it. The branch is kept, and **no Herdr workspace is closed,
|
|
154
160
|
opened or removed** on any path.
|
|
155
161
|
|
|
156
|
-
### A warp waits for this session's own agent tasks
|
|
157
|
-
|
|
158
|
-
A warp never lands while this session still has running or queued agent tasks
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
162
|
+
### A warp waits for this session's own agent tasks and background jobs
|
|
163
|
+
|
|
164
|
+
A warp never lands while this session still has running or queued agent tasks or
|
|
165
|
+
a running background job — and it is never thrown away: the request is
|
|
166
|
+
**queued**.
|
|
167
|
+
|
|
168
|
+
- The `worktree_warp` tool validates and queues the handoff exactly as it does
|
|
169
|
+
when the session is idle, and its first line names both workloads: `worktree
|
|
170
|
+
warp: handoff queued — waiting for 2 running agent task(s) and 1 running
|
|
171
|
+
background job before the move`. It never claims a move. A second
|
|
172
|
+
`worktree_warp` call in the same turn is refused, because the request is
|
|
173
|
+
pending from the moment it is queued.
|
|
174
|
+
- `/warp` — a typed name, the selector, a create's follow-up warp and the agent
|
|
175
|
+
handoff all share one path — gives both sources a bounded chance to drain
|
|
176
|
+
(`ODD_WORKTREE_WARP_BUSY_WAIT_MS`, 60 s by default) and then keeps the request
|
|
177
|
+
**pending** instead of switching: the session stays where it is, and a bounded
|
|
178
|
+
background poller re-dispatches the SAME validated handoff once this session
|
|
179
|
+
reports no running or queued agent task and no running job. Nothing switches
|
|
180
|
+
mid-work.
|
|
181
|
+
- **One pending warp per session.** A second warp is refused while one is
|
|
182
|
+
pending — on the tool and on the panel alike, with `a warp to <name> is
|
|
183
|
+
already pending for this session — it runs when the pending agent tasks
|
|
184
|
+
finish; wait for it or let it expire` — and the pending request is never
|
|
185
|
+
replaced.
|
|
186
|
+
- The pending warp expires after `ODD_WORKTREE_WARP_PENDING_MS` (30 minutes by
|
|
187
|
+
default, clamped to a day) and notifies that it expired with nothing moved. It
|
|
188
|
+
re-reads both sources every `ODD_WORKTREE_WARP_PENDING_POLL_MS` (2 s by
|
|
189
|
+
default) and its timer never keeps the session alive. A warp that runs, is
|
|
190
|
+
refused or expires clears the queue, so the next request is accepted again.
|
|
191
|
+
- The re-dispatched handoff re-checks that the destination checkout and the
|
|
192
|
+
session are still where the request left them: drift refuses the move instead
|
|
193
|
+
of guessing.
|
|
194
|
+
|
|
195
|
+
Both sources are read **best effort**, and neither is ever guessed:
|
|
196
|
+
|
|
197
|
+
- **Agent tasks** come from Gentle Shell's presence header for this session,
|
|
198
|
+
through the same bounded reader the deletion guard uses. A heartbeat older than
|
|
199
|
+
15 s is not evidence, and an absent or unreadable store blocks nothing.
|
|
200
|
+
- **Background jobs** come from the host's `job_list` tool — the same `ctx.tools`
|
|
201
|
+
+ `ctx.executeTool` seam `worktree_create` uses to register a checkout. Each
|
|
202
|
+
row is `id · status · label · elapsed · output`; only a status field that says
|
|
203
|
+
`running` or `queued` (a monitor reports `monitor running`) keeps the warp
|
|
204
|
+
waiting, while `exited 0`, `failed 1` and `stopped` are finished. "Not
|
|
205
|
+
exited" is never read as activity.
|
|
206
|
+
- A host that does not offer `job_list`, a call that fails, and an answer this
|
|
207
|
+
parser does not know all count as **unknown**, never as "no jobs": the warp
|
|
208
|
+
still runs, and a `queue:` line says the job state is unknown instead of
|
|
209
|
+
pretending it was read.
|
|
173
210
|
|
|
174
211
|
### `/issues` pins the repository
|
|
175
212
|
|
|
@@ -189,9 +226,11 @@ start, unless you set `CODEGRAPH_FORCE=1`, which answers "present" without
|
|
|
189
226
|
probing.
|
|
190
227
|
|
|
191
228
|
- **On creation**, `worktree_create` runs `codegraph init` inside the new
|
|
192
|
-
checkout, so it starts with its own index.
|
|
193
|
-
|
|
194
|
-
|
|
229
|
+
checkout, so it starts with its own index. It runs in the background half of
|
|
230
|
+
the create's setup (see *Create* above), so the checkout is usable before the
|
|
231
|
+
index is written. A session where the gate answered false reports that step as
|
|
232
|
+
`skipped` and names the gate as the reason; it never silently pretends to have
|
|
233
|
+
indexed anything.
|
|
195
234
|
- **On edits**, a successful `edit` or `write` schedules `codegraph sync` for the
|
|
196
235
|
git toplevel of the file touched, so a worktree syncs that worktree. The sync is
|
|
197
236
|
detached: the tool result never waits for it, and a failure never reaches you.
|