git-auto-commit

command module
v0.0.0-...-1de4b27 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: MIT Imports: 3 Imported by: 0

README

git-auto-commit

CI Go Report Card

A cross-platform CLI tool that automatically generates meaningful commit messages from your staged changes using AI.

Features

  • 🤖 Multiple AI Providers: Supports OpenAI (native & Azure), Anthropic Claude, and GitHub Models
  • 🌍 Cross-Platform: Works on Windows, Linux, and macOS
  • 📝 Conventional Commits: Generates commit messages following the conventional commit format
  • 🔒 Secure: API keys stored in local config file with restricted permissions
  • 🎯 Simple to Use: Interactive configuration wizard and straightforward CLI
  • Fast: Written in Go for optimal performance

Installation

From Source
go install github.com/algernon-coop/git-auto-commit@latest
Using Go Get
git clone https://github.com/algernon-coop/git-auto-commit.git
cd git-auto-commit
go build -o git-auto-commit .
Pre-built Binaries

Download pre-built binaries from the releases page.

Quick Start

1. Configure AI Provider

Run the interactive configuration wizard:

git-auto-commit configure

This will prompt you to select an AI provider and enter your credentials:

  • OpenAI (native): Requires an OpenAI API key
  • OpenAI (Azure): Requires Azure OpenAI endpoint, API key, and deployment name
  • Anthropic Claude: Requires an Anthropic API key
  • GitHub Models: Requires a GitHub token
2. Stage Your Changes
git add .
3. Generate and Commit
git-auto-commit

The tool will:

  1. Analyze your staged changes
  2. Generate a meaningful commit message using AI
  3. Display the message for review
  4. Commit the changes
Dry Run Mode

To preview the commit message without committing:

git-auto-commit --dry-run

Configuration

The configuration is stored in ~/.git-auto-commit.yaml by default. You can specify a custom config file:

git-auto-commit --config /path/to/config.yaml
Configuration File Format
provider: openai
openai:
  api_key: your-api-key-here
  model: gpt-4

Supported AI Providers

OpenAI (Native)
provider: openai
openai:
  api_key: sk-...
  model: gpt-4  # or gpt-3.5-turbo, gpt-4-turbo, etc.
Azure OpenAI
provider: azure
azure:
  endpoint: https://your-resource.openai.azure.com
  api_key: your-azure-api-key
  deployment: your-deployment-name
Anthropic Claude
provider: claude
claude:
  api_key: sk-ant-...
  model: claude-3-5-sonnet-20241022  # or other Claude models
GitHub Models
provider: github
github:
  token: ghp_...
  model: gpt-4o  # or other available models

Development

Prerequisites
  • Go 1.21 or higher
  • Git
Building from Source
git clone https://github.com/algernon-coop/git-auto-commit.git
cd git-auto-commit
go mod download
go build -o git-auto-commit .
Running Tests
go test ./... -v
Using Dev Container

This project includes a dev container configuration for VS Code:

  1. Install the Dev Containers extension
  2. Open the project in VS Code
  3. Click "Reopen in Container" when prompted
Linting
golangci-lint run

CI/CD

The project uses GitHub Actions for continuous integration:

  • Test: Runs tests on Linux, Windows, and macOS with multiple Go versions
  • Lint: Runs golangci-lint to ensure code quality
  • Build: Creates binaries for all supported platforms

Dependencies

Dependencies are managed with Go modules and automatically updated weekly via Dependabot.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Inspired by the need for better commit messages
  • Built with Cobra for CLI functionality
  • Uses various AI providers for intelligent commit message generation

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cmd
git
llm

Jump to

Keyboard shortcuts

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