Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bodhi-commit-genius-js

BODHEESH69MIT1.0.0TypeScript support: included

πŸš€ Smart commit message generator with AI - supports local LLMs and cloud APIs

bodhi, commit-genius, git, commit, ai, artificial-intelligence, machine-learning, conventional-commits, ollama, openai, gpt, cli, automation, developer-tools, productivity, git-automation, commit-message, semantic-commits, version-control, git-workflow, code-quality, code-review, best-practices, local-llm, cloud-ai, offline-mode, smart-commits, git-tools, git-hooks, commit-convention, commit-lint, commit-format, commit-standards, git-commit, git-message, git-history, repository, source-control, development-workflow, team-collaboration, code-management, typescript, javascript, nodejs, npm-package, dev-tools, coding-assistant, ai-powered, bodhi-tools, ai-assistant, code-automation, development-tools, software-development, programming, coding, developer-experience, dx, devops, continuous-integration, ci-cd, agile, scrum, git-flow, github, gitlab, bitbucket, version-management, code-versioning, repository-management, commit-history, git-log, git-commands, git-cli, command-line, terminal, shell, bash, powershell, zsh, development-environment, ide-integration, vscode, visual-studio-code, intellij, webstorm, code-editor, development-workflow, team-productivity, collaboration-tools, code-collaboration, team-development, project-management, software-engineering, engineering-tools, code-organization, repository-structure, monorepo, multi-repo, git-repository, branch-management, merge-requests, pull-requests, code-changes, change-tracking, code-history, commit-tracking, semantic-versioning, semver, changelog, release-notes, documentation, code-documentation, api-documentation, technical-documentation, code-standards, coding-guidelines, style-guide, code-consistency, team-standards, development-standards, code-maintainability, code-readability, clean-code, refactoring, code-improvement, performance-optimization, code-optimization, debugging, testing, unit-testing, integration-testing, test-automation, quality-assurance, qa, code-review-tools, peer-review, team-review, code-analysis, static-analysis, dynamic-analysis, code-metrics, code-coverage, security, code-security, secure-development, devsecops, open-source, oss, free-software, community, developer-community, programming-tools, software-tools, development-kit, sdk, api, rest-api, graphql, web-development, frontend, backend, full-stack, cross-platform, multi-platform, windows, linux, macos, unix, cloud, cloud-computing, saas, paas, iaas, microservices, serverless, containers, docker, kubernetes, scalability, reliability, maintainability, extensibility, modularity, reusability

readme

πŸš€ Bodhi Commit Genius JS

A powerful npm package that generates smart, AI-powered commit messages for your Git repositories. Works offline with smart heuristics, with cloud AI (OpenAI), or with local AI models (Ollama). Perfect for developers, teams, and organizations looking to maintain clean, consistent, and meaningful Git history.

πŸ“¦ Installation

# Install globally
npm install -g bodhi-commit-genius-js

# Or install in your project
npm install --save-dev bodhi-commit-genius-js

πŸš€ Usage Examples

Basic Usage

# Generate message for staged changes
bodhi commit

# Stage and commit all changes
bodhi commit .

# Stage specific files
bodhi commit src/feature.ts tests/feature.test.ts

# Use specific provider
bodhi commit --provider openai
bodhi commit --provider ollama
bodhi commit --provider simple

🎯 Why Choose Bodhi Commit Genius?

  • πŸ€– AI-Powered Intelligence: Uses advanced AI to understand your code changes
  • πŸ”„ Works Offline: Smart heuristics work without internet or AI
  • πŸ›‘οΈ Fallback Protection: Automatically switches to offline mode if AI is unavailable
  • πŸ“Š Smart Analysis: Understands code patterns, file types, and change context
  • 🌐 Multiple AI Options: Choose between cloud AI (OpenAI) or local AI (Ollama)
  • πŸ’° Cost-Effective: Free offline mode, optional AI integration
  • πŸ”’ Privacy-Focused: Local AI option for sensitive code
  • πŸš€ Developer-Friendly: Easy setup, works with existing Git workflow

✨ Features

  • πŸ€– Smart commit message generation using multiple providers:
    • πŸ“ Simple mode: No dependencies, works offline using smart heuristics
    • 🌐 OpenAI mode: Uses OpenAI's GPT models (requires API key)
    • πŸ’» Ollama mode: Uses local LLMs (requires Ollama installation)
  • πŸ“Š Intelligent diff analysis for better context understanding
  • 🎯 Conventional commits support with type inference
  • ⚑ Git hooks integration for seamless workflow
  • πŸ”§ Customizable commit message templates
  • πŸ’» Interactive mode for message editing
  • πŸš€ TypeScript support out of the box

Advanced Examples

# Custom commit template
bodhi commit --template "type(scope): message"

# Interactive mode
bodhi commit -i

# With OpenAI key
bodhi commit --provider openai --api-key your-key

# With specific Ollama model
bodhi commit --provider ollama --model codellama

Example Commit Messages

  1. Feature Addition

    feat(auth): add OAuth2 authentication with Google provider
  2. Bug Fix

    fix(api): handle null response in user service
  3. Code Refactoring

    refactor(core): move API routes to dedicated modules
  4. Documentation

    docs(api): add OpenAPI specification and examples
  5. Testing

    test(auth): add integration tests for login flow
  6. Performance

    perf(db): optimize user query with index

Configuration

Create a .commitgenius.json in your project root or configure via CLI:

{
  "provider": "simple", // "simple", "ollama", or "openai"
  "model": "codellama", // for ollama provider
  "apiKey": "your-openai-key", // for openai provider
  "template": "{type}: {description}",
  "conventionalCommits": true
}

πŸ€– Provider Setup Guide

Commit Genius offers three modes of operation, giving you the flexibility to use it with or without AI capabilities:

1. Simple Mode (Default) - No AI Required

The simplest way to get started - works offline and requires no additional setup.

✨ Features:

  • Works completely offline
  • No API keys or external dependencies
  • Smart heuristics for commit type detection
  • Conventional commit format support
  • Analyzes file changes and code patterns

πŸš€ Setup:

# Just install and use!
npm install -g bodhi-commit-genius-js
bodhi commit

2. OpenAI Mode - Cloud AI

Get high-quality commit messages using OpenAI's GPT models. Requires an API key but offers the best quality.

✨ Features:

  • High-quality, context-aware commit messages
  • Understands complex code changes
  • Best semantic analysis of changes
  • Handles multiple files intelligently

πŸ”‘ Setup:

  1. Get your OpenAI API key:

  2. Configure Commit Genius:

    # Set API key permanently
    cmg config set apiKey your-openai-key
    cmg config set provider openai
    
    # Or use per command
    bodhi commit --provider openai --api-key your-openai-key

πŸ’‘ Note: If OpenAI is unavailable or the API key is invalid, Commit Genius will automatically fall back to simple mode.

3. Ollama Mode - Local AI

Run AI locally on your machine. Free to use and privacy-friendly, but requires local installation.

✨ Features:

  • Runs completely locally
  • No API keys needed
  • Good balance of quality and privacy
  • Multiple models supported

πŸš€ Setup:

  1. Install Ollama:

    • Windows:
      # Download and install from:
      https://ollama.ai/download/windows
    • Mac:
      brew install ollama
    • Linux:
      curl -fsSL https://ollama.ai/install.sh | sh
  2. Pull the model (one-time setup):

    ollama pull codellama
  3. Configure Commit Genius:

    # Set as default provider
    cmg config set provider ollama
    
    # Or use per command
    bodhi commit --provider ollama

πŸ’‘ Note: If Ollama is not running or encounters an error, Commit Genius will automatically fall back to simple mode.

Comparison of Modes

Feature Simple OpenAI Ollama
Setup Required None API Key Local Install
Works Offline βœ… ❌ βœ…
Message Quality Good Best Very Good
Privacy Best Cloud-Based Local Only
Cost Free Pay-per-use Free
Speed Fastest Fast Moderate
Resource Usage Minimal Cloud-Based Local GPU/CPU

πŸ”§ Integration Guide

Git Hooks Setup

  1. Automatic Setup

    {
      "scripts": {
        "prepare": "bodhi-commit-genius-js install-hooks"
      }
    }
  2. Manual Setup

    # Install husky
    npm install husky --save-dev
    
    # Add prepare script
    npm pkg set scripts.prepare="husky install"
    
    # Add commit-msg hook
    npx husky add .husky/commit-msg 'npx bodhi validate $1'

CI/CD Integration

# GitHub Actions Example
name: Validate Commits
on: [pull_request]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - run: npm install -g bodhi-commit-genius-js
      - run: cmg validate --from ${{ github.event.pull_request.base.sha }}

IDE Integration

  1. VS Code

    • Install Git Lens extension
    • Configure external diff tool
    • Use with VS Code source control
  2. JetBrains IDEs

    • Use with built-in VCS
    • Configure external diff tool
    • Terminal integration

πŸ“š Best Practices

  1. Commit Organization

    • One logical change per commit
    • Clear, descriptive messages
    • Reference issues when relevant
  2. Message Structure

    type(scope): description
    
    [optional body]
    [optional footer]
  3. Common Types

    • feat: New features
    • fix: Bug fixes
    • docs: Documentation
    • style: Formatting
    • refactor: Code restructuring
    • test: Adding tests
    • chore: Maintenance
  4. Scopes

    • Module names
    • Feature areas
    • Components
    • File types

πŸ“ License

MIT

πŸ™ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.