Skip to main content

Add your description here

Project description

Floyd - AI-Powered Pull Request Generator

Floyd is a command-line tool that leverages Claude AI to automatically generate high-quality pull request titles and descriptions based on your git changes. It analyzes your commits, diffs, and file changes to create professional PRs following conventional commit standards.

Features

  • ๐Ÿค– AI-Powered Analysis: Uses Claude to analyze your code changes and generate comprehensive PR descriptions
  • ๐Ÿ“ Conventional Commits: Automatically formats PR titles following conventional commit standards (feat:, fix:, docs:, etc.)
  • ๐ŸŽจ Beautiful CLI: Rich, colorful terminal interface with gradient ASCII art
  • โ™ป๏ธ Iterative Refinement: Refine generated PRs with natural language feedback
  • โš™๏ธ Configurable: Customize AI behavior with custom instructions and diff size limits
  • ๐Ÿ” Smart Context: Analyzes commit history, file stats, and diffs for accurate descriptions
  • ๐Ÿš€ GitHub Integration: Seamlessly creates PRs via GitHub CLI

Prerequisites

Installation

Install Floyd from PyPI using pip:

pip install floyd-pr-generator

Verify installation:

floyd --help

Configuration

Floyd can be configured using a TOML configuration file. The configuration file should be placed at:

  • Linux/macOS: ~/.config/floyd.toml
  • Windows: C:\AppData\Roaming\floyd\floyd.toml

Configuration Options

Create a floyd.toml file with the following structure:

[ai]
# Maximum character limit for git diffs (prevents token limit issues)
# Set to -1 for no limit
diff_limit = 50000

# Custom instructions to guide the AI's PR generation
# This will be appended to the AI prompt
instructions = """
- Focus on business impact in the description
- Include any breaking changes at the top
- Mention related ticket numbers if present in commits
- Keep descriptions concise but informative
"""

Configuration Parameters

diff_limit (integer)

  • Purpose: Limits the size of git diffs sent to Claude to prevent token limit issues
  • Default: -1 (no limit)
  • Recommended: 50000 for most projects
  • Example: diff_limit = 50000

instructions (string)

  • Purpose: Provide custom guidance to Claude for generating PRs
  • Format: Multi-line string
  • Use cases:
    • Enforce team-specific PR conventions
    • Highlight certain types of changes
    • Include specific formatting requirements
    • Add context about your project's workflow

Example Configurations

Minimal Configuration

[ai]
diff_limit = 50000

Comprehensive Configuration

[ai]
diff_limit = 50000
instructions = """
PR Description Guidelines:
- Start with a brief summary of what changed and why
- List breaking changes first with โš ๏ธ emoji
- Group related changes by feature area
- Include ticket references (e.g., JIRA-123)
- Mention any migration steps required
- Keep technical details but make them accessible
- Add testing instructions if relevant
"""

Team-Specific Configuration

[ai]
diff_limit = 75000
instructions = """
Team Standards:
- Follow our internal PR template structure
- Highlight security implications
- Mention performance impacts
- Reference design docs when applicable
- Tag relevant team members in description
- Include rollback plan for infrastructure changes
"""

Usage

Basic Usage

Navigate to your git repository and run:

floyd <target-branch>

Example:

floyd main

This will:

  1. Fetch the diff between your current branch and the target branch
  2. Analyze recent commits and file changes
  3. Generate a PR title and description using Claude
  4. Display the draft for review
  5. Offer options to create, refine, or cancel

Workflow

  1. Review Generated Draft: Floyd displays the AI-generated PR title and body in a formatted panel

  2. Choose Action:

    • Create Pull Request: Immediately create the PR on GitHub
    • Refine Draft: Provide feedback in natural language to improve the draft
    • Cancel: Exit without creating a PR
  3. Iterative Refinement (optional):

    • If you choose "Refine Draft", you can provide feedback like:
      • "Make the description more technical"
      • "Add more details about the authentication changes"
      • "Keep it shorter and more concise"
      • "Emphasize the performance improvements"

Example Session

$ floyd main

 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ          โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  
โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–ˆโ–‘โ–‘โ–ˆโ–ˆโ–ˆ         โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆ โ–‘โ–‘โ–ˆโ–ˆโ–ˆ โ–‘โ–‘โ–ˆโ–ˆโ–ˆ โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆ 
 โ–‘โ–ˆโ–ˆโ–ˆ   โ–ˆ โ–‘  โ–‘โ–ˆโ–ˆโ–ˆ        โ–ˆโ–ˆโ–ˆ     โ–‘โ–‘โ–ˆโ–ˆโ–ˆ โ–‘โ–‘โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ   โ–‘โ–ˆโ–ˆโ–ˆ   โ–‘โ–‘โ–ˆโ–ˆโ–ˆ
 โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ    โ–‘โ–ˆโ–ˆโ–ˆ       โ–‘โ–ˆโ–ˆโ–ˆ      โ–‘โ–ˆโ–ˆโ–ˆ  โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ    โ–‘โ–ˆโ–ˆโ–ˆ    โ–‘โ–ˆโ–ˆโ–ˆ
 โ–‘โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–ˆ    โ–‘โ–ˆโ–ˆโ–ˆ       โ–‘โ–ˆโ–ˆโ–ˆ      โ–‘โ–ˆโ–ˆโ–ˆ   โ–‘โ–‘โ–ˆโ–ˆโ–ˆ     โ–‘โ–ˆโ–ˆโ–ˆ    โ–‘โ–ˆโ–ˆโ–ˆ
 โ–‘โ–ˆโ–ˆโ–ˆ  โ–‘     โ–‘โ–ˆโ–ˆโ–ˆ      โ–ˆโ–‘โ–‘โ–ˆโ–ˆโ–ˆ     โ–ˆโ–ˆโ–ˆ     โ–‘โ–ˆโ–ˆโ–ˆ     โ–‘โ–ˆโ–ˆโ–ˆ    โ–ˆโ–ˆโ–ˆ 
 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ       โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘      โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  
