diff-aware commit message generation with multi-provider support
Analyzes staged Git diffs by extracting file changes and passing them through a provider-agnostic abstraction layer that routes to OpenAI, TogetherAI, Groq, xAI, OpenRouter, Ollama, or LM Studio. The system constructs context-aware prompts from the diff payload and returns AI-generated commit messages. Uses a Router-Handler-Service pattern where src/cli.ts routes commands, provider modules handle API calls, and utility functions manage diff extraction and prompt construction.
Unique: Uses a provider-agnostic abstraction layer (src/feature/providers/index.ts) that decouples AI backend selection from message generation logic, enabling seamless switching between cloud (OpenAI, TogetherAI) and local (Ollama, LM Studio) providers without code changes. Implements diff chunking to handle large changesets that exceed token limits.
vs alternatives: More flexible than GitHub Copilot's commit suggestions (which are tightly coupled to GitHub) because it supports 7+ providers including local LLMs, and more lightweight than Conventional Commits linters because it generates rather than validates messages.
git hook-based automatic commit message injection
Integrates with Git's prepare-commit-msg hook to intercept the commit workflow and automatically generate messages before the editor opens. When a user runs 'git commit' without a message, the hook executes aicommits in headless mode, captures the generated message, and writes it to the temporary commit message file (.git/COMMIT_EDITMSG). The hook installation is managed via 'aicommits hook install' which registers the hook script in .git/hooks/prepare-commit-msg.
Unique: Implements hook installation as a first-class CLI command ('aicommits hook install') that programmatically writes and registers the hook script, rather than requiring manual file placement. Detects headless mode to suppress interactive prompts when running in hook context, ensuring non-blocking execution.
vs alternatives: More transparent than manual CLI invocation because it integrates into the native Git workflow without requiring developers to remember to run a separate command; more reliable than shell aliases because it hooks into Git's internal commit flow.
pull request description generation from commit messages
Extends commit message generation to produce pull request descriptions by analyzing the diff and generating a summary suitable for PR body text. The system constructs a prompt that instructs the AI to produce a PR-formatted description (including motivation, changes, and testing notes) rather than a single-line commit message. PR descriptions are generated using the same provider abstraction and configuration system as commits.
Unique: Reuses the same provider abstraction and diff analysis pipeline as commit generation, with only the prompt instructions changing to target PR format. No separate PR-specific provider logic required.
vs alternatives: More flexible than GitHub's auto-generated PR descriptions because it uses custom AI models and can be configured per-project; more comprehensive than commit-based PR generation because it produces structured multi-section descriptions.
headless mode detection and non-interactive execution
Detects when aicommits is running in a non-interactive context (e.g., Git hook, CI/CD pipeline) and suppresses interactive prompts, progress spinners, and user input requests. Headless mode is automatically detected by checking for TTY (terminal) availability or can be explicitly enabled via environment variables. In headless mode, the system returns results directly without waiting for user confirmation, enabling integration into automated workflows.
Unique: Implements automatic headless detection by checking TTY availability (src/cli.ts) rather than requiring explicit flags, making the tool work seamlessly in both interactive and automated contexts without configuration changes.
vs alternatives: More user-friendly than tools requiring explicit headless flags because it detects the context automatically; more reliable than tools that assume interactive mode because it adapts to the execution environment.
multi-format commit message generation with conventional commits and gitmoji support
Generates commit messages in multiple configurable formats: plain text (default), Conventional Commits (type(scope): subject), Gitmoji (emoji prefix + message), and subject+body format. The format is selected via configuration (stored in ~/.aicommits in INI format) or CLI flags (--type). The prompt engineering adapts based on the selected format, instructing the AI model to follow specific conventions. Format validation ensures generated messages conform to the selected schema before returning to the user.
Unique: Implements format selection as a configuration-driven prompt engineering pattern where the AI instruction set changes based on the selected format, rather than post-processing generated text. Supports Gitmoji as a first-class format, not just a cosmetic layer, with dedicated prompt instructions for emoji selection.
vs alternatives: More flexible than commitlint (which only validates) because it generates format-compliant messages; more comprehensive than Copilot's commit suggestions because it supports Gitmoji and subject+body formats in addition to Conventional Commits.
provider-agnostic ai backend abstraction with dynamic model selection
Abstracts AI provider APIs behind a unified interface (src/feature/providers/index.ts) that decouples message generation logic from provider-specific implementation details. Supports 7+ providers: OpenAI, TogetherAI, Groq, xAI, OpenRouter, Ollama, and LM Studio. Each provider is implemented as a module with standardized request/response handling. Users configure their preferred provider and model via 'aicommits setup' wizard or CLI flags, and the system routes API calls to the selected backend without code changes.
Unique: Implements a provider abstraction layer that treats local (Ollama, LM Studio) and cloud (OpenAI, TogetherAI) providers identically, enabling seamless switching without code changes. Each provider module handles API-specific details (authentication, request formatting, response parsing) while exposing a common interface.
vs alternatives: More flexible than tools locked to a single provider (e.g., GitHub Copilot → OpenAI only) because it supports 7+ backends; more lightweight than LangChain's provider abstraction because it's purpose-built for commit generation with minimal overhead.
configuration management with ini-based persistence and cli override
Stores user configuration in ~/.aicommits as an INI file containing provider credentials, model selection, commit format, and custom prompt instructions. Configuration is loaded at startup and can be overridden via CLI flags (--type, --generate, --prompt). The system implements a precedence hierarchy: CLI flags > environment variables > INI file > defaults. Configuration is validated on load to ensure required fields (API keys, provider name) are present; missing credentials trigger the setup wizard.
Unique: Implements a three-tier configuration precedence (CLI flags > env vars > INI file > defaults) that allows flexible overrides without modifying persistent config. Uses INI format for human-readability and simplicity, avoiding the complexity of YAML or JSON while remaining easy to edit manually.
vs alternatives: More flexible than environment-variable-only configuration because it supports persistent defaults; simpler than YAML-based config (used by some tools) because INI is more readable for non-technical users.
interactive setup wizard with provider credential validation
Provides an interactive CLI wizard ('aicommits setup') that guides users through selecting an AI provider, entering API credentials, choosing a commit format, and optionally customizing the prompt. The wizard validates credentials by making a test API call to the selected provider before saving configuration. If validation fails, the wizard prompts the user to re-enter credentials or select a different provider. Configuration is written to ~/.aicommits upon successful validation.
Unique: Implements credential validation as part of the setup flow by making a test API call to the selected provider before persisting configuration, ensuring users discover credential issues immediately rather than on first use. Supports all 7+ providers in a single wizard without branching logic.
vs alternatives: More user-friendly than manual configuration because it guides users through options interactively; more reliable than skipping validation because it catches credential errors before they impact the user's workflow.
+4 more capabilities