| Crates.io | aic |
| lib.rs | aic |
| version | 0.2.0 |
| created_at | 2025-03-29 05:51:24.177978+00 |
| updated_at | 2025-04-23 16:21:31.058574+00 |
| description | AI-powered commit message generation CLI tool |
| homepage | https://github.com/shenxiangzhuang/aic |
| repository | https://github.com/shenxiangzhuang/aic |
| max_upload_size | |
| id | 1610867 |
| size | 140,309 |
A CLI tool that uses AI to generate meaningful commit messages by analyzing your staged Git changes.
.aic.toml for repository-specific settingscargo install aic
# For OpenAI
aic config setup --api-token your_openai_token --api-base-url https://api.openai.com --model gpt-3.5-turbo
# For DeepSeek
aic config setup --api-token your_deepseek_token --api-base-url https://api.deepseek.com --model deepseek-chat
Output:
⚙️ Updating configuration...
✓ Set api_token to: your•••••
✓ Set api_base_url to: https://api.openai.com
✓ Set model to: gpt-3.5-turbo
🎉 Configuration updated successfully!
aic config list
Output:
⚙️ Current Configuration:
┌───────────────┬──────────────────────────────────────┐
│ api_token │ your••••• │
│ api_base_url │ https://api.openai.com │
│ model │ gpt-3.5-turbo │
│ system_prompt │ You are an expert at writing... │
│ user_prompt │ Here is the git diff of the staged...│
└───────────────┴──────────────────────────────────────┘
📁 Configuration file location:
/home/user/.config/aic/config.toml
aic ping
Output:
🔍 Testing API connection...
🌐 API Base URL: https://api.openai.com
🤖 Model: gpt-3.5-turbo
✅ API connection successful!
✨ Configuration is working correctly.
# Stage changes and generate commit message
aic -a
# Generate and commit automatically
aic -ac
# Generate, commit, and push automatically
aic -acp
# Generate commit message (with staged changes)
aic
Example output:
╭─────────────────────────────────────╮
│ AI Commit Message Generator │
╰─────────────────────────────────────╯
📦 Staging all changes...
🔍 Analyzing staged changes...
🤖 Using model: gpt-3.5-turbo
✨ Generating commit message...
📋 Commit command:
git commit -m "feat: add new feature X"
Execute this commit? [Y/m/n]:
# Generate commit message (requires staged changes)
aic
# Stage all changes and generate commit message
aic -a
# Generate and commit automatically
aic -c
# Stage all changes and commit automatically
aic -ac
# Generate commit message and push after committing
aic -p
# Stage all changes, generate commit message and push after committing
aic -ap
# Generate, commit, and push automatically
aic -cp
# Stage all changes, commit, and push automatically
aic -acp
# Test API connection
aic ping
Note: The
-aflag will stage ALL changes in your working directory withgit add .. The-cflag will commit directly without confirmation. The-pflag will push changes to remote after a successful commit (either automatic or manual). Use these flags with caution, especially in repositories with multiple changes.
# Quick setup
aic config setup --api-token <TOKEN> --api-base-url https://api.openai.com --model gpt-4-turbo
# View current settings
aic config list
# View active configuration (global + project)
aic config show
# Get specific setting
aic config get api_token
# Update setting
aic config set model gpt-4-turbo
aic config set default_prompt "Write detailed commit messages"
You can also create a project-specific .aic.toml file in your repository root. See Project-level Configuration for details.
The global configuration is stored in TOML format at:
~/.config/aic/config.toml%APPDATA%\aic\config.tomlExample config.toml:
api_token = "your_api_token_here"
api_base_url = "https://api.openai.com"
model = "gpt-3.5-turbo"
system_prompt = """You are an expert at writing clear and concise commit messages.
Follow these rules strictly:
1. Start with a type: feat, fix, docs, style, refactor, perf, test, build, ci, chore, or revert
2. Add a scope in parentheses when the change affects a specific component/module
3. Write a brief description in imperative mood (e.g., 'add' not 'added')
4. Keep the first line under 72 characters
5. For simple changes (single file, small modifications), use only the subject line
6. For complex changes (multiple files, new features, breaking changes):
- Add a body explaining what and why
- Use numbered points (1., 2., 3., etc.) to list distinct changes
- Organize points in order of importance"""
user_prompt = """Generate a commit message for the following changes. First analyze the complexity of the diff.
For simple changes, provide only a subject line.
For complex changes, include a body with numbered points (1., 2., 3.) that clearly outline
each distinct modification or feature. Organize these points by importance.
Look for patterns like new features, bug fixes, or configuration changes to determine
the appropriate type and scope:
```diff
{}
```"""
api_token: Your API authentication tokenapi_base_url: API endpoint (default: OpenAI)model: AI model to use (default: gpt-3.5-turbo)system_prompt: System prompt that defines the AI's role and commit message formatuser_prompt: User prompt that provides context about the git changesIn addition to global settings, you can create a project-specific configuration file:
# Check current active configuration (global + project)
aic config show
.aic.toml file in your Git repository rootaic in that repository.git folder)Example .aic.toml:
# Project-specific configuration (.aic.toml)
# All fields are optional - only specify what you want to override
# API settings
api_token = "your_api_token_here" # Only add if different from global config
api_base_url = "https://api.openai.com"
model = "gpt-4-turbo" # Use a different model for this project
# Customized prompts for project-specific commit conventions
system_prompt = """You are a commit message expert for our project.
Use our project conventions:
1. feat: for new features
2. fix: for bug fixes
3. docs: for documentation
4. refactor: for code changes that neither fix bugs nor add features
5. style: for changes that do not affect the meaning of the code
6. test: for adding or modifying tests
7. chore: for routine tasks, dependency updates, etc.
Always include the scope in parentheses when possible.
Example: feat(auth): implement OAuth login
For complex changes, use bullet points to describe the details."""
user_prompt = """Generate a commit message following our project conventions.
Analyze the complexity of the diff and provide appropriate detail:
```diff
{}
```"""
You can view the active configuration and which files are being used with:
aic config show
Output example:
📋 Active Configuration:
🔍 Configuration Sources:
Global config: /home/user/.config/aic/config.toml
Project config: /path/to/your/project/.aic.toml
ℹ️ Project settings override global settings
...
EDITOR: Preferred editor for modifying commit messages
# Stage changes and generate commit message
git add .
aic
# Stage and commit automatically
aic -ac
# Stage changes and push after manual commit
aic -ap
# Stage, commit and push automatically (all-in-one)
aic -acp
# Commit and push changes that are already staged
aic -cp
# Set up OpenAI
aic config setup --api-token sk-... --model gpt-4-turbo
# Set up DeepSeek
aic config setup --api-token ds-... --api-base-url https://api.deepseek.com --model deepseek-chat
# Customize commit message style
aic config set system_prompt "You are an expert at writing clear and concise commit messages..."
aic config set user_prompt "Here is the git diff of the staged changes. Generate a commit message..."
No Changes Detected
git addAPI Errors
Editor Issues
export EDITOR=vimgit checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)This project is licensed under the MIT License - see the LICENSE file for details.