PR Formatter
Generates pull request title and body following VitalArc conventions.
Execution: Runs in forked context with general-purpose agent. Invocation: User-triggered only (creates PRs).
When to Use
- •End of workstation session (via session-orchestrator)
- •User requests PR creation
- •After significant feature completion
PR Format
Title
Follow conventional commits: <type>(<scope>): <description>
| Type | When to Use |
|---|---|
feat | New feature |
fix | Bug fix |
refactor | Code restructure |
docs | Documentation |
style | Formatting |
test | Tests |
chore | Maintenance |
| Scope | Area |
|---|---|
workout | Workout tracking |
nutrition | Food logging |
health | HealthKit, metrics |
analytics | Charts, insights |
ui | Design system, components |
infra | Infrastructure, DI |
Body Template
markdown
## Summary - [Primary change and why] - [Secondary changes] ## Changes - [List modified areas] ## Testing - [x] Build passes locally - [ ] CI passes - [ ] Unit tests pass - [ ] Manual testing done --- Session: [N] | Platform: macOS | Build: Verified Generated with [Claude Code](https://claude.ai/code)
Implementation
1. Analyze Changes
bash
# Get branch info BRANCH=$(git rev-parse --abbrev-ref HEAD) BASE_BRANCH="main" # Get commit history on this branch COMMITS=$(git log $BASE_BRANCH..HEAD --oneline) # Get diff stats DIFF_STAT=$(git diff --stat $BASE_BRANCH) # Get changed files by category DOMAIN_CHANGES=$(git diff --name-only $BASE_BRANCH | grep "Domain/") PRESENTATION_CHANGES=$(git diff --name-only $BASE_BRANCH | grep "Presentation/") INFRA_CHANGES=$(git diff --name-only $BASE_BRANCH | grep "Infrastructure/")
2. Determine Type and Scope
Based on changes:
- •New files in Domain/Entities →
feat - •Changes to existing files →
fixorrefactor - •Only Presentation changes →
uiscope - •Only Domain changes → appropriate domain scope
3. Generate Title
bash
# Extract from branch name or commits # Branch: dev/mac-notifications-12.3-2026-01-28 # → feat(notifications): add notification settings # Or from commit messages FIRST_COMMIT=$(git log $BASE_BRANCH..HEAD --oneline | tail -1)
4. Generate Body
bash
# Count changes FILES_CHANGED=$(git diff --name-only $BASE_BRANCH | wc -l) INSERTIONS=$(git diff --stat $BASE_BRANCH | tail -1 | grep -oE '[0-9]+ insertion' | grep -oE '[0-9]+') DELETIONS=$(git diff --stat $BASE_BRANCH | tail -1 | grep -oE '[0-9]+ deletion' | grep -oE '[0-9]+') # Get session info SESSION=$(cat .claude/session-state.json | grep -o '"current_session": "[^"]*"' | cut -d'"' -f4)
Output Format
PR Ready Output
markdown
## PR Ready ### Title
feat(notifications): add notification settings and TRIMP calculation
code
### Body ```markdown ## Summary - Added notification settings UI with UNUserNotificationCenter integration - Implemented TRIMP/Strain calculation for workout analytics - Completed typography token migration ## Changes - **Domain**: NotificationType, NotificationPreferences, StrainResult entities - **Presentation**: NotificationSettingsView, NotificationPreviewCard - **Use Cases**: CalculateStrainScoreUseCase ## Testing - [x] Build passes locally - [ ] CI passes - [ ] Unit tests pass - [ ] Manual testing done --- Session: 12.3 | Platform: macOS | Build: Verified Generated with [Claude Code](https://claude.ai/code)
Create Command
bash
gh pr create --title "feat(notifications): add notification settings and TRIMP calculation" --body "$(cat <<'EOF' [body content] EOF )"
code
### Draft PR With `--draft` flag: ```bash gh pr create --draft --title "..." --body "..."
Options
| Option | Description |
|---|---|
--draft | Create as draft PR |
--no-checklist | Omit testing checklist |
--base=branch | Specify base branch (default: main) |
Error Handling
No Changes
markdown
## No Changes to PR No commits found between main and current branch. Make sure you have: 1. Committed your changes 2. Pushed to remote
Cannot Determine Type
markdown
## Cannot Auto-Detect PR Type Changes span multiple areas. Please specify: **Suggested titles:** 1. `feat(notifications): add notification scheduling` (if primary feature) 2. `refactor(ui): update design system tokens` (if refactoring) 3. `chore(infra): update agent skills` (if infrastructure) Which would you like to use?
GitHub CLI Not Available
markdown
## GitHub CLI Not Found `gh` command not available. Install with: ```bash brew install gh gh auth login
Manual PR creation:
- •Push branch:
git push -u origin $(git branch --show-current) - •Open: https://github.com/tanujsutaria/VitalArc/pull/new/[branch]
- •Use the title and body above
code