|
| 1 | +# PR Workflow |
| 2 | + |
| 3 | +## Shared references |
| 4 | + |
| 5 | +Load before executing: |
| 6 | + |
| 7 | +- [Scope Detection](../shared/scope-detection.md) |
| 8 | +- [File Inclusion Policy](../shared/file-inclusion-policy.md) |
| 9 | +- [Safety Rules](../shared/safety-rules.md) |
| 10 | +- [Conventional Types](../shared/conventional-types.md) |
| 11 | + |
| 12 | +______________________________________________________________________ |
| 13 | + |
| 14 | +## Goal |
| 15 | + |
| 16 | +Prepare the current work for review and create a pull request that includes: |
| 17 | + |
| 18 | +- a correctly named branch |
| 19 | +- a conventional commit message |
| 20 | +- a PR title following the required format |
| 21 | +- a reviewable PR body that explains what changed, why, validation, and risk |
| 22 | + |
| 23 | +Template location: `../templates/pull-request-template.md` |
| 24 | + |
| 25 | +______________________________________________________________________ |
| 26 | + |
| 27 | +## PR title format |
| 28 | + |
| 29 | +``` |
| 30 | +<type>[optional scope]: <description> |
| 31 | +``` |
| 32 | + |
| 33 | +For breaking changes, append `!` after the type/scope: `feat(api)!: remove deprecated endpoint` |
| 34 | + |
| 35 | +Example: `feat(core): add automated PR workflow` |
| 36 | + |
| 37 | +______________________________________________________________________ |
| 38 | + |
| 39 | +## Branch rules |
| 40 | + |
| 41 | +Create a new branch if: |
| 42 | + |
| 43 | +- the current branch is `main` |
| 44 | +- the repository is in detached `HEAD` |
| 45 | + |
| 46 | +If already on a feature branch, use the current branch. |
| 47 | + |
| 48 | +Branch naming follows `<type>/<scope>-<short-description>` (or `<type>/<short-description>` when no scope applies). See [Branch Workflow](branch.md) for full naming rules. |
| 49 | + |
| 50 | +______________________________________________________________________ |
| 51 | + |
| 52 | +## Execution flow |
| 53 | + |
| 54 | +### 1 — Inspect repository |
| 55 | + |
| 56 | +Determine: current branch, whether HEAD is detached, git status, modified files, diff summary, and commit history against the base branch. |
| 57 | + |
| 58 | +### 2 — Infer metadata |
| 59 | + |
| 60 | +Determine: PR type, optional scope, short description, PR title, branch name. |
| 61 | + |
| 62 | +### 3 — Prepare branch |
| 63 | + |
| 64 | +If on `main` or detached `HEAD`, create a new branch and switch to it. Otherwise stay on the current branch. |
| 65 | + |
| 66 | +### 4 — Commit work |
| 67 | + |
| 68 | +Stage all user-modified files per [File Inclusion Policy](../shared/file-inclusion-policy.md). Exclude only obvious junk. Create commit. Skip if nothing to commit. |
| 69 | + |
| 70 | +### 5 — Push branch |
| 71 | + |
| 72 | +Push to origin. Set upstream if necessary. |
| 73 | + |
| 74 | +### 6 — Generate PR body |
| 75 | + |
| 76 | +Load `../templates/pull-request-template.md` and adapt it to the actual change. |
| 77 | + |
| 78 | +Treat the template as a default outline, not a rigid contract. Prioritize reviewer scanability and signal quality over filling every heading. |
| 79 | + |
| 80 | +Required information: |
| 81 | + |
| 82 | +- what changed |
| 83 | +- why it changed |
| 84 | +- how it was validated |
| 85 | + |
| 86 | +Default outline (adapt as needed): |
| 87 | + |
| 88 | +- Summary - 2-4 sentences covering what changed and why |
| 89 | +- Changes - grouped in the way that makes the diff easiest to review (for example by concern, subsystem, workflow, or user impact) |
| 90 | +- Validation - concrete tests, manual verification, and confidence signals |
| 91 | +- Breaking Changes - include only when applicable |
| 92 | +- Related Issues - include only when applicable; do not invent issue numbers |
| 93 | +- Release Notes - include only for user-visible or package-relevant changes |
| 94 | +- Notes for Reviewers - include when review guidance, risks, tradeoffs, follow-up context, or requested feedback focus would help; for UI changes, include screenshots/video links when useful |
| 95 | + |
| 96 | +Review mode: |
| 97 | + |
| 98 | +- open as draft when implementation is incomplete, checks are pending, or early feedback is requested |
| 99 | +- when draft, state what is incomplete and what feedback is being requested |
| 100 | + |
| 101 | +Rules: |
| 102 | + |
| 103 | +- omit empty sections entirely (do not include `N/A`, `None`, or `No related issues`) |
| 104 | +- prefer fewer, high-signal sections over boilerplate |
| 105 | +- use backticks for identifiers, commands, files, and code terms |
| 106 | +- keep the Summary concise and focused on intent, not file-by-file trivia |
| 107 | + |
| 108 | +### 7 — Create PR |
| 109 | + |
| 110 | +Create the pull request using the generated title and body, as draft or ready-for-review based on the review mode rules above. |
| 111 | + |
| 112 | +______________________________________________________________________ |
| 113 | + |
| 114 | +## Output |
| 115 | + |
| 116 | +Report: |
| 117 | + |
| 118 | +- branch name and whether it was created |
| 119 | +- commit message and whether a commit was created |
| 120 | +- PR title |
| 121 | +- PR body |
| 122 | +- any files excluded and why |
| 123 | +- any assumptions or blockers |
0 commit comments