Slice 6: right-click command menu + git write actions

git boundary: Pull/Push/Commit/DiscardAll (discard is 1.4-destructive). Scanner.RefreshRepo re-scans one repo after a mutation. Service GitFetch/GitPull/GitPush/GitCommit/GitDiscard record a git-* activity event and refresh on success; service.New takes a refresh hook. HTTP POST /api/repo/git. New <repo-menu> overlay with plain-language commands (Get latest/Publish/Check for updates/Save my work/Set active/Ask Claude to switch/Copy path/Discard all changes), summoned by repo-list's repo:contextmenu. Added service test for commit/discard on a temp repo. Verified the menu live for safe commands.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 09:12:18 -04:00
parent 9d1519222c
commit 6ef1c195e3
13 changed files with 521 additions and 9 deletions
+32
View File
@@ -0,0 +1,32 @@
# 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: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… / Discard all
changes… → `POST /api/repo/git {path, op, message?}` (op: pull/push/fetch/
commit/discard). "Save my work…" prompts for a message; "Discard all
changes…" confirms (destructive).
- Set as active project → `POST /api/active-project`.
- Ask Claude to switch here → `POST /api/switch` (the handoff request).
- Copy path → clipboard.
- 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).
## Notes / gotchas
- Results aren't shown inline; they appear in `<activity-feed>` (each op records a
`git-*` 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.