A CLI tool that generates semantic Japanese commit message prompts for LLMs from Git diff information.
Project description
komitto (commit)
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
- Interactive Mode: Review, edit, regenerate, or commit the generated message in an interactive session
- Editor Integration: Edit the commit message using your preferred editor
- Robust Error Handling: Gracefully handles various error scenarios with helpful feedback
Installation
pip install komitto
For development installation, use the following command:
pip install -e .
Language Support
komitto automatically detects your language based on your OS locale settings. Currently supported languages are:
- English (
en) - Default - Japanese (
ja)
To force a specific language, you can set the KOMITTO_LANG environment variable:
# Linux/macOS
export KOMITTO_LANG=ja
# Windows (PowerShell)
$env:KOMITTO_LANG="ja"
Usage
Basic Usage (Prompt Generation Mode)
- Make changes in a repository and stage files using
git add. - Run the
komittocommand. - The generated prompt will be copied to your clipboard - simply paste it into ChatGPT or another LLM.
komitto
# -> The generated prompt has been copied to your clipboard!
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.
Note: Interactive mode is only available when LLM API settings are configured in komitto.toml.
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"
Editor Integration
When using the interactive mode, you can edit the generated message using your preferred editor. The editor is determined in the following order:
GIT_EDITORenvironment variableVISUALenvironment variableEDITORenvironment variable- Git's configured
GIT_EDITOR - Default editor (notepad on Windows, vi on other platforms)
komitto -i
e
# -> Opens editor to modify the message
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).
- OS-specific user configuration directory (global settings)
- Windows:
%APPDATA%\komitto\config.toml - macOS:
~/Library/Application Support/komitto/config.toml - Linux:
~/.config/komitto/config.toml
- Windows:
- 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 helpful assistant that generates semantic commit messages.
Please analyze the provided diff information and create a concise and descriptive commit message following Conventional Commits format.
"""
[llm]
# Set the following parameters when using AI-generated content
provider = "openai" # Options: "openai", "gemini", "anthropic"
# Model specification
model = "gpt-5.2" # or other available models
# API key (uses environment variables OPENAI_API_KEY, GEMINI_API_KEY, ANTHROPIC_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
[git]
# Files to exclude from the diff analysis (glob patterns)
# Default excludes: package-lock.json, yarn.lock, pnpm-lock.yaml, poetry.lock, Cargo.lock, go.sum, *.lock
exclude = [
"package-lock.json",
"yarn.lock",
"*.lock"
]
Using Ollama/LM Studio
To use Ollama or LM Studio as your LLM provider, configure the base_url parameter:
[llm]
provider = "openai"
model = "qwen3"
base_url = "http://localhost:11434/v1"
# Optional: API key might not be required for local instances
# api_key = "dummy"
This allows you to use locally hosted LLM models while still using the OpenAI-compatible API interface.
How It Works
- Executes
git diff --stagedto retrieve differences between staged files. - 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).
- Combines the predefined system prompt, any user-specified additional context, and the XML-formatted diff information to generate the final prompt.
- Copies the generated prompt to the clipboard.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file komitto-0.3.0.tar.gz.
File metadata
- Download URL: komitto-0.3.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
261da3d11bd67586fd34665b0654a740eee25e7a76f4fdde1bb2491ae72695b2
|
|
| MD5 |
f8eb438abcd6a4fc48f9436112ef5323
|
|
| BLAKE2b-256 |
829798d75aa2d9fbf9121cd2aef9c6655c0991c63d0e09f2aaee3a3e4859e1ed
|
Provenance
The following attestation bundles were made for komitto-0.3.0.tar.gz:
Publisher:
publish.yaml on MXCAKE3893/komitto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
komitto-0.3.0.tar.gz -
Subject digest:
261da3d11bd67586fd34665b0654a740eee25e7a76f4fdde1bb2491ae72695b2 - Sigstore transparency entry: 773003224
- Sigstore integration time:
-
Permalink:
MXCAKE3893/komitto@94745333ba827be8997f79704bee8a64f4d42c1e -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/MXCAKE3893
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@94745333ba827be8997f79704bee8a64f4d42c1e -
Trigger Event:
release
-
Statement type:
File details
Details for the file komitto-0.3.0-py3-none-any.whl.
File metadata
- Download URL: komitto-0.3.0-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
906e6f76c1701527bf68a9bcc762701f3adb3c2c546d4769735c3ac299906618
|
|
| MD5 |
0788f40d78a4e6375e7b847ee91d4b36
|
|
| BLAKE2b-256 |
c04f0432f77966c986805e4996d29d76f5885c597fecfb31eac686325700fe05
|
Provenance
The following attestation bundles were made for komitto-0.3.0-py3-none-any.whl:
Publisher:
publish.yaml on MXCAKE3893/komitto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
komitto-0.3.0-py3-none-any.whl -
Subject digest:
906e6f76c1701527bf68a9bcc762701f3adb3c2c546d4769735c3ac299906618 - Sigstore transparency entry: 773003273
- Sigstore integration time:
-
Permalink:
MXCAKE3893/komitto@94745333ba827be8997f79704bee8a64f4d42c1e -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/MXCAKE3893
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@94745333ba827be8997f79704bee8a64f4d42c1e -
Trigger Event:
release
-
Statement type: