Measure pull request size from git numstat or a diff, skipping lock and generated files, and plan how to split big changes into reviewable slices. Use when the user asks if a PR is too big, wants a size check, or asks to split a PR.
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
#!/usr/bin/env python3
"""Measure pull request size from `git diff --numstat` or a unified diff.
Usage:
git diff --numstat origin/main...HEAD | python3 scripts/pr_size.py --numstat - --suggest
python3 scripts/pr_size.py --diff change.diff --warn 300 --fail 800
Options: --numstat FILE | --diff FILE (exactly one; '-' is standard input), --warn N (400),
--fail N (1000), --limit N (400), --depth N (1), --suggest, --ignore PATTERN (repeatable).
Exit codes: 0 ok or warn, 1 fail, 2 usage or input error. Standard library only; this script
never runs git itself, you pipe the diff in.
"""
from __future__ import annotations
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from pr_size_guard.__main__ import main
if __name__ == "__main__":
sys.exit(main())