Skip to main content

PR Assistant CLI

Version License: MIT Language PyPI Downloads

PR Assistant is an AI-powered CLI tool designed to help developers streamline their workflow. It understands your codebase and automatically generates Pull Requests based on high-level instructions.

Features

  • AI-Powered PR Creation: Generate PRs with code changes, titles, and descriptions from simple prompts.
  • Codebase Understanding: Analyzes your project structure to provide context-aware suggestions.
  • GitHub Integration: Automatically creates branches and opens PRs in your repository.
  • Rate Limiting: Built-in client-side rate limiter to prevent API abuse.
  • Gemini Integration: Uses Google's Gemini models for intelligent code generation.

Installation

You can install the package directly from the source:

git clone https://github.com/yourusername/pr-assistant.git
cd pr-assistant
pip install -e .

Configuration

Before using the tool, you need to initialize the configuration with your API keys.

  1. GitHub Token: A Personal Access Token (PAT) with repo scope.
  2. Gemini API Key: Your Google Gemini API key.
  3. Bot Token (Optional): A separate GitHub PAT for a bot account to post reviews.

Run the init command:

pr-assistant init

Follow the interactive prompts to save your credentials.

Project-Level Configuration

You can configure the tool for specific projects to avoid re-entering the repository name.

  1. Run pr-assistant init inside your project directory.
  2. When prompted "Do you want to configure this directory as a project?", answer y.
  3. The repository name will be saved to a local .pr-assistant.json file.

Note: Your API keys are always stored securely in your global configuration (home directory) and are never saved to the local project file.

Usage

Global Options

  • --verbose: Enable detailed debug logging.
pr-assistant --verbose create 1

Create a PR

To create a PR, use the create command. You can specify the number of PRs to generate and a specific instruction.

pr-assistant create 1 --instruction "Add a hello world function to main.py"

List PRs

To list active PRs in your repository:

pr-assistant list-prs

Review a PR

To review a PR using AI:

pr-assistant review-pr <pr_number> --persona "Senior Software Engineer"

The AI will analyze the diff and post a comment on the PR with its findings.

Development & Testing

This project includes a comprehensive test suite using pytest.

Running Tests

To run the tests, ensure you have the dev dependencies installed:

pip install -e ".[dev]"
python3 -m pytest tests/

Test Coverage

  • Unit Tests: Config, Rate Limiter, Codebase Reader.
  • Mocked Tests: GitHub Client, Agent (LLM).
  • Integration Tests: CLI Commands.
  • Security Tests: Key handling.

License

MIT

Metadata

Release files for pr-assistant-cli 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pr-assistant-cli 0.1.4
File Size Uploaded Provenance Actions
pr_assistant_cli-0.1.4.tar.gz 16.0 kB Without provenance Details for pr_assistant_cli-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pr-assistant-cli 0.1.4
File Interpreter ABI Platform Actions
pr_assistant_cli-0.1.4-py3-none-any.whl Python 3 none any Details for pr_assistant_cli-0.1.4-py3-none-any.whl

Total release size: 29.3 kB

Release files / pr_assistant_cli-0.1.4.tar.gz

Download URL pr_assistant_cli-0.1.4.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
af3672d66d89eb332c857ad8de0a8e8bf17e365845bd9273ec87e87dd4d97c4c
BLAKE2b-256 checksum
How to use checksums
5f5f716fb9c859c88c3bf3a654ecd89837788863abaa3933788f9ffc46cfb430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pr_assistant_cli-0.1.4-py3-none-any.whl

Download URL pr_assistant_cli-0.1.4-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e58f2d11920ebe13a8591b2169cee878e9f6453891cff5175738cc01556a1bb
BLAKE2b-256 checksum
How to use checksums
4d39518e1a0360b62546958f5b3bdcf23831a8f781eb41c84a647b0f85637ae2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for pr-assistant-cli 0.1.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page