Slice 9: git_checkout and create_branch (menu + MCP)

git boundary Checkout/CreateBranch; service GitCheckout/GitCreateBranch (activity detail names the branch; gitAction takes an ok-detail). HTTP /api/repo/git ops checkout + create-branch (branch field). MCP tools git_checkout and create_branch. <repo-menu> gains Switch branch… and New branch… (prompt for name). Service test covers create+switch and existing-branch failure. Checkout is not destructive - git refuses if it would overwrite changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 17:27:58 -04:00
parent e59d5bbd29
commit e1999bcf21
10 changed files with 136 additions and 14 deletions
+13
View File
@@ -217,3 +217,16 @@ Append-only running history of all changes (AGENT.md §9.1). Newest last.
set; `http.extraheader` present; `git_fetch` via the app returned ok.
- **Security note:** the token is written to the container's ephemeral gitconfig
and passed in a `git config` argv — acceptable for a localhost dev container.
## 2026-09-20 — Slice 9: git_checkout + create_branch
- **What:** git boundary `Checkout` (switch existing branch) and `CreateBranch`
(git checkout -b). Service `GitCheckout`/`GitCreateBranch` (feed detail names
the branch; `gitAction` now takes an ok-detail). HTTP `/api/repo/git` gained
ops `checkout` and `create-branch` (+`branch` field). MCP tools `git_checkout`
and `create_branch`. `<repo-menu>` gained "Switch branch…" and "New branch…"
(prompt for the name). Service test covers create+switch+existing-branch-fails.
- **Why:** Round out the everyday git commands in both front doors (§1.7).
- **Affects:** `internal/git`, `internal/service` (+test), `internal/mcp`,
`cmd/server/main.go`, `components/repo-menu`, `web/templates/help.html`,
`AGENT.md` (§8.1). Checkout isn't §1.4-destructive — git refuses if it would
overwrite uncommitted changes.