Create a draft PR with a validated body template and issue linkage.
Create a draft PR using a consistent template. Validate body locally before opening.
Base branch (default main), head branch (default current), PR title, issue number, summary bullets (1-4), implementation checklist items, validation checklist items.
Confirm branch state — Verify not on main. Verify at least one commit exists. Push if needed:
git push -u origin <branch>
Build PR body — Write a temporary markdown file:
Fixes #<number>
## Summary
- <bullet>
## Implementation Plan
- [ ] <step>
## Validation
- [ ] <criterion>
Validate body — Run:
powershell -ExecutionPolicy Bypass -File tools/validate_pr_body.ps1 -Body (Get-Content -Raw <tmpfile>)
Fix and re-run until green.
Create draft PR — Run:
gh pr create --draft --base <base> --head <head> --title "<title>" --body-file <tmpfile>
Verify & cleanup — Run gh pr view --json number,url,body. Confirm formatting persisted. Delete the temporary body file.
PR URL, linked issue number, validation result.