Metadata-Version: 2.4
Name: commithink
Version: 0.1.3
Summary: AI-powered Conventional Commit generator using Ollama
Author-email: Leonardo Martignoni <leonardo.martignonii@gmail.com>
Maintainer-email: Leonardo Martignoni <leonardo.martignonii@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/leomarss/commithink
Project-URL: Repository, https://github.com/leomarss/commithink
Project-URL: Issues, https://github.com/leomarss/commithink/issues
Keywords: git,commit,conventional-commits,cli,ollama,ai
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer==0.21.0
Requires-Dist: ollama==0.6.1
Requires-Dist: rich==14.2.0
Requires-Dist: tomli==2.3.0
Requires-Dist: tomli-w==1.2.0
Dynamic: license-file

# commithink

![Local AI](<https://img.shields.io/badge/AI-local%20(ollama)-success?style=flat-square&color=informational>) ![License](https://img.shields.io/pypi/l/commithink?style=flat-square&color=informational)

**commithink** is an AI-powered CLI tool that generates **clean, Conventional Commit messages** by analyzing your staged Git changes.

It uses a **local LLM via Ollama**, works fully offline, and guides you through an **interactive workflow** so you always stay in control.

> AI suggests. You decide.

## Features

- AI-generated commit messages (local, via Ollama)
- Follows **Conventional Commits**
- Interactive mode (accept, regenerate, edit, change type)
- Uses staged changes (`git diff --cached`)
- No cloud APIs, no API keys
- Project-level configuration
- Fully offline

## Requirements

- Python **>= 3.10**
- Git
- Ollama installed and running locally (ollama.com)

After installation, make sure Ollama is running and that you have at least one model available.

## Installation

### Recommended (pipx)

`pipx` installs CLI tools globally in isolated environments.

```bash
pipx install commithink
```

### Alternative (pip)

```bash
python -m pip install commithink
```

## Basic usage

Stage your changes as usual:

```bash
git add .
```

Then run:

```bash
commithink
```

`commithink` will analyze the staged diff and guide you through an interactive flow to produce the final commit message.

## Interactive controls

| Key | Action                    |
| --- | ------------------------- |
| `a` | Accept and commit         |
| `r` | Regenerate the message    |
| `e` | Edit the message manually |
| `t` | Change commit type        |
| `q` | Abort                     |

## Passing a hint

You can optionally provide a short description of your changes:

```bash
commithink "fix validation on user registration"
```

This helps the model generate a more accurate message.

## Dry run

To generate a commit message **without committing**:

```bash
commithink --dry-run
```

## Configuration

`commithink` supports **project-level configuration** via a `.commithink.toml` file in the repository root.

### Set configuration values

```bash
commithink --config model=qwen2.5-coder:3b
commithink --config language=english
```

This creates or updates the following file:

```toml
model = "qwen2.5-coder:3b"
language = "english"
```

### Configuration precedence

1. CLI options (`--model`, `--lang`)
2. `.commithink.toml`
3. Built-in defaults

## Example output

```text
fix: handle user registration errors correctly
```

## Philosophy

`commithink` is designed to:

- reduce cognitive load
- improve commit quality
- keep the developer in control

AI assists — **the final decision is always yours.**
