{"id":27646334,"url":"https://github.com/shenxiangzhuang/aic","last_synced_at":"2025-10-24T09:04:02.130Z","repository":{"id":285045513,"uuid":"956382492","full_name":"shenxiangzhuang/aic","owner":"shenxiangzhuang","description":"AI powered commit message generation","archived":false,"fork":false,"pushed_at":"2025-04-23T16:25:25.000Z","size":150,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-24T01:18:09.564Z","etag":null,"topics":["ai","commit","git","llm","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/aic","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shenxiangzhuang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-28T06:50:47.000Z","updated_at":"2025-04-23T16:25:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"594631b9-731d-459a-8a5a-f1853c2baeab","html_url":"https://github.com/shenxiangzhuang/aic","commit_stats":null,"previous_names":["shenxiangzhuang/aic"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenxiangzhuang%2Faic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenxiangzhuang%2Faic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenxiangzhuang%2Faic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenxiangzhuang%2Faic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shenxiangzhuang","download_url":"https://codeload.github.com/shenxiangzhuang/aic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250540886,"owners_count":21447428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","commit","git","llm","rust"],"created_at":"2025-04-24T01:18:13.912Z","updated_at":"2025-10-24T09:04:02.124Z","avatar_url":"https://github.com/shenxiangzhuang.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AIC: AI Commit Message Generator\n\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![Crates.io](https://img.shields.io/crates/v/aic)](https://crates.io/crates/aic)\n[![codecov](https://codecov.io/gh/shenxiangzhuang/aic/graph/badge.svg?token=Ekvrf0TzJa)](https://codecov.io/gh/shenxiangzhuang/aic)\n\nA CLI tool that uses AI to generate meaningful commit messages by analyzing your staged Git changes.\n\n## Features\n\n- 🤖 **AI-Powered**: Automatically generates detailed and context-aware commit messages\n- ✏️ **Interactive Mode**: Review and edit generated messages before committing\n- 🔌 **Multiple AI Providers**: Works with OpenAI and compatible APIs\n- 🌟 **Project-level Config**: Use `.aic.toml` for repository-specific settings\n- ⚙️ **Customizable**: Configure prompts, models, and API endpoints\n\n## Installation\n\n```bash\ncargo install aic\n```\n\n## Quick Start\n\n1. Configure your API settings:\n\n```bash\n# For OpenAI\naic config setup --api-token your_openai_token --api-base-url https://api.openai.com/v1 --model gpt-3.5-turbo\n\n# For DeepSeek\naic config setup --api-token your_deepseek_token --api-base-url https://api.deepseek.com --model deepseek-chat\n```\n\nOutput:\n\n```bash\n⚙️  Updating configuration...\n✓ Set api_token to: your•••••\n✓ Set api_base_url to: https://api.openai.com/v1\n✓ Set model to: gpt-3.5-turbo\n🎉 Configuration updated successfully!\n```\n\n2. Verify your configuration:\n\n```bash\naic config list\n```\n\nOutput:\n\n```\n⚙️  Current Configuration:\n┌───────────────┬──────────────────────────────────────┐\n│ api_token     │ your•••••                            │\n│ api_base_url  │ https://api.openai.com/v1            │\n│ model         │ gpt-3.5-turbo                        │\n│ system_prompt │ You are an expert at writing...      │\n│ user_prompt   │ Here is the git diff of the staged...│\n└───────────────┴──────────────────────────────────────┘\n\n📁 Configuration file location:\n   /home/user/.config/aic/config.toml\n```\n\n3. Test your API connection:\n\n```bash\naic ping\n```\n\nOutput:\n\n```\n🔍 Testing API connection...\n🌐 API Base URL: https://api.openai.com/v1\n🤖 Model: gpt-3.5-turbo\n✅ API connection successful!\n✨ Configuration is working correctly.\n```\n\n4. Generate commit messages:\n\n```bash\n# Stage changes and generate commit message\naic -a\n\n# Generate and commit automatically\naic -ac\n\n# Generate, commit, and push automatically\naic -acp\n\n# Generate commit message (with staged changes)\naic\n```\n\nExample output:\n\n```\n╭─────────────────────────────────────╮\n│     AI Commit Message Generator     │\n╰─────────────────────────────────────╯\n📦 Staging all changes...\n🔍 Analyzing staged changes...\n🤖 Using model: gpt-3.5-turbo\n✨ Generating commit message...\n📋 Commit command:\ngit commit -m \"feat: add new feature X\"\n\nExecute this commit? [Y/m/n]:\n```\n\n## Usage\n\n### Basic Commands\n\n```bash\n# Generate commit message (requires staged changes)\naic\n\n# Stage all changes and generate commit message\naic -a\n\n# Generate and commit automatically\naic -c\n\n# Stage all changes and commit automatically\naic -ac\n\n# Generate commit message and push after committing\naic -p\n\n# Stage all changes, generate commit message and push after committing\naic -ap\n\n# Generate, commit, and push automatically\naic -cp\n\n# Stage all changes, commit, and push automatically\naic -acp\n\n# Test API connection\naic ping\n```\n\n\u003e **Note**: The `-a` flag will stage ALL changes in your working directory with `git add .`. The `-c` flag will commit directly without confirmation. The `-p` flag will push changes to remote after a successful commit (either automatic or manual). Use these flags with caution, especially in repositories with multiple changes.\n\n### Configuration Management\n\n```bash\n# Quick setup\naic config setup --api-token \u003cTOKEN\u003e --api-base-url https://api.openai.com/v1 --model gpt-4-turbo\n\n# View current settings\naic config list\n\n# View active configuration (global + project)\naic config show\n\n# Get specific setting\naic config get api_token\n\n# Update setting\naic config set model gpt-4-turbo\naic config set default_prompt \"Write detailed commit messages\"\n```\n\nYou can also create a project-specific `.aic.toml` file in your repository root. See [Project-level Configuration](#project-level-configuration) for details.\n\n### Configuration Files\n\n#### Global Configuration\n\nThe global configuration is stored in TOML format at:\n\n- Linux/macOS: `~/.config/aic/config.toml`\n- Windows: `%APPDATA%\\aic\\config.toml`\n\nExample `config.toml`:\n\n```toml\napi_token = \"your_api_token_here\"\napi_base_url = \"https://api.openai.com/v1\"\nmodel = \"gpt-3.5-turbo\"\nsystem_prompt = \"\"\"You are an expert at writing clear and concise commit messages.\nFollow these rules strictly:\n\n1. Start with a type: feat, fix, docs, style, refactor, perf, test, build, ci, chore, or revert\n2. Add a scope in parentheses when the change affects a specific component/module\n3. Write a brief description in imperative mood (e.g., 'add' not 'added')\n4. Keep the first line under 72 characters\n5. For simple changes (single file, small modifications), use only the subject line\n6. For complex changes (multiple files, new features, breaking changes):\n   - Add a body explaining what and why\n   - Use numbered points (1., 2., 3., etc.) to list distinct changes\n   - Organize points in order of importance\"\"\"\nuser_prompt = \"\"\"Generate a commit message for the following changes. First analyze the complexity of the diff.\n\nFor simple changes, provide only a subject line.\n\nFor complex changes, include a body with numbered points (1., 2., 3.) that clearly outline\neach distinct modification or feature. Organize these points by importance.\n\nLook for patterns like new features, bug fixes, or configuration changes to determine\nthe appropriate type and scope:\n\n```diff\n{}\n```\"\"\"\n```\n\n### Configuration Options\n\n- `api_token`: Your API authentication token\n- `api_base_url`: API endpoint (default: OpenAI)\n- `model`: AI model to use (default: gpt-3.5-turbo)\n- `system_prompt`: System prompt that defines the AI's role and commit message format\n- `user_prompt`: User prompt that provides context about the git changes\n\n### Project-level Configuration\n\nIn addition to global settings, you can create a project-specific configuration file:\n\n```bash\n# Check current active configuration (global + project)\naic config show\n```\n\n1. Create a `.aic.toml` file in your Git repository root\n2. Project settings will override global settings when running `aic` in that repository\n3. The search for project config will stop at the Git repository root (directory with `.git` folder)\n\nExample `.aic.toml`:\n\n```toml\n# Project-specific configuration (.aic.toml)\n# All fields are optional - only specify what you want to override\n\n# API settings\napi_token = \"your_api_token_here\"  # Only add if different from global config\napi_base_url = \"https://api.openai.com/v1\"\nmodel = \"gpt-4-turbo\"  # Use a different model for this project\n\n# Customized prompts for project-specific commit conventions\nsystem_prompt = \"\"\"You are a commit message expert for our project.\nUse our project conventions:\n1. feat: for new features\n2. fix: for bug fixes\n3. docs: for documentation\n4. refactor: for code changes that neither fix bugs nor add features\n5. style: for changes that do not affect the meaning of the code\n6. test: for adding or modifying tests\n7. chore: for routine tasks, dependency updates, etc.\n\nAlways include the scope in parentheses when possible.\nExample: feat(auth): implement OAuth login\n\nFor complex changes, use bullet points to describe the details.\"\"\"\n\nuser_prompt = \"\"\"Generate a commit message following our project conventions.\nAnalyze the complexity of the diff and provide appropriate detail:\n\n```diff\n{}\n```\"\"\"\n```\n\nYou can view the active configuration and which files are being used with:\n\n```bash\naic config show\n```\n\nOutput example:\n\n```\n📋 Active Configuration:\n\n🔍 Configuration Sources:\n   Global config: /home/user/.config/aic/config.toml\n   Project config: /path/to/your/project/.aic.toml\n   ℹ️ Project settings override global settings\n...\n```\n\n### Environment Variables\n\n- `EDITOR`: Preferred editor for modifying commit messages\n  - Falls back to: vim → vi → nano\n\n## Examples\n\n### Basic Usage\n\n```bash\n# Stage changes and generate commit message\ngit add .\naic\n\n# Stage and commit automatically\naic -ac\n\n# Stage changes and push after manual commit\naic -ap\n\n# Stage, commit and push automatically (all-in-one)\naic -acp\n\n# Commit and push changes that are already staged\naic -cp\n```\n\n### Configuration Examples\n\n```bash\n# Set up OpenAI\naic config setup --api-token sk-... --model gpt-4-turbo\n\n# Set up DeepSeek\naic config setup --api-token ds-... --api-base-url https://api.deepseek.com --model deepseek-chat\n\n# Customize commit message style\naic config set system_prompt \"You are an expert at writing clear and concise commit messages...\"\naic config set user_prompt \"Here is the git diff of the staged changes. Generate a commit message...\"\n```\n\n## Troubleshooting\n\n1. **No Changes Detected**\n   - Ensure changes are staged with `git add`\n   - Check if you're in a git repository\n\n2. **API Errors**\n   - Verify your API token is set correctly\n   - Check API endpoint accessibility\n   - Confirm you have sufficient API credits\n\n3. **Editor Issues**\n   - Set your preferred editor: `export EDITOR=vim`\n   - Ensure the editor is installed and accessible\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## References\n\n- [The Lost Art of Commit Messages](https://www.seyhan.me/blog/post/lost-art-of-commit-messages)\n- [Conventional Commits 1.0.0](https://www.conventionalcommits.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenxiangzhuang%2Faic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshenxiangzhuang%2Faic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenxiangzhuang%2Faic/lists"}