{"id":25426742,"url":"https://github.com/suenot/aicommit","last_synced_at":"2025-10-31T16:30:26.397Z","repository":{"id":268843345,"uuid":"905456107","full_name":"suenot/aicommit","owner":"suenot","description":"A CLI tool that generates concise and descriptive git commit messages using LLM","archived":false,"fork":false,"pushed_at":"2025-02-14T21:04:30.000Z","size":3156,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T21:11:10.582Z","etag":null,"topics":["ai","aicommit","autocommit","commit","git","llm","version"],"latest_commit_sha":null,"homepage":"https://suenot.github.io/aicommit/","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/suenot.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":"2024-12-18T21:36:08.000Z","updated_at":"2025-02-14T21:04:34.000Z","dependencies_parsed_at":"2025-01-13T22:25:44.343Z","dependency_job_id":"4ac55245-f6ef-47d6-9cfa-7d1c933b6734","html_url":"https://github.com/suenot/aicommit","commit_stats":null,"previous_names":["suenot/commit","suenot/aicommit"],"tags_count":91,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suenot%2Faicommit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suenot%2Faicommit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suenot%2Faicommit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suenot%2Faicommit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suenot","download_url":"https://codeload.github.com/suenot/aicommit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239120206,"owners_count":19584980,"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","aicommit","autocommit","commit","git","llm","version"],"created_at":"2025-02-17T00:21:37.296Z","updated_at":"2025-10-31T16:30:26.345Z","avatar_url":"https://github.com/suenot.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aicommit\n![logo](./docs/aicommit-logo.png)\n\n[![Crates.io](https://img.shields.io/crates/v/aicommit.svg)](https://crates.io/crates/aicommit)\n[![Documentation](https://docs.rs/aicommit/badge.svg)](https://docs.rs/aicommit)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n📚 [Website \u0026 Documentation](https://suenot.github.io/aicommit/)\n\nA CLI tool that generates concise and descriptive git commit messages using LLMs (Large Language Models).\n\n## Features\n\n### Implemented Features\n- ✅ Uses LLMs to generate meaningful commit messages from your changes\n- ✅ Supports multiple LLM providers (OpenRouter, Ollama, OpenAI compatible api)\n- ✅ Custom api keys for services through open router api (for google aistudio and etc) - go to https://openrouter.ai/settings/integrations and paste key from any of them: AI21, Amazon BedRock, Anthropic, AnyScale, Avian.io, Cloudflare, Cohere, DeepInfra, **DeepSeek**, Fireworks, **Google AI Studio**, Google Vertex, Hyperbolic, Infermatic, Inflection, Lambda, Lepton, Mancer, Mistral, NovitaAI, OpenAI, Perplexity, Recursal, SambaNova, SF Compute, Together, xAI\n- ✅ Fast and efficient - works directly from your terminal\n- ✅ Easy configuration and customization\n- ✅ Transparent token usage and cost tracking\n- ✅ Automatic retry on provider errors (configurable attempts with 5s delay)\n- ✅ Version management with automatic incrementation\n- ✅ Version synchronization with Cargo.toml\n- ✅ Version synchronization with package.json\n- ✅ Version management with git tag\n- ✅ Provider management (add, list, set active)\n- ✅ Interactive configuration setup\n- ✅ Configuration file editing\n- ✅ Add all to stash functionality (`aicommit --add`)\n- ✅ Auto push functionality (`aicommit --push`)\n- ✅ Auto pull functionality (`aicommit --pull`)\n- ✅ Automatic upstream branch setup for new branches\n- ✅ Interactive commit message generation (`aicommit --dry-run`)\n- ✅ Basic .gitignore file checks and management (create ~/.default_gitignore and use it as template if there is no .gitignore in this directory)\n- ✅ Watch mode (`aicommit --watch 1m`)\n- ✅ Watch with edit delay (`aicommit --watch 1m --wait-for-edit 30s`)\n- ✅ OpenAI compatible API support\n- ✅ Help information display (`aicommit --help`)\n- ✅ Publication in npm\n- ✅ Support for cross-compilation (ARM, AARCH64, etc.)\n- ✅ Installation from binary\n- ✅ --verbose mode (show context for LLM)\n\n### Planned Features\n- 🚧 Support github issues (sync, auto open, auto close)\n- 🚧 Tests for each feature to prevent breaking changes\n- 🚧 Split commits by file (`aicommit --by-file`)\n- 🚧 Split commits by feature (`aicommit --by-feature`)\n- 🚧 Version management for multiple languages (requirements.txt, etc.)\n- 🚧 Branch safety checks for push operations\n- 🚧 Publication management\n- 🚧 Publication in brew/macports\n- 🚧 Publication in apt/apk/yum/pacman\n- 🚧 Publication in other package managers\n- 🚧 Support for submodules\n- 🚧 Support for mercurial\n- 🚧 Langchain support for multiple providers and custom logic\n- 🚧 Using priority for providers (if one of provider broken)\n\nLegend:\n- ✅ Implemented\n- 🚧 Planned\n- 🧪 Has tests\n\n## Installation\n\nThere are several ways to install aicommit:\n\n### Using Cargo (Rust package manager)\n\nIf you have Rust installed:\n```bash\ncargo install aicommit\n```\n\n### Using npm/npx\n\n```bash\n# Run without installation\nnpx @suenot/aicommit\n\n# Or install globally\nnpm install -g @suenot/aicommit\naicommit\n```\n\n### Using brew\n```bash\n# Install Homebrew if you haven't already\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n\n# Add aicommit tap and install\nbrew tap suenot/tap\nbrew install suenot/tap/aicommit\n```\n\n### Manual Installation\n\n#### Download Pre-built Binaries\n\nYou can download pre-built binaries from the [GitHub Releases](https://github.com/suenot/aicommit/releases) page.\n\nAvailable builds:\n- Linux (x86_64, ARM64)\n- macOS (Intel x86_64, Apple Silicon ARM64)\n- Windows (x86_64, ARM64)\n\n#### Linux/macOS:\n```bash\n# 1. Download and extract (replace VERSION and ARCH with appropriate values)\n# wget https://github.com/suenot/aicommit/releases/download/vVERSION/aicommit-\u003cARCH\u003e\n# chmod +x aicommit-\u003cARCH\u003e\n# mv aicommit-\u003cARCH\u003e aicommit\n# sudo mv aicommit /usr/local/bin/\n\n# Example for Linux x86_64:\nwget https://github.com/suenot/aicommit/releases/download/v0.1.72/aicommit-linux-x86_64\nmv aicommit-linux-x86_64 aicommit\nchmod +x aicommit\nsudo mv aicommit /usr/local/bin/\n\n# Example for macOS ARM64:\nwget https://github.com/suenot/aicommit/releases/download/v0.1.72/aicommit-macos-aarch64\nmv aicommit-macos-aarch64 aicommit\nchmod +x aicommit\nsudo mv aicommit /usr/local/bin/\n\n# Example for macOS x86_64:\nwget https://github.com/suenot/aicommit/releases/download/v0.1.72/aicommit-macos-x86_64\nmv aicommit-macos-x86_64 aicommit\nchmod +x aicommit\nsudo mv aicommit /usr/local/bin/\n\n\n# 2. Make it executable\nchmod +x aicommit-\u003cARCH\u003e\n\n\n# 3. Move to a directory in your PATH (optional)\n\n```\n\n#### Windows:\n1. Download the ZIP file for your architecture\n2. Extract the executable\n3. Add the directory to your PATH or move the executable to a directory in your PATH\n\n### Build from Source\n\nIf you want to build the latest version from source:\n\n```bash\n# 1. Clone the repository\ngit clone https://github.com/suenot/aicommit\ncd aicommit\n\n# 2. Build and install\ncargo install --path .\n```\n\nRequirements for building from source:\n- Rust toolchain (install from [rustup.rs](https://rustup.rs))\n- A C compiler (gcc, clang, or MSVC)\n- OpenSSL development packages (on Linux)\n\n## Quick Start\n\n1. Add a provider (choose one method):\n\n   Interactive mode:\n   ```bash\n   aicommit --add-provider\n   ```\n\n   Non-interactive mode (example with OpenRouter):\n   ```bash\n   aicommit --add-provider --add-openrouter --openrouter-api-key \"your-api-key\"\n   ```\n\n2. Make some changes to your code\n\n3. Create a commit:\n   ```bash\n   # Commit only staged changes (files added with git add)\n   aicommit\n\n   # Automatically stage and commit all changes\n   aicommit --add\n\n   # Stage all changes, commit, and push\n   aicommit --add --push\n   ```\n\n## Provider Management\n\nAdd a provider in interactive mode:\n```bash\naicommit --add-provider\n```\n\nAdd providers in non-interactive mode:\n```bash\n# Add OpenRouter provider\naicommit --add-provider --add-openrouter --openrouter-api-key \"your-api-key\" --openrouter-model \"mistralai/mistral-tiny\"\n\n# Add Ollama provider\naicommit --add-provider --add-ollama --ollama-url \"http://localhost:11434\" --ollama-model \"llama2\"\n\n# Add OpenAI compatible provider\naicommit --add-provider --add-openai-compatible \\\n  --openai-compatible-api-key \"your-api-key\" \\\n  --openai-compatible-api-url \"https://api.deep-foundation.tech/v1/chat/completions\" \\\n  --openai-compatible-model \"gpt-4o-mini\"\n```\n\nOptional parameters for non-interactive mode:\n- `--max-tokens` - Maximum number of tokens (default: 50)\n- `--temperature` - Controls randomness (default: 0.3)\n\nList all configured providers:\n```bash\naicommit --list\n```\n\nSet active provider:\n```bash\naicommit --set \u003cprovider-id\u003e\n```\n\n## Version Management\n\naicommit supports automatic version management with the following features:\n\n1. Automatic version incrementation using a version file:\n```bash\naicommit --version-file version --version-iterate\n```\n\n2. Synchronize version with Cargo.toml:\n```bash\naicommit --version-file version --version-iterate --version-cargo\n```\n\n3. Synchronize version with package.json:\n```bash\naicommit --version-file version --version-iterate --version-npm\n```\n\n4. Update version on GitHub (creates a new tag):\n```bash\naicommit --version-file version --version-iterate --version-github\n```\n\nYou can combine these flags to update multiple files at once:\n```bash\naicommit --version-file version --version-iterate --version-cargo --version-npm --version-github\n```\n\n## Configuration\n\nThe configuration file is stored at `~/.aicommit.json`. You can edit it directly with:\n\n```bash\naicommit --config\n```\n\n### Global Configuration\n\nThe configuration file supports the following global settings:\n\n```json\n{\n  \"providers\": [...],\n  \"active_provider\": \"provider-id\",\n  \"retry_attempts\": 3  // Number of attempts to generate commit message if provider fails\n}\n```\n\n- `retry_attempts`: Number of retry attempts if provider fails (default: 3)\n  - Waits 5 seconds between attempts\n  - Shows informative messages about retry progress\n  - Can be adjusted based on your needs (e.g., set to 5 for less stable providers)\n\n### Provider Configuration\n\nEach provider can be configured with the following settings:\n\n- `max_tokens`: Maximum number of tokens in the response (default: 200)\n- `temperature`: Controls randomness in the response (0.0-1.0, default: 0.3)\n\nExample configuration with all options:\n```json\n{\n  \"providers\": [{\n    \"id\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"provider\": \"openrouter\",\n    \"api_key\": \"sk-or-v1-...\",\n    \"model\": \"mistralai/mistral-tiny\",\n    \"max_tokens\": 200,\n    \"temperature\": 0.3\n  }],\n  \"active_provider\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"retry_attempts\": 3\n}\n```\n\nFor OpenRouter, token costs are automatically fetched from their API. For Ollama, you can specify your own costs if you want to track usage.\n\n## Supported LLM Providers\n\n### OpenRouter\n```json\n{\n  \"providers\": [{\n    \"id\": \"550e8400-e29b-41d4-a716-446655440000\",\n    \"provider\": \"openrouter\",\n    \"api_key\": \"sk-or-v1-...\",\n    \"model\": \"mistralai/mistral-tiny\",\n    \"max_tokens\": 50,\n    \"temperature\": 0.3,\n    \"input_cost_per_1k_tokens\": 0.25,\n    \"output_cost_per_1k_tokens\": 0.25\n  }],\n  \"active_provider\": \"550e8400-e29b-41d4-a716-446655440000\"\n}\n```\n\n#### Recommended Providers through OpenRouter\n\n- 🌟 **Google AI Studio** - 1000000 tokens for free\n  - \"google/gemini-2.0-flash-exp:free\"\n- 🌟 **DeepSeek**\n  - \"deepseek/deepseek-chat\"\n\n\n### Ollama\n```json\n{\n  \"providers\": [{\n    \"id\": \"67e55044-10b1-426f-9247-bb680e5fe0c8\",\n    \"provider\": \"ollama\",\n    \"url\": \"http://localhost:11434\",\n    \"model\": \"llama2\",\n    \"max_tokens\": 50,\n    \"temperature\": 0.3,\n    \"input_cost_per_1k_tokens\": 0.0,\n    \"output_cost_per_1k_tokens\": 0.0\n  }],\n  \"active_provider\": \"67e55044-10b1-426f-9247-bb680e5fe0c8\"\n}\n```\n\n### OpenAI-compatible API\n\nFor example, you can use DeepGPTBot's OpenAI-compatible API for generating commit messages. Here's how to set it up:\n\n1. Get your API key from Telegram:\n   - Open [@DeepGPTBot](https://t.me/DeepGPTBot) in Telegram\n   - Use the `/api` command to get your API key\n\n2. Configure aicommit (choose one method):\n\n   Interactive mode:\n   ```bash\n   aicommit --add-provider\n   ```\n   Select \"OpenAI Compatible\" and enter:\n   - API Key: Your key from @DeepGPTBot\n   - API URL: https://api.deep-foundation.tech/v1/chat/completions\n   - Model: gpt-4o-mini\n   - Max tokens: 50 (default)\n   - Temperature: 0.3 (default)\n\n   Non-interactive mode:\n   ```bash\n   aicommit --add-provider --add-openai-compatible \\\n     --openai-compatible-api-key \"your-api-key\" \\\n     --openai-compatible-api-url \"https://api.deep-foundation.tech/v1/chat/completions\" \\\n     --openai-compatible-model \"gpt-4o-mini\"\n   ```\n\n3. Start using it:\n   ```bash\n   aicommit\n   ```\n\n## Usage Information\n\nWhen generating a commit message, the tool will display:\n- Number of tokens used (input and output)\n- Total API cost (calculated separately for input and output tokens)\n\nExample output:\n```\nGenerated commit message: Add support for multiple LLM providers\nTokens: 8↑ 32↓\nAPI Cost: $0.0100\n```\n\nYou can have multiple providers configured and switch between them by changing the `active_provider` field to match the desired provider's `id`.\n\n### Staging Changes\n\nBy default, aicommit will only commit changes that have been staged using `git add`. To automatically stage all changes before committing, use the `--add` flag:\n\n```bash\n# Only commit previously staged changes\naicommit\n\n# Automatically stage and commit all changes\naicommit --add\n\n# Stage all changes, commit, and push (automatically sets up upstream if needed)\naicommit --add --push\n\n# Stage all changes, pull before commit, and push after (automatically sets up upstream if needed)\naicommit --add --pull --push\n```\n\n### Automatic Upstream Branch Setup\n\nWhen using `--pull` or `--push` flags, aicommit automatically handles upstream branch configuration:\n\n- If the current branch has no upstream set:\n  ```bash\n  # Automatically runs git push --set-upstream origin \u003cbranch\u003e when needed\n  aicommit --push\n\n  # Automatically sets up tracking and pulls changes\n  aicommit --pull\n  ```\n\n- For new branches:\n  - With `--push`: Creates the remote branch and sets up tracking\n  - With `--pull`: Skips pull if remote branch doesn't exist yet\n  - No manual `git push --set-upstream origin \u003cbranch\u003e` needed\n\nThis makes working with new branches much easier, as you don't need to manually configure upstream tracking.\n\n## Watch Mode\n\nThe watch mode allows you to automatically commit changes at specified intervals. This is useful for:\n- Automatic backups of your work\n- Maintaining a detailed history of changes\n- Not forgetting to commit your changes\n\n### Basic Watch Mode\n\n```bash\naicommit --watch 1m      # Check and commit changes every minute\naicommit --watch 30s     # Check every 30 seconds\naicommit --watch 2h      # Check every 2 hours\n```\n\n### Watch with Edit Delay\n\nYou can add a delay after the last edit before committing. This helps avoid creating commits while you're still actively editing files:\n\n```bash\naicommit --watch 1m --wait-for-edit 30s   # Check every minute, but wait 30s after last edit\n```\n\n### Time Units\n- `s`: seconds\n- `m`: minutes\n- `h`: hours\n\n### Additional Options\nYou can combine watch mode with other flags:\n```bash\n# Watch with auto-push\naicommit --watch 1m --push\n\n# Watch with version increment\naicommit --watch 1m --add --version-file version --version-iterate\n\n# Interactive mode with watch\naicommit --watch 1m --dry-run\n```\n\n### Tips\n- Use shorter intervals (30s-1m) for active development sessions\n- Use longer intervals (5m-15m) for longer coding sessions\n- Add `--wait-for-edit` when you want to avoid partial commits\n- Use `Ctrl+C` to stop watching\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuenot%2Faicommit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuenot%2Faicommit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuenot%2Faicommit/lists"}