Slice 11: branch-picker submenu in the right-click menu

Replace the Switch branch text prompt with a flyout submenu populated from GET /api/repo (the repo's branches; current one disabled); clicking a branch checks it out. Flips leftward near the viewport edge. New branch still prompts. Verified live: submenu lists branches and switches.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 17:44:55 -04:00
parent ad00654487
commit 68b6c3a3f8
3 changed files with 86 additions and 29 deletions
+9 -5
View File
@@ -11,11 +11,13 @@ event. Safe commands run on click; the destructive one confirms first (§1.4).
- **Listens:** `repo:contextmenu` on `document``detail: { repo, x, y }`
(dispatched by `<repo-list>` on right-click). Shows the menu at (x, y).
- **Commands → endpoints:**
- Get latest / Publish / Check for updates / Save my work… / Switch branch… /
New branch… / Discard all changes… → `POST /api/repo/git {path, op,
message?, branch?}` (op: pull/push/fetch/commit/checkout/create-branch/
discard). "Save my work…" prompts for a message; "Switch branch…"/"New
branch…" prompt for the branch; "Discard all changes…" confirms (destructive).
- Get latest / Publish / Check for updates / Save my work… / New branch… /
Discard all changes… → `POST /api/repo/git {path, op, message?, branch?}`
(op: pull/push/fetch/commit/create-branch/checkout/discard). "Save my work…"
prompts for a message; "New branch…" prompts for a name; "Discard all
changes…" confirms (destructive).
- **Switch branch ▸** — a flyout submenu populated from `GET /api/repo?path=`
(the repo's branches; current one disabled). Clicking a branch → checkout.
- Set as active project → `POST /api/active-project`.
- Ask Claude to switch here → `POST /api/switch` (the handoff request).
- Copy path → clipboard.
@@ -26,6 +28,8 @@ event. Safe commands run on click; the destructive one confirms first (§1.4).
actions, backed by the shared service layer (same ops Claude gets via MCP).
- 2026-09-20: added "Switch branch…" (checkout) and "New branch…" (create-branch),
both prompting for the branch name (slice 9).
- 2026-09-20: "Switch branch" is now a flyout submenu listing the repo's branches
(fetched from /api/repo), not a text prompt (slice 11). "New branch…" still prompts.
## Notes / gotchas
- Results aren't shown inline; they appear in `<activity-feed>` (each op records a