pi-odd-worktree 1.1.1 → 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 +55 -7
- package/extensions/odd-worktree-tools.ts +490 -164
- 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-git.js +1 -190
- package/lib/worktree-hooks.js +2 -2
- package/lib/worktree-model-result.js +2 -2
- package/lib/worktree-session-guard.js +9 -1
- package/lib/worktree-warp-busy.js +564 -0
- package/package.json +1 -1
- package/tools/herdr-free-create.test.js +161 -0
- 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 +1123 -0
- 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 +35 -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
|
|
|
@@ -34,7 +34,6 @@ interchangeably by `worktree_close`, and by `/warp`.
|
|
|
34
34
|
| --- | --- |
|
|
35
35
|
| Pi (`@earendil-works/pi-coding-agent`, `@earendil-works/pi-tui`) | Peer dependencies at `*`, supplied by the host. The package installs no runtime dependencies. |
|
|
36
36
|
| Node.js >= 18 and `git` | `engines` declares 18 as the floor, and every repository operation is a git child process. |
|
|
37
|
-
| `herdr` — optional | Not required: only `worktree_create` tries a Herdr workspace association, and it falls back to plain `git`. |
|
|
38
37
|
| `gh`, authenticated (`gh auth login`) | `/issues` only. Without it the command stays registered, says once per session what is missing, and never opens. |
|
|
39
38
|
| `codegraph` — optional | Keeps each checkout's index fresh: `codegraph init` when a checkout is created, and a background `codegraph sync` after edits and writes. Absent, both stay off for the whole session. |
|
|
40
39
|
| Gentle Shell — recommended | Supplies the presence and transport records the deletion guard reads to see sessions other than this one. |
|
|
@@ -74,8 +73,8 @@ as commands, and the four `worktree_*` tools are offered to the agent.
|
|
|
74
73
|
selector never offers the checkout you are already in; the exclusion is by
|
|
75
74
|
resolved real path, so a differently-spelled path to the same checkout is
|
|
76
75
|
excluded too.
|
|
77
|
-
4. **
|
|
78
|
-
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
|
|
79
78
|
host offers dialog UI; creating never does, because it touches no existing
|
|
80
79
|
data.
|
|
81
80
|
|
|
@@ -128,7 +127,7 @@ attempted.
|
|
|
128
127
|
### The deletion guard, and its honest limit
|
|
129
128
|
|
|
130
129
|
Deleting a checkout is refused while a live Pi session is working in it, and
|
|
131
|
-
the **same** check runs for `
|
|
130
|
+
the **same** check runs for `worktree_delete` and for the panel's `ctrl+d`, both
|
|
132
131
|
before the pending-change question and again immediately before the removal.
|
|
133
132
|
This session's own checkout is refused with "warp first"; another session's is
|
|
134
133
|
refused naming its real session id, resolved by joining the published presence
|
|
@@ -154,6 +153,55 @@ Removal is `git worktree remove <absolute path>`, with `--force` only when the
|
|
|
154
153
|
caller asked for it. The branch is kept, and **no Herdr workspace is closed,
|
|
155
154
|
opened or removed** on any path.
|
|
156
155
|
|
|
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.
|
|
204
|
+
|
|
157
205
|
### `/issues` pins the repository
|
|
158
206
|
|
|
159
207
|
The repository identity (`<host>/<owner>/<repo>`) is pinned when the list loads,
|
|
@@ -238,7 +286,7 @@ This package is the worktree / ODD / issues surface only: no customize panel, no
|
|
|
238
286
|
plugin-tools toggles, no Herdr plugin management, and no worktree↔issue
|
|
239
287
|
association. There is nothing to configure, and `/warp`, `/odd-list` and
|
|
240
288
|
`/issues` are always on (the three `/codegraph-*` commands follow the CLI).
|
|
241
|
-
Paths, branches and arguments reach `git
|
|
289
|
+
Paths, branches and arguments reach `git` and `gh` as fixed argv arrays,
|
|
242
290
|
never as a shell string.
|
|
243
291
|
|
|
244
292
|
## Tests
|