A CLI tool that generates commit messages using AI (OpenAI or DeepSeek) based on git diff.
- 🤖 Supports both OpenAI and DeepSeek APIs
- ⚙️ Simple configuration management
- 📋 Copies the generated message to clipboard
- 🔒 Secure - Your API keys are stored locally
go install github.com/hoangneee/ai-commit@latest
-
Clone the repository:
git clone https://github.com/hoangneee/ai-commit.git cd ai-commit
-
Make the build script executable and run it:
chmod +x build.sh ./build.sh
-
Set up the alias (choose one method):
For temporary use (current terminal session only):
alias aic='$(pwd)/aic'
For permanent use (add to your shell config):
echo "alias aic='$(pwd)/aic'" >> ~/.zshrc # or ~/.bashrc source ~/.zshrc # or ~/.bashrc
-
Verify the installation:
aic --help
git clone https://github.com/hoangneee/ai-commit.git
cd ai-commit
go build -o aic .
sudo mv aic /usr/local/bin/
# Set OpenAI API key (required)
aic config set-openai your-openai-api-key
# Optional: Set model and temperature
aic config set-openai your-openai-api-key --model gpt-4 --temperature 0.7
# Set DeepSeek API key (required)
aic config set-deepseek your-deepseek-api-key
# Optional: Set model, temperature, and base URL
aic config set-deepseek your-deepseek-api-key --model deepseek-chat --temperature 0.7 --base-url https://api.deepseek.com/v1
# Set Google AI API key (required)
aic config set-googleai your-googleai-api-key
# Optional: Set model and temperature
aic config set-googleai your-googleai-api-key --model gemini-pro --temperature 0.7
-
Stage your changes:
git add .
-
Generate a commit message:
aic generate # or simply aic
The generated commit message will be copied to your clipboard and displayed in the terminal.
-
Paste and commit:
git commit -m "$(pbpaste)" # On macOS # or git commit -m "$(xclip -o)" # On Linux with xclip # or just paste manually
The configuration is stored in ~/.aicommit.yaml
. Here's an example:
ai_model: openai # or "deepseek"
openai:
api_key: your-openai-api-key
model: gpt-3.5-turbo
temperature: 0.7
deepseek:
api_key: your-deepseek-api-key
model: deepseek-chat
temperature: 0.7
base_url: https://api.deepseek.com/v1
googleai:
api_key: your-googleai-api-key
model: gemini-pro
temperature: 0.7