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
+5
View File
@@ -195,6 +195,7 @@ func main() {
Path string `json:"path"`
Op string `json:"op"`
Message string `json:"message"`
Branch string `json:"branch"`
}
if err := c.Bind(&body); err != nil {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid body"})
@@ -213,6 +214,10 @@ func main() {
out, err = svc.GitCommit(ctx, activity.ActorUser, body.Path, body.Message)
case "discard":
out, err = svc.GitDiscard(ctx, activity.ActorUser, body.Path)
case "checkout":
out, err = svc.GitCheckout(ctx, activity.ActorUser, body.Path, body.Branch)
case "create-branch":
out, err = svc.GitCreateBranch(ctx, activity.ActorUser, body.Path, body.Branch)
default:
return c.JSON(http.StatusBadRequest, map[string]string{"error": "unknown op: " + body.Op})
}