@firstpick/pi-package-webui 0.5.5 → 0.5.7
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 +477 -13
- package/lib/git-worktrees.mjs +512 -0
- package/package.json +4 -4
- package/public/app.js +1160 -197
- package/public/index.html +13 -7
- package/public/styles.css +355 -20
- package/tests/http-endpoints-harness.test.mjs +133 -1
- package/tests/mobile-static.test.mjs +74 -32
- package/tests/native-parity-harness.test.mjs +1 -1
- package/tests/native-parity.test.mjs +2 -2
- package/tests/streaming-ui-coupling.test.mjs +186 -0
- 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");
|
|
@@ -456,6 +582,12 @@ try {
|
|
|
456
582
|
const remoteQr = await request(lan, "/api/network/qr");
|
|
457
583
|
assert.equal(remoteQr.status, 403, "remote QR generation must be localhost-only because it can embed the PIN");
|
|
458
584
|
|
|
585
|
+
const remoteWorktreeRemove = await request(lan, "/api/git-worktrees", {
|
|
586
|
+
method: "DELETE",
|
|
587
|
+
body: { path: path.join(cwd, "irrelevant-worktree"), confirmed: true, tab: tabId },
|
|
588
|
+
});
|
|
589
|
+
assert.equal(remoteWorktreeRemove.status, 403, "worktree removal must be localhost-only");
|
|
590
|
+
|
|
459
591
|
const enableAuth = await request("127.0.0.1", "/api/remote-auth/settings", { method: "POST", body: { enabled: true } });
|
|
460
592
|
assert.equal(enableAuth.status, 200, "localhost can enable remote PIN auth");
|
|
461
593
|
const pin = enableAuth.body?.data?.auth?.pin;
|
|
@@ -31,7 +31,7 @@ const companionDependencies = {
|
|
|
31
31
|
"@firstpick/pi-extension-safety-guard": "^0.2.3",
|
|
32
32
|
"@firstpick/pi-extension-setup-skills": "^0.1.8",
|
|
33
33
|
"@firstpick/pi-extension-stats": "^0.2.6",
|
|
34
|
-
"@firstpick/pi-extension-todo-progress": "^0.2.
|
|
34
|
+
"@firstpick/pi-extension-todo-progress": "^0.2.5",
|
|
35
35
|
"@firstpick/pi-extension-tools": "^0.1.6",
|
|
36
36
|
"@firstpick/pi-prompts-git-pr": "^0.1.2",
|
|
37
37
|
"@firstpick/pi-themes-bundle": "^0.1.4",
|
|
@@ -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");
|
|
@@ -555,6 +559,9 @@ assert.match(app, /function parseTodoProgressWidget\(lines\)/, "todo-progress wi
|
|
|
555
559
|
assert.ok(app.includes("const goalLine = cleanLines.find((line) => /^Goal\\s*[::]/i.test(line));"), "todo-progress parser should preserve an optional Goal line from extension widget lines");
|
|
556
560
|
assert.ok(app.includes("if (todo.goal) summary.append(make(\"div\", \"todo-widget-goal\", `Goal: ${todo.goal}`));"), "todo-progress widget should display the goal above the progress header");
|
|
557
561
|
assert.match(app, /const todoProgressWidgetExpandedByTab = new Map\(\)/, "todo-progress expansion state should survive widget re-renders per tab");
|
|
562
|
+
assert.match(app, /const todoProgressSignatureByTab = new Map\(\)/, "todo-progress should track per-tab signatures to avoid unchanged re-renders");
|
|
563
|
+
assert.match(app, /function widgetRequestEquivalent\(a, b\)[\s\S]*?return a\.widgetLines\.every/, "todo-progress and generic widgets should no-op identical widget payloads");
|
|
564
|
+
assert.match(app, /todoProgressSignatureByTab\.get\(tabId\) === signature\) return false/, "live todo-progress sync should skip unchanged checklist signatures");
|
|
558
565
|
assert.match(app, /const node = make\("details", "widget todo-widget"\)/, "todo-progress widget should render collapsed by default as expandable details");
|
|
559
566
|
assert.match(app, /Optional feature detection intentionally checks loaded Pi capabilities/, "optional Web UI features should be detected through loaded capabilities, not package folders");
|
|
560
567
|
assert.match(app, /function resetOptionalFeatureAvailability\(\)/, "optional feature state should reset across active-tab and reload boundaries");
|
|
@@ -598,7 +605,7 @@ assert.match(app, /function ensureFooterTooltipNode\(\)[\s\S]*footer-floating-to
|
|
|
598
605
|
const footerTooltipSource = app.match(/function applyFooterTooltip\(node, tooltip, options = \{\}\)[\s\S]*?\n}\n\nfunction footerMetric/)?.[0] || "";
|
|
599
606
|
assert.ok(footerTooltipSource, "git footer tooltip application source should be inspectable");
|
|
600
607
|
assert.doesNotMatch(footerTooltipSource, /node\.title/, "git footer tooltips should not set native title tooltips in addition to the styled tooltip");
|
|
601
|
-
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");
|
|
602
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");
|
|
603
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");
|
|
604
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");
|
|
@@ -606,29 +613,43 @@ assert.match(app, /function renderGitFooterPayloadMetric\(chip\)[\s\S]*applyGitF
|
|
|
606
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");
|
|
607
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");
|
|
608
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");
|
|
609
|
-
assert.match(app, /chip\.key === "git"[\s\S]*setFooterBranchPickerOpen\(!footerBranchPickerOpen\)[\s\S]*
|
|
610
|
-
assert.match(app, /
|
|
611
|
-
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");
|
|
612
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");
|
|
613
|
-
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");
|
|
614
623
|
assert.match(app, /let footerBranchCreateDraft = \{ type: "", name: "" \}/, "new branch creation should not default the editable type prefix to feat");
|
|
615
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");
|
|
616
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");
|
|
617
|
-
assert.match(app, /function
|
|
618
|
-
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");
|
|
619
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");
|
|
620
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");
|
|
621
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");
|
|
622
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");
|
|
623
|
-
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");
|
|
624
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");
|
|
625
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");
|
|
626
|
-
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");
|
|
627
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");
|
|
628
646
|
assert.match(app, /if \(footerBranchPickerOpen\) elements\.statusBar\.append\(renderFooterBranchPicker\(\)\)/, "footer should append the branch picker above the status bar when open");
|
|
629
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");
|
|
630
|
-
assert.match(server, /url\.pathname === "\/api\/git-
|
|
631
|
-
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");
|
|
632
653
|
assert.match(app, /let latestStats = null/, "default footer should retain session stats for token and context display");
|
|
633
654
|
assert.match(app, /async function refreshStats\(tabContext = activeTabContext\(\)\)[\s\S]*api\("\/api\/stats"/, "default footer should fetch session stats");
|
|
634
655
|
assert.match(app, /function renderMinimalFooter\(\)[\s\S]*stats: fallbackFooterStats\(\)/, "minimal default footer should include token, cost, and context stats");
|
|
@@ -637,8 +658,11 @@ assert.match(app, /function footerStatsCostDisplay\(stats = latestStats\)[\s\S]*
|
|
|
637
658
|
assert.doesNotMatch(app, /Git footer status disabled/, "disabled git footer should show only the minimal footer metadata");
|
|
638
659
|
assert.doesNotMatch(app, /footerMeta\("runtime"/, "minimal Web UI footer should not render runtime metadata");
|
|
639
660
|
assert.match(app, /statusEntries\.has\(GIT_FOOTER_WEBUI_STATUS_KEY\)/, "optional feature detection should recognize the git-footer-status Web UI payload");
|
|
640
|
-
assert.match(app, /
|
|
641
|
-
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");
|
|
642
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");
|
|
643
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");
|
|
644
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");
|
|
@@ -700,10 +724,10 @@ assert.match(app, /const gitWorkflowsByTab = new Map\(\)/, "guided git workflow
|
|
|
700
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");
|
|
701
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");
|
|
702
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");
|
|
703
|
-
assert.match(app, /addGitWorkflowAction\("Create PR", \(\) => createGitPrBranch\(\), "primary", false, GIT_WORKFLOW_CREATE_PR_TOOLTIP\)/, "guided git workflow should offer a Create PR
|
|
704
|
-
assert.match(app, /const GIT_WORKFLOW_CREATE_PR_TOOLTIP = \[[\s\S]*"Create PR
|
|
705
|
-
assert.match(app, /const GIT_WORKFLOW_MANUAL_BRANCH_TOOLTIP = \[[\s\S]*"Manual PR
|
|
706
|
-
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");
|
|
707
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");
|
|
708
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");
|
|
709
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");
|
|
@@ -714,23 +738,34 @@ assert.match(css, /\.git-workflow-message-input-row \{[\s\S]*flex:\s*1 1 100%/,
|
|
|
714
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");
|
|
715
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");
|
|
716
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");
|
|
717
|
-
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");
|
|
718
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");
|
|
719
745
|
assert.match(app, /async function runGitPrPrompt\(tabId = gitWorkflowActionTabId\(\), \{ prefixOutput = "" \} = \{\}\)[\s\S]*body: \{ message: "\/pr" \}/, "guided git workflow should generate PR descriptions with /pr");
|
|
720
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");
|
|
721
|
-
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");
|
|
722
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");
|
|
723
750
|
assert.doesNotMatch(app, /gitWorkflowVisibleTabId|Workflow belongs to/, "guided git workflow should not pin or show workflows outside their owning terminal tab");
|
|
724
751
|
assert.match(app, /function renderReleaseNpmOutputWidget\(\)/, "release-npm live output should use a specialized Web UI renderer");
|
|
725
752
|
assert.match(app, /async function refreshAppRunners\(tabContext = activeTabContext\(\)\)/, "frontend should load detected app runners for the active tab cwd");
|
|
726
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");
|
|
727
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");
|
|
728
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");
|
|
729
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");
|
|
730
763
|
assert.match(server, /function customAppRunnerUnavailableReason\(projectRoot, runner\)[\s\S]*Command is not available/, "server should explain why saved custom app runners are unavailable");
|
|
731
764
|
assert.match(server, /url\.pathname === "\/api\/app-runners" && req\.method === "GET"/, "server should expose detected app runners for the active tab cwd");
|
|
732
765
|
assert.match(server, /url\.pathname === "\/api\/app-runner" && req\.method === "POST"/, "server should start selected app runners directly");
|
|
733
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");
|
|
734
769
|
assert.match(server, /function addGoRunner\(runners, cwd\)[\s\S]*Go\/Golang app entry/, "server should detect Go\/Golang app runners");
|
|
735
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");
|
|
736
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");
|
|
@@ -788,28 +823,32 @@ assert.match(app, /if \(isThinkingPart\) \{[\s\S]*?visibleThinkingText\(assistan
|
|
|
788
823
|
assert.match(app, /message\.role === "thinking"[\s\S]*?visibleThinkingText\(message\.thinking \|\| textFromContent\(message\.content\)\)[\s\S]*?if \(thinkingOutputVisible && thinkingText\) appendText\(body, thinkingText, "thinking-text"\);/, "thinking cards should suppress empty and provider no-thinking placeholder output");
|
|
789
824
|
assert.match(app, /function showStreamingThinking\(initialText = ""\)[\s\S]*?if \(initialText && !streamThinking\.textContent\) streamThinking\.textContent = initialText;/, "live thinking should not create a visible placeholder card before content arrives");
|
|
790
825
|
assert.match(app, /function setStreamingThinkingText\(text\)[\s\S]*?const thinking = visibleThinkingText\(text\);[\s\S]*?if \(!thinkingOutputVisible \|\| !thinking\) return false;[\s\S]*?return true;/, "live thinking text setters should ignore empty text instead of clearing or flashing the card");
|
|
791
|
-
assert.match(app, /function
|
|
826
|
+
assert.match(app, /function syncStreamingThinkingFromUpdate\(event, update, \{ placeholder = "" \} = \{\}\)[\s\S]*?return setStreamingThinkingText\(streamThinkingRawText \|\| placeholder\);/, "incremental thinking sync should only report success after setting visible thinking text");
|
|
792
827
|
assert.doesNotMatch(app, /text \|\| placeholder \|\| streamThinkingBubble/, "partial-message thinking sync should not clear an existing thinking card when a partial carries no visible thinking text");
|
|
793
828
|
assert.match(app, /if \(thinkingOutputVisible && delta && \(!synced \|\| !streamThinking\?\.textContent\)\) \{/, "live thinking delta fallback should require visible delta text before creating a card");
|
|
794
829
|
assert.match(app, /function thinkingDeltaText\(update\) \{[\s\S]*?return visibleThinkingText\(update\.delta \|\| update\.thinking \|\| update\.content \|\| ""\);/, "live thinking deltas should suppress provider no-thinking placeholders too");
|
|
795
830
|
assert.match(app, /const THINKING_VISIBILITY_STORAGE_KEY = "pi-webui-thinking-visible"/, "thinking visibility should persist in browser storage");
|
|
796
831
|
assert.match(app, /function setThinkingOutputVisible\(visible[\s\S]*renderAllMessages\(\{ preserveScroll: true \}\)/, "thinking visibility changes should immediately re-render the transcript");
|
|
797
832
|
assert.match(app, /function assistantStreamingMessage\(event\)/, "live streaming should read the authoritative partial assistant message from RPC events like the TUI");
|
|
798
|
-
assert.match(app, /
|
|
799
|
-
assert.match(app, /
|
|
833
|
+
assert.match(app, /function syncStreamingThinkingFromUpdate\(event, update[\s\S]*?const fallback = streamingThinkingTextFallback\(event\);[\s\S]*?setStreamThinkingRawText\(fallback\);[\s\S]*?return setStreamingThinkingText\(streamThinkingRawText \|\| placeholder\);/, "live thinking end should replace deltas with the final partial-message thinking content");
|
|
834
|
+
assert.match(app, /function setStreamRawText\(text\)[\s\S]*?streamRawText = nextText;[\s\S]*?resetStreamDerivedTextCache\(\);/, "live assistant text should synchronize from partial messages through a cache-aware setter");
|
|
800
835
|
assert.match(app, /const TODO_PROGRESS_LINE_REGEX = /, "frontend should recognize live todo progress lines that will be moved into the todo widget");
|
|
801
836
|
assert.match(app, /function stripTodoProgressLines\(text, \{ streaming = false \} = \{\}\)/, "live Assistant output should strip todo-progress lines before rendering final-output text");
|
|
802
837
|
assert.match(app, /function syncLiveTodoProgressWidgetFromText\(text, tabId = activeTabId\)/, "live Assistant checklist text should update the todo-progress widget before tool execution events");
|
|
803
|
-
assert.match(app, /
|
|
804
|
-
assert.match(app, /function renderStreamingAssistantText\(\)[\s\S]*?const
|
|
805
|
-
assert.match(app, /function syncStreamingThinkingFormat\(
|
|
806
|
-
assert.match(app, /const finalText = thinkingFormat\?\.hasThinkingFormat \?
|
|
838
|
+
assert.match(app, /scheduleLiveTodoProgressWidgetSync\(streamRawText, event\.tabId \|\| activeTabId\)/, "streaming assistant text should feed the live todo-progress widget through the coalesced sync scheduler");
|
|
839
|
+
assert.match(app, /function renderStreamingAssistantText\(\)[\s\S]*?const thinkingFormat = syncStreamingThinkingFormat\(\);[\s\S]*?const finalText = thinkingFormat\?\.hasThinkingFormat \? streamDerivedText\(\)\.finalText : streamRenderableAssistantText\(\);/, "streamed Assistant text should render cached derived output without directly rescanning raw stream text");
|
|
840
|
+
assert.match(app, /function syncStreamingThinkingFormat\(\)[\s\S]*?const parsed = streamDerivedText\(\)\.thinkingFormat;[\s\S]*?setStreamingThinkingText\(thinking\)/, "tagged <think> streaming output should update the live thinking card from cached parse state instead of flashing raw tags");
|
|
841
|
+
assert.match(app, /const finalText = thinkingFormat\?\.hasThinkingFormat \? streamDerivedText\(\)\.finalText : streamRenderableAssistantText\(\);/, "tagged <think> streaming output should render only final response text in the Assistant card");
|
|
807
842
|
assert.match(app, /const STREAM_OUTPUT_HIDE_DELAY_MS = 300/, "stream output hiding should be debounced to prevent rapid flicker");
|
|
808
843
|
assert.match(app, /const STREAM_OUTPUT_TOOLCALL_GUARD_MS = 220/, "live assistant text should be briefly guarded so pre-tool-call text can be suppressed");
|
|
809
844
|
assert.match(app, /function scheduleStreamBubbleHide\([\s\S]*?STREAM_OUTPUT_MIN_VISIBLE_MS/, "stream output cards should observe a minimum visible duration before hiding");
|
|
810
845
|
assert.match(app, /if \(finalText\) \{[\s\S]*?renderStreamingMarkdown\(streamText, finalText\);[\s\S]*?\} else \{\n\s+scheduleStreamBubbleHide\(\);/, "empty filtered stream output should schedule hide while visible stream output renders as Markdown");
|
|
811
|
-
assert.match(app, /
|
|
846
|
+
assert.match(app, /scheduleStreamingAssistantTextRender\(\{ immediate: !!\(streamToolCallSeen \|\| streamBubble\) \}\);/, "live assistant text should wait briefly before showing unless it is already visible or follows a tool call");
|
|
812
847
|
assert.match(app, /streamToolCallSeen = true;\n\s+suppressStreamingAssistantTextBeforeToolCall\(\);/, "tool-call starts should remove pending assistant text from the live transcript");
|
|
848
|
+
assert.match(app, /function renderStreamingToolCallCard\(\{ scroll = false \} = \{\}\)[\s\S]*?appendMessage\(message, \{ streaming: true \}\)[\s\S]*?streamToolCallText\.textContent !== displayText/, "live tool-call cards should render and update the arguments stream in place");
|
|
849
|
+
assert.match(app, /update\.type === "toolcall_delta"[\s\S]*?updateStreamingToolCallFromEvent\(event, \{ appendDelta: true \}\)[\s\S]*?Building tool call:/, "tool-call deltas should update visible streamed arguments instead of a static placeholder");
|
|
850
|
+
assert.match(app, /case "tool_execution_start":[\s\S]*?removeStreamingToolCallCard\(\)[\s\S]*?handleToolExecutionStart\(event\)/, "the streamed tool-call argument card should be removed when the real tool execution card starts");
|
|
851
|
+
assert.doesNotMatch(app, /Preparing tool call:/, "tool-call streaming should no longer show only the static preparing placeholder");
|
|
813
852
|
assert.match(app, /const created = appendMessage\(\{ role: "assistant", title: "final output"/, "live Assistant cards should be created only for final output text without a noisy Assistant label");
|
|
814
853
|
assert.match(app, /function renderMarkdownInto\(parent, text\)/, "assistant output should have a browser-native Markdown renderer");
|
|
815
854
|
assert.match(app, /safeMarkdownLinkHref\(url\)/, "Markdown links should be sanitized before rendering");
|
|
@@ -1129,13 +1168,16 @@ assert.match(server, /const EXTENSION_UI_BLOCKING_METHODS = new Set\(\["select",
|
|
|
1129
1168
|
assert.match(server, /function trackPendingExtensionUiRequest\(tab, event\)/, "server should track blocking extension UI requests per tab");
|
|
1130
1169
|
assert.match(server, /pendingExtensionUiRequests: new Map\(\)/, "new tabs should initialize pending extension UI request storage");
|
|
1131
1170
|
assert.match(server, /extensionStatuses: new Map\(\)/, "new tabs should initialize replayable extension status storage");
|
|
1171
|
+
assert.match(server, /extensionWidgets: new Map\(\)/, "new tabs should initialize replayable extension widget storage");
|
|
1132
1172
|
assert.match(server, /function rememberExtensionStatusEvent\(tab, event\)[\s\S]*event\.method !== "setStatus"[\s\S]*statuses\.set\(String\(event\.statusKey\), String\(event\.statusText\)\)/, "server should retain extension status events for reconnects");
|
|
1133
|
-
assert.match(server, /
|
|
1173
|
+
assert.match(server, /function rememberExtensionWidgetEvent\(tab, event\)[\s\S]*event\.method !== "setWidget"[\s\S]*widgets\.set\(String\(widgetKey\)/, "server should retain extension widget events for reconnects");
|
|
1174
|
+
assert.match(server, /rememberExtensionStatusEvent\(tab, scopedEvent\)[\s\S]*rememberExtensionWidgetEvent\(tab, scopedEvent\)[\s\S]*trackPendingExtensionUiRequest\(tab, scopedEvent\)/, "RPC events should retain extension statuses and widgets before broadcasting");
|
|
1134
1175
|
assert.match(server, /trackPendingExtensionUiRequest\(tab, scopedEvent\)/, "RPC events should populate pending extension UI storage before broadcasting");
|
|
1135
1176
|
assert.match(server, /scopedEvent = \{ \.\.\.scopedEvent,[\s\S]*?pendingExtensionUiRequestCount: pendingExtensionUiRequests\(tab\)\.length \}/, "RPC events should broadcast pending blocker counts for tab indicators");
|
|
1136
1177
|
assert.match(server, /function replayExtensionStatuses\(tab, res\)[\s\S]*method: "setStatus"/, "server should replay latest extension statuses on SSE reconnect");
|
|
1178
|
+
assert.match(server, /function replayExtensionWidgets\(tab, res\)[\s\S]*method: "setWidget"/, "server should replay latest extension widgets on SSE reconnect");
|
|
1137
1179
|
assert.match(server, /function replayPendingExtensionUiRequests\(tab, res\)/, "server should be able to replay missed extension UI requests on SSE reconnect");
|
|
1138
|
-
assert.match(server, /replayExtensionStatuses\(tab, res\);\n\s+replayPendingExtensionUiRequests\(tab, res\)/, "SSE connections should replay extension statuses before pending blockers");
|
|
1180
|
+
assert.match(server, /replayExtensionStatuses\(tab, res\);\n\s+replayExtensionWidgets\(tab, res\);\n\s+replayPendingExtensionUiRequests\(tab, res\)/, "SSE connections should replay extension statuses and widgets before pending blockers");
|
|
1139
1181
|
assert.match(server, /pendingExtensionUiRequests: pendingExtensionUiRequestSummaries\(tab\)/, "detailed Web UI status should expose pending extension UI blockers");
|
|
1140
1182
|
assert.match(server, /resolvePendingExtensionUiRequest\(tab, payload\.id\)/, "extension UI responses should clear the pending blocker cache");
|
|
1141
1183
|
assert.match(server, /type: "webui_extension_ui_resolved"[\s\S]*?pendingExtensionUiRequestCount/, "extension UI responses should notify clients that a blocker resolved");
|
|
@@ -1338,7 +1380,7 @@ assert.match(app, /pruneDisconnectedLiveToolCards\(\);/, "reconciliation must pr
|
|
|
1338
1380
|
// --- Performance: incremental streaming markdown (P0-3) ---
|
|
1339
1381
|
assert.match(app, /function streamingMarkdownStableBoundary\(text\)[\s\S]*?for \(let index = 0; index < lines\.length - 1; index \+= 1\)/, "streaming markdown boundary must never treat the final partial line as stable");
|
|
1340
1382
|
assert.match(app, /function renderStreamingMarkdown\(block, text\)[\s\S]*?if \(!text\.startsWith\(state\.stableText\)\)/, "streaming markdown must fall back to a full re-render when earlier content changes");
|
|
1341
|
-
assert.match(app, /streamRawText = "";\n streamMarkdownState = null;/, "resetting the stream bubble must clear incremental markdown state");
|
|
1383
|
+
assert.match(app, /streamRawText = "";\n streamThinkingRawText = "";\n resetStreamDerivedTextCache\(\);\n streamMarkdownState = null;/, "resetting the stream bubble must clear incremental markdown state and derived caches");
|
|
1342
1384
|
|
|
1343
1385
|
// --- Performance: delta transcript fetch (P1-1) ---
|
|
1344
1386
|
assert.match(app, /function mergeMessagesDelta\(previous, data\)[\s\S]*?messagesLookEqual\(previous\[since\], data\.messages\[0\]\)/, "delta merges must verify the one-message overlap before applying");
|
|
@@ -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
|
|