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
|
@@ -471,7 +471,7 @@ describe('A2: ignored files are disclosed, never silently deleted', () => {
|
|
|
471
471
|
});
|
|
472
472
|
|
|
473
473
|
// S7/S8: the warp panel's Ctrl+D runs the SAME active-session guard as the
|
|
474
|
-
// `
|
|
474
|
+
// `worktree_delete` tool, and it runs it BEFORE the pending-change question.
|
|
475
475
|
// These cases drive the real `/warp` command with a host double: `ui.custom`
|
|
476
476
|
// answers the marker the selector's `ctrl+d` emits, `ui.confirm` records the
|
|
477
477
|
// one dialog, and every temp worktree is created through the registered tool.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
// S6: `
|
|
2
|
+
// S6: `worktree_delete` removes a checkout with `git worktree remove` and NOTHING
|
|
3
3
|
// else. The Herdr workspace reconcile it used to run — closing every workspace
|
|
4
4
|
// of the checkout's group and opening a fresh one at the principal — is gone:
|
|
5
5
|
// this package never closes or opens a Herdr panel, and it never asks Herdr to
|
|
@@ -192,7 +192,7 @@ describe('S6: a real close spawns no Herdr process', () => {
|
|
|
192
192
|
// From here on any Herdr spawn would leave a line in the log.
|
|
193
193
|
process.env.HERDR_BIN_PATH = HERDR_SHIM;
|
|
194
194
|
try {
|
|
195
|
-
const closed = await tools.get('
|
|
195
|
+
const closed = await tools.get('worktree_delete').execute('c2', { name: 'feat-quiet' }, undefined, undefined, ctx);
|
|
196
196
|
assert.notEqual(closed.isError, true, resultText(closed));
|
|
197
197
|
} finally {
|
|
198
198
|
process.env.HERDR_BIN_PATH = NO_HERDR;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
// S7/S8/S9: lib/worktree-session-guard.js — the ONE active-session guard the
|
|
3
|
-
// `
|
|
3
|
+
// `worktree_delete` tool and the warp panel's Ctrl+D both run.
|
|
4
4
|
//
|
|
5
5
|
// Gentle Shell publishes its session presence store under
|
|
6
6
|
// `<agent home>/gentle-agents/presence`: a bounded `<sessionHash>.<incarnation>
|
|
@@ -279,7 +279,7 @@ describe('worktree_create', () => {
|
|
|
279
279
|
});
|
|
280
280
|
});
|
|
281
281
|
|
|
282
|
-
describe('
|
|
282
|
+
describe('worktree_delete', () => {
|
|
283
283
|
test('removes the checkout and keeps the branch', async () => {
|
|
284
284
|
const repo = makeRepo();
|
|
285
285
|
const { ctx } = makeCtx(repo);
|
|
@@ -293,7 +293,7 @@ describe('worktree_close', () => {
|
|
|
293
293
|
assert.notEqual(created.isError, true, resultText(created));
|
|
294
294
|
const target = path.join(path.dirname(repo), `${path.basename(repo)}-worktrees`, 'feat-close-me');
|
|
295
295
|
|
|
296
|
-
const closed = await tools.get('
|
|
296
|
+
const closed = await tools.get('worktree_delete').execute('call-8', { name: 'feat-close-me' }, undefined, undefined, ctx);
|
|
297
297
|
assert.notEqual(closed.isError, true, resultText(closed));
|
|
298
298
|
assert.equal(
|
|
299
299
|
resultText(closed),
|
|
@@ -313,7 +313,7 @@ describe('worktree_close', () => {
|
|
|
313
313
|
test('an unknown name is refused and leaves the repository untouched', async () => {
|
|
314
314
|
const repo = makeRepo();
|
|
315
315
|
const { ctx } = makeCtx(repo);
|
|
316
|
-
const result = await tools.get('
|
|
316
|
+
const result = await tools.get('worktree_delete').execute('call-10', { name: 'nope' }, undefined, undefined, ctx);
|
|
317
317
|
assert.equal(result.isError, true);
|
|
318
318
|
assert.equal(resultText(result), 'no registered worktree for "nope": no worktrees are registered');
|
|
319
319
|
assert.equal(listWorktreePaths(repo).length, 1);
|
|
@@ -330,7 +330,7 @@ describe('worktree_close', () => {
|
|
|
330
330
|
const target = path.join(path.dirname(repo), `${path.basename(repo)}-worktrees`, 'feat-busy');
|
|
331
331
|
const sessionHash = publishSession({ sessionId: 'worker-9', label: 'Worker', workspace: target });
|
|
332
332
|
|
|
333
|
-
const closed = await tools.get('
|
|
333
|
+
const closed = await tools.get('worktree_delete').execute('call-s2', { name: 'feat-busy' }, undefined, undefined, ctx);
|
|
334
334
|
assert.equal(closed.isError, true, 'a live session blocks the close');
|
|
335
335
|
const text = resultText(closed);
|
|
336
336
|
assert.match(text, /working in that checkout/);
|
|
@@ -355,7 +355,7 @@ describe('worktree_close', () => {
|
|
|
355
355
|
// The session now STANDS in the checkout: no presence record is needed for
|
|
356
356
|
// the deterministic cwd check to catch it.
|
|
357
357
|
const { ctx } = makeCtx(target);
|
|
358
|
-
const closed = await tools.get('
|
|
358
|
+
const closed = await tools.get('worktree_delete').execute('call-s5', { name: 'feat-mine' }, undefined, undefined, ctx);
|
|
359
359
|
assert.equal(closed.isError, true);
|
|
360
360
|
const text = resultText(closed);
|
|
361
361
|
assert.match(text, /this session is working in that checkout/);
|
|
@@ -373,7 +373,7 @@ describe('worktree_close', () => {
|
|
|
373
373
|
const target = path.join(path.dirname(repo), `${path.basename(repo)}-worktrees`, 'feat-blocked-ui');
|
|
374
374
|
publishSession({ sessionId: 'ui-worker', label: 'UI Worker', workspace: target, incarnationIndex: 2 });
|
|
375
375
|
const { ctx, confirmations } = makeUiCtx(repo);
|
|
376
|
-
const closed = await tools.get('
|
|
376
|
+
const closed = await tools.get('worktree_delete').execute('call-s7', { name: 'feat/blocked-ui' }, undefined, undefined, ctx);
|
|
377
377
|
assert.equal(closed.isError, true);
|
|
378
378
|
assert.equal(confirmations.length, 0, 'the session check runs before the approval question');
|
|
379
379
|
assert.ok(fs.existsSync(target));
|
|
@@ -385,7 +385,7 @@ describe('worktree_close', () => {
|
|
|
385
385
|
await tools.get('worktree_create').execute('call-s8', { branch: 'feat/free', changes: 'none' }, undefined, undefined, ctx);
|
|
386
386
|
const target = path.join(path.dirname(repo), `${path.basename(repo)}-worktrees`, 'feat-free');
|
|
387
387
|
publishSession({ sessionId: 'other-worker', label: 'Other', workspace: repo, incarnationIndex: 3 });
|
|
388
|
-
const closed = await tools.get('
|
|
388
|
+
const closed = await tools.get('worktree_delete').execute('call-s9', { name: 'feat-free' }, undefined, undefined, ctx);
|
|
389
389
|
assert.notEqual(closed.isError, true, resultText(closed));
|
|
390
390
|
assert.equal(fs.existsSync(target), false);
|
|
391
391
|
});
|
|
@@ -398,7 +398,7 @@ describe('worktree_close', () => {
|
|
|
398
398
|
const sessionHash = publishSession({ sessionId: 'raw-worker-9', label: 'Raw', workspace: target, incarnationIndex: 7 });
|
|
399
399
|
publishTransport({ sessionId: 'raw-worker-9' });
|
|
400
400
|
|
|
401
|
-
const closed = await tools.get('
|
|
401
|
+
const closed = await tools.get('worktree_delete').execute('call-s13', { name: 'feat-joined' }, undefined, undefined, ctx);
|
|
402
402
|
assert.equal(closed.isError, true);
|
|
403
403
|
const text = resultText(closed);
|
|
404
404
|
assert.ok(text.includes('id raw-worker-9'), text);
|
|
@@ -415,7 +415,7 @@ describe('worktree_close', () => {
|
|
|
415
415
|
const target = path.join(path.dirname(repo), `${path.basename(repo)}-worktrees`, 'feat-unjoined');
|
|
416
416
|
const sessionHash = publishSession({ sessionId: 'unjoined-worker', label: 'Unjoined', workspace: target, incarnationIndex: 8 });
|
|
417
417
|
|
|
418
|
-
const closed = await tools.get('
|
|
418
|
+
const closed = await tools.get('worktree_delete').execute('call-s15', { name: 'feat-unjoined' }, undefined, undefined, ctx);
|
|
419
419
|
assert.equal(closed.isError, true);
|
|
420
420
|
const text = resultText(closed);
|
|
421
421
|
assert.ok(text.includes(sessionHash.slice(0, 12)), text);
|
|
@@ -431,7 +431,7 @@ describe('worktree_close', () => {
|
|
|
431
431
|
const target = path.join(path.dirname(repo), `${path.basename(repo)}-worktrees`, 'feat-advisory');
|
|
432
432
|
publishSession({ sessionId: 'legacy-peer', label: 'Legacy', workspace: null, heartbeat: Date.now(), incarnationIndex: 9, discovery: false });
|
|
433
433
|
|
|
434
|
-
const closed = await tools.get('
|
|
434
|
+
const closed = await tools.get('worktree_delete').execute('call-s17', { name: 'feat-advisory' }, undefined, undefined, ctx);
|
|
435
435
|
assert.notEqual(closed.isError, true, resultText(closed));
|
|
436
436
|
assert.match(resultText(closed), /published no workspace/);
|
|
437
437
|
assert.match(resultText(closed), /best effort/);
|
|
@@ -447,7 +447,7 @@ describe('worktree_close', () => {
|
|
|
447
447
|
sessionId: 'crashed-worker', label: 'Crashed', workspace: target,
|
|
448
448
|
heartbeat: Date.now() - 10 * 60 * 1000, incarnationIndex: 4,
|
|
449
449
|
});
|
|
450
|
-
const closed = await tools.get('
|
|
450
|
+
const closed = await tools.get('worktree_delete').execute('call-s11', { name: 'feat-stale' }, undefined, undefined, ctx);
|
|
451
451
|
assert.notEqual(closed.isError, true, resultText(closed));
|
|
452
452
|
const text = resultText(closed);
|
|
453
453
|
assert.match(text, /stale Gentle Shell presence record ignored/);
|