@firstpick/pi-package-webui 0.7.9 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/bin/pi-webui.mjs +316 -13
- package/lib/git-workflow-preferences.mjs +16 -0
- package/lib/git-worktrees.mjs +43 -4
- package/package.json +4 -2
- package/public/app.js +591 -76
- package/public/index.html +18 -4
- package/public/service-worker.js +1 -1
- package/public/styles.css +26 -0
- package/tests/boot-failure-diagnostics.test.mjs +2 -2
- package/tests/codex-fast-mode-static.test.mjs +56 -0
- package/tests/composer-skill-tag-layout.test.mjs +70 -0
- package/tests/fast-mode-client-static.test.mjs +8 -8
- package/tests/fixtures/fake-pi.mjs +41 -0
- package/tests/git-workflow-preferences.test.mjs +8 -0
- package/tests/guided-git-publication-backend-static.test.mjs +40 -0
- package/tests/http-endpoints-harness.test.mjs +262 -1
- package/tests/mobile-static.test.mjs +56 -5
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/side-panel-resize-static.test.mjs +8 -1
|
@@ -228,6 +228,26 @@ try {
|
|
|
228
228
|
assert.equal(health.body.piRunning, true, "fake pi RPC process should be attached and running");
|
|
229
229
|
assert.match(health.body.piVersion, /^\d+\.\d+\.\d+/, "health metadata should expose the installed Pi version");
|
|
230
230
|
|
|
231
|
+
const initialInterfacePreferences = await request("127.0.0.1", "/api/interface-preferences");
|
|
232
|
+
assert.equal(initialInterfacePreferences.status, 200);
|
|
233
|
+
assert.equal(initialInterfacePreferences.body?.data?.preferences?.sidePanelWidth, null, "a user without a saved width should receive the default preference");
|
|
234
|
+
assert.equal(Object.hasOwn(initialInterfacePreferences.body?.data || {}, "path"), false, "preference responses must not disclose the user's settings-file path");
|
|
235
|
+
const savedInterfacePreferences = await request("127.0.0.1", "/api/interface-preferences", {
|
|
236
|
+
method: "PUT",
|
|
237
|
+
body: { sidePanelWidth: 612.4 },
|
|
238
|
+
});
|
|
239
|
+
assert.equal(savedInterfacePreferences.status, 200);
|
|
240
|
+
assert.equal(savedInterfacePreferences.body?.data?.preferences?.sidePanelWidth, 612, "saved side-panel widths should be normalized to whole pixels");
|
|
241
|
+
assert.equal(JSON.parse(await readFile(settingsFile, "utf8")).interfacePreferences?.sidePanelWidth, 612, "the side-panel width should be saved in the private user settings file");
|
|
242
|
+
const reloadedInterfacePreferences = await request("127.0.0.1", "/api/interface-preferences");
|
|
243
|
+
assert.equal(reloadedInterfacePreferences.body?.data?.preferences?.sidePanelWidth, 612, "the saved width should survive subsequent user preference reads");
|
|
244
|
+
const invalidInterfacePreferences = await request("127.0.0.1", "/api/interface-preferences", {
|
|
245
|
+
method: "PUT",
|
|
246
|
+
body: { sidePanelWidth: 100 },
|
|
247
|
+
});
|
|
248
|
+
assert.equal(invalidInterfacePreferences.status, 400, "out-of-range side-panel widths should be rejected");
|
|
249
|
+
assert.equal((await request("127.0.0.1", "/api/interface-preferences")).body?.data?.preferences?.sidePanelWidth, 612, "invalid saves must preserve the last valid user width");
|
|
250
|
+
|
|
231
251
|
// Workflow policy setup is server-scoped: missing policy reads as canonical
|
|
232
252
|
// deny-default state without creating PI_CODING_AGENT_DIR or its policy file.
|
|
233
253
|
const missingWorkflowPolicy = await request("127.0.0.1", "/api/workflow-policy");
|
|
@@ -921,6 +941,39 @@ try {
|
|
|
921
941
|
assert.equal(gitMain.status, 200);
|
|
922
942
|
assert.equal(gitMain.body?.ok, true, "main branch endpoint should rename the branch");
|
|
923
943
|
|
|
944
|
+
const bypassPublish = await request("127.0.0.1", `/api/git-workflow/publish?tab=${encodeURIComponent(tabId)}`);
|
|
945
|
+
assert.equal(bypassPublish.status, 405, "GET /api/git-workflow/publish should be refused with 405");
|
|
946
|
+
|
|
947
|
+
const pushWithoutRemote = await request("127.0.0.1", "/api/git-workflow/push", { method: "POST", body: { tab: tabId } });
|
|
948
|
+
assert.equal(pushWithoutRemote.status, 200);
|
|
949
|
+
assert.equal(pushWithoutRemote.body?.ok, false, "push without a configured destination should fail closed");
|
|
950
|
+
assert.equal(pushWithoutRemote.body?.code, "NO_REMOTE", "remote-less push should have a stable recovery code");
|
|
951
|
+
assert.match(String(pushWithoutRemote.body?.hint || ""), /publish this repository|add a Git remote/i);
|
|
952
|
+
assert.match(String(pushWithoutRemote.body?.data?.stderr || ""), /No configured push destination/i, "classified failures should preserve process output");
|
|
953
|
+
|
|
954
|
+
const unconfirmedPublish = await request("127.0.0.1", "/api/git-workflow/publish", {
|
|
955
|
+
method: "POST",
|
|
956
|
+
body: { tab: tabId, repoName: "pi-webui-http-harness", visibility: "private" },
|
|
957
|
+
});
|
|
958
|
+
assert.equal(unconfirmedPublish.status, 200);
|
|
959
|
+
assert.equal(unconfirmedPublish.body?.ok, false, "publication should require exact server-side confirmation");
|
|
960
|
+
assert.match(String(unconfirmedPublish.body?.error || ""), /confirmed: true/);
|
|
961
|
+
|
|
962
|
+
const invalidVisibilityPublish = await request("127.0.0.1", "/api/git-workflow/publish", {
|
|
963
|
+
method: "POST",
|
|
964
|
+
body: { tab: tabId, repoName: "pi-webui-http-harness", visibility: "internal", confirmed: true },
|
|
965
|
+
});
|
|
966
|
+
assert.equal(invalidVisibilityPublish.body?.ok, false, "publication should reject visibility outside public/private");
|
|
967
|
+
assert.match(String(invalidVisibilityPublish.body?.error || ""), /visibility must be 'public' or 'private'/);
|
|
968
|
+
|
|
969
|
+
const invalidNamePublish = await request("127.0.0.1", "/api/git-workflow/publish", {
|
|
970
|
+
method: "POST",
|
|
971
|
+
body: { tab: tabId, repoName: "invalid repository name", visibility: "public", confirmed: true },
|
|
972
|
+
});
|
|
973
|
+
assert.equal(invalidNamePublish.body?.ok, false, "publication should reuse GitHub repository-name validation");
|
|
974
|
+
assert.match(String(invalidNamePublish.body?.error || ""), /Invalid GitHub repository name/);
|
|
975
|
+
assert.equal(runGitFixture(["remote"], cwd, "guarded publication requests must not configure a remote"), "");
|
|
976
|
+
|
|
924
977
|
const initialWorktrees = await request("127.0.0.1", `/api/git-worktrees?tab=${encodeURIComponent(tabId)}`);
|
|
925
978
|
assert.equal(initialWorktrees.status, 200);
|
|
926
979
|
assert.equal(initialWorktrees.body?.ok, true, "worktree list endpoint should return data for a git repository");
|
|
@@ -1095,12 +1148,156 @@ try {
|
|
|
1095
1148
|
await writeFile(path.join(remoteWork, "incoming.txt"), "base\nremote one\nremote two\n");
|
|
1096
1149
|
runGitFixture(["commit", "-am", "remote two"], remoteWork, "remote worktree should commit second incoming change");
|
|
1097
1150
|
runGitFixture(["push", "origin", "main"], remoteWork, "remote worktree should push incoming commits");
|
|
1098
|
-
|
|
1151
|
+
|
|
1152
|
+
const remoteOnlySwitchBranch = "feature/remote-only-switch";
|
|
1153
|
+
runGitFixture(["switch", "-c", remoteOnlySwitchBranch], remoteWork, "remote worktree should create the switch fixture branch");
|
|
1154
|
+
await writeFile(path.join(remoteWork, "remote-switch.txt"), "switch fixture\n");
|
|
1155
|
+
runGitFixture(["add", "remote-switch.txt"], remoteWork, "remote switch fixture should stage its marker");
|
|
1156
|
+
runGitFixture(["commit", "-m", "remote switch fixture"], remoteWork, "remote switch fixture should commit its marker");
|
|
1157
|
+
runGitFixture(["push", "-u", "origin", remoteOnlySwitchBranch], remoteWork, "remote switch fixture should push its branch");
|
|
1158
|
+
runGitFixture(["switch", "main"], remoteWork, "remote worktree should return to main after the switch fixture");
|
|
1159
|
+
|
|
1160
|
+
const remoteOnlyWorktreeBranch = "feature/remote-only-worktree";
|
|
1161
|
+
runGitFixture(["switch", "-c", remoteOnlyWorktreeBranch], remoteWork, "remote worktree should create the worktree fixture branch");
|
|
1162
|
+
await writeFile(path.join(remoteWork, "remote-worktree.txt"), "worktree fixture\n");
|
|
1163
|
+
runGitFixture(["add", "remote-worktree.txt"], remoteWork, "remote worktree fixture should stage its marker");
|
|
1164
|
+
runGitFixture(["commit", "-m", "remote worktree fixture"], remoteWork, "remote worktree fixture should commit its marker");
|
|
1165
|
+
runGitFixture(["push", "-u", "origin", remoteOnlyWorktreeBranch], remoteWork, "remote worktree fixture should push its branch");
|
|
1166
|
+
runGitFixture(["switch", "main"], remoteWork, "remote worktree should return to main after the worktree fixture");
|
|
1167
|
+
|
|
1168
|
+
const remoteOnlyCreateBranch = "feature/remote-only-create";
|
|
1169
|
+
runGitFixture(["branch", remoteOnlyCreateBranch], remoteWork, "remote worktree should create the local-create compatibility fixture branch");
|
|
1170
|
+
runGitFixture(["push", "origin", remoteOnlyCreateBranch], remoteWork, "remote create fixture should push its branch");
|
|
1171
|
+
const staleRemoteBranch = "feature/remote-only-stale";
|
|
1172
|
+
runGitFixture(["branch", staleRemoteBranch], remoteWork, "remote worktree should create the stale fixture branch");
|
|
1173
|
+
runGitFixture(["push", "origin", staleRemoteBranch], remoteWork, "remote stale fixture should push its branch");
|
|
1174
|
+
|
|
1175
|
+
runGitFixture(["remote", "add", "mirror", remoteBare], localRepo, "local repo should add a second configured remote for exact-ref coverage");
|
|
1176
|
+
runGitFixture(["remote", "add", "team/mirror", remoteBare], localRepo, "local repo should add a slash-named remote for exact local-name derivation coverage");
|
|
1099
1177
|
|
|
1100
1178
|
const remoteTab = await request("127.0.0.1", "/api/tabs", { method: "POST", body: { cwd: localRepo, title: "remote-behind-fixture" } });
|
|
1101
1179
|
assert.equal(remoteTab.status, 201);
|
|
1102
1180
|
const remoteTabId = remoteTab.body?.data?.tab?.id;
|
|
1103
1181
|
assert.ok(remoteTabId, "remote fixture tab should have an id");
|
|
1182
|
+
|
|
1183
|
+
const fetchedRemoteBranches = await request("127.0.0.1", "/api/git-fetch", { method: "POST", body: { tab: remoteTabId }, timeoutMs: 20_000 });
|
|
1184
|
+
assert.equal(fetchedRemoteBranches.status, 200);
|
|
1185
|
+
assert.equal(fetchedRemoteBranches.body?.ok, true, `git fetch --prune should reveal remote-only branches: ${fetchedRemoteBranches.body?.error || ""}`);
|
|
1186
|
+
runGitFixture(["fetch", "mirror"], localRepo, "remote fixture should fetch the second remote for exact-ref collision coverage");
|
|
1187
|
+
runGitFixture(["fetch", "team/mirror"], localRepo, "remote fixture should fetch the slash-named remote for prefix matching coverage");
|
|
1188
|
+
runGitFixture(["symbolic-ref", "refs/remotes/origin/HEAD", "refs/remotes/origin/main"], localRepo, "remote fixture should create a symbolic remote HEAD alias");
|
|
1189
|
+
runGitFixture(["branch", "origin/main", "main"], localRepo, "remote fixture should create a local ref that makes refname:short ambiguous");
|
|
1190
|
+
|
|
1191
|
+
const listedRemoteBranches = await request("127.0.0.1", `/api/git-branches?tab=${encodeURIComponent(remoteTabId)}`);
|
|
1192
|
+
assert.equal(listedRemoteBranches.status, 200);
|
|
1193
|
+
assert.equal(listedRemoteBranches.body?.ok, true, "branch listing should include fetched remote-only branches");
|
|
1194
|
+
const branchRecords = listedRemoteBranches.body?.data?.branches || [];
|
|
1195
|
+
const originRemoteSwitch = branchRecords.find((branch) => branch.remote === true && branch.remoteRef === `origin/${remoteOnlySwitchBranch}`);
|
|
1196
|
+
assert.deepEqual(originRemoteSwitch, {
|
|
1197
|
+
name: remoteOnlySwitchBranch,
|
|
1198
|
+
current: false,
|
|
1199
|
+
remote: true,
|
|
1200
|
+
remoteRef: `origin/${remoteOnlySwitchBranch}`,
|
|
1201
|
+
remoteName: "origin",
|
|
1202
|
+
displayName: `origin/${remoteOnlySwitchBranch}`,
|
|
1203
|
+
}, "remote-only rows should carry explicit local and exact remote metadata");
|
|
1204
|
+
const sameNameRemoteRefs = branchRecords
|
|
1205
|
+
.filter((branch) => branch.remote === true && branch.name === remoteOnlySwitchBranch)
|
|
1206
|
+
.map((branch) => branch.remoteRef)
|
|
1207
|
+
.sort();
|
|
1208
|
+
assert.deepEqual(sameNameRemoteRefs, [`mirror/${remoteOnlySwitchBranch}`, `origin/${remoteOnlySwitchBranch}`, `team/mirror/${remoteOnlySwitchBranch}`], "same-name remote-only branches should remain distinct by exact ref even when a remote name contains a slash");
|
|
1209
|
+
assert.equal(branchRecords.some((branch) => branch.remote === true && branch.remoteRef === "origin/HEAD"), false, "symbolic remote HEAD aliases must not be listed");
|
|
1210
|
+
assert.equal(branchRecords.some((branch) => branch.remote === true && branch.name === "main"), false, "a local branch should hide same-named remote rows");
|
|
1211
|
+
assert.ok(branchRecords.some((branch) => branch.remote !== true && branch.name === "origin/main"), "local branch names must not change when refname shortening would be ambiguous");
|
|
1212
|
+
assert.equal(listedRemoteBranches.body?.data?.remoteBranchesTruncated, false, "complete remote branch output should not be marked truncated");
|
|
1213
|
+
|
|
1214
|
+
const implicitRemoteSwitch = await request("127.0.0.1", "/api/git-branch", {
|
|
1215
|
+
method: "POST",
|
|
1216
|
+
body: { tab: remoteTabId, branch: remoteOnlySwitchBranch },
|
|
1217
|
+
});
|
|
1218
|
+
assert.equal(implicitRemoteSwitch.body?.ok, false, "remote-only names without an exact remoteRef must not trigger Git DWIM tracking creation");
|
|
1219
|
+
assert.match(String(implicitRemoteSwitch.body?.error || ""), /Unknown local git branch/, "implicit remote selection should retain the local-only API guard");
|
|
1220
|
+
assert.equal(runGitFixture(["branch", "--list", remoteOnlySwitchBranch], localRepo, "implicit remote switch should not create a local branch"), "");
|
|
1221
|
+
|
|
1222
|
+
const localCreateOverRemote = await request("127.0.0.1", "/api/git-branch", {
|
|
1223
|
+
method: "POST",
|
|
1224
|
+
body: { tab: remoteTabId, branch: remoteOnlyCreateBranch, create: true },
|
|
1225
|
+
timeoutMs: 20_000,
|
|
1226
|
+
});
|
|
1227
|
+
assert.equal(localCreateOverRemote.body?.ok, true, "explicit local branch creation should remain available when a same-named remote-only branch exists");
|
|
1228
|
+
assert.equal(runGitFixture(["branch", "--show-current"], localRepo, "local create compatibility path should switch to its new branch"), remoteOnlyCreateBranch);
|
|
1229
|
+
const createdUpstream = spawnSync("git", ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"], { cwd: localRepo, encoding: "utf8" });
|
|
1230
|
+
assert.notEqual(createdUpstream.status, 0, "explicit local creation should not silently track the same-named remote branch");
|
|
1231
|
+
runGitFixture(["switch", "main"], localRepo, "local repo should return to main after local-create compatibility coverage");
|
|
1232
|
+
|
|
1233
|
+
runGitFixture(["push", "origin", "--delete", staleRemoteBranch], remoteWork, "remote fixture should delete the stale branch upstream");
|
|
1234
|
+
const prunedRemoteBranches = await request("127.0.0.1", "/api/git-fetch", { method: "POST", body: { tab: remoteTabId }, timeoutMs: 20_000 });
|
|
1235
|
+
assert.equal(prunedRemoteBranches.body?.ok, true, "git fetch --prune should remove the deleted origin tracking ref");
|
|
1236
|
+
const staleRemoteSwitch = await request("127.0.0.1", "/api/git-branch", {
|
|
1237
|
+
method: "POST",
|
|
1238
|
+
body: { tab: remoteTabId, branch: staleRemoteBranch, remoteRef: `origin/${staleRemoteBranch}` },
|
|
1239
|
+
});
|
|
1240
|
+
assert.equal(staleRemoteSwitch.body?.ok, false, "acting on a remote ref removed by prune must fail closed");
|
|
1241
|
+
assert.match(String(staleRemoteSwitch.body?.error || ""), /Unknown remote git branch/, "stale remote actions should explain that the advertised ref no longer exists");
|
|
1242
|
+
assert.equal(runGitFixture(["branch", "--list", staleRemoteBranch], localRepo, "stale remote action should not create a local branch"), "");
|
|
1243
|
+
|
|
1244
|
+
const mismatchedRemoteSwitch = await request("127.0.0.1", "/api/git-branch", {
|
|
1245
|
+
method: "POST",
|
|
1246
|
+
body: { tab: remoteTabId, branch: remoteOnlySwitchBranch, remoteRef: `origin/${remoteOnlyWorktreeBranch}` },
|
|
1247
|
+
});
|
|
1248
|
+
assert.equal(mismatchedRemoteSwitch.status, 200);
|
|
1249
|
+
assert.equal(mismatchedRemoteSwitch.body?.ok, false, "a remote ref must match its submitted local branch name");
|
|
1250
|
+
assert.equal(runGitFixture(["branch", "--list", remoteOnlySwitchBranch], localRepo, "mismatched remote switch should not create a local branch"), "");
|
|
1251
|
+
|
|
1252
|
+
const switchedRemoteBranch = await request("127.0.0.1", "/api/git-branch", {
|
|
1253
|
+
method: "POST",
|
|
1254
|
+
body: { tab: remoteTabId, branch: remoteOnlySwitchBranch, remoteRef: `origin/${remoteOnlySwitchBranch}` },
|
|
1255
|
+
timeoutMs: 20_000,
|
|
1256
|
+
});
|
|
1257
|
+
assert.equal(switchedRemoteBranch.status, 200);
|
|
1258
|
+
assert.equal(switchedRemoteBranch.body?.ok, true, `remote-only switch should create a tracking branch: ${switchedRemoteBranch.body?.error || ""}`);
|
|
1259
|
+
assert.equal(runGitFixture(["branch", "--show-current"], localRepo, "remote-only switch should remain attached"), remoteOnlySwitchBranch);
|
|
1260
|
+
assert.equal(runGitFixture(["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"], localRepo, "remote-only switch should configure its upstream"), `origin/${remoteOnlySwitchBranch}`);
|
|
1261
|
+
|
|
1262
|
+
const collisionRemoteSwitch = await request("127.0.0.1", "/api/git-branch", {
|
|
1263
|
+
method: "POST",
|
|
1264
|
+
body: { tab: remoteTabId, branch: remoteOnlySwitchBranch, remoteRef: `mirror/${remoteOnlySwitchBranch}` },
|
|
1265
|
+
});
|
|
1266
|
+
assert.equal(collisionRemoteSwitch.status, 200);
|
|
1267
|
+
assert.equal(collisionRemoteSwitch.body?.ok, false, "a newly materialized local branch should reject a same-name remote selection");
|
|
1268
|
+
assert.equal(runGitFixture(["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"], localRepo, "collision rejection must preserve the original upstream"), `origin/${remoteOnlySwitchBranch}`);
|
|
1269
|
+
|
|
1270
|
+
const switchedBackToMain = await request("127.0.0.1", "/api/git-branch", { method: "POST", body: { tab: remoteTabId, branch: "main" }, timeoutMs: 20_000 });
|
|
1271
|
+
assert.equal(switchedBackToMain.status, 200);
|
|
1272
|
+
assert.equal(switchedBackToMain.body?.ok, true, "local branch switching should remain unchanged after remote switching");
|
|
1273
|
+
|
|
1274
|
+
const mismatchedRemoteWorktree = await request("127.0.0.1", "/api/git-worktrees", {
|
|
1275
|
+
method: "POST",
|
|
1276
|
+
body: { tab: remoteTabId, branchName: remoteOnlyWorktreeBranch, remoteRef: `origin/${remoteOnlySwitchBranch}`, sessionMode: "empty", openTab: true },
|
|
1277
|
+
timeoutMs: 20_000,
|
|
1278
|
+
});
|
|
1279
|
+
assert.equal(mismatchedRemoteWorktree.status, 200);
|
|
1280
|
+
assert.equal(mismatchedRemoteWorktree.body?.ok, false, "a worktree remote ref must match its submitted local branch name");
|
|
1281
|
+
assert.equal(runGitFixture(["branch", "--list", remoteOnlyWorktreeBranch], localRepo, "mismatched remote worktree should not create a local branch"), "");
|
|
1282
|
+
|
|
1283
|
+
const remoteTrackingWorktree = await request("127.0.0.1", "/api/git-worktrees", {
|
|
1284
|
+
method: "POST",
|
|
1285
|
+
body: { tab: remoteTabId, branchName: remoteOnlyWorktreeBranch, remoteRef: `team/mirror/${remoteOnlyWorktreeBranch}`, sessionMode: "empty", openTab: true },
|
|
1286
|
+
timeoutMs: 20_000,
|
|
1287
|
+
});
|
|
1288
|
+
assert.equal(remoteTrackingWorktree.status, 200);
|
|
1289
|
+
assert.equal(remoteTrackingWorktree.body?.ok, true, `remote-only worktree should create a tracking branch: ${remoteTrackingWorktree.body?.error || ""}`);
|
|
1290
|
+
const remoteTrackingWorktreePath = remoteTrackingWorktree.body?.data?.worktree?.path || remoteTrackingWorktree.body?.data?.path;
|
|
1291
|
+
const remoteTrackingWorktreeTabId = remoteTrackingWorktree.body?.data?.tab?.id;
|
|
1292
|
+
assert.ok(remoteTrackingWorktreePath, "remote-only worktree response should include its path");
|
|
1293
|
+
assert.ok(remoteTrackingWorktreeTabId, "remote-only worktree should open a tab");
|
|
1294
|
+
assert.equal(runGitFixture(["branch", "--show-current"], remoteTrackingWorktreePath, "remote-only worktree should remain attached"), remoteOnlyWorktreeBranch);
|
|
1295
|
+
assert.equal(runGitFixture(["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"], remoteTrackingWorktreePath, "remote-only worktree should configure its upstream"), `team/mirror/${remoteOnlyWorktreeBranch}`);
|
|
1296
|
+
const closeRemoteTrackingWorktreeTab = await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [remoteTrackingWorktreeTabId] }, timeoutMs: 10_000 });
|
|
1297
|
+
assert.equal(closeRemoteTrackingWorktreeTab.body?.ok, true, "remote-only worktree tab should close before cleanup");
|
|
1298
|
+
const removeRemoteTrackingWorktree = await request("127.0.0.1", "/api/git-worktrees", { method: "DELETE", body: { tab: remoteTabId, path: remoteTrackingWorktreePath, confirmed: true }, timeoutMs: 20_000 });
|
|
1299
|
+
assert.equal(removeRemoteTrackingWorktree.body?.ok, true, "remote-only tracking worktree should be removable after the tab closes");
|
|
1300
|
+
|
|
1104
1301
|
const incomingChanges = await request("127.0.0.1", `/api/git-changes?tab=${encodeURIComponent(remoteTabId)}`);
|
|
1105
1302
|
assert.equal(incomingChanges.status, 200);
|
|
1106
1303
|
assert.equal(incomingChanges.body?.ok, true, "git changes endpoint should load a fetched-behind repo");
|
|
@@ -2345,6 +2542,70 @@ try {
|
|
|
2345
2542
|
const closeFilesTab = await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [filesTabId] }, timeoutMs: 10_000 });
|
|
2346
2543
|
assert.equal(closeFilesTab.status, 200, "file fixture tab should close after scoped file checks");
|
|
2347
2544
|
|
|
2545
|
+
// Codex subscription Fast mode: exact status is extension-owned and every mutation must be
|
|
2546
|
+
// idle, explicit, tab-scoped, and confirmed by the extension status event.
|
|
2547
|
+
const initialCodexFastMode = await request("127.0.0.1", `/api/codex-fast-mode?tab=${encodeURIComponent(tabId)}`);
|
|
2548
|
+
assert.equal(initialCodexFastMode.status, 200);
|
|
2549
|
+
assert.equal(initialCodexFastMode.body?.data?.available, true, "fake /fast-mode command should make Codex Fast mode available");
|
|
2550
|
+
assert.equal(initialCodexFastMode.body?.data?.statusKnown, false, "server must not infer Fast mode before the extension publishes status");
|
|
2551
|
+
|
|
2552
|
+
const invalidCodexFastMode = await request("127.0.0.1", "/api/codex-fast-mode", {
|
|
2553
|
+
method: "PUT",
|
|
2554
|
+
body: { enabled: "yes", tab: tabId },
|
|
2555
|
+
});
|
|
2556
|
+
assert.equal(invalidCodexFastMode.status, 400, "Codex Fast mode should require an explicit boolean");
|
|
2557
|
+
|
|
2558
|
+
const codexFastModeOn = await request("127.0.0.1", "/api/codex-fast-mode", {
|
|
2559
|
+
method: "PUT",
|
|
2560
|
+
body: { enabled: true, tab: tabId },
|
|
2561
|
+
});
|
|
2562
|
+
assert.equal(codexFastModeOn.status, 200, `Codex Fast mode on should succeed: ${codexFastModeOn.body?.error || ""}`);
|
|
2563
|
+
assert.equal(codexFastModeOn.body?.data?.statusKnown, true);
|
|
2564
|
+
assert.equal(codexFastModeOn.body?.data?.enabled, true, "PUT should return only extension-confirmed on state");
|
|
2565
|
+
|
|
2566
|
+
const rejectNextCodexFastMode = await request("127.0.0.1", "/api/prompt", {
|
|
2567
|
+
method: "POST",
|
|
2568
|
+
body: { message: "fixture reject next codex fast mode mutation", tab: tabId },
|
|
2569
|
+
});
|
|
2570
|
+
assert.equal(rejectNextCodexFastMode.status, 200);
|
|
2571
|
+
const rejectedCodexFastModeOff = await request("127.0.0.1", "/api/codex-fast-mode", {
|
|
2572
|
+
method: "PUT",
|
|
2573
|
+
body: { enabled: false, tab: tabId },
|
|
2574
|
+
timeoutMs: 5_000,
|
|
2575
|
+
});
|
|
2576
|
+
assert.equal(rejectedCodexFastModeOff.status, 409, "RPC success without matching extension status should fail closed");
|
|
2577
|
+
assert.match(String(rejectedCodexFastModeOff.body?.error || ""), /did not confirm off/i);
|
|
2578
|
+
const codexFastModeStillOn = await request("127.0.0.1", `/api/codex-fast-mode?tab=${encodeURIComponent(tabId)}`);
|
|
2579
|
+
assert.equal(codexFastModeStillOn.body?.data?.enabled, true, "a rejected mutation must not become optimistic off state");
|
|
2580
|
+
|
|
2581
|
+
const busyFixturePrompt = await request("127.0.0.1", "/api/prompt", {
|
|
2582
|
+
method: "POST",
|
|
2583
|
+
body: { message: "voice test slow", tab: tabId },
|
|
2584
|
+
});
|
|
2585
|
+
assert.equal(busyFixturePrompt.status, 200);
|
|
2586
|
+
await delay(80);
|
|
2587
|
+
const busyCodexFastModeOff = await request("127.0.0.1", "/api/codex-fast-mode", {
|
|
2588
|
+
method: "PUT",
|
|
2589
|
+
body: { enabled: false, tab: tabId },
|
|
2590
|
+
});
|
|
2591
|
+
assert.equal(busyCodexFastModeOff.status, 409, "Codex Fast mode changes should be rejected during a running turn");
|
|
2592
|
+
assert.match(String(busyCodexFastModeOff.body?.error || ""), /busy|running turn/i);
|
|
2593
|
+
let settledCodexFastMode;
|
|
2594
|
+
for (let attempt = 0; attempt < 40; attempt += 1) {
|
|
2595
|
+
settledCodexFastMode = await request("127.0.0.1", `/api/codex-fast-mode?tab=${encodeURIComponent(tabId)}`);
|
|
2596
|
+
if (settledCodexFastMode.body?.data?.busy === false) break;
|
|
2597
|
+
await delay(150);
|
|
2598
|
+
}
|
|
2599
|
+
assert.equal(settledCodexFastMode?.body?.data?.busy, false, "fake running turn should settle before the retry");
|
|
2600
|
+
|
|
2601
|
+
const codexFastModeOff = await request("127.0.0.1", "/api/codex-fast-mode", {
|
|
2602
|
+
method: "PUT",
|
|
2603
|
+
body: { enabled: false, tab: tabId },
|
|
2604
|
+
});
|
|
2605
|
+
assert.equal(codexFastModeOff.status, 200, `Codex Fast mode off should succeed after the tab settles: ${codexFastModeOff.body?.error || ""}`);
|
|
2606
|
+
assert.equal(codexFastModeOff.body?.data?.enabled, false);
|
|
2607
|
+
assert.equal(codexFastModeOff.body?.data?.statusKnown, true, "off response should be extension-confirmed");
|
|
2608
|
+
|
|
2348
2609
|
// Natural Conversation shell: /talk availability drives per-tab status and safety guards.
|
|
2349
2610
|
const conversationFeature = await request("127.0.0.1", `/api/features/natural-conversation?tab=${encodeURIComponent(tabId)}`);
|
|
2350
2611
|
assert.equal(conversationFeature.status, 200);
|
|
@@ -379,8 +379,14 @@ assert.match(css, /body\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-
|
|
|
379
379
|
assert.match(css, /#promptInput \{[\s\S]*?min-height:\s*calc\(1\.5em \+ 1\.8rem\)/, "prompt input should default to a compact single-line height");
|
|
380
380
|
assert.match(css, /#promptInput \{[\s\S]*?overflow-y:\s*hidden/, "prompt input should be JS-resized instead of showing a scrollbar by default");
|
|
381
381
|
assert.match(css, /\.composer-context-tags \{[\s\S]*?top:\s*-0\.48rem;[\s\S]*?left:\s*0\.75rem;/, "busy prompt behavior and skill tags should sit at the top-left of the input frame");
|
|
382
|
+
assert.match(css, /\.composer-context-tags \{[^}]*width:\s*calc\(100% - 4\.5rem\);[^}]*min-width:\s*0;[^}]*pointer-events:\s*none;/, "context tags should claim the available prompt-frame width while leaving empty overlay space clickable through to the prompt");
|
|
383
|
+
assert.match(css, /\.composer-busy-mode-tag,[\s\S]*?\.composer-workflow-mode-chip \{\s*pointer-events:\s*auto;/, "interactive context chips should remain clickable through the pointer-transparent full-width overlay");
|
|
384
|
+
assert.match(css, /\.composer-skill-tags \{[^}]*flex:\s*1 1 0;[^}]*overflow:\s*hidden;/, "skill tag strips should use the true leftover context-tag width without squeezing sibling chips");
|
|
382
385
|
assert.match(css, /\.composer-busy-mode-tag \{[\s\S]*?var\(--ctp-crust\)/, "busy prompt behavior tag should use an opaque base background");
|
|
383
|
-
assert.match(css, /\.composer-skill-tag \{[\s\S]*?var\(--ctp-crust\)/, "skill tags should
|
|
386
|
+
assert.match(css, /\.composer-skill-tag \{[^}]*flex:\s*0 0 auto;[\s\S]*?var\(--ctp-crust\)/, "skill tags should preserve their natural chip widths inside the responsive strip");
|
|
387
|
+
assert.doesNotMatch(app, /SKILL_TAG_MAX_VISIBLE/, "skill tag visibility should not remain capped at a fixed count");
|
|
388
|
+
assert.match(app, /function fitSessionSkillTags\(\)[\s\S]*?availableWidth = container\.clientWidth[\s\S]*?maxOverflowDigits = String\(tags\.length\)\.length[\s\S]*?requiredWidth <= availableWidth \+ 0\.5/, "skill tags should fit their visible count to the measured input width with bounded overflow-chip measurements");
|
|
389
|
+
assert.match(app, /function installSessionSkillTagResizeHandling\(\)[\s\S]*?new ResizeObserver\(scheduleSessionSkillTagLayout\)[\s\S]*?observe\(container\.parentElement\)/, "skill tag fitting should rerun when the composer tag strip changes width");
|
|
384
390
|
assert.match(css, /\.composer-feature-category-tag \{[\s\S]*?var\(--ctp-crust\)[\s\S]*?\.composer-feature-category-tag\.complex-feature \{[\s\S]*?var\(--ctp-mauve\)[\s\S]*?\.composer-feature-category-tag\[hidden\]/, "feature category tags should use the existing composer-tag frame with a distinct complex state and hidden default");
|
|
385
391
|
assert.match(css, /button\.composer-skill-tag:hover,[\s\S]*?button\.composer-skill-tag:focus-visible/, "skill tags should be styled as clickable controls");
|
|
386
392
|
assert.match(css, /\.extension-dialog\.skill-editor-dialog \{[\s\S]*?--skill-editor-size:\s*min\(152rem[\s\S]*?width:\s*var\(--skill-editor-size\);[\s\S]*?height:\s*var\(--skill-editor-size\);[\s\S]*?aspect-ratio:\s*1 \/ 1/, "skill editor should use a square viewport-bounded modal layout");
|
|
@@ -1019,7 +1025,40 @@ assert.match(app, /chip\.key === "git"[\s\S]*setFooterBranchPickerOpen\(!footerB
|
|
|
1019
1025
|
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");
|
|
1020
1026
|
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");
|
|
1021
1027
|
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");
|
|
1022
|
-
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");
|
|
1028
|
+
assert.match(app, /function renderFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*openFooterBranchOption\(branch, state\)[\s\S]*footer-branch-advanced-action[\s\S]*applyFooterGitBranch\(branch\.name, \{ switchingKey: branch\.key \}\)/, "branch rows should prefer worktree open/create while keeping an advanced in-place switch action");
|
|
1029
|
+
const branchPickerRenderKeySource = appFunctionSource("footerBranchPickerRenderKey", "gitFooterPickerStateKey");
|
|
1030
|
+
const branchPickerKeySandbox = { footerBranchPickerOpen: true, footerBranchPickerState: { loading: true, branches: [] } };
|
|
1031
|
+
const loadingBranchPickerKey = vm.runInNewContext(`${branchPickerRenderKeySource}\nfooterBranchPickerRenderKey()`, branchPickerKeySandbox);
|
|
1032
|
+
branchPickerKeySandbox.footerBranchPickerState = { loading: false, branches: [{ name: "main" }] };
|
|
1033
|
+
const loadedBranchPickerKey = vm.runInNewContext("footerBranchPickerRenderKey()", branchPickerKeySandbox);
|
|
1034
|
+
assert.notEqual(loadingBranchPickerKey, loadedBranchPickerKey, "branch picker render key should change when asynchronous branch data replaces loading state");
|
|
1035
|
+
assert.match(appFunctionSource("gitFooterPickerStateKey", "updateGitFooterChipNodeValue"), /footerBranchPickerRenderKey\(\)/, "git footer cache identity should include live branch picker state so the first opening rerenders when loading finishes");
|
|
1036
|
+
const branchSwitchAvailabilitySource = appFunctionSource("footerBranchSwitchAvailability", "renderFooterBranchOption");
|
|
1037
|
+
const branchSwitchAvailability = JSON.parse(vm.runInNewContext(`${branchSwitchAvailabilitySource}\nJSON.stringify({
|
|
1038
|
+
switching: footerBranchSwitchAvailability({ name: "feat/demo" }, { loading: true, switching: "origin/main" }, ""),
|
|
1039
|
+
loading: footerBranchSwitchAvailability({ name: "feat/demo" }, { loading: true, switching: "" }, ""),
|
|
1040
|
+
mainWorktree: footerBranchSwitchAvailability({ name: "feat/demo", mainWorktree: true }, {}, "/repo"),
|
|
1041
|
+
otherWorktree: footerBranchSwitchAvailability({ name: "feat/demo", mainWorktree: false }, {}, "/repo-worktrees/demo"),
|
|
1042
|
+
available: footerBranchSwitchAvailability({ name: "feat/demo" }, {}, ""),
|
|
1043
|
+
})`));
|
|
1044
|
+
assert.equal(branchSwitchAvailability.switching.label, "Action running…", "running branch mutations should expose their exact disabled category");
|
|
1045
|
+
assert.match(branchSwitchAvailability.switching.reason, /origin\/main is still running/, "running branch mutations should name the active branch action");
|
|
1046
|
+
assert.equal(branchSwitchAvailability.loading.label, "Refreshing…", "branch metadata loading should expose a distinct disabled category");
|
|
1047
|
+
assert.match(branchSwitchAvailability.loading.reason, /information finishes loading/, "branch metadata loading should explain when switching becomes available");
|
|
1048
|
+
assert.equal(branchSwitchAvailability.mainWorktree.label, "In main worktree", "main-worktree occupancy should expose a distinct disabled category");
|
|
1049
|
+
assert.match(branchSwitchAvailability.mainWorktree.reason, /main worktree at \/repo/, "main-worktree occupancy should identify the exact checkout path");
|
|
1050
|
+
assert.equal(branchSwitchAvailability.otherWorktree.label, "In another worktree", "secondary-worktree occupancy should expose a distinct disabled category");
|
|
1051
|
+
assert.match(branchSwitchAvailability.otherWorktree.reason, /another worktree at \/repo-worktrees\/demo/, "secondary-worktree occupancy should identify the exact checkout path");
|
|
1052
|
+
assert.deepEqual(branchSwitchAvailability.available, { disabled: false, label: "Switch here", reason: "" }, "unoccupied idle branches should keep Switch here enabled");
|
|
1053
|
+
assert.match(app, /function footerGitBranchKey\(item = \{\}\)[\s\S]*return item\.remote \? `remote:\$\{item\.remoteRef\}` : `local:\$\{item\.name\}`/, "remote branch rows should use their exact remote ref, not local name, as their deduplication identity");
|
|
1054
|
+
assert.match(app, /function normalizeFooterGitBranches\(data = \{\}\)[\s\S]*const remoteRef = cleanFooterPayloadText\(item\?\.remoteRef, "", 4000\);[\s\S]*if \(remote && !remoteRef\) continue;[\s\S]*remoteRef: remote \? remoteRef : "",[\s\S]*remoteName: remote \? cleanStatusText\(item\?\.remoteName\) : "",[\s\S]*displayName: remote \? cleanFooterPayloadText\(item\?\.displayName, remoteRef, 4000\) : name,[\s\S]*const key = footerGitBranchKey\(branch\);[\s\S]*if \(seen\.has\(key\)\) continue;/, "branch normalization should sanitize and retain explicit remote metadata while deduplicating by remote identity");
|
|
1055
|
+
assert.match(app, /function footerBranchOptionLabel\(branch = \{\}\)[\s\S]*cleanStatusText\(branch\.displayName\) \|\| cleanStatusText\(branch\.name\)/, "remote branch rows should visibly prefer the advertised exact remote ref label");
|
|
1056
|
+
assert.match(app, /function footerBranchOptionDetail\(branch, state, \{ selected, worktreePath \} = \{\}\)[\s\S]*if \(branch\.remote\) return `remote-only · creates local branch \$\{branch\.name\} tracking \$\{branch\.remoteRef\}`;/, "remote branch rows should visibly describe the local tracking branch they create");
|
|
1057
|
+
assert.match(app, /function renderFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*remote-only[\s\S]*Remote-only branch \$\{branch\.remoteRef\}: create local branch \$\{branch\.name\} tracking it[\s\S]*Advanced: git switch --track -c \$\{branch\.name\} \$\{branch\.remoteRef\} in this checkout/, "remote branch rows should expose remote-only state and exact-ref tracking actions in visible and accessible text");
|
|
1058
|
+
assert.match(app, /function openFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*if \(branch\.remote\) return createFooterGitBranchWorktree\(branch\.name, \{ skipConfirm: true, chooseBase: false, remoteRef: branch\.remoteRef/, "remote primary actions should forward the advertised exact remote ref to tracking-worktree creation");
|
|
1059
|
+
assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\), \{[\s\S]*const response = trackedRemoteRef[\s\S]*\? await api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, remoteRef: trackedRemoteRef, sessionMode: "fork-current", openTab: true \}, tabId \}\)[\s\S]*: await api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, baseRef, sessionMode: "fork-current", openTab: true \}, tabId \}\)/, "remote worktree creation should submit the exact remote ref while local creation retains its base-ref request shape");
|
|
1060
|
+
assert.match(app, /async function applyFooterGitBranch\(branch, \{[\s\S]*const response = trackedRemoteRef[\s\S]*\? await api\("\/api\/git-branch", \{ method: "POST", body: \{ branch: branchName, create, remoteRef: trackedRemoteRef \}, tabId \}\)[\s\S]*: await api\("\/api\/git-branch", \{ method: "POST", body: \{ branch: branchName, create \}, tabId \}\)/, "remote in-place switching should submit the exact remote ref while local switching retains its request shape");
|
|
1061
|
+
assert.match(app, /function footerBranchOptionDetail\(branch, state,[\s\S]*state\.switchingKey \? state\.switchingKey === branch\.key[\s\S]*switchingKey: branch\.key/, "branch busy state should use the exact local-or-remote row identity instead of a collision-prone display label");
|
|
1023
1062
|
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");
|
|
1024
1063
|
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");
|
|
1025
1064
|
assert.match(app, /let footerBranchCreateDraft = \{ type: "", name: "" \}/, "new branch creation should not default the editable type prefix to feat");
|
|
@@ -1034,7 +1073,8 @@ assert.match(app, /submitButton\.dataset\.tooltip = footerBranchCreateTooltip\(b
|
|
|
1034
1073
|
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");
|
|
1035
1074
|
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");
|
|
1036
1075
|
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");
|
|
1037
|
-
assert.match(app, /Loading
|
|
1076
|
+
assert.match(app, /Loading local and fetched remote branches and worktrees… Worktree creation is available once branch data loads\./, "branch picker loading copy should accurately describe local and fetched remote branch metadata");
|
|
1077
|
+
assert.match(app, /No other local or fetched remote branches available\.[\s\S]*Fetch to list remote branches, or create a branch worktree from origin\/main or the current workspace HEAD to continue\./, "branch picker empty copy should explain how fetched remote branches become available");
|
|
1038
1078
|
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");
|
|
1039
1079
|
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");
|
|
1040
1080
|
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");
|
|
@@ -1057,7 +1097,8 @@ assert.match(server, /url\.pathname === "\/api\/git-branches"[\s\S]*readGitBranc
|
|
|
1057
1097
|
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");
|
|
1058
1098
|
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");
|
|
1059
1099
|
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");
|
|
1060
|
-
assert.match(server, /url\.pathname === "\/api\/git-branch"[\s\S]*switchGitBranch\(tab\.cwd, body\.branch, \{ create: body\.create === true \}\)/, "server should
|
|
1100
|
+
assert.match(server, /url\.pathname === "\/api\/git-branch"[\s\S]*const remoteRef = requestedRemoteRef\(body\);[\s\S]*switchGitBranch\(tab\.cwd, body\.branch, \{ create: body\.create === true, remoteRef \}\)/, "server should preserve optional exact remote-ref intent for advanced footer branch switching");
|
|
1101
|
+
assert.match(server, /runGitReadCommandDetailed\(root, \["for-each-ref", "--format=%\(refname\)%09%\(symref\)"[\s\S]*remoteBranchesTruncated: remoteData\.truncated === true[\s\S]*item\.remote !== true && item\.name === targetBranch/, "server branch listing should parse full remote refs, expose truncation, and keep local branch guards local-only");
|
|
1061
1102
|
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");
|
|
1062
1103
|
assert.match(app, /let latestStats = null/, "default footer should retain session stats for token and context display");
|
|
1063
1104
|
assert.match(app, /async function refreshStats\(tabContext = activeTabContext\(\)\)[\s\S]*api\("\/api\/stats"/, "default footer should fetch session stats");
|
|
@@ -1265,6 +1306,16 @@ assert.match(app, /async function runGitMessagePrompt\([\s\S]*\/api\/git-workflo
|
|
|
1265
1306
|
assert.match(app, /async function runGitBranchNamePrompt\([\s\S]*\/api\/git-workflow\/generate"[\s\S]*kind: "branch"/, "guided git workflow should generate branch names with the configured model and effort");
|
|
1266
1307
|
assert.match(app, /async function acceptCurrentGitStaging\([\s\S]*summary\?\.staged[\s\S]*No staged files are available/, "review staging should require a non-empty current staged set");
|
|
1267
1308
|
assert.match(app, /function gitWorkflowRequest\([\s\S]*response\.hint \? `\\n\\nHint:/, "guided git failures should show actionable backend hints");
|
|
1309
|
+
assert.match(app, /function gitWorkflowRequest\([\s\S]*if \(response\.code\) failure\.code = response\.code;[\s\S]*if \(response\.hint\) failure\.hint = response\.hint;[\s\S]*if \(response\.data\) failure\.data = response\.data;[\s\S]*throw failure;/, "guided git request failures should preserve the structured backend code, hint, and process result");
|
|
1310
|
+
assert.match(app, /async function pushGitWorkflow\([\s\S]*if \(error\?\.code === "NO_REMOTE"\) \{[\s\S]*await publishGitWorkflowRepository\(tabId, error\)/, "guided git push should offer GitHub publication only for structured NO_REMOTE failures");
|
|
1311
|
+
assert.match(app, /async function publishGitWorkflowRepository\(tabId, failure\)[\s\S]*Publish this repository to GitHub with the authenticated GitHub CLI \(gh\) account instead\?[\s\S]*if \(!publishRequested\) return false;[\s\S]*repoName = promptGitPublishRepoName\(tabId\);[\s\S]*if \(!repoName\) return false;[\s\S]*visibility = promptGitPublishVisibility\(repoName\);[\s\S]*if \(!visibility\) return false;/, "guided git publication should ask to publish, then require a repository name and explicit visibility before continuing");
|
|
1312
|
+
assert.match(app, /async function publishGitWorkflowRepository\([\s\S]*const confirmed = await appConfirmText\(\[[\s\S]*Repository name: \$\{repoName\}[\s\S]*Visibility: \$\{visibility\}[\s\S]*Branch to push: \$\{branch\}[\s\S]*Resulting remote: origin[\s\S]*if \(!confirmed\) return false;[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/publish", \{ body: \{ repoName, visibility, confirmed: true \}/, "guided git publication should require a final summary confirmation before the confirmed publish request");
|
|
1313
|
+
assert.match(app, /async function publishGitWorkflowRepository\([\s\S]*Published \$\{result\.repoName \|\| repoName\} as \$\{result\.visibility \|\| visibility\}\.[\s\S]*Remote: \$\{result\.remote \|\| "origin"\}[\s\S]*Branch: \$\{result\.branch \|\| branch\}[\s\S]*scheduleRefreshFooter\(\)/, "successful publication should report branch/remote metadata and refresh the footer");
|
|
1314
|
+
assert.match(app, /function promptGitPublishRepoName\(tabId = activeTabId\) \{\n\s+const targetTab = tabs\.find\(\(tab\) => tab\.id === tabId\) \|\| activeTab\(\);\n\s+const value = window\.prompt\("GitHub repository name to create", defaultGitInitRepoName\(targetTab\)\);[\s\S]*return cleanGitHubRepoNameInput\(value\);/, "publication should prefill the repository name from the publishing tab's workspace directory and validate it with the existing client rules");
|
|
1315
|
+
assert.match(app, /async function publishGitWorkflowRepository\(tabId, failure\)[\s\S]*const branch = failure\?\.data\?\.branch \|\| gitFooterCurrentBranch\(\) \|\| "the current branch";[\s\S]*repoName = promptGitPublishRepoName\(tabId\);/, "publication confirmation should prefer the server-reported branch and resolve the repository-name default from the publishing tab");
|
|
1316
|
+
assert.match(app, /function promptGitPublishVisibility\(repoName\) \{\n\s+const value = window\.prompt\(`Visibility for GitHub repository \$\{repoName\} — type public or private \(no default\)`, ""\);/, "visibility must be typed with no preselected default");
|
|
1317
|
+
assert.match(app, /function cleanGitPublishVisibilityInput\(value\)[\s\S]*if \(visibility !== "public" && visibility !== "private"\)[\s\S]*nothing was published/, "publication visibility must be exactly public or private");
|
|
1318
|
+
assert.doesNotMatch(app, /visibility = "(?:public|private)"/, "publication visibility should never be defaulted in the frontend");
|
|
1268
1319
|
assert.match(server, /async function gitAddAllPayload\([\s\S]*platform\(\) === "win32"[\s\S]*findWindowsReservedGitPath\([\s\S]*windowsReservedGitPathFailure\(/, "guided git add should preflight Windows-reserved untracked paths before staging");
|
|
1269
1320
|
assert.match(app, /Pre-commit verification reminder[\s\S]*Continue with this commit/, "configured verification reminders should run before committing");
|
|
1270
1321
|
assert.match(server, /async function startGitWorkflowGeneration\([\s\S]*set_model[\s\S]*setThinkingLevelForTab[\s\S]*type: "prompt"/, "server should apply the configured generation profile before prompting Pi");
|
|
@@ -1926,7 +1977,7 @@ for (const [name, range] of Object.entries(companionDependencies)) {
|
|
|
1926
1977
|
assert.equal(pkg.optionalDependencies?.[name], range, `webui package should optionally depend on ${name}`);
|
|
1927
1978
|
assert.equal(pkg.dependencies?.[name], undefined, `webui package should not require optional companion ${name}`);
|
|
1928
1979
|
assert.equal(lock.packages?.[""]?.optionalDependencies?.[name], range, `package-lock root should optionally depend on ${name}`);
|
|
1929
|
-
assert.equal(lock.packages?.[""]?.dependencies?.[name],
|
|
1980
|
+
assert.equal(lock.packages?.[""]?.dependencies?.[name], undefined, `package-lock root should not promote optional companion ${name} to a required dependency`);
|
|
1930
1981
|
assert.ok(lock.packages?.[`node_modules/${name}`], `package-lock should include resolved optional companion ${name}`);
|
|
1931
1982
|
}
|
|
1932
1983
|
assert.equal(pkg.bundledDependencies, undefined, "webui optional companion packages should not be bundled into the tarball");
|
|
@@ -68,7 +68,7 @@ assert.match(server, /"issue-wizard-state\.mjs"/, "the static allowlist must con
|
|
|
68
68
|
assert.match(server, /"issue-bot-client\.mjs"/, "the static allowlist must serve the browser client module");
|
|
69
69
|
assert.match(serviceWorker, /"\/issue-wizard-state\.mjs"/, "the PWA shell must keep caching the pure wizard module");
|
|
70
70
|
assert.match(serviceWorker, /"\/issue-bot-client\.mjs"/, "the PWA shell must cache the browser client module");
|
|
71
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
71
|
+
assert.match(serviceWorker, /pi-webui-pwa-v50/, "the PWA cache name must change with browser wiring updates");
|
|
72
72
|
assert.match(packageJson, /node --check public\/issue-wizard-state\.mjs/, "the package check must keep syntax-checking the pure wizard module");
|
|
73
73
|
assert.match(packageJson, /node --check public\/issue-bot-client\.mjs/, "the package check must syntax-check the browser client module");
|
|
74
74
|
|
|
@@ -8,6 +8,7 @@ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
|
8
8
|
const html = fs.readFileSync(path.join(root, "public/index.html"), "utf8");
|
|
9
9
|
const css = fs.readFileSync(path.join(root, "public/styles.css"), "utf8");
|
|
10
10
|
const app = fs.readFileSync(path.join(root, "public/app.js"), "utf8");
|
|
11
|
+
const server = fs.readFileSync(path.join(root, "bin/pi-webui.mjs"), "utf8");
|
|
11
12
|
|
|
12
13
|
test("Control Deck exposes an accessible resize separator", () => {
|
|
13
14
|
assert.match(html, /id="sidePanelResizeHandle"[^>]*role="separator"[^>]*aria-orientation="vertical"[^>]*aria-label="Resize Control Deck width"[^>]*tabindex="0"/);
|
|
@@ -22,8 +23,14 @@ test("desktop layouts and Control Deck content follow the selected width", () =>
|
|
|
22
23
|
assert.match(css, /\.side-panel \{[\s\S]*width:\s*100%;[\s\S]*min-width:\s*0/);
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
test("Control Deck width is clamped, persisted, pointer-resizable, and keyboard-resizable", () => {
|
|
26
|
+
test("Control Deck width is clamped, user-persisted, pointer-resizable, and keyboard-resizable", () => {
|
|
26
27
|
assert.match(app, /const SIDE_PANEL_WIDTH_STORAGE_KEY = "pi-webui-side-panel-width"/);
|
|
28
|
+
assert.match(app, /const SIDE_PANEL_WIDTH_MAX_PX = 4096/);
|
|
29
|
+
assert.match(app, /width >= SIDE_PANEL_WIDTH_MIN_PX && width <= SIDE_PANEL_WIDTH_MAX_PX/);
|
|
30
|
+
assert.match(app, /function persistSidePanelWidth\(width\)[\s\S]*\/api\/interface-preferences[\s\S]*sidePanelWidth: rounded[\s\S]*scoped: false/);
|
|
31
|
+
assert.match(app, /async function restoreSidePanelWidthPreference\(\)[\s\S]*\/api\/interface-preferences[\s\S]*response\.data\?\.preferences\?\.sidePanelWidth[\s\S]*cacheSidePanelWidth/);
|
|
32
|
+
assert.match(server, /url\.pathname === "\/api\/interface-preferences" && req\.method === "GET"/);
|
|
33
|
+
assert.match(server, /url\.pathname === "\/api\/interface-preferences" && req\.method === "PUT"/);
|
|
27
34
|
assert.match(app, /function sidePanelMaxWidth\(\)[\s\S]*fileViewerVisible[\s\S]*splitOpen[\s\S]*primaryMinWidth[\s\S]*available/);
|
|
28
35
|
assert.match(app, /function applySidePanelWidth\(width, \{ persist = false \} = \{\}\)[\s\S]*--side-panel-width[\s\S]*persistSidePanelWidth/);
|
|
29
36
|
assert.match(app, /function beginSidePanelResize\(event\)[\s\S]*setPointerCapture[\s\S]*pointermove[\s\S]*pointercancel/);
|