refactor(agentic): canonicalize PR input DTO

This commit is contained in:
Virgil 2026-04-02 18:38:03 +00:00
parent 23063599df
commit 1b3d102684

View file

@ -20,13 +20,13 @@ import (
// --- agentic_create_pr ---
// CreatePRInput is the input for agentic_create_pr.
// PRInput is the input for agentic_create_pr and agentic_pr.
//
// input := CreatePRInput{
// input := PRInput{
// Workspace: "mcp-1773581873",
// Base: "main",
// }
type CreatePRInput struct {
type PRInput struct {
Workspace string `json:"workspace"` // workspace name (e.g. "mcp-1773581873")
Title string `json:"title,omitempty"` // PR title (default: task description)
Body string `json:"body,omitempty"` // PR body (default: auto-generated)
@ -34,6 +34,9 @@ type CreatePRInput struct {
DryRun bool `json:"dry_run,omitempty"` // preview without creating
}
// CreatePRInput is kept as a compatibility alias for older callers.
type CreatePRInput = PRInput
// CreatePROutput is the output for agentic_create_pr.
//
// // out.Success == true, out.Branch == "agent/issue-123-fix", out.Pushed == true
@ -55,7 +58,7 @@ func (s *PrepSubsystem) registerCreatePRTool(svc *coremcp.Service) {
}, s.createPR)
}
func (s *PrepSubsystem) createPR(ctx context.Context, _ *mcp.CallToolRequest, input CreatePRInput) (*mcp.CallToolResult, CreatePROutput, error) {
func (s *PrepSubsystem) createPR(ctx context.Context, _ *mcp.CallToolRequest, input PRInput) (*mcp.CallToolResult, CreatePROutput, error) {
if input.Workspace == "" {
return nil, CreatePROutput{}, coreerr.E("createPR", "workspace is required", nil)
}