Skip to main content

Add your description here

Project description

GitGuard: The AI-Assisted Safety Copilot

Version control systems are unforgiving. GitGuard bridges the gap between powerful functionality and developer safety.

GitGuard is an AI-powered CLI tool designed to interpret your intent, evaluate risk, and guarantee a safe rollback mechanism before any Git command is executed. It acts as a dedicated safety and reasoning layer for your version control workflow.

GitGuard Demo

🚀 The Problem

Git is powerful but dangerous. Operations like reset, rebase, and force push can permanently delete work, creating a culture of fear among junior developers and resulting in:

  • Fear of advanced features.
  • Messy, unorganized commit histories.
  • Dependency on senior leads for simple fixes.
  • Real productivity costs due to "Git avoidance."

🛡️ Our Solution

GitGuard is an AI copilot that:

  1. Interprets Intent: You describe what you want in plain English.
  2. Evaluates Risk: Automatically flags operations as Safe, Medium, or High risk.
  3. Guarantees Recovery: Creates automatic checkpoints before every command.
  4. Enforces Safety: Requires explicit confirmation for destructive actions.

✨ Key Features

  • 🧠 NLP Interpretation: "Undo my last commit but keep changes" -> git reset --soft HEAD~1
  • 🚦 Risk Classification: Know before you go. Is this safe, or will it rewrite history?
  • 💾 Automatic Checkpoints: Every operation is backed up locally.
  • ⏪ One-Command Undo: Made a mistake? gitguard rollback takes you back instantly.
  • 🔒 Privacy First: Your code stays local. Only abstract intent strings are sent to the AI.

📦 Installation

Prerequisites

  • Python 3.9+
  • A Google Gemini API Key (Get one here)

Install via pip / uv

# Clone the repository
git clone https://github.com/yourusername/gitguard-cli.git
cd gitguard-cli

# Install dependencies (using uv is recommended)
uv sync

# Install the package in editable mode
uv pip install -e .

Configuration

Create a .env file in the project root or set the environment variable:

GEMINI_API_KEY="your_api_key_here"

💻 Usage

1. Run a Command

Describe what you want to do. GitGuard will analyze it and propose a plan.

gitguard run "delete the feature-login branch"

Output:

GitGuard interpreting intent: "delete the feature-login branch"

[Proposed Execution Plan]
• Summary: Delete the local branch named 'feature-login'
• Risk Level: HIGH
• Planned Commands:
  $ git branch -d feature-login

Proceed with this plan? [y/N]: y
✓ Safety checkpoint created: gitguard-backup-20231027_103000
Running: git branch -d feature-login
✓ Done
Success! Operation completed safely.
Undo anytime with: gitguard rollback

2. Rollback

If anything goes wrong, revert to the state before the last GitGuard operation.

gitguard rollback

🏗️ Architecture

  • CLI Interface (Typer/Rich): Handles user interaction and local execution.
  • Intent Engine (Gemini 1.5 Flash): Translates natural language into structured Git plans using Structured Outputs.
  • Safety Layer: Manages local checkpoints (custom branches) and enforces confirmation.

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.


Team Innovaide | built with ❤️ for safer engineering.

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

gitguard_cli-0.1.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

gitguard_cli-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file gitguard_cli-0.1.0.tar.gz.

File metadata

  • Download URL: gitguard_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gitguard_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 adbdb2a3fe12db9d44d3a83af14f72314a9c515ab9610d8731988c5948f6d4f7
MD5 2b8d91792f115a0a223cac2b2788f5e2
BLAKE2b-256 c5fba6799b2ea3c8f03461452f0d9a2c96accaa88182c938220dd995ee9a616d

See more details on using hashes here.

File details

Details for the file gitguard_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gitguard_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gitguard_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c036f5b8ab886208866367a2ed6ec5f59c98be16073a37083c0e68a0796cc674
MD5 fc05d01c7aedbef47e5ad0c8d53aca9f
BLAKE2b-256 cd5854d849ff445e6b40ec560bab8b2c33fd5fa67752dd79bc739aa8a8c4f3f7

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