6 stable releases

1.0.5 Oct 8, 2024
1.0.4 Oct 5, 2024
1.0.1 Sep 21, 2024
1.0.0 Sep 20, 2024

#73 in Machine learning

MIT license

17KB
230 lines

Commitaura

An Intelligent Git Commit Assistant with README Integration

Commitaura enhances your Git workflow by generating concise, meaningful commit messages and suggesting updates to your README based on staged changes. Leveraging OpenAI's GPT models, it provides context-aware suggestions that save time and improve documentation quality.

Table of Contents

Features

  • Automated Commit Messages: Generates detailed commit messages based on your staged changes.
  • README Updates: Suggests modifications to your README.md to reflect recent changes.
  • Interactive CLI: Offers an intuitive command-line interface with prompts and selections.
  • Flexible Operations: Choose to commit changes, update the README, or both simultaneously.

Installation

Prerequisites

  • Rust and Cargo: Ensure you have Rust and Cargo installed. Install them via rustup.rs.
  • OpenAI API Key: You'll need a valid OpenAI API key to use Commitaura.

Install Commitaura directly using Cargo:

cargo install commitaura

Note: If Commitaura is not yet published on crates.io, you can install it from the Git repository:

cargo install --git https://github.com/alexfigueroa-solutions/commitaura.git

This command compiles the project and installs the commitaura binary to Cargo's bin directory, which is typically included in your system's PATH (~/.cargo/bin).

Building from Source

If you prefer to build Commitaura from the source code:

  1. Clone the Repository

    git clone https://github.com/alexfigueroa-solutions/commitaura.git
    
  2. Navigate to the Project Directory

    cd commitaura
    
  3. Build and Install the Project

    Use Cargo to build and install the project:

    cargo install --path .
    

    This command compiles the project and installs the commitaura binary to Cargo's bin directory.

Setting Up the OpenAI API Key

Commitaura requires an OpenAI API key to function. You can set it up using one of the following methods:

  • Environment Variable

    Add the API key to your shell profile (e.g., ~/.bashrc, ~/.zshrc):

    export OPENAI_API_KEY=your-api-key-here
    
  • .env File

    In your home directory or project root, create a .env file:

    echo "OPENAI_API_KEY=your-api-key-here" > ~/.commitaura.env
    

    Commitaura will automatically load the API key from this file.

Usage

Commitaura provides several commands to streamline your Git operations.

Commands

  • commit: Automatically generate a commit message and commit staged changes.
  • update-readme: Generate suggestions to update your README.md based on staged changes.
  • commit-and-update: Perform a commit and update the README in one step.

Examples

Commit Changes with an Auto-Generated Message

commitaura commit
  • Analyzes staged changes.
  • Generates a commit message using OpenAI's GPT model.
  • Prompts for confirmation before committing.

Update README Based on Changes

commitaura update-readme
  • Analyzes staged changes and the current README.md.
  • Suggests updates to the README.
  • Allows selection of specific updates to apply.

Commit and Update README Together

commitaura commit-and-update
  • Combines the functionalities of commit and update-readme.

Configuration

Commitaura relies on an OpenAI API key for generating messages.

  • Environment Variable

    Add the API key to your shell profile:

    export OPENAI_API_KEY=your-api-key-here
    
  • .env File

    Create a .env file in your home directory or project root:

    echo "OPENAI_API_KEY=your-api-key-here" > ~/.commitaura.env
    

    Commitaura will automatically load the API key from this file.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.

Contact

Developed by Alex Figueroa.

Dependencies

~21–35MB
~324K SLoC