MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / runAutoCreatePR

Method runAutoCreatePR

internal/tui/app.go:1411–1431  ·  view source on GitHub ↗

runAutoCreatePR returns a tea.Cmd that creates a PR in the background.

()

Source from the content-addressed store, hash-verified

1409
1410// runAutoCreatePR returns a tea.Cmd that creates a PR in the background.
1411func (a *App) runAutoCreatePR() tea.Cmd {
1412 prdName := a.completionScreen.PRDName()
1413 branch := a.completionScreen.Branch()
1414 dir := a.baseDir
1415
1416 // Load the PRD to generate PR content
1417 prdPath := filepath.Join(a.baseDir, ".chief", "prds", prdName, "prd.json")
1418 return func() tea.Msg {
1419 p, err := prd.LoadPRD(prdPath)
1420 if err != nil {
1421 return autoActionResultMsg{action: "pr", err: fmt.Errorf("failed to load PRD: %s", err.Error())}
1422 }
1423 title := git.PRTitleFromPRD(prdName, p)
1424 body := git.PRBodyFromPRD(p)
1425 url, err := git.CreatePR(dir, branch, title, body)
1426 if err != nil {
1427 return autoActionResultMsg{action: "pr", err: err}
1428 }
1429 return autoActionResultMsg{action: "pr", prURL: url, prTitle: title}
1430 }
1431}
1432
1433// renderCompletionView renders the completion screen.
1434func (a *App) renderCompletionView() string {

Callers 1

Calls 6

LoadPRDFunction · 0.92
PRTitleFromPRDFunction · 0.92
PRBodyFromPRDFunction · 0.92
CreatePRFunction · 0.92
PRDNameMethod · 0.80
BranchMethod · 0.80

Tested by

no test coverage detected