@@ -136,11 +136,24 @@ export function openSpawnModal(
// settles — so the fetch can't race past and clobber the seeded directory.
let cloneCwd: string | null = prefill?.cwd ?? null;
- // ---- name ------------------------------------------------------------
+ // ---- name (also seeds the worktree branch) ---------------------------
+ // The worktree branch defaults to the session name — including a clone's
+ // prefilled name — and tracks it on reroll/edit until the user types their
+ // own branch.
+ let branchEdited = false;
+ const syncBranchToName = () => {
+ if (!branchEdited) branchInput.value = nameInput.value;
+ };
nameInput.value = prefill?.name ?? generateName();
+ nameInput.addEventListener("input", syncBranchToName);
+ branchInput.addEventListener("input", () => {
+ branchEdited = true;
+ });
(host.querySelector("#reroll") as HTMLButtonElement).addEventListener("click", () => {
nameInput.value = generateName();
+ syncBranchToName();
});
+ syncBranchToName(); // seed the branch from the initial name
// ---- command tiles ---------------------------------------------------
function selectPreset(id: string): void {