Skip to main content

A CLI tool that generates semantic Japanese commit message prompts for LLMs from Git diff information.

Project description

komitto (commit)

English | 日本語

A CLI tool for generating semantic commit message prompts from git diff information. The generated prompt is automatically copied to the clipboard, allowing you to paste it into an LLM to create your commit message.

Key Features

  • Analyzes staged changes (git diff --staged)
  • Converts change details into an XML format that is easily understandable by LLMs
  • LLM API Integration: Directly calls APIs from providers like OpenAI, Gemini, Anthropic, and Ollama to automatically generate commit messages
  • Contextual Understanding: Automatically includes recent commit logs in the prompt to consider project context and style
  • Combines with system prompts specifically designed for commit message generation
  • Copies the final generated prompt to the clipboard
  • Provides functionality to attach additional context about the changes via command-line arguments

Installation

pip install komitto

For development installation, use the following command:

pip install -e .

Usage

Basic Usage (Prompt Generation Mode)

  1. Make changes in a repository and stage files using git add.
  2. Run the komitto command.
  3. The generated prompt will be copied to your clipboard - simply paste it into ChatGPT or another LLM.

AI Automated Generation Mode (Recommended)

By configuring API settings in the komitto.toml configuration file, the komitto command will automatically invoke the API when executed, directly copying the generated commit message to your clipboard.

komitto
# -> 🤖 AI is currently generating a commit message...
# -> ✅ The generated message has been copied to your clipboard!

Interactive Mode

Run with the -i or --interactive flag to review and edit the generated message before committing.

komitto -i

You can choose from the following actions:

  • y: Accept (Commit): Accepts the message and automatically executes git commit.
  • e: Edit: Opens an editor to modify the message.
  • r: Regenerate: Regenerates the message.
  • n: Cancel: Exits without doing anything.

Passing Additional Context

If you have supplementary information you want to include in the prompt, such as the purpose behind your changes or any special notes, you can pass it as command-line arguments.

Example:

komitto "This change is an emergency bug fix"

Customization via Configuration File

You can generate a template configuration file (komitto.toml) for your current directory by running the following command:

komitto init

You can customize the prompt content by creating a TOML-formatted configuration file. The system will search for configuration files in the following order, and any found settings will override the default settings (with later configurations taking precedence).

  1. OS-specific user configuration directory (global settings)
    • Windows: %APPDATA%\komitto\config.toml
    • macOS: ~/Library/Application Support/komitto/config.toml
    • Linux: ~/.config/komitto/config.toml
  2. Current directory (project-specific settings)
    • ./komitto.toml

Example Configuration File Entries (komitto.toml / config.toml)

[prompt]
# Overwrite the default system prompt
system = """
You are a cheerful engineer speaking in Kansai dialect.
...
"""

[llm]
# Set the following parameters when using AI-generated content
provider = "openai" # Options: "openai", "gemini", "anthropic"

# Model specification
model = "gpt-5"

# API key (uses environment variables OPENAI_API_KEY, etc. if not specified)
# api_key = "sk-..." 

# For using Ollama/LM Studio, etc.
# base_url = "http://localhost:11434/v1"

# Number of previous commit history entries to include in the prompt (default: 5)
history_limit = 5

How It Works

  1. Executes git diff --staged to retrieve differences between staged files.
  2. Converts the diff information into a structured XML format containing details such as file paths, function/class names, and types of changes (additions, modifications, deletions).
  3. Combines the predefined system prompt, any user-specified additional context, and the XML-formatted diff information to generate the final prompt.
  4. Copies the generated prompt to the clipboard.

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

komitto-0.2.3.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

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

komitto-0.2.3-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file komitto-0.2.3.tar.gz.

File metadata

  • Download URL: komitto-0.2.3.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for komitto-0.2.3.tar.gz
Algorithm Hash digest
SHA256 14737aca158a32c938a149bc46ab758cacd59cbbd345a57aeeba18280ac63c7e
MD5 05b1c761160bd3eed12a128e748a56a2
BLAKE2b-256 1804f4223a33529ef57b2f2f2f60cc9d41be941844ac3e37deb55ecbe35dc748

See more details on using hashes here.

Provenance

The following attestation bundles were made for komitto-0.2.3.tar.gz:

Publisher: publish.yaml on MXCAKE3893/komitto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file komitto-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: komitto-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for komitto-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 501a15bea25c8da33b596191261c56b3597b5ef7ad8b7d187b42213b4ea63c54
MD5 a15fe11a34296284903044c9028edba6
BLAKE2b-256 b732a1c07c8a494032eee79a7b6577366114e0d7a6470e07248dad650ca4ab30

See more details on using hashes here.

Provenance

The following attestation bundles were made for komitto-0.2.3-py3-none-any.whl:

Publisher: publish.yaml on MXCAKE3893/komitto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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