Skip to main content

AI-powered Git CLI using MCP + OpenAI, Gemini, or Ollama for commit workflows

Project description

agent-gitv1

AI-powered Git CLI for commit, push, explain, and pull-request workflows using MCP + LLMs.

What It Does

agent-gitv1 helps developers move faster in git workflows by generating commit messages, explaining large diffs, diagnosing push failures, and drafting PR titles/descriptions.

Supported LLM providers:

  • Google Gemini
  • OpenAI
  • Ollama (local or same network)

Quick Start

  1. Install:
pip install agent-gitv1
  1. Configure your provider:
agent config
  1. Run in any git repo:
agent commit
agent explain
agent pr
agent push

Key Features

  • AI-assisted commit messages with multiple suggestions
  • Smart staging mode that can split work into logical commit groups
  • Repository-aware commit style adaptation from recent commit history
  • agent explain for change intent, risk, and impacted files
  • agent push with live command output and LLM-driven failure diagnosis
  • Adaptive push diagnostics (light or full evidence collection)
  • Interactive PR drafting with remote detection and branch selection
  • Optional PR creation via GitHub CLI (gh pr create)
  • Ollama LAN auto-discovery (/24 subnet on port 11434)

Requirements

  • Python 3.10+
  • Git
  • uvx (install with pip install uv)
  • Provider credentials for Gemini/OpenAI, or a reachable Ollama instance
  • GitHub CLI (gh) if you want agent pr --create

Installation

pip install agent-gitv1

Verify installation:

agent --version
agent --help

Configuration

agent config

Provider notes:

  • Gemini: uses GEMINI_API_KEY env var or key entered during config
  • OpenAI: uses OPENAI_API_KEY env var or key entered during config
  • Ollama: can auto-detect URLs such as http://192.168.1.35:11434

Commands

agent commit

Generate AI commit messages and commit changes.

Examples:

agent commit
agent commit --suggestions 3
agent commit --no-smart-stage
agent commit --repo /path/to/repo
agent commit --verbose

Behavior highlights:

  • Uses MCP git diff for normal commit flow
  • Can auto-group changed files and create multiple commits
  • Adapts commit style to recent repository history

agent explain

Explain current uncommitted changes in a developer-friendly format.

Examples:

agent explain
agent explain --repo /path/to/repo

Output includes:

  • What changed
  • Why it likely changed
  • Risk areas
  • Files impacted

agent pr

Generate PR title/body from commits + diff, then optionally create PR via GitHub CLI.

Examples:

agent pr
agent pr --create
agent pr --draft --create
agent pr --target-remote upstream
agent pr --target-remote upstream --base develop --head feature/my-branch --create

Interactive flow (default):

  • Detect remotes (origin, upstream, etc.)
  • Let user choose PR target remote if multiple exist
  • Fetch and let user choose base branch
  • Compare ahead/behind status and warn if branch is behind target
  • Generate PR title and description with LLM
  • Optionally create PR with gh pr create

agent push

Push current branch (or explicit branch) with live output.

Examples:

agent push
agent push --branch main
agent push --remote origin --branch feature/my-branch

Behavior highlights:

  • Auto-detects and pushes current local branch when --branch is omitted
  • If no upstream exists, offers git push --set-upstream
  • On failure, collects live git evidence and generates LLM diagnosis with fix commands

agent config

Configure provider, model, and Ollama endpoint/model.

agent --help

List all commands and options.

Environment Variables

  • GEMINI_API_KEY
  • OPENAI_API_KEY

GitHub CLI Requirement for PR Creation

agent pr --create requires authenticated GitHub CLI.

gh auth status
gh auth login

Developer Setup (Optional)

Only if you are modifying this codebase locally:

git clone <repo-url>
cd Agent_bhai
pip install -e .

Build and Publish (PyPI)

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*

License

MIT

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

agent_gitv1-0.1.5.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

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

agent_gitv1-0.1.5-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file agent_gitv1-0.1.5.tar.gz.

File metadata

  • Download URL: agent_gitv1-0.1.5.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for agent_gitv1-0.1.5.tar.gz
Algorithm Hash digest
SHA256 902dd2e3d55189cfef3de072a5017e65527896aca2d4f1ed2126f80455394fbc
MD5 cf32c5d244e0e4c1648caf428ceeafb3
BLAKE2b-256 9b0e958f55423b573fcfd928a4ae148a75690f5c902c45fa0dc7ae9d5cec2c18

See more details on using hashes here.

File details

Details for the file agent_gitv1-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: agent_gitv1-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for agent_gitv1-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 088bdc4921398b81d3ea0ef8137eb4e3ad917dd06e9ebf8a1b2fcbfbe12dac1f
MD5 af73ced4b99affd5fc30318026fc5f09
BLAKE2b-256 e574fe05ef0c042e363086d49a7d7019b8e2c712db3c8fa944a3cb3b4737a70b

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