alcapush
v1.0.5
Published
AI-powered git commit message generator with GPT-5-nano support π
Downloads
611
Maintainers
Readme
Alcapush π
AI-powered git commit message generator with GPT-5-nano support
Alcapush is a fork of opencommit with enhanced features, better UX, and support for the latest AI models including GPT-5-nano.
GitHub Repository: https://github.com/dablon/alcapush
β¨ Features
- π€ Multiple AI Providers: OpenAI (GPT-5-nano, GPT-4, GPT-3.5), Anthropic Claude, Google Gemini, Ollama
- π― Smart Fallback: Automatically falls back to gpt-4o-mini if GPT-5-nano is not available
- π Conventional Commits: Follows the Conventional Commits specification
- π¨ GitMoji Support: Optional emoji prefixes for visual commit history
- π Multi-language: Generate commits in any language
- π‘ Context-Aware: Add custom context to improve commit messages
- β‘ Fast & Efficient: Intelligent diff splitting for large changes
- π¨ Beautiful CLI: Colorful output with progress indicators
- π§ Highly Configurable: Customize everything to match your workflow
- π Commit History: View and manage your commit message history
- β Favorites: Save frequently used commit message patterns
- πΏ Branch-Aware: Automatically includes branch context in commit messages
- π¦ Batch Commits: Split large changes into multiple logical commits with AI-powered grouping
π New Features (Compared to OpenCommit)
This fork introduces several enhancements and new capabilities:
- π GPT-5-nano Support: Native support for OpenAI's GPT-5-nano model with optimized API handling
- π Intelligent Auto-Fallback: Automatically falls back to
gpt-4o-miniif GPT-5-nano is unavailable - π§ͺ Config Test Command: Test your AI provider configuration with
acp config test - π¨ Enhanced CLI Experience: Improved progress indicators, better error messages, and more intuitive feedback
- π Custom API URL Support: Configure custom API endpoints for enterprise or proxy setups
- π Better Error Handling: More descriptive error messages with troubleshooting tips
- βοΈ Enhanced Config Management: Improved configuration commands with
describeandtestsubcommands - π― Optimized GPT-5-nano Integration: Special handling for GPT-5-nano's unique API format and response structure
- π° Cost Estimation: Real-time cost estimation before generating commit messages to help you track API usage
- π Commit History & Favorites: Track your commit history and save frequently used commit message patterns
- πΏ Branch-Aware Commits: Automatically includes branch context (feature/, fix/, hotfix/, etc.) in commit messages
- π¦ Batch Commit Generation: Split large diffs into multiple logical commits with AI-powered file grouping
π¦ Installation
npm install -g alcapushπ Quick Start
- Configure your API key:
acp config set ACP_API_KEY=sk-your-openai-api-keyMake some changes to your code
Generate and commit:
acpThat's it! Alcapush will:
- Analyze your changes
- Generate a meaningful commit message
- Ask for confirmation
- Commit your changes
π― Usage
Basic Usage
# Generate commit for staged changes
acp
# Auto-commit without confirmation
acp --yes
# Add additional context
acp -c "Fixing bug reported in issue #123"
# Use full GitMoji specification
acp --fgmConfiguration
# Set configuration
acp config set KEY=VALUE
# Get configuration value
acp config get KEY
# List all configuration
acp config list
# Describe configuration options
acp config describe
acp config describe ACP_MODEL
# Test your configuration
acp config testGit Hooks
# Install git hooks (prepare-commit-msg and commit-msg)
acp hook install
# Check hook status
acp hook status
# Uninstall git hooks
acp hook uninstallInstalled Hooks:
- prepare-commit-msg: Automatically generates commit messages when you run
git commitwithout a message - commit-msg: Validates commit messages against Conventional Commits specification
After installing hooks, you can simply run git commit and Alcapush will automatically generate and validate your commit messages!
Commit History & Favorites
# View commit history (last 50 commits)
acp history
# View commit history with custom limit
acp history 20
# Clear commit history
acp history clear
# Add a commit message to favorites
acp favorite add "feat: add user authentication"
# Remove a commit message from favorites
acp favorite remove "feat: add user authentication"
# List all favorites (sorted by usage)
acp favorite listFeatures:
- π Automatic History: All commits are automatically saved to history with branch information
- β Favorites: Save frequently used commit message patterns for quick reference
- π Usage Tracking: Favorites are sorted by usage count to show your most-used patterns
- π Branch Context: History includes branch information for better context
Batch Commit Generation
Split large changes into multiple logical commits with AI-powered grouping:
# Split changes into 3 commits
acp batch 3
# Include unstaged changes
acp batch 3 --all
# Auto-commit without confirmation
acp batch 3 --yes
# Add context to commit messages
acp batch 3 --context "Refactoring authentication system"How it works:
- AI analyzes all your changed files
- Groups related files together based on functionality, dependencies, and feature boundaries
- Creates logical commit groups (e.g., "User authentication feature", "Update dependencies")
- Generates commit messages for each group
- Commits each group separately
Example:
$ acp batch 2
β Found 5 file(s) with changes
β Grouped into 2 commit(s)
π¦ Will create 2 commit(s):
1. User authentication feature (3 files)
Adds login and registration functionality with related utilities
Files: src/auth.ts, src/login.ts, test/auth.test.ts
2. Update dependencies (2 files)
Updates package.json with new dependency versions
Files: package.json, package-lock.json
β Generated 2 commit message(s)Features:
- π€ AI-Powered Grouping: Intelligently groups related files together
- π Logical Commits: Creates meaningful, atomic commits
- π Smart Validation: Only commits files that actually have changes
- β‘ Automatic Staging: Handles file staging/unstaging automatically
- π― Context-Aware: Uses branch context to improve grouping decisions
Branch-Aware Commit Messages
Alcapush automatically detects your current branch and includes branch context in commit message generation:
# On feature/user-auth branch
git checkout -b feature/user-auth
acp
# AI will suggest: feat(user-auth): ... based on branch name
# On fix/login-bug branch
git checkout -b fix/login-bug
acp
# AI will suggest: fix(login-bug): ... based on branch name
# On hotfix/security-patch branch
git checkout -b hotfix/security-patch
acp
# AI will suggest: fix(security-patch): ... based on branch nameSupported Branch Patterns:
feature/orfeat/β Suggestsfeattypefix/orbugfix/β Suggestsfixtypehotfix/β Suggestsfixtypechore/β Suggestschoretypedocs/β Suggestsdocstyperefactor/β Suggestsrefactortypetest/β Suggeststesttypeperf/β Suggestsperftyperelease/β Suggestschoretype
Scope Extraction:
- Automatically extracts scope from branch names (e.g.,
feature/user-authβ scope:user-auth) - Cleans up ticket numbers and other patterns (e.g.,
feature/JIRA-123-authβ scope:auth) - Works with multi-level branch names (e.g.,
feature/api/user-authβ scope:api/user-auth)
βοΈ Configuration Options
| Option | Description | Default |
|--------|-------------|---------|
| ACP_API_KEY | API key for the AI provider | - |
| ACP_AI_PROVIDER | AI provider (openai, anthropic, gemini, ollama) | openai |
| ACP_MODEL | Model name | gpt-5-nano (fallback: gpt-4o-mini) |
| ACP_TOKENS_MAX_INPUT | Max input tokens | 4096 |
| ACP_TOKENS_MAX_OUTPUT | Max output tokens | 500 |
| ACP_EMOJI | Enable GitMoji emojis | false |
| ACP_LANGUAGE | Language for commit messages | en |
| ACP_DESCRIPTION | Add detailed description | false |
| ACP_ONE_LINE_COMMIT | Generate one-line commits | false |
| ACP_API_URL | Custom API URL | - |
π€ AI Provider Setup
OpenAI (Default)
acp config set ACP_AI_PROVIDER=openai
acp config set ACP_API_KEY=sk-...
acp config set ACP_MODEL=gpt-5-nano # or gpt-4o, gpt-4o-miniAnthropic Claude
acp config set ACP_AI_PROVIDER=anthropic
acp config set ACP_API_KEY=sk-ant-...
acp config set ACP_MODEL=claude-3-5-sonnet-20241022Google Gemini
acp config set ACP_AI_PROVIDER=gemini
acp config set ACP_API_KEY=your-gemini-key
acp config set ACP_MODEL=gemini-proOllama (Local)
# Start Ollama first
ollama run mistral
# Configure Alcapush
acp config set ACP_AI_PROVIDER=ollama
acp config set ACP_MODEL=mistralπ¨ Examples
Enable GitMoji
acp config set ACP_EMOJI=true
acp
# Output: β¨ feat: add user authenticationAdd Detailed Descriptions
acp config set ACP_DESCRIPTION=true
acp
# Output:
# feat: add user authentication
#
# Implemented JWT-based authentication system with login and
# registration endpoints. Added middleware for protected routes.Multi-language Support
acp config set ACP_LANGUAGE=es
acp
# Output: feat: agregar autenticaciΓ³n de usuarioOne-line Commits
acp config set ACP_ONE_LINE_COMMIT=true
acp
# Output: feat: add user authenticationCommit History Example
# View your commit history
$ acp history
π Commit History (last 10 commits):
1. feat(auth): add user authentication [feature/user-auth] β
12/15/2024, 2:30:45 PM
2. fix(login): resolve session timeout bug [fix/login-bug]
12/15/2024, 1:15:20 PM
3. docs: update API documentation [main]
12/14/2024, 4:22:10 PMFavorites Example
# Add frequently used patterns
$ acp favorite add "feat: add new feature"
β
Added to favorites: feat: add new feature
$ acp favorite add "fix: resolve bug"
β
Added to favorites: fix: resolve bug
# List favorites
$ acp favorite list
β Favorites (2):
1. feat: add new feature (used 5x)
Added: 12/10/2024
2. fix: resolve bug (used 3x)
Added: 12/08/2024Branch-Aware Example
# Create a feature branch
$ git checkout -b feature/payment-integration
# Make changes and commit
$ acp
# AI will automatically:
# - Detect branch type: feature
# - Extract scope: payment-integration
# - Suggest commit type: feat
# - Include branch context in prompt
# Generated message might be:
# feat(payment-integration): add Stripe payment integrationπ° Cost Estimation
Alcapush provides real-time cost estimation before generating commit messages, helping you understand the API usage and costs upfront.
How It Works
Before generating a commit message, Alcapush displays:
- Input tokens: Estimated tokens in your diff and prompts
- Output tokens: Estimated tokens for the generated message
- Estimated cost: Calculated cost in USD based on your selected model
Example Output
$ acp
π Usage Estimate:
Input tokens: 1,234
Output tokens (estimated): 500
Estimated cost: $0.000062
Proceed with generating commit message? βΊ (Y/n)Supported Models & Pricing
Alcapush includes up-to-date pricing for popular models:
| Model | Input (per 1M tokens) | Output (per 1M tokens) | |-------|---------------------|----------------------| | GPT-5-nano | $0.05 | $0.40 | | GPT-4o-mini | $0.15 | $0.60 | | GPT-4o | $2.50 | $10.00 | | Claude 3.5 Sonnet | $3.00 | $15.00 | | Gemini Pro | $0.50 | $1.50 | | Ollama (local) | Free | Free |
Pricing is automatically calculated based on current API rates (verified November 2024)
Cost Optimization Tips
- Use
gpt-5-nanoorgpt-4o-minifor the lowest costs - Use Ollama for free local processing
- Adjust
ACP_TOKENS_MAX_OUTPUTto limit output token usage - Use
ACP_TOKENS_MAX_INPUTto control input size for large diffs
πΈ Screenshots
Cost Estimation Display
Real-time cost estimation before generating commit messages
GPT-5-nano Support
Native GPT-5-nano integration with optimized API handling
Config Test Command
Test your AI provider configuration with acp config test
Enhanced CLI with Progress Indicators
Beautiful CLI with colorful progress indicators and better feedback
Auto-Fallback Mechanism
Automatic fallback to gpt-4o-mini when GPT-5-nano is unavailable
Enhanced Error Messages
Descriptive error messages with troubleshooting tips
Config Management
Enhanced configuration commands with describe and test subcommands
π Comparison with OpenCommit
| Feature | Alcapush | OpenCommit | |---------|-------------|------------| | GPT-5-nano Support | β | β | | Auto-fallback Mechanism | β | β | | Cost Estimation | β | β | | Config Test Command | β | β | | Custom API URL Support | β | β | | Enhanced Error Messages | β | β | | Colorful CLI | β | β | | Progress Indicators | β | β | | Multiple AI Providers | β | β | | GitMoji Support | β | β | | Config Management | β | β | | Context Flag | β | β | | Commit History | β | β | | Favorites | β | β | | Branch-Aware Commits | β | β | | Batch Commit Generation | β | β |
π οΈ Development
# Clone the repository
git clone https://github.com/dablon/alcapush.git
cd alcapush
# Install dependencies
npm install
# Build
npm run build
# Link locally
npm link
# Test
acpπ License
MIT Β© Nicolas Alcaraz
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
π Acknowledgments
Alcapush is a fork of opencommit by di-sukharev.
This project extends opencommit with additional features and improvements while maintaining compatibility with the original tool's core functionality. We're grateful to the opencommit team for creating such a great foundation.
π§ Support
If you have any questions or issues, please open an issue on GitHub.
