{"id":14964955,"url":"https://github.com/tak-bro/aicommit2","last_synced_at":"2026-05-10T04:31:42.533Z","repository":{"id":220298510,"uuid":"750368232","full_name":"tak-bro/aicommit2","owner":"tak-bro","description":"A Reactive CLI that generates commit messages for Git and Jujutsu with Ollama, ChatGPT, Gemini, Claude, Mistral and other AI","archived":false,"fork":false,"pushed_at":"2026-03-19T07:42:42.000Z","size":98390,"stargazers_count":495,"open_issues_count":2,"forks_count":40,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-20T00:49:30.557Z","etag":null,"topics":["ai-commits","aicommit","aicommits","anthropic","chatgpt","claude","cli","codestral","cohere","deepseek","git-commit","groq","jj","jujutsu","llama","mistral","ollama","perplexity","pre-commit","pre-commit-hook"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/aicommit2","language":"TypeScript","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/tak-bro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"tak-bro"}},"created_at":"2024-01-30T14:13:47.000Z","updated_at":"2026-03-19T15:30:54.000Z","dependencies_parsed_at":"2024-11-08T22:01:50.852Z","dependency_job_id":"7ab233eb-dc87-4e11-8c02-478a02b469c4","html_url":"https://github.com/tak-bro/aicommit2","commit_stats":{"total_commits":292,"total_committers":9,"mean_commits":32.44444444444444,"dds":"0.22945205479452058","last_synced_commit":"5650410314d16d743c58e1c917b9ae9e0974069c"},"previous_names":["tak-bro/aicommit2"],"tags_count":137,"template":false,"template_full_name":null,"purl":"pkg:github/tak-bro/aicommit2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tak-bro%2Faicommit2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tak-bro%2Faicommit2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tak-bro%2Faicommit2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tak-bro%2Faicommit2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tak-bro","download_url":"https://codeload.github.com/tak-bro/aicommit2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tak-bro%2Faicommit2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-commits","aicommit","aicommits","anthropic","chatgpt","claude","cli","codestral","cohere","deepseek","git-commit","groq","jj","jujutsu","llama","mistral","ollama","perplexity","pre-commit","pre-commit-hook"],"created_at":"2024-09-24T13:34:01.235Z","updated_at":"2026-05-10T04:31:42.524Z","avatar_url":"https://github.com/tak-bro.png","language":"TypeScript","funding_links":["https://github.com/sponsors/tak-bro"],"categories":["TypeScript","AI","CLIs"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cdiv\u003e\n    \u003cimg src=\"https://github.com/tak-bro/aicommit2/blob/main/img/demo-min.gif?raw=true\" alt=\"aicommit2\"/\u003e\n    \u003ch1 align=\"center\"\u003eaicommit2\u003c/h1\u003e\n  \u003c/div\u003e\n  \u003cp\u003e\n    A Reactive CLI that generates commit messages for Git, YADM, and Jujutsu with Ollama, ChatGPT, Gemini, Claude, Mistral, and other AI\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\" markdown=\"1\"\u003e\n\n[![tak-bro](https://img.shields.io/badge/by-tak--bro-293462?logo=github)](https://github.com/tak-bro)\n![license: MIT](https://img.badges.sh/license-MIT-2D2654?labelColor=5C5C5C\u0026logo=lucide%3AScale\u0026logoColor=ffffff\u0026logoStrokeWidth=1.5\u0026letterSpacing=0.5)\n[![version](https://img.shields.io/npm/v/aicommit2?logo=semanticrelease\u0026label=release\u0026color=A51C2D)](https://www.npmjs.com/package/aicommit2)\n[![downloads](https://img.shields.io/npm/dt/aicommit2?color=F33535\u0026logo=npm)](https://www.npmjs.com/package/aicommit2)\n[![Nix](https://img.shields.io/badge/Nix-5277C3?logo=nixos\u0026logoColor=fff)](#nix-installation)\n[![Homebrew](https://img.shields.io/badge/Homebrew-FBB040?logo=homebrew\u0026logoColor=000)](https://formulae.brew.sh/formula/aicommit2)\n\n\u003c/div\u003e\n\n______________________________________________________________________\n\n## Table of Contents\n\n- [Quick start](#quick-start)\n- [Introduction](#introduction)\n- [Key features](#key-features)\n- [Supported providers](#supported-providers)\n- [Setup](#setup)\n- [How it works](#how-it-works)\n- [Version Control Systems](#version-control-systems)\n- [Usage](#usage)\n- [Integrations](#integrations)\n  - [LazyGit](#lazygit)\n  - [Git Hooks](#git-hooks)\n- [Configuration](#configuration)\n- [General Settings](#general-settings)\n- [Diff Compression](#diff-compression)\n- [Logging](#logging)\n- [Custom Prompt Template](#custom-prompt-template)\n- [Code Review](#code-review)\n- [Watch Commit Mode](#watch-commit-mode)\n- [Upgrading](#upgrading)\n- [Contributing](#contributing)\n\n______________________________________________________________________\n\n## Quick start\n\n```bash\n# Install via Homebrew (macOS/Linux)\nbrew install aicommit2\n\n# Or install via npm\nnpm install -g aicommit2\n\n# Set up AI providers (interactive wizard)\naicommit2 setup\n\n# Or configure manually\naicommit2 config set OPENAI.key=\u003cyour-key\u003e\n\n# Use in your Git repository\ngit add .\naicommit2\n\n# Also works with YADM and Jujutsu repositories (auto-detected)\nyadm add \u003cfile\u003e\naicommit2\n```\n\n## Introduction\n\n_aicommit2_ automatically generates commit messages using AI. It supports [Git](https://git-scm.com/), [YADM](https://yadm.io/) (Yet Another Dotfiles Manager), and [Jujutsu](https://github.com/jj-vcs/jj) (jj) repositories with automatic detection. [AICommits](https://github.com/Nutlope/aicommits) inspired the core functionalities and architecture of this project.\n\n## Key features\n\n- **[VCS Support](#version-control-systems)**: Works with Git, YADM, and Jujutsu repositories\n- **[Multi-AI Support](#cloud-ai-services)**: Integrates with OpenAI, Anthropic Claude, Google Gemini, Mistral AI, Cohere, Groq, Ollama and more\n- **[OpenAI API Compatibility](docs/providers/compatible.md)**: Support for any service that implements the OpenAI API specification\n- **[Reactive CLI](#usage)**: Enables simultaneous requests to multiple AIs and selection of the best commit message\n- **[Code Review](#code-review)**: AI-powered structured code review with severity levels before committing\n- **[Git Hook Integration](#git-hooks)**: Can be used as a prepare-commit-msg hook\n- **[Custom Prompt](#custom-prompt-template)**: Supports user-defined system prompt templates\n- **[Diff Compression](#diff-compression)**: Reduces token usage by 30-60% with smart diff compression\n\n## Supported Providers\n\n| Provider | Default Model | Documentation |\n|----------|---------------|---------------|\n| OpenAI | `gpt-4o-mini` | [Guide](docs/providers/openai.md) |\n| Copilot SDK (Preview) | `gpt-4.1` | [Guide](docs/providers/copilot-sdk.md) |\n| OpenRouter | `openrouter/auto` | [Guide](docs/providers/openrouter.md) |\n| Anthropic | `claude-sonnet-4-20250514` | [Guide](docs/providers/anthropic.md) |\n| Gemini | `gemini-3-flash-preview` | [Guide](docs/providers/gemini.md) |\n| Mistral | `mistral-small-latest` | [Guide](docs/providers/mistral.md) |\n| Codestral | `codestral-latest` | [Guide](docs/providers/mistral.md) |\n| Cohere | `command-a-03-2025` | [Guide](docs/providers/cohere.md) |\n| Groq | `llama-3.3-70b-versatile` | [Guide](docs/providers/groq.md) |\n| Perplexity | `sonar` | [Guide](docs/providers/perplexity.md) |\n| DeepSeek | `deepseek-v4-flash` | [Guide](docs/providers/deepseek.md) |\n| GitHub Models | `openai/gpt-4o-mini` | [Guide](docs/providers/github-models.md) |\n| Bedrock | `anthropic.claude-haiku-4-5-20251001-v1:0` | [Guide](docs/providers/bedrock.md) |\n| Ollama | *(user configured)* | [Guide](docs/providers/ollama.md) |\n\n\u003e 📘 For OpenAI-compatible APIs, see [Compatibility Guide](docs/providers/compatible.md)\n\u003e\n\u003e 📘 GitHub note: `COPILOT_SDK` uses Copilot CLI authentication (`Copilot Requests` permission), while `GITHUB_MODELS` uses GitHub Models API tokens (`models: read`).\n\u003e\n\u003e 📘 Copilot SDK stable setup example (`config.ini` + env): [Copilot SDK Guide](docs/providers/copilot-sdk.md#recommended-configini-stable-baseline).\n\n## Setup\n\n1. Install _aicommit2_:\n\n**Via Homebrew (recommended for macOS/Linux):**\n```bash\nbrew install aicommit2\n```\n\n**Via npm:**\n```bash\nnpm install -g aicommit2\n```\n\n\u003e ⚠️ For npm installation, the minimum supported version of Node.js is v18. Check your Node.js version with `node --version`.\n\n\u003e ⚠️ Homebrew installation does not include [Copilot SDK](docs/providers/copilot-sdk.md) support due to its proprietary dependency. Use npm if you need Copilot SDK.\n\n2. Configure your AI provider(s) (**at least ONE provider must be configured**):\n\n**Option A: Interactive setup wizard (recommended)**\n```bash\naicommit2 setup\n```\n\n\u003e 👉 The setup wizard guides you through provider selection, API key entry, and model configuration in one step.\n\n**Option B: Manual configuration**\n```bash\naicommit2 config set OPENAI.key=\u003cyour key\u003e\naicommit2 config set ANTHROPIC.key=\u003cyour key\u003e\n# ... (similar commands for other providers)\n```\n\n3. Run _aicommit2_ in your Git or Jujutsu repository:\n\n```bash\n# For Git repositories\ngit add \u003cfiles...\u003e\naicommit2\n\n# Works with Jujutsu too (auto-detected, no staging needed)\naicommit2\n```\n\n\u003e 👉 **Tip:** Use the `aic2` alias if `aicommit2` is too long for you.\n\n### Alternative Installation Methods\n\n#### Nix Installation\n\nIf you use the Nix package manager, aicommit2 can be installed directly using the provided flake:\n\n```bash\n# Install temporarily in your current shell\nnix run github:tak-bro/aicommit2\n\n# Install permanently to your profile\nnix profile install github:tak-bro/aicommit2\n\n# Use the shorter alias\nnix run github:tak-bro/aic2 -- --help\n```\n\n##### Using in a Flake-based Project\n\nAdd aicommit2 to your flake inputs:\n\n```nix\n{\n  # flake.nix configuration file\n  inputs = {\n    nixpkgs.url = \"github:NixOS/nixpkgs/nixos-unstable\";\n    aicommit2.url = \"github:tak-bro/aicommit2\";\n  };\n  # Rest of your flake.nix file\n}\n```\n\n```nix\n# Somewhere where you define your packages\n{pkgs, inputs, ...}:{\n  environment.systemPackages = [inputs.aicommit2.packages.x86_64-linux.default];\n  # Or home packages\n  home.packages = [inputs.aicommit2.packages.x86_64-linux.default];\n}\n```\n\n##### Development Environment\n\nTo enter a development shell with all dependencies:\n\n```bash\nnix develop github:tak-bro/aicommit2\n```\n\nAfter setting up with Nix, you'll still need to configure API keys as described in the [Setup](#setup) section.\n\n#### From Source\n\n```bash\ngit clone https://github.com/tak-bro/aicommit2.git\ncd aicommit2\nnpm run build\nnpm install -g .\n```\n\n#### Via VSCode Devcontainer\n\nAdd [feature](https://github.com/kvokka/features/tree/main/src/aicommit2) to\nyour `devcontainer.json` file:\n\n```json\n\"features\": {\n  \"ghcr.io/kvokka/features/aicommit2:1\": {}\n}\n```\n\n## How it works\n\nThis CLI tool runs `git diff` to grab all your latest code changes, sends them to configured AI, then returns the AI generated commit message.\n\n\u003e If the diff becomes too large, AI will not function properly. If you encounter an error saying the message is too long or it's not a valid commit message, **try reducing the commit unit**.\n\n## Version Control Systems\n\n### Git (Primary)\n\n```bash\n# Standard Git workflow\ngit add \u003cfiles\u003e\naicommit2\n```\n\n- Uses `git diff --cached` for staged changes\n- Supports all Git features and hooks\n- Requires staging changes before commit\n\n### YADM Support\n\n_aicommit2_ supports [YADM (Yet Another Dotfiles Manager)](https://yadm.io/) for managing dotfiles:\n\n```bash\n# Standard YADM workflow\nyadm add \u003cfiles\u003e\naicommit2\n```\n\n**Features:**\n\n- Automatic detection of YADM repositories (prioritized before Git)\n- Uses `yadm` commands instead of `git` for all operations\n- Supports all YADM features including encryption and alternate files\n- Works with dotfiles in `$HOME` directory\n- Hook installation: `aicommit2 hook install` (installs to `~/.config/yadm/hooks/`)\n- **Note:** Watch mode (`--watch-commit`) is not supported for YADM repositories\n\n**Installation:**\n\n```bash\n# macOS\nbrew install yadm\n\n# Linux\napt-get install yadm  # Debian/Ubuntu\ndnf install yadm      # Fedora\n\n# Initialize repository\nyadm init\n# or clone existing dotfiles\nyadm clone \u003curl\u003e\n```\n\n### Jujutsu Support\n\n_aicommit2_ also supports [Jujutsu (jj)](https://github.com/jj-vcs/jj) repositories:\n\n```bash\n# Automatic jj detection (no staging needed)\naicommit2\n\n# Force Git when both .jj and .git exist (for colocated repos)\nFORCE_GIT=true aicommit2\n# or\naicommit2 config set forceGit=true\n```\n\n**Features:**\n\n- Automatic detection of `.jj` repositories (prioritized over Git since jj v0.34.0+ uses colocated repos)\n- Uses `jj describe` to set commit message (does NOT run `jj new` by default)\n- Supports Jujutsu's fileset syntax for file exclusions\n- Works seamlessly with colocated Git repositories\n\n**jj new Behavior:**\n\nBy default, _aicommit2_ only runs `jj describe` to set the commit message, without creating a new changeset. This matches the workflow of many Jujutsu users who prefer to manually control when to run `jj new`.\n\nTo automatically run `jj new` after describing (mimics `jj commit` behavior):\n\n```bash\n# Via CLI flag\naicommit2 --jj-auto-new\n\n# Or via config (persistent)\naicommit2 config set jjAutoNew=true\n```\n\n**Installation:**\n\n```bash\n# macOS\nbrew install jj\n\n# Linux/Windows\ncargo install jj-cli\n\n# Initialize repository\njj init\n```\n\n### Detection Priority\n\n1. **CLI flags** (highest priority - overrides everything):\n   - `--git`: Force use Git\n   - `--yadm`: Force use YADM\n   - `--jj`: Force use Jujutsu\n2. **Environment variables**:\n   - `FORCE_GIT=true`: Forces Git\n   - `FORCE_YADM=true`: Forces YADM\n   - `FORCE_JJ=true`: Forces Jujutsu\n3. **Config**: `aicommit2 config set forceGit=true` (forces Git)\n4. **Auto-detection**:\n   - Jujutsu repository (checked first - since jj v0.34.0+, repos are colocated with .git)\n   - Git repository (checked for .git directories - regular Git repos)\n   - YADM repository (checked last - for dotfiles in $HOME without .git directory)\n\n### Force VCS Selection\n\nSometimes you may want to use a specific VCS even when multiple are available:\n\n```bash\n# Use YADM in a directory that has both .git and YADM tracking\ncd ~/my-project  # Has .git directory\naicommit2 --yadm  # Forces YADM usage instead of Git\n\n# Use Git explicitly\naicommit2 --git\n\n# Use Jujutsu explicitly\naicommit2 --jj\n```\n\n## Usage\n\n### CLI mode\n\nYou can call `aicommit2` directly to generate a commit message for your staged changes:\n\n```bash\ngit add \u003cfiles...\u003e\naicommit2\n```\n\n`aicommit2` passes down unknown flags to `git commit`, so you can pass in [`commit` flags](https://git-scm.com/docs/git-commit).\n\nFor example, you can stage all changes in tracked files as you commit:\n\n```bash\naicommit2 --all # or -a\n```\n\n#### CLI Options\n\nRun `aicommit2 --help` to see all available options grouped by category.\n\n##### Message Options\n\n- `--locale` or `-l`: Locale to use for the generated commit messages (default: **en**)\n- `--generate` or `-g`: Number of messages to generate (default: **1**)\n  - **Warning**: This uses more tokens, meaning it costs more.\n- `--type` or `-t`: Git commit message format (default: **conventional**). It supports [`conventional`](https://conventionalcommits.org/) and [`gitmoji`](https://gitmoji.dev/)\n- `--prompt` or `-p`: Custom prompt to fine-tune the AI generation\n- `--include-body` or `-i`: Force include commit body in all generated messages (default: **false**)\n\n##### Behavior\n\n- `--all` or `-a`: Automatically stage changes in tracked files for the commit (default: **false**)\n- `--confirm` or `-y`: Skip confirmation when committing after message generation (default: **false**)\n- `--auto-select` or `-s`: Automatically select when only one message is generated (default: **false**)\n- `--edit` or `-e`: Open the AI-generated commit message in your default editor (default: **false**)\n- `--clipboard` or `-c`: Copy the selected message to clipboard and exit **without committing** (default: **false**)\n- `--dry-run` or `-d`: Generate commit message without committing (default: **false**)\n  - Useful for reviewing messages before manual commit (e.g., with GitHub Desktop)\n- `--output` or `-o`: Output format for non-interactive mode (default: **none**)\n  - Use `--output json` for [LazyGit](#lazygit) integration\n\n##### VCS Selection\n\n- `--git`: Force use Git (overrides auto-detection)\n- `--yadm`: Force use YADM (overrides auto-detection)\n- `--jj`: Force use Jujutsu (overrides auto-detection)\n- `--jj-auto-new`: Run `jj new` after `jj describe` (default: **false**)\n\n##### Hook Integration\n\n- `--hook-mode`: Run as a Git hook with [`prepare-commit-msg`](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#_committing_workflow_hooks) (default: **false**)\n- `--pre-commit`: Run in [pre-commit](https://pre-commit.com/) framework mode (default: **false**)\n\n##### Formatting \u0026 Debug\n\n- `--exclude` or `-x`: Files to exclude from AI analysis\n- `--disable-lowercase`: Preserve original casing of commit messages (default: **false**)\n- `--verbose` or `-v`: Enable verbose logging for debugging (default: **false**)\n\nExamples:\n\n```bash\n# Generate multiple commit messages with clipboard and file exclusions\naicommit2 --locale \"jp\" --all --type \"conventional\" --generate 3 --clipboard --exclude \"*.json\" --exclude \"*.ts\"\n\n# Generate and edit a commit message\naicommit2 --edit --type conventional # or gitmoji\n\n# Generate message without committing (dry-run)\naicommit2 --dry-run # or -d\n\n# Dry-run with clipboard (generate, select, then copy)\naicommit2 -d -c\n\n# Enable verbose logging for debugging\naicommit2 --verbose # or -v\n```\n\n#### Commands\n\nIn addition to the main commit message generation, aicommit2 provides several utility commands:\n\n| Command | Description |\n|---------|-------------|\n| `aicommit2 setup` | Interactive setup wizard for configuring AI providers |\n| `aicommit2 config` | Manage configuration (get, set, list, del) |\n| `aicommit2 doctor` | Check health status of AI providers |\n| `aicommit2 stats` | View usage statistics and performance metrics |\n| `aicommit2 hook` | Install/uninstall Git prepare-commit-msg hook |\n| `aicommit2 log` | Manage log files |\n| `aicommit2 github-login` | Login to GitHub for GitHub Models access |\n\n```bash\n# Interactive setup wizard\naicommit2 setup\n\n# Configuration management\naicommit2 config set OPENAI.key=\u003cyour-key\u003e\naicommit2 config get OPENAI\naicommit2 config list\n\n# Health check\naicommit2 doctor\n\n# Statistics\naicommit2 stats\naicommit2 stats -d 7    # Last 7 days\naicommit2 stats clear   # Clear all stats\n\n# Git hook\naicommit2 hook install\naicommit2 hook uninstall\n```\n\n\u003e GitHub Models tip: use `aicommit2 github-login` and set `GITHUB_MODELS.model` in `publisher/model` format (for example, `openai/gpt-5`).\n\n## Integrations\n\n### LazyGit\n\n_aicommit2_ supports non-interactive JSON output mode for seamless integration with [LazyGit](https://github.com/jesseduffield/lazygit).\n\n#### Setup\n\nUse the `--output json` flag to get AI-generated commit messages in JSON Lines format:\n\n```bash\naicommit2 --output json\n# Output: {\"subject\":\"feat: add user authentication\",\"body\":\"\"}\n# Output: {\"subject\":\"fix: resolve login bug\",\"body\":\"Fixes issue with session handling\"}\n```\n\nEach line is a separate JSON object with `subject` and `body` fields, compatible with LazyGit's `menuFromCommand` prompt type.\n\n#### LazyGit Configuration\n\nAdd the following to your LazyGit config file (`~/.config/lazygit/config.yml` or `~/Library/Application Support/lazygit/config.yml` on macOS):\n\n```yaml\ncustomCommands:\n  # Quick commit with AI-generated subject (c in files panel)\n  - key: \"c\"\n    context: \"files\"\n    description: \"Generate commit message with aicommit2\"\n    prompts:\n      - type: \"menuFromCommand\"\n        title: \"Select commit message\"\n        key: \"Commit\"\n        command: \"aicommit2 --output json\"\n        filter: '\"subject\":\"(?P\u003csubject\u003e[^\"]+)\",\"body\":\"(?P\u003cbody\u003e[^\"]*)\"'\n        valueFormat: '{{ .subject }}\u003cSEP\u003e{{ .body }}'\n        labelFormat: '{{ .subject }}'\n    output: \"terminal\"\n    command: bash -c 'MSG=\"{{ .Form.Commit }}\" \u0026\u0026 SUBJ=\"${MSG%%\u003cSEP\u003e*}\" \u0026\u0026 BODY=\"${MSG#*\u003cSEP\u003e}\" \u0026\u0026 git commit -e -m \"$SUBJ\" ${BODY:+-m \"$BODY\"}'\n```\n\n\u003e **Note:** This overrides LazyGit's default `c` (commit) key. You can change the key to another value (e.g., `\u003cc-a\u003e`) if you prefer to keep the default behavior.\n\n#### Usage in LazyGit\n\n1. Stage your changes in LazyGit\n2. Press `c` to generate AI commit messages and select one\n3. The editor opens with the selected message for final review\n\n#### Advanced: fzf Preview with Body\n\nFor detailed commit messages with **subject + body**, use the fzf-based approach. This uses `--include-body` (`-i`) flag to generate detailed body content and shows a preview window before committing.\n\n**Requirements:** `jq` and `fzf` must be installed (`brew install jq fzf`).\n\nFirst, create the script file at `~/.config/lazygit/scripts/aicommit_fzf.sh` (or `~/Library/Application Support/lazygit/scripts/` on macOS):\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\n\nfor cmd in aicommit2 jq fzf; do\n  if ! command -v \"$cmd\" \u003e/dev/null 2\u003e\u00261; then\n    echo \"$cmd is required\"\n    exit 1\n  fi\ndone\n\nresults_file=\"$(mktemp -t lazygit-aicommit-results.XXXXXX)\"\ntrap 'rm -f \"$results_file\"' EXIT INT TERM\n\nselected=\"$(\n  echo | fzf \\\n    --prompt=\"AI commit\u003e \" \\\n    --header=\"Select a message\" \\\n    --height=100% \\\n    --layout=reverse \\\n    --info=inline \\\n    --with-nth=2.. \\\n    --delimiter=$'\\t' \\\n    --with-shell=\"bash --noprofile --norc -c\" \\\n    --preview-window=\"right:60%:wrap\" \\\n    --preview \"jq -r '.[ {1} ] | \\\"\\(.subject)\\n\\n\\(.body)\\\"' $results_file\" \\\n    --bind \"load:unbind(load)+reload-sync#aicommit2 -i --output json 2\u003e/dev/null | jq -s '.' \u003e $results_file \u0026\u0026 jq -r 'to_entries[] | \\\"\\\\(.key)\\\\t\\\\(.value.subject)\\\"' $results_file#\"\n)\" || exit 0\n\n[ -n \"$selected\" ] || exit 0\n\nindex=\"${selected%%$'\\t'*}\"\nsubject=\"$(jq -r \".[$index].subject\" \"$results_file\")\"\nbody=\"$(jq -r \".[$index].body\" \"$results_file\")\"\n\ngit commit -e -m \"$subject\" -m \"$body\"\n```\n\nMake it executable: `chmod +x ~/.config/lazygit/scripts/aicommit_fzf.sh`\n\nThen add this to your LazyGit config:\n\n```yaml\ncustomCommands:\n  # Long commit with fzf preview (Shift+C in files panel)\n  - key: \"C\"\n    context: \"files\"\n    description: \"Generate commit message (long) with aicommit2\"\n    output: \"terminal\"\n    command: \"/path/to/aicommit_fzf.sh\"  # Update with your script path\n```\n\n\u003e Thanks to [@peinan](https://github.com/peinan) for this configuration! See the [original discussion](https://github.com/tak-bro/aicommit2/issues/215#issuecomment-3982049025) and dotfiles ([config.yml](https://github.com/peinan/dotfiles/blob/main/src/.config/lazygit/config.yml), [aicommit_fzf.sh](https://github.com/peinan/dotfiles/blob/main/src/.config/lazygit/scripts/aicommit_fzf.sh)) for reference.\n\n### Git Hooks\n\nYou can integrate _aicommit2_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing.\n\n#### Automatic Installation\n\nIn the Git repository you want to install the hook in:\n\n```bash\naicommit2 hook install\n```\n\n#### Manual Installation\n\nIf you prefer to set up the hook manually, create or edit the `.git/hooks/prepare-commit-msg` file:\n\n```bash\n#!/bin/sh\n# your-other-hook \"$@\"\naicommit2 --hook-mode \"$@\"\n```\n\nMake the hook executable:\n\n```bash\nchmod +x .git/hooks/prepare-commit-msg\n```\n\n##### Use with a custom `core.hooksPath`\n\nIf you are using [`husky`](https://typicode.github.io/husky/) or have configured a custom [`core.hooksPath`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corehooksPath), update the corresponding hooks file instead. For Husky users, this file is `.husky/prepare-commit-message`.\n\n#### Integration with pre-commit Framework\n\nIf you're using the [pre-commit](https://pre-commit.com/) framework, you can add _aicommit2_ to your `.pre-commit-config.yaml`:\n\n```yaml\nrepos:\n    - repo: local\n      hooks:\n          - id: aicommit2\n            name: AI Commit Message Generator\n            entry: aicommit2 --pre-commit\n            language: node\n            stages: [prepare-commit-msg]\n            always_run: true\n```\n\nMake sure you have:\n\n1. Installed pre-commit: `brew install pre-commit`\n2. Installed aicommit2 globally: `npm install -g aicommit2`\n3. Run `pre-commit install --hook-type prepare-commit-msg` to set up the hook\n\n\u003e **Note:** The `--pre-commit` flag is specifically designed for use with the pre-commit framework and ensures proper integration with other pre-commit hooks.\n\n#### Uninstall\n\nIn the Git repository you want to uninstall the hook from:\n\n```bash\naicommit2 hook uninstall\n```\n\nOr manually delete the `.git/hooks/prepare-commit-msg` file.\n\n### Health Check\n\nUse the `doctor` command to check the status of your configured AI providers:\n\n```bash\naicommit2 doctor\n```\n\nExample output:\n\n```\n🩺 aicommit2 Health Check\n\nProviders:\n  ✅ OPENAI         API key configured\n  ✅ OLLAMA         Running (Host: http://localhost:11434)\n  ⏭️ ANTHROPIC      Not configured\n  ⚠️ GEMINI         API key configured\n\nSummary: 2 healthy, 0 error, 1 warning, 1 skipped\n```\n\nStatus icons:\n- ✅ **Healthy**: Provider is properly configured\n- ⚠️ **Warning**: Provider has issues (e.g., Ollama not running)\n- ❌ **Error**: Provider configuration has errors\n- ⏭️ **Skipped**: Provider is not configured\n\n### Statistics\n\nUse the `stats` command to view AI request statistics and performance metrics:\n\n```bash\naicommit2 stats\n```\n\nExample output:\n\n```\n📊 aicommit2 Statistics\n   Period: 3/16/2026 - 3/17/2026\n\nOverview:\n  Total requests:     144\n  Success rate:       60.4%\n  Avg response time:  1.3s\n\nProvider Usage:\n  Provider       Rate  Bar                    Cnt  Selected        Time\n  GROQ           100%  ████████████████████    48     1  (2.1%)   732ms\n  OPENAI           0%  ░░░░░░░░░░░░░░░░░░░░    46     0           514ms\n  GITHUB_MODELS   96%  ███████████████████░    25     0            2.0s\n  GEMINI          29%  ██████░░░░░░░░░░░░░░    14     0            2.8s\n```\n\n**Columns:**\n- **Rate**: Success rate (bar color: 🟢 ≥80%, 🟡 50-79%, 🔴 \u003c50%)\n- **Cnt**: Total request count\n- **Selected**: How many times you chose this provider's message\n\nOptions:\n- `aicommit2 stats -d 7` - Show statistics for the last 7 days\n- `aicommit2 stats clear` - Clear all statistics\n\nStatistics are stored locally at `~/.config/aicommit2/stats.json`. Use `aicommit2 stats clear` to reset.\n\n## Configuration\n\naicommit2 supports configuration via command-line arguments, environment variables, and a configuration file. Settings are resolved in the following order of precedence:\n\n1. Command-line arguments\n2. Environment variables\n3. Configuration file\n4. Default values\n\n### Configuration File Location\n\naicommit2 follows the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/latest/index.html) for its configuration file. The configuration file is named `config.ini` and is in INI format. It is resolved in the following order of precedence:\n\n1. **`AICOMMIT_CONFIG_PATH` environment variable**: If this environment variable is set, its value is used as the direct path to the configuration file.\n2. **`$XDG_CONFIG_HOME/aicommit2/config.ini`**: This is the primary XDG-compliant location. If `$XDG_CONFIG_HOME` is not set, it defaults to `~/.config/aicommit2/config.ini`.\n3. **`~/.aicommit2`**: This is a legacy location maintained for backward compatibility.\n\nThe first existing file found in this order will be used. If no configuration file is found, aicommit2 will default to creating a new `config.ini` file in the `$XDG_CONFIG_HOME/aicommit2/` directory.\n\nYou can find the path of the currently loaded configuration file using the `config path` command:\n\n```bash\naicommit2 config path\n```\n\n### Environment Variable Expansion in Config File\n\nYou can use environment variables in your configuration file values. Both `$VAR` and `${VAR}` syntax are supported.\n\nExample `config.ini`:\n\n```ini\n[OPENAI]\nkey=$OPENAI_API_KEY\nurl=${CUSTOM_API_URL}/v1\n```\n\nOpenRouter example:\n\n```ini\nlogging=true\ngenerate=1\nlocale=ru\nmaxTokens=4096\ntemperature=0.2\n\n[OPENROUTER]\nenvKey=OPENROUTER_BASE_TOKEN\nmodel=stepfun/step-3.5-flash:free\nurl=https://openrouter.ai\npath=/api/v1/chat/completions\nsystemPromptPath=prompts/aicommit_prompt.txt\nresponseFormat.type=json_object\nprovider.allow_fallbacks=true\nprovider.require_parameters=false\n```\n\nIf `systemPromptPath` is relative, it is resolved relative to the config file\nlocation.\nNested OpenRouter objects such as `responseFormat` and `provider` can be written\ndirectly in `config.ini` using dotted keys, or set with JSON via `aicommit2 config set`.\n\n### Reading and Setting Configuration\n\n- READ: `aicommit2 config get [\u003ckey\u003e [\u003ckey\u003e ...]]`\n- SET: `aicommit2 config set \u003ckey\u003e=\u003cvalue\u003e`\n- DELETE: `aicommit2 config del \u003cconfig-name\u003e`\n\nExample:\n\n```bash\n# Get all configurations\naicommit2 config get\n\n# Get specific configuration\naicommit2 config get OPENAI\naicommit2 config get GEMINI.key\n\n# Set configurations\naicommit2 config set OPENAI.generate=3 GEMINI.temperature=0.5\n\n# Delete a configuration setting or section\naicommit2 config del OPENAI.key\naicommit2 config del GEMINI\naicommit2 config del timeout\n```\n\n### Environment Variables\n\nYou can configure API keys using environment variables. This is particularly useful for CI/CD environments or when you don't want to store keys in the configuration file.\n\n```bash\n# OpenAI\nOPENAI_API_KEY=\"your-openai-key\"\n# Anthropic\nANTHROPIC_API_KEY=\"your-anthropic-key\"\n# Google\nGEMINI_API_KEY=\"your-gemini-key\"\n# Mistral AI\nMISTRAL_API_KEY=\"your-mistral-key\"\nCODESTRAL_API_KEY=\"your-codestral-key\"\n# Other Providers\nCOHERE_API_KEY=\"your-cohere-key\"\nGROQ_API_KEY=\"your-groq-key\"\nPERPLEXITY_API_KEY=\"your-perplexity-key\"\nDEEPSEEK_API_KEY=\"your-deepseek-key\"\n```\n\n\u003e **Note**: You can customize the environment variable name used for the API key with the `envKey` configuration property for each service.\n\nUsage Example:\n\n```bash\nOPENAI_API_KEY=\"your-openai-key\" ANTHROPIC_API_KEY=\"your-anthropic-key\" aicommit2\n```\n\n\u003e **Note**: Environment variables take precedence over configuration file settings.\n\n### How to Configure in detail\n\n_aicommit2_ offers flexible configuration options for all AI services, including support for specifying multiple models. You can configure settings via command-line arguments, environment variables, or a configuration file.\n\n1. **Command-line arguments**: Use the format `--[Model].[Key]=value`.\n   To specify multiple models, use the `--[Model].model=model1,model2` format.\n\n   ```bash\n   aicommit2 --OPENAI.locale=\"jp\" --GEMINI.temperature=\"0.5\" --OPENAI.model=\"gpt-4o-mini,gpt-3.5-turbo\"\n   ```\n\n2. **Configuration file**: Refer to [Configuration File Location](#configuration-file-location) or use the `set` command.\n   For array-like values like `model`, you can use either the `model=model1,model2` comma-separated syntax or the `model[]=` syntax for multiple entries. This applies to all AI services.\n\n   ```ini\n   # General Settings\n   logging=true\n   generate=2\n   temperature=1.0\n\n   # Model-Specific Settings\n   [OPENAI]\n   key=\"\u003cyour-api-key\u003e\"\n   temperature=0.8\n   generate=1\n   model=\"gpt-4o-mini,gpt-3.5-turbo\"\n   systemPromptPath=\"\u003cyour-prompt-path\u003e\"\n\n   [GEMINI]\n   key=\"\u003cyour-api-key\u003e\"\n   generate=5\n   includeBody=true\n   model=\"gemini-3-flash-preview,gemini-3.1-pro-preview\"\n\n   [OLLAMA]\n   temperature=0.7\n   model[]=llama3.2\n   model[]=codestral\n   ```\n\n\u003e The priority of settings is: **Command-line Arguments \u003e Environment Variables \u003e Model-Specific Settings \u003e General Settings \u003e Default Values**.\n\n### Configuration Examples\n\n```bash\naicommit2 config set \\\n  generate=2 \\\n  topP=0.8 \\\n  maxTokens=1024 \\\n  temperature=0.7 \\\n  OPENAI.key=\"sk-...\" OPENAI.model=\"gpt-4o-mini\" OPENAI.temperature=0.5 \\\n  ANTHROPIC.key=\"sk-...\" ANTHROPIC.model=\"claude-sonnet-4-20250514\" ANTHROPIC.maxTokens=2000 \\\n  MISTRAL.key=\"your-key\" MISTRAL.model=\"mistral-small-latest\"  \\\n  OLLAMA.model=\"llama3.2\" OLLAMA.numCtx=4096 OLLAMA.watchMode=true\n```\n\n\u003e 🔍 **Detailed Support Info**: Check each provider's documentation for specific limits and behaviors:\n\u003e\n\u003e - [OpenAI](docs/providers/openai.md)\n\u003e - [Anthropic Claude](docs/providers/anthropic.md)\n\u003e - [Gemini](docs/providers/gemini.md)\n\u003e - [Mistral \u0026 Codestral](docs/providers/mistral.md)\n\u003e - [Cohere](docs/providers/cohere.md)\n\u003e - [Groq](docs/providers/groq.md)\n\u003e - [Perplexity](docs/providers/perplexity.md)\n\u003e - [DeepSeek](docs/providers/deepseek.md)\n\u003e - [GitHub Models](docs/providers/github-models.md)\n\u003e - [OpenAI API Compatibility](docs/providers/compatible.md)\n\u003e - [Ollama](docs/providers/ollama.md)\n\n## General Settings\n\nFor detailed information about all available settings, see the [General Settings documentation](docs/settings.md).\n\n| Setting                | Description                                                         | Default      |\n| ---------------------- | ------------------------------------------------------------------- | ------------ |\n| `locale`               | Locale for the generated commit messages                            | en           |\n| `generate`             | Number of commit messages to generate                               | 1            |\n| `type`                 | Type of commit message (`conventional` / `gitmoji`)                 | conventional |\n| `maxLength`            | Maximum character length of the commit subject                      | 50           |\n| `timeout`              | Request timeout (milliseconds)                                      | 10000        |\n| `temperature`          | Model's creativity (0.0 - 2.0)                                      | 0.7          |\n| `maxTokens`            | Maximum number of tokens to generate                                | 1024         |\n| `includeBody`          | Whether the commit message includes body                            | false        |\n| `codeReview`           | Enable automated code review before commit                          | false        |\n| `codeReviewPromptPath` | Path to custom code review prompt file                              | -            |\n| `autoCopy`             | Auto-copy commit message to clipboard (commits normally)            | false        |\n| `useStats`             | Enable usage statistics tracking                                    | true         |\n| `statsDays`            | Days to retain statistics data (auto-cleanup)                       | 30           |\n| `systemPromptPath`     | Path to custom system prompt file                                   | -            |\n| `modelNameDisplay`     | Model name display in CLI labels (`none` / `short` / `full`)       | short        |\n| `stream`               | **Experimental.** Enable streaming for real-time commit message generation | false        |\n| `diffCompression`      | Diff compression mode (`none` / `compact`)                          | none         |\n| `maxHunkLines`         | Max lines per hunk in compressed diff (0 = unlimited)               | 0            |\n| `maxDiffLines`         | Max total lines in compressed diff (0 = unlimited)                  | 0            |\n| `diffContext`           | Number of context lines in git diff (0-10)                          | 3            |\n\n```bash\n# Example: Set settings for a specific model\naicommit2 config set OPENAI.locale=\"jp\"\naicommit2 config set GEMINI.temperature=0.5\naicommit2 config set ANTHROPIC.includeBody=true\n```\n\n\u003e 👉 For all settings and detailed explanations, see [docs/settings.md](docs/settings.md)\n\n### Available Settings by Model\n\n|                           | timeout | temperature | maxTokens | topP | stream |\n| :-----------------------: | :-----: | :---------: | :-------: | :--: | :----: |\n|        **OpenAI**         |    ✓    |      ✓      |     ✓     |  ✓   |   ✓    |\n|   **Anthropic Claude**    |    ✓    |      ✓      |     ✓     |  ✓   |   ✓    |\n|        **Gemini**         |         |      ✓      |     ✓     |  ✓   |   ✓    |\n|      **Mistral AI**       |    ✓    |      ✓      |     ✓     |  ✓   |        |\n|       **Codestral**       |    ✓    |      ✓      |     ✓     |  ✓   |        |\n|        **Cohere**         |    ✓    |      ✓      |     ✓     |  ✓   |        |\n|         **Groq**          |    ✓    |      ✓      |     ✓     |  ✓   |   ✓    |\n|      **Perplexity**       |    ✓    |      ✓      |     ✓     |  ✓   |        |\n|       **DeepSeek**        |    ✓    |      ✓      |     ✓     |  ✓   |   ✓    |\n|     **Github Models**     |    ✓    |      ✓      |     ✓     |  ✓   |        |\n|        **Ollama**         |    ✓    |      ✓      |           |  ✓   |   ✓    |\n| **OpenAI API-Compatible** |    ✓    |      ✓      |     ✓     |  ✓   |   ✓    |\n\n## Diff Compression\n\naicommit2 can compress git diffs before sending to AI providers, reducing token usage by 30-60%. Inspired by [RTK](https://github.com/rtk-ai/rtk)'s token optimization techniques.\n\nWhen enabled (`compact` mode), the compressor:\n- Strips diff metadata headers (`diff --git`, `index`, `---/+++`)\n- Minimizes context lines (keeps only lines adjacent to changes, replaces distant context with `...`)\n- Caps large hunks and total diff size to protect model context windows\n\n```bash\n# Enable diff compression globally\naicommit2 config set diffCompression=compact\n\n# Or per model — useful for models with smaller context windows\naicommit2 config set OLLAMA.diffCompression=compact\naicommit2 config set OLLAMA.maxHunkLines=100\naicommit2 config set OLLAMA.maxDiffLines=500\n\n# Tune compression settings\naicommit2 config set maxHunkLines=200   # max lines per hunk (0=unlimited)\naicommit2 config set maxDiffLines=1000  # max total diff lines (0=unlimited)\naicommit2 config set diffContext=1      # reduce git context lines (default: 3)\n\n# Disable compression (default)\naicommit2 config set diffCompression=none\n```\n\n## Logging\n\nThe application utilizes two distinct logging systems to provide comprehensive insights into its operations:\n\n### 1. Application Logging (Winston)\n\nThis system handles general application logs and exceptions. Its behavior can be configured through the following settings in your `config.ini` file:\n\n- **`logLevel`**:\n\n  - **Description**: Specifies the minimum level for logs to be recorded. Messages with a level equal to or higher than the configured `logLevel` will be captured.\n  - **Default**: `info`\n  - **Supported Levels**: `error`, `warn`, `info`, `http`, `verbose`, `debug`, `silly`\n\n- **`logFilePath`**:\n\n  - **Description**: Defines the path to the main application log file. This setting supports date patterns (e.g., `%DATE%`) to automatically rotate log files daily.\n  - **Default**: `logs/aicommit2-%DATE%.log` (relative to the application's state directory, typically `~/.local/state/aicommit2/logs` on Linux or `~/Library/Application Support/aicommit2/logs` on macOS).\n\n- **`exceptionLogFilePath`**:\n\n  - **Description**: Specifies the path to a dedicated log file for recording exceptions. Similar to `logFilePath`, it supports date patterns for daily rotation.\n  - **Default**: `logs/exceptions-%DATE%.log` (relative to the application's state directory, typically `~/.local/state/aicommit2/logs` on Linux or `~/Library/Application Support/aicommit2/logs` on macOS).\n\n### 2. AI Request/Response Logging\n\nThis system is specifically designed to log the prompts and responses exchanged with AI models for review and commit generation. These logs are stored in the application's dedicated logs directory.\n\n- **Log Location**: These logs are stored in the same base directory as the application logs, which is determined by the system's state directory (e.g., `~/.local/state/aicommit2/logs` on Linux or `~/Library/Application Support/aicommit2/logs` on macOS).\n- **File Naming**: Each AI log file is uniquely named using a combination of the date (`YYYY-MM-DD_HH-MM-SS`) and a hash of the git diff content, ensuring easy identification and chronological order.\n\n### Enable/Disable Logging\n\nThe `logging` setting controls whether log files are generated. It can be configured both globally and for individual AI services:\n\n- **Global `logging` setting**: When set in the general configuration, it controls the overall application logging (handled by Winston) and acts as a default for AI request/response logging.\n- **Service-specific `logging` setting**: You can override the global `logging` setting for a particular AI service. If `logging` is set to `false` for a specific service, AI request/response logs will not be generated for that service, regardless of the global setting.\n\n### Log Management\n\n_aicommit2_ generates detailed logs for debugging and tracking AI requests. You can manage these log files using the built-in log commands:\n\n#### View Log Files\n\n```bash\n# List all log files with details\naicommit2 log list\n\n# Show logs directory path\naicommit2 log path\n```\n\n#### Open Log Directory\n\n```bash\n# Open logs directory in your file manager\naicommit2 log open\n```\n\n#### Clean Up Logs\n\n```bash\n# Remove all log files\naicommit2 log removeAll\n```\n\n#### Log File Information\n\n- **Location**: Logs are stored in your system's state directory (usually `~/.local/state/aicommit2/logs` on Linux/macOS)\n- **Content**: Each log file contains the git diff, system prompt, AI response, and metadata\n- **Naming**: Files are named with timestamp and hash for easy identification\n- **Size**: File sizes are displayed in human-readable format (B, KB, MB, GB)\n\n## Custom Prompt Template\n\n_aicommit2_ supports custom prompt templates through the `systemPromptPath` option. This feature allows you to define your own prompt structure, giving you more control over the commit message generation process.\n\n### Using the systemPromptPath Option\n\nTo use a custom prompt template, specify the path to your template file when running the tool:\n\n```bash\naicommit2 config set systemPromptPath=\"/path/to/user/prompt.txt\"\naicommit2 config set OPENAI.systemPromptPath=\"/path/to/another-prompt.txt\"\n```\n\nFor the above command, OpenAI uses the prompt in the `another-prompt.txt` file, and the rest of the model uses `prompt.txt`.\n\n\u003e **NOTE**: For the `systemPromptPath` option, set the **template path**, not the template content\n\n### Template Format\n\nYour custom template can include placeholders for various commit options.\nUse curly braces `{}` to denote these placeholders for options. The following placeholders are supported:\n\n- `{locale}`: The language for the commit message (default: **en**)\n- `{maxLength}`: The maximum length for the commit message (default: **50**)\n- `{type}`: The type of the commit message (**conventional** or **gitmoji**)\n- `{generate}`: The number of commit messages to generate (default: **1**)\n\n#### Example Template\n\nHere's an example of how your custom template might look:\n\n```\nGenerate a {type} commit message in {locale}.\nThe message should not exceed {maxLength} characters.\nPlease provide {generate} messages.\n\nRemember to follow these guidelines:\n1. Use the imperative mood\n2. Be concise and clear\n3. Explain the 'why' behind the change\n```\n\n#### **Appended Text**\n\nPlease note that the following text will **ALWAYS** be appended to the end of your custom prompt:\n\n```\nLastly, Provide your response as a JSON array containing exactly {generate} object, each with the following keys:\n- \"subject\": The main commit message using the {type} style. It should be a concise summary of the changes.\n- \"body\": An optional detailed explanation of the changes. If not needed, use an empty string.\n- \"footer\": An optional footer for metadata like BREAKING CHANGES. If not needed, use an empty string.\nThe array must always contain {generate} element, no more and no less.\nExample response format:\n[\n  {\n    \"subject\": \"fix: fix bug in user authentication process\",\n    \"body\": \"- Update login function to handle edge cases\\n- Add additional error logging for debugging\",\n    \"footer\": \"\"\n  }\n]\nEnsure you generate exactly {generate} commit message, even if it requires creating slightly varied versions for similar changes.\nThe response should be valid JSON that can be parsed without errors.\n```\n\nThis ensures that the output is consistently formatted as a JSON array, regardless of the custom template used.\n\n## Code Review\n\naicommit2 includes an AI-powered code review feature that analyzes your staged changes before generating commit messages. When enabled, it provides structured feedback with severity levels and actionable suggestions.\n\n### Enable Code Review\n\n```bash\n# Enable globally\naicommit2 config set codeReview=true\n\n# Or enable for specific providers only\naicommit2 config set OPENAI.codeReview=true\naicommit2 config set ANTHROPIC.codeReview=true\n```\n\n### How It Works\n\nWhen `codeReview` is enabled, the commit flow becomes:\n\n1. **Stage changes** (`git add`)\n2. **Run aicommit2** — code review runs automatically before commit message generation\n3. **Review results** — AI analyzes the diff and returns structured feedback\n4. **Confirm or abort** — choose to continue with the commit or fix issues first\n5. **Generate commit messages** — proceeds as normal after confirmation\n\n### Structured Review Output\n\nReviews are organized by severity and category:\n\n- **Severity levels**: `critical`, `warning`, `suggestion`, `praise`\n- **Categories**: `bug`, `security`, `performance`, `style`, `maintainability`, `other`\n\nEach review item includes a title, description, file reference, and concrete suggestion for improvement. When critical issues are found, the confirmation prompt defaults to \"No\" to encourage fixing before committing.\n\n### Custom Review Prompt\n\nYou can customize the code review prompt using a template file:\n\n```bash\naicommit2 config set codeReviewPromptPath=\"/path/to/review-prompt.txt\"\naicommit2 config set OPENAI.codeReviewPromptPath=\"/path/to/another-prompt.txt\"\n```\n\nThe template supports the same `{locale}`, `{type}`, `{generate}`, `{maxLength}` placeholders as the commit prompt.\n\n\u003e **NOTE**: When using a custom review prompt, the response format is plain text (not structured JSON). The structured severity/category output is only available with the default prompt.\n\n\u003e **WARNING**: Code review runs **in addition to** commit message generation, which means **API token usage roughly doubles** per commit. If multiple providers have `codeReview` enabled, each provider performs its own review. Monitor your token usage carefully, especially with large diffs.\n\n## Watch Commit Mode\n\n![watch-commit-gif](https://github.com/tak-bro/aicommit2/blob/main/img/watch-commit-min.gif?raw=true)\n\nWatch Commit mode allows you to monitor Git commits in real-time and automatically perform AI code reviews using the `--watch-commit` flag.\n\n```bash\naicommit2 --watch-commit\n```\n\nThis feature only works within Git repository directories and automatically triggers whenever a commit event occurs. When a new commit is detected, it automatically:\n\n1. Analyzes commit changes\n2. Performs AI code review\n3. Displays results in real-time\n\n\u003e For detailed configuration of the code review feature, please refer to the [codeReview](docs/settings.md#codereview) section. The settings in that section are shared with this feature.\n\n⚠️ **CAUTION**\n\n- The Watch Commit feature is currently **experimental**\n- This feature performs AI analysis for each commit, which **consumes a significant number of API tokens**\n- API costs can increase substantially if there are many commits\n- It is recommended to **carefully monitor your token usage** when using this feature\n- To use this feature, you must enable watch mode for at least one AI model:\n\n```bash\naicommit2 config set [MODEL].watchMode=\"true\"\n```\n\n## Upgrading\n\nCheck the installed version with:\n\n```bash\naicommit2 --version\n```\n\nIf it's not the [latest version](https://github.com/tak-bro/aicommit2/releases/latest), run:\n\n```bash\n# Via Homebrew\nbrew upgrade aicommit2\n\n# Via npm\nnpm update -g aicommit2\n```\n\n## Disclaimer and Risks\n\nThis project uses functionalities from external APIs but is not officially affiliated with or endorsed by their providers. Users are responsible for complying with API terms, rate limits, and policies.\n\n## Contributing\n\nFor bug fixes or feature implementations, please check the [Contribution Guide](CONTRIBUTING.md).\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n\n\u003c!-- markdownlint-disable --\u003e\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/eltociear\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/eltociear\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@eltociear\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=eltociear\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/ubranch\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/ubranch\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@ubranch\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=ubranch\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/bhodrolok\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/bhodrolok\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@bhodrolok\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=bhodrolok\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/ryicoh\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/ryicoh\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@ryicoh\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=ryicoh\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/noamsto\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/noamsto\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@noamsto\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=noamsto\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/tdabasinskas\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/tdabasinskas\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@tdabasinskas\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=tdabasinskas\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/gnpaone\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/gnpaone\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@gnpaone\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=gnpaone\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/devxpain\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/devxpain\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@devxpain\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=devxpain\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/delenzhang\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/delenzhang\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@delenzhang\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=delenzhang\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/kvokka\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/kvokka\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@kvokka\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=kvokka\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/mdeweerd\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/mdeweerd\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@mdeweerd\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=mdeweerd\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/DivitMittal\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/DivitMittal\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@DivitMittal\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=DivitMittal\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/aaccioly\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/aaccioly\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@aaccioly\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=aaccioly\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/forivall\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/forivall\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@forivall\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=forivall\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/jaytaylor\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/jaytaylor\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@jaytaylor\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=jaytaylor\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/denniswebb\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/denniswebb\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@denniswebb\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=denniswebb\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/peinan\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/peinan\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@peinan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/issues/215\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/totoroot\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/totoroot\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@totoroot\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=totoroot\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/lawrence3699\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/lawrence3699\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@lawrence3699\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=lawrence3699\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/atlet99\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/atlet99\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e@atlet99\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/tak-bro/aicommit2/commits?author=atlet99\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n______________________________________________________________________\n\nIf this project has been helpful, please consider giving it a Star ⭐️!\n\nMaintainer: [@tak-bro](https://env-tak.github.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftak-bro%2Faicommit2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftak-bro%2Faicommit2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftak-bro%2Faicommit2/lists"}