PHPackages                             mdeloughry/gcm-gen - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. mdeloughry/gcm-gen

ActiveLibrary[Queues &amp; Workers](/categories/queues)

mdeloughry/gcm-gen
==================

Git Commit Message Generator

v0.007(1y ago)015MITPHPPHP ^8.1

Since Dec 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/DR-DinoMight/gcm-gen)[ Packagist](https://packagist.org/packages/mdeloughry/gcm-gen)[ RSS](/packages/mdeloughry-gcm-gen/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (13)Used By (0)

GCM-Gen (Git Commit Message Generator)
======================================

[](#gcm-gen-git-commit-message-generator)

GCM-Gen is a CLI tool that generates meaningful commit messages by analysing your git changes. It uses AI to understand your code changes and generate appropriate commit messages. Supports both ChatGPT and Ollama for AI processing.

Features
--------

[](#features)

- 🤖 AI-powered commit message generation (ChatGPT or Ollama)
- ⚡ Quick and easy to use
- 🛠️ Configurable prompts and settings
- 📝 Direct git commit integration with branch-based commit types
- 🎨 Beautiful terminal UI

Choosing an LLM Provider
------------------------

[](#choosing-an-llm-provider)

GCM-Gen supports two AI providers, each with their own advantages:

### ChatGPT (Recommended for Best Results)

[](#chatgpt-recommended-for-best-results)

- ✅ Superior commit message quality
- ✅ Faster processing
- ✅ Lower system requirements
- ❌ Requires API key
- ❌ Sends code diffs to OpenAI servers
- ❌ Usage costs (pay per API call)

### Ollama (Recommended for Privacy/Offline Use)

[](#ollama-recommended-for-privacyoffline-use)

- ✅ Completely free to use
- ✅ Runs 100% locally
- ✅ No data leaves your machine
- ❌ Requires significant system resources
- ❌ Slower processing time
- ❌ May produce less consistent results

Choose ChatGPT if you want the best quality commit messages and don't mind the API costs. Choose Ollama if you need to keep your code private or want a free, offline solution.

Requirements
------------

[](#requirements)

### Core Requirements

[](#core-requirements)

- PHP 8.1 or higher
- Composer
- Git

### AI Provider Requirements

[](#ai-provider-requirements)

#### Option 1: ChatGPT

[](#option-1-chatgpt)

1. OpenAI API Key
    - Sign up at [OpenAI Platform](https://platform.openai.com/signup)
    - Create an API key at [API Keys](https://platform.openai.com/api-keys)
    - Add the API key to your configuration file

#### Option 2: Ollama

[](#option-2-ollama)

1. Install Ollama
    - Visit [Ollama.ai](https://ollama.ai) to download and install
    - Follow the installation instructions for your operating system
2. Start the Ollama service: ```
    ollama serve
    ```
3. Pull the required model: ```
    ollama pull llama3.2
    ```

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

[](#installation)

### Global Installation

[](#global-installation)

```
composer global require mdeloughry/gcm-gen
```

Make sure your global Composer bin directory is in your system's PATH.

Usage
-----

[](#usage)

```
# Generate a commit message
gcm-gen g

# Generate and commit in one go
gcm-gen c

# Show current configuration
gcm-gen config

# Edit configuration
gcm-gen config --edit
```

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

[](#configuration)

On first run, GCM-Gen will create a configuration file at `~/.config/gcm-gen.config.php`. You can edit this file directly or use:

```
gcm-gen config --edit
```

### Configuration Options

[](#configuration-options)

The configuration file supports both ChatGPT and Ollama providers. Here's a complete example:

```
return [
    'provider' => 'chatgpt', // or 'ollama'
    'ignore_files' => [
        'vendor',
        'node_modules',
        'package-lock.json',
        'yarn.lock',
        'composer.lock',
        'dist',
        'build',
        'public',
        'storage',
    ],
    'ollama' => [
        'model' => 'llama3.2', // Default model
    ],
    'chatgpt' => [
        'model' => 'gpt-4', // Default model
        'api_key' => 'your-api-key-here',
    ],
    'prompt' =>
