-
If the current branch is main, stop and say a PR must come from a feature branch.
-
Inspect changed files as needed so the PR matches the actual work, not just the commit subjects.
-
Write a clear PR title in imperative mood, under 72 characters.
-
Write a Markdown body with these sections:
## What
## Why
## How
## Test plan
-
Push the current branch to origin with upstream if needed (git push -u origin <branch>).
-
If a PR already exists for this branch, update it:
gh pr edit --base main --title "<title>" --body-file <tmpfile>
-
Otherwise create it:
gh pr create --base main --title "<title>" --body-file <tmpfile>
-
Use a temporary file for the PR body instead of inline shell quoting.
-
After success, print the PR URL, the final title, and the final body.
-
If origin/main or GitHub auth is unavailable, explain the blocker briefly and stop.