with one click
gwt-manage-pr
// Use when the user wants to create, inspect, update, or unblock a pull request and expects one visible entrypoint for the PR lifecycle.
// Use when the user wants to create, inspect, update, or unblock a pull request and expects one visible entrypoint for the PR lifecycle.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | gwt-manage-pr |
| description | Use when the user wants to create, inspect, update, or unblock a pull request and expects one visible entrypoint for the PR lifecycle. |
Single skill for the full PR lifecycle: create, check status, and fix blockers. Auto-detects the appropriate mode from current branch PR state, or accepts an explicit mode from the user.
Use the current user's language for decision summaries, blocker reports, and next-step guidance returned from this workflow.
Canonical agent-facing surface is gwtd pr ... / gwtd actions ... for PR inspection, create/update, and fix flows. The current implementation may still use GitHub REST / gh internally as transport, while GraphQL remains the transport for unresolved review threads and thread reply/resolve.
Every final user-facing report from this workflow MUST state whether a PR was
created, updated, fixed, or left unchanged. When a PR was created, pushed to,
or fixed, include a PR Update Summary derived from the actual diff, commit
range, and PR body. Do not invent changes from intent alone.
PR Update Summary must include:
NoneFor check and NO ACTION results, explicitly say no PR update was made.
If an existing PR is only inspected, summarize the current PR status separately
from PR Update Summary so the report does not imply new changes were pushed.
Final report shape:
## PR Result
- Action: Created | Updated | Fixed | Checked | No Action
- PR: #<number> <url> | None
- Branches: <base> <- <head>
### PR Update Summary
- Commits: <count or range>
- Updates:
- <what changed>
- Related: #<issue/spec> | None
- Verification: <commands/checks and status>
### Next
- <remaining blocker or "None">
Omit PR Update Summary only when no PR was created, updated, or fixed; in
that case include PR Update: none in the result.
Before executing any gwtd ... command from this skill or its references,
resolve GWT_BIN first: executable GWT_BIN_PATH, then command -v gwtd,
then $GWT_PROJECT_ROOT/target/debug/gwtd or ./target/debug/gwtd. Run the
command as "$GWT_BIN" ...; if none exists, stop with an actionable
gwtd not found error.
On invocation, run Shared Preflight, then route:
mergeable: CONFLICTING|DIRTY|BEHIND → fixN > 0 + no open PR → createN > 0 + open PR + clean merge state → create (push-only + post-push fix)N = 0 + open PR → fix (check CI / reviews / conflicts)N = 0 + no open PR → report NO ACTIONEvery mode begins with these steps. The order is intentional — commit count against the base branch comes before PR state lookup so that the MERGED shortcut ("PR is done therefore nothing to do") is structurally impossible.
Repo + branches:
git rev-parse --show-toplevel / git rev-parse --abbrev-ref HEADdevelop unless user specifies.Branch protection: Only develop may target main. Refuse any other branch targeting main.
Working tree state: git status --porcelain. If dirty, pause and present options (continue / abort / cleanup). Do not auto-commit/stash.
Fetch: git fetch origin
Commit count against base (mandatory first check):
N=$(git rev-list --count "origin/$base..HEAD")
Baseline ref rule: ALWAYS compare against
origin/<base>(the PR target branch, defaultorigin/develop). NEVER useorigin/<head>(the remote tracking branch of the current branch) — that only tells you if commits are pushed, not whether develop has your work. Confusing the two is the root cause of the MERGED-state false NO ACTION bug.
PR lookup + open-PR check:
gwtd pr current as the normal read path for the current branch.no current pull request as the canonical no-PR sentinel.has_open_pr = any entry with state == "open" && merged_at == nullmergeable:. CONFLICTING, DIRTY, and BEHIND are blocking merge states and immediately upgrade routing to fix.Route using the 2×2 matrix, with merge-state override:
| Commits (N) | Open PR? | Action |
|---|---|---|
| N > 0 | No | CREATE new PR |
| N > 0 | Yes | PUSH ONLY to existing PR → then FIX |
| N = 0 | Yes | FIX (CI / reviews / conflicts) |
| N = 0 | No | NO ACTION |
If the open PR reports mergeable: CONFLICTING, DIRTY, or BEHIND,
use FIX immediately instead of push-only/create. Outside that
override, PR state (MERGED / CLOSED) is not consulted.
Detailed logic in references/create-flow.md.
Create mode is entered from the Preflight 2×2 matrix when N > 0.
CONFLICTING / DIRTY / BEHIND → enter Fix mode before any push-only path.origin/$base, merge origin/$base first (never rebase). Push after merge.<type>(<scope>): <subject> (Conventional Commits)feat/fix/docs/chore/refactor/test/ci/perffeat//fix/ must match title type.codex/skills/gwt-manage-pr/references/pr-body-template.md<!-- GUIDE: ... --> comments from final outputTODO in required sections; derive content from diff/Issues/SPECs before asking userClosing Issues: Closes #N or None only. Bare #N without keyword is forbidden.gwtd pr create --base <base> [--head <head>] --title "<title>" -f <file> [--label <label>]* [--draft]gwtd pr edit <number> [--title "<title>"] [-f <file>] [--add-label <label>]*gh internally, but agent-facing workflow should stay on the gwtd pr surface.After PR creation or push, automatically enter fix mode and use gwtd pr checks, gwtd pr reviews, gwtd pr review-threads, and gwtd actions logs/job-logs as the normal inspection path.
Detailed logic in references/check-flow.md.
Read-only mode. Do not create/switch branches, push, or create/edit PRs.
gwtd pr currentgwtd pr view <number>gwtd pr checks <number>gwtd pr reviews <number>gwtd pr review-threads <number>gwtd actions logs --run <id> / gwtd actions job-logs --job <id>Human-readable summary using signal prefixes:
| Prefix | Action | Meaning |
|---|---|---|
>> | CREATE PR | Create a new PR |
> | PUSH ONLY | Push to existing PR |
~ | FIX | Fix CI / reviews / conflicts on existing PR |
-- | NO ACTION | Nothing to do |
!! | MANUAL CHECK | Manual check required |
Per-status templates:
Templates map directly from the Preflight 2×2 matrix:
>> CREATE PR -- <N> new commit(s) not covered by any PR.> PUSH ONLY -- Unmerged PR #<number> open for <head>. + PR URL~ FIX -- PR #<number> is <mergeable>; resolve base sync/conflicts before push-only.~ FIX -- PR #<number> open, checking CI/reviews/conflicts.-- NO ACTION -- No commits ahead of <base>, no open PR.!! MANUAL CHECK -- Could not determine commit count. + reasonAppend (!) Worktree has uncommitted changes. when dirty.
The commit count N = git rev-list --count origin/<base>..HEAD is
computed in the Shared Preflight and is the primary routing signal.
Check mode simply reports it:
N > 0 + no open PR → >> CREATE PR -- <N> new commit(s) not in any PR.N > 0 + open PR + clean merge state → > PUSH ONLY -- Unmerged PR open. + PR URLmergeable: CONFLICTING|DIRTY|BEHIND → ~ FIX -- PR is blocked by merge state.N = 0 + open PR → report CI / review / conflict statusN = 0 + no open PR → -- NO ACTIONThe old "Post-Merge Commit Check" logic (merge_commit ancestry,
fallback chain) is subsumed by git rev-list --count origin/<base>..HEAD
which directly answers "does develop have all my work?" regardless of
PR state.
Detailed logic in references/fix-flow.md.
mergeable / mergeStateStatus fields (CONFLICTING/DIRTY/BEHIND)CHANGES_REQUESTED state## Diagnosis Report: PR #<number>
**Merge Verdict: BLOCKED | CLEAR**
Blocking items: <N>
---
### BLOCKING
#### B1. [CATEGORY] <1-line title>
- **What:** Factual statement
- **Where:** file_path:line / check name / branch ref
- **Evidence:** Verbatim quote from output
- **Action:** Specific fix with file path/command
- **Auto-fix:** Yes | No (needs confirmation)
---
### INFORMATIONAL
#### I1. [CATEGORY] <1-line title>
- **What / Note**
---
**Summary:** <N> blocking, <M> informational.
Categories: CONFLICT, BRANCH-BEHIND, CI-FAILURE, CHANGE-REQUEST, UNRESOLVED-THREAD, REVIEW-COMMENT
Classification:
Each CHANGE-REQUEST, UNRESOLVED-THREAD, and UNANSWERED-COMMENT is a separate B-item.
Auto-fix: Yes --> proceed directly to fix.Auto-fix: No --> ask user about those items only.git fetch origin <base> && git merge origin/<base> && git pushNo reviewer comment may be left unanswered or unresolved.
gwtd pr review-threads reply-and-resolve <number> -f <file> to reply to and resolve all unresolved threads on the PR.resolveReviewThread.Post a PR summary comment via gwtd pr comment <number> -f <file>.
Re-run inspection with --mode all. Loop until exit code 0.
Same CI check fails 3 consecutive iterations --> report to user, ask continue/abort/change approach.
| Prohibited | Required Alternative |
|---|---|
| "We should look into..." | "Edit path/file.ts:42 to..." |
| "There seem to be some issues" | "3 blocking items detected" |
| "This might be causing..." | "Root cause: <error from log>" |
| "Consider fixing..." | "Action: Fix <what> in <where>" |
| "Various CI checks are failing" | "2 CI checks failing: build, lint" |
\n) in final comment text.When work is tracked in Issues:
Progress
- ...
Done
- ...
Next
- ...
PR lifecycle work is driven through the canonical gwtd pr ... and
gwtd actions ... surfaces. Do not depend on retired repo-local helper script
paths when running this workflow.
references/create-flow.md -- PR creation workflow detailsreferences/check-flow.md -- PR status checking detailsreferences/fix-flow.md -- CI/conflict/review fix detailsreferences/pr-body-template.md -- PR body template