Skip to main content

GitSage AI: Premium AI-powered Git commit assistant with deep intelligence.

Project description

GitSage AI

AI-powered Git commit assistant — one command, production-quality commits.

GitSage analyses your staged changes and returns a perfectly structured commit message plus a full intelligence report, powered by a hosted backend that makes a single AI round-trip so you never wait for a local model to spin up.


Features

Feature Detail
Single-round-trip intelligence One API call returns the commit message, explanation, and confidence score together
Secure key storage API key lives in ~/.gitsage_auth with chmod 600 permissions — never in your repo
Smart diff cache Results are cached in ~/.gitsage_cache by SHA-256(diff) — repeated commits are instant
Sensitive file filtering .env, .key, credentials, secrets, and similar files are stripped from diffs before any network call
Rich terminal UI Confidence bar, colour-coded scope, structured explanation panels
Async by default All I/O (git, HTTP, cache) is non-blocking via asyncio + httpx
Edit mode Review and revise the AI suggestion before it's committed
Anonymous telemetry Optional, opt-out, fires on a daemon thread — never blocks the CLI
Conventional commits Default style; configurable to simple, emoji, or any custom style

Quick start

1 — Install

pip install gitsage

2 — Get an API key

Visit https://gitsage-ai.vercel.app/docs to generate a free key.

3 — Authenticate

gitsage auth --token gs_YOUR_KEY_HERE

Your key is saved to ~/.gitsage_auth with restricted file permissions (600 on Unix).

4 — Commit

git add .
gitsage commit
# or the shorthand
gitsage -c

Commands

gitsage commit

Analyses staged changes and opens an interactive prompt:

y     — accept and commit
edit  — revise the message before committing
n     — abort

gitsage auth

gitsage auth --token <KEY>   # save / replace API key
gitsage auth                 # show current key status (masked)
gitsage auth --status        # same as above, explicit
gitsage auth --logout        # remove stored key

gitsage config

gitsage config                        # show current preferences
gitsage config --style emoji          # change commit style
gitsage config --no-telemetry         # disable anonymous telemetry
gitsage config --reset                # restore all defaults

gitsage --version

Prints the installed version and exits.


Configuration

Preferences are stored in ~/.git-sage.json. The API key is kept separately in ~/.gitsage_auth and is never written to the preferences file.

Key Default Description
style conventional Commit message style
auto_commit false Skip the interactive prompt
max_length 72 Soft cap on commit message length
telemetry true Anonymous usage analytics

Architecture

cli/main.py          — Typer app, auth command, commit workflow, rich UI
│
├── config/loader.py — Preferences (~/.git-sage.json) + secure key (~/.gitsage_auth)
├── git/diff.py      — Staged diff retrieval, sensitive-file filtering, async wrappers
│
├── engine/
│   ├── core.py      — Orchestrator: cache → fast-path (API) or legacy (local)
│   ├── cache.py     — SHA-256 keyed result cache in ~/.gitsage_cache
│   ├── analyzer.py  — Diff parser → DiffSummary (files, intent, cleaned content)
│   ├── models.py    — CommitResult, DiffSummary dataclasses
│   ├── orchestrator.py — Single-prompt generator for local providers
│   ├── explainer.py — Explanation generator + confidence heuristic (local path)
│   └── formatter.py — Output formatting utilities
│
└── providers/
    ├── base.py      — AIProvider ABC (generate / generate_async)
    ├── gitsage.py   — GitSageAPIProvider — async httpx, AnalysisResult, _clean_commit_message
    ├── gemini.py    — Google Gemini (optional, pip install gitsage[gemini])
    └── local.py     — Ollama local provider (optional, pip install gitsage[local])

Request flow

gitsage commit
    │
    ├─ git diff --cached          (async subprocess)
    ├─ sensitive-file filter
    ├─ truncate to 3 000 tokens
    ├─ SHA-256 cache lookup       → hit: return immediately
    │
    └─ POST /v1/intelligence/analyze
           X-API-Key: gs_...
           { diff, context, style }
           ↓
       { commit_message, explanation, confidence, provider, model }
           ↓
       _clean_commit_message()    (strip markdown from message)
       cache.save()
       display_result()           (rich panels + confidence bar)
       prompt: y / edit / n

Development

git clone https://github.com/iamAgbaCoder/gitsage
cd gitsage
python -m venv .dev && source .dev/bin/activate   # or .dev\Scripts\activate on Windows
pip install -e ".[dev]"

Run tests

pytest tests/ -v

Lint & format

ruff check .
black .

Build

python -m build

Publishing

Event Target
Push to main TestPyPI (auto)
Push to release or tag v* PyPI (auto) + GitHub Release

Trusted Publishing (OIDC) is used — no PYPI_TOKEN secret needed. Set up the PyPI and TestPyPI environments in your GitHub repo settings.


License

Apache 2.0 — see LICENSE.

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

gitsage_cli-1.0.0.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

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

gitsage_cli-1.0.0-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file gitsage_cli-1.0.0.tar.gz.

File metadata

  • Download URL: gitsage_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gitsage_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 caf07da593417511f9e4b3024a4280b175590e6577b4d350008a38835dc34578
MD5 5b636fcaa9576f12a6a6db9962c25a6a
BLAKE2b-256 b06b9f8558db051bbe44ce06b7e867691cc626bf740076237f7a9310a8cdb09f

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitsage_cli-1.0.0.tar.gz:

Publisher: publish.yml on iamAgbaCoder/GitSage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gitsage_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gitsage_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gitsage_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86e47713b5a43444963d9620111a6b04ed3b0b1718caaf15238e4ae00f778716
MD5 13adad9e162a1fc1fea89adfea497a55
BLAKE2b-256 3a67abf4a2048a32293123a951ad724ef836f71c4a1b4887a26acb15f0649a89

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitsage_cli-1.0.0-py3-none-any.whl:

Publisher: publish.yml on iamAgbaCoder/GitSage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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