Skip to main content

A CLI agent to assist with PR creation and management

Project description

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.

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

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

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_assistant_cli-0.1.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

pr_assistant_cli-0.1.2-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file pr_assistant_cli-0.1.2.tar.gz.

File metadata

  • Download URL: pr_assistant_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pr_assistant_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 65127409d6d0754bd6dd535987c92bb707caaab85ec4804ba3c9e4c0461cd4b0
MD5 62eb24f19d30958beb02f5f08d02f46e
BLAKE2b-256 130724a0a69a56554c0a66a80164de93f3e3aa762ebf521242c0de090c2b12a6

See more details on using hashes here.

File details

Details for the file pr_assistant_cli-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pr_assistant_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a8266d3a37c1cb28efcf1ff0426299346b06fb5a70aed7241f7d3dfff8c580f4
MD5 60e7ab7d42667d99391897977b309500
BLAKE2b-256 1bef6eef3b8161de7668d18cf3c269f70ac9f528562a72a24b1086c257ae7aff

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