AI Committer is a lightweight CLI tool designed to help developers generate professional, AI-powered git commit messages with customizable options. It supports various AI providers, models, and commit types, making it a versatile addition to your development workflow.
- Generate professional commit messages using AI.
- Supports multiple AI providers like
ollama
andopenai
. - Customizable commit types (e.g.,
feat
,fix
,chore
). - Option to generate a list of commit messages.
- Fully configurable via CLI arguments or environment variables.
Install globally using npm
or yarn
:
npm install -g ai-committer
Run the tool from the command line:
ai-committer
ai-committer --provider openai --model gpt-4o --commitType feat
This will generate a commit message using the specified provider, model, and commit type.
You can configure the tool using:
- CLI Arguments
- Environment Variables
- A combination of both
Argument | Description | Example Values | Default |
---|---|---|---|
--provider |
The AI provider to use. | ollama , openai |
ollama |
--model |
The AI model to use with the provider. | gpt-4o , gpt-3.5-turbo |
undefined |
--commitType |
The commit type for the generated message. | feat , fix , chore |
undefined |
--numCommits |
The number of commit messages to generate. | Any integer | 5 |
--list |
Generate a list of commits instead of a single one. | true /false |
false |
Example:
ai-committer --provider openai --model gpt-4o --commitType feat --numCommits 3 --list
You can set environment variables to configure the tool globally.
Variable | Description | Example Values | Default |
---|---|---|---|
AI_PROVIDER |
The AI provider to use. | ollama , openai |
ollama |
OPENAI_API_KEY |
API key required for the openai provider. |
Your OpenAI API key | undefined |
Set them directly in your terminal:
export AI_PROVIDER=openai
export OPEN_AI_API_KEY=your-api-key
or Create a .env
file in your working directory and set the variables:
AI_PROVIDER=openai
OPENAI_API_KEY=your-api-key
ai-committer --provider openai --model gpt-4o --commitType fix
ai-committer --provider ollama --list --numCommits 3
-
Create a
.env
file:AI_PROVIDER=openai OPENAI_API_KEY=your-api-key
-
Run the tool:
ai-committer
Option | Default Value |
---|---|
AI_PROVIDER |
ollama |
MODEL |
undefined |
COMMIT_TYPE |
undefined |
NUM_COMMITS |
5 |
IS_LIST |
false |
- Node.js: Ensure Node.js is installed on your system.
- OpenAI API Key: Required when using the
openai
provider.
Contributions are welcome! Feel free to submit a pull request or open an issue.
Enjoy effortless commit messages with AI Committer! 🚀