Skip to main content

AI-powered Pull Request Description Generator

Project description

AIPR - Agentic Pull Request Description Generator

Automatically analyze git diffs and vulnerabilities to generate comprehensive, well-structured pull request descriptions. By intelligently detecting changes, performing security scans, and leveraging state-of-the-art AI models, AIPR helps teams save time while maintaining high-quality, consistent pull request descriptions.

# Install with pipx (recommended)
pipx install pr-generator-agent

# Or with pip
pip install pr-generator-agent

# Set the environment variable for the API key
export ANTHROPIC_API_KEY="your-api-key"

# Generate a PR description
aipr

# Custom usage - Analyze changes against main branch
# Include: Vulnerability scanning
# Use: Azure OpenAI o1-mini model
# Prompt: meta template
# Ouptut: Verbose
aipr -t main --vulns -p meta -m azure/o1-mini -v

# Inline with merge request creation
gh pr create -b "$(aipr -s)" -t "feat: New Feature"

Key Features

  • 🔍 Smart Detection: Automatically analyzes working tree changes or compares branches
  • 🛡️ Security First: Optional vulnerability scanning between branches using Trivy
  • 🤖 AI-Powered: Multiple AI providers (Azure OpenAI, OpenAI, Anthropic) for optimal results
  • 🔄 CI/CD Ready: Seamless integration with GitLab and GitHub workflows

Example Output

Change Summary:

1. **Added User Authentication**
   - Implemented JWT middleware
   - Added login/register endpoints
   - Updated bcrypt to v5.1.1

2. **Security Updates**
   - Fixed 2 medium severity vulnerabilities
   - Updated deprecated crypto functions

Security Analysis:
✓ No new vulnerabilities introduced

Requirements

  • Python 3.10 or higher (3.10, 3.11 officially supported)
  • Git
  • LLM API Key (Anthropic, OpenAI, or Azure OpenAI)
  • Trivy (used for --vulns scanning)

Environment Variables

Anthropic (Default)

  • ANTHROPIC_API_KEY: Anthropic API key

Azure OpenAI

  • AZURE_API_KEY: Azure OpenAI API key
  • AZURE_API_BASE: Azure endpoint URL
  • AZURE_API_VERSION: API version (default: "2024-02-15-preview")

OpenAI

  • OPENAI_API_KEY: OpenAI API key

Usage

Command Options

  • -t, --target: Compare changes with specific branch (default: auto-detects main/master)
  • -p, --prompt: Select prompt template (e.g., 'meta')
  • -v, --verbose: Show API interaction details
  • -d, --debug: Preview prompts without API calls
  • -s, --silent: Output only the description
  • --vulns: Include vulnerability scanning
  • -m, --model: Specify AI model to use

The tool intelligently detects changes by:

  1. Using staged/unstaged changes if present
  2. Comparing against target branch if working tree is clean

Supported AI Models

Choose from multiple AI providers:

Provider Model Notes
Anthropic claude-3-sonnet default
claude-3.5-sonnet latest
claude-3.5-haiku latest
claude-3-opus latest
claude-3-haiku
claude alias for claude-3-sonnet
Azure OpenAI azure/o1-mini
azure/gpt-4o-mini
azure/gpt-4o
azure alias for azure/gpt-4o-mini
OpenAI gpt-4o
gpt-4-turbo
gpt-3.5-turbo
openai alias for gpt-4o

Custom Prompts

AIPR supports custom prompt templates that allow you to tailor merge request descriptions to your team's specific needs. Custom prompts enable you to:

  • Define consistent formatting across your team
  • Include organization-specific requirements
  • Add custom sections and validation rules
  • Provide examples that match your team's standards

For detailed information on creating and using custom prompts, see our Custom Prompts Tutorial.

Contributing

We welcome contributions! See our Contributing Guide for details on:

  • Setting up your development environment
  • Our development workflow
  • Code style guidelines
  • Pull request process
  • Running tests

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

pr_generator_agent-1.0.0.tar.gz (106.5 kB view details)

Uploaded Source

Built Distribution

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

pr_generator_agent-1.0.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file pr_generator_agent-1.0.0.tar.gz.

File metadata

  • Download URL: pr_generator_agent-1.0.0.tar.gz
  • Upload date:
  • Size: 106.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pr_generator_agent-1.0.0.tar.gz
Algorithm Hash digest
SHA256 54fa5b68fd9a45c4a4f8e4503417b9ef365329dd88aeceb5eb6779ab2b830663
MD5 62583015631d5f548d6c5a92a00316d5
BLAKE2b-256 e7f7fec763858b8a57a85e391344334db6d3758ad7f13d6b0a3b857426a63d96

See more details on using hashes here.

File details

Details for the file pr_generator_agent-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pr_generator_agent-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0512e9005a66c52b4265d253db7d86722aeba232228eab3e541c7db1373d637
MD5 352d01c394b6ce6041d552afbe51276f
BLAKE2b-256 53389fa609f194df8c7e49a4cb93ffeb1f25c4fe16df93ba1bb535a13e0f3bc8

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