โ–‘โ–‘โ–‘โ–‘โ–‘       โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘    โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘       โ–‘โ–‘โ–‘โ–‘โ–‘    โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   

'diff_limit' loaded with value: 50000
'instructions' loaded with value: Focus on business impact in...
Successfully fetched branch diff
Successfully generated a PR.

โ•ญโ”€ Draft Pull Request โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Title: feat: add user authentication system                            โ”‚
โ”‚                                                                        โ”‚
โ”‚ Body:                                                                  โ”‚
โ”‚ This PR introduces a comprehensive user authentication system with:    โ”‚
โ”‚ - JWT-based token authentication                                       โ”‚
โ”‚ - Password hashing with bcrypt                                         โ”‚
โ”‚ - Session management                                                   โ”‚
โ”‚ - Login/logout endpoints                                               โ”‚
โ”‚                                                                        โ”‚
โ”‚ Breaking Changes:                                                      โ”‚
โ”‚ - API endpoints now require authentication headers                     โ”‚
โ”‚ - Database schema updated with users table                             โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

? What would you like to do?
  โฏ Create Pull Request
    Refine Draft
    Cancel

How It Works

  1. Git Analysis: Floyd examines your current branch against the target branch to gather:

    • Commit history
    • File change statistics
    • Detailed code diffs
  2. AI Processing: The information is sent to Claude with:

    • Your custom instructions (if configured)
    • Context about the branch and commits
    • Conventional commit formatting requirements
  3. PR Generation: Claude generates:

    • A conventional commit-formatted title
    • A comprehensive description of changes
    • Context-aware content based on commit messages
  4. Interactive Review: You can:

    • Accept and create the PR immediately
    • Request refinements with natural language
    • Cancel if needed

Project Structure

floyd/
โ”œโ”€โ”€ __init__.py          # Package initialization
โ”œโ”€โ”€ cli.py              # Command-line interface entry point
โ”œโ”€โ”€ git.py              # Git operations (diff, commits, branches)
โ”œโ”€โ”€ models.py           # AI model interaction and response parsing
โ”œโ”€โ”€ ui.py               # Rich terminal UI components
โ”œโ”€โ”€ utils.py            # Utilities (config loading, command execution)
โ””โ”€โ”€ workflow.py         # Main PR generation workflow

Error Handling

Floyd handles various error scenarios gracefully:

  • Not a Git Repository: Validates you're in a git repository before proceeding
  • Branch Doesn't Exist: Checks if the target branch exists on origin
  • PR Already Exists: Prevents duplicate PRs for the same branch combination
  • Claude CLI Not Available: Alerts if the Claude CLI isn't installed or accessible
  • Parsing Errors: Handles unexpected AI response formats

Dependencies

  • rich: Beautiful terminal formatting and UI components
  • questionary: Interactive CLI prompts
  • setuptools: Package management
  • pathlib: Cross-platform path handling

Troubleshooting

"This directory is not a git repository"

Make sure you're running Floyd from within a git repository.

"The 'claude' command failed to execute"

Ensure the Claude CLI is installed and available in your PATH. Visit Claude CLI documentation for installation instructions.

"The branch 'X' does not exist on origin"

The target branch must exist on the remote repository. Push your target branch first or use a different branch name.

Configuration not loading

Verify your config file is at the correct location:

  • Linux/macOS: ~/.config/floyd.toml
  • Windows: C:\AppData\Roaming\floyd\floyd.toml

Check the file has correct TOML syntax.

Contributing

Contributions are welcome! Please feel free to submit issues, fork the repository, and create pull requests.

Acknowledgments


Note: Floyd requires the Claude CLI and GitHub CLI to be properly configured on your system. Make sure you're authenticated with both services before using Floyd.

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

floyd_pr_generator-0.2.1.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

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

floyd_pr_generator-0.2.1-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file floyd_pr_generator-0.2.1.tar.gz.

File metadata

  • Download URL: floyd_pr_generator-0.2.1.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for floyd_pr_generator-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9873290a03c87d416ae51e8ef6c90b6662f92d182d9a40744925c69bcbce5af6
MD5 41560e2f3665f50655f1d749367d6bfd
BLAKE2b-256 588987256ba10f358add52979f880c3b42ca1aec09dc9c6f137cae1099a38970

See more details on using hashes here.

File details

Details for the file floyd_pr_generator-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for floyd_pr_generator-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c57fbd4053c31505b768e46ee6ec166745754b3a57a4d7e56d9669615ebb4ebc
MD5 e5129aacecf431a05c0919865b0866a3
BLAKE2b-256 c75000ce5ab5a78bf78794cf15d8f8eb3f1db67bbff3c94c99ebffd89421fd89

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