pi-odd-worktree 1.2.0 → 2.0.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 +53 -22
- package/extensions/odd-worktree-tools.ts +439 -68
- 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-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 +806 -171
- 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 +11 -11
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
|
|
|
@@ -73,8 +73,8 @@ as commands, and the four `worktree_*` tools are offered to the agent.
|
|
|
73
73
|
selector never offers the checkout you are already in; the exclusion is by
|
|
74
74
|
resolved real path, so a differently-spelled path to the same checkout is
|
|
75
75
|
excluded too.
|
|
76
|
-
4. **
|
|
77
|
-
plus `force: true` for a dirty checkout.
|
|
76
|
+
4. **Delete** — `worktree_delete` with exactly one of `name`, `path` or `branch`,
|
|
77
|
+
plus `force: true` for a dirty checkout. Deleting asks for approval when the
|
|
78
78
|
host offers dialog UI; creating never does, because it touches no existing
|
|
79
79
|
data.
|
|
80
80
|
|
|
@@ -127,7 +127,7 @@ attempted.
|
|
|
127
127
|
### The deletion guard, and its honest limit
|
|
128
128
|
|
|
129
129
|
Deleting a checkout is refused while a live Pi session is working in it, and
|
|
130
|
-
the **same** check runs for `
|
|
130
|
+
the **same** check runs for `worktree_delete` and for the panel's `ctrl+d`, both
|
|
131
131
|
before the pending-change question and again immediately before the removal.
|
|
132
132
|
This session's own checkout is refused with "warp first"; another session's is
|
|
133
133
|
refused naming its real session id, resolved by joining the published presence
|
|
@@ -153,23 +153,54 @@ Removal is `git worktree remove <absolute path>`, with `--force` only when the
|
|
|
153
153
|
caller asked for it. The branch is kept, and **no Herdr workspace is closed,
|
|
154
154
|
opened or removed** on any path.
|
|
155
155
|
|
|
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
|
-
|
|
156
|
+
### A warp waits for this session's own agent tasks and background jobs
|
|
157
|
+
|
|
158
|
+
A warp never lands while this session still has running or queued agent tasks or
|
|
159
|
+
a running background job — and it is never thrown away: the request is
|
|
160
|
+
**queued**.
|
|
161
|
+
|
|
162
|
+
- The `worktree_warp` tool validates and queues the handoff exactly as it does
|
|
163
|
+
when the session is idle, and its first line names both workloads: `worktree
|
|
164
|
+
warp: handoff queued — waiting for 2 running agent task(s) and 1 running
|
|
165
|
+
background job before the move`. It never claims a move. A second
|
|
166
|
+
`worktree_warp` call in the same turn is refused, because the request is
|
|
167
|
+
pending from the moment it is queued.
|
|
168
|
+
- `/warp` — a typed name, the selector, a create's follow-up warp and the agent
|
|
169
|
+
handoff all share one path — gives both sources a bounded chance to drain
|
|
170
|
+
(`ODD_WORKTREE_WARP_BUSY_WAIT_MS`, 60 s by default) and then keeps the request
|
|
171
|
+
**pending** instead of switching: the session stays where it is, and a bounded
|
|
172
|
+
background poller re-dispatches the SAME validated handoff once this session
|
|
173
|
+
reports no running or queued agent task and no running job. Nothing switches
|
|
174
|
+
mid-work.
|
|
175
|
+
- **One pending warp per session.** A second warp is refused while one is
|
|
176
|
+
pending — on the tool and on the panel alike, with `a warp to <name> is
|
|
177
|
+
already pending for this session — it runs when the pending agent tasks
|
|
178
|
+
finish; wait for it or let it expire` — and the pending request is never
|
|
179
|
+
replaced.
|
|
180
|
+
- The pending warp expires after `ODD_WORKTREE_WARP_PENDING_MS` (30 minutes by
|
|
181
|
+
default, clamped to a day) and notifies that it expired with nothing moved. It
|
|
182
|
+
re-reads both sources every `ODD_WORKTREE_WARP_PENDING_POLL_MS` (2 s by
|
|
183
|
+
default) and its timer never keeps the session alive. A warp that runs, is
|
|
184
|
+
refused or expires clears the queue, so the next request is accepted again.
|
|
185
|
+
- The re-dispatched handoff re-checks that the destination checkout and the
|
|
186
|
+
session are still where the request left them: drift refuses the move instead
|
|
187
|
+
of guessing.
|
|
188
|
+
|
|
189
|
+
Both sources are read **best effort**, and neither is ever guessed:
|
|
190
|
+
|
|
191
|
+
- **Agent tasks** come from Gentle Shell's presence header for this session,
|
|
192
|
+
through the same bounded reader the deletion guard uses. A heartbeat older than
|
|
193
|
+
15 s is not evidence, and an absent or unreadable store blocks nothing.
|
|
194
|
+
- **Background jobs** come from the host's `job_list` tool — the same `ctx.tools`
|
|
195
|
+
+ `ctx.executeTool` seam `worktree_create` uses to register a checkout. Each
|
|
196
|
+
row is `id · status · label · elapsed · output`; only a status field that says
|
|
197
|
+
`running` or `queued` (a monitor reports `monitor running`) keeps the warp
|
|
198
|
+
waiting, while `exited 0`, `failed 1` and `stopped` are finished. "Not
|
|
199
|
+
exited" is never read as activity.
|
|
200
|
+
- A host that does not offer `job_list`, a call that fails, and an answer this
|
|
201
|
+
parser does not know all count as **unknown**, never as "no jobs": the warp
|
|
202
|
+
still runs, and a `queue:` line says the job state is unknown instead of
|
|
203
|
+
pretending it was read.
|
|
173
204
|
|
|
174
205
|
### `/issues` pins the repository
|
|
175
206
|
|