PullCraft is a simple but powerful CLI tool for automating the creation and updating of GitHub pull requests. It creates diffs based on your code changes and a base or specified branch, then uses generative AI to create meaningful PR titles and descriptions. It then creates the PR for you and opens the PR in the browser for final review. You can provide hints, templates, and other options to customize the PR creation process to your needs.
- Features
- Prerequisites
- Quick Start
- Installation
- Usage
- Configuration Options and CLI Flags
- Template Placeholders
- Examples
- Troubleshooting
- Contributing
- License
- Acknowledgments
- Automatic PR creation and updating
- AI-powered generation of PR titles and descriptions
- Customizable templates for PR content
- Support for different GitHub authentication strategies
- Configurable file exclusions and diff thresholds
- Option to dump diffs to a file for manual review
- Git
- A GitHub account
- An OpenAI API key
If you have Node.js installed, you can install PullCraft using npm:
npm install -g pullcraft
- Download and run the installation script:
curl -O https://raw.githubusercontent.com/jamesvillarrubia/pullcraft/main/build/install.sh sudo bash install.sh
This script will automatically:
- Fetch the latest version of PullCraft
- Download the executable
- Make it executable
- Move it to /usr/local/bin
- Verify the installation
If you encounter any issues, please check the error messages and ensure you have the necessary permissions.
-
Download the installation script:
curl -O https://raw.githubusercontent.com/jamesvillarrubia/pullcraft/main/build/install.bat
-
Right-click on the downloaded
install.bat
file and select "Run as administrator".NOTE: The windows binary currently untested and has been removed. Best option for Windows is to install with
npm -g pullcraft
This script will automatically:
- Fetch the latest version of PullCraft
- Download the executable
- Create an installation directory
- Move the executable to the installation directory
- Add the installation directory to your PATH
- Verify the installation
After installation, restart your command prompt for the PATH changes to take effect.
If you encounter any issues, please check the error messages and ensure you're running the script with administrator privileges.
-
Set up your OpenAI API key:
- Option 1: Create a
.env
file in your project root:OPENAI_API_KEY=your_api_key_here
- Option 2: Set it as an environment variable in your shell:
export OPENAI_API_KEY=your_api_key_here
- Option 3: Use the
--api-key
option when running PullCraft:pullcraft main feature-branch --api-key your_api_key_here
- Option 1: Create a
-
Create a PR:
pullcraft main feature-branch
PullCraft is primarily used as a command-line tool. Here are some common usage scenarios:
-
Basic usage (create a PR from current branch to the default base branch):
pullcraft
-
Specify base branch:
pullcraft main
-
Specify both base and compare branches:
pullcraft main feature-branch
-
Use custom file exclusions:
pullcraft main --exclusions "*.md,package-lock.json"
-
Open the PR in the browser after creation:
pullcraft main --open-pr
-
Use a specific GitHub strategy:
pullcraft main --github-strategy octokit
-
Provide a hint for the AI:
pullcraft main --hint "This PR updates the user authentication system"
-
Use custom templates:
pullcraft main --title-template "feat: {{title}}" --description-template "## Changes\n\n{{description}}"
-
Set a custom diff threshold:
pullcraft main --diff-threshold 600
-
Use a different OpenAI model:
pullcraft main --model gpt-4