feat(maestro): pick a project, then its worktree
The working-directory picker was a flat list mixing repositories with their worktrees, each row repeating the project name as an abbreviated path. It is now two steps: a grid of project boxes carrying the full unabbreviated path, then — only once a project is picked — that repository's worktrees with "+ new" as the default. "+ new" creates a worktree; picking an existing one runs in it and leaves the create-worktree toggle off, since the daemon never adopts (docs/WORKTREES.md). That is #91's rule, now an explicit choice rather than an inference from which row was clicked. Also fixes `.raw-wrap[hidden]`: `display: flex` outranked the UA sheet's `[hidden]`, so the free-text cwd input showed even when hidden. The interaction rules are listed in spawnForm.ts for the TUI mirror (#96) to follow. Refs #95
This commit is contained in:
@@ -80,10 +80,10 @@ describe("spawnForm worktree defaults and branch picker (#61)", () => {
|
||||
};
|
||||
|
||||
function pickProject(form: HTMLFormElement): void {
|
||||
form.querySelector<HTMLButtonElement>(".project-row.project-other")!.click();
|
||||
form.querySelector<HTMLButtonElement>(".project-other")!.click();
|
||||
form
|
||||
.querySelectorAll<HTMLButtonElement>(".project-row")
|
||||
.forEach((row) => row.dataset.cwd === "/home/user/maestro" && row.click());
|
||||
.querySelectorAll<HTMLButtonElement>(".project-box")
|
||||
.forEach((box) => box.dataset.cwd === "/home/user/maestro" && box.click());
|
||||
}
|
||||
|
||||
it("defaults the worktree toggle on for a picked project with no gitroot probe", async () => {
|
||||
@@ -118,8 +118,8 @@ describe("spawnForm worktree defaults and branch picker (#61)", () => {
|
||||
for (let i = 0; i < 40; i++) await Promise.resolve();
|
||||
|
||||
handle.el
|
||||
.querySelectorAll<HTMLButtonElement>(".project-row")
|
||||
.forEach((row) => row.dataset.cwd === "/home/user/wt-91" && row.click());
|
||||
.querySelectorAll<HTMLButtonElement>(".project-box")
|
||||
.forEach((box) => box.dataset.cwd === "/home/user/wt-91" && box.click());
|
||||
await drain();
|
||||
|
||||
expect(handle.el.querySelector<HTMLInputElement>("input[name=worktree_enabled]")!.checked).toBe(
|
||||
@@ -133,7 +133,7 @@ describe("spawnForm worktree defaults and branch picker (#61)", () => {
|
||||
const form = await mount();
|
||||
|
||||
// Escape hatch: switch to a free-text dir; only now does /api/gitroot fire.
|
||||
form.querySelector<HTMLElement>(".project-row.project-other")!.click();
|
||||
form.querySelector<HTMLElement>(".project-other")!.click();
|
||||
const raw = form.querySelector<HTMLInputElement>("input[name=cwd_raw]")!;
|
||||
raw.value = "/opt/somewhere";
|
||||
raw.dispatchEvent(new Event("input"));
|
||||
|
||||
Reference in New Issue
Block a user