pi-odd-worktree 2.1.0 → 3.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 +54 -319
- package/extensions/odd-worktree-tools.ts +4145 -2529
- package/lib/bash-activity.js +1164 -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 +1416 -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 +308 -14
- 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 +1419 -0
- package/tools/bash-design.test.js +1091 -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 +610 -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 +1871 -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 +391 -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 +1512 -66
- package/tools/issues-open-guard.test.js +1096 -0
- package/tools/issues-section.test.js +4195 -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
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
// T2/T3 + T4 (warp S2,S3,S4,S5,S6,S9,S12,S16; worktree-ui-feedback S4,S12,S15)
|
|
3
3
|
// tests: lib/warp-selector-view.js — the warp surface as ONE component with
|
|
4
4
|
// two views: the S4 bottom panel
|
|
5
|
-
// (title, the current worktree's
|
|
6
|
-
// worktree
|
|
7
|
-
//
|
|
5
|
+
// (`Warp · n worktrees` title (S16), the current worktree's detail line, the
|
|
6
|
+
// focused worktree's detail line, a SCROLLABLE window of up to seven
|
|
7
|
+
// worktree rows with `↑ n more` / `↓ n more` lines outside the selection space
|
|
8
|
+
// (S15/L19), and the one-row key legend) and the extended list (always-active
|
|
8
9
|
// filter row, pagination, `esc` back one level).
|
|
9
10
|
//
|
|
10
11
|
// Contract under test, as observable output only: every line is exactly the
|
|
11
12
|
// requested width; the panel is exactly as tall as its content and never
|
|
12
13
|
// taller than the rows the host offers (S3: a bottom panel that computes its
|
|
13
14
|
// own height, not a box with slack); the S4 order above is pinned; the current
|
|
14
|
-
// worktree owns the header and is never one of the
|
|
15
|
-
// never a DESTINATION either:
|
|
15
|
+
// worktree owns the header and is never one of the rows (S4b), and it is
|
|
16
|
+
// never a DESTINATION either: the extended list holds every other checkout
|
|
16
17
|
// and never the one the session already stands in; the
|
|
17
18
|
// principal leads when it is not current, then the rows follow the most
|
|
18
|
-
// recent activity; `view all worktrees`
|
|
19
|
-
//
|
|
20
|
-
//
|
|
19
|
+
// recent activity; S20: there is NO `view all worktrees` row — the extended
|
|
20
|
+
// list is the `a` key, and the `a` token appears only when a checkout stands
|
|
21
|
+
// outside `<repo-name>-worktrees/`; the legend is exactly ONE row (S2); S5
|
|
22
|
+
// rows are the checkout NAMES
|
|
21
23
|
// alone (the branch lives in a data line, never repeated on the row); a data
|
|
22
24
|
// line carries branch, the change size as LINE COUNTS (S16: bare `+A −D`,
|
|
23
25
|
// because the sign already says what the number is — the label survives only
|
|
@@ -32,15 +34,23 @@
|
|
|
32
34
|
// checkout, in both views, and both legends advertise it (the extension owns
|
|
33
35
|
// the confirmation and every refusal); the facts are read for the current and the
|
|
34
36
|
// focused checkout, at most once each, and render() performs no I/O; `c`
|
|
35
|
-
// opens the create flow instead of owning a list row (S6) while `
|
|
36
|
-
// `enter`, `r` and `esc` keep their
|
|
37
|
+
// opens the create flow instead of owning a list row (S6) while `a` (S14:
|
|
38
|
+
// the extended list's key, never `v`), `enter`, `r` and `esc` keep their
|
|
39
|
+
// meanings; `esc` steps back one level from
|
|
37
40
|
// the list; while the search is active `delete` clears the whole query and
|
|
38
41
|
// `backspace` edits one character (S4/S12); no key outside the documented map
|
|
39
42
|
// changes state.
|
|
40
43
|
//
|
|
41
|
-
// The panel frame is pinned: 7 fixed rows
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
+
// The panel frame is pinned (S19, revised in L17): 7 fixed rows — top rule,
|
|
45
|
+
// the CURRENT checkout's detail line, the FOCUSED checkout's detail line, one
|
|
46
|
+
// blank row, ... the list ..., one more blank row, the legend, the bottom
|
|
47
|
+
// rule — plus up to seven worktree rows and the `↑ n more` / `↓ n more`
|
|
48
|
+
// lines, which are text outside the selection space: the cursor never lands
|
|
49
|
+
// on them and one is drawn only while it has a count to carry. The name line
|
|
50
|
+
// is gone: the top block is the two DETAIL lines alone, and the blank row that
|
|
51
|
+
// separates it from the list stays while a second blank row now separates the
|
|
52
|
+
// list from the keybindings. S20: no `view all worktrees` row exists.
|
|
53
|
+
// The list frame is
|
|
44
54
|
// pinned: 5 fixed rows (top rule, filter, page row, footer, bottom rule) plus
|
|
45
55
|
// a page.
|
|
46
56
|
|
|
@@ -50,7 +60,7 @@ const fs = require('node:fs');
|
|
|
50
60
|
const os = require('node:os');
|
|
51
61
|
const path = require('node:path');
|
|
52
62
|
|
|
53
|
-
const { createWarpSelectorView, formatFactsLine } = require('../lib/warp-selector-view.js');
|
|
63
|
+
const { createWarpSelectorView, formatFactsLine, LIST_BLOCK_LINES } = require('../lib/warp-selector-view.js');
|
|
54
64
|
|
|
55
65
|
function strip(value) {
|
|
56
66
|
return String(value).replace(/\x1b\[[0-9;]*m/g, '');
|
|
@@ -105,12 +115,12 @@ const HEIGHT = 20;
|
|
|
105
115
|
const NOW = Date.parse('2026-03-01T00:00:00.000Z');
|
|
106
116
|
const ago = (ms) => new Date(NOW - ms).toISOString();
|
|
107
117
|
|
|
108
|
-
const CURRENT = { name: 'feat-odd-viewer', path: '/w/feat-odd-viewer', branch: 'feat/odd-viewer' };
|
|
118
|
+
const CURRENT = { name: 'feat-odd-viewer', path: '/w/herdr-worktrees/feat-odd-viewer', branch: 'feat/odd-viewer' };
|
|
109
119
|
const CHECKOUTS = [
|
|
110
120
|
CURRENT,
|
|
111
121
|
{ name: 'main', path: '/w/herdr', branch: 'main', isPrincipal: true },
|
|
112
|
-
{ name: 'feat-alpha', path: '/w/feat-alpha', branch: 'feat/alpha' },
|
|
113
|
-
{ name: 'fix-beta', path: '/w/fix-beta', branch: 'fix/beta' },
|
|
122
|
+
{ name: 'feat-alpha', path: '/w/herdr-worktrees/feat-alpha', branch: 'feat/alpha' },
|
|
123
|
+
{ name: 'fix-beta', path: '/w/herdr-worktrees/fix-beta', branch: 'fix/beta' },
|
|
114
124
|
];
|
|
115
125
|
|
|
116
126
|
const DEFAULT_FACTS = { branch: 'feat/alpha', changes: { added: 2, deleted: 1 }, ahead: 1, behind: 0, createdAt: '2026-02-01' };
|
|
@@ -176,25 +186,33 @@ function screen(view, width = WIDTH) {
|
|
|
176
186
|
return { lines, rows };
|
|
177
187
|
}
|
|
178
188
|
|
|
179
|
-
// S4: the panel is pinned, so every region is reachable by position —
|
|
180
|
-
// layout regression then fails ONE named assertion instead of thirty magic
|
|
181
|
-
// indices. The
|
|
182
|
-
//
|
|
189
|
+
// S4/S15/S19: the panel is pinned, so every region is reachable by position —
|
|
190
|
+
// a layout regression then fails ONE named assertion instead of thirty magic
|
|
191
|
+
// indices. The top block is the two detail lines (S19), then the blank row,
|
|
192
|
+
// then the list area, then the second blank row and the three trailing rows
|
|
193
|
+
// (legend, bottom rule). Inside the list area, `↑ n more` / `↓ n more`
|
|
194
|
+
// announce the rows the window hides and are never rows of the list.
|
|
195
|
+
const MORE_ROW = /^\s*([↑↓]) (\d+) more$/;
|
|
196
|
+
|
|
183
197
|
function panel(view, width = WIDTH) {
|
|
184
198
|
const { lines, rows } = screen(view, width);
|
|
185
199
|
const list = rows.slice(4, rows.length - 3);
|
|
200
|
+
const isMore = (text) => MORE_ROW.test(text);
|
|
186
201
|
return {
|
|
187
202
|
lines,
|
|
188
203
|
rows,
|
|
189
204
|
height: lines.length,
|
|
190
205
|
title: lines[0],
|
|
191
|
-
|
|
192
|
-
currentData: rows[
|
|
193
|
-
|
|
206
|
+
header: [rows[1], rows[2]],
|
|
207
|
+
currentData: rows[1],
|
|
208
|
+
focusData: rows[2],
|
|
209
|
+
gapAbove: rows[3],
|
|
210
|
+
gapBelow: rows[rows.length - 3],
|
|
194
211
|
list,
|
|
195
|
-
|
|
212
|
+
upMore: list.find((text) => (MORE_ROW.exec(text) || [])[1] === '↑') || null,
|
|
213
|
+
downMore: list.find((text) => (MORE_ROW.exec(text) || [])[1] === '↓') || null,
|
|
214
|
+
worktrees: list.filter((text) => !isMore(text) && !/view all worktrees/.test(text)),
|
|
196
215
|
viewAll: list.find((text) => /view all worktrees/.test(text)) || null,
|
|
197
|
-
focusData: rows[rows.length - 3],
|
|
198
216
|
legend: rows[rows.length - 2],
|
|
199
217
|
bottom: lines[lines.length - 1],
|
|
200
218
|
};
|
|
@@ -206,23 +224,23 @@ function assertWidth(lines, width = WIDTH) {
|
|
|
206
224
|
}
|
|
207
225
|
}
|
|
208
226
|
|
|
209
|
-
describe('bottom panel layout (S3, S4)', () => {
|
|
210
|
-
test('renders the S4 order from top to bottom at a content-fitting height', async () => {
|
|
227
|
+
describe('bottom panel layout (S3, S4, S19)', () => {
|
|
228
|
+
test('renders the S4/S19 order from top to bottom at a content-fitting height', async () => {
|
|
211
229
|
const { view } = await opened();
|
|
212
230
|
const view80 = panel(view);
|
|
213
|
-
assert.equal(view80.height, 10, 'top +
|
|
231
|
+
assert.equal(view80.height, 10, 'top + two detail lines + blank + 3 rows + blank + legend + bottom');
|
|
214
232
|
|
|
215
233
|
const { lines, rows } = screen(view, WIDE);
|
|
216
234
|
assertWidth(lines, WIDE);
|
|
217
|
-
assert.match(lines[0], /^╭─ Warp ─+ esc ─╮$/, 'line 1 is the title line');
|
|
218
|
-
assert.equal(rows[1],
|
|
219
|
-
assert.equal(rows[2], DEFAULT_LINE, 'line 3 is
|
|
220
|
-
assert.equal(rows[3], '', '
|
|
235
|
+
assert.match(lines[0], /^╭─ Warp · 3 worktrees ─+ esc ─╮$/, 'line 1 is the title line, counting every checkout the list holds');
|
|
236
|
+
assert.equal(rows[1], DEFAULT_LINE, 'line 2 is the current checkout\'s detail, and no name line sits above it');
|
|
237
|
+
assert.equal(rows[2], DEFAULT_LINE, 'line 3 is the focused checkout\'s detail, moved up (S19)');
|
|
238
|
+
assert.equal(rows[3], '', 'the blank row between the detail lines and the list STAYS (S19, revised)');
|
|
221
239
|
assert.equal(rows[4], '▸ main · use the local project', 'the list starts on line 5, focused first');
|
|
222
240
|
assert.equal(rows[5], ' feat-alpha');
|
|
223
241
|
assert.equal(rows[6], ' fix-beta');
|
|
224
|
-
assert.equal(rows[7],
|
|
225
|
-
assert.equal(rows[8], '↑↓ move · enter choose · c create · ctrl+d delete · r reload · esc close', 'one legend row, with no `
|
|
242
|
+
assert.equal(rows[7], '', 'a second blank row separates the list from the keybindings (S19)');
|
|
243
|
+
assert.equal(rows[8], '↑↓ move · enter choose · c create · ctrl+d delete · r reload · esc close', 'one legend row, with no `a all` while nothing is hidden, the delete key, and no retired edit key');
|
|
226
244
|
assert.match(lines[9], /^╰─+╯$/, 'the frame is closed');
|
|
227
245
|
assert.equal(lines.length, 10, 'the frame fills its computed height exactly');
|
|
228
246
|
});
|
|
@@ -237,55 +255,69 @@ describe('bottom panel layout (S3, S4)', () => {
|
|
|
237
255
|
assertWidth(frame.lines, width);
|
|
238
256
|
assert.match(frame.title, /^╭─ Warp /, `rows ${rows}/${width}: the title line survives`);
|
|
239
257
|
assert.match(frame.bottom, /^╰─+╯$/, `rows ${rows}/${width}: the frame stays closed`);
|
|
240
|
-
assert.equal(frame.
|
|
258
|
+
assert.equal(frame.gapAbove, '', `rows ${rows}/${width}: the blank row above the list never moves`);
|
|
259
|
+
assert.equal(frame.gapBelow, '', `rows ${rows}/${width}: the blank row below the list never moves`);
|
|
241
260
|
}
|
|
242
261
|
}
|
|
243
262
|
});
|
|
244
263
|
|
|
245
|
-
test('
|
|
246
|
-
const
|
|
247
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
248
|
-
...Array.from({ length:
|
|
264
|
+
test('the list block spends its seven lines on rows and hidden counts (S15, L20)', async () => {
|
|
265
|
+
const base = [
|
|
266
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
267
|
+
...Array.from({ length: 9 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
249
268
|
];
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
assert.equal(
|
|
255
|
-
assert.equal(
|
|
256
|
-
|
|
257
|
-
assert.
|
|
258
|
-
assert.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
269
|
+
const open = (checkouts) => opened({ checkouts, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, rows: HEIGHT });
|
|
270
|
+
assert.equal(LIST_BLOCK_LINES, 7, 'S15 (L20): the block is seven lines');
|
|
271
|
+
|
|
272
|
+
const seven = panel((await open(base.slice(0, 8))).view);
|
|
273
|
+
assert.equal(seven.worktrees.length, 7, 'nothing is hidden, so the block holds seven checkout rows');
|
|
274
|
+
assert.equal(seven.upMore, null);
|
|
275
|
+
assert.equal(seven.downMore, null);
|
|
276
|
+
assert.equal(seven.height, 7 + 7, 'and the block is seven lines tall');
|
|
277
|
+
assert.equal(seven.viewAll, null, 'S20: there is no `view all worktrees` row to select');
|
|
278
|
+
|
|
279
|
+
const eight = panel((await open(base)).view);
|
|
280
|
+
assert.equal(eight.worktrees.length, 6, 'one hidden-count line leaves six checkout rows');
|
|
281
|
+
assert.equal(eight.downMore, '↓ 3 more', 'S15: the hidden rows are announced below the window');
|
|
282
|
+
assert.equal(eight.upMore, null, 'nothing is hidden above the first row');
|
|
283
|
+
assert.equal(eight.height, 7 + 6 + 1, 'the block is still seven lines tall');
|
|
284
|
+
assert.equal(eight.height, eight.lines.length, 'the frame fills that height exactly');
|
|
285
|
+
const body = eight.rows.join('\n');
|
|
286
|
+
assert.ok(!body.includes('wt-8'), 'the eighth worktree is beyond the visible window');
|
|
287
|
+
assert.ok(!body.includes('wt-9'));
|
|
288
|
+
assert.equal(eight.focusData, DEFAULT_LINE, 'the focused row keeps its detail line, now above the list');
|
|
289
|
+
|
|
290
|
+
const scrolled = await open(base);
|
|
291
|
+
for (let i = 0; i < 6; i += 1) scrolled.view.handleInput('down');
|
|
292
|
+
const both = panel(scrolled.view);
|
|
293
|
+
assert.equal(both.worktrees.length, 5, 'both hidden-count lines leave five checkout rows');
|
|
294
|
+
assert.equal(both.upMore, '↑ 2 more');
|
|
295
|
+
assert.equal(both.downMore, '↓ 2 more');
|
|
296
|
+
assert.equal(both.height, 7 + 5 + 2, 'the block never grows past seven lines');
|
|
297
|
+
assert.equal(both.worktrees[4], '▸ wt-7', 'the selection is inside the window');
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
test('the panel never draws a `view all worktrees` row', async () => {
|
|
301
|
+
const many = [
|
|
302
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
303
|
+
...Array.from({ length: 11 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
266
304
|
];
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
const six = [...five, { name: 'wt-6', path: '/w/wt-6', branch: 'feat/wt-6' }];
|
|
274
|
-
const hidden = panel((await opened({ checkouts: six, current: { name: 'cur', path: '/w/cur' } })).view);
|
|
275
|
-
assert.equal(hidden.worktrees.length, 5, 'the sixth row is what makes the offer appear');
|
|
276
|
-
assert.equal(hidden.viewAll, ' view all worktrees');
|
|
277
|
-
assert.equal(hidden.height, 7 + 5 + 1);
|
|
278
|
-
|
|
279
|
-
const few = panel((await opened({ checkouts: CHECKOUTS, current: { name: CURRENT.name, path: CURRENT.path } })).view);
|
|
280
|
-
assert.equal(few.viewAll, null, 'three other worktrees need no offer row');
|
|
305
|
+
for (const rows of [8, 12, 20, 40]) {
|
|
306
|
+
const frame = panel((await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, rows })).view);
|
|
307
|
+
assert.ok(!frame.rows.join('\n').includes('view all worktrees'), `rows ${rows}: the extended list is a key, never a row`);
|
|
308
|
+
assert.equal(frame.viewAll, null);
|
|
309
|
+
}
|
|
281
310
|
});
|
|
282
311
|
|
|
283
|
-
test('the
|
|
284
|
-
const {
|
|
312
|
+
test('S19: the top block is the two detail lines only — no name line, and the current is never a row', async () => {
|
|
313
|
+
const facts = (item) => ({ branch: item === CURRENT.path ? 'main' : 'feat/alpha', changes: { added: 233, deleted: 0 }, ahead: 0, behind: 0, createdAt: '2026-02-20' });
|
|
314
|
+
const { view } = await opened({ facts });
|
|
285
315
|
const frame = panel(view, WIDE);
|
|
286
|
-
assert.equal(frame.
|
|
287
|
-
assert.
|
|
288
|
-
assert.
|
|
316
|
+
assert.equal(frame.currentData, 'branch main · +233 · created 9d ago · modified —', 'line 2 is the principal checkout\'s own detail');
|
|
317
|
+
assert.equal(frame.focusData, 'branch feat/alpha · +233 · created 9d ago · modified —', 'line 3 is the focused checkout\'s detail');
|
|
318
|
+
assert.ok(!frame.header.includes('feat-odd-viewer'), `no name line survives above the detail lines: ${JSON.stringify(frame.header)}`);
|
|
319
|
+
assert.equal(frame.lines.filter((line) => line === 'feat-odd-viewer').length, 0, 'the checkout name is not a line of its own any more');
|
|
320
|
+
assert.ok(!frame.worktrees.some((row) => row.includes('feat-odd-viewer')), 'S4b: the current is not a row either');
|
|
289
321
|
});
|
|
290
322
|
|
|
291
323
|
test('an empty list names its state and keeps creation on the hotkey', async () => {
|
|
@@ -310,6 +342,235 @@ describe('bottom panel layout (S3, S4)', () => {
|
|
|
310
342
|
});
|
|
311
343
|
});
|
|
312
344
|
|
|
345
|
+
describe('S14: the extended list key is `a`', () => {
|
|
346
|
+
test('`a` opens the extended list and `v` is no longer a binding', async () => {
|
|
347
|
+
const byKey = await opened();
|
|
348
|
+
byKey.view.handleInput('a');
|
|
349
|
+
assert.equal(byKey.view.state.view, 'list', 'a opens the extended list');
|
|
350
|
+
assert.deepEqual(byKey.results, [], 'and never resolves the component');
|
|
351
|
+
|
|
352
|
+
const old = await opened();
|
|
353
|
+
old.view.handleInput('v');
|
|
354
|
+
assert.equal(old.view.state.view, 'popup', 'v moved nothing: the key is a, not v');
|
|
355
|
+
assert.deepEqual(old.results, []);
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
test('the hint bar names `a` and is drawn only when a checkout stands outside the listing', async () => {
|
|
359
|
+
const outside = [
|
|
360
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
361
|
+
{ name: 'wt-1', path: '/w/herdr-worktrees/wt-1', branch: 'feat/wt-1' },
|
|
362
|
+
{ name: 'elsewhere', path: '/somewhere/else', branch: 'feat/elsewhere' },
|
|
363
|
+
];
|
|
364
|
+
const withOutside = panel((await opened({ checkouts: outside, current: { name: 'cur', path: '/w/herdr-worktrees/cur' } })).view, WIDE);
|
|
365
|
+
assert.equal(withOutside.legend, '↑↓ move · enter choose · c create · ctrl+d delete · a all · r reload · esc close', 'the hint names `a all` and every other token is untouched');
|
|
366
|
+
assert.equal(withOutside.viewAll, null, 'S20: there is no `view all worktrees` row');
|
|
367
|
+
assert.ok(!withOutside.rows.join('\n').includes('view all worktrees'), 'and the row never comes back');
|
|
368
|
+
|
|
369
|
+
const listed = [
|
|
370
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
371
|
+
{ name: 'wt-1', path: '/w/herdr-worktrees/wt-1', branch: 'feat/wt-1' },
|
|
372
|
+
];
|
|
373
|
+
const insideOnly = panel((await opened({ checkouts: listed, current: { name: 'cur', path: '/w/herdr-worktrees/cur' } })).view, WIDE);
|
|
374
|
+
assert.equal(insideOnly.legend, '↑↓ move · enter choose · c create · ctrl+d delete · r reload · esc close', 'S20: with nothing outside the listing there is no `a all` token');
|
|
375
|
+
assert.ok(!insideOnly.legend.includes('a all'));
|
|
376
|
+
assert.ok(!insideOnly.lines.join('\n').includes('v all'), 'the retired key appears nowhere in the frame');
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
describe('S15: the panel scrolls a window of seven checkouts', () => {
|
|
381
|
+
const many = [
|
|
382
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
383
|
+
...Array.from({ length: 11 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
384
|
+
];
|
|
385
|
+
|
|
386
|
+
async function after(keys, options = {}) {
|
|
387
|
+
const made = await opened({
|
|
388
|
+
checkouts: many,
|
|
389
|
+
current: { name: 'cur', path: '/w/herdr-worktrees/cur' },
|
|
390
|
+
facts: () => null,
|
|
391
|
+
...options,
|
|
392
|
+
});
|
|
393
|
+
for (const key of keys) made.view.handleInput(key);
|
|
394
|
+
return { made, frame: panel(made.view, WIDE) };
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
test('shows six rows and a down arrow carrying the hidden count at the top', async () => {
|
|
398
|
+
const { made, frame } = await after([]);
|
|
399
|
+
assert.deepEqual(
|
|
400
|
+
frame.worktrees,
|
|
401
|
+
['▸ wt-1', ' wt-2', ' wt-3', ' wt-4', ' wt-5', ' wt-6'],
|
|
402
|
+
'S15 (L20): one hidden-count line leaves six rows',
|
|
403
|
+
);
|
|
404
|
+
assert.equal(made.view.state.cursor, 0);
|
|
405
|
+
assert.equal(frame.upMore, null, 'nothing is hidden above the first row');
|
|
406
|
+
assert.equal(frame.downMore, '↓ 5 more', 'the rows below the window are announced with their count');
|
|
407
|
+
assert.ok(frame.list.indexOf(frame.downMore) > frame.list.indexOf(' wt-6'), 'the down arrow sits BELOW the visible rows');
|
|
408
|
+
assert.ok(!frame.worktrees.includes(frame.downMore), 'the indicator is text, never a row the cursor can land on');
|
|
409
|
+
assert.equal(frame.height, 7 + 6 + 1, 'the block is still seven lines');
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
test('scrolls one row at a time, spends two lines once both counts are needed, and never selects an indicator', async () => {
|
|
413
|
+
const fifth = await after(Array.from({ length: 5 }, () => 'down'));
|
|
414
|
+
assert.equal(fifth.frame.upMore, null, 'five moves stay inside the first window');
|
|
415
|
+
assert.equal(fifth.frame.worktrees[5], '▸ wt-6', 'the selection is the last visible row');
|
|
416
|
+
assert.equal(fifth.frame.downMore, '↓ 5 more');
|
|
417
|
+
|
|
418
|
+
const seventh = await after(Array.from({ length: 6 }, () => 'down'));
|
|
419
|
+
assert.equal(seventh.made.view.state.cursor, 6, 'the cursor moved onto a real checkout, not onto the indicator');
|
|
420
|
+
assert.deepEqual(
|
|
421
|
+
seventh.frame.worktrees,
|
|
422
|
+
[' wt-3', ' wt-4', ' wt-5', ' wt-6', '▸ wt-7'],
|
|
423
|
+
'once both counts are needed the window keeps five rows and scrolls',
|
|
424
|
+
);
|
|
425
|
+
assert.equal(seventh.frame.upMore, '↑ 2 more', 'the hidden rows above are counted');
|
|
426
|
+
assert.equal(seventh.frame.downMore, '↓ 4 more');
|
|
427
|
+
assert.equal(seventh.frame.height, 7 + 5 + 2, 'five rows plus the two lines: seven');
|
|
428
|
+
assert.ok(seventh.frame.list.indexOf(seventh.frame.upMore) < seventh.frame.list.indexOf(' wt-3'), 'the up arrow sits ABOVE the visible rows');
|
|
429
|
+
|
|
430
|
+
const eighth = await after(Array.from({ length: 7 }, () => 'down'));
|
|
431
|
+
assert.equal(eighth.frame.upMore, '↑ 3 more');
|
|
432
|
+
assert.equal(eighth.frame.downMore, '↓ 3 more');
|
|
433
|
+
assert.equal(eighth.frame.worktrees[4], '▸ wt-8', 'the window follows the selection one row at a time');
|
|
434
|
+
|
|
435
|
+
const last = await after(Array.from({ length: 11 }, () => 'down'));
|
|
436
|
+
assert.equal(last.frame.worktrees.at(-1), '▸ wt-11', 'the last checkout is reachable from the panel');
|
|
437
|
+
assert.equal(last.frame.worktrees.length, 6, 'at the bottom only the up line is left, so six rows show');
|
|
438
|
+
assert.equal(last.frame.upMore, '↑ 5 more', 'every hidden row above is counted');
|
|
439
|
+
assert.equal(last.frame.downMore, null, 'nothing is left below the last row, so no line is drawn');
|
|
440
|
+
|
|
441
|
+
const back = await after(Array.from({ length: 11 }, () => 'down').concat(Array.from({ length: 11 }, () => 'up')));
|
|
442
|
+
assert.equal(back.made.view.state.cursor, 0, 'scrolling back up returns to the first row');
|
|
443
|
+
assert.equal(back.frame.upMore, null, 'and the up line disappears');
|
|
444
|
+
assert.equal(back.frame.downMore, '↓ 5 more');
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
test('a short panel never overflows and still keeps the selection visible', async () => {
|
|
448
|
+
for (const rows of [8, 9, 10]) {
|
|
449
|
+
const made = await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null, rows });
|
|
450
|
+
assert.ok(made.view.render(WIDE).length <= rows, `rows ${rows}: the frame never grows past the host's rows`);
|
|
451
|
+
for (let i = 0; i < 7; i += 1) made.view.handleInput('down');
|
|
452
|
+
const frame = panel(made.view, WIDE);
|
|
453
|
+
assert.ok(frame.height <= rows, `rows ${rows}: the scrolled frame fits too`);
|
|
454
|
+
assert.ok(frame.rows.some((text) => /^▸ wt-8$/.test(text)), `rows ${rows}: the selected row stays on screen`);
|
|
455
|
+
assertWidth(frame.lines, WIDE);
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
describe('S16: the heading counts the checkouts the list holds', () => {
|
|
461
|
+
const many = [
|
|
462
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
463
|
+
...Array.from({ length: 8 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
464
|
+
];
|
|
465
|
+
|
|
466
|
+
test('the panel heading counts every checkout its listing holds, not the seven-row window', async () => {
|
|
467
|
+
const { view } = await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
468
|
+
const frame = panel(view, WIDE);
|
|
469
|
+
assert.equal(frame.worktrees.length, 6, 'six are visible: one line goes to the hidden-count');
|
|
470
|
+
assert.match(frame.title, /^╭─ Warp · 8 worktrees ─+ esc ─╮$/, 'the heading counts the eight checkouts the list holds');
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
test('the extended list adds the checkouts outside the worktrees root to the same count', async () => {
|
|
474
|
+
const roots = [
|
|
475
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
476
|
+
{ name: 'main', path: '/w/herdr', branch: 'main', isPrincipal: true },
|
|
477
|
+
{ name: 'inside-a', path: '/w/herdr-worktrees/inside-a', branch: 'feat/a' },
|
|
478
|
+
{ name: 'inside-b', path: '/w/herdr-worktrees/inside-b', branch: 'feat/b' },
|
|
479
|
+
{ name: 'elsewhere', path: '/somewhere/else', branch: 'feat/elsewhere' },
|
|
480
|
+
{ name: 'scratch', path: '/other/scratch', branch: 'chore/scratch' },
|
|
481
|
+
];
|
|
482
|
+
const { view } = await opened({ checkouts: roots, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
483
|
+
const frame = panel(view, WIDE);
|
|
484
|
+
assert.match(frame.title, /^╭─ Warp · 3 worktrees ─+ esc ─╮$/, 'the listing holds the principal and the two plugin checkouts');
|
|
485
|
+
const panelRows = frame.rows.join('\n');
|
|
486
|
+
assert.ok(!panelRows.includes('elsewhere') && !panelRows.includes('scratch'), 'the outside checkouts are not in the panel listing');
|
|
487
|
+
|
|
488
|
+
view.handleInput('a');
|
|
489
|
+
assert.match(screen(view, WIDE).lines[0], /^╭─ Warp · all 5 worktrees ─+ esc ─╮$/, 'S20: the extended list adds them, so the number grows');
|
|
490
|
+
const listed = screen(view, WIDE).rows.join('\n');
|
|
491
|
+
for (const name of ['inside-a', 'inside-b', 'elsewhere', 'scratch']) {
|
|
492
|
+
assert.ok(listed.includes(name), `${name} is one of the counted rows`);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
test('the heading counts what the list holds, never the page', async () => {
|
|
497
|
+
const { view } = await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
498
|
+
view.handleInput('a');
|
|
499
|
+
for (const char of 'wt-1') view.handleInput(char);
|
|
500
|
+
const { lines, rows } = screen(view, WIDE);
|
|
501
|
+
assert.match(lines[0], /^╭─ Warp · all 8 worktrees ─+ esc ─╮$/, 'the heading counts the eight rows the list holds, never the page');
|
|
502
|
+
assert.equal(rows[17], 'page 1/1 · 1 worktree', 'the page row keeps counting the matches');
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
test('a single checkout reads in the singular', async () => {
|
|
506
|
+
const one = [
|
|
507
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
508
|
+
{ name: 'wt-1', path: '/w/herdr-worktrees/wt-1', branch: 'feat/wt-1' },
|
|
509
|
+
];
|
|
510
|
+
const { view } = await opened({ checkouts: one, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
511
|
+
assert.match(panel(view, WIDE).title, /^╭─ Warp · 1 worktree ─+ esc ─╮$/, 'one checkout reads in the singular');
|
|
512
|
+
view.handleInput('a');
|
|
513
|
+
assert.match(screen(view, WIDE).lines[0], /^╭─ Warp · all 1 worktree ─+ esc ─╮$/);
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
test('the heading never exceeds the panel width', async () => {
|
|
517
|
+
const { view } = await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
518
|
+
for (const width of [24, 30, 40, 80]) {
|
|
519
|
+
assertWidth(panel(view, width).lines, width);
|
|
520
|
+
view.handleInput('a');
|
|
521
|
+
assertWidth(screen(view, width).lines, width);
|
|
522
|
+
view.handleInput('escape');
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
describe('S19: the two detail lines, with a blank row on each side', () => {
|
|
528
|
+
const checkouts = [
|
|
529
|
+
{ name: 'principal', path: '/w/herdr', branch: 'main', isPrincipal: true },
|
|
530
|
+
...Array.from({ length: 8 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
531
|
+
];
|
|
532
|
+
const facts = (checkoutPath) => ({
|
|
533
|
+
branch: checkoutPath === '/w/herdr' ? 'main' : `feat/${checkoutPath.split('/').pop()}`,
|
|
534
|
+
changes: { added: 233, deleted: 0 },
|
|
535
|
+
ahead: 0,
|
|
536
|
+
behind: checkoutPath === '/w/herdr' ? 0 : 1,
|
|
537
|
+
createdAt: ago(9 * 86400_000),
|
|
538
|
+
lastActivity: ago(20 * 60_000),
|
|
539
|
+
});
|
|
540
|
+
const openAt = async () => opened({ checkouts, current: { name: 'principal', path: '/w/herdr' }, facts, rows: HEIGHT });
|
|
541
|
+
|
|
542
|
+
test('the principal name line is gone, both detail lines stay, and the gaps sit on both sides', async () => {
|
|
543
|
+
const { view } = await openAt();
|
|
544
|
+
const frame = panel(view, WIDE);
|
|
545
|
+
assert.deepEqual(frame.header, [
|
|
546
|
+
'branch main · +233 · created 9d ago · modified 20m ago',
|
|
547
|
+
'branch feat/wt-1 · +233 · ↓1 · created 9d ago · modified 20m ago',
|
|
548
|
+
], 'exactly the two detail lines sit above the blank row');
|
|
549
|
+
assert.ok(!frame.rows.includes('principal'), 'the principal\'s NAME line is gone');
|
|
550
|
+
assert.equal(frame.rows[3], '', 'the blank row between the details and the list stays (S19, revised)');
|
|
551
|
+
assert.equal(frame.gapBelow, '', 'a second blank row closes the list');
|
|
552
|
+
assert.equal(frame.rows[frame.rows.length - 3], '', 'the blank row sits between the list and the keybindings');
|
|
553
|
+
assert.equal(frame.rows[frame.rows.length - 2], frame.legend, 'the keybindings come right after it');
|
|
554
|
+
assertWidth(frame.lines, WIDE);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
test('the second detail line follows the selection, which only ever lands on a real checkout', async () => {
|
|
558
|
+
const { view } = await openAt();
|
|
559
|
+
for (let i = 0; i < 6; i += 1) view.handleInput('down');
|
|
560
|
+
await tick();
|
|
561
|
+
const moved = panel(view, WIDE);
|
|
562
|
+
assert.equal(moved.focusData, 'branch feat/wt-7 · +233 · ↓1 · created 9d ago · modified 20m ago', 'the line follows the selection');
|
|
563
|
+
assert.equal(moved.currentData, 'branch main · +233 · created 9d ago · modified 20m ago', 'while the top line stays the principal one');
|
|
564
|
+
|
|
565
|
+
for (let i = 0; i < 2; i += 1) view.handleInput('down');
|
|
566
|
+
await tick();
|
|
567
|
+
assert.equal(view.state.cursor, 7, 'the last checkout holds the focus');
|
|
568
|
+
const offered = panel(view, WIDE);
|
|
569
|
+
assert.equal(offered.focusData, 'branch feat/wt-8 · +233 · ↓1 · created 9d ago · modified 20m ago', 'and it is described in full');
|
|
570
|
+
assert.equal(offered.viewAll, null, 'S20: there is no offer row to focus');
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
|
|
313
574
|
describe('current worktree data line (S4a)', () => {
|
|
314
575
|
const CURRENT_FACTS = {
|
|
315
576
|
branch: 'feat/odd-viewer', changes: { added: 0, deleted: 0 }, ahead: 0, behind: 2, createdAt: ago(2 * 86400_000), lastActivity: ago(3600_000),
|
|
@@ -425,15 +686,15 @@ describe('focused checkout facts (S4d, S9)', () => {
|
|
|
425
686
|
});
|
|
426
687
|
|
|
427
688
|
test('moving the selection refreshes the data line and reads each checkout only once', async () => {
|
|
428
|
-
const facts = (path) => ({ ...BASE, branch: path === '/w/feat-alpha' ? 'feat/alpha' : 'main' });
|
|
689
|
+
const facts = (path) => ({ ...BASE, branch: path === '/w/herdr-worktrees/feat-alpha' ? 'feat/alpha' : 'main' });
|
|
429
690
|
const { view, factCalls, paints } = await opened({ facts });
|
|
430
|
-
assert.deepEqual(factCalls, ['/w/feat-odd-viewer', '/w/herdr'], 'the current and the focused checkout are read');
|
|
691
|
+
assert.deepEqual(factCalls, ['/w/herdr-worktrees/feat-odd-viewer', '/w/herdr'], 'the current and the focused checkout are read');
|
|
431
692
|
assert.ok(paints.length > 0, 'the component repaints after a move');
|
|
432
693
|
view.handleInput('down');
|
|
433
694
|
screen(view, WIDE);
|
|
434
695
|
await tick();
|
|
435
696
|
const moved = panel(view, WIDE);
|
|
436
|
-
assert.deepEqual(factCalls, ['/w/feat-odd-viewer', '/w/herdr', '/w/feat-alpha'], 'the new focus is read on demand');
|
|
697
|
+
assert.deepEqual(factCalls, ['/w/herdr-worktrees/feat-odd-viewer', '/w/herdr', '/w/herdr-worktrees/feat-alpha'], 'the new focus is read on demand');
|
|
437
698
|
assert.ok(moved.focusData.startsWith('branch feat/alpha'), `the data follows the focus: ${moved.focusData}`);
|
|
438
699
|
view.handleInput('up');
|
|
439
700
|
screen(view, WIDE);
|
|
@@ -462,15 +723,15 @@ describe('focused checkout facts (S4d, S9)', () => {
|
|
|
462
723
|
|
|
463
724
|
describe('ordering and both ages (S12)', () => {
|
|
464
725
|
const ORDERED = [
|
|
465
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
466
|
-
{ name: 'stale', path: '/w/stale', branch: 'feat/stale', lastActivity: ago(10 * 86400_000) },
|
|
467
|
-
{ name: 'open', path: '/w/open', branch: 'feat/open', lastActivity: null, lastActivityReason: 'not a git repository' },
|
|
468
|
-
{ name: 'commit-fresh', path: '/w/commit-fresh', branch: 'feat/cf', lastActivity: ago(60_000) },
|
|
469
|
-
{ name: 'dirty-fresh', path: '/w/dirty-fresh', branch: 'feat/df', lastActivity: ago(3600_000) },
|
|
726
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
727
|
+
{ name: 'stale', path: '/w/herdr-worktrees/stale', branch: 'feat/stale', lastActivity: ago(10 * 86400_000) },
|
|
728
|
+
{ name: 'open', path: '/w/herdr-worktrees/open', branch: 'feat/open', lastActivity: null, lastActivityReason: 'not a git repository' },
|
|
729
|
+
{ name: 'commit-fresh', path: '/w/herdr-worktrees/commit-fresh', branch: 'feat/cf', lastActivity: ago(60_000) },
|
|
730
|
+
{ name: 'dirty-fresh', path: '/w/herdr-worktrees/dirty-fresh', branch: 'feat/df', lastActivity: ago(3600_000) },
|
|
470
731
|
];
|
|
471
732
|
|
|
472
733
|
test('orders the rows by last activity descending, keeps the unreadable one last and never prints its reason', async () => {
|
|
473
|
-
const { view } = await opened({ checkouts: ORDERED, current: { name: 'cur', path: '/w/cur' }, facts: () => null });
|
|
734
|
+
const { view } = await opened({ checkouts: ORDERED, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
474
735
|
const rows = panel(view, WIDE).worktrees;
|
|
475
736
|
assert.match(rows[0], /^▸ commit-fresh/, 'the most recent commit leads and takes the focus');
|
|
476
737
|
assert.match(rows[1], /^ {2}dirty-fresh/, 'a recent dirty file follows the commit');
|
|
@@ -484,13 +745,13 @@ describe('ordering and both ages (S12)', () => {
|
|
|
484
745
|
assert.ok(focused.focusData.endsWith('modified —'), `a brief value replaces a fake date: ${focused.focusData}`);
|
|
485
746
|
assert.ok(!focused.focusData.includes('not a git repository'), `the reason stays out of the row: ${focused.focusData}`);
|
|
486
747
|
assert.ok(!/modified 20\d\d/.test(focused.focusData));
|
|
487
|
-
const stored = view.state.checkouts.find((entry) => entry.path === '/w/open');
|
|
748
|
+
const stored = view.state.checkouts.find((entry) => entry.path === '/w/herdr-worktrees/open');
|
|
488
749
|
assert.equal(stored.lastActivityReason, 'not a git repository', 'the provenance is kept in data');
|
|
489
750
|
});
|
|
490
751
|
|
|
491
752
|
test('the extended list keeps the same order', async () => {
|
|
492
|
-
const { view } = await opened({ checkouts: ORDERED, current: { name: 'cur', path: '/w/cur' }, facts: () => null });
|
|
493
|
-
view.handleInput('
|
|
753
|
+
const { view } = await opened({ checkouts: ORDERED, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
754
|
+
view.handleInput('a');
|
|
494
755
|
const { rows } = screen(view, WIDE);
|
|
495
756
|
assert.match(rows[2], /commit-fresh/);
|
|
496
757
|
assert.match(rows[3], /dirty-fresh/);
|
|
@@ -532,14 +793,14 @@ describe('S15: compact facts rows never print the raw reason', () => {
|
|
|
532
793
|
|
|
533
794
|
test('a row-level reason is kept as data and never rendered', async () => {
|
|
534
795
|
const checkouts = [
|
|
535
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
536
|
-
{ name: 'stale', path: '/w/stale', branch: 'feat/stale', lastActivity: null, lastActivityReason: LONG },
|
|
796
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
797
|
+
{ name: 'stale', path: '/w/herdr-worktrees/stale', branch: 'feat/stale', lastActivity: null, lastActivityReason: LONG },
|
|
537
798
|
];
|
|
538
|
-
const { view } = await opened({ checkouts, current: { name: 'cur', path: '/w/cur' }, facts: () => null });
|
|
799
|
+
const { view } = await opened({ checkouts, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
539
800
|
const frame = panel(view, WIDE);
|
|
540
801
|
assert.match(frame.worktrees[0], /^▸ stale/, 'the unreadable row still sorts last and takes the focus');
|
|
541
802
|
assert.ok(frame.focusData.endsWith('modified —'), `the row's own reason is not printed: ${frame.focusData}`);
|
|
542
|
-
const stored = view.state.checkouts.find((entry) => entry.path === '/w/stale');
|
|
803
|
+
const stored = view.state.checkouts.find((entry) => entry.path === '/w/herdr-worktrees/stale');
|
|
543
804
|
assert.equal(stored.lastActivityReason, LONG, 'the provenance survives in the component data');
|
|
544
805
|
});
|
|
545
806
|
|
|
@@ -562,7 +823,7 @@ describe('the create key and the retired edit key (S1, S4, S6)', () => {
|
|
|
562
823
|
|
|
563
824
|
test('c stays ordinary text in the extended list, where the filter owns printables', async () => {
|
|
564
825
|
const { view, results } = await opened();
|
|
565
|
-
view.handleInput('
|
|
826
|
+
view.handleInput('a');
|
|
566
827
|
view.handleInput('c');
|
|
567
828
|
assert.equal(view.state.filter, 'c', 'the filter took the character');
|
|
568
829
|
assert.deepEqual(results, []);
|
|
@@ -583,17 +844,18 @@ describe('the create key and the retired edit key (S1, S4, S6)', () => {
|
|
|
583
844
|
assert.deepEqual(empty.results, [], 'e on an empty list is inert');
|
|
584
845
|
|
|
585
846
|
const many = [
|
|
586
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
587
|
-
...Array.from({ length: 8 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
847
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
848
|
+
...Array.from({ length: 8 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
588
849
|
];
|
|
589
|
-
const offered = await opened({ checkouts: many, current: { name: 'cur', path: '/w/cur' } });
|
|
590
|
-
for (let i = 0; i <
|
|
591
|
-
assert.
|
|
850
|
+
const offered = await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' } });
|
|
851
|
+
for (let i = 0; i < 8; i += 1) offered.view.handleInput('down');
|
|
852
|
+
assert.equal(offered.view.state.cursor, 7, 'S20: the selection stops on the last checkout, there is no offer row');
|
|
592
853
|
offered.view.handleInput('e');
|
|
593
|
-
assert.deepEqual(offered.results, [], 'e on the
|
|
854
|
+
assert.deepEqual(offered.results, [], 'e on the last checkout is inert too');
|
|
855
|
+
assert.ok(!offered.view.render(WIDE).join('\n').includes('view all worktrees'));
|
|
594
856
|
|
|
595
857
|
const listed = await opened();
|
|
596
|
-
listed.view.handleInput('
|
|
858
|
+
listed.view.handleInput('a');
|
|
597
859
|
listed.view.handleInput('T');
|
|
598
860
|
listed.view.handleInput('e');
|
|
599
861
|
assert.equal(listed.view.state.filter, 'e', 'e is typed text while the filter is open');
|
|
@@ -602,14 +864,14 @@ describe('the create key and the retired edit key (S1, S4, S6)', () => {
|
|
|
602
864
|
});
|
|
603
865
|
|
|
604
866
|
describe('extended list (S1, S6)', () => {
|
|
605
|
-
test('
|
|
867
|
+
test('a opens a paginated list of every other checkout with an always-active filter row', async () => {
|
|
606
868
|
const { view } = await opened();
|
|
607
|
-
view.handleInput('
|
|
869
|
+
view.handleInput('a');
|
|
608
870
|
assert.equal(view.state.view, 'list');
|
|
609
871
|
const { lines, rows } = screen(view);
|
|
610
872
|
assert.equal(lines.length, HEIGHT);
|
|
611
873
|
assertWidth(lines);
|
|
612
|
-
assert.match(lines[0], /^╭─ Warp · all worktrees ─+ esc ─╮$/);
|
|
874
|
+
assert.match(lines[0], /^╭─ Warp · all 3 worktrees ─+ esc ─╮$/);
|
|
613
875
|
assert.equal(rows[1], 'filter: type to search', 'the filter row is always present and never selectable');
|
|
614
876
|
assert.equal(rows[2], '▸ main · use the local project', 'S6: the principal leads the list');
|
|
615
877
|
assert.equal(rows[3], ' feat-alpha');
|
|
@@ -623,7 +885,7 @@ describe('extended list (S1, S6)', () => {
|
|
|
623
885
|
|
|
624
886
|
test('typing filters the list live and the filter row is not a selectable item', async () => {
|
|
625
887
|
const { view } = await opened();
|
|
626
|
-
view.handleInput('
|
|
888
|
+
view.handleInput('a');
|
|
627
889
|
view.handleInput('a');
|
|
628
890
|
assert.equal(view.state.filterOpen, true);
|
|
629
891
|
assert.equal(view.state.filter, 'a');
|
|
@@ -642,7 +904,7 @@ describe('extended list (S1, S6)', () => {
|
|
|
642
904
|
|
|
643
905
|
test('the filter excludes rows that match nothing and enter cannot warp from it', async () => {
|
|
644
906
|
const { view, results } = await opened();
|
|
645
|
-
view.handleInput('
|
|
907
|
+
view.handleInput('a');
|
|
646
908
|
for (const ch of 'zzz') view.handleInput(ch);
|
|
647
909
|
const { lines, rows } = screen(view);
|
|
648
910
|
assertWidth(lines);
|
|
@@ -654,9 +916,9 @@ describe('extended list (S1, S6)', () => {
|
|
|
654
916
|
});
|
|
655
917
|
|
|
656
918
|
test('pgUp/pgDn page through every other checkout', async () => {
|
|
657
|
-
const many = Array.from({ length: 12 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/wt-${index + 1}`, branch: `feat/wt-${index + 1}` }));
|
|
658
|
-
const { view } = await opened({ checkouts: many, current: { name: 'wt-1', path: '/w/wt-1' }, rows: 11 });
|
|
659
|
-
view.handleInput('
|
|
919
|
+
const many = Array.from({ length: 12 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` }));
|
|
920
|
+
const { view } = await opened({ checkouts: many, current: { name: 'wt-1', path: '/w/herdr-worktrees/wt-1' }, rows: 11 });
|
|
921
|
+
view.handleInput('a');
|
|
660
922
|
let { rows } = screen(view);
|
|
661
923
|
// 11 rows - 5 fixed rows = a 6-row page, and wt-1 (the session's own
|
|
662
924
|
// checkout) is not one of the eleven destinations.
|
|
@@ -680,7 +942,7 @@ describe('extended list (S1, S6)', () => {
|
|
|
680
942
|
|
|
681
943
|
test('esc closes the filter first and then steps back to the panel', async () => {
|
|
682
944
|
const { view, results } = await opened();
|
|
683
|
-
view.handleInput('
|
|
945
|
+
view.handleInput('a');
|
|
684
946
|
view.handleInput('a');
|
|
685
947
|
assert.equal(view.state.filterOpen, true);
|
|
686
948
|
view.handleInput('escape');
|
|
@@ -696,7 +958,7 @@ describe('extended list (S1, S6)', () => {
|
|
|
696
958
|
|
|
697
959
|
test('ctrl+c steps back from the list too', async () => {
|
|
698
960
|
const { view, results } = await opened();
|
|
699
|
-
view.handleInput('
|
|
961
|
+
view.handleInput('a');
|
|
700
962
|
view.handleInput('ctrl+c');
|
|
701
963
|
assert.equal(view.state.view, 'popup');
|
|
702
964
|
assert.deepEqual(results, []);
|
|
@@ -704,22 +966,22 @@ describe('extended list (S1, S6)', () => {
|
|
|
704
966
|
|
|
705
967
|
test('enter on a checkout warps to its path', async () => {
|
|
706
968
|
const { view, results } = await opened();
|
|
707
|
-
view.handleInput('
|
|
969
|
+
view.handleInput('a');
|
|
708
970
|
view.handleInput('down');
|
|
709
971
|
view.handleInput('enter');
|
|
710
|
-
assert.deepEqual(results, [{ warp: '/w/feat-alpha' }], 'the second row is feat-alpha: the current checkout is not listed');
|
|
972
|
+
assert.deepEqual(results, [{ warp: '/w/herdr-worktrees/feat-alpha' }], 'the second row is feat-alpha: the current checkout is not listed');
|
|
711
973
|
});
|
|
712
974
|
});
|
|
713
975
|
|
|
714
976
|
describe('the S6 space rule', () => {
|
|
715
977
|
test('space toggles while the filter is closed, types once it is open, and toggles again after it closes', async () => {
|
|
716
978
|
const { view, toggles } = await opened({ onToggle: () => {} });
|
|
717
|
-
view.handleInput('
|
|
979
|
+
view.handleInput('a');
|
|
718
980
|
view.handleInput('down');
|
|
719
981
|
assert.equal(view.state.listCursor, 1);
|
|
720
982
|
|
|
721
983
|
view.handleInput(' ');
|
|
722
|
-
assert.deepEqual(toggles, ['/w/feat-alpha'], 'space toggles the focused row while the filter is closed');
|
|
984
|
+
assert.deepEqual(toggles, ['/w/herdr-worktrees/feat-alpha'], 'space toggles the focused row while the filter is closed');
|
|
723
985
|
assert.equal(view.state.filterOpen, false, 'and never opens the filter');
|
|
724
986
|
assert.equal(view.state.filter, '');
|
|
725
987
|
|
|
@@ -728,7 +990,7 @@ describe('the S6 space rule', () => {
|
|
|
728
990
|
assert.equal(view.state.filter, 'z');
|
|
729
991
|
view.handleInput(' ');
|
|
730
992
|
assert.equal(view.state.filter, 'z ', 'once open, space goes to the text');
|
|
731
|
-
assert.deepEqual(toggles, ['/w/feat-alpha'], 'and no longer toggles');
|
|
993
|
+
assert.deepEqual(toggles, ['/w/herdr-worktrees/feat-alpha'], 'and no longer toggles');
|
|
732
994
|
|
|
733
995
|
view.handleInput('escape');
|
|
734
996
|
assert.equal(view.state.filterOpen, false);
|
|
@@ -739,12 +1001,12 @@ describe('the S6 space rule', () => {
|
|
|
739
1001
|
view.handleInput('escape');
|
|
740
1002
|
view.handleInput('down');
|
|
741
1003
|
view.handleInput(' ');
|
|
742
|
-
assert.deepEqual(toggles, ['/w/feat-alpha', '/w/feat-alpha'], 'closing an empty filter restores the toggle');
|
|
1004
|
+
assert.deepEqual(toggles, ['/w/herdr-worktrees/feat-alpha', '/w/herdr-worktrees/feat-alpha'], 'closing an empty filter restores the toggle');
|
|
743
1005
|
});
|
|
744
1006
|
|
|
745
1007
|
test('without a toggle, space is a printable and opens the filter', async () => {
|
|
746
1008
|
const { view } = await opened();
|
|
747
|
-
view.handleInput('
|
|
1009
|
+
view.handleInput('a');
|
|
748
1010
|
view.handleInput(' ');
|
|
749
1011
|
assert.equal(view.state.filterOpen, true);
|
|
750
1012
|
assert.equal(view.state.filter, ' ');
|
|
@@ -759,7 +1021,7 @@ describe('S9: no redundant help overlay', () => {
|
|
|
759
1021
|
assert.ok(panel(view).worktrees.some((text) => /feat-alpha/.test(text)), 'the panel rows stay');
|
|
760
1022
|
assert.deepEqual(view.state, before, '? changes no state in the panel');
|
|
761
1023
|
|
|
762
|
-
view.handleInput('
|
|
1024
|
+
view.handleInput('a');
|
|
763
1025
|
view.handleInput('?');
|
|
764
1026
|
const { rows } = screen(view);
|
|
765
1027
|
assert.equal(view.state.filter, '?', '? is ordinary printable text in the list, never a help toggle');
|
|
@@ -772,16 +1034,18 @@ describe('S9: no redundant help overlay', () => {
|
|
|
772
1034
|
assert.equal(panel(view, WIDE).legend, '↑↓ move · enter choose · c create · ctrl+d delete · r reload · esc close');
|
|
773
1035
|
assert.ok(!panel(view, WIDE).legend.includes('?'), 'no generic help hint in the panel legend');
|
|
774
1036
|
|
|
775
|
-
//
|
|
776
|
-
// is
|
|
1037
|
+
// S20: the `a` token appears only when a checkout stands outside
|
|
1038
|
+
// `<repo-name>-worktrees/`, and there is never a row to go with it.
|
|
777
1039
|
const many = [
|
|
778
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
779
|
-
|
|
1040
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1041
|
+
{ name: 'wt-1', path: '/w/herdr-worktrees/wt-1', branch: 'feat/wt-1' },
|
|
1042
|
+
{ name: 'elsewhere', path: '/somewhere/else', branch: 'feat/elsewhere' },
|
|
780
1043
|
];
|
|
781
|
-
const offered = await opened({ checkouts: many, current: { name: 'cur', path: '/w/cur' } });
|
|
782
|
-
assert.match(panel(offered.view, WIDE).legend, /
|
|
1044
|
+
const offered = await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' } });
|
|
1045
|
+
assert.match(panel(offered.view, WIDE).legend, /a all/, 'the hint names the extended list key');
|
|
1046
|
+
assert.ok(!panel(offered.view, WIDE).rows.join('\n').includes('view all worktrees'), 'and no row advertises it');
|
|
783
1047
|
|
|
784
|
-
view.handleInput('
|
|
1048
|
+
view.handleInput('a');
|
|
785
1049
|
const { rows } = screen(view);
|
|
786
1050
|
assert.equal(rows[18], '↑↓ move · pgUp/pgDn page · enter warp · ctrl+d delete · r reload · esc back');
|
|
787
1051
|
assert.ok(!rows[18].includes('?'), 'no generic help hint in the list legend');
|
|
@@ -791,12 +1055,12 @@ describe('S9: no redundant help overlay', () => {
|
|
|
791
1055
|
describe('S6: the principal leads when it is not the current checkout', () => {
|
|
792
1056
|
test('a principal with the oldest activity still renders before newer checkouts', async () => {
|
|
793
1057
|
const checkouts = [
|
|
794
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
795
|
-
{ name: 'recent', path: '/w/recent', branch: 'feat/recent', lastActivity: ago(60_000) },
|
|
1058
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1059
|
+
{ name: 'recent', path: '/w/herdr-worktrees/recent', branch: 'feat/recent', lastActivity: ago(60_000) },
|
|
796
1060
|
{ name: 'main', path: '/w/herdr', branch: 'main', isPrincipal: true, lastActivity: ago(90 * 86400_000) },
|
|
797
|
-
{ name: 'older', path: '/w/older', branch: 'feat/older', lastActivity: ago(120 * 86400_000) },
|
|
1061
|
+
{ name: 'older', path: '/w/herdr-worktrees/older', branch: 'feat/older', lastActivity: ago(120 * 86400_000) },
|
|
798
1062
|
];
|
|
799
|
-
const { view } = await opened({ checkouts, current: { name: 'cur', path: '/w/cur' }, facts: () => null });
|
|
1063
|
+
const { view } = await opened({ checkouts, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
800
1064
|
const rows = panel(view, WIDE).worktrees;
|
|
801
1065
|
assert.equal(rows[0], '▸ main · use the local project', 'the principal is first despite the oldest activity');
|
|
802
1066
|
assert.equal(rows[1], ' recent');
|
|
@@ -818,18 +1082,18 @@ describe('S1: render performs no I/O and enrichment keeps the selection', () =>
|
|
|
818
1082
|
|
|
819
1083
|
test('apply() re-sorts by the newly arrived activity and keeps the focused checkout', async () => {
|
|
820
1084
|
const initial = [
|
|
821
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
822
|
-
{ name: 'alpha', path: '/w/alpha', branch: 'feat/alpha' },
|
|
823
|
-
{ name: 'beta', path: '/w/beta', branch: 'feat/beta' },
|
|
1085
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1086
|
+
{ name: 'alpha', path: '/w/herdr-worktrees/alpha', branch: 'feat/alpha' },
|
|
1087
|
+
{ name: 'beta', path: '/w/herdr-worktrees/beta', branch: 'feat/beta' },
|
|
824
1088
|
];
|
|
825
|
-
const { view } = await opened({ checkouts: initial, current: { name: 'cur', path: '/w/cur' }, facts: () => null });
|
|
1089
|
+
const { view } = await opened({ checkouts: initial, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, facts: () => null });
|
|
826
1090
|
view.handleInput('down');
|
|
827
1091
|
view.handleInput('down'); // focus beta (the second list row, clamped)
|
|
828
1092
|
assert.equal(view.state.cursor, 1);
|
|
829
1093
|
view.apply([
|
|
830
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
831
|
-
{ name: 'alpha', path: '/w/alpha', branch: 'feat/alpha', lastActivity: '2026-02-01T00:00:00.000Z' },
|
|
832
|
-
{ name: 'beta', path: '/w/beta', branch: 'feat/beta', lastActivity: '2026-02-02T00:00:00.000Z' },
|
|
1094
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1095
|
+
{ name: 'alpha', path: '/w/herdr-worktrees/alpha', branch: 'feat/alpha', lastActivity: '2026-02-01T00:00:00.000Z' },
|
|
1096
|
+
{ name: 'beta', path: '/w/herdr-worktrees/beta', branch: 'feat/beta', lastActivity: '2026-02-02T00:00:00.000Z' },
|
|
833
1097
|
]);
|
|
834
1098
|
const rows = panel(view, WIDE).worktrees;
|
|
835
1099
|
assert.equal(rows[0], '▸ beta', 'beta now leads by activity and holds the focus');
|
|
@@ -847,8 +1111,8 @@ describe('S1: render performs no I/O and enrichment keeps the selection', () =>
|
|
|
847
1111
|
const before = JSON.parse(JSON.stringify(view.state.checkouts));
|
|
848
1112
|
|
|
849
1113
|
const replacement = [
|
|
850
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
851
|
-
{ name: 'late', path: '/w/late', branch: 'feat/late', lastActivity: '2026-02-02T00:00:00.000Z' },
|
|
1114
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1115
|
+
{ name: 'late', path: '/w/herdr-worktrees/late', branch: 'feat/late', lastActivity: '2026-02-02T00:00:00.000Z' },
|
|
852
1116
|
];
|
|
853
1117
|
assert.doesNotThrow(() => view.apply(replacement));
|
|
854
1118
|
releaseFacts(DEFAULT_FACTS);
|
|
@@ -866,7 +1130,7 @@ describe('S12: Delete clears the search, Backspace edits it', () => {
|
|
|
866
1130
|
|
|
867
1131
|
test('Delete empties the whole query while the search is active', async () => {
|
|
868
1132
|
const { view, results } = await opened();
|
|
869
|
-
view.handleInput('
|
|
1133
|
+
view.handleInput('a');
|
|
870
1134
|
for (const char of 'alpha') view.handleInput(char);
|
|
871
1135
|
assert.equal(view.state.filter, 'alpha');
|
|
872
1136
|
view.handleInput('\x1b[3~'); // the raw Delete sequence
|
|
@@ -880,7 +1144,7 @@ describe('S12: Delete clears the search, Backspace edits it', () => {
|
|
|
880
1144
|
|
|
881
1145
|
test('the installed matcher spelling of Delete clears it too', async () => {
|
|
882
1146
|
const { view } = await opened();
|
|
883
|
-
view.handleInput('
|
|
1147
|
+
view.handleInput('a');
|
|
884
1148
|
for (const char of 'beta') view.handleInput(char);
|
|
885
1149
|
view.handleInput('delete');
|
|
886
1150
|
assert.equal(view.state.filter, '');
|
|
@@ -888,7 +1152,7 @@ describe('S12: Delete clears the search, Backspace edits it', () => {
|
|
|
888
1152
|
|
|
889
1153
|
test('Backspace still deletes exactly one character', async () => {
|
|
890
1154
|
const { view } = await opened();
|
|
891
|
-
view.handleInput('
|
|
1155
|
+
view.handleInput('a');
|
|
892
1156
|
for (const char of 'alpha') view.handleInput(char);
|
|
893
1157
|
view.handleInput('backspace');
|
|
894
1158
|
assert.equal(view.state.filter, 'alph');
|
|
@@ -909,7 +1173,7 @@ describe('S12: Delete clears the search, Backspace edits it', () => {
|
|
|
909
1173
|
test('the footer advertises Delete clear on one row only while the search is active', async () => {
|
|
910
1174
|
for (const width of [40, 80, 120]) {
|
|
911
1175
|
const { view } = await opened();
|
|
912
|
-
view.handleInput('
|
|
1176
|
+
view.handleInput('a');
|
|
913
1177
|
view.handleInput('T');
|
|
914
1178
|
const open = view.render(width).map(strip);
|
|
915
1179
|
const openLegend = open[open.length - 2];
|
|
@@ -938,7 +1202,7 @@ describe('keys that are not in the map', () => {
|
|
|
938
1202
|
|
|
939
1203
|
test('no key outside the documented map changes the list state', async () => {
|
|
940
1204
|
const { view, results } = await opened();
|
|
941
|
-
view.handleInput('
|
|
1205
|
+
view.handleInput('a');
|
|
942
1206
|
screen(view);
|
|
943
1207
|
const before = { listCursor: view.state.listCursor, filter: view.state.filter, filterOpen: view.state.filterOpen, view: view.state.view, help: view.state.help };
|
|
944
1208
|
for (const key of ['tab', 'home', 'end', 'left', 'right', 'ctrl+s']) view.handleInput(key);
|
|
@@ -971,33 +1235,32 @@ describe('selection and reload', () => {
|
|
|
971
1235
|
assert.deepEqual(closed.results, [null], 'the component resolves once');
|
|
972
1236
|
});
|
|
973
1237
|
|
|
974
|
-
test('enter on the
|
|
1238
|
+
test('enter on the last checkout warps and never opens the extended list', async () => {
|
|
975
1239
|
const many = [
|
|
976
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
977
|
-
...Array.from({ length: 8 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
1240
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1241
|
+
...Array.from({ length: 8 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
978
1242
|
];
|
|
979
|
-
const { view, results } = await opened({ checkouts: many, current: { name: 'cur', path: '/w/cur' }, rows: 14 });
|
|
980
|
-
for (let i = 0; i <
|
|
981
|
-
assert.match(panel(view).
|
|
1243
|
+
const { view, results } = await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' }, rows: 14 });
|
|
1244
|
+
for (let i = 0; i < 7; i += 1) view.handleInput('down');
|
|
1245
|
+
assert.match(panel(view).worktrees.at(-1), /^▸ wt-8$/, 'S20: the selection stops on the last checkout');
|
|
982
1246
|
view.handleInput('enter');
|
|
983
|
-
assert.
|
|
984
|
-
assert.deepEqual(results, []);
|
|
1247
|
+
assert.deepEqual(results, [{ warp: '/w/herdr-worktrees/wt-8' }], 'enter warps; the list is a key, never a row');
|
|
985
1248
|
});
|
|
986
1249
|
|
|
987
1250
|
test('r reloads through the injected callback and re-reads both data lines', async () => {
|
|
988
1251
|
const reloaded = [
|
|
989
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
990
|
-
{ name: 'new-shape', path: '/w/new-shape', branch: 'feat/new-shape' },
|
|
1252
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1253
|
+
{ name: 'new-shape', path: '/w/herdr-worktrees/new-shape', branch: 'feat/new-shape' },
|
|
991
1254
|
];
|
|
992
1255
|
const { view, reloadCalls, factCalls } = await opened({
|
|
993
1256
|
checkouts: [
|
|
994
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
995
|
-
{ name: 'old-shape', path: '/w/old-shape', branch: 'feat/old-shape' },
|
|
1257
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1258
|
+
{ name: 'old-shape', path: '/w/herdr-worktrees/old-shape', branch: 'feat/old-shape' },
|
|
996
1259
|
],
|
|
997
|
-
current: { name: 'cur', path: '/w/cur' },
|
|
1260
|
+
current: { name: 'cur', path: '/w/herdr-worktrees/cur' },
|
|
998
1261
|
reloadTo: reloaded,
|
|
999
1262
|
});
|
|
1000
|
-
assert.deepEqual(factCalls, ['/w/cur', '/w/old-shape'], 'the mount reads the current and the focused row once');
|
|
1263
|
+
assert.deepEqual(factCalls, ['/w/herdr-worktrees/cur', '/w/herdr-worktrees/old-shape'], 'the mount reads the current and the focused row once');
|
|
1001
1264
|
view.handleInput('r');
|
|
1002
1265
|
assert.equal(reloadCalls.length, 1, 'the reload reader is the only source');
|
|
1003
1266
|
await tick();
|
|
@@ -1005,7 +1268,7 @@ describe('selection and reload', () => {
|
|
|
1005
1268
|
assert.match(rows[0], /new-shape/);
|
|
1006
1269
|
assert.deepEqual(
|
|
1007
1270
|
factCalls,
|
|
1008
|
-
['/w/cur', '/w/old-shape', '/w/cur', '/w/new-shape'],
|
|
1271
|
+
['/w/herdr-worktrees/cur', '/w/herdr-worktrees/old-shape', '/w/herdr-worktrees/cur', '/w/herdr-worktrees/new-shape'],
|
|
1009
1272
|
'the cached facts are dropped on reload and both data lines are re-read',
|
|
1010
1273
|
);
|
|
1011
1274
|
});
|
|
@@ -1038,7 +1301,7 @@ describe('S2: one-row key legends', () => {
|
|
|
1038
1301
|
test('the extended-list legend owns exactly one row at every width', async () => {
|
|
1039
1302
|
for (const width of WIDTHS) {
|
|
1040
1303
|
const { view } = await opened();
|
|
1041
|
-
view.handleInput('
|
|
1304
|
+
view.handleInput('a');
|
|
1042
1305
|
const { lines } = screen(view, width);
|
|
1043
1306
|
assert.equal(lines.length, HEIGHT, `width ${width}: the list still fills its rows`);
|
|
1044
1307
|
const legend = legendRows(lines, /esc back|↑↓/);
|
|
@@ -1065,20 +1328,20 @@ describe('S4: ctrl+d asks to delete the focused checkout', () => {
|
|
|
1065
1328
|
view.handleInput('down');
|
|
1066
1329
|
assert.match(panel(view).worktrees[1], /^▸ feat-alpha$/, 'a checkout row is focused');
|
|
1067
1330
|
view.handleInput(spelling);
|
|
1068
|
-
assert.deepEqual(results, [{ delete: '/w/feat-alpha' }], `${JSON.stringify(spelling)} names the focused path`);
|
|
1331
|
+
assert.deepEqual(results, [{ delete: '/w/herdr-worktrees/feat-alpha' }], `${JSON.stringify(spelling)} names the focused path`);
|
|
1069
1332
|
}
|
|
1070
1333
|
});
|
|
1071
1334
|
|
|
1072
|
-
test('ctrl+d on the
|
|
1335
|
+
test('ctrl+d on the last checkout names it, and on an empty panel resolves nothing', async () => {
|
|
1073
1336
|
const many = [
|
|
1074
|
-
{ name: 'cur', path: '/w/cur', branch: 'feat/cur' },
|
|
1075
|
-
...Array.from({ length: 8 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
1337
|
+
{ name: 'cur', path: '/w/herdr-worktrees/cur', branch: 'feat/cur' },
|
|
1338
|
+
...Array.from({ length: 8 }, (_, index) => ({ name: `wt-${index + 1}`, path: `/w/herdr-worktrees/wt-${index + 1}`, branch: `feat/wt-${index + 1}` })),
|
|
1076
1339
|
];
|
|
1077
|
-
const offered = await opened({ checkouts: many, current: { name: 'cur', path: '/w/cur' } });
|
|
1078
|
-
for (let i = 0; i <
|
|
1079
|
-
assert.match(panel(offered.view).
|
|
1340
|
+
const offered = await opened({ checkouts: many, current: { name: 'cur', path: '/w/herdr-worktrees/cur' } });
|
|
1341
|
+
for (let i = 0; i < 8; i += 1) offered.view.handleInput('down');
|
|
1342
|
+
assert.match(panel(offered.view).worktrees.at(-1), /^▸ wt-8$/, 'the last checkout is focused');
|
|
1080
1343
|
offered.view.handleInput('ctrl+d');
|
|
1081
|
-
assert.deepEqual(offered.results, [], 'the
|
|
1344
|
+
assert.deepEqual(offered.results, [{ delete: '/w/herdr-worktrees/wt-8' }], 'the delete request names a real checkout, never a row that is not one');
|
|
1082
1345
|
|
|
1083
1346
|
const empty = await opened({ checkouts: [CURRENT], current: { name: CURRENT.name, path: CURRENT.path } });
|
|
1084
1347
|
empty.view.handleInput('ctrl+d');
|
|
@@ -1087,15 +1350,15 @@ describe('S4: ctrl+d asks to delete the focused checkout', () => {
|
|
|
1087
1350
|
|
|
1088
1351
|
test('ctrl+d in the extended list names the focused row and stays inert while the filter is open', async () => {
|
|
1089
1352
|
const { view, results } = await opened();
|
|
1090
|
-
view.handleInput('
|
|
1353
|
+
view.handleInput('a');
|
|
1091
1354
|
// The list is every OTHER checkout, principal first: main, then feat-alpha
|
|
1092
1355
|
// — so the focused row after one move is feat-alpha.
|
|
1093
1356
|
view.handleInput('down');
|
|
1094
1357
|
view.handleInput('\x04');
|
|
1095
|
-
assert.deepEqual(results, [{ delete: '/w/feat-alpha' }], 'the list speaks the same marker');
|
|
1358
|
+
assert.deepEqual(results, [{ delete: '/w/herdr-worktrees/feat-alpha' }], 'the list speaks the same marker');
|
|
1096
1359
|
|
|
1097
1360
|
const searching = await opened();
|
|
1098
|
-
searching.view.handleInput('
|
|
1361
|
+
searching.view.handleInput('a');
|
|
1099
1362
|
searching.view.handleInput('T');
|
|
1100
1363
|
const before = { listCursor: searching.view.state.listCursor, filter: searching.view.state.filter, view: searching.view.state.view };
|
|
1101
1364
|
searching.view.handleInput('ctrl+d');
|
|
@@ -1107,7 +1370,7 @@ describe('S4: ctrl+d asks to delete the focused checkout', () => {
|
|
|
1107
1370
|
for (const width of [80, 120]) {
|
|
1108
1371
|
const { view } = await opened();
|
|
1109
1372
|
assert.match(panel(view, width).legend, /ctrl\+d delete/, `width ${width}: the panel names it`);
|
|
1110
|
-
view.handleInput('
|
|
1373
|
+
view.handleInput('a');
|
|
1111
1374
|
const { lines } = screen(view, width);
|
|
1112
1375
|
assert.match(lines[lines.length - 2], /ctrl\+d delete/, `width ${width}: and so does the extended list`);
|
|
1113
1376
|
}
|
|
@@ -1154,7 +1417,7 @@ describe('S1: no issue or ODD association is rendered', () => {
|
|
|
1154
1417
|
const frame = panel(view, WIDE);
|
|
1155
1418
|
assert.equal(frame.focusData, DEFAULT_LINE, 'the focused line is association-free');
|
|
1156
1419
|
assert.equal(frame.currentData, DEFAULT_LINE, 'so is the current worktree line');
|
|
1157
|
-
view.handleInput('
|
|
1420
|
+
view.handleInput('a');
|
|
1158
1421
|
const listed = screen(view, WIDE).lines.join('\n');
|
|
1159
1422
|
assert.ok(!listed.includes('issues'), 'the extended list names no issue association');
|
|
1160
1423
|
assert.ok(!/w1-a|w2-b|#12/.test(listed), 'and no ODD document or issue id either');
|
|
@@ -1164,8 +1427,7 @@ describe('S1: no issue or ODD association is rendered', () => {
|
|
|
1164
1427
|
// ---------------------------------------------------------------------------
|
|
1165
1428
|
// S11/T9: every footer and header token paints through the ONE shared palette
|
|
1166
1429
|
// (lib/tui-paint.js) with the injected theme — a shortcut KEY (a button) is
|
|
1167
|
-
// accent+bold, its description muted, a TITLE takes the
|
|
1168
|
-
// title role (its Agents title: ~/.config/herdr-app/mods/agents/main.js:413),
|
|
1430
|
+
// accent+bold, its description muted, a TITLE takes the `dim` title role,
|
|
1169
1431
|
// ordinary values are the text role and counts/labels are muted
|
|
1170
1432
|
// or dim — while the focus cue stays monochrome (`▸`), so a theme that answers
|
|
1171
1433
|
// nothing still reads as a frame.
|
|
@@ -1189,7 +1451,7 @@ describe('S11: the shared palette', () => {
|
|
|
1189
1451
|
test('the extended list and the active-search legend use the same key/description palette', async () => {
|
|
1190
1452
|
const theme = recordingTheme();
|
|
1191
1453
|
const { view } = await opened({ theme });
|
|
1192
|
-
view.handleInput('
|
|
1454
|
+
view.handleInput('a');
|
|
1193
1455
|
const browse = view.render(WIDE).at(-2);
|
|
1194
1456
|
assert.match(browse, /\x1b\[1m\x1b\[96mpgUp\/pgDn\x1b\[0m\x1b\[22m\x1b\[90m page/, 'a compound key is ONE key run');
|
|
1195
1457
|
assert.match(browse, /\x1b\[1m\x1b\[96menter\x1b\[0m\x1b\[22m\x1b\[90m warp/, 'and its description is muted');
|
|
@@ -1214,23 +1476,21 @@ describe('S11: the shared palette', () => {
|
|
|
1214
1476
|
const theme = recordingTheme();
|
|
1215
1477
|
const { view } = await opened({ theme });
|
|
1216
1478
|
const lines = view.render(WIDE);
|
|
1217
|
-
assert.match(lines[0], /\x1b\[1m\x1b\[33mWarp\x1b\[0m\x1b\[22m/,
|
|
1218
|
-
'the frame title is the Agents view title role, bold');
|
|
1479
|
+
assert.match(lines[0], /\x1b\[1m\x1b\[33mWarp · 3 worktrees\x1b\[0m\x1b\[22m/,
|
|
1480
|
+
'the frame title is the Agents view title role, bold, count included');
|
|
1219
1481
|
assert.ok(!theme.calls.some((call) => call.role === 'accent' && call.text === 'Warp'),
|
|
1220
1482
|
'the title never takes the button accent');
|
|
1221
1483
|
assert.match(lines[0], /\x1b\[1m\x1b\[96mesc\x1b\[0m\x1b\[22m/, 'the close hint in the header is painted as a key');
|
|
1222
1484
|
assert.match(lines[0], /\x1b\[34m╭─\x1b\[0m/, 'the frame rule keeps the border role');
|
|
1223
|
-
assert.match(lines[1], /\x1b\[
|
|
1224
|
-
assert.
|
|
1225
|
-
assert.ok(
|
|
1226
|
-
assert.match(lines[2], /\x1b\[90mbranch feat\/alpha/, 'the facts line is muted');
|
|
1227
|
-
assert.match(lines.at(-3), /\x1b\[90mbranch feat\/alpha/, 'so is the focused worktree line');
|
|
1485
|
+
assert.match(lines[1], /\x1b\[90mbranch feat\/alpha/, 'the current checkout\'s facts line is muted');
|
|
1486
|
+
assert.match(lines[2], /\x1b\[90mbranch feat\/alpha/, 'so is the focused checkout\'s line');
|
|
1487
|
+
assert.ok(!lines.slice(1, 3).some((line) => /feat-odd-viewer/.test(line)), 'S19: no name line is painted at all');
|
|
1228
1488
|
});
|
|
1229
1489
|
|
|
1230
1490
|
test('the list page row paints its label dim, the page value as ordinary text and the total muted', async () => {
|
|
1231
1491
|
const theme = recordingTheme();
|
|
1232
1492
|
const { view } = await opened({ theme, rows: 20 });
|
|
1233
|
-
view.handleInput('
|
|
1493
|
+
view.handleInput('a');
|
|
1234
1494
|
const pageRow = view.render(WIDE).at(-3);
|
|
1235
1495
|
assert.match(pageRow, /\x1b\[2mpage \x1b\[0m/, 'the `page` label is dim');
|
|
1236
1496
|
assert.match(pageRow, /\x1b\[39m1\/1\x1b\[0m/, 'the page number is ordinary text');
|
|
@@ -1240,7 +1500,7 @@ describe('S11: the shared palette', () => {
|
|
|
1240
1500
|
test('the search row paints its static label dim and the live query as ordinary text', async () => {
|
|
1241
1501
|
const theme = recordingTheme();
|
|
1242
1502
|
const { view } = await opened({ theme });
|
|
1243
|
-
view.handleInput('
|
|
1503
|
+
view.handleInput('a');
|
|
1244
1504
|
const idle = view.render(WIDE)[1];
|
|
1245
1505
|
assert.match(idle, /\x1b\[2mfilter: \x1b\[0m\x1b\[90mtype to search/, 'the idle hint is dim/muted, never accent');
|
|
1246
1506
|
view.handleInput('a');
|
|
@@ -1259,11 +1519,11 @@ describe('S11: the shared palette', () => {
|
|
|
1259
1519
|
};
|
|
1260
1520
|
const { view } = await opened({ theme: hostile });
|
|
1261
1521
|
const { lines, rows } = screen(view, WIDE);
|
|
1262
|
-
assert.match(lines[0], /^╭─ Warp ─+ esc ─╮$/, 'the title line still renders without colour');
|
|
1522
|
+
assert.match(lines[0], /^╭─ Warp · 3 worktrees ─+ esc ─╮$/, 'the title line still renders without colour');
|
|
1263
1523
|
assert.match(rows[rows.length - 2], /↑↓ move · enter choose · c create · ctrl\+d delete · r reload · esc close/,
|
|
1264
1524
|
'the legend still spells every key and its words');
|
|
1265
1525
|
assert.equal(rows[4], '▸ main · use the local project', 'the focus marker survives monochrome');
|
|
1266
|
-
view.handleInput('
|
|
1526
|
+
view.handleInput('a');
|
|
1267
1527
|
assert.match(screen(view, WIDE).rows.at(-2), /pgUp\/pgDn page/, 'the list legend survives too');
|
|
1268
1528
|
});
|
|
1269
1529
|
});
|
|
@@ -1291,13 +1551,17 @@ describe('the current checkout is never a destination', () => {
|
|
|
1291
1551
|
});
|
|
1292
1552
|
return {
|
|
1293
1553
|
dir,
|
|
1554
|
+
// S20: the checkouts this package creates live under
|
|
1555
|
+
// `<repo-name>-worktrees`, so a real workspace keeps them there and the
|
|
1556
|
+
// panel's listing is what these tests exercise.
|
|
1294
1557
|
checkout(name) {
|
|
1295
|
-
const full = path.join(dir, name);
|
|
1296
|
-
fs.mkdirSync(full);
|
|
1558
|
+
const full = path.join(dir, 'herdr-worktrees', name);
|
|
1559
|
+
fs.mkdirSync(full, { recursive: true });
|
|
1297
1560
|
return full;
|
|
1298
1561
|
},
|
|
1299
1562
|
alias(name, target) {
|
|
1300
|
-
const full = path.join(dir, name);
|
|
1563
|
+
const full = path.join(dir, 'herdr-worktrees', name);
|
|
1564
|
+
fs.mkdirSync(path.dirname(full), { recursive: true });
|
|
1301
1565
|
fs.symlinkSync(target, full);
|
|
1302
1566
|
return full;
|
|
1303
1567
|
},
|
|
@@ -1318,7 +1582,7 @@ describe('the current checkout is never a destination', () => {
|
|
|
1318
1582
|
current: { name: 'feat-alpha', path: feat },
|
|
1319
1583
|
canonicalPath: realpath,
|
|
1320
1584
|
});
|
|
1321
|
-
view.handleInput('
|
|
1585
|
+
view.handleInput('a');
|
|
1322
1586
|
const { lines, rows } = screen(view);
|
|
1323
1587
|
assertWidth(lines);
|
|
1324
1588
|
assert.equal(rows[2], '▸ principal · use the local project', 'the principal still leads the destinations');
|
|
@@ -1342,7 +1606,7 @@ describe('the current checkout is never a destination', () => {
|
|
|
1342
1606
|
current: { name: 'feat-alpha', path: feat },
|
|
1343
1607
|
canonicalPath: realpath,
|
|
1344
1608
|
});
|
|
1345
|
-
listedByAlias.view.handleInput('
|
|
1609
|
+
listedByAlias.view.handleInput('a');
|
|
1346
1610
|
assert.ok(!screen(listedByAlias.view).rows.join('\n').includes('alias-alpha'),
|
|
1347
1611
|
'the alias of the current checkout is not a destination');
|
|
1348
1612
|
assert.equal(screen(listedByAlias.view).rows[17], 'page 1/1 · 1 worktree');
|
|
@@ -1355,7 +1619,7 @@ describe('the current checkout is never a destination', () => {
|
|
|
1355
1619
|
current: { name: 'alias-alpha', path: alias },
|
|
1356
1620
|
canonicalPath: realpath,
|
|
1357
1621
|
});
|
|
1358
|
-
listedByReal.view.handleInput('
|
|
1622
|
+
listedByReal.view.handleInput('a');
|
|
1359
1623
|
assert.ok(!screen(listedByReal.view).rows.join('\n').includes('feat-alpha'),
|
|
1360
1624
|
'the real path is the same checkout as the alias the session stands on');
|
|
1361
1625
|
assert.equal(screen(listedByReal.view).rows[17], 'page 1/1 · 1 worktree');
|
|
@@ -1373,7 +1637,7 @@ describe('the current checkout is never a destination', () => {
|
|
|
1373
1637
|
current: { name: 'feat-x', path: feat },
|
|
1374
1638
|
canonicalPath: realpath,
|
|
1375
1639
|
});
|
|
1376
|
-
view.handleInput('
|
|
1640
|
+
view.handleInput('a');
|
|
1377
1641
|
const { rows } = screen(view);
|
|
1378
1642
|
assert.equal(rows[2], '▸ feat-x2', 'a shared name prefix is not the same checkout');
|
|
1379
1643
|
assert.equal(rows[3], '', 'and the current checkout itself is still absent');
|
|
@@ -1395,7 +1659,7 @@ describe('the current checkout is never a destination', () => {
|
|
|
1395
1659
|
});
|
|
1396
1660
|
const frame = panel(view, WIDE);
|
|
1397
1661
|
assert.deepEqual(frame.worktrees, ['▸ principal · use the local project'], 'the panel lists only the other checkout');
|
|
1398
|
-
assert.equal(frame.viewAll, null, '
|
|
1662
|
+
assert.equal(frame.viewAll, null, 'S20: no `view all worktrees` row exists at all');
|
|
1399
1663
|
assert.equal(frame.height, 8, 'the panel shrinks to its content');
|
|
1400
1664
|
});
|
|
1401
1665
|
|
|
@@ -1407,7 +1671,7 @@ describe('the current checkout is never a destination', () => {
|
|
|
1407
1671
|
current: { name: 'feat-alpha', path: feat },
|
|
1408
1672
|
canonicalPath: realpath,
|
|
1409
1673
|
});
|
|
1410
|
-
view.handleInput('
|
|
1674
|
+
view.handleInput('a');
|
|
1411
1675
|
const { lines, rows } = screen(view);
|
|
1412
1676
|
assertWidth(lines);
|
|
1413
1677
|
assert.equal(rows[2], '(no other worktrees)', 'the list explains itself instead of naming the current checkout');
|
|
@@ -1429,7 +1693,7 @@ describe('the current checkout is never a destination', () => {
|
|
|
1429
1693
|
current: { name: 'unknown', path: path.join(ws.dir, 'nowhere') },
|
|
1430
1694
|
canonicalPath: realpath,
|
|
1431
1695
|
});
|
|
1432
|
-
view.handleInput('
|
|
1696
|
+
view.handleInput('a');
|
|
1433
1697
|
const { rows } = screen(view);
|
|
1434
1698
|
assert.equal(rows[2], '▸ principal · use the local project');
|
|
1435
1699
|
assert.equal(rows[3], ' feat-alpha');
|
|
@@ -1453,7 +1717,7 @@ describe('the current checkout is never a destination', () => {
|
|
|
1453
1717
|
{ name: 'alias-alpha', path: alias, branch: 'feat/alpha' },
|
|
1454
1718
|
],
|
|
1455
1719
|
});
|
|
1456
|
-
view.handleInput('
|
|
1720
|
+
view.handleInput('a');
|
|
1457
1721
|
assert.ok(!screen(view).rows.join('\n').includes('alias-alpha'), 'the mount already excludes it');
|
|
1458
1722
|
view.handleInput('r');
|
|
1459
1723
|
await tick();
|