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): you may share and modify this program under those terms; see the license file for full conditions.
Requirements
- Python 3.10+
giton yourPATH(install Git and ensuregitworks in a terminal)
Install
From PyPI, install the prgen-cli package; the prgen command is what you run in the terminal.
From PyPI:
pip install prgen-cli
# or
uv tool install prgen-cli
From a clone (installs all dependencies):
uv sync
Formatting / lint (see [tool.ruff] in pyproject.toml):
uv run ruff format .
uv run ruff check .
Setup
Store settings in ~/.config/prgen/config.json using prgen config (interactive prompts, or prgen config set …). Supported fields:
OPENAI_API_KEY— OpenAI API key (also merged into the environment when you runprgen, if not already set)GOOGLE_API_KEY— Google AI Studio / Gemini API key (same behavior)base— optional default for--base(see Defaults below)provider— optional default for--providertier— optional default for--tier
Override the config directory with XDG_CONFIG_HOME (file is $XDG_CONFIG_HOME/prgen/config.json).
Defaults
Defaults apply to the main prgen command (generating a PR summary), not to prgen config … subcommands.
Built-in CLI defaults (no config file)
If you do not pass a flag and the key is not set in config.json, prgen uses:
| What | Default | Meaning |
|---|---|---|
| Git repo | current directory | Diff and log are for the repo you run from. Use -C / --repo for another tree. |
--base |
origin/main |
Compare HEAD to this ref (git diff / git log vs merge base). The ref must exist locally (e.g. run git fetch origin or use a local branch like main). |
--provider |
auto |
Pick a backend from your API keys: Gemini if GOOGLE_API_KEY is set, otherwise OpenAI if OPENAI_API_KEY is set. If neither is set, prgen exits with an error until you configure keys. |
--tier |
default |
Cheaper/faster model preset. pro selects a stronger model for the chosen provider. |
--model |
(unset) | Use the model for the current --tier (see presets in the source under defaults.py). --model ID overrides --tier entirely. |
--context |
none |
Extra text merged into the prompt; the literal string none means “no extra context” unless you change it. |
Optional overrides from config.json
If base, provider, or tier appear in config.json, they replace the built-in defaults only when you do not pass the matching flag.
- Example:
basein JSON ismain, and you runprgenwith no--base→ effective base ismain. - Example: same config, but you run
prgen --base origin/main→--basewins; the file is ignored for that run.
--model and --context are not read from the JSON file; only base, provider, and tier are.
Summary
- Config file fills in
--base,--provider, and--tierwhen those flags are omitted. - Explicit flags always override the file.
autochooses Gemini vs OpenAI from which API keys are available (see--providerabove).
Set keys from the CLI
Writes go to ~/.config/prgen/config.json (see prgen config path). Allowed keys: OPENAI_API_KEY, GOOGLE_API_KEY, base, provider, tier.
prgen config # wizard: API keys + base, provider, tier (Rich prompts)
prgen config set OPENAI_API_KEY sk-...
prgen config set GOOGLE_API_KEY - < key.txt # value read from stdin
prgen config unset OPENAI_API_KEY
prgen config show # safe summary (keys as set/unset; colors if TTY)
prgen config path # print path to the file
Run on another project
Use -C (same idea as git -C) so you can run prgen from anywhere:
prgen -C ~/src/my-application
If prgen is not on your PATH, invoke it via uv from the prgen repo:
uv run --directory /path/to/prgen prgen -C ~/src/my-application
Install globally (optional)
From the prgen project directory:
uv tool install .
# or
pipx install .
Then prgen is available in new shells (ensure your tool install bin directory is on PATH).
Options
See prgen --help for all flags. In addition to Defaults:
- If there is no diff and no commits compared to
--base, prgen exits with an error (nothing to summarize).
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.2.1.tar.gz.
File metadata
- Download URL: prgen_cli-0.2.1.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3151081b2650f4513af288cb91641734acc512a36a4d6de7765456a08edec130
|
|
| MD5 |
1c7c24106b72b3fbd2a3294f3e214e57
|
|
| BLAKE2b-256 |
46b9f71cb3dc4623e53103be36339d3d122b52714a6bc0dc597a88c3dca5ac12
|
File details
Details for the file prgen_cli-0.2.1-py3-none-any.whl.
File metadata
- Download URL: prgen_cli-0.2.1-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1041f2e7fe82125f029dbb82e3a6fd0da53028eb9242b67fd9184eb5bddc84c2
|
|
| MD5 |
b6930cccf6f47a43de267ceb250abf34
|
|
| BLAKE2b-256 |
be0a8844ba072fd125c5e1a55cf842b8f764302a243f78030235425e2c1f5740
|