Skip to main content

A terminal UI that automatically generates git commit messages using local language models via Ollama.

Project description

Comet

Comet is a terminal user interface application that automatically generates descriptive git commit messages using local language models via Ollama. It analyzes your staged git diffs and provides a clean interface to review, edit, regenerate, and commit your changes.

Features

  • Local Model Generation: Connects to your local Ollama instance to generate commit messages privately.
  • Model Swapping: Press tab to cycle through available local models directly from the interface. Comet defaults to your currently loaded model to save time.
  • Context Aware: Automatically pulls in the last 5 commits to understand the tone and style of your project.
  • Terminal User Interface: Built with Textual. It provides a dedicated text area to edit the generated message.
  • Dynamic Newlines: Use the down arrow key on the last line to seamlessly add new lines to your commit message, and the up arrow key to remove them.
  • Quick Undo: Press ctrl+z to instantly undo the last local commit if you need to make changes.
  • Direct Syncing: Commit your changes and immediately push them to your remote repository with a second press of the commit button.
  • Customizable Prompts: The instructions provided to the language model are stored in comet/system.md and can be edited to fit your specific workflow.

Requirements

  • Python 3.10 or higher
  • Git installed and accessible in your system path
  • Ollama installed and running locally

Installation

Clone the repository and install the required dependencies:

git clone <repository_url>
cd Comet
python -m venv .venv

# On Windows
.venv\Scripts\activate

# On Unix/macOS
source .venv/bin/activate

pip install -r requirements.txt

Usage

Ensure you have staged your changes using git add and that Ollama is running in the background.

Run the Comet application:

comet

Keyboard Shortcuts

  • enter: Commit the current text. If pressed again, it will push the commit to the remote repository.
  • tab: Swap the active language model.
  • ctrl+r: Regenerate the commit message with the current model.
  • ctrl+z: Undo the most recent local commit.
  • ctrl+t: Terminate the application.
  • down arrow: Add a new line when at the bottom of the text area.
  • up arrow: Remove the previous empty line.

Architecture

Comet uses the subprocess module to run git commands and capture diffs. It reads the local comet/system.md file for system instructions and sends the diff to the Ollama Python client. The interface is built using Textual, providing responsive keyboard bindings and a resilient terminal layout.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_comet-1.0.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_comet-1.0.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file cli_comet-1.0.0.tar.gz.

File metadata

  • Download URL: cli_comet-1.0.0.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for cli_comet-1.0.0.tar.gz
Algorithm Hash digest
SHA256 85cba435eb2c5d0c9c3aa12404c249c399d7ff392f64a43acfbbd8e0784535e8
MD5 802ad9dcec606102cfaac30316338fd0
BLAKE2b-256 f32135aa643fad8661443a04c2d06991282ea6baa521549c775eda330befafbc

See more details on using hashes here.

File details

Details for the file cli_comet-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cli_comet-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for cli_comet-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3276fcc35889639fe63c4923651279d21819d867c36396a7c19c28dd397db2d4
MD5 70af9da54c0c9184dcb625ad9669e616
BLAKE2b-256 97779d3b0791d60bf7ad7b0c03f192ae44896032dd58a92bd48d70a6d948580e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page