commitpilotai
v1.0.8
Published
A Node.js CLI tool that acts as an AI git co-pilot.
Maintainers
Readme
✈️ CommitPilot (cmt)
CommitPilot is a professional-grade CLI tool that acts as an AI-powered co-pilot for your Git workflow. It analyzes your changes, identifies logical patterns, and generates high-quality, context-aware commit messages and Pull Request descriptions following the Conventional Commits specification.
🌟 Key Features
🧠 Intelligence & Context
- Atomic Commit Splitter: (
cmt split) Analyzes large "Mega-Commits" and suggests logical ways to split them into multiple atomic commits. - Branch-Aware Context: Automatically detects ticket IDs (like
CP-123) from your branch name and includes them in the commit header. - Smart Scoping: Suggests a commit scope based on the directory where most changes occurred.
- Local Rules Engine: Supports
.commitpilotfiles in your project root for team-specific AI instructions.
🛡️ Safety & Privacy
- Pre-Flight Security Scanner: Automatically detects sensitive files (like
.env,.pem, orcredentials.json) in staging and halts the process to prevent secret leakage. - Privacy-First Mode: (
cmt privacy on) Masks string literals in your diffs before sending them to the AI to protect business logic. - Token Guard: Warns you before sending extremely large diffs to the LLM to prevent high costs or hallucinations.
🎨 Visual Experience
- Pilot's Cockpit: A high-density dashboard header showing your current repo, branch, last commit, and staging status.
- Visual Impact Summary: An ASCII chart showing the "flavor" of your commit (Logic vs. Styles vs. Tests vs. Docs).
- Flight HUD: A real-time telemetry bar showing the AI model used, response latency, and estimated transaction cost.
- Dynamic Themes: The terminal UI accents react to the commit type (Emerald Green for
feat, Red forfix).
🚀 Installation
Prerequisites
- Node.js v18 or higher.
- Git installed and initialized in your project.
Global Install
npm install -g .Setup a Git Alias
Run this once to enable the native-feeling git c command:
cmt alias install🛠️ Getting Started
1. Configure your AI Provider
CommitPilot supports a wide range of providers. Run the interactive wizard to set up your preferred one:
cmt authSupported Providers: Google Gemini, OpenAI, Anthropic, Ollama (Local), Perplexity, OpenRouter (including many Free models), Mistral, Groq, Moonshot (Kimi), and MiniMax.
2. Stage your changes
git add .3. Generate a commit
git c # or 'cmt'📖 Command Reference
Primary Commands
| Command | Description | Use Case |
|:--- |:--- |:--- |
| cmt | Generate a commit message | Standard workflow for staged changes. |
| cmt split | Split changes into atomic commits | Use when you've worked on multiple features at once. |
| cmt pr | Generate PR title & body | When you're ready to open a Pull Request. Integrates with gh CLI. |
| cmt undo | Revert last commit | "Undo" a commit while keeping changes staged for a quick fix. |
Configuration & Management
| Command | Description |
|:--- |:--- |
| cmt auth | Launch the AI provider configuration wizard. |
| cmt use <provider> | Quickly switch between previously configured providers. |
| cmt config | View your current active configuration and saved providers. |
| cmt model <name> | Swap the specific model for the current provider (e.g., gpt-4o-mini). |
| cmt privacy <on/off>| Toggle string literal masking for diffs. |
| cmt remove <provider>| Delete a provider's credentials from local storage. |
Flags
-s, --short: Forces a concise, single-line conventional commit.-l, --long: Generates a detailed commit with a technical bulleted list.-f, --force: Bypasses the Pre-Flight Security Scanner (use with caution!).-b, --base <branch>: (Forcmt pr) Explicitly set the target branch for the PR.
🏗️ Technical Stack
- TypeScript - Core logic and type safety.
- Vercel AI SDK - Unified interface for multi-provider support.
- Clack/Prompts - Beautiful interactive CLI components.
- Simple-Git - Programmatic git orchestration.
- Boxen & Kleur - Rich terminal aesthetics and framing.
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for setup instructions and development guidelines.
⚖️ License
This project is licensed under the MIT License - see the LICENSE file for details.
