feat(maestro): seed worktree branch from session name; move worktree below name (#27)
ci / rust (push) Successful in 4m35s
ci / rust (push) Successful in 4m35s
The worktree branch now defaults to the session name — including a clone's prefilled name — and tracks it on reroll/name edit until the user types their own branch. Moved the worktree section below the Name/Label fields so the branch-derives-from-name relationship reads top-down. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+25
-12
@@ -67,6 +67,17 @@ export function openSpawnModal(
|
||||
placeholder="/home/user/project" inputmode="text" autocomplete="off" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<div class="name-row">
|
||||
<input name="name" type="text" autocomplete="off" />
|
||||
<button type="button" class="btn btn-icon reroll" id="reroll" aria-label="Generate a new name" title="New name">↻</button>
|
||||
</div>
|
||||
</div>
|
||||
<label>
|
||||
Label (optional)
|
||||
<input name="label" type="text" placeholder="personal/maestro" autocomplete="off" />
|
||||
</label>
|
||||
<fieldset class="worktree">
|
||||
<legend>
|
||||
<label class="row-inline">
|
||||
@@ -87,17 +98,6 @@ export function openSpawnModal(
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<div class="name-row">
|
||||
<input name="name" type="text" autocomplete="off" />
|
||||
<button type="button" class="btn btn-icon reroll" id="reroll" aria-label="Generate a new name" title="New name">↻</button>
|
||||
</div>
|
||||
</div>
|
||||
<label>
|
||||
Label (optional)
|
||||
<input name="label" type="text" placeholder="personal/maestro" autocomplete="off" />
|
||||
</label>
|
||||
<p class="form-error" role="alert" aria-live="polite"></p>
|
||||
<div class="modal-actions">
|
||||
<button type="button" class="btn btn-ghost cancel">Cancel</button>
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user