pdir-merge-pr

pdir-merge-pr is a command for Claude Code from hmaurus/masterclaude. It costs 26 tokens per session (708 once invoked), scanned A, original, MIT.

A command for completing an approved GitHub pull request, which is a proposed code change, by combining its commits and cleaning up its branches.

In plain words
What is it for?
Use it when a pull request is approved and ready to merge, to run project checks, inspect continuous-integration results, squash-merge it, and remove the related branches.
Why use it?
It guides the final checks and prevents merging the wrong, unfinished, or failing pull request.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the pdir-workflow plugin — 7 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/hmaurus/masterclaude/pdir-merge-pr
Clone the repo
git clone --depth 1 https://github.com/hmaurus/masterclaude

Made for: Claude Code.

Or install pdir-workflow, the plugin that ships this one along with the rest of its 7 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pdir-merge-pr

README.md
[![agentmods](https://agentmods.dev/badge/commands/hmaurus/masterclaude/pdir-merge-pr.svg)](https://agentmods.dev/commands/hmaurus/masterclaude/pdir-merge-pr)
Your own site
<a href="https://agentmods.dev/commands/hmaurus/masterclaude/pdir-merge-pr"><img src="https://agentmods.dev/badge/commands/hmaurus/masterclaude/pdir-merge-pr.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 708 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.00708
Opus 5 $0.00013 $0.00354
Sonnet 5 $0.00005 $0.00142
Haiku 4.5 $0.00003 $0.00071

Measured 5d ago against content hash 3ac172cc71fb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

pdir-merge-pr scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/pdir-workflow/commands/pdir-merge-pr.md · 69 lines

How it starts

The opening of the file, as written. The whole thing — 69 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PDIR: Merge PR

Valida, faz o squash merge do PR e limpa a branch local/remota.

Pré-requisito: PR aprovado e pronto para merge.

Em qualquer passo, se algo falhar ou faltar informação, informe o erro e pergunte ao usuário como prosseguir.

Descobrir o PR

  • Com argumento ($ARGUMENTS): número do PR (descarte o # se vier).
  • Sem argumento: use o PR aberto da branch atual.

Leia o PR com gh pr view <número> --json number,title,state,isDraft,headRefName e mostre número + título — é a conferência de que você vai mergear o PR certo. Um squash merge com --delete-branch é irreversível na prática (some com a branch). Se o PR não estiver aberto (já mergeado/fechado) ou for draft, pare e avise — não faça merge.

Instruções

1. Validar localmente

Rode os checks do projeto (lint, type-check, build) — consulte package.json, Makefile ou equivalente para os comandos disponíveis. Se algum falhar, pare e informe ao usuário.

2. Verificar o CI do PR

Cheque o status dos checks de CI do PR (gh pr checks <número>). Se houver algo falhando, pare e pergunte se o usuário quer aguardar, seguir mesmo assim, ou abortar.

3. Fazer o merge

Guarde o nome da branch de origem do PR — o headRefName que você leu ao descobrir o PR. Precisa dele para a limpeza, e a branch pode sumir logo em seguida.

Faça o squash merge deletando a branch:

gh pr merge <número> --squash --delete-branch

O --squash (convenção do PDIR: um commit por PR) e o --delete-branch (remove a branch remota — e a local, se você estiver nela) são intencionais — mantenha ambos.

4. Sincronizar o local

Volte para o branch default e atualize-o:

DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)
git checkout "$DEFAULT_BRANCH"
git pull origin "$DEFAULT_BRANCH"

O passo anterior já removeu a branch de origem remota (e a local, se você estava nela). Se a branch local ainda existir, remova-a com git branch -d <headRefName>. O -d recusa apagar trabalho não mergeado — se ele reclamar, não force com -D: investigue por que a branch parece não mergeada.

Read the full file on GitHub · 69 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 69 lines · 26 tokens per session scan A 3ac172cc71fb

Subscribe to this mod's changes

pdir-merge-pr is a command published in the GitHub repository hmaurus/masterclaude (2 stars, last pushed 1mo ago), licensed MIT. It adds 26 tokens to every session and 708 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.