Metadata-Version: 2.4
Name: gcommit
Version: 0.1.0
Summary: A small Git wrapper that reviews staged changes with local Ollama and prepares commit messages.
Author: gcommit contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/ckdarby/gcommit
Project-URL: Issues, https://github.com/ckdarby/gcommit/issues
Project-URL: Source, https://github.com/ckdarby/gcommit
Project-URL: Changelog, https://github.com/ckdarby/gcommit/blob/main/CHANGELOG.md
Keywords: git,commit,ollama,cli
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# gcommit

`gcommit` is a small Git wrapper that reviews staged changes with a local Ollama model and prepares a commit message.

Only `commit` and `doctor` are custom. Other commands are delegated directly to `git`.

## Install

Install Ollama first: https://ollama.com/download

```sh
ollama pull qwen2.5-coder:1.5b
pipx install gcommit
gcommit doctor
```

Until the PyPI release is live, install from GitHub:

```sh
pipx install git+https://github.com/ckdarby/gcommit.git@v0.1.0
```

Requires Python 3.10+, Git, Ollama, and `pipx`.

## Privacy

gcommit sends staged diff excerpts to the configured Ollama endpoint. The default endpoint is local:

```sh
GCOMMIT_OLLAMA_URL=http://127.0.0.1:11434
```

If you set `GCOMMIT_OLLAMA_URL` to a remote server, staged code may be sent to that server.

## Use

```sh
git add <files>
gcommit commit
```

```sh
gcommit commit --print
gcommit commit --yes
gcommit commit --edit
gcommit commit --model small
gcommit commit --model large
gcommit commit --fast
gcommit commit --review
```

Optional short alias:

```sh
alias g=gcommit
g commit
```

`--print` shows the generated subject without committing. `--yes` commits without prompting. `--edit` opens the generated subject in Git's editor.

By default, `gcommit commit` runs in `auto` mode: it uses an instant deterministic subject for obvious changes, then falls back to one structured model call. `--review` uses the slower chunked review path for deeper feedback. `--fast` skips the deterministic path and uses one model call.

Model output is rejected if it does not cover every staged file.

Manual message flows are left to Git. If you pass flags like `-m`, `--message`, `-F`, `--amend`, `--fixup`, or `--squash`, `gcommit` delegates to `git commit`.

Common safe commit flags are passed through, including `--author`, `--date`, `--cleanup`, `--trailer`, `--signoff`, `--no-verify`, `--gpg-sign`, `--no-gpg-sign`, `--status`, `--no-status`, `--verbose`, `--quiet`, and `--allow-empty`.

## Config

Pick a model preset:

```sh
gcommit commit --model tiny
gcommit commit --model small
gcommit commit --model medium
gcommit commit --model large
gcommit commit --model xlarge
gcommit commit --model huge
```

Or pass any Ollama model tag:

```sh
gcommit commit --model qwen2.5-coder:14b
GCOMMIT_MODEL=qwen2.5-coder:7b gcommit commit
```

- `GCOMMIT_MODEL`: Ollama model name.
- `GCOMMIT_MODE`: `auto`, `fast`, or `review`.
- `GCOMMIT_OLLAMA_URL`: Ollama base URL.
- `GCOMMIT_OLLAMA_TIMEOUT`: request timeout in seconds.
- `GCOMMIT_FAST_CHARS`: maximum staged patch characters for fast mode.
- `GCOMMIT_REVIEW_CHARS`: maximum characters per review chunk.
- `GCOMMIT_REVIEW_MAX_CHUNKS`: maximum review chunks before combining overflow.

Defaults:

```sh
GCOMMIT_MODEL=qwen2.5-coder:1.5b
GCOMMIT_MODE=auto
GCOMMIT_OLLAMA_URL=http://127.0.0.1:11434
```

## Troubleshooting

Run:

```sh
gcommit doctor
```

Common fixes:

```sh
ollama pull qwen2.5-coder:1.5b
pipx ensurepath
pipx upgrade gcommit
```

## Project

- Support: [SUPPORT.md](SUPPORT.md)
- Security: [SECURITY.md](SECURITY.md)
- Contributing: [CONTRIBUTING.md](CONTRIBUTING.md)
- Changelog: [CHANGELOG.md](CHANGELOG.md)

## Develop

```sh
python3 -m pip install --require-hashes -r requirements-build.txt
python3 -m pip install --no-build-isolation --no-deps -e .
python3 -m compileall g gcommit tests
python3 -m unittest discover
```

Build a release package:

```sh
python3 -m pip install --require-hashes -r requirements-build.txt
python3 -m build --no-isolation
```
