Skip to main content

AI-powered PR description generator that understands your git diff

Project description

gpr — AI-powered PR descriptions and commit messages from your git diff

Stop writing PR descriptions and commit messages by hand. gpr analyzes your git diff and generates professional content in seconds — using Claude, OpenAI, or a local Ollama model (no API key required).

Two modes:

  • gpr — generate a full PR description from your branch diff
  • gpr --commit — generate a conventional commit message from staged changes
$ gpr
Branch: feature/auth → main  |  3 commits, 5 files changed, +247/-31 lines

╭─────────────────────── PR Description ──────────────────────────╮
│ **Title:** Add JWT authentication with refresh token support     │
│                                                                  │
│ ## Summary                                                       │
│ Implements JWT-based authentication replacing the session-based  │
│ system. Adds refresh token rotation for better security and...   │
│                                                                  │
│ ## Changes                                                       │
│ - `src/auth/jwt.py`: New JWT encode/decode with HS256            │
│ - `src/middleware/auth.py`: Updated auth middleware for JWT      │
│ - `tests/test_auth.py`: 14 new tests covering edge cases        │
│                                                                  │
│ ## Test Plan                                                     │
│ - [ ] Login flow generates valid JWT                            │
│ - [ ] Expired tokens are rejected with 401                      │
│ - [ ] Refresh token rotation works correctly                    │
╰──────────────────────────────────────────────────────────────────╯

$ git add src/auth/jwt.py && gpr --commit
Staged: 1 file(s) staged, +47/-12 lines

╭────────────────────── Commit Message ───────────────────────────╮
│ feat(auth): add JWT encode/decode with HS256 algorithm           │
│                                                                  │
│ Replaces session-based auth with stateless JWT tokens.          │
│ Uses HS256 for signing with configurable secret rotation.       │
╰──────────────────────────────────────────────────────────────────╯

$ gpr --commit-run   # generates message AND runs git commit automatically

Why gpr?

Tool What it does Limitation
aicommits Generates commit messages No PR description support
GitHub Copilot Suggests PR description in browser Requires GitHub Copilot subscription
gpr PR descriptions + commit messages Works with any provider, including local LLMs

Key advantages:

  • Two workflows in one — PR descriptions AND conventional commit messages
  • No vendor lock-in — Claude, OpenAI, or local Ollama
  • No API key required — use --provider ollama with a local model
  • Integrates with gh — one flag to open gh pr create with generated content

Install

pip install gpr-ai

Or with pipx:

pipx install gpr-ai

Quick Start

# Generate PR description (Claude, requires ANTHROPIC_API_KEY)
gpr

# Generate conventional commit message for staged changes
git add -p   # stage what you want
gpr --commit

# Generate commit message AND run git commit
gpr --commit-run

# Use local Ollama — no API key needed!
gpr --provider ollama --model llama3.2
gpr --commit --provider ollama

# Copy to clipboard
gpr --copy
gpr --commit --copy

# Open gh pr create directly
gpr --gh

# Save to file
gpr --output pr.md

Usage

Usage: gpr [OPTIONS]

  Generate AI-powered pull request descriptions from your git diff.

Options:
  -p, --provider [claude|openai|ollama]
                                  AI provider to use.  [default: claude]
  -m, --model TEXT                Model name (provider-specific).
  -b, --base TEXT                 Base branch to diff against (auto-detected).
  -s, --style [standard|conventional|minimal]
                                  PR description style.  [default: standard]
  -c, --copy                      Copy output to clipboard.
  --gh                            Open 'gh pr create' with generated content.
  -o, --output PATH               Save output to file.
  --raw                           Print raw markdown without rich formatting.
  --commit                        Generate a conventional commit message for staged changes.
  --commit-run                    Like --commit, but also runs 'git commit -m' automatically.
  --diff-only                     Print the diff that would be sent to AI.
  --ollama-host TEXT              Ollama server URL.  [default: http://localhost:11434]
  --repo PATH                     Path to git repository.
  --version                       Show the version and exit.
  --help                          Show this message and exit.

PR Styles

standard (default)

Full PR description with Summary, Changes, and Test Plan sections.

conventional

Follows Conventional Commits format with type/scope prefix.

minimal

Brief title + 3 bullet points. Good for small changes.

gpr --style conventional
gpr --style minimal

Using Local Models (Ollama)

No API key required — runs entirely on your machine:

# Install Ollama: https://ollama.ai
ollama pull llama3.2   # or codellama, mistral, etc.

# Run gpr with Ollama
gpr --provider ollama --model llama3.2

Environment Variables

Variable Description
ANTHROPIC_API_KEY Required for --provider claude
OPENAI_API_KEY Required for --provider openai

Workflow Integration

With gh CLI

# Generate and immediately create PR
gpr --gh

# Or save first, review, then create
gpr --output pr.md
cat pr.md  # review
gh pr create --title "..." --body "$(cat pr.md)"

In CI (generate PR description on push)

gpr --raw --provider ollama > pr_description.md

Requirements

  • Python 3.9+
  • Git repository with at least one commit
  • One of: ANTHROPIC_API_KEY, OPENAI_API_KEY, or running Ollama

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpr_ai-0.2.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gpr_ai-0.2.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file gpr_ai-0.2.0.tar.gz.

File metadata

  • Download URL: gpr_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for gpr_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f1a5c93f269de30e117eb5081a0d5713e02a41362a904955693306a8448eaff7
MD5 e63f82d9bd0c2442def4fad99494f3ac
BLAKE2b-256 ef7f742dfb0a17e421c5c2d17e579ef9775ebd1849a2fa49771c906606939056

See more details on using hashes here.

File details

Details for the file gpr_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gpr_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for gpr_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7067fcb4c051dfcaf8867e92d17cf1f471965113455951790d555b6a569de81
MD5 cddba236734663ef693cf914b57e8db7
BLAKE2b-256 6cad8706643e59626fedb7c969e2920993bcb5f50ca4ea0e931b582e9f1192d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page