Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

split-pr

Python 3.11+ License: MIT Tests Claude Code Plugin

Stop letting monster PRs die in review purgatory.

A Claude Code plugin that splits large PRs into chains of small, reviewable PRs. It analyzes your diff semantically — using tree-sitter for per-function granularity — builds a dependency DAG, verifies the split is lossless, and creates the PRs with proper base branches and merge order.

Install

/plugin marketplace add emilhe/split-pr
/plugin install split-pr@emilhe-split-pr

Usage

/split-pr                              # split current branch vs main
/split-pr --base develop               # different base branch
/split-pr --name auth-refactor         # custom prefix for PR titles
/split-pr --threshold 600              # larger PRs allowed (default: 400 lines)
/split-pr --max-files 15               # max files per PR (default: 10)
/split-pr --bulk "vendor/"             # skip AST analysis for vendored paths
/split-pr --auto                       # skip interactive review
/split-pr --pr 42                      # split an existing PR

How it works

┌─────────────────────────────────────────────────────────────┐
│                        /split-pr                            │
│                     (skill orchestrator)                    │
└──────────────┬──────────────────────┬───────────────────────┘
               │                      │
               ▼                      ▼
┌──────────────────────┐  ┌───────────────────────┐
│   Discovery Agent    │  │    Splitter Agent      │
│                      │  │                        │
│  Classify hunks      │  │  Create branches       │
│  Build topic DAG     │  │  Apply patches         │
│  Detect vendored     │  │  Run validation        │
│  code, shims         │  │  Create PRs via gh     │
│  Recursive decomp    │  │  Update descriptions   │
└──────────┬───────────┘  └───────────┬────────────┘
           │                          │
           ▼                          ▼
┌─────────────────────────────────────────────────────────────┐
│                    split-pr-tools CLI                        │
│                                                             │
│  Python library: diff_parser, analyzer, dag, state          │
│  tree-sitter AST analysis, pure computation, zero git dep   │
└─────────────────────────────────────────────────────────────┘

AI does the thinking (topic classification, dependency detection). Code does the math (AST analysis, DAG operations, diff parsing, lossless verification).

Key features

  • Tree-sitter AST analysis — splits large files into per-function virtual hunks, so different functions can go to different PRs
  • Hunk-level splitting — works with messy, entangled commits
  • DAG-based dependencies — independent topics can be reviewed in parallel
  • Lossless verification — every hunk accounted for before any PRs are created
  • Smart grouping — vendored code stays bundled, tests travel with the code they test
  • Tracking issue — auto-created checklist with clickable DAG and merge order

Local development

git clone https://github.com/emilhe/split-pr.git
cd split-pr

uv sync --all-extras          # install deps
uv run pytest                 # run tests
uv tool install --force .     # install CLI globally

# Symlink skill + agents into Claude Code
mkdir -p ~/.claude/skills/split-pr ~/.claude/agents
ln -sf "$(pwd)/commands/split-pr.md" ~/.claude/skills/split-pr/SKILL.md
ln -sf "$(pwd)/agents/pr-discovery.md" ~/.claude/agents/pr-discovery.md
ln -sf "$(pwd)/agents/pr-splitter.md" ~/.claude/agents/pr-splitter.md

Add to ~/.claude/settings.json for permission-free CLI calls:

{
  "permissions": {
    "allow": [
      "Bash(split-pr-tools *)",
      "Write(/tmp/split-pr-*)"
    ]
  }
}

Tech stack

CLI Typer
Diff parsing unidiff
AST analysis tree-sitter
Graph algorithms NetworkX
Package management uv
AI orchestration Claude Code skills + agents
Git operations git + gh CLI

License

MIT

About

Claude Code plugin for splitting (large) PRs into smaller pieces

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages