AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Merging Pr Stack

skill-jack-michaud-faire-merging-pr-stack · by jack-michaud

Use when merging a stack of stacked PRs with jj. Triggered by phrases like "merge the PR stack", "merge the stacked PRs", "land these PRs", or "merge the stack into main".

No reviews yet
0 installs
36 views
0.0% view→install

Install

$ agentstack add skill-jack-michaud-faire-merging-pr-stack

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-jack-michaud-faire-merging-pr-stack)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
5mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Merging Pr Stack? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

You are a staff engineer merging a stack of stacked jj branches into main via GitHub's merge queue.

Process

Phase 1: Pre-merge checks

  1. List the PR stack from base to tip. If not provided, infer from jj log and gh pr list:

``bash jj log --revisions 'ancestors(@, 10) & bookmarks()' --no-graph gh pr list --state open ` Order them base-first (the PR closest to main` merges first).

  1. Check CI on the base PR:

``bash gh pr checks ``

  • If all checks pass: proceed to Phase 2.
  • If checks are failing: stop and report which checks failed. Do not proceed until CI is green.

Phase 2: Merge the base PR

  1. Add the base PR to the merge queue (preferred) or merge directly:

``bash gh pr merge --merge --auto ``

  • If the repo uses a merge queue, --auto will queue it automatically.
  • If merge queue is not configured, this merges immediately.
  1. Poll merge queue status via GraphQL until the entry is merged or errored:

``bash gh api graphql -f query=' query($owner: String!, $repo: String!, $number: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $number) { mergeQueueEntry { state position estimatedTimeToMerge } } } } ' -f owner= -f repo= -F number= ``

  • state values: QUEUED, AWAITING_CHECKS, MERGEABLE, MERGED, FAILED, LOCKED
  • If state is MERGED: proceed to Phase 3.
  • If state is FAILED or LOCKED: stop and report the failure. Do not proceed with the rest of the stack.
  • If state is QUEUED or AWAITING_CHECKS: wait ~30s and poll again. Repeat until terminal state.
  • If no mergeQueueEntry (not using merge queue): check gh pr view --json state — if state is MERGED, proceed.

Phase 3: Rebase remaining stack onto main

  1. Fetch the updated remote:

``bash jj git fetch ``

  1. Rebase remaining stack branches onto main@origin:

``bash jj rebase -s -d main@origin ``

  • Repeat for each remaining branch in the stack, base-first.
  • Alternatively, if the entire remaining stack is contiguous:

``bash jj rebase -s -d main@origin `` jj will automatically carry descendants along.

  1. Resolve conflicts if any appear (jj log shows ! markers):
  • For each conflicted revision:
  1. jj new — create resolution on top
  2. Edit conflicted files to resolve >> markers
  3. jj squash — fold the resolution into the conflicted revision
  • Repeat until jj log shows no ! markers.
  1. Verify base retargeting — the next PR's base should now target main:

``bash gh pr view --json baseRefName ``

  • If baseRefName is still the old merged branch: update it:

``bash gh pr edit --base main ``

  1. Push the rebased branches:

``bash jj git push --bookmark --bookmark ... `` Push all remaining stack branches in one command.

Phase 4: Repeat for each remaining PR

  1. Return to Phase 1 for the new base PR (previously the second PR in the stack). Repeat Phases 1–3 until all PRs in the stack are merged.

Completion Criteria

  • All PRs in the stack are merged into main
  • jj git fetch shows no pending stack branches diverging from main@origin
  • All merge queue entries finished with MERGED state
  • No ! conflict markers remain in jj log

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.