68b6c3a3f8
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>
2.2 KiB
2.2 KiB
repo-menu
Intent
The right-click command menu (AGENT.md §6) — the app's reason for being: run git in plain language ("Get latest", "Publish", "Save my work…") without a terminal. A self-contained overlay control (§1.1) that any list can summon via an event. Safe commands run on click; the destructive one confirms first (§1.4).
Public surface
- Tag:
<repo-menu>(place once, near the end of the page). - Listens:
repo:contextmenuondocument—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… / 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.
- Get latest / Publish / Check for updates / Save my work… / New branch… /
Discard all changes… →
- Dismisses on outside click, Esc, or scroll.
History
- 2026-09-20: created — slice 6; plain-language git commands + coordination 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 agit-*event with ok/failed), and errors raise a browser alert. - Network ops (pull/push/fetch) need git credentials reachable from the server; inside Docker that means a mounted SSH agent / credential helper (§11) — until then they'll report an auth error. commit/discard are local and always work.