runAutoCreatePR returns a tea.Cmd that creates a PR in the background.
()
| 1409 | |
| 1410 | // runAutoCreatePR returns a tea.Cmd that creates a PR in the background. |
| 1411 | func (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. |
| 1434 | func (a *App) renderCompletionView() string { |
no test coverage detected