Generate GitHub PR descriptions from the command line with the help of AI.
propr
aims to populate a basic PR description right from your terminal so you can focus on more important things.
npm install -g @segersniels/propr
# Install in the current directory
curl -sSL https://raw.githubusercontent.com/segersniels/propr/master/scripts/install.sh | bash
# Install in /usr/local/bin
curl -sSL https://raw.githubusercontent.com/segersniels/propr/master/scripts/install.sh | sudo bash -s /usr/local/bin
- Download the latest binary from the releases page for your system
- Rename the binary to
propr
- Copy the binary to a location in your
$PATH
Before using Propr, you'll need to set up the following:
-
GitHub Token: Set the
GITHUB_TOKEN
environment variable with a valid GitHub token that has permissions to create pull requests.export GITHUB_TOKEN=your_github_token
-
AI Provider API Key: Depending on which AI model you want to use, set one of the following environment variables:
- For OpenAI models (default):
export OPENAI_API_KEY=your_openai_api_key
- For Anthropic models:
export ANTHROPIC_API_KEY=your_anthropic_api_key
- For DeepSeek models:
export DEEPSEEK_API_KEY=your_deepseek_api_key
- For OpenAI models (default):
Before you can get started, write some code and push it to a branch. Then depending on your needs, you can use the following commands:
NAME:
propr - Generate your PRs from the command line with AI
USAGE:
propr [global options] command [command options]
COMMANDS:
create Creates a PR with a generated description
generate Generates a PR description and outputs it
config Configure propr to your liking
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
Propr can be configured with the following options:
- Model: Choose which AI model to use for generating PR descriptions.
- Prompt: Customize the system prompt used to generate PR descriptions.
- Template: Define the template structure for your PR descriptions (default:
# Description
). - Pretty Print: Enable or disable pretty printing of the generated output (default:
true
).
Example configuration:
{
"model": "gpt-4o-mini",
"prompt": "You are responsible to write a concise GitHub PR description...",
"template": "# Description\n\n## Changes\n\n## Why",
"pretty_print": true
}
You can customize the PR description template to match your team's standards. For example:
propr config init
Then, when prompted, enter a template like:
# Description
## Changes
-
## Impact
-
## Testing
-
Enable debug mode to see more detailed logs:
DEBUG=true propr generate
If you encounter errors like OPENAI_API_KEY is not set
, make sure you've set the appropriate environment variable for your chosen model.
- No Remote Origin: Propr requires a GitHub repository with a remote origin set up. Make sure your local repository has a remote origin pointing to GitHub.
- No Changes: If you get an error like
not enough changes found to generate
, make sure you have committed and pushed changes to your branch. - Branch Comparison: By default, Propr compares your current branch to the repository's default branch. If you want to compare against a different branch, use the
--branch
flag. - Repository Format: Propr expects the remote origin URL to be in a standard GitHub format (e.g.,
https://github.com/username/repo.git
or[email protected]:username/repo.git
).
If you encounter rate limiting issues with the GitHub API, consider using a personal access token with higher rate limits.
For very large changes, the AI model might struggle to generate a comprehensive description due to token limits. In such cases:
- Consider breaking your PR into smaller, more focused changes
- Propr automatically filters out lock files like
package-lock.json
,yarn.lock
, etc. to save on tokens
GITHUB_TOKEN
: Required for creating PRs and accessing repository informationOPENAI_API_KEY
: Required when using OpenAI modelsANTHROPIC_API_KEY
: Required when using Anthropic modelsDEEPSEEK_API_KEY
: Required when using DeepSeek modelsDEBUG
: Set to any value to enable debug logging
Propr works by:
- Fetching the diff between your current branch and the target branch
- Collecting commit messages from your branch
- Sending this information to the configured AI model
- Generating a PR description based on the changes
- Optionally creating a PR with the generated description
The tool automatically filters out lock files and other large generated files to optimize token usage.
Contributions are welcome! Check out the GitHub repository for more information.