@firstpick/pi-package-webui 0.5.6 → 0.5.8
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 +3 -1
- package/bin/pi-webui.mjs +526 -28
- package/lib/git-worktrees.mjs +512 -0
- package/package.json +3 -3
- package/public/app.js +703 -118
- package/public/index.html +13 -7
- package/public/styles.css +365 -24
- package/tests/http-endpoints-harness.test.mjs +192 -1
- package/tests/mobile-static.test.mjs +52 -20
- package/tests/native-parity-harness.test.mjs +1 -1
- package/tests/native-parity.test.mjs +2 -2
- package/tests/streaming-ui-coupling.test.mjs +15 -4
- package/webui-rpc-helper.mjs +99 -1
- /package/{dev/docs → lib}/WEBUI_TUI_NATIVE_PARITY.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { spawn, spawnSync } from "node:child_process";
|
|
3
|
-
import { chmod, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
3
|
+
import { chmod, mkdir, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
4
4
|
import { networkInterfaces, tmpdir } from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { setTimeout as delay } from "node:timers/promises";
|
|
@@ -182,6 +182,132 @@ try {
|
|
|
182
182
|
assert.equal(gitMain.status, 200);
|
|
183
183
|
assert.equal(gitMain.body?.ok, true, "main branch endpoint should rename the branch");
|
|
184
184
|
|
|
185
|
+
const initialWorktrees = await request("127.0.0.1", `/api/git-worktrees?tab=${encodeURIComponent(tabId)}`);
|
|
186
|
+
assert.equal(initialWorktrees.status, 200);
|
|
187
|
+
assert.equal(initialWorktrees.body?.ok, true, "worktree list endpoint should return data for a git repository");
|
|
188
|
+
assert.ok(initialWorktrees.body?.data?.worktrees?.some((worktree) => worktree.isMainWorktree && worktree.current), "worktree list should include the current main worktree");
|
|
189
|
+
|
|
190
|
+
await writeFile(path.join(cwd, "guided.txt"), "guided worktree flow\n");
|
|
191
|
+
runGitFixture(["add", "guided.txt"], cwd, "source checkout should stage guided workflow changes");
|
|
192
|
+
await mkdir(path.join(cwd, "dev", "COMMIT"), { recursive: true });
|
|
193
|
+
await writeFile(path.join(cwd, "dev", "COMMIT", "staged-commit-short.txt"), "feat: guided worktree branch\n");
|
|
194
|
+
await writeFile(path.join(cwd, "dev", "COMMIT", "staged-commit-long.txt"), "feat: guided worktree branch\n- feat: cover guided branch worktrees\n");
|
|
195
|
+
const guidedBranch = "feat/guided-worktree";
|
|
196
|
+
const guidedWorktree = await request("127.0.0.1", "/api/git-workflow/branch", {
|
|
197
|
+
method: "POST",
|
|
198
|
+
body: { tab: tabId, branch: guidedBranch, sessionMode: "empty", openTab: true },
|
|
199
|
+
timeoutMs: 20_000,
|
|
200
|
+
});
|
|
201
|
+
assert.equal(guidedWorktree.status, 200);
|
|
202
|
+
assert.equal(guidedWorktree.body?.ok, true, `guided branch worktree endpoint should return ok: ${guidedWorktree.body?.error || ""}`);
|
|
203
|
+
assert.equal(guidedWorktree.body?.data?.created, true, "guided branch flow should create a worktree instead of switching in place");
|
|
204
|
+
assert.equal(guidedWorktree.body?.data?.branch, guidedBranch);
|
|
205
|
+
assert.equal(guidedWorktree.body?.data?.carriedStagedChanges, true, "guided branch worktree should copy staged changes into the worktree index");
|
|
206
|
+
assert.ok(guidedWorktree.body?.data?.copiedMessageFiles?.includes("dev/COMMIT/staged-commit-short.txt"), "guided branch worktree should copy short commit message file");
|
|
207
|
+
assert.ok(guidedWorktree.body?.data?.copiedMessageFiles?.includes("dev/COMMIT/staged-commit-long.txt"), "guided branch worktree should copy long commit message file");
|
|
208
|
+
const guidedWorktreePath = guidedWorktree.body?.data?.worktree?.path || guidedWorktree.body?.data?.path;
|
|
209
|
+
const guidedWorktreeTabId = guidedWorktree.body?.data?.tab?.id;
|
|
210
|
+
assert.ok(guidedWorktreePath, "guided branch worktree response should include the worktree path");
|
|
211
|
+
assert.ok(guidedWorktreeTabId, "guided branch worktree should open a Web UI tab");
|
|
212
|
+
assert.equal(guidedWorktree.body?.data?.tab?.cwd, guidedWorktreePath, "guided worktree tab should be rooted at the worktree path");
|
|
213
|
+
assert.equal(guidedWorktree.body?.data?.tab?.gitWorkspace?.branch, guidedBranch, "guided worktree tab metadata should record the branch");
|
|
214
|
+
assert.equal(runGitFixture(["branch", "--show-current"], cwd, "source checkout should stay on main after guided worktree creation"), "main");
|
|
215
|
+
assert.match(runGitFixture(["status", "--short"], guidedWorktreePath, "guided worktree should have copied staged changes"), /^A guided\.txt/m);
|
|
216
|
+
const guidedCommit = await request("127.0.0.1", "/api/git-workflow/commit", { method: "POST", body: { variant: "short", tab: guidedWorktreeTabId }, timeoutMs: 20_000 });
|
|
217
|
+
assert.equal(guidedCommit.status, 200);
|
|
218
|
+
assert.equal(guidedCommit.body?.ok, true, "guided worktree tab should continue the commit flow with copied message files");
|
|
219
|
+
assert.equal(runGitFixture(["branch", "--show-current"], guidedWorktreePath, "guided worktree should remain on the PR branch"), guidedBranch);
|
|
220
|
+
const closeGuidedWorktreeTab = await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [guidedWorktreeTabId] }, timeoutMs: 10_000 });
|
|
221
|
+
assert.equal(closeGuidedWorktreeTab.status, 200);
|
|
222
|
+
assert.equal(closeGuidedWorktreeTab.body?.ok, true, "guided worktree tab should close before cleanup");
|
|
223
|
+
const removeGuidedWorktree = await request("127.0.0.1", "/api/git-worktrees", { method: "DELETE", body: { tab: tabId, path: guidedWorktreePath, confirmed: true, force: true }, timeoutMs: 20_000 });
|
|
224
|
+
assert.equal(removeGuidedWorktree.status, 200);
|
|
225
|
+
assert.equal(removeGuidedWorktree.body?.ok, true, "guided worktree should be removable after the tab is closed");
|
|
226
|
+
runGitFixture(["reset", "--hard"], cwd, "source checkout should clean staged guided workflow fixture changes");
|
|
227
|
+
await rm(path.join(cwd, "dev"), { recursive: true, force: true });
|
|
228
|
+
|
|
229
|
+
const worktreeBranch = "feat/http-worktree";
|
|
230
|
+
const createWorktree = await request("127.0.0.1", "/api/git-worktrees", {
|
|
231
|
+
method: "POST",
|
|
232
|
+
body: { tab: tabId, branchName: worktreeBranch, sessionMode: "empty", openTab: true },
|
|
233
|
+
timeoutMs: 20_000,
|
|
234
|
+
});
|
|
235
|
+
assert.equal(createWorktree.status, 200);
|
|
236
|
+
assert.equal(createWorktree.body?.ok, true, `worktree create endpoint should return ok: ${createWorktree.body?.error || ""}`);
|
|
237
|
+
assert.equal(createWorktree.body?.data?.created, true, "creating a new branch worktree should report created=true");
|
|
238
|
+
assert.equal(createWorktree.body?.data?.branch, worktreeBranch);
|
|
239
|
+
const worktreePath = createWorktree.body?.data?.worktree?.path || createWorktree.body?.data?.path;
|
|
240
|
+
const worktreeTabId = createWorktree.body?.data?.tab?.id;
|
|
241
|
+
assert.ok(worktreePath, "created worktree response should include a worktree path");
|
|
242
|
+
assert.ok(worktreeTabId, "creating a branch worktree should open a tab by default");
|
|
243
|
+
assert.equal(createWorktree.body?.data?.tab?.cwd, worktreePath, "opened worktree tab should be rooted at the worktree path");
|
|
244
|
+
assert.equal(createWorktree.body?.data?.tab?.gitWorkspace?.branch, worktreeBranch, "opened tab metadata should record the worktree branch");
|
|
245
|
+
assert.equal(createWorktree.body?.data?.tab?.gitWorkspace?.worktreePath, worktreePath, "opened tab metadata should record the worktree path");
|
|
246
|
+
|
|
247
|
+
const branchesWithWorktree = await request("127.0.0.1", `/api/git-branches?tab=${encodeURIComponent(tabId)}`);
|
|
248
|
+
assert.equal(branchesWithWorktree.status, 200);
|
|
249
|
+
assert.equal(branchesWithWorktree.body?.ok, true, "git branch list should still load after creating a worktree");
|
|
250
|
+
const occupiedBranch = branchesWithWorktree.body?.data?.branches?.find((branch) => branch.name === worktreeBranch);
|
|
251
|
+
assert.equal(occupiedBranch?.occupied, true, "branch list should mark branches checked out in a worktree");
|
|
252
|
+
assert.equal(occupiedBranch?.worktreePath, worktreePath, "branch list should point occupied branches at their worktree");
|
|
253
|
+
assert.equal(occupiedBranch?.worktreeCurrent, false, "main checkout should see the new branch as checked out elsewhere");
|
|
254
|
+
assert.ok(branchesWithWorktree.body?.data?.occupiedBranches?.some((branch) => branch.branch === worktreeBranch && branch.path === worktreePath), "occupied branch summary should include the new worktree");
|
|
255
|
+
|
|
256
|
+
const occupiedSwitch = await request("127.0.0.1", "/api/git-branch", { method: "POST", body: { tab: tabId, branch: worktreeBranch } });
|
|
257
|
+
assert.equal(occupiedSwitch.status, 200);
|
|
258
|
+
assert.equal(occupiedSwitch.body?.ok, false, "switching to a branch checked out in another worktree should be refused");
|
|
259
|
+
assert.equal(occupiedSwitch.body?.code, "BRANCH_CHECKED_OUT_ELSEWHERE");
|
|
260
|
+
assert.match(String(occupiedSwitch.body?.error || ""), /Open that worktree instead/);
|
|
261
|
+
|
|
262
|
+
const duplicateWorktree = await request("127.0.0.1", "/api/git-worktrees", {
|
|
263
|
+
method: "POST",
|
|
264
|
+
body: { tab: tabId, branchName: worktreeBranch, sessionMode: "empty", openTab: true },
|
|
265
|
+
timeoutMs: 20_000,
|
|
266
|
+
});
|
|
267
|
+
assert.equal(duplicateWorktree.status, 200);
|
|
268
|
+
assert.equal(duplicateWorktree.body?.ok, true, "creating an already checked out branch should reuse the existing worktree");
|
|
269
|
+
assert.equal(duplicateWorktree.body?.data?.created, false);
|
|
270
|
+
assert.equal(duplicateWorktree.body?.data?.openedExisting, true);
|
|
271
|
+
assert.equal(duplicateWorktree.body?.data?.openedExistingTab, true, "already-open worktree tab should be reused");
|
|
272
|
+
assert.equal(duplicateWorktree.body?.data?.tab?.id, worktreeTabId);
|
|
273
|
+
|
|
274
|
+
const openedWorktree = await request("127.0.0.1", "/api/git-worktrees/open", {
|
|
275
|
+
method: "POST",
|
|
276
|
+
body: { tab: tabId, path: worktreePath, sessionMode: "empty", openTab: true },
|
|
277
|
+
timeoutMs: 20_000,
|
|
278
|
+
});
|
|
279
|
+
assert.equal(openedWorktree.status, 200);
|
|
280
|
+
assert.equal(openedWorktree.body?.ok, true, "opening an existing worktree should return ok");
|
|
281
|
+
assert.equal(openedWorktree.body?.data?.openedExistingTab, true, "opening an already-open worktree should reuse its tab");
|
|
282
|
+
assert.equal(openedWorktree.body?.data?.tab?.id, worktreeTabId);
|
|
283
|
+
|
|
284
|
+
const unconfirmedRemove = await request("127.0.0.1", "/api/git-worktrees", { method: "DELETE", body: { tab: tabId, path: worktreePath } });
|
|
285
|
+
assert.equal(unconfirmedRemove.status, 200);
|
|
286
|
+
assert.equal(unconfirmedRemove.body?.ok, false, "worktree removal should require explicit confirmation");
|
|
287
|
+
assert.match(String(unconfirmedRemove.body?.error || ""), /requires confirmed: true/);
|
|
288
|
+
|
|
289
|
+
const busyRemove = await request("127.0.0.1", "/api/git-worktrees", { method: "DELETE", body: { tab: tabId, path: worktreePath, confirmed: true } });
|
|
290
|
+
assert.equal(busyRemove.status, 200);
|
|
291
|
+
assert.equal(busyRemove.body?.ok, false, "worktree removal should be refused while a Web UI tab is open inside it");
|
|
292
|
+
assert.equal(busyRemove.body?.code, "WORKTREE_BUSY");
|
|
293
|
+
|
|
294
|
+
const closeWorktreeTab = await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [worktreeTabId] }, timeoutMs: 10_000 });
|
|
295
|
+
assert.equal(closeWorktreeTab.status, 200);
|
|
296
|
+
assert.equal(closeWorktreeTab.body?.ok, true, "worktree tab should close before removal");
|
|
297
|
+
assert.ok(closeWorktreeTab.body?.data?.closedIds?.includes(worktreeTabId), "close response should include the worktree tab id");
|
|
298
|
+
|
|
299
|
+
const removedWorktree = await request("127.0.0.1", "/api/git-worktrees", { method: "DELETE", body: { tab: tabId, path: worktreePath, confirmed: true }, timeoutMs: 20_000 });
|
|
300
|
+
assert.equal(removedWorktree.status, 200);
|
|
301
|
+
assert.equal(removedWorktree.body?.ok, true, `confirmed worktree removal should succeed: ${removedWorktree.body?.error || ""}`);
|
|
302
|
+
assert.equal(removedWorktree.body?.data?.removed, true);
|
|
303
|
+
assert.equal(removedWorktree.body?.data?.path, worktreePath);
|
|
304
|
+
|
|
305
|
+
const worktreesAfterRemoval = await request("127.0.0.1", `/api/git-worktrees?tab=${encodeURIComponent(tabId)}`);
|
|
306
|
+
assert.equal(worktreesAfterRemoval.status, 200);
|
|
307
|
+
assert.equal(worktreesAfterRemoval.body?.ok, true);
|
|
308
|
+
assert.equal(worktreesAfterRemoval.body?.data?.worktrees?.some((worktree) => worktree.path === worktreePath), false, "removed worktree should disappear from list output");
|
|
309
|
+
assert.equal(worktreesAfterRemoval.body?.data?.occupiedBranches?.some((branch) => branch.branch === worktreeBranch), false, "removed worktree should disappear from occupied branch output");
|
|
310
|
+
|
|
185
311
|
const remoteFixtureRoot = await mkdtemp(path.join(tmpdir(), "pi-webui-git-remote-"));
|
|
186
312
|
const remoteBare = path.join(remoteFixtureRoot, "origin.git");
|
|
187
313
|
const localRepo = path.join(remoteFixtureRoot, "local");
|
|
@@ -382,6 +508,65 @@ try {
|
|
|
382
508
|
assert.match(interactiveOutput, /# stdin sent \(5 chars\) and closed/, "app runner output should show that stdin was sent without echoing the input text itself");
|
|
383
509
|
await request("127.0.0.1", "/api/app-runner/clear", { method: "POST", body: { tab: tabId } });
|
|
384
510
|
|
|
511
|
+
const scriptVersion = spawnSync("script", ["--version"], { encoding: "utf8" });
|
|
512
|
+
const utilLinuxScriptAvailable = process.platform !== "win32" && scriptVersion.status === 0 && /util-linux/i.test(`${scriptVersion.stdout}\n${scriptVersion.stderr}`);
|
|
513
|
+
const bashAvailable = spawnSync("bash", ["--version"], { encoding: "utf8" }).status === 0;
|
|
514
|
+
if (utilLinuxScriptAvailable && bashAvailable) {
|
|
515
|
+
await mkdir(path.join(cwd, "qa"), { recursive: true });
|
|
516
|
+
await writeFile(path.join(cwd, "qa", "read-p-runner.sh"), [
|
|
517
|
+
"#!/usr/bin/env bash",
|
|
518
|
+
"set -euo pipefail",
|
|
519
|
+
"read -r -p 'choice? ' answer",
|
|
520
|
+
"printf 'selected:%s\\n' \"$answer\"",
|
|
521
|
+
"",
|
|
522
|
+
].join("\n"));
|
|
523
|
+
const savedReadPromptRunner = await request("127.0.0.1", "/api/app-runner-config", {
|
|
524
|
+
method: "POST",
|
|
525
|
+
body: { tab: tabId, runner: { label: "Read prompt bash", command: "bash", path: "qa/read-p-runner.sh" } },
|
|
526
|
+
timeoutMs: 10_000,
|
|
527
|
+
});
|
|
528
|
+
assert.equal(savedReadPromptRunner.status, 200, `saving a bash read -p runner should succeed: ${savedReadPromptRunner.body?.error || ""}`);
|
|
529
|
+
const readPromptRunner = savedReadPromptRunner.body?.data?.runners?.find((runner) => runner.custom === true && runner.label === "Read prompt bash");
|
|
530
|
+
assert.ok(readPromptRunner?.id, "bash read -p runner should appear in detected app runners");
|
|
531
|
+
const readPromptStart = await request("127.0.0.1", "/api/app-runner", {
|
|
532
|
+
method: "POST",
|
|
533
|
+
body: { tab: tabId, runnerId: readPromptRunner.id },
|
|
534
|
+
timeoutMs: 10_000,
|
|
535
|
+
});
|
|
536
|
+
assert.equal(readPromptStart.status, 200, `bash read -p runner start should return ok: ${readPromptStart.body?.error || ""}`);
|
|
537
|
+
assert.equal(readPromptStart.body?.data?.activeRun?.executionMode, "pty", "bash read -p runner should use the PTY-backed execution path when util-linux script is available");
|
|
538
|
+
let readPromptState = readPromptStart;
|
|
539
|
+
for (let attempt = 0; attempt < 50; attempt++) {
|
|
540
|
+
readPromptState = await request("127.0.0.1", `/api/app-runners?tab=${encodeURIComponent(tabId)}`, { timeoutMs: 5_000 });
|
|
541
|
+
const output = [
|
|
542
|
+
...(readPromptState.body?.data?.activeRun?.lines || []),
|
|
543
|
+
readPromptState.body?.data?.activeRun?.pendingLine || "",
|
|
544
|
+
].join("\n");
|
|
545
|
+
if (/choice\?/.test(output)) break;
|
|
546
|
+
await delay(100);
|
|
547
|
+
}
|
|
548
|
+
assert.match([
|
|
549
|
+
...(readPromptState.body?.data?.activeRun?.lines || []),
|
|
550
|
+
readPromptState.body?.data?.activeRun?.pendingLine || "",
|
|
551
|
+
].join("\n"), /choice\?/, "bash read -p prompts should be captured before a trailing newline");
|
|
552
|
+
const readPromptInput = await request("127.0.0.1", "/api/app-runner/input", {
|
|
553
|
+
method: "POST",
|
|
554
|
+
body: { tab: tabId, text: "alpha", closeStdin: true },
|
|
555
|
+
timeoutMs: 10_000,
|
|
556
|
+
});
|
|
557
|
+
assert.equal(readPromptInput.status, 200, `bash read -p runner input should be accepted: ${readPromptInput.body?.error || ""}`);
|
|
558
|
+
for (let attempt = 0; attempt < 50; attempt++) {
|
|
559
|
+
if (readPromptState.body?.data?.activeRun?.status && readPromptState.body.data.activeRun.status !== "running") break;
|
|
560
|
+
await delay(100);
|
|
561
|
+
readPromptState = await request("127.0.0.1", `/api/app-runners?tab=${encodeURIComponent(tabId)}`, { timeoutMs: 5_000 });
|
|
562
|
+
}
|
|
563
|
+
assert.equal(readPromptState.body?.data?.activeRun?.status, "done", "bash read -p runner should finish after stdin");
|
|
564
|
+
const readPromptOutput = (readPromptState.body?.data?.activeRun?.lines || []).join("\n");
|
|
565
|
+
assert.match(readPromptOutput, /selected:alpha/, "bash read -p runner should receive stdin from the app-runner input endpoint");
|
|
566
|
+
assert.doesNotMatch(readPromptOutput, /^alpha$/m, "PTY-backed app runner should not echo raw stdin into captured output");
|
|
567
|
+
await request("127.0.0.1", "/api/app-runner/clear", { method: "POST", body: { tab: tabId } });
|
|
568
|
+
}
|
|
569
|
+
|
|
385
570
|
await writeFile(path.join(cwd, ".pi-webui-runners.json"), `${JSON.stringify({
|
|
386
571
|
version: 1,
|
|
387
572
|
runners: [{ id: "broken-custom", label: "Broken custom", command: "definitely-missing-pi-webui-runner", path: "custom-runner.mjs" }],
|
|
@@ -456,6 +641,12 @@ try {
|
|
|
456
641
|
const remoteQr = await request(lan, "/api/network/qr");
|
|
457
642
|
assert.equal(remoteQr.status, 403, "remote QR generation must be localhost-only because it can embed the PIN");
|
|
458
643
|
|
|
644
|
+
const remoteWorktreeRemove = await request(lan, "/api/git-worktrees", {
|
|
645
|
+
method: "DELETE",
|
|
646
|
+
body: { path: path.join(cwd, "irrelevant-worktree"), confirmed: true, tab: tabId },
|
|
647
|
+
});
|
|
648
|
+
assert.equal(remoteWorktreeRemove.status, 403, "worktree removal must be localhost-only");
|
|
649
|
+
|
|
459
650
|
const enableAuth = await request("127.0.0.1", "/api/remote-auth/settings", { method: "POST", body: { enabled: true } });
|
|
460
651
|
assert.equal(enableAuth.status, 200, "localhost can enable remote PIN auth");
|
|
461
652
|
const pin = enableAuth.body?.data?.auth?.pin;
|
|
@@ -48,6 +48,7 @@ assert.match(html, /id="newTabButton"[\s\S]*aria-haspopup="menu"[\s\S]*aria-cont
|
|
|
48
48
|
assert.match(html, /id="newTabMenuPanel" class="terminal-new-tab-menu-panel composer-publish-menu-panel"/, "new-tab menu should reuse the shared composer dropdown panel");
|
|
49
49
|
assert.match(html, /id="newTabCurrentDirectoryButton" class="terminal-new-tab-menu-item composer-publish-menu-item"[\s\S]*<span>Current Directory<\/span>/, "new-tab menu should offer the active cwd");
|
|
50
50
|
assert.match(html, /id="newTabChooseDirectoryButton" class="terminal-new-tab-menu-item composer-publish-menu-item"[\s\S]*<span>Choose Directory<\/span>/, "new-tab menu should offer the cwd picker");
|
|
51
|
+
assert.match(html, /id="newTabWorktreeButton" class="terminal-new-tab-menu-item composer-publish-menu-item"[\s\S]*<span>Branch Worktree…<\/span>/, "new-tab menu should offer branch worktree tabs");
|
|
51
52
|
assert.match(html, /id="closeAllTabsButton"[\s\S]*?>Close all Tabs<\/button>/, "tab header should expose a top-right close-all tabs action");
|
|
52
53
|
assert.match(html, /id="sidePanelBackdrop"/, "mobile side panel needs an overlay/backdrop close target");
|
|
53
54
|
assert.match(html, /<strong class="side-panel-title">[\s\S]*Control Deck[\s\S]*id="webuiVersionBadge"[\s\S]*id="webuiDevBadge"/, "Control Deck title should expose Web UI version and dev badges");
|
|
@@ -75,6 +76,7 @@ assert.match(html, /id="pathPickerCreateButton"[^>]*>Create directory<\/button>/
|
|
|
75
76
|
assert.match(html, /id="pathPickerSearchInput"[^>]*type="search"[^>]*placeholder="Search current directory…"/, "cwd picker should expose a current-directory search box");
|
|
76
77
|
assert.match(html, /id="pathPickerClearSearchButton"[^>]*hidden[^>]*>Clear<\/button>/, "cwd picker should expose a clear-search action");
|
|
77
78
|
assert.match(html, /id="optionalFeaturesBox"/, "side panel should expose optional feature status and controls");
|
|
79
|
+
assert.match(html, /class="optional-features-description[\s\S]*href="https:\/\/github\.com\/Firstp1ck\/npm-packages\/issues\/new"[\s\S]*open a GitHub issue/, "optional features should link users to GitHub issues for additional feature requests");
|
|
78
80
|
assert.doesNotMatch(html, /id="btwOverlayDialog"/, "/btw should not use a blocking modal overlay");
|
|
79
81
|
assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscription usage status");
|
|
80
82
|
assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
|
|
@@ -163,7 +165,7 @@ assert.doesNotMatch(html, /<code>\/release-(?:npm|aur)<\/code>/, "Publish menu s
|
|
|
163
165
|
assert.doesNotMatch(html, /data-tooltip="[^"]*\/release-(?:npm|aur)/, "Publish tooltip should not show slash command names");
|
|
164
166
|
assert.match(html, /id="steerButton"[\s\S]*?data-tooltip="Steer usage:/, "Steer should explain type-first usage in a tooltip");
|
|
165
167
|
assert.match(html, /id="followUpButton"[\s\S]*?data-tooltip="Follow-up usage:/, "Follow-up should explain type-first usage in a tooltip");
|
|
166
|
-
assert.match(html, /id="gitWorkflowButton"[\s\S]*?data-tooltip="Guided Git workflow:[\s\S]*Optional: create or type a PR branch[\s\S]*Push normally, or push the PR branch, generate\/review \/pr, and create the PR/, "Git workflow tooltip should describe the current commit-or-PR flow");
|
|
168
|
+
assert.match(html, /id="gitWorkflowButton"[\s\S]*?data-tooltip="Guided Git workflow:[\s\S]*Optional: create or type a PR branch worktree[\s\S]*Push normally, or push the PR worktree branch, generate\/review \/pr, and create the PR/, "Git workflow tooltip should describe the current commit-or-PR worktree flow");
|
|
167
169
|
assert.ok(
|
|
168
170
|
html.indexOf('<main class="layout">') < html.indexOf('id="sidePanelBackdrop"') &&
|
|
169
171
|
html.indexOf('id="sidePanelBackdrop"') < html.indexOf('id="sidePanel"'),
|
|
@@ -319,6 +321,8 @@ assert.match(css, /\.terminal-tab-group-close \{[\s\S]*?border-left-color/, "ter
|
|
|
319
321
|
assert.match(css, /body\.mobile-tabs-expanded \.terminal-tabs \{ display: flex; \}/, "mobile tabs should expand only when toggled");
|
|
320
322
|
assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\) \{[\s\S]*?\.terminal-tabs \{\n\s+position:\s*absolute;[\s\S]*?top:\s*calc\(100% \+ 0\.35rem\);[\s\S]*?overscroll-behavior:\s*contain;[\s\S]*?-webkit-overflow-scrolling:\s*touch;/, "expanded mobile tabs should overlay below the header with contained touch scrolling");
|
|
321
323
|
assert.match(css, /\.terminal-tab-activity-indicator/, "terminal tabs should expose per-tab agent activity indicators");
|
|
324
|
+
assert.match(css, /\.terminal-tab-app-runner-indicator \{[\s\S]*?terminal-tab-app-runner-pulse/, "terminal tabs should expose animated app-runner indicators");
|
|
325
|
+
assert.match(css, /\.terminal-tab\.app-runner-running,\n\.terminal-tab-group-item\.app-runner-running/, "terminal tabs and grouped items should mark running app runners");
|
|
322
326
|
assert.match(css, /\.terminal-tab-group-item \{[\s\S]*?flex:\s*0 0 auto[\s\S]*?background:\s*var\(--ctp-crust\)/, "grouped terminal tab items should keep readable height and use opaque backgrounds");
|
|
323
327
|
assert.match(css, /\.terminal-tab-group-add \{[\s\S]*?flex:\s*0 0 auto/, "grouped terminal tab menus should scroll instead of shrinking the add-tab action");
|
|
324
328
|
assert.match(css, /\.terminal-tab-group\.active \{[\s\S]*?background:[\s\S]*?var\(--ctp-crust\)/, "active terminal tab groups should keep opaque backgrounds");
|
|
@@ -601,7 +605,7 @@ assert.match(app, /function ensureFooterTooltipNode\(\)[\s\S]*footer-floating-to
|
|
|
601
605
|
const footerTooltipSource = app.match(/function applyFooterTooltip\(node, tooltip, options = \{\}\)[\s\S]*?\n}\n\nfunction footerMetric/)?.[0] || "";
|
|
602
606
|
assert.ok(footerTooltipSource, "git footer tooltip application source should be inspectable");
|
|
603
607
|
assert.doesNotMatch(footerTooltipSource, /node\.title/, "git footer tooltips should not set native title tooltips in addition to the styled tooltip");
|
|
604
|
-
assert.match(app, /const GIT_FOOTER_TOOLTIP_COPY = \{[\s\S]*tokens:[\s\S]*cache:[\s\S]*pi:[\s\S]*speed:[\s\S]*cost:[\s\S]*context:[\s\S]*cwd:[\s\S]*git:[\s\S]*"git-state":[\s\S]*sync:[\s\S]*changes:[\s\S]*"git-extra":[\s\S]*model:[\s\S]*thinking:/, "git footer tooltips should explain each known extension footer box");
|
|
608
|
+
assert.match(app, /const GIT_FOOTER_TOOLTIP_COPY = \{[\s\S]*tokens:[\s\S]*cache:[\s\S]*pi:[\s\S]*speed:[\s\S]*cost:[\s\S]*context:[\s\S]*cwd:[\s\S]*git:[\s\S]*"git-state":[\s\S]*sync:[\s\S]*changes:[\s\S]*"git-extra":[\s\S]*worktree:[\s\S]*model:[\s\S]*thinking:/, "git footer tooltips should explain each known extension footer box including worktrees");
|
|
605
609
|
assert.match(app, /function gitFooterPayloadTooltip\(chip, options = \{\}\)[\s\S]*GIT_FOOTER_TOOLTIP_COPY\[key\][\s\S]*`Current: \$\{value\}`/, "git footer tooltips should combine explanations with the current chip value");
|
|
606
610
|
assert.match(app, /function isRedundantFooterTooltipTitle\(sourceTitle, chip, value\)[\s\S]*labels\.map\(\(label\) => `\$\{label\}: \$\{value\}`\)/, "git footer tooltips should suppress duplicate label/current title lines");
|
|
607
611
|
assert.match(app, /function gitFooterTooltipAlign\(chip\)[\s\S]*\["tokens", "cwd"\][\s\S]*return "start";[\s\S]*\["model", "thinking"\][\s\S]*return "end";/, "git footer tooltip alignment should keep edge boxes readable");
|
|
@@ -609,29 +613,43 @@ assert.match(app, /function renderGitFooterPayloadMetric\(chip\)[\s\S]*applyGitF
|
|
|
609
613
|
assert.match(app, /function applyFooterChangedFilesDropdown\(node, chip\)[\s\S]*chip\?\.key !== "changes"[\s\S]*footer-changes-with-files[\s\S]*footer-changed-files-popover/, "git footer changes chip should render a changed-files hover popover when files are present");
|
|
610
614
|
assert.match(app, /function insertChangedFilePathReference\(path\)[\s\S]*formatPathReference\(path\)[\s\S]*input\.focus\(\)/, "clicking changed files should insert an @path reference and focus the composer");
|
|
611
615
|
assert.match(app, /function renderGitFooterPayloadMeta\(chip, tab\)[\s\S]*options\.title = gitFooterPayloadTooltip\(chip, \{ action \}\)[\s\S]*footerMeta\(chip\.label, chip\.value, footerMetaClassForPayload\(chip\), options\)[\s\S]*applyFooterChangedFilesDropdown\(node, chip\)/, "git footer meta payload chips should render as styled metadata with explanatory tooltips and changes popovers");
|
|
612
|
-
assert.match(app, /chip\.key === "git"[\s\S]*setFooterBranchPickerOpen\(!footerBranchPickerOpen\)[\s\S]*
|
|
613
|
-
assert.match(app, /
|
|
614
|
-
assert.match(app, /function
|
|
616
|
+
assert.match(app, /chip\.key === "git"[\s\S]*setFooterBranchPickerOpen\(!footerBranchPickerOpen\)[\s\S]*Worktree actions are the safe default for parallel work/, "git branch footer chip should open the worktree-aware branch picker");
|
|
617
|
+
assert.match(app, /chip\.key === "worktree"[\s\S]*setFooterBranchPickerOpen\(!footerBranchPickerOpen\)[\s\S]*Click to manage branch worktrees/, "worktree footer chip should open the branch worktree picker");
|
|
618
|
+
assert.match(app, /function footerPayloadWithLiveModel\(payload\)[\s\S]*const worktreeLabel = gitWorkspaceBadgeLabel\(workspace\)[\s\S]*key: "worktree"/, "git footer payload should inject a live worktree chip from tab metadata");
|
|
619
|
+
assert.match(app, /function renderFooterBranchPicker\(\)[\s\S]*Git branches & worktrees[\s\S]*renderFooterWorktreeList\(state\)[\s\S]*renderFooterBranchOption\(branch, state\)/, "git branch picker should render branch worktree controls and local branch choices");
|
|
620
|
+
assert.match(app, /function renderFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*openFooterBranchOption\(branch, state\)[\s\S]*footer-branch-advanced-action[\s\S]*applyFooterGitBranch\(branch\.name\)/, "branch rows should prefer worktree open/create while keeping an advanced in-place switch action");
|
|
615
621
|
assert.match(app, /GIT_BRANCH_TYPE_SUGGESTIONS = \["feat", "fix", "change", "perf", "test", "chore", "refactor", "docs", "style", "build", "ci", "revert"\]/, "new branch creation should reuse the conventional type suggestions from /git-staged-msg");
|
|
616
|
-
assert.match(app, /function renderFooterBranchCreateForm\(state = footerBranchPickerState\)[\s\S]*footer-branch-create-dropdown-inputfield[\s\S]*footer-branch-type-suggestions[\s\S]*footer-branch-create-input-field[\s\S]*Create
|
|
622
|
+
assert.match(app, /function renderFooterBranchCreateForm\(state = footerBranchPickerState\)[\s\S]*footer-branch-create-dropdown-inputfield[\s\S]*footer-branch-type-suggestions[\s\S]*footer-branch-create-input-field[\s\S]*Create branch worktree/, "branch worktree creation should use a styled editable suggestions dropdown plus input field instead of a browser prompt");
|
|
617
623
|
assert.match(app, /let footerBranchCreateDraft = \{ type: "", name: "" \}/, "new branch creation should not default the editable type prefix to feat");
|
|
618
624
|
assert.match(app, /function footerBranchCreateType\(value = footerBranchCreateDraft\.type\) \{\n\s+return slugifyGitBranchPart\(value\);\n\}/, "branch type suggestions should not restrict or default custom user-entered prefixes");
|
|
619
625
|
assert.match(app, /const slash = make\("span", "footer-branch-create-slash", "\/"\)/, "branch creation should visibly separate the prefix and user input with a slash");
|
|
620
|
-
assert.match(app, /function
|
|
621
|
-
assert.match(app, /function footerBranchCreateTooltip\(branchName = footerBranchCreateName\(\)\)[\s\S]*A branch is a
|
|
626
|
+
assert.match(app, /function gitWorktreeCreateCommandDisplay\(branch, state = footerBranchPickerState\)[\s\S]*git worktree add -b[\s\S]*preview\.textContent = gitWorktreeCreateCommandDisplay\(branchName \|\| footerBranchCreatePreviewName\(\), state\)/, "branch worktree creation should show the live complete quoted git worktree command");
|
|
627
|
+
assert.match(app, /function footerBranchCreateTooltip\(branchName = footerBranchCreateName\(\), state = footerBranchPickerState\)[\s\S]*A branch worktree is a separate checkout for parallel changes\.[\s\S]*does not switch this tab's branch, commit, push, or delete anything[\s\S]*ignored dependencies such as node_modules or \.venv are not copied/, "create worktree button should have a detailed explanatory tooltip");
|
|
622
628
|
assert.match(app, /submitButton\.dataset\.tooltip = footerBranchCreateTooltip\(branchName\);[\s\S]*submitButton\.removeAttribute\("title"\)/, "create branch button should use the styled tooltip instead of a native title tooltip");
|
|
623
629
|
assert.match(css, /\.footer-branch-create-submit\[data-tooltip\]::after \{[\s\S]*?content:\s*attr\(data-tooltip\);[\s\S]*?white-space:\s*pre-wrap;[\s\S]*?overflow-wrap:\s*anywhere;/, "create branch button tooltip should be styled and support detailed multiline copy");
|
|
624
630
|
assert.match(app, /submitButton\.disabled = false;[\s\S]*submitButton\.classList\.toggle\("footer-branch-create-submit-disabled", submitDisabled\);[\s\S]*submitButton\.setAttribute\("aria-disabled", submitDisabled \? "true" : "false"\)/, "branch creation should use aria-disabled styling so the tooltip is not dimmed by disabled button opacity");
|
|
625
631
|
assert.match(css, /\.footer-branch-create-submit-disabled \{[\s\S]*?cursor:\s*not-allowed;[\s\S]*?color:\s*rgba\(166, 227, 161, 0\.58\);/, "greyed branch create button should use a class instead of disabled opacity");
|
|
626
|
-
assert.match(app, /Loading existing local branches…
|
|
632
|
+
assert.match(app, /Loading existing local branches and worktrees… Worktree creation is available once branch data loads\./, "branch picker loading copy should make clear that worktree creation is gated on branch metadata");
|
|
627
633
|
assert.match(css, /\.footer-model-picker\.footer-branch-picker \{[\s\S]*?overflow:\s*visible;[\s\S]*?max-height:\s*none;/, "branch picker should not force scrolling just to see the open type suggestions dropdown");
|
|
628
634
|
assert.match(css, /\.footer-branch-type-suggestions \{[\s\S]*?grid-template-columns:\s*repeat\(3,[\s\S]*?max-height:\s*none;[\s\S]*?overflow:\s*visible;/, "branch type suggestions should render as a styled multi-column dropdown without internal scrolling");
|
|
629
|
-
assert.match(
|
|
635
|
+
assert.match(css, /\.footer-branch-option-row \{[\s\S]*?grid-template-columns:\s*minmax\(0, 1fr\) auto/, "branch rows should lay out primary worktree action and advanced switch separately");
|
|
636
|
+
assert.match(css, /\.footer-branch-advanced-action:disabled \{[\s\S]*?cursor:\s*not-allowed/, "advanced branch switch action should visibly disable occupied branches");
|
|
637
|
+
assert.match(css, /\.footer-worktree \.footer-meta-value,[\s\S]*?\.footer-tui-worktree \{[\s\S]*?color:\s*var\(--ctp-green\)/, "worktree footer chips should have distinct green styling");
|
|
638
|
+
assert.match(css, /\.workspace-dashboard-action\.worktree \{[\s\S]*?color:\s*var\(--ctp-green\)/, "workspace dashboard should style the branch worktree action distinctly");
|
|
639
|
+
assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\)[\s\S]*api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, sessionMode: "fork-current", openTab: true \}/, "branch worktree creation should call the worktree create endpoint");
|
|
640
|
+
assert.match(app, /async function openFooterGitWorktree\(path,[\s\S]*api\("\/api\/git-worktrees\/open", \{ method: "POST", body: \{ path: worktreePath, sessionMode: "fork-current", openTab: true \}/, "existing worktree actions should call the worktree open endpoint");
|
|
641
|
+
assert.match(app, /elements\.newTabWorktreeButton\?\.addEventListener\("click", \(\) => openBranchWorktreePicker\(\)\)/, "new-tab menu branch worktree item should open the picker");
|
|
642
|
+
assert.match(app, /\{ kind: "Git", label: "Branch worktree"[\s\S]*openBranchWorktreePicker\(\)/, "command palette should include branch worktree actions");
|
|
643
|
+
assert.match(app, /dashboardAction\("Branch worktree", \(\) => openBranchWorktreePicker\(\), "worktree"\)/, "workspace dashboard should expose a branch worktree action");
|
|
644
|
+
assert.match(app, /async function createFooterGitBranch\(branch = footerBranchCreateName\(\)\)[\s\S]*confirmFooterGitBranchAction\(branchName, \{ create: true, requireConfirm: true/, "advanced in-place branch creation should still require confirmation before running git switch -c");
|
|
630
645
|
assert.match(app, /function footerBranchAgentWarningLines[\s\S]*WARNING:[\s\S]*still running or waiting for input in this Git working tree/, "branch create/switch confirmation should warn when an agent is active in the current git working tree");
|
|
631
646
|
assert.match(app, /if \(footerBranchPickerOpen\) elements\.statusBar\.append\(renderFooterBranchPicker\(\)\)/, "footer should append the branch picker above the status bar when open");
|
|
632
647
|
assert.match(server, /url\.pathname === "\/api\/git-branches"[\s\S]*readGitBranches\(tab\.cwd\)/, "server should expose local git branch listing for the footer picker");
|
|
633
|
-
assert.match(server, /url\.pathname === "\/api\/git-
|
|
634
|
-
assert.match(server, /
|
|
648
|
+
assert.match(server, /url\.pathname === "\/api\/git-worktrees" && req\.method === "POST"[\s\S]*createGitWorktreeTab\(tab, body\)/, "server should expose git worktree creation for branch tabs");
|
|
649
|
+
assert.match(server, /url\.pathname === "\/api\/git-worktrees\/open" && req\.method === "POST"[\s\S]*openExistingGitWorktreeTab\(tab, body\)/, "server should expose existing git worktree opening for branch tabs");
|
|
650
|
+
assert.match(server, /url\.pathname === "\/api\/git-worktrees" && req\.method === "DELETE"[\s\S]*requireLocalhost\(req, "Removing Git worktrees is only allowed from localhost"\)[\s\S]*removeGitWorktreeForTab\(tab, body\)/, "server should guard destructive git worktree removal behind localhost and confirmation");
|
|
651
|
+
assert.match(server, /url\.pathname === "\/api\/git-branch"[\s\S]*switchGitBranch\(tab\.cwd, body\.branch, \{ create: body\.create === true \}\)/, "server should expose advanced git branch switching and creation for the footer picker");
|
|
652
|
+
assert.match(server, /async function switchGitBranch[\s\S]*BRANCH_CHECKED_OUT_ELSEWHERE[\s\S]*const args = create \? \["switch", "-c", targetBranch\] : \["switch", targetBranch\]/, "server branch switching should refuse branches checked out in another worktree before git switch");
|
|
635
653
|
assert.match(app, /let latestStats = null/, "default footer should retain session stats for token and context display");
|
|
636
654
|
assert.match(app, /async function refreshStats\(tabContext = activeTabContext\(\)\)[\s\S]*api\("\/api\/stats"/, "default footer should fetch session stats");
|
|
637
655
|
assert.match(app, /function renderMinimalFooter\(\)[\s\S]*stats: fallbackFooterStats\(\)/, "minimal default footer should include token, cost, and context stats");
|
|
@@ -640,8 +658,11 @@ assert.match(app, /function footerStatsCostDisplay\(stats = latestStats\)[\s\S]*
|
|
|
640
658
|
assert.doesNotMatch(app, /Git footer status disabled/, "disabled git footer should show only the minimal footer metadata");
|
|
641
659
|
assert.doesNotMatch(app, /footerMeta\("runtime"/, "minimal Web UI footer should not render runtime metadata");
|
|
642
660
|
assert.match(app, /statusEntries\.has\(GIT_FOOTER_WEBUI_STATUS_KEY\)/, "optional feature detection should recognize the git-footer-status Web UI payload");
|
|
643
|
-
assert.match(app, /
|
|
644
|
-
assert.match(app, /function requestGitFooterWebuiPayload\(tabContext
|
|
661
|
+
assert.match(app, /function renderGitFooterRefreshButton\(\)[\s\S]*git-footer-refresh-button[\s\S]*triggerGitFooterRefreshFromButton\(\)/, "git footer should render a compact refresh button wired to the explicit refresh handler");
|
|
662
|
+
assert.match(app, /function triggerGitFooterRefreshFromButton\(\)[\s\S]*requestGitFooterWebuiPayload\(tabContext, \{ force: true, silent: false, allowDuringRun: true \}\)/, "git footer refresh button should force a visible /git-footer-refresh request even during active agent runs");
|
|
663
|
+
assert.doesNotMatch(app, /Git footer refresh is unavailable while Pi is busy\./, "explicit git footer refresh should not be blocked while the agent is running");
|
|
664
|
+
assert.match(app, /message: `\/\$\{refreshCommand\}\$\{silent \? " --webui-silent" : ""\}`/, "Web UI should quietly request the extension-owned footer payload when idle and omit --webui-silent for explicit refreshes");
|
|
665
|
+
assert.match(app, /function requestGitFooterWebuiPayload\(tabContext = activeTabContext\(\), \{ force = false, silent = true, allowDuringRun = false \} = \{\}\)[\s\S]*?!allowDuringRun && \(currentState\?\.isStreaming \|\| currentState\?\.isCompacting\)[\s\S]*?!force && statusEntries\.has\(GIT_FOOTER_WEBUI_STATUS_KEY\)/, "git footer payload refresh should support forced refresh even when a live payload already exists and only block busy runs by default");
|
|
645
666
|
assert.doesNotMatch(app, /function requestGitFooterWebuiPayload\([\s\S]*?statusEntries\.delete\(GIT_FOOTER_WEBUI_STATUS_KEY\)/, "forced git footer refreshes should keep the existing payload visible while the refresh runs");
|
|
646
667
|
assert.match(app, /function applyOptimisticModelSelection\(model, tabContext = activeTabContext\(\)\)[\s\S]*?currentState = \{ \.\.\.currentState, model: nextModel \}[\s\S]*?renderStatus\(\)[\s\S]*?requestGitFooterWebuiPayload\(tabContext, \{ force: true \}\)/, "model changes should update current state and footer immediately before async refreshes complete");
|
|
647
668
|
assert.match(app, /function gitFooterRelevantStateChanged\(previousState, nextState\)[\s\S]*?previousState\.thinkingLevel !== nextState\.thinkingLevel[\s\S]*?modelStateKey\(previousState\.model\) !== modelStateKey\(nextState\.model\)/, "state refresh should detect model and thinking changes that make the git footer payload stale");
|
|
@@ -703,10 +724,10 @@ assert.match(app, /const gitWorkflowsByTab = new Map\(\)/, "guided git workflow
|
|
|
703
724
|
assert.match(app, /function bindGitWorkflowToActiveTab\(\) \{\n\s+gitWorkflow = gitWorkflowForTab\(activeTabId\) \|\| createGitWorkflowState\(\);/, "guided git workflow should render only the active terminal tab's workflow state");
|
|
704
725
|
assert.match(app, /function setGitWorkflow\(patch, \{ tabId = activeTabId \} = \{\}\)[\s\S]*if \(tabId === activeTabId\) \{[\s\S]*renderGitWorkflow\(\);/, "guided git workflow should not render inactive terminal workflows globally");
|
|
705
726
|
assert.match(html, /id="gitPrDialog"[\s\S]*id="gitPrTitleInput"[\s\S]*id="gitPrBodyEditor"[\s\S]*id="gitPrCreateButton"/, "guided git workflow should expose a PR review dialog with title and body editing");
|
|
706
|
-
assert.match(app, /addGitWorkflowAction\("Create PR", \(\) => createGitPrBranch\(\), "primary", false, GIT_WORKFLOW_CREATE_PR_TOOLTIP\)/, "guided git workflow should offer a Create PR
|
|
707
|
-
assert.match(app, /const GIT_WORKFLOW_CREATE_PR_TOOLTIP = \[[\s\S]*"Create PR
|
|
708
|
-
assert.match(app, /const GIT_WORKFLOW_MANUAL_BRANCH_TOOLTIP = \[[\s\S]*"Manual PR
|
|
709
|
-
assert.match(app, /addGitWorkflowAction\("Manual
|
|
727
|
+
assert.match(app, /addGitWorkflowAction\("Create PR worktree", \(\) => createGitPrBranch\(\), "primary", false, GIT_WORKFLOW_CREATE_PR_TOOLTIP\)/, "guided git workflow should offer a Create PR worktree action after message generation");
|
|
728
|
+
assert.match(app, /const GIT_WORKFLOW_CREATE_PR_TOOLTIP = \[[\s\S]*"Create PR worktree:"[\s\S]*"1\. Ask Pi to generate a type\/feature-name branch from staged changes\."[\s\S]*"4\. Create or open a Git worktree for that branch instead of switching this checkout\."[\s\S]*"7\. Push and Create PR will push upstream, run \/pr, let you review, then run gh pr create\."/, "Create PR worktree should have an up-to-date step-by-step tooltip");
|
|
729
|
+
assert.match(app, /const GIT_WORKFLOW_MANUAL_BRANCH_TOOLTIP = \[[\s\S]*"Manual PR worktree:"[\s\S]*"1\. Skip agent branch-name generation\."[\s\S]*"4\. Create or open a Git worktree for that branch instead of switching this checkout\."[\s\S]*"7\. Push and Create PR will push upstream, run \/pr, let you review, then run gh pr create\."/, "Manual worktree should have an up-to-date step-by-step tooltip");
|
|
730
|
+
assert.match(app, /addGitWorkflowAction\("Manual worktree", \(\) => createGitPrBranchManually\(\), "", false, GIT_WORKFLOW_MANUAL_BRANCH_TOOLTIP\)/, "Manual worktree should render with its tooltip");
|
|
710
731
|
assert.match(app, /function renderGitWorkflowManualCommitInput\(\{ appendCommitButton = true \} = \{\}\)[\s\S]*git-workflow-message-input[\s\S]*Commit input[\s\S]*commitGitWorkflow\("input", tabId\)/, "Message stage should render a manual commit message input with a Commit input action");
|
|
711
732
|
assert.match(app, /gitWorkflow\.step === "generate"\) \{\n\s+const commitInputButton = renderGitWorkflowManualCommitInput\(\{ appendCommitButton: false \}\);[\s\S]*addGitWorkflowAction\("Preview current message files"[\s\S]*gitWorkflowActions\.append\(commitInputButton\)/, "Message process stage should place Commit input immediately after Preview current message files");
|
|
712
733
|
assert.match(app, /gitWorkflow\.step === "message"\) \{[\s\S]*const commitInputButton = renderGitWorkflowManualCommitInput\(\{ appendCommitButton: false \}\);[\s\S]*addGitWorkflowAction\("Regenerate"[\s\S]*gitWorkflowActions\.append\(commitInputButton\)/, "Commit choice stage should place Commit input immediately after Regenerate");
|
|
@@ -717,23 +738,34 @@ assert.match(css, /\.git-workflow-message-input-row \{[\s\S]*flex:\s*1 1 100%/,
|
|
|
717
738
|
assert.match(css, /\.git-workflow-actions button\[data-tooltip\]::after \{[\s\S]*content:\s*attr\(data-tooltip\)[\s\S]*white-space:\s*pre-line/, "guided git workflow action tooltips should render multiline step lists");
|
|
718
739
|
assert.match(app, /function gitBranchNamePromptMessage\(\)[\s\S]*hasAvailableCommand\("git-branch-name"\)[\s\S]*return "\/git-branch-name"/, "guided git workflow should ask the agent to generate PR branch names when the prompt is available");
|
|
719
740
|
assert.match(app, /async function loadGitWorkflowBranchName\([\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch-name"/, "guided git workflow should load generated agent branch names before branch creation");
|
|
720
|
-
assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch"/, "guided git workflow should confirm an agent-suggested branch before
|
|
741
|
+
assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*prompt\("New PR branch worktree name[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch", \{ body: \{ branch, sessionMode: "fork-current", openTab: true \}/, "guided git workflow should confirm an agent-suggested branch before opening its worktree");
|
|
742
|
+
assert.match(app, /function syncGitWorkflowWorktreeTabs\(result\)[\s\S]*Array\.isArray\(result\?\.tabs\)[\s\S]*applyTabMetadata\(result\.tab\)/, "guided git workflow should merge worktree tab metadata returned by the branch endpoint");
|
|
743
|
+
assert.match(app, /const targetTabId = result\.tab\?\.id[\s\S]*setGitWorkflow\(nextState, \{ tabId: targetTabId \}\)[\s\S]*switchTab\(targetTabId\)/, "guided git workflow should transfer PR state to the opened worktree tab");
|
|
721
744
|
assert.match(app, /addGitWorkflowAction\("Push and Create PR", \(\) => pushAndCreatePrGitWorkflow\(\), "primary", false\)/, "guided git workflow should replace push with Push and Create PR in PR mode");
|
|
722
745
|
assert.match(app, /async function runGitPrPrompt\(tabId = gitWorkflowActionTabId\(\), \{ prefixOutput = "" \} = \{\}\)[\s\S]*body: \{ message: "\/pr" \}/, "guided git workflow should generate PR descriptions with /pr");
|
|
723
746
|
assert.match(server, /case "\/api\/git-workflow\/branch-name":[\s\S]*readGitWorkflowBranchName\(cwd\)/, "server should expose generated branch-name file loading for the guided PR workflow");
|
|
724
|
-
assert.match(server, /case "\/api\/git-workflow\/branch":[\s\S]
|
|
747
|
+
assert.match(server, /case "\/api\/git-workflow\/branch":[\s\S]*createGitWorkflowBranchWorktree\(tab, body\)/, "server should route guided PR branch creation through worktree tabs");
|
|
748
|
+
assert.match(server, /async function createGitWorkflowBranchWorktree\(tab, body = \{\}\)[\s\S]*snapshotGitWorkflowBranchState\(root\)[\s\S]*applyGitWorkflowBranchStateToWorktree\(snapshot, worktreePath\)[\s\S]*openWorktreeResultForTab\(tab, createdResult/, "guided PR worktree creation should copy staged state before opening the worktree tab");
|
|
725
749
|
assert.match(server, /case "\/api\/git-workflow\/create-pr":[\s\S]*runGitHubWorkflowCommand\(\["pr", "create"/, "server should create PRs with the GitHub CLI after confirmation");
|
|
726
750
|
assert.doesNotMatch(app, /gitWorkflowVisibleTabId|Workflow belongs to/, "guided git workflow should not pin or show workflows outside their owning terminal tab");
|
|
727
751
|
assert.match(app, /function renderReleaseNpmOutputWidget\(\)/, "release-npm live output should use a specialized Web UI renderer");
|
|
728
752
|
assert.match(app, /async function refreshAppRunners\(tabContext = activeTabContext\(\)\)/, "frontend should load detected app runners for the active tab cwd");
|
|
729
753
|
assert.match(app, /function renderAppRunnerWidget\(\)/, "frontend should render app runner output in the shared top widget area");
|
|
754
|
+
assert.match(app, /function tabAppRunnerRunningRun\(tab\)[\s\S]*appRunnerIsRunning\(run\)/, "frontend should derive running app-runner state for terminal tab indicators");
|
|
755
|
+
assert.match(app, /function appendTerminalTabContent\(button, \{ title, indicator, meta, count = null, appRunnerRun = null \}\)[\s\S]*terminal-tab-app-runner-indicator/, "terminal tab content should render a visible app-runner badge");
|
|
756
|
+
assert.match(app, /function renderTerminalTabGroup\(group[\s\S]*tabGroupAppRunnerRunningRun\(groupTabs\)[\s\S]*app-runner-running/, "terminal tab groups should indicate when any child tab has a running app runner");
|
|
757
|
+
assert.match(server, /function tabMeta\(tab\)[\s\S]*appRunner: publicAppRunnerState\(tab\.appRunner\)/, "server should expose app-runner state in tab metadata for inactive tab indicators");
|
|
730
758
|
assert.match(app, /function renderAppRunnerInputForm\(run\)[\s\S]*app-runner-stdin-input[\s\S]*Send stdin/, "frontend should let running app runners receive line-oriented stdin");
|
|
759
|
+
assert.match(app, /function renderAppRunnerContextForm\(run\)[\s\S]*app-runner-context-lines-input[\s\S]*Add to context/, "frontend should let users choose how many app-runner output lines to add to agent context");
|
|
760
|
+
assert.match(app, /async function transferAppRunnerOutputToContext\(run, form\)[\s\S]*\/api\/app-runner\/context[\s\S]*scheduleRefreshMessages/, "frontend should submit selected app-runner output lines and refresh the transcript after context transfer");
|
|
731
761
|
assert.match(app, /function appRunnerFailureState\(runnerId, error[\s\S]*failed to start app runner/, "frontend should render visible app-runner start failures instead of only logging them");
|
|
732
762
|
assert.match(app, /appRunnerCustomFeedback[\s\S]*Custom app runner was not saved/, "custom app-runner save failures should be shown inline in the dialog");
|
|
733
763
|
assert.match(server, /function customAppRunnerUnavailableReason\(projectRoot, runner\)[\s\S]*Command is not available/, "server should explain why saved custom app runners are unavailable");
|
|
734
764
|
assert.match(server, /url\.pathname === "\/api\/app-runners" && req\.method === "GET"/, "server should expose detected app runners for the active tab cwd");
|
|
735
765
|
assert.match(server, /url\.pathname === "\/api\/app-runner" && req\.method === "POST"/, "server should start selected app runners directly");
|
|
736
766
|
assert.match(server, /url\.pathname === "\/api\/app-runner\/input" && req\.method === "POST"[\s\S]*sendAppRunnerInput/, "server should accept stdin for running app runners");
|
|
767
|
+
assert.match(server, /url\.pathname === "\/api\/app-runner\/context" && req\.method === "POST"[\s\S]*transferAppRunnerContext/, "server should expose app-runner output transfer into agent context");
|
|
768
|
+
assert.match(server, /function transferAppRunnerContext\(tab, body = \{\}\)[\s\S]*sendWebuiHelperCommand\(tab, "app-runner-context"[\s\S]*publicAppRunnerState\(run\)/, "server should send selected app-runner output lines through the Web UI helper as a custom context message");
|
|
737
769
|
assert.match(server, /function addGoRunner\(runners, cwd\)[\s\S]*Go\/Golang app entry/, "server should detect Go\/Golang app runners");
|
|
738
770
|
assert.match(server, /function addZigRunner\(runners, cwd\)[\s\S]*zig build run[\s\S]*zig run/, "server should detect Zig build and entry-file runners");
|
|
739
771
|
assert.match(server, /function addCppRunners\(runners, cwd\)[\s\S]*C\/C\+\+ CMake executable target[\s\S]*language: "C\+\+"/, "server should detect C\/C++ CMake and entry-file runners");
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "../lib/native-command-adapter.mjs";
|
|
29
29
|
|
|
30
30
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
31
|
-
const parity = JSON.parse(await readFile(join(root, "
|
|
31
|
+
const parity = JSON.parse(await readFile(join(root, "lib", "WEBUI_TUI_NATIVE_PARITY.json"), "utf8"));
|
|
32
32
|
|
|
33
33
|
const localReq = { socket: { remoteAddress: "127.0.0.1" } };
|
|
34
34
|
const remoteReq = { socket: { remoteAddress: "192.168.1.50" } };
|
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
|
|
6
6
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
7
|
const [parityRaw, server, app, pkgRaw] = await Promise.all([
|
|
8
|
-
readFile(join(root, "
|
|
8
|
+
readFile(join(root, "lib", "WEBUI_TUI_NATIVE_PARITY.json"), "utf8"),
|
|
9
9
|
readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
|
|
10
10
|
readFile(join(root, "public", "app.js"), "utf8"),
|
|
11
11
|
readFile(join(root, "package.json"), "utf8"),
|
|
@@ -185,7 +185,7 @@ assert.match(app, /let userBashQueuesByTab = new Map\(\)/, "frontend should trac
|
|
|
185
185
|
assert.match(app, /enqueueUserBashCommand\(parsed, \{ usesPromptInput, targetTabId \}\)/, "user bash should enqueue while an active or queued bash command exists");
|
|
186
186
|
assert.match(server, /function sendQueuedBashCommand\(tab, command\)/, "server should serialize user bash commands per tab");
|
|
187
187
|
assert.match(server, /command\.type === "bash"[\s\S]*?await sendQueuedBashCommand\(tab, command\)[\s\S]*?: await tab\.rpc\.send\(command\)/, "generic POST handling should route bash through the FIFO queue");
|
|
188
|
-
assert.ok(pkg.files.includes("
|
|
188
|
+
assert.ok(pkg.files.includes("lib/WEBUI_TUI_NATIVE_PARITY.json"), "published package should include the native parity matrix");
|
|
189
189
|
assert.ok(pkg.files.includes("lib"), "published package should include shared Web UI foundation modules");
|
|
190
190
|
assert.ok(pkg.files.includes("webui-rpc-helper.mjs"), "published package should include the Web UI RPC helper extension");
|
|
191
191
|
|
|
@@ -4,9 +4,18 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
6
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const app = await readFile(join(root, "public", "app.js"), "utf8");
|
|
8
|
+
|
|
9
|
+
const SELF_CONTAINED_THEORY_TITLES = new Map([
|
|
10
|
+
[0, "Live todo-progress widget rebuild"],
|
|
11
|
+
[1, "scrollChatToBottom"],
|
|
12
|
+
[2, "O(n²) re-parse"],
|
|
13
|
+
[3, "markdown re-render fallback"],
|
|
14
|
+
[4, "setRunIndicatorActivity"],
|
|
15
|
+
[5, "ingestEventTabActivity"],
|
|
16
|
+
[6, "markTabOutputSeen"],
|
|
17
|
+
[7, "Skill / auto-retry tracking"],
|
|
18
|
+
[8, "steer prompt"],
|
|
10
19
|
]);
|
|
11
20
|
|
|
12
21
|
function findFunctionBody(source, name) {
|
|
@@ -48,7 +57,9 @@ function findCaseBody(source, caseLabel) {
|
|
|
48
57
|
}
|
|
49
58
|
|
|
50
59
|
function assertDocTheory(id, titleFragment) {
|
|
51
|
-
|
|
60
|
+
const title = SELF_CONTAINED_THEORY_TITLES.get(id);
|
|
61
|
+
assert.ok(title, `self-contained theory ${id} should be listed`);
|
|
62
|
+
assert.match(title, new RegExp(titleFragment), `self-contained theory ${id} should include: ${titleFragment}`);
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
const futureFailures = [];
|