SuperAPI AI Directory

aicommits

AI-powered meaningful git commit message generation.

Open website

About this tool

Purpose

aicommits is a command-line tool (CLI) used to automatically generate Git commit messages with the help of AI, helping developers reduce the work of manually writing commit messages.

Main capabilities

  • Generate commit messages for staged changes.
  • Support multiple AI providers: TogetherAI (recommended), OpenAI, Groq, xAI, OpenRouter, Ollama (local), LM Studio (local, no API key required), and custom OpenAI-compatible endpoints.
  • Provide five commit message formats: plain (default), conventional, conventional+body, gitmoji, subject+body.
  • Can generate multiple commit messages at once for selection (use the --generate or -g option to specify the number).
  • Support appending a commit message description via the --description option.
  • Can customize the prompt via the --prompt or -p option to guide LLM behavior (such as specifying language or style).
  • Support copying the generated message to the clipboard (--clipboard or -c) instead of committing directly.
  • Support automatically staging changes to tracked files (--all or -a).
  • Support bypassing pre-commit hooks (--no-verify or -n).
  • Can use --yes or -y to skip confirmation before committing.

Usage

  1. Environment requirement: The minimum Node.js version is v22, which can be checked via node --version .npm install -g aicommits.aicommits setup. This command will guide you to select a provider, configure the API key, automatically fetch and select available models (when supported), and choose the commit message format.
  2. In a CI/CD environment, it can also be configured via a configuration file:
    • aicommits config set OPENAI_API_KEY="your_api_key_here"
    • aicommits config set OPENAI_BASE_URL="your_api_endpoint"(optional, used for a custom endpoint)
    • aicommits config set OPENAI_MODEL="your_model_choice"(optional, defaults to the provider default) This will create .aicommits in the user's home directory.
  3. Check the installed version: see the official documentation for the command.
  4. Update to the latest version: running the update command will automatically detect the package manager (npm, pnpm, yarn, or bun) and update using the corresponding command; you can also update manually.
  5. Generate a commit message directly:aicommits will generate a commit message for staged changes. Unknown arguments will be passed to git commit, so commit flags can be passed in. For example, stage changes to all tracked files when committing.
  6. Available command-line options:
    • --all or -a: automatically stage changes to tracked files (default false).
    • --clipboard or -c: copy the selected message to the clipboard instead of committing (default false).
    • --generate or -g: number of messages to generate (default 1).
    • --exclude or -x: files to exclude from AI analysis.
    • --description: include a commit message description.
    • --type or -t: Git commit message format (default plain), supporting plain, conventional, conventional+body, gitmoji, subject+body.
    • --prompt or -p: custom prompt to guide LLM behavior (for example, specific language or style instructions).
    • --no-verify or -n: bypass pre-commit hooks when committing (default false).
    • --yes or -y: skip confirmation after generating the message (default false).
  7. Generate multiple messages: use the --generate <i> option, where i is the number to generate. Note that this consumes more tokens and costs more.
  8. Use --description Add a description when submitting context that needs to go beyond the subject.
  9. Use --type to specify one of five formats. This feature is useful when a project follows a specific commit message standard or uses tools that depend on these formats.
  10. aicommits can be integrated with Git through the prepare-commit-msg hook:
    • Install the hook in the target Git repository.
    • Uninstall the hook in the target Git repository.
    • Stage files and commit:git add <files...>, then git commit(generated only when no message is passed in). If you want to write the message yourself, you can pass it directly:git commit -m "My message".
    • aicommits generates a commit message and passes it back to Git, and Git opens it in the configured editor for you to review/edit. Save and close the editor to commit.

Configuration

  • Environment variables: aicommits can also be configured using environment variables instead of a configuration file. Configuration settings are resolved in the following order of precedence: command-line arguments > environment variables > configuration file.
  • View the current configuration: run the command to display all configuration options that differ from the defaults. The API key is masked for security. If no custom configuration is set, it displays "(using all default values)".
  • Change the model: run the interactive command to select or change the AI model. This command displays the current provider and model, fetches available models from the provider API, lets you select from the available models or enter a custom model name, and automatically updates the configuration.
  • Update aicommits: check the latest version on npm, detect the package manager, update using the corresponding command, display progress, and confirm completion.
  • Read configuration values: use the read command, for example to read the API key. You can also read multiple configuration options at once, separated by spaces.
  • Set configuration values: use the set command, for example to set the API key. You can also set multiple configuration options at once.
  • Configuration items include: the OpenAI API key or custom provider API key; the custom OpenAI-compatible API endpoint URL; the model used by OpenAI-compatible providers; the selected AI provider (automatically set during setup; valid values: openai, togetherai, groq, xai, openrouter, ollama, lmstudio, custom); the locale for generated commit messages (see the ISO 639-1 code list); the number of commit messages to generate for selection (note that this consumes more tokens); the network request timeout in milliseconds (default 10000, i.e. 10 seconds, for hosted providers; default 60000, i.e. 60 seconds, for Together AI and local providers); the preferred character length for the generated commit subject (guides the model to generate concise messages, but the full subject may be longer); the commit message type (plain is a simple, unstructured commit message).

Generation process

The model receives the list of staged files, requests the required staged diff, and submits a validated commit subject and optional description. The tool can only read Git's staged snapshot, so unstaged edits are neversent to the model.

Use cases

Suitable for developers who want to automatically generate Git commit messages, especially teams that need to follow a specific commit format (such as Conventional Commits) or want to reduce the effort of writing commit messages manually. Also suitable for automated configuration in CI/CD environments.

Limitations

  • The minimum required Node.js version is v22.
  • Using --generate to generate multiple messages consumes more tokens and costs more.
  • Some providers (such as Together AI, OpenAI, xAI, LM Studio) use an agentic generation process, while other providers use a one-shot process.
  • When using environment variables, make sure all related variables (such as OPENAI_API_KEY and OPENAI_BASE_URL) are set consistently to avoid mismatches with the configuration file.
  • No other specific limitations are provided.