--- name: create-pr description: Create a Bitbucket pull request from a worktree branch. --- # Skill: create-pr Create a Bitbucket (or GitHub) pull request from a worktree branch. ## Invoked by 🎫 JiraOps mode (or 🪃 Orchestrator) ## Required Inputs | Input | Source | Example | |-------|--------|---------| | `TICKET_KEY` | Jira issue key | `PROJECT-123` | | `MODULE` | Module/component name | `auth`, `api`, `core` | ## Output - Pull request created targeting the main branch - Jira comment with PR link added - BigMind fact stored ## Steps ### 1. Get current branch ```bash cd - git branch --show-current ``` ### 2. Ensure all changes are committed ```bash git status ``` If uncommitted changes exist, warn the user before proceeding. ### 3. Push branch to origin ```bash git push -u origin ``` ### 4. Gather diff statistics ```bash git diff origin/main --stat git diff origin/main --name-only ``` ### 5. Read Jira ticket for context ```python ticket = retrieve_ticket_details(TICKET_KEY) # Extract: summary, description for PR title/description ``` ### 6. Compose PR title and description PR title format: ``` : ``` PR description template: ```markdown ## Jira : ## Description ## Changes ## Tests - Unit tests - Integration tests - All tests passing ✅ ## Checklist - [ ] Code review completed - [ ] Tests passing - [ ] No generated source modifications ``` ### 7. Create the pull request ```python create_pull_request( project_key="", repo_slug="", title=f"{TICKET_KEY}: {summary}", description=, from_branch=, to_branch="main" ) ``` ### 8. Add Jira comment with PR link ```python add_comment_to_ticket( issue_key=TICKET_KEY, comment=f"*Pull Request created*\n\nBranch: {BRANCH}\nPR: [PR #{pr_id}|]" ) ``` ### 9. Store in BigMind ```python memory_store_fact( category="codebase", fact=f"{TICKET_KEY}: PR #{pr_id} created — {BRANCH} → main. {N} files changed." ) ``` ## Error Handling | Error | Resolution | |-------|------------| | Branch not pushed | Run `git push -u origin ` first | | Uncommitted changes | Warn user, suggest `git add` + `git commit` | | PR already exists | Check `list_prs_for_repository` for existing PR from same branch | | Merge conflicts | Run `git fetch origin main && git merge origin/main` in worktree | | No diff (empty PR) | Branch is identical to `main` — nothing to merge | ## Conventions - PR title: always starts with `TICKET_KEY:` for Jira auto-linking - Target branch: typically `main` (configure per project) - One PR per ticket — don't create multiple PRs for the same branch