Skip to content

AI-driven CLI tool that generates optimal, context-aware commit messages, streamlining your version control process with precision and efficiency

License

Notifications You must be signed in to change notification settings

stiliajohny/commitron

Repository files navigation

Contributors Forks Stargazers Issues GPL3 License LinkedIn Ask Me Anything


Main Logo

commitron

AI-driven CLI tool that generates optimal, context-aware commit messages, streamlining your version control process with precision and efficiency
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

Commitron

Commitron is a CLI tool that generates AI-powered commit messages based on your staged changes in a git repository.

Features

  • 🤖 Uses AI to generate meaningful commit messages
  • 🔍 Analyzes your staged changes to understand what has been modified
  • 🧩 Supports multiple AI providers:
    • OpenAI (ChatGPT)
    • Google Gemini
    • Ollama (local inference)
    • Anthropic Claude
  • 📝 Supports various commit message conventions:
  • ⚙️ Customizable settings via configuration file

Example output

When you run commitron after staging some changes, you'll see output similar to this:

Generated Commit Message:
------------------------
feat(git): add support for detecting staged files and creating commits

Implement Git integration for detecting staged files and generating
commit messages based on the changes. This adds functionality to check
if the current directory is a Git repository, retrieve a list of staged
files, and create commits with AI-generated messages.
------------------------

Do you want to use this commit message? (y/n):

If you type y, the commit will be created using the generated message.

Installation

Using Homebrew (macOS)

# Add the tap directly from the commitron repository
brew tap stiliajohny/commitron https://github.com/stiliajohny/commitron.git

# Then install commitron
brew install commitron

Manual Installation

# Clone the repository
git clone https://github.com/johnstilia/commitron.git

# Navigate to the directory
cd commitron

# Build and install
go install ./cmd/commitron

Usage

# Stage your changes
git add .

# Run commitron to generate a commit message
commitron

# Use with a custom config file
commitron --config /path/to/custom/config.yaml
# or using shorthand flags
commitron -c /path/to/custom/config.yaml

# Available commands
commitron generate            # Generate a commit message (default command)
commitron init                # Initialize a new configuration file
commitron version             # Show version information

# Command options
commitron generate --dry-run                  # Preview without committing
commitron generate -d                         # Shorthand for --dry-run
commitron generate -c /path/to/config         # Use custom config (shorthand)
commitron init --force                        # Overwrite existing config
commitron init -f                             # Shorthand for --force
commitron init -c /path/to/config             # Initialize at custom location (shorthand)

# Get help for any command
commitron --help
commitron [command] --help

Configuration

Commitron looks for a configuration file at ~/.commitronrc. This is a YAML file that allows you to customize how the tool works.

Example configuration:

# AI provider configuration
ai:
  provider: openai
  api_key: your-api-key-here
  model: gpt-3.5-turbo

# Commit message configuration
commit:
  convention: conventional
  include_body: true
  max_length: 72

# Context settings for AI
context:
  include_file_names: true
  include_diff: true
  max_context_length: 4000

See example.commitronrc for a complete example with all available options.

API Keys

To use Commitron, you'll need API keys for your chosen AI provider:

For Ollama, you need to have it running locally. See Ollama documentation for more information.

License

See LICENSE.txt for details.

Built With


Getting Started

Prerequisites

Installation


Usage


Roadmap

See the open issues for a list of proposed features (and known issues).


Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GPLv3 License. See LICENSE for more information.

Contact

John Stilia - stilia.johny@gmail.com


Acknowledgements

About

AI-driven CLI tool that generates optimal, context-aware commit messages, streamlining your version control process with precision and efficiency

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published