Skip to main content

A CLI tool to generate commit messages using AI models

Project description

AI Message Generator for Git

PyPI version License: MIT Python 3.7+

A CLI tool that generates commit messages using AI models based on your git repository changes. It analyzes the staged changes in your git repository and uses AI models to generate meaningful and descriptive commit messages.

Features

  • 🤖 Supports multiple AI models:
    • OpenAI GPT-3.5 Turbo
    • DeepSeek Chat
  • 🎯 Follows conventional commits format
  • 🛠️ Customizable prompt templates
  • 🔑 Secure API key storage
  • 🌐 Smart API endpoint management
  • 📝 Clear and concise commit messages

Installation

pip install aimsg

Setup

Initialize the tool with your API key and preferred model:

aimsg init

This will guide you through:

  1. Selecting an AI model
  2. Entering your API key
  3. Configuring the API endpoint (if needed)

Each model has its default API endpoint:

  • GPT-3.5 Turbo: https://api.openai.com/v1
  • DeepSeek Chat: https://api.deepseek.com

Usage

Simply use the aimsg command in any git repository:

# Stage your changes first
git add .

# Generate commit message for staged changes
aimsg commit

# Show help
aimsg --help

# Configure custom prompt template
aimsg prompt

# Reset prompt template to default
aimsg reset_prompt

# Change the AI model or API endpoint
aimsg model

Model Selection

You can choose or change the AI model:

$ aimsg model

The tool will show you:

  • Available models with their default API endpoints
  • Your current configuration
  • Option to modify the API endpoint (when applicable)

Some models (like DeepSeek) require using their specific API endpoints, which will be automatically configured for you.

Custom Prompt Template

You can customize the prompt template used for generating commit messages:

$ aimsg prompt

This will show the current prompt template and allow you to modify it. The template can use the following variables:

  • {diff}: The git diff content

Example custom prompt template:

Based on this git diff, write a commit message:
{diff}

The commit message should:
1. Start with a type (feat/fix/docs/style/refactor/test/chore)
2. Include a scope in parentheses
3. Have a brief description
4. Be no longer than 72 characters

To reset the prompt template to default:

$ aimsg reset_prompt

Example Output

$ git add .
$ aimsg commit

Generated commit message:
----------------------------------------
feat(cli): add AI-powered commit message generation
----------------------------------------

Do you want to commit with this message? [y/N]: y
Changes committed successfully!

Contributing

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

License

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

Troubleshooting

If you get "command not found: aimsg" after installation:

  1. Make sure you've added the user-level bin directory to your PATH as shown in the installation section
  2. Check if the aimsg command exists in the bin directory:
ls ~/Library/Python/3.12/bin/aimsg  # Adjust Python version as needed
  1. If the command exists but still isn't found, try restarting your terminal

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aimsg-0.1.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aimsg-0.1.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file aimsg-0.1.1.tar.gz.

File metadata

  • Download URL: aimsg-0.1.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for aimsg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 403cb22b7cc70fa3cb98907b739fb8f2cfe4175e9725440315741d53214e8519
MD5 643e5f6b19ae15f785221307a86e151e
BLAKE2b-256 f042003b4f9885bea15df4fd4c0abb6d76a227a59fc78f4b7d290a93a6ab2322

See more details on using hashes here.

File details

Details for the file aimsg-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aimsg-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for aimsg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 737c193f4be4259db7fc235743a9a50b473fc36a205550b216d32a3cc51cfd6f
MD5 7f3241e9ed266a391b3d969bba04ae24
BLAKE2b-256 cfd5393e04d9fd603117075d50cb44f86b170a067438584391910a0444e15166

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page