with one click
pr-opener
// Opens a GitHub pull request for the current branch using `gh pr create`. Composes the body with Summary + Test plan + Closes
// Opens a GitHub pull request for the current branch using `gh pr create`. Composes the body with Summary + Test plan + Closes
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | pr-opener |
| description | Opens a GitHub pull request for the current branch using `gh pr create`. Composes the body with Summary + Test plan + Closes |
| allowed-tools | Bash, Read |
| context | inline |
A PR without an issue link is a commit without a reason. Ciel's pr-opener guarantees every PR auto-closes its source issue on merge.
ISSUE_NUMBER: [from .git/ciel-work-context written by branch-setup]
BRANCH: [current branch ā from git rev-parse]
TITLE: [1-line summary ā imperative, ⤠70 chars]
BASE_BRANCH: [main usually, from .git/ciel-work-context]
DRAFT: [true|false ā default false, true if CI not yet green]
.git/ciel-work-contextgit log -1 --format=%s), strip conventional-commit prefix if presentgh run list --branch=$BRANCH --limit=1 --json status --jq '.[0].status' returns in_progress OR any test is failing# 1. gh auth
gh auth status 2>&1 | grep -q "Logged in" || { echo "gh not authenticated"; exit 1; }
# 2. Branch pushed to origin
CURRENT=$(git rev-parse --abbrev-ref HEAD)
git ls-remote --exit-code origin "$CURRENT" > /dev/null 2>&1 || {
echo "Branch not pushed ā pushing now"
git push -u origin "$CURRENT"
}
# 3. Work context exists
[ -f .git/ciel-work-context ] || { echo "No .git/ciel-work-context ā did branch-setup run?"; exit 1; }
# 4. Not already a PR open for this branch
gh pr list --head "$CURRENT" --state=open --json number --jq '.[0].number' | grep -q . && {
PR_NUM=$(gh pr list --head "$CURRENT" --state=open --json number --jq '.[0].number')
echo "PR already exists: #$PR_NUM ā updating body instead"
UPDATE_MODE=true
}
Extract linked issue from branch name (<type>/<N>-... ā issue #N) or .git/ciel-work-context.
Summarize changes from commits + diff stat: top 3 changes by impact (by lines changed or commit subject classification). Avoid exhaustive file list.
Assemble with:
ISSUE_NUMBER: <N>
BRANCH: <branch>
COMMITS: git log origin/$BASE_BRANCH..HEAD --oneline
CHANGED_FILES: git diff --stat origin/$BASE_BRANCH...HEAD
RELIRE_VERDICT: [from critic agent if invoked]
CI_STATUS: gh run list --branch=<branch> --limit=1 --json conclusion
EVIDENCE: [prouver-verifier output if applicable]
Expected body structure (generated):
## Summary
<1-3 bullets ā what changed and why>
## Closes
Closes #<N>
## Changes
<git diff --stat output>
## Test plan
- [x] Unit tests pass (<N> added/modified)
- [x] Integration tests pass
- [x] Manual verification: <staging evidence from prouver-verifier>
- [x] No regression on existing suites
## Evidence
- Staging logs: <snippet>
- CI run: <URL to gh run>
- RELIRE verdict: <BLOCKING: none | IMPORTANT: N | MINOR: N>
š¤ Opened by Ciel (pr-opener)
if [ -z "$UPDATE_MODE" ]; then
gh pr create \
--base "$BASE_BRANCH" \
--head "$CURRENT" \
--title "<title>" \
--body-file /tmp/ciel-pr-body-$$ \
$([ "$DRAFT" = "true" ] && echo "--draft")
else
gh pr edit "$PR_NUM" --body-file /tmp/ciel-pr-body-$$
fi
[PR OPENED]
Number: #<P>
URL: https://github.com/<org>/<repo>/pull/<P>
Closes: #<N>
Draft: <true|false>
CI: <pending|running|passed|failed>
prouver-verifier MUST have run green before the merge command (mirror of skills/ciel/SKILL.md) ā applies to every merge path: gh pr merge [--auto|--squash|--merge|--rebase], git push direct-to-default, GitHub UI "Merge" button. If pr-opener is asked to auto-merge (e.g., user passes a --merge-when-green intent), refuse unless .git/ciel-prouver-verdict exists with verdict=PASS.--no-verify ā pre-push hooks run; if they fail, investigate, don't skip.branch-setupprouver-verifier PROUVER step completes successfullygh auth status passes?.git/ciel-work-context exists?gh pr view succeeds)Closes #N present in body?pr-opener DOES NOT close the issue ā issue-closer does that POST-merge with evidence. The PR body's Closes #N is a GitHub-level auto-close hook; issue-closer adds the structured comment with production evidence after merge lands.