aicheckin is a command‑line tool that helps you create clear,
incremental commit histories from uncommitted changes in your Git or
Subversion (SVN) repository. It leverages a local Ollama LLM to
analyse your changes, classify them into Conventional Commit types
(feat, fix, docs, etc.), group related changes and propose high‑quality
commit messages. You can accept, edit or decline each group
interactively or run in a non‑interactive mode for automation.
- Git and SVN support: Works with both Git and Subversion repositories. Automatically detects the VCS type and repository root.
- AI‑powered messages: Uses an Ollama LLM to generate commit messages that follow the Conventional Commits specification.
- Grouped commits: Analyses diffs to group related changes so that each commit is focused and descriptive.
- Interactive flow: Review each proposed commit, edit the message
or decline the group. A
--yesflag allows fully automated operation. - Robust ignore handling: Respects
.gitignoreand SVN ignore settings. Untracked files are excluded by default. - Clear exit codes: Distinct exit codes for success, no changes, configuration errors, VCS errors, LLM/network errors and cases where all groups are declined.
- Python 3.10 or newer.
- A working installation of Git and/or Subversion on your system.
- A running Ollama server with the desired model installed.
The easiest way to install aicheckin is using the automated installer:
python install.pyThis script will:
- Check your Python version (3.10+ required)
- Install the package and its dependencies
- Set up your system PATH automatically
- Help you configure the Ollama connection interactively
- Verify the installation
After installation, you can use the aicheckin command from anywhere.
If you prefer to install manually or need more control:
-
Create and activate a virtual environment (recommended):
python3 -m venv .venv source .venv/bin/activate # Linux/macOS .venv\Scripts\activate # Windows PowerShell
-
Install dependencies:
pip install -r requirements.txt
-
(Optional) Install the tool system‑wide using
pipxorpip:pip install .
The tool expects a file named .ollama_config.json in the
~/.ollama_server/ directory in your home directory. This file defines
how to connect to your local Ollama server.
Note: If you used python install.py, the configuration file
is created automatically during installation in ~/.ollama_server/.
This location is user-specific and easy to find.
For manual setup, the required keys are:
{
"base_url": "http://localhost",
"port": 11434,
"model": "llama3",
"request_timeout": 60,
"max_tokens": 1024
}Only base_url, port and model are required. request_timeout
and max_tokens are optional. See the sample in examples/ for a
complete example.
Run the tool from within your repository (or any subdirectory of it):
python aicheckin.pyYou can run the tool interactively to review and confirm generated
commit groups, or use --yes to accept all proposed groups
non-interactively (useful for automation).
To automatically accept all groups without prompting, use the
--yes flag:
python aicheckin.py --yesTo increase verbosity for debugging, use --verbose.
The following CLI options are supported:
Usage: aicheckin [OPTIONS]
Options:
--yes Accept all generated commit groups without prompting.
--vcs [git|svn] Force the VCS type (auto‑detected by default).
--verbose Enable verbose (debug) output.
--help Show this message and exit.
- Detection – Starting from the current directory, the tool
walks up the directory tree to find a
.gitor.svnfolder. It stops when it finds one or reaches the filesystem root. If both are present at the same level, it exits with an error. If neither is found, it exits with code 3. - Configuration – The tool looks for
.ollama_config.jsonin the~/.ollama_server/directory. If the file is missing or malformed, it prints an error and exits with code 5. - Change detection – It computes the status of your working
copy against
HEAD(Git) orBASE(SVN). Untracked/unversioned files are ignored unless you extend the tool yourself. If no changes are found, it exits with code 4. - Diff extraction – For each changed file, a unified diff is
obtained via
git difforsvn diff. - Grouping – The diffs are classified into Conventional Commit types using heuristics (file extensions and keywords) and grouped accordingly.
- LLM message generation – For each group the tool constructs a prompt summarising the changes and calls your Ollama server to generate a commit message. If the LLM is unreachable or errors, a fallback message is used.
- Interactive confirmation – In interactive mode you are
shown each group with its proposed message. You may accept the
message, edit it (either via your
$EDITORor inline) or decline the group entirely. Declined groups remain uncommitted. - Commit and push – For each accepted group, files are staged
(
git add/svn add), a commit is created and (for Git) pushed immediately to theoriginremote. - Summary and exit – A summary of committed and declined groups is printed. Distinct exit codes indicate success or the type of failure. See below.
The tool exits with one of the following codes:
| Code | Meaning |
|---|---|
| 0 | Success – commits were created or there were no changes |
| 1 | Generic error (unexpected/unhandled) |
| 2 | Invalid usage / CLI argument error |
| 3 | No repository found |
| 4 | No changes found to commit |
| 5 | Configuration error |
| 6 | VCS command failure |
| 7 | LLM / network error |
| 8 | User declined all commit groups |
The project uses a src layout with modular components. See
docs/architecture.md for details on how the VCS, diff, grouping,
LLM and CLI modules interact.
Install the test dependencies and run pytest:
pip install -r requirements.txt
pytest -qOptionally generate a coverage report:
pytest --cov=src --cov-report=term-missing- The grouping is currently file‑based. If a single file contains multiple unrelated changes (e.g. bug fix and new feature), it will be classified by the dominant type and committed together.
- The commit type classification uses simple heuristics; it may occasionally misclassify changes. You can always edit the proposed message.
- The tool relies on a running Ollama server. Network failures or misconfiguration will result in fallback messages or aborts.
Contributions are welcome! Please open an issue or a pull request on GitHub. Ensure your code is well‑tested and adheres to the existing coding style. For major changes, please discuss them in an issue first.
This project is licensed under the MIT License. See the LICENSE
file for details.
All notable changes are documented in CHANGELOG.md.