Skip to main content

Local AI layer for git: orchestrates policies & plugins between commit and push.

Project description

giton

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • 🤖 LLM usage: $0.5059 (7 commits)
  • 👤 Human dev: ~$300 (3.0h @ $100/h, 30min dedup)

Generated on 2026-05-27 using openrouter/qwen/qwen3-coder-next


giton is a local AI layer for Git that works between commit and push. It helps standardize commits, propose safe code fixes, and orchestrate external tools via plugins.

Does something like this already exist?

Partially: there are tools for AI commit messages, git hooks, and commit-history rewriting. What is still missing is one local operator that:

  • interacts with the user right after commit,
  • proposes code fixes as additional commits (fixup!),
  • cleans up history before push,
  • integrates plugins via MCP/REST/CLI/gRPC.

Proposed direction for giton

  1. Local-first with safe defaults

    • AI proposes changes, user approves them.
    • Prefer fixup! commits over automatic history rewriting.
  2. Git hook layer

    • pre-commit: policy validation and quick fixes.
    • post-commit: inspect the fresh commit and propose follow-up patches.
    • pre-push: standardize history (autosquash, commit naming, final checks).
  3. Plugin architecture

    • Shared input/output contract (JSON schema).
    • Plugin adapters: MCP, REST, CLI shell, gRPC/protobuf.

MVP usage example

After giton init, hooks are installed and run automatically from Git lifecycle events. The commands below show equivalent manual execution for demonstration/debugging.

# 1) initialize hooks in the repository
giton init

# 2) user makes a normal commit
git add -p
git commit -m "update stuff"

# 3) equivalent manual run: post-commit hook logic
giton hook post-commit

# 4) equivalent manual run: pre-push hook logic
giton hook pre-push

Example interaction:

giton: Found 2 issues (example: null check, commit message policy).
giton: Apply patch and add commit "fixup! ..."? [Y/n]

MVP plan

  • MVP 1: hooks + policy engine + interactive CLI
  • MVP 2: patching + fixup workflow + pre-push autosquash
  • MVP 3: stable plugin API and MCP/REST/CLI/gRPC integrations

Install

pip install giton

Quick start

giton init                # install git hooks + 3 default plugins
giton shell               # interactive REPL
giton plugin catalog      # browse all available plugins
giton plugin install domd # install a specific extension
giton plugin install-category lang:python   # install everything for a language

Default plugins

The 3 plugins activated by giton init cover the most common day-to-day needs in a commit → push loop:

name category trigger role
pyqual lang:python pre-commit Python lint / type / complexity checks
vallm task:validate post-commit Validate AI-generated code/patches
pretest task:test pre-push Run / generate tests before push

Quick-extend categories

Each plugin in the catalog is tagged with a category, so you can install groups at once:

  • languages: lang:python, lang:markdown, lang:any
  • tasks: task:validate, task:test, task:refactor, task:autofix, task:fix, task:docs, task:security
  • integrations: integration:mcp
giton plugin install-category task:autofix

Interactive shell

$ giton shell
giton> help
giton> install-defaults
giton> hook pre-commit
giton> catalog
giton> install prefact

Built-in policies

giton ships with a small zero-dependency policy engine that runs on every hook trigger — even before any plugin is installed:

  • conventional_commits — subject must match type(scope)?: subject and stay within max_subject_length.
  • no_wip_commits — blocks subjects matching wip, tmp, xxx, fixme.
  • no_secrets — scans staged additions for AWS keys, private-key headers and api_key=/secret= patterns.
  • max_file_size — rejects staged files larger than kb (default 512 KB).

Inspect or customize them per repo:

giton policy list                    # show active policies
giton policy check -t pre-commit     # evaluate without running plugins
giton policy init                    # write .giton/config.yaml

.giton/config.yaml is a deep-merge over the defaults — disable a single check or tweak max_subject_length without restating everything:

policies:
  no_wip_commits:
    enabled: false
  conventional_commits:
    max_subject_length: 100
hooks:
  post-commit:
    fail_on_policy: true   # turn advisory checks into blocking

Plugin contract

A plugin is any executable command (CLI). The catalog entry declares its trigger, category, install target (PyPI/local path) and command template. The runner expands {paths}, {diff_file} and {root} placeholders with the current git context before invocation.

Future exec types (mcp, rest) will share the same JSON in/out contract: input = git context + policy findings, output = list of proposed actions (patches, fixup commits, warnings).

Examples

The examples/ directory contains working demonstrations of giton:

  • examples/basic - Basic usage example showing how to use giton as a Python library to collect git context, run triggers, and handle policy findings and plugin results. Can be run directly or with pytest.

  • examples/advanced - Advanced usage example demonstrating plugin management (add, remove, list), custom policy configuration, hook installation/uninstallation, and running multiple triggers in sequence.

  • examples/testing - Testing example with pytest integration and Docker support. Shows how to integrate giton into CI/CD pipelines with containerized testing environments. Includes Dockerfile and docker-compose.yml for easy setup.

Running examples with Docker

All examples include Dockerfiles for containerized execution:

# Basic example
docker build -f examples/basic/Dockerfile -t giton-example-basic .
docker run --rm -v $(pwd)/examples/basic/logs:/app/logs giton-example-basic

# Advanced example
docker build -f examples/advanced/Dockerfile -t giton-example-advanced .
docker run --rm -v $(pwd)/examples/advanced/logs:/app/logs giton-example-advanced

# Testing example
docker build -f examples/testing/Dockerfile -t giton-test .
docker run --rm -v $(pwd)/examples/testing/logs:/app/logs giton-test

See each example's README.md for detailed usage instructions.

License

Licensed under Apache-2.0.

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

giton-0.1.4.tar.gz (270.6 kB view details)

Uploaded Source

Built Distribution

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

giton-0.1.4-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file giton-0.1.4.tar.gz.

File metadata

  • Download URL: giton-0.1.4.tar.gz
  • Upload date:
  • Size: 270.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for giton-0.1.4.tar.gz
Algorithm Hash digest
SHA256 27ab71ee18fbdf5df699ea50094a65c366247f361e376e1994615cbc36be32e4
MD5 e557c7faf7edc0ba0af3c410e702f9d9
BLAKE2b-256 6dc77ecef75da3407890d0513a62e49b8b4c1078b25f3c877a2b27240388eb44

See more details on using hashes here.

File details

Details for the file giton-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: giton-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for giton-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2f3460e076fb928d692fc28c44a11661dd31e47d70bac771950de0ddb7764944
MD5 de679154d3e23ae0c24d2e6a518ead66
BLAKE2b-256 3c353a93f08106f44ddc34adb083d414ca59709d681cbc53180570782d4fb2e7

See more details on using hashes here.

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