Open Pull Request
Purpose
Create or update a repository-compliant pull request for committed work.
Use When
- The user wants to open a pull request for the current branch.
- The user wants to update the title or description of an existing pull request.
- The task requires applying repository PR rules before publishing work for review.
- The branch already contains the intended committed changes.
Do Not Use When
- The task is to create or switch branches.
- The task is to create the commit itself.
- The task is to transition Jira issue state.
- The task is to handle review comments after the pull request already exists.
Inputs
- Current branch or explicit head branch.
- Optional explicit base branch.
- Optional Jira issue key for the work being published.
- GitHub authentication that can read and create or edit pull requests for the target repository.
- Local Git checkout and network access needed for the repository-supported GitHub tooling.
- Jira authentication is required only when the task must emit a Jira item URL from
acli jira auth status.
- Repository PR rules from repo docs and shared standards.
- Installed shared package root:
${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current
Workflow
- Build repository context first.
- Read the target repository
AGENTS.md once per session. If you already loaded it earlier in this session and still have its full contents, reuse them instead of re-reading; if the context was summarized or you are unsure it is complete, read it again. Do not pre-load shared docs in this step; read them lazily only when the repository points to them.
- Read repository-specific docs when they exist, because they may extend or override shared guidance.
- Read shared docs only when the repository explicitly points to them. Resolve those shared docs from
${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current when available; otherwise read them from the main branch of the shared GitHub repository.
- Resolve the target PR context.
- Determine the current repository and head branch.
- Determine the intended base branch from repo context or user direction.
- Use
mpt-ext-tool-gh-pr-ops to check whether a PR already exists for the branch.
- Read PR rules before mutation.
- Use repository PR rules from repo docs first.
- When the repository relies on this shared package standard for PR formatting, read
standards/pull-requests.md using the shared-doc resolution rule from the repository context step, and use it as the source of truth.
- Build the complete PR title and description before creating the PR. Follow
standards/pull-requests.md for the description-at-creation rule and the AI-generated warning line; mpt-ext-tool-gh-pr-ops sets them atomically.
- Render the title deterministically with the bundled
render_pr_title.py so the Jira key, the summary, and any [HF]/[BACKPORT] marker match what the shared Danger action enforces:
python3 "${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-task-open-pull-request/scripts/render_pr_title.py" \
--jira-key MPT-1234 \
--summary "<short summary>" \
--kind feature \
--base-branch main
- Create or update the PR.
- If no PR exists for the branch, create a new PR through
mpt-ext-tool-gh-pr-ops, which sets the complete description at creation (or uses the draft-then-ready flow when it cannot be finalized yet).
- If a PR already exists for the branch, update the existing PR instead of creating a duplicate.
- Report the result clearly.
- Show whether the PR was created or updated.
- Show the PR title.
- Show the PR URL.
- When the Jira issue key is available, try to resolve the Jira site through
acli jira auth status and build the Jira item URL as https://<site>/browse/<issue-key>.
- Include testing status in the user-facing result message.
- Use the bundled deterministic script to render the compact user-facing output after successful PR creation or update:
python3 "${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-task-open-pull-request/scripts/render_result.py" \
--pr-url "<pr-url>" \
--jira-site "<site-from-acli-jira-auth-status>" \
--jira-key MPT-1234 \
--testing "<testing-status>"
- If the Jira item URL is not available safely, omit that line instead of inventing it.
- If
acli jira auth status does not return a reliable site value, omit the Jira: line instead of inventing it.
- Show blockers clearly when auth, permissions, missing branch context, or GitHub API failures prevent the operation.
Guardrails
- Never create a duplicate PR when one already exists for the branch.
- Never open a PR with a placeholder body and fill it in later; rely on
mpt-ext-tool-gh-pr-ops and standards/pull-requests.md for the description-at-creation and draft-then-ready flow.
- Never invent PR formatting rules; read repository context first.
- Never mix commit creation, branch creation, or Jira transitions into this task.
- Never silently choose the wrong base branch when repo context or user intent is ambiguous.
Bundled Resources
scripts/render_result.py
- Inputs: PR URL, testing status, optional Jira site, and optional Jira key
- Output: compact user-facing
PR, optional Jira, and Testing lines
- Runtime path:
${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-task-open-pull-request/scripts/render_result.py
scripts/render_pr_title.py
- Inputs:
--jira-key, --summary, --kind {feature,bugfix,hotfix,backport} (default feature), --base-branch (default main), optional --json
- Output: the PR title
[MARKER ]<JIRA-ID> <summary>; validates the Jira key and rejects a Conventional Commit prefix in the summary; adds [HF]/[BACKPORT] only for release-branch PRs
- Runtime path:
${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-task-open-pull-request/scripts/render_pr_title.py
Expected Outcome
The current branch has a repository-compliant pull request that was either created or updated successfully, or the task stops with a clear blocker that explains what must be fixed before the PR can be opened.
1---2name: mpt-ext-task-open-pull-request3description: Only open or update a repository-compliant pull request to publish committed work, reusing the existing PR instead of duplicating. Does not update docs, run checks, or transition Jira.4---56# Open Pull Request78## Purpose910Create or update a repository-compliant pull request for committed work.1112## Use When1314- The user wants to open a pull request for the current branch.15- The user wants to update the title or description of an existing pull request.16- The task requires applying repository PR rules before publishing work for review.17- The branch already contains the intended committed changes.1819## Do Not Use When2021- The task is to create or switch branches.22- The task is to create the commit itself.23- The task is to transition Jira issue state.24- The task is to handle review comments after the pull request already exists.2526## Inputs2728- Current branch or explicit head branch.29- Optional explicit base branch.30- Optional Jira issue key for the work being published.31- GitHub authentication that can read and create or edit pull requests for the target repository.32- Local Git checkout and network access needed for the repository-supported GitHub tooling.33- Jira authentication is required only when the task must emit a Jira item URL from `acli jira auth status`.34- Repository PR rules from repo docs and shared standards.35- Installed shared package root:3637```text38${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current39```4041## Workflow42431. Build repository context first.44- Read the target repository `AGENTS.md` once per session. If you already loaded it earlier in this session and still have its full contents, reuse them instead of re-reading; if the context was summarized or you are unsure it is complete, read it again. Do not pre-load shared docs in this step; read them lazily only when the repository points to them.45- Read repository-specific docs when they exist, because they may extend or override shared guidance.46- Read shared docs only when the repository explicitly points to them. Resolve those shared docs from `${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current` when available; otherwise read them from the `main` branch of the shared GitHub repository.47482. Resolve the target PR context.49- Determine the current repository and head branch.50- Determine the intended base branch from repo context or user direction.51- Use `mpt-ext-tool-gh-pr-ops` to check whether a PR already exists for the branch.52533. Read PR rules before mutation.54- Use repository PR rules from repo docs first.55- When the repository relies on this shared package standard for PR formatting, read `standards/pull-requests.md` using the shared-doc resolution rule from the repository context step, and use it as the source of truth.56- Build the complete PR title and description before creating the PR. Follow `standards/pull-requests.md` for the description-at-creation rule and the AI-generated warning line; `mpt-ext-tool-gh-pr-ops` sets them atomically.57- Render the title deterministically with the bundled `render_pr_title.py` so the Jira key, the summary, and any `[HF]`/`[BACKPORT]` marker match what the shared Danger action enforces:5859```bash60python3 "${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-task-open-pull-request/scripts/render_pr_title.py" \61 --jira-key MPT-1234 \62 --summary "<short summary>" \63 --kind feature \64 --base-branch main65```66674. Create or update the PR.68- If no PR exists for the branch, create a new PR through `mpt-ext-tool-gh-pr-ops`, which sets the complete description at creation (or uses the draft-then-ready flow when it cannot be finalized yet).69- If a PR already exists for the branch, update the existing PR instead of creating a duplicate.70715. Report the result clearly.72- Show whether the PR was created or updated.73- Show the PR title.74- Show the PR URL.75- When the Jira issue key is available, try to resolve the Jira site through `acli jira auth status` and build the Jira item URL as `https://<site>/browse/<issue-key>`.76- Include testing status in the user-facing result message.77- Use the bundled deterministic script to render the compact user-facing output after successful PR creation or update:7879```bash80python3 "${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-task-open-pull-request/scripts/render_result.py" \81 --pr-url "<pr-url>" \82 --jira-site "<site-from-acli-jira-auth-status>" \83 --jira-key MPT-1234 \84 --testing "<testing-status>"85```8687- If the Jira item URL is not available safely, omit that line instead of inventing it.88- If `acli jira auth status` does not return a reliable site value, omit the `Jira:` line instead of inventing it.89- Show blockers clearly when auth, permissions, missing branch context, or GitHub API failures prevent the operation.9091## Guardrails9293- Never create a duplicate PR when one already exists for the branch.94- Never open a PR with a placeholder body and fill it in later; rely on `mpt-ext-tool-gh-pr-ops` and `standards/pull-requests.md` for the description-at-creation and draft-then-ready flow.95- Never invent PR formatting rules; read repository context first.96- Never mix commit creation, branch creation, or Jira transitions into this task.97- Never silently choose the wrong base branch when repo context or user intent is ambiguous.9899## Bundled Resources100101- `scripts/render_result.py`102 - Inputs: PR URL, testing status, optional Jira site, and optional Jira key103 - Output: compact user-facing `PR`, optional `Jira`, and `Testing` lines104 - Runtime path: `${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-task-open-pull-request/scripts/render_result.py`105- `scripts/render_pr_title.py`106 - Inputs: `--jira-key`, `--summary`, `--kind {feature,bugfix,hotfix,backport}` (default `feature`), `--base-branch` (default `main`), optional `--json`107 - Output: the PR title `[MARKER ]<JIRA-ID> <summary>`; validates the Jira key and rejects a Conventional Commit prefix in the summary; adds `[HF]`/`[BACKPORT]` only for release-branch PRs108 - Runtime path: `${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-task-open-pull-request/scripts/render_pr_title.py`109110## Expected Outcome111112The current branch has a repository-compliant pull request that was either created or updated successfully, or the task stops with a clear blocker that explains what must be fixed before the PR can be opened.