Skip to content

Generating commit messages using Generative AI powered by Gemini

Notifications You must be signed in to change notification settings

utsmannn/commitah

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commitah CLI

Commitah is a Command Line Interface (CLI) tool that automates the process of generating Git commit messages using Generative AI powered by Gemini. This tool streamlines commit creation by analyzing git diff and providing multiple commit message suggestions based on user-defined specifications.

Features

  • AI-Powered Commit Messages: Generates contextual commit messages based on staged changes.
  • Customizable Configurations: Modify message specifications and Gemini API Key.
  • Interactive UI: CLI prompts to choose from suggested messages.
  • Error Handling: Ensures Git and required configurations are properly set up.

Installation

Prerequisites

  • Node.js v16 or later
  • Git installed and available in PATH

Install CLI App

npm install --global commitah

Usage

Basic Command

Run the tool in a Git repository with staged changes:

commitah
ScreenRecording2024-12-11at19.06.28-ezgif.com-resize-video.mov

Options

  • --config: Show the current configuration.
  • --config-update: Update the Gemini API Key or message specification.
  • --show: Preview the selected commit message without committing.

Example

commitah --show

Configuration

Configuration is stored in ~/.commitahconfig. When first run, the tool generates a default configuration. If the Gemini API Key is empty, the tool will open a browser for the user to generate the API Key and provide a prompt to paste it back into the CLI.

ScreenRecording2024-12-11at16.58.52-ezgif.com-resize-video.mp4

Generated Default Configuration

{
  "geminiApiKey": "",
  "messageSpec": "simple for each message, with Commit Conventions standard",
  "sizeOption": 3
}

Updating Configuration

Use the following command to update configuration:

commitah --config-update

Dependencies

Commitah uses the following libraries:

Development

Directory Structure

  • src/: Contains the source code.
  • dist/: Compiled JavaScript files.
  • config.js: Handles reading and writing configuration files.
  • main.js: Entry point for the CLI.

Build

To compile the TypeScript source files:

npm run build

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the ISC License.

Author

Muhammad Utsman

About

Generating commit messages using Generative AI powered by Gemini

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published