PHPackages                             byron/ai-git-automation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. byron/ai-git-automation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

byron/ai-git-automation
=======================

AI-powered Git automation for commit messages and PR summaries

07PHP

Since Feb 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/byronfichardt/ai-commit)[ Packagist](https://packagist.org/packages/byron/ai-git-automation)[ RSS](/packages/byron-ai-git-automation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AI Git Automation
=================

[](#ai-git-automation)

A Laravel package that automates commit message generation and PR summaries using AI (OpenAI or Claude). This package helps developers save time and maintain consistent documentation by generating meaningful commit messages and pull request descriptions.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require byron/ai-git-automation
```

The package will automatically register itself using Laravel's package discovery.

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="Byron\AiGit\AiGitServiceProvider"
```

This will create a `config/ai-git.php` configuration file. Add the following variables to your `.env` file:

```
# Choose your AI provider (openai or claude)
AI_PROVIDER=openai

# OpenAI Configuration
OPENAI_API_KEY=your-openai-api-key-here
OPENAI_MODEL=gpt-4-turbo-preview
OPENAI_TEMPERATURE=0.7
OPENAI_MAX_TOKENS=500

# Claude Configuration (if using Claude)
CLAUDE_API_KEY=your-claude-api-key-here
CLAUDE_MODEL=claude-3-opus-20240229
CLAUDE_TEMPERATURE=0.7
CLAUDE_MAX_TOKENS=500
```

Usage
-----

[](#usage)

### Generating Commit Messages

[](#generating-commit-messages)

```
# If using Laravel directly
php artisan ai:commit

# If using Laravel Sail
sail artisan ai:commit --working-dir=/var/www/html
```

Options:

- `--m|message`: Manually specify a commit message
- `--working-dir`: Specify the working directory (required when using Laravel Sail)

The command will:

1. Check if there are staged changes
2. Generate a commit message using AI based on the diff
3. Show you the message and ask for confirmation
4. Allow you to edit the message if needed
5. Commit the changes with the approved message

### Using with Laravel Sail

[](#using-with-laravel-sail)

When using Laravel Sail, you need to specify the working directory because the command runs inside the Docker container. The working directory should be set to `/var/www/html` which is the default Laravel Sail project directory:

```
# Generate commit message
sail artisan ai:commit --working-dir=/var/www/html

# Generate PR summary
sail artisan ai:pr-summary --working-dir=/var/www/html [base] [head]
```

### Generating PR Summaries

[](#generating-pr-summaries)

```
# If using Laravel directly
php artisan ai:pr-summary [base] [head]

# If using Laravel Sail
sail artisan ai:pr-summary --working-dir=/var/www/html [base] [head]
```

Arguments:

- `base`: Base branch (default: current branch)
- `head`: Head branch (default: current branch)

Options:

- `--main`: Generate a summary for merging to main branch
- `--copy`: Copy the summary to clipboard
- `--output`: Output file path to save the summary
- `--working-dir`: Specify the working directory (required when using Laravel Sail)

### GitHub Action Integration

[](#github-action-integration)

To automatically generate PR descriptions, create `.github/workflows/pr-description.yml`:

```
name: Generate PR Description

on:
  pull_request:
    types: [opened, reopened]
    branches: [dev, main]

jobs:
  generate-description:
    runs-on: ubuntu-latest
    if: github.event.pull_request.body == ''

    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.2'

      - name: Install Dependencies
        run: composer install --no-progress --prefer-dist --optimize-autoloader

      - name: Generate PR Description
        env:
          AI_PROVIDER: ${{ secrets.AI_PROVIDER || 'openai' }}
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          CLAUDE_API_KEY: ${{ secrets.CLAUDE_API_KEY }}
        run: php artisan ai:pr-summary ${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.ref }} --main --output=pr-description.txt

      - name: Update PR Description
        uses: actions/github-script@v6
        with:
          script: |
            const fs = require('fs');
            const description = fs.readFileSync('pr-description.txt', 'utf8');
            await github.rest.pulls.update({
              owner: context.repo.owner,
              repo: context.repo.repo,
              pull_number: context.issue.number,
              body: description
            });

```

Add these secrets to your repository:

- `AI_PROVIDER`: Your chosen AI provider (openai or claude)
- `OPENAI_API_KEY`: Your OpenAI API key (if using OpenAI)
- `CLAUDE_API_KEY`: Your Claude API key (if using Claude)

Tips for Best Results
---------------------

[](#tips-for-best-results)

1. Stage your changes thoughtfully to generate more focused commit messages
2. Use conventional commit message format when possible
3. Keep diffs reasonably sized for better AI analysis
4. Review and edit generated messages/summaries as needed

Why This Matters
----------------

[](#why-this-matters)

- **Time Savings**: Automates the often time-consuming task of writing commit messages and PR descriptions
- **Consistency**: Maintains a consistent style across your commit history
- **Quality**: Leverages AI to generate comprehensive and meaningful documentation
- **Flexibility**: Choose between OpenAI and Claude based on your preferences and needs

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbbb2187fb93b5fc91f65ccd5632de43aad2dcdc776203349b20c91022b0d010?d=identicon)[byronfichardt](/maintainers/byronfichardt)

---

Top Contributors

[![byronfichardt](https://avatars.githubusercontent.com/u/7403549?v=4)](https://github.com/byronfichardt "byronfichardt (9 commits)")

### Embed Badge

![Health badge](/badges/byron-ai-git-automation/health.svg)

```
[![Health](https://phpackages.com/badges/byron-ai-git-automation/health.svg)](https://phpackages.com/packages/byron-ai-git-automation)
```

###  Alternatives

[eecli/addon-templates

Templates for the eecli generate:addon command.

386.2k1](/packages/eecli-addon-templates)[klitsche/ffigen

FFI binding generator

168.0k1](/packages/klitsche-ffigen)[silverstripe-australia/advancedreports

A reporting module that provides an extra level of configuration and functionality over the base SilverStripe structures. Generates static output content in HTML, CSV and PDF formats.

132.6k](/packages/silverstripe-australia-advancedreports)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
