prgen
Generate a pull request title and description from git diff and commit history.
Author: Jean Paul Fernandez · github.com/jpxoi/prgen
Licensed under the GNU General Public License v3.0 (GPL-3.0-only).
Requirements
- Python 3.10+
giton yourPATH- One of:
- OpenAI API access
- Google Gemini API access
- A local or remote Ollama server
Install
From PyPI:
pip install prgen-cli
# or
uv tool install prgen-cli
From a clone:
uv sync
Run the CLI with:
prgen --help
What It Does
prgen compares HEAD against a base ref, collects:
git diff <base>...HEADgit log <base>..HEAD
It sends that context to an LLM and prints:
- a PR title from
<summary>...</summary> - a PR description from
<body>...</body>
If the model does not return those tags, prgen prints the raw model output instead.
Providers
prgen supports three backends:
openaigeminiollama
--provider auto is the default.
In auto mode:
- Gemini is chosen when
GOOGLE_API_KEYis available - otherwise OpenAI is chosen when
OPENAI_API_KEYis available - if neither key is configured, prgen exits with an error
Ollama is always explicit:
- use
--provider ollama - also pass
--model <name> --tierpresets do not apply to Ollama
Quick Start
OpenAI:
prgen config set OPENAI_API_KEY sk-...
prgen
Gemini:
prgen config set GOOGLE_API_KEY your-key
prgen --provider gemini
Ollama:
prgen --provider ollama --model llama3.1:8b
If the Ollama model is missing locally, let prgen pull it:
prgen --provider ollama --model llama3.1:8b --pull
Configuration
Configuration lives in ~/.config/prgen/config.json.
If XDG_CONFIG_HOME is set, prgen uses:
$XDG_CONFIG_HOME/prgen/config.json
You can manage the file with:
prgen config
prgen config show
prgen config path
Supported persisted keys:
OPENAI_API_KEYGOOGLE_API_KEYOLLAMA_HOSTbaseprovidertier
Notes:
OPENAI_API_KEYandGOOGLE_API_KEYare treated as secretsOLLAMA_HOSTis not secret and is merged into the environment if setbase,provider, andtierare optional CLI defaultsmodelandcontextare not persisted in config
Examples:
prgen config
prgen config set OPENAI_API_KEY sk-...
prgen config set GOOGLE_API_KEY your-key
prgen config set OLLAMA_HOST http://127.0.0.1:11434
prgen config set base origin/main
prgen config set provider ollama
prgen config set tier pro
prgen config unset OLLAMA_HOST
prgen config show
To read a secret value from stdin:
prgen config set OPENAI_API_KEY - < key.txt
Defaults
Built-in defaults:
| Option | Default | Notes |
|---|---|---|
--repo, -C |
current directory | Uses the current git repo unless you point elsewhere |
--base |
origin/main |
The ref must resolve locally |
--provider |
auto |
Prefers Gemini over OpenAI when both keys exist |
--tier |
default |
Used only for OpenAI and Gemini |
--model |
unset | Overrides tier selection; required for Ollama |
--context |
none |
Extra text merged into the prompt |
--pull |
false |
Only relevant for Ollama |
--verbose, -v |
false |
Print usage, git size, and API response headers to stderr |
Config-file defaults apply only when you omit the matching flag:
baseprovidertier
Explicit flags always win over the config file.
Current model presets:
- OpenAI
default:gpt-5-mini - OpenAI
pro:gpt-5.4 - Gemini
default:gemini-3-flash-preview - Gemini
pro:gemini-3.1-pro-preview
Usage
Basic usage:
prgen
Pick a different base:
prgen --base main
Run against another repository:
prgen -C ~/src/my-project
Override the model directly:
prgen --provider openai --model gpt-5.4
prgen --provider gemini --model gemini-3.1-pro-preview
prgen --provider ollama --model mistral-small3.1
Add extra context:
prgen --context "Focus on customer-facing impact and rollout notes."
Inspect API response headers (useful on rate-limit errors):
prgen --provider openai --verbose
With --verbose, prgen prints to stderr:
- provider, model, git base, commit count, and prompt size
- token usage (OpenAI / Gemini) or eval counts (Ollama)
- HTTP status and useful response headers (rate limits, request id)
Transport headers are omitted. Authorization values and API keys in URLs are redacted.
Behavior Notes
- prgen validates that
--baseresolves before generating anything - if there are no commits and no file changes vs the base ref, prgen exits with an error
- when
--provider ollama --pullis used, prgen can download the model automatically - when stderr is a TTY, loading states and Ollama downloads use Rich UI output
--verboseprints usage and API response headers after the call (or after an error), including rate-limit metadata when the provider sends it
Development
Install local dependencies:
uv sync
Format and lint:
uv run ruff format .
uv run ruff check .
Run from the repo without installing globally:
uv run prgen --help
Install the local checkout as a global tool:
uv tool install .
# or
pipx install .
Metadata
Release files for prgen-cli 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| prgen_cli-0.4.1.tar.gz | 35.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prgen_cli-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.0 kB
Release files / prgen_cli-0.4.1.tar.gz
| Download URL | prgen_cli-0.4.1.tar.gz |
|---|---|
| Size | 35.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
726b8e02aadccb6e060b883d626ac542bc9e47e0572efdba765606c27f06c175
|
|
BLAKE2b-256 checksum How to use checksums |
a8fe6a4eb22c9428d8595f4f65286922f5f1ab55d80f3dbc705ffaf5b55861af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logRelease files / prgen_cli-0.4.1-py3-none-any.whl
| Download URL | prgen_cli-0.4.1-py3-none-any.whl |
|---|---|
| Size | 37.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4dc4785769e8857ef2cb5c45dd36d714467373cc43440566c95ca9eb9ea674db
|
|
BLAKE2b-256 checksum How to use checksums |
723b97809729ab3ec96ab5368fc62f7c8bd472193f8483974b26116915d6e3c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logSecurity for prgen-cli 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for prgen_cli-0.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.