| name | workflow-ship |
| description | Use when the user asks to run workflow:ship, ship a branch, publish a feature branch, open and merge a PR, or push/PR/merge/cleanup completed work. |
| license | MIT |
Workflow Ship
Ship the current feature branch by pushing, opening a PR, merging it to main, and cleaning up safely.
Trigger Phrases
workflow:ship
ship workflow
ship this branch
publish this branch
open and merge a PR
push, PR, merge, and clean up
Process
-
Verify branch state:
- Run
git branch --show-current.
- Stop if the branch is
main or master.
- Run
git status --short --branch.
- Stop if there are uncommitted changes and suggest
workflow:commit.
- Resolve the base ref: use local
main when present, otherwise use origin/main.
- Run
git log <base-ref>..HEAD --oneline and stop if there are no commits ahead of the base ref.
-
Run Codex review as final gate:
-
Push the branch:
- Detect whether an upstream exists with
git rev-parse --abbrev-ref --symbolic-full-name @{u}.
- If no upstream exists, run
git push -u origin <branch>.
- If upstream exists, run
git push.
-
Summarize the shipment:
- Run
git log <base-ref>..HEAD --oneline.
- Run
git diff --stat <base-ref>...HEAD.
- Show the commits and a compact summary before creating the PR.
-
Create the PR:
- Use
gh pr create.
- Derive the title from the branch name and commits using conventional-commit style.
- Include a body with
## Summary and ## Test plan.
- Show the PR URL.
-
Merge safely:
- Run
gh pr merge <number> --merge --delete-branch.
- If the merge fails because checks are failing, conflicts exist, or review is required, stop and report the blocker.
- Never force-merge.
-
Update local main:
- Switch to
main.
- Pull the latest
main.
-
Delete the local branch:
- Run
git branch -d <branch>.
- If safe deletion fails, do not use
-D; report the reason and let the user decide.
-
Confirm final state:
- Run
git status --short --branch.
- Run
git branch --list.
- Confirm the worktree is clean and on
main.
Error Handling
- If the branch has no commits ahead of
main, stop and say there is nothing to ship.
- If
codex is not on PATH, stop with a clear error — do not silently skip the review gate.
- If
codex review exits non-zero, stop and report the failure — do not push.
- If
gh is not authenticated or available, stop and report the exact blocker.
- If the remote branch was already deleted by the merge step, skip remote deletion silently.
Command Notes
- Follow the active agent and project shell rules.
- Use non-interactive git commands whenever possible.
- Do not run destructive commands unless the user explicitly asks for them.