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
- Python 3.14 or higher
- Git
- GitHub CLI (gh) - for creating pull requests
- Claude CLI - for AI generation
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:
50000for 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:
- Fetch the diff between your current branch and the target branch
- Analyze recent commits and file changes
- Generate a PR title and description using Claude
- Display the draft for review
- Offer options to create, refine, or cancel
Workflow
-
Review Generated Draft: Floyd displays the AI-generated PR title and body in a formatted panel
-
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
-
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"
- If you choose "Refine Draft", you can provide feedback like:
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
-
Git Analysis: Floyd examines your current branch against the target branch to gather:
- Commit history
- File change statistics
- Detailed code diffs
-
AI Processing: The information is sent to Claude with:
- Your custom instructions (if configured)
- Context about the branch and commits
- Conventional commit formatting requirements
-
PR Generation: Claude generates:
- A conventional commit-formatted title
- A comprehensive description of changes
- Context-aware content based on commit messages
-
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.
License
[Add your license here]
Acknowledgments
- Built with Anthropic's Claude AI
- Uses GitHub CLI for PR creation
- Terminal UI powered by Rich
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file floyd_pr_generator-0.1.1.tar.gz.
File metadata
- Download URL: floyd_pr_generator-0.1.1.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b37dcedfd39a8b366f189bb6e325ae1019b5eeb070f5ec802bba540f0be8c744
|
|
| MD5 |
92c9b0f70f566ddec24f7a563694a3c1
|
|
| BLAKE2b-256 |
0c5a0a292da6376082186fa82d07d545c734ddd5fd542ea8204aa821d080e6c4
|
File details
Details for the file floyd_pr_generator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: floyd_pr_generator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
245d548132353500bfe659bf7ea89308ab65f7c979d7a1b7ff895a8c852e61fd
|
|
| MD5 |
d53e91ec7c7a8c8cce0a3fad409b8ae3
|
|
| BLAKE2b-256 |
3758a2dac3d0fb0d52c99c18639b792f81121deeacd3702dcb74fa210a4e11bb
|