pi-odd-worktree 2.1.0 → 3.0.1
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 +54 -319
- package/extensions/odd-worktree-tools.ts +4182 -2539
- package/lib/bash-activity.js +1166 -0
- package/lib/bash-design.js +684 -0
- package/lib/bash-destructive.js +559 -0
- package/lib/bash-frame.js +205 -0
- package/lib/card-content.js +23 -0
- package/lib/card-style.js +175 -0
- package/lib/checkout-facts.js +30 -70
- package/lib/codegraph-card-preview.js +628 -0
- package/lib/codegraph-card.js +515 -0
- package/lib/codegraph-compaction.js +76 -0
- package/lib/codegraph-daemon.js +246 -0
- package/lib/codegraph-edit-sync.js +182 -0
- package/lib/codegraph-guard-target.js +337 -0
- package/lib/codegraph-guard.js +211 -0
- package/lib/codegraph-index.js +1020 -0
- package/lib/codegraph-lock.js +607 -0
- package/lib/codegraph-mcp-config.js +134 -0
- package/lib/codegraph-mcp.js +123 -0
- package/lib/codegraph-paths.js +69 -0
- package/lib/codegraph-prompt/explore.md +11 -0
- package/lib/codegraph-prompt/fix.md +6 -0
- package/lib/codegraph-prompt/generic.md +8 -0
- package/lib/codegraph-prompt/judge.md +9 -0
- package/lib/codegraph-prompt/orchestrator.md +17 -0
- package/lib/codegraph-prompt/verify.md +10 -0
- package/lib/codegraph-prompt/worker.md +7 -0
- package/lib/codegraph-role.js +55 -0
- package/lib/codegraph-rules.js +146 -0
- package/lib/codegraph-session.js +303 -383
- package/lib/codegraph-warmup.js +139 -0
- package/lib/file-card-markdown.js +141 -0
- package/lib/file-card-resolver.js +245 -0
- package/lib/file-card.js +659 -0
- package/lib/files-index.js +387 -0
- package/lib/files-insert.js +81 -0
- package/lib/files-orders.js +326 -0
- package/lib/files-picker-view.js +1421 -0
- package/lib/files-preview.js +338 -0
- package/lib/files-scope-detail.js +171 -0
- package/lib/files-scope-view.js +507 -0
- package/lib/gh-issues.js +323 -15
- package/lib/issue-preview.js +26 -7
- package/lib/issues-bash-mutation.js +206 -0
- package/lib/issues-cache-store.js +261 -0
- package/lib/issues-section.js +710 -0
- package/lib/issues-view.js +649 -52
- package/lib/odd-prompt/odd-worktrees.md +21 -0
- package/lib/odd-worktrees-prompt.js +10 -28
- package/lib/related-issues-cache.js +210 -0
- package/lib/shell-card.js +825 -0
- package/lib/skill-odd-card.js +183 -0
- package/lib/tui-paint.js +4 -5
- package/lib/warp-create-panel.js +538 -250
- package/lib/warp-create-picker.js +56 -9
- package/lib/warp-delete-confirm.js +19 -28
- package/lib/warp-selector-view.js +160 -82
- package/lib/which-command.js +90 -0
- package/lib/worktree-card.js +267 -897
- package/lib/worktree-cards.js +383 -0
- package/lib/worktree-create.js +287 -0
- package/lib/worktree-git.js +3 -3
- package/lib/worktree-guard.js +548 -0
- package/lib/worktree-hooks.js +421 -712
- package/lib/worktree-list.js +120 -0
- package/lib/worktree-registry.js +162 -879
- package/lib/{worktree-close-herdr.js → worktree-remove.js} +9 -11
- package/lib/worktree-setup-runner.js +376 -0
- package/lib/worktree-setup.js +140 -0
- package/lib/worktree-warp-busy.js +462 -85
- package/lib/worktree-warp-sessions.js +1 -2
- package/package.json +2 -2
- package/tools/bash-activity.test.js +1420 -0
- package/tools/bash-design.test.js +1093 -0
- package/tools/bash-destructive.test.js +139 -0
- package/tools/card-content.test.js +44 -0
- package/tools/card-style.test.js +298 -0
- package/tools/codegraph-card-preview.test.js +254 -0
- package/tools/codegraph-card.test.js +1080 -0
- package/tools/codegraph-compaction.test.js +378 -0
- package/tools/codegraph-daemon.test.js +248 -0
- package/tools/codegraph-edit-sync.test.js +295 -0
- package/tools/codegraph-guard-target.test.js +174 -0
- package/tools/codegraph-guard.test.js +238 -0
- package/tools/codegraph-index.test.js +1948 -0
- package/tools/codegraph-lock.test.js +932 -0
- package/tools/codegraph-mcp-config.test.js +181 -0
- package/tools/codegraph-mcp.test.js +194 -0
- package/tools/codegraph-paths.test.js +44 -0
- package/tools/codegraph-role.test.js +30 -0
- package/tools/codegraph-rules.test.js +250 -0
- package/tools/codegraph-session.test.js +660 -391
- package/tools/codegraph-warmup.test.js +316 -0
- package/tools/commands.test.js +510 -31
- package/tools/file-card-markdown.test.js +188 -0
- package/tools/file-card.test.js +1289 -0
- package/tools/files-bridge.test.js +575 -0
- package/tools/files-command.test.js +613 -0
- package/tools/files-index.test.js +473 -0
- package/tools/files-insert.test.js +139 -0
- package/tools/files-orders.test.js +597 -0
- package/tools/files-picker-view.test.js +1889 -0
- package/tools/files-preview.test.js +452 -0
- package/tools/files-scope-detail.test.js +264 -0
- package/tools/files-scope-view.test.js +614 -0
- package/tools/fixtures/card-codegraph-outputs.js +110 -0
- package/tools/fixtures/codegraph-cli-stub.js +16 -0
- package/tools/fixtures/codegraph-init-process.js +28 -0
- package/tools/fixtures/codegraph-lock-worker.js +117 -0
- package/tools/fixtures/daemon-fake.js +98 -0
- package/tools/fixtures/daemon-mcp-server.js +39 -0
- package/tools/fixtures/daemon-warmup-worker.js +12 -0
- package/tools/fixtures/load-extension.js +136 -3
- package/tools/gh-issues-feedback.test.js +31 -7
- package/tools/gh-issues.test.js +417 -1
- package/tools/issue-preview.test.js +44 -7
- package/tools/issues-bash-mutation.test.js +101 -0
- package/tools/issues-cache-store.test.js +222 -0
- package/tools/issues-command.test.js +1517 -67
- package/tools/issues-open-guard.test.js +1096 -0
- package/tools/issues-section.test.js +4235 -0
- package/tools/issues-seed-query-regression.test.js +67 -0
- package/tools/issues-view.test.js +1489 -60
- package/tools/odd-worktrees-prompt.test.js +98 -65
- package/tools/package-surface.test.js +431 -36
- package/tools/related-issues-cache.test.js +324 -0
- package/tools/shell-card.test.js +834 -0
- package/tools/skill-odd-card.test.js +200 -0
- package/tools/t5-session-identity.test.js +44 -22
- package/tools/warp-busy-guard.test.js +2565 -309
- package/tools/warp-create-panel.test.js +499 -74
- package/tools/warp-create-picker.test.js +101 -5
- package/tools/warp-delete-confirm.test.js +49 -15
- package/tools/warp-empty-session.test.js +0 -1
- package/tools/warp-fallback-regression.test.js +533 -0
- package/tools/warp-selector-view.test.js +460 -196
- package/tools/which-command.test.js +126 -0
- package/tools/worktree-card.test.js +551 -0
- package/tools/worktree-cards.test.js +845 -0
- package/tools/worktree-changes.test.js +4 -5
- package/tools/worktree-create.test.js +489 -0
- package/tools/worktree-guard.test.js +823 -0
- package/tools/worktree-hooks.test.js +905 -0
- package/tools/worktree-list.test.js +170 -0
- package/tools/worktree-registry.test.js +89 -230
- package/tools/worktree-remove-async.test.js +318 -0
- package/tools/worktree-setup-runner.test.js +276 -0
- package/tools/worktree-setup.test.js +140 -0
- package/tools/worktree-tools.test.js +419 -199
- package/lib/codegraph-commands.js +0 -165
- package/lib/odd-prompt/odd-worktrees.with-codegraph.md +0 -19
- package/lib/odd-prompt/odd-worktrees.without-codegraph.md +0 -15
- package/lib/worktree-model-result.js +0 -291
- package/tools/codegraph-commands.test.js +0 -371
- package/tools/herdr-free-create.test.js +0 -161
- package/tools/worktree-close-herdr-async.test.js +0 -204
- package/tools/worktree-odd-migration.test.js +0 -224
- package/tools/worktree-registry-cache.test.js +0 -163
- package/tools/worktree-registry-odd.test.js +0 -231
|
@@ -1108,8 +1108,8 @@ describe('S2: one-row key legends', { concurrency: false }, () => {
|
|
|
1108
1108
|
|
|
1109
1109
|
// S11/T9: every picker footer and header paints through the ONE shared palette
|
|
1110
1110
|
// (lib/tui-paint.js) with the injected theme — a shortcut KEY (a button) is
|
|
1111
|
-
// accent+bold and its description muted, a TITLE takes the
|
|
1112
|
-
//
|
|
1111
|
+
// accent+bold and its description muted, a TITLE takes the `dim` title role
|
|
1112
|
+
// and stays bold, a static label is dim, a live value (the typed
|
|
1113
1113
|
// query, the typed name) is the normal text role, a count is muted, and a rule
|
|
1114
1114
|
// takes the border role. A hostile or absent theme degrades to plain text, and
|
|
1115
1115
|
// the one-row compaction keeps the key role at every width.
|
|
@@ -1117,9 +1117,8 @@ describe('S2: one-row key legends', { concurrency: false }, () => {
|
|
|
1117
1117
|
// with their skip messages, so the palette's error role has no call site here.
|
|
1118
1118
|
describe('S11: the shared palette', { concurrency: false }, () => {
|
|
1119
1119
|
const ROLE_SGR = { accent: 96, customMessageLabel: 33, muted: 90, dim: 2, border: 34, error: 91, text: 39, mdHeading: 35 };
|
|
1120
|
-
// T9 (S13): the title role is
|
|
1121
|
-
//
|
|
1122
|
-
// pins the decision instead of reading it back out of the table.
|
|
1120
|
+
// T9 (S13): the title role is `dim` and stays bold, asserted LITERALLY — the
|
|
1121
|
+
// test pins the decision instead of reading it back out of the table.
|
|
1123
1122
|
const TITLE_PAINT = '\x1b[1m\x1b[33m';
|
|
1124
1123
|
const VALUE_PAINT = '\x1b[39m';
|
|
1125
1124
|
|
|
@@ -1355,3 +1354,100 @@ describe('S11: the shared palette', { concurrency: false }, () => {
|
|
|
1355
1354
|
}
|
|
1356
1355
|
});
|
|
1357
1356
|
});
|
|
1357
|
+
|
|
1358
|
+
// S11 (T8, warp-queue-boundary): the copy question can never be answered by a
|
|
1359
|
+
// keystroke the human did not mean for it. The prompt opens with the
|
|
1360
|
+
// NON-destructive answer focused and DROPS every input event that arrives inside
|
|
1361
|
+
// a short grace window after it mounts, so a buffered or double-tapped Enter
|
|
1362
|
+
// (submitting the command, or queueing a follow-up message while streaming)
|
|
1363
|
+
// cannot answer a question nobody saw. The clock is injected, so no test sleeps.
|
|
1364
|
+
describe('S11 (T8): the copy question cannot be answered by a stray Enter', { concurrency: false }, () => {
|
|
1365
|
+
function openCopy(overrides = {}) {
|
|
1366
|
+
const finished = [];
|
|
1367
|
+
let t = 1000;
|
|
1368
|
+
const view = picker.createSingleSelect({
|
|
1369
|
+
title: 'Uncommitted changes: 1 file, +1/-0. Copy to the destination checkout?',
|
|
1370
|
+
helpers: null,
|
|
1371
|
+
hostTui: null,
|
|
1372
|
+
theme: null,
|
|
1373
|
+
...picker.copyQuestionOptions(),
|
|
1374
|
+
now: () => t,
|
|
1375
|
+
done: (out) => { finished.push(out); },
|
|
1376
|
+
...overrides,
|
|
1377
|
+
});
|
|
1378
|
+
return { view, finished, advance: (ms) => { t += ms; } };
|
|
1379
|
+
}
|
|
1380
|
+
const plain = (view, width = 100) => view.render(width).join('\n').replace(/\x1b\[[0-9;]*m/g, '');
|
|
1381
|
+
|
|
1382
|
+
test('the wiring keeps the visible order and opens on NO COPY', () => {
|
|
1383
|
+
const wiring = picker.copyQuestionOptions();
|
|
1384
|
+
assert.deepEqual(wiring.items, ['YES COPY', 'NO COPY'], 'the visible item order is unchanged');
|
|
1385
|
+
assert.equal(wiring.initialSelected, 'NO COPY', 'the safe answer is the one passed as initialSelected');
|
|
1386
|
+
const { view } = openCopy();
|
|
1387
|
+
const text = plain(view);
|
|
1388
|
+
assert.match(text, /^\s*❯\s+NO COPY$/m, 'the cursor opens on NO COPY');
|
|
1389
|
+
assert.match(text, /^\s+YES COPY$/m, 'YES COPY is still offered, unfocused, on its own row');
|
|
1390
|
+
});
|
|
1391
|
+
|
|
1392
|
+
test('an Enter inside the grace window does not finish the picker and does not answer', () => {
|
|
1393
|
+
const { view, finished, advance } = openCopy();
|
|
1394
|
+
view.handleInput('\r');
|
|
1395
|
+
view.handleInput('\n');
|
|
1396
|
+
assert.deepEqual(finished, [], 'a buffered/double-tapped Enter answers nothing');
|
|
1397
|
+
advance(399);
|
|
1398
|
+
view.handleInput('\r');
|
|
1399
|
+
assert.deepEqual(finished, [], 'still inside the window: the panel survives the stray Enter');
|
|
1400
|
+
assert.match(plain(view), /NO COPY/, 'the question is still on screen and unanswered');
|
|
1401
|
+
assert.equal(view.state.cursor, 1, 'the dropped input moved nothing either');
|
|
1402
|
+
});
|
|
1403
|
+
|
|
1404
|
+
test('an Enter after the window confirms the focused row', () => {
|
|
1405
|
+
const { view, finished, advance } = openCopy();
|
|
1406
|
+
view.handleInput('\r');
|
|
1407
|
+
advance(400);
|
|
1408
|
+
view.handleInput('\r');
|
|
1409
|
+
assert.deepEqual(finished, ['NO COPY'], 'only the keypress made after the window answers');
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
test('with the copy question’s wiring the first Enter cannot produce YES COPY', () => {
|
|
1413
|
+
const { view, finished } = openCopy();
|
|
1414
|
+
view.handleInput('\r');
|
|
1415
|
+
assert.ok(!finished.includes('YES COPY'), 'the stray Enter never answers the destructive choice');
|
|
1416
|
+
assert.deepEqual(finished, [], 'the panel answers nothing at all inside the window');
|
|
1417
|
+
});
|
|
1418
|
+
|
|
1419
|
+
test('YES COPY is still reachable deliberately (navigate, then confirm)', () => {
|
|
1420
|
+
const { view, finished, advance } = openCopy();
|
|
1421
|
+
advance(400);
|
|
1422
|
+
view.handleInput('\x1b[A');
|
|
1423
|
+
assert.match(plain(view), /^\s*❯\s+YES COPY$/m, 'an arrow after the window moves the cursor');
|
|
1424
|
+
view.handleInput('\r');
|
|
1425
|
+
assert.deepEqual(finished, ['YES COPY'], 'the deliberate answer is the chosen row');
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
test('Esc still cancels after the window, and is dropped inside it', () => {
|
|
1429
|
+
const inside = openCopy();
|
|
1430
|
+
inside.view.handleInput('\x1b');
|
|
1431
|
+
assert.deepEqual(inside.finished, [], 'a stray Esc inside the window does not kill the question');
|
|
1432
|
+
inside.advance(400);
|
|
1433
|
+
inside.view.handleInput('\x1b');
|
|
1434
|
+
assert.deepEqual(inside.finished, [null], 'Esc after the window cancels');
|
|
1435
|
+
});
|
|
1436
|
+
|
|
1437
|
+
test('without inputGraceMs every other picker keeps its immediate Enter', () => {
|
|
1438
|
+
const finished = [];
|
|
1439
|
+
const view = picker.createSingleSelect({
|
|
1440
|
+
title: 'Type',
|
|
1441
|
+
items: ['feat', 'fix'],
|
|
1442
|
+
helpers: null,
|
|
1443
|
+
hostTui: null,
|
|
1444
|
+
theme: null,
|
|
1445
|
+
done: (out) => { finished.push(out); },
|
|
1446
|
+
});
|
|
1447
|
+
view.handleInput('\r');
|
|
1448
|
+
assert.deepEqual(finished, ['feat'], 'the default (no grace window) confirms on the first Enter');
|
|
1449
|
+
const zeroed = openCopy({ inputGraceMs: 0 });
|
|
1450
|
+
zeroed.view.handleInput('\r');
|
|
1451
|
+
assert.deepEqual(zeroed.finished, ['NO COPY'], 'an explicit 0 is the same: no grace window');
|
|
1452
|
+
});
|
|
1453
|
+
});
|
|
@@ -74,7 +74,7 @@ const TARGET = { name: 'feat-del', path: '/checkouts/feat-del', branch: 'feat/de
|
|
|
74
74
|
const BASE_BODY = `Delete worktree checkout at ${TARGET.path} for branch '${TARGET.branch}'? This removes the checkout but keeps the branch.`;
|
|
75
75
|
|
|
76
76
|
describe('S4: the keyboard delete dialog is always asked and always honest', () => {
|
|
77
|
-
test('the title names the worktree and a clean, zero-ahead checkout adds no warning', async () => {
|
|
77
|
+
test('the title states the confirmation and names the worktree, and a clean, zero-ahead checkout adds no warning', async () => {
|
|
78
78
|
const repo = makeRepo('clean');
|
|
79
79
|
git(repo, ['branch', 'main', 'HEAD']);
|
|
80
80
|
const evidence = await confirmLib.readWarpDeleteEvidence(repo);
|
|
@@ -82,7 +82,7 @@ describe('S4: the keyboard delete dialog is always asked and always honest', ()
|
|
|
82
82
|
assert.equal(evidence.aheadMain.status, 'none');
|
|
83
83
|
assert.equal(evidence.aheadMain.ahead, 0);
|
|
84
84
|
const prompt = confirmLib.warpDeletePrompt(TARGET, evidence);
|
|
85
|
-
assert.equal(prompt.title, "
|
|
85
|
+
assert.equal(prompt.title, "Confirm delete: worktree 'feat-del'");
|
|
86
86
|
assert.equal(prompt.body, BASE_BODY);
|
|
87
87
|
assert.equal(prompt.force, false, 'a clean checkout is never forced');
|
|
88
88
|
});
|
|
@@ -407,11 +407,13 @@ describe('A1: the confirmation is bound to the pending CONTENT, not to a line co
|
|
|
407
407
|
});
|
|
408
408
|
});
|
|
409
409
|
|
|
410
|
-
// A2 (verification): a checkout can read CLEAN while git ignores files
|
|
411
|
-
// only exist inside it, and removing the checkout deletes them.
|
|
412
|
-
//
|
|
413
|
-
//
|
|
414
|
-
|
|
410
|
+
// A2 (verification, amended): a checkout can read CLEAN while git ignores files
|
|
411
|
+
// that only exist inside it, and removing the checkout deletes them. The human
|
|
412
|
+
// asked that the question stop naming them — untracked, ignored files are noise
|
|
413
|
+
// there — so they are NO LONGER disclosed, while their path list stays part of
|
|
414
|
+
// the reading: a file that appears during the dialog still changes the key and
|
|
415
|
+
// still refuses the deletion.
|
|
416
|
+
describe('A2: ignored files stay read as a safety net, and are never disclosed', () => {
|
|
415
417
|
function withIgnored(tag) {
|
|
416
418
|
const repo = makeRepo(tag);
|
|
417
419
|
git(repo, ['branch', 'main', 'HEAD']);
|
|
@@ -424,7 +426,7 @@ describe('A2: ignored files are disclosed, never silently deleted', () => {
|
|
|
424
426
|
return repo;
|
|
425
427
|
}
|
|
426
428
|
|
|
427
|
-
test('a checkout that reads clean but holds ignored files discloses them', async () => {
|
|
429
|
+
test('a checkout that reads clean but holds ignored files discloses none of them', async () => {
|
|
428
430
|
const repo = withIgnored('ignored-present');
|
|
429
431
|
const evidence = await confirmLib.readWarpDeleteEvidence(repo);
|
|
430
432
|
assert.equal(evidence.changes.status, 'clean', 'nothing git tracks is pending');
|
|
@@ -432,7 +434,16 @@ describe('A2: ignored files are disclosed, never silently deleted', () => {
|
|
|
432
434
|
assert.equal(evidence.ignored.files, 2);
|
|
433
435
|
assert.deepEqual(evidence.ignored.samples, ['build/out.txt', 'debug.log']);
|
|
434
436
|
const prompt = confirmLib.warpDeletePrompt(TARGET, evidence);
|
|
435
|
-
|
|
437
|
+
// A2 amended: the body is the clean dialog plus the one ahead fact this
|
|
438
|
+
// fixture really carries — no clause, no listing — so the ignored files are
|
|
439
|
+
// provably ABSENT from what the human reads, while the evidence above proves
|
|
440
|
+
// they are still read and still fingerprinted.
|
|
441
|
+
assert.equal(
|
|
442
|
+
prompt.body,
|
|
443
|
+
`${BASE_BODY} Commits ahead of main: ${evidence.aheadMain.ahead}.`,
|
|
444
|
+
'the ignored files are never named in the question',
|
|
445
|
+
);
|
|
446
|
+
assert.doesNotMatch(prompt.body, /Ignored files/i, 'no ignored-files clause is rendered');
|
|
436
447
|
assert.equal(prompt.force, false, 'ignored files do not force: git needs no --force for them');
|
|
437
448
|
});
|
|
438
449
|
|
|
@@ -479,9 +490,7 @@ describe('S7/S8: Ctrl+D checks live sessions before the deletion question', () =
|
|
|
479
490
|
const crypto = require('node:crypto');
|
|
480
491
|
const { loadExtension } = require('./fixtures/load-extension.js');
|
|
481
492
|
|
|
482
|
-
const NO_HERDR = path.join(os.tmpdir(), 'odd-worktree-no-such-herdr-binary');
|
|
483
493
|
const HOOK_BIN = track(fs.mkdtempSync(path.join(os.tmpdir(), 'wt-confirm-hookbin-')));
|
|
484
|
-
fs.writeFileSync(path.join(HOOK_BIN, 'codegraph'), '#!/bin/sh\nexit 0\n', { mode: 0o755 });
|
|
485
494
|
const AGENT_HOME = track(fs.mkdtempSync(path.join(os.tmpdir(), 'wt-confirm-agent-home-')));
|
|
486
495
|
const PRESENCE = path.join(AGENT_HOME, 'gentle-agents', 'presence');
|
|
487
496
|
|
|
@@ -491,7 +500,6 @@ describe('S7/S8: Ctrl+D checks live sessions before the deletion question', () =
|
|
|
491
500
|
let restorePath = null;
|
|
492
501
|
|
|
493
502
|
before(async () => {
|
|
494
|
-
process.env.HERDR_BIN_PATH = NO_HERDR;
|
|
495
503
|
delete process.env.GENTLE_PI_AGENT_HOME;
|
|
496
504
|
process.env.PI_CODING_AGENT_DIR = AGENT_HOME;
|
|
497
505
|
restorePath = process.env.PATH;
|
|
@@ -537,7 +545,7 @@ describe('S7/S8: Ctrl+D checks live sessions before the deletion question', () =
|
|
|
537
545
|
const repo = makeRepo(`ctrl-d-${tag}`);
|
|
538
546
|
git(repo, ['branch', 'main', 'HEAD']);
|
|
539
547
|
const created = await tools.get('worktree_create').execute(
|
|
540
|
-
`create-${tag}`, { branch: `feat/${tag}`,
|
|
548
|
+
`create-${tag}`, { branch: `feat/${tag}`, odd: tag }, undefined, undefined,
|
|
541
549
|
{
|
|
542
550
|
cwd: repo,
|
|
543
551
|
hasUI: false,
|
|
@@ -547,7 +555,8 @@ describe('S7/S8: Ctrl+D checks live sessions before the deletion question', () =
|
|
|
547
555
|
},
|
|
548
556
|
);
|
|
549
557
|
assert.notEqual(created.isError, true, JSON.stringify(created));
|
|
550
|
-
|
|
558
|
+
// The path the create really wrote, not a remembered flattened spelling.
|
|
559
|
+
const target = created.details.path;
|
|
551
560
|
const notifications = [];
|
|
552
561
|
const confirmations = [];
|
|
553
562
|
let mounts = 0;
|
|
@@ -587,7 +596,7 @@ describe('S7/S8: Ctrl+D checks live sessions before the deletion question', () =
|
|
|
587
596
|
const { repo, target, notifications, confirmations, ctx } = await panelFixture('clear');
|
|
588
597
|
await commands.get('warp').handler('', ctx);
|
|
589
598
|
assert.equal(confirmations.length, 1, 'exactly one deletion question');
|
|
590
|
-
assert.match(confirmations[0].title, /^
|
|
599
|
+
assert.match(confirmations[0].title, /^Confirm delete: worktree '/);
|
|
591
600
|
assert.match(confirmations[0].body, /Delete worktree checkout at /);
|
|
592
601
|
assert.match(confirmations[0].body, /keeps the branch/);
|
|
593
602
|
assert.equal(fs.existsSync(target), false, 'the approved checkout is removed');
|
|
@@ -599,6 +608,31 @@ describe('S7/S8: Ctrl+D checks live sessions before the deletion question', () =
|
|
|
599
608
|
);
|
|
600
609
|
});
|
|
601
610
|
|
|
611
|
+
// Invariant 4 (docs/codebase/invariants.md): the guard's caveats are
|
|
612
|
+
// disclosed, never silently dropped. The panel's ctrl+d is the only surface
|
|
613
|
+
// that removes a checkout now, so a stale presence record must reach the human
|
|
614
|
+
// from HERE — the delete tool whose formatter used to print it is unregistered
|
|
615
|
+
// (T6/S4).
|
|
616
|
+
test('a stale presence record\u2019s caveat reaches the human on the panel delete', async () => {
|
|
617
|
+
const { target, notifications, confirmations, ctx } = await panelFixture('stale-caveat');
|
|
618
|
+
publishSession({
|
|
619
|
+
sessionId: 'crashed-panel-worker', label: 'Crashed', workspace: target,
|
|
620
|
+
heartbeat: Date.now() - 10 * 60 * 1000, incarnationIndex: 8,
|
|
621
|
+
});
|
|
622
|
+
await commands.get('warp').handler('', ctx);
|
|
623
|
+
|
|
624
|
+
assert.equal(confirmations.length, 1, 'the stale record never blocks the question');
|
|
625
|
+
assert.equal(fs.existsSync(target), false, 'the removal still happens');
|
|
626
|
+
assert.ok(
|
|
627
|
+
notifications.some(([level, text]) => level === 'info' && /worktree deleted/.test(String(text))),
|
|
628
|
+
JSON.stringify(notifications),
|
|
629
|
+
);
|
|
630
|
+
const caveat = notifications.find(([, text]) => /stale Gentle Shell presence record ignored/.test(String(text)));
|
|
631
|
+
assert.ok(caveat, `the stale record is disclosed: ${JSON.stringify(notifications)}`);
|
|
632
|
+
assert.match(caveat[1], /best effort/);
|
|
633
|
+
assert.equal(caveat[0], 'warning', 'the caveat is a warning, not a silent info line');
|
|
634
|
+
});
|
|
635
|
+
|
|
602
636
|
test('a session that appears while the question is open refuses the removal after approval', async () => {
|
|
603
637
|
const { target, notifications, confirmations, ctx } = await panelFixture('late', {
|
|
604
638
|
confirm: ({ target: doomed }) => {
|
|
@@ -61,7 +61,6 @@ before(async () => {
|
|
|
61
61
|
const copy = path.join(dir, 'odd-worktree-tools.mjs');
|
|
62
62
|
fs.writeFileSync(copy, stubbedSource());
|
|
63
63
|
process.env.GENTLE_WORKTREE_LIB_DIR = LIB_DIR;
|
|
64
|
-
process.env.HERDR_BIN_PATH = path.join(dir, 'no-such-herdr-binary');
|
|
65
64
|
process.env.GENTLE_WORKTREE_THREAD = 'thread-1';
|
|
66
65
|
mod = await import(pathToFileURL(copy).href);
|
|
67
66
|
mod.default({
|