Generate PR titles and descriptions from git diff
Project description
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 |
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."
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
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 .
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prgen_cli-0.3.0.tar.gz.
File metadata
- Download URL: prgen_cli-0.3.0.tar.gz
- Upload date:
- Size: 31.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
545a5d1b18923037b7572cc9beb6e8ee5054e778a7fc818969ea12a60d7b002f
|
|
| MD5 |
f28e20e6fce6833035819f3842b4a507
|
|
| BLAKE2b-256 |
aee040743f6e86d87729031e766c3bdf5cdd7fd6248a24fbe9d1909a9394e8a2
|
Provenance
The following attestation bundles were made for prgen_cli-0.3.0.tar.gz:
Publisher:
publish.yml on jpxoi/prgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prgen_cli-0.3.0.tar.gz -
Subject digest:
545a5d1b18923037b7572cc9beb6e8ee5054e778a7fc818969ea12a60d7b002f - Sigstore transparency entry: 1262264175
- Sigstore integration time:
-
Permalink:
jpxoi/prgen@ea6db2504d991e63b14ae247da1ba43e521f60a6 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/jpxoi
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ea6db2504d991e63b14ae247da1ba43e521f60a6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file prgen_cli-0.3.0-py3-none-any.whl.
File metadata
- Download URL: prgen_cli-0.3.0-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e37c1b9b3b25eaaae3965cf0166514f6a1eab8f92d179883529fc9cac9b91a5
|
|
| MD5 |
9639cf9bccbe2c1b7f6a5797cbc22442
|
|
| BLAKE2b-256 |
0167b0bb1744e3d956cb0308ebf21bd4a6abcffb3faabc9ffeb95b5b452318ec
|
Provenance
The following attestation bundles were made for prgen_cli-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on jpxoi/prgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prgen_cli-0.3.0-py3-none-any.whl -
Subject digest:
8e37c1b9b3b25eaaae3965cf0166514f6a1eab8f92d179883529fc9cac9b91a5 - Sigstore transparency entry: 1262264202
- Sigstore integration time:
-
Permalink:
jpxoi/prgen@ea6db2504d991e63b14ae247da1ba43e521f60a6 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/jpxoi
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ea6db2504d991e63b14ae247da1ba43e521f60a6 -
Trigger Event:
push
-
Statement type: