List worktrees and reopenable branches in the Create worktree step #52

Merged
pedromcaraujo merged 1 commit from palette-reopen-branches into main 2026-10-31 18:15:20 +00:00

Summary

  • The palette's Create worktree step now lists, below the name input:
    • the channel's existing worktrees — pick one to switch to it;
    • local branches with no checkout, newest first ("Reopen <branch> · 2 hours ago") — pick one to recreate a worktree on it.
  • Both lists filter as you type; typing an exact existing branch name swaps the Create row for Reopen.
  • New GET /worktrees/branches?channel= in the tmux sidecar (git for-each-ref, skips branches checked out anywhere and names that can't be a session name, e.g. containing /; capped at 30).

Closing a worktree session always keeps its branch, so this turns an accidental close (easy on mobile, where × is always visible and a clean close doesn't confirm) into a one-tap undo.

Test plan

  • JS (node --check) and Python (py_compile) syntax checks
  • for-each-ref format verified against a real repo
  • After deploy: palette → Create worktree lists worktrees + branches; Reopen recreates the worktree and session
## Summary - The palette's **Create worktree** step now lists, below the name input: - the channel's existing worktrees — pick one to switch to it; - local branches with no checkout, newest first ("Reopen `<branch>` · 2 hours ago") — pick one to recreate a worktree on it. - Both lists filter as you type; typing an exact existing branch name swaps the Create row for Reopen. - New `GET /worktrees/branches?channel=` in the tmux sidecar (`git for-each-ref`, skips branches checked out anywhere and names that can't be a session name, e.g. containing `/`; capped at 30). Closing a worktree session always keeps its branch, so this turns an accidental close (easy on mobile, where × is always visible and a clean close doesn't confirm) into a one-tap undo. ## Test plan - [x] JS (`node --check`) and Python (`py_compile`) syntax checks - [x] `for-each-ref` format verified against a real repo - [ ] After deploy: palette → Create worktree lists worktrees + branches; Reopen recreates the worktree and session
List worktrees and reopenable branches in the Create worktree step
All checks were successful
CI / check (pull_request) Successful in 12s
9487ebce70
The palette's Create worktree prompt now shows the channel's existing
worktrees (switch to one) and its local branches with no checkout,
newest first (reopen one in a fresh worktree) — filtered by the typed
name. Closing a session keeps its branch, so this makes an accidental
close a one-tap undo. Branches come from a new GET /worktrees/branches.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pedromcaraujo/forge!52
No description provided.