Open source · MIT, TypeScript, runs on your machine or in your CI.

View source
DiffCarve
diffcarve · early CLI and GitHub Action

Cut the 1,500-line PR into a stack of small ones.

DiffCarve takes the pull request your coding agent just opened and splits it into layers ordered by what imports what, each with a reviewability score.

Features

What it does

Coding agents write a whole feature in one go. DiffCarve decides where to cut, from the code itself.

Dependency-ordered layers

Builds an import graph over the changed files with ts-morph and splits the diff so nothing depends on a later layer. Handles relative imports, tsconfig paths and package.json imports aliases.

diffcarve analyze <branch>

Reviewability score

0 to 100 per layer, pass at 50, with the lines, files, complexity delta and reverse dependencies behind it, so you know which layers to skim.

per layer

PR comment dry run

--dry-run prints the proposed stack as the markdown a PR comment would carry.

--dry-run

GitHub Action

Silent under 400 changed lines by default, otherwise posts or updates one comment. Needs only GITHUB_TOKEN, never blocks or approves, and your source never leaves the runner.

dry run only
Quick start

Run it

From the README. Node 22.18 or newer. Run it from the branch the PR targets: it diffs the branch against its merge base with HEAD.

npm install
npm run build
node dist/cli.js analyze my-feature-branch
node dist/cli.js analyze my-feature-branch --dry-run
npm test && npm run lint

As a GitHub Action, add uses: ai-automation-tools/diff-carve@main to a workflow on pull_request (opened, synchronize) with fetch-depth: 0; the optional threshold input sets the changed-line count before it comments. The full workflow is in the README.

Status

MVP prototype

On ten real oversized PRs the layers came out sensible on 6 (results), signed off as enough to keep building. No config file yet; diffcarve.yml, stacked PR chains, a merge gate and Python come later.

Resources

Read more