# Pr Stack

> >

- **Type:** Skill
- **Install:** `agentstack add skill-marcoskichel-empire-pr-stack`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [marcoskichel](https://agentstack.voostack.com/s/marcoskichel)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [marcoskichel](https://github.com/marcoskichel)
- **Source:** https://github.com/marcoskichel/empire/tree/main/plugins/empire-git/skills/pr-stack

## Install

```sh
agentstack add skill-marcoskichel-empire-pr-stack
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# PR Stack

Keep a "PR stack" comment in sync on every PR in a stacked chain. One comment per PR, each listing the whole chain with that PR highlighted. Merged PRs render struck-through. A lone PR against the default branch gets no comment.

**User input:** $ARGUMENTS

## When to run

- After creating a PR whose base is another open PR (a stacked PR).
- After merging a PR in a chain — merged rows must flip to struck-through, and downstream bases change (`pr-merge` retargets children before merging).
- After retargeting (changing the base of) any PR in a chain.
- Whenever the user asks to refresh, fix, or rebuild the stack comment.

`pr-merge` invokes this automatically after a successful merge. Run it manually otherwise.

## Step 1 — Anchor on a PR

The script anchors on one PR and discovers the rest of the chain from it.

- Default: the PR for the current branch.
- If the user named a PR number or URL, pass `--pr `.
- If not inside the target repo, pass `--repo `.

## Step 2 — Run the script

```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/pr-stack.mjs" [--pr ] [--repo ] [--dry-run]
```

Use `--dry-run` first when you want to preview the rendered comment and planned actions without posting anything.

The script:

1. Detects the repo and default branch.
2. Builds the live chain around the anchor PR by linking each PR's base branch to another open PR's head branch (walks parents up, children down).
3. Unions that with the membership recorded in any existing stack comment, so PRs that already merged (head branch deleted, link broken) stay listed.
4. Resolves each member's current state, title, and URL.
5. Upserts the marker comment on every open member, or removes it when the chain is no longer meaningful.

## Step 3 — Report

State what changed per PR (created / updated / removed / unchanged). Do not paste the full comment back unless asked.

## Rendering rules

The comment the script renders, for reference:

```

### PR stack

| PR |
| --- |
| ~~[Shared ESLint/Prettier/TypeScript config](https://github.com/o/r/pull/25)~~ ✅ |
| **[Coder server baseline](https://github.com/o/r/pull/15) ← this PR** |
| [Template CI + nightly deploy](https://github.com/o/r/pull/16) |
```

- Order is base → tip, top to bottom.
- Each row is `[]()`. GitHub does not render a bare PR link as its title — only the explicit link text shows inline — so the title is written out and refreshed every run.
- Current PR: bold, suffixed `← this PR`.
- Merged PR: struck-through, suffixed ✅.
- Closed-unmerged PR: struck-through, no check.
- First line is a hidden marker. `members=` records chain order and survives head-branch deletion. The marker is how the script finds and updates its own comment instead of duplicating.

## Chain detection

- A chain exists when ≥2 PRs are open, or ≥1 open PR rides on ≥1 merged sibling from the same stack.
- A single PR based on the default branch with no merged siblings is not a chain → any existing stack comment is removed.
- Branching stacks (a PR with multiple stacked children) render flat in discovery order; the script follows one child per level.

## Why

Stacked PRs hide their relationships. A reviewer opening PR 4 of 7 has no idea what came before or what depends on it. A self-updating stack comment makes the whole chain visible from any PR, and reflects merges as they happen so the picture never goes stale. Keeping it in a comment (not the PR body) leaves the body clean for `pr-description` and survives body rewrites.

## Source & license

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

- **Author:** [marcoskichel](https://github.com/marcoskichel)
- **Source:** [marcoskichel/empire](https://github.com/marcoskichel/empire)
- **License:** MIT

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

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-marcoskichel-empire-pr-stack
- Seller: https://agentstack.voostack.com/s/marcoskichel
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
