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:
@@ -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})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user