Skip to content

sojanvarghese/commit-x

Repository files navigation

License NPM Version NPM Downloads Node.js TypeScript Yarn AI CLI

AI-powered Git commit assistant that intelligently analyzes your code changes and generates clear, concise, and context-aware commit messages using Google's Gemini AI.

✨ Features

  • Smart Analysis - Automatically understands code changes and generates contextual commit messages
  • Intelligent Fallbacks - Summary messages for large files, lock files, and build artifacts
  • Security-First - Path validation, input sanitization, and secure API key handling
  • Fast & Reliable - Optimized performance with retry logic and error recovery

🚀 Quick Start

Prerequisites

Installation

# Install globally from npm
npm install -g @sojanvarghese/commit-x

Setup

# Interactive setup
cx setup

# Or set API key directly
export GEMINI_API_KEY="your_api_key_here"

Usage

# Process files with AI (recommended)
cx

# Traditional workflow
cx commit --all

# Preview changes
cx commit --dry-run

📖 Commands

Command Description
cx Process files with AI
cx commit --all Stage all files and commit together
cx commit --dry-run Preview commits without executing
cx commit -m "message" Use custom commit message
cx status Show repository status
cx diff Show unstaged changes summary
cx config View configuration
cx config set <key> <value> Set configuration value
cx config reset Reset configuration to defaults
cx setup Interactive setup
cx privacy Show privacy settings and data handling information
cx debug Debug repository detection
cx help-examples Show usage examples

⚙️ Configuration

# View current configuration
cx config

# Set configuration values
cx config set model gemini-2.0-flash-lite

# Reset to defaults
cx config reset

Configuration Options

Option Type Default Description
apiKey string - Gemini AI API key (use environment variable)
model string gemini-2.0-flash-lite AI model to use

Acknowledgments