PonoPush

24 Jun 2024

OVERVIEW


PonoPush is a command-line application designed to assist developers in making better Git commit messages using AI. It leverages the OpenAI API to generate detailed commit messages based on the changes made to the codebase. PonoPush ensures that commit messages are informative, well-structured, and easy to understand.

Features:

  • Automatic Commit Message Generation: Uses OpenAI API to create detailed and structured commit messages.
  • Customizable Prompts: Users can customize the prompt used for generating commit messages.
  • Integration with Default Editor: Opens the suggested commit message in the user’s default editor for review and modification.
  • Configuration Management: Allows setting API configurations such as api.token, api.url, api.model, and api.max_tokens.
  • GPG Signing: Option to sign commits with GPG, controlled by the gpg.enabled configuration.
  • User-Provided Context: Developers can provide additional context for the AI by using the -m flag.


Installation

Prerequisites

  • Rust toolchain installed (use rustup).
  • An OpenAI API token.

Steps

  1. Clone the repository:

    git clone https://github.com/yourusername/ponopush.git
    cd ponopush
    
  2. Build the project:

    cargo build --release
    
  3. Install the binary:

    sudo cp target/release/ponopush /usr/local/bin/
    
  4. Ensure the configuration directory and file exist:

    sudo mkdir -p /etc/ponopush
    sudo touch /etc/ponopush/ponopush.conf
    
  5. Populate /etc/ponopush/ponopush.conf with your desired prompt template. Example:

Usage

Setting Up Configuration

You can set the API configuration using the following commands:

ponopush config api.token YOUR_API_TOKEN
ponopush config api.url YOUR_API_URL
ponopush config api.model YOUR_API_MODEL
ponopush config api.max_tokens YOUR_API_MAX_TOKENS
ponopush config gpg.enabled true

Running PonoPush

After making changes to your code, you can run:

ponopush

The application will generate a commit message, open it in your default editor for review, and commit the changes upon saving the file.

Providing Additional Context

You can provide additional context for the AI by using the -m flag:

ponopush -m "User feedback demands that the users are allowed to provide a generic and non-professional reason on why the commit was made so that the AI can use the information to improve its response"

If the -m flag is not provided, the application will use the prompt from /etc/ponopush/ponopush.conf as usual.