Skip to content

vieiraeduardos/commit-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLI for Commit AI

Overview

The commit-ai is a command-line interface tool designed for generating semantic commit using AI. It leverages the power of Google's Gemini AI model to analyze and suggest commit messages based on code differences pulled from Git repositories.

Features

  • Commit: Analyze and suggest commit messages with AI.
  • Add API Key: Configure your Gemini API key for authentication.
  • Easy Setup: Simple commands to manage your API key and perform code reviews.

Installation

  1. Clone the Repository

    git clone https://github.com/vieiraeduardos/commit-ai.git
    cd commit-ai
    
  2. Install Dependencies Ensure you have Node.js installed. Then, install the required packages:

    npm install
    
  3. Build Compile TypeScript code to JavaScript:

    npm run build
    

Usage

Adding Your API Key

To use the Gemini AI model, you need to set up your API key. Follow these steps to add your API key:

  1. Obtain a Gemini API Key

    • Go to the Google Cloud Console.
    • Navigate to the APIs & Services section.
    • Select Credentials from the menu.
    • Click on Create Credentials and choose API Key.
    • Copy the generated API key.
  2. Add the API Key to Your Project

    Use the add-key command to save the API key:

    npm run start add-key "your-gemini-api-key"
    

This command saves the API key in a .env file. Make sure to replace "your-gemini-api-key" with your actual API key.

Generating semantic commit

To generate semantic commit using the AI model, use the commit command:

npm run start commit

This command retrieves the code diff from the current Git repository and sends it to the Gemini AI model for analysis. Ensure that your API key is set before running this command.

Commands

  • add-key <apiKey>: Add your Gemini API key. Replace with your actual API key.
  • commit: Generate semantic commit based code diff in the current Git repository.

Configuration

The .env file is used to store the API key. The file will be automatically created or updated when you run the add-key command. Ensure this file is included in your .gitignore to keep your API key secure.

Troubleshooting

  • Error: API key is not set: Ensure that you have added the API key using the add-key command and that the .env file is in the project root.
  • Command not found: Ensure you have built the project using npm run build and that you're running the command from the correct directory.

Contributing

Contributions are welcome! Please submit a pull request or open an issue if you find bugs or have feature requests.

License

This project is licensed under the MIT License.

Support

If you find this project useful and would like to support its development, consider making a donation via Pix. Your support helps cover development costs and keep the project active.

Pix: 98992073959

Thank you for your support! 👍

About

CLI for Commit AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published