com um clique
oh-merge
Review and merge open PRs for GitHub issues as a cohesive batch
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Review and merge open PRs for GitHub issues as a cohesive batch
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Do the work. Pre-flight, build, detect drift, salvage if needed. Use when you have a clear aim and are ready to implement.
Resolve multi-dependency fan-in by merging dependency PRs into a common base and updating issue dependencies
Claim a GitHub issue, create its branch and draft PR before implementation, execute the work in isolation, and hand the completed draft to RNA's full ship gate.
Check work and detect drift before committing. A second opinion that catches misalignment early. Use at natural pause points, before PRs, or when something feels off.
Agent-led PR/working-tree review triage. Start from the diff, add RNA graph/business context only where it changes review decisions, and state when raw git diff is enough.
Install and configure the Repo-Native Alignment (RNA) MCP server. Downloads the binary, configures the MCP server, pre-warms the code index, and updates AGENTS.md with tool guidance.
| name | oh-merge |
| description | Review and merge open PRs for GitHub issues as a cohesive batch |
Holistically review pending GitHub issue PRs from oh-task, then squash-merge them as a cohesive batch.
/oh-merge
Load project background from AGENTS.md, relevant .oh/ artifacts, and RNA MCP context when available.
Find all PRs with oh-merge label:
gh pr list --label oh-merge --json number,title,headRefName,baseRefName,additions,deletions
Only PRs with the oh-merge label are eligible for merge.
IMPORTANT: PRs with merge conflicts ARE eligible. The skill rebases and resolves conflicts in step 6. Do NOT skip PRs because of conflict status - that's exactly what this skill handles.
Build dependency graph and identify stacks:
Create adjacency list: baseRefName → [PRs targeting it]
Find root PRs: those where baseRefName = main (or master)
Identify stacks: chains where child PRs target parent PR branches
Detect cycles: If a branch eventually targets itself, report error and skip
Example graph:
main ← PR #42 (issue/123) ← PR #43 (issue/456)
main ← PR #44 (issue/789) [separate stack]
Select stack to process:
Batch review - evaluate all PRs in the selected stack together:
/review skill on the combined changesThis batch review supplements, but never replaces, each PR's project-specific /ship gate.
Merge stack in dependency order (root first, then children):
For each PR in the stack, starting from the root:
/review, and force-push with lease.main, rebase, and force-push before any validation.a. Verify the full RNA ship gate completed on the final pushed commit:
/ship step comments are present, including RNA-grounded review,
independent review, regression oracle, merit assessment, manual verification,
delivery verification, and final comment sweep./review sub-agent posted explicit APPROVE for the exact final commit./ship <pr-number>; do not merge directly.b. Verify CI is passing on that same final commit:
gh pr checks <pr-number> --fail-on-error
If CI is failing, stop and report error.
c. Squash merge:
gh pr merge <pr-number> --squash
d. For child PRs in the stack (after parent merged):
Update base branch to main:
gh pr edit <child-pr-number> --base main
Rebase child onto main:
gh pr checkout <child-pr-number>
git rebase origin/main
git push --force-with-lease
The rewrite invalidates prior validation. Return to step 0 and rerun the full ship gate, fresh independent final-diff review, and CI before merging.
e. On merge failure - If any PR in the stack fails to merge:
Note: GitHub automatically closes linked issues when the PR merges through
Closes #N in the PR body.
When PRs target other PR branches (not main), oh-merge detects the stack and processes it:
Detection:
gh pr list --label oh-merge --json number,title,headRefName,baseRefName
baseRefName = main are rootsbaseRefName = issue/<number> are children targeting that parentGraph building:
adjacency[baseRefName] = [list of PRs targeting it]
Example:
adjacency["main"] = [PR #42, PR #44]
adjacency["issue/123"] = [PR #43]
Stack 1: main ← #42 (issue/123) ← #43 (issue/456)
Stack 2: main ← #44 (issue/789)
Merge sequence (for Stack 1):
gh pr edit 43 --base maingit rebase origin/main && git push --force-with-leaseAfter processing:
Before: PR #43 → issue/123 → main
PR #42 → main
PR #44 → main (separate stack)
After: PR #42 merged to main (issue #123 auto-closed)
PR #43 rebased onto main, merged to main (issue #456 auto-closed)
PR #44 remains for next oh-merge run
The holistic review checks what individual PR reviews can't:
oh-merge label (human approval gate)/ship pipelineAPPROVE from a fresh, separate repo-local /review sub-agent on the exact final commitNote: The oh-merge label must be created in the repo. This is opt-in per repo.
oh-merge label foundCRITICAL: You MUST signal completion when done. Call the signal_completion tool as your FINAL action.
Signal based on outcome:
| Outcome | Call |
|---|---|
| Stack merged | signal_completion(status: "success", message: "Merged N PRs") |
| No PRs to merge | signal_completion(status: "success", message: "No PRs with oh-merge label") |
| Partial success | signal_completion(status: "error", error: "Merged N PRs, failed on PR #X: <reason>") |
| Unrecoverable failure | signal_completion(status: "error", error: "<reason>") |
If you do not signal, the orchestrator will not know you are done and the session becomes orphaned.
Fallback: If the signal_completion tool is not available, output your completion status as your final message in the format: COMPLETION: status=<status> message=<message> or COMPLETION: status=<status> error=<reason>.
$ /oh-merge
Finding PRs with oh-merge label...
Found 2 PRs:
PR #42 "Fix validation bug" (issue/123) → main (CI ✓)
PR #44 "Refactor validator" (issue/789) → main (CI ✓)
Building dependency graph...
Stack 1: main ← #42
Stack 2: main ← #44
2 independent stacks, processing Stack 1
Running batch review on Stack 1 (1 PR)...
Batch review complete: ✓ No issues
Processing PR #42 (Fix validation bug)...
Verifying CI... ✓
Rebasing onto main... clean
Squash merging... ✓
Issue #123 will auto-close on merge
Merge complete.
Merged: 1 PR (#42)
Remaining: 1 PR (#44 - queued for next run)
signal_completion(status: "success", message: "Merged 1 PR (#42)")
Done.
$ /oh-merge
Finding PRs with oh-merge label...
Found 3 PRs:
PR #42 "Fix validation bug" (issue/123) → main (CI ✓)
PR #43 "Add edge case tests" (issue/456) → issue/123 (CI ✓)
PR #44 "Refactor validator" (issue/789) → main (CI ✓)
Building dependency graph...
Stack 1: main ← #42 (issue/123) ← #43 (issue/456)
Stack 2: main ← #44
2 stacks found, processing Stack 1 (2 PRs)
Running batch review on Stack 1...
Collecting diffs: +547 -103 across 8 files
Batch review complete: ✓ No issues
Processing stack root: PR #42 (Fix validation bug)...
Verifying CI... ✓
Rebasing onto main... clean
Squash merging... ✓
Issue #123 will auto-close on merge
Processing stack child: PR #43 (Add edge case tests)...
Verifying CI... ✓
Updating base branch to main... done
Rebasing onto main... clean
Squash merging... ✓
Issue #456 will auto-close on merge
Stack merged.
Merged: 2 PRs (#42, #43)
Remaining: 1 PR (#44 - queued for next run)
signal_completion(status: "success", message: "Merged 2 PRs (#42, #43)")
Done.