1.0.7 • Published 6 months ago

ai-committer v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

AI Committer

AI Committer is a lightweight CLI tool designed to help developers generate professional, AI-powered git commit messages with customizable options. It supports various AI providers, models, and commit types, making it a versatile addition to your development workflow.


Features

  • Generate professional commit messages using AI.
  • Supports multiple AI providers like ollama and openai.
  • Customizable commit types (e.g., feat, fix, chore).
  • Option to generate a list of commit messages.
  • Fully configurable via CLI arguments or environment variables.

Installation

Install globally using npm or yarn:

npm install -g ai-committer

Usage

Run the tool from the command line:

ai-committer

Basic Command

ai-committer --provider openai --model gpt-4o --commitType feat

This will generate a commit message using the specified provider, model, and commit type.


Configuration

You can configure the tool using:

  1. CLI Arguments
  2. Environment Variables
  3. A combination of both

CLI Arguments

ArgumentDescriptionExample ValuesDefault
--providerThe AI provider to use.ollama, openaiollama
--modelThe AI model to use with the provider.gpt-4o, gpt-3.5-turboundefined
--commitTypeThe commit type for the generated message.feat, fix, choreundefined
--numCommitsThe number of commit messages to generate.Any integer5
--listGenerate a list of commits instead of a single one.true/falsefalse

Example:

ai-committer --provider openai --model gpt-4o --commitType feat --numCommits 3 --list

Environment Variables

You can set environment variables to configure the tool globally.

VariableDescriptionExample ValuesDefault
AI_PROVIDERThe AI provider to use.ollama, openaiollama
OPENAI_API_KEYAPI key required for the openai provider.Your OpenAI API keyundefined

Set them directly in your terminal:

export AI_PROVIDER=openai
export OPEN_AI_API_KEY=your-api-key

or Create a .env file in your working directory and set the variables:

AI_PROVIDER=openai
OPENAI_API_KEY=your-api-key

Examples

Generate a Single Commit Message

ai-committer --provider openai --model gpt-4o --commitType fix

Generate a List of Commit Messages

ai-committer --provider ollama --list --numCommits 3

Use Environment Variables

  1. Create a .env file:

    AI_PROVIDER=openai
    OPENAI_API_KEY=your-api-key
  2. Run the tool:

    ai-committer

Default Values

OptionDefault Value
AI_PROVIDERollama
MODELundefined
COMMIT_TYPEundefined
NUM_COMMITS5
IS_LISTfalse

Prerequisites

  • Node.js: Ensure Node.js is installed on your system.
  • OpenAI API Key: Required when using the openai provider.

Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue.


Enjoy effortless commit messages with AI Committer! 🚀

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago