cpr

command module
v0.0.0-...-b406f6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 1 Imported by: 0

README

cpr - Create Pull Request CLI

A lightweight command-line tool that creates GitHub pull requests with auto-generated Angular format titles and summaries based on your git diff.

Features

  • Auto-generated PR titles in Angular commit format (e.g., feat: add new feature, fix: resolve bug)
  • Intelligent PR summaries based on your code changes
  • GitHub SDK integration for native PR creation
  • Customizable with flags for title, body, and draft status
  • Smart commit type detection based on file changes and diff content

Installation

go install github.com/fraser-isbester/cpr@latest

Or build from source:

git clone https://github.com/fraser-isbester/cpr.git
cd cpr
make install

Usage

Basic Usage

Simply run cpr from your feature branch:

cpr

This will:

  1. Analyze the diff between your current branch and the default branch
  2. Generate an Angular-format PR title
  3. Create a comprehensive PR summary
  4. Open a pull request on GitHub
Command Flags
cpr [flags]
Flag Short Description
--title -t Custom PR title (overrides auto-generation)
--body -b Custom PR body (overrides auto-generation)
--draft -d Create PR as draft
--verbose -v Enable verbose output
Examples

Create a PR with auto-generated title and summary:

cpr

Create a draft PR:

cpr --draft

Create a PR with custom title:

cpr --title "feat(auth): implement OAuth2 login"

Create a PR with custom body:

cpr --body "This PR implements the new authentication system using OAuth2."

Authentication

The tool requires a GitHub personal access token. Set it as an environment variable:

export GITHUB_TOKEN=your_token_here
# or
export GH_TOKEN=your_token_here

Angular Commit Types

The tool automatically detects and uses the following commit types:

  • feat: New features
  • fix: Bug fixes
  • docs: Documentation changes
  • style: Code style changes
  • refactor: Code refactoring
  • perf: Performance improvements
  • test: Test additions or changes
  • build: Build system changes
  • ci: CI configuration changes
  • chore: Other changes

Development

Prerequisites
  • Go 1.21 or higher
  • Git
Building
make build
Testing

The project uses Ginkgo for BDD-style testing:

make test
Available Make Commands
  • make build - Build the binary
  • make install - Install the binary to GOPATH/bin
  • make test - Run all tests
  • make test-coverage - Run tests with coverage report
  • make clean - Clean build artifacts
  • make fmt - Format code
  • make vet - Run go vet
  • make deps - Download and tidy dependencies

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
git

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL