AI-powered Git assistant with persistent context management
Project description
GitAgent - Unified AI-Powered Git Assistant
GitAgent is a unified AI-powered Git assistant that provides intelligent, context-aware Git operations with persistent session management and automatic command verification.
๐ Key Features
๐ง Unified Intelligence
- No more basic/advanced modes - All features unified in one intelligent system
- Context-aware command recommendations based on repository state
- Natural language understanding for complex Git operations
๐ Persistent Context Management
- Session persistence across multiple invocations
- Workflow resumption for interrupted operations
- Command history and verification tracking
- Sessions stored in
.git/gitagent_sessions/for full context preservation
โ Advanced Command Verification
- Automatic success verification after each command execution
- Semantic verification beyond just error codes
- Intelligent error recovery with specific issue identification
- Pre-execution prerequisite checking
๐ Multi-Step Workflow Management
- Intelligent workflow decomposition for complex operations
- Step-by-step execution with user confirmation
- Context preservation across workflow steps
- Automatic workflow completion tracking
โก Automation Ready
- Auto-approve mode (
-yflag) for scripts and CI/CD - Full verification even in automated mode
- Detailed execution logging and result tracking
๐ ๏ธ Installation
-
Clone the repository:
git clone <repository-url> cd GitAgent
-
Install dependencies:
pip install -r requirements.txt
-
Make the script executable:
chmod +x gitagent
-
Set up your Groq API key (required for AI functionality):
export GROQ_API_KEY="your-groq-api-key"
๐ Usage
Basic Usage
# Interactive mode - ask any Git question
./gitagent "What's the current status of my repository?"
# Multi-step operations
./gitagent "Stage all changes, commit with a meaningful message, and push to origin"
# Branch operations
./gitagent "Delete current branch and create a new feature branch called user-auth"
Auto-Approve Mode (for automation)
# Automatically approve all recommended commands
./gitagent -y "Stage and commit all changes"
# Perfect for scripts and CI/CD pipelines
./gitagent -y "Push all commits to origin main"
Session Management
# Resume interrupted workflows
./gitagent continue
# Or just run any command - GitAgent will detect and offer to resume active sessions
./gitagent "What should I do next?"
Help and Options
./gitagent --help
๐ฏ Example Workflows
1. Smart Repository Analysis
./gitagent "Analyze my repository and tell me what needs attention"
- Analyzes current status, uncommitted changes, unpushed commits
- Provides context-aware recommendations
- Remembers previous analysis for comparison
2. Complex Branch Operations
./gitagent "I want to delete this feature branch and create a new one for bug fixes"
- Automatically switches to safe branch before deletion
- Verifies branch deletion success
- Creates new branch with proper base
- Tracks entire workflow in session
3. Commit Workflow Automation
./gitagent -y "Stage modified files, create commit with descriptive message, and push"
- Intelligently stages appropriate files
- Generates meaningful commit messages
- Handles push with proper upstream tracking
- Verifies each step's success
4. Error Recovery
# If something goes wrong, GitAgent can help recover
./gitagent "The last command failed, what should I do?"
- Analyzes failure context from session history
- Provides specific recovery steps
- Can resume workflow after fixes
๐ง Architecture
Unified Agent Design
- Single LangGraph workflow handles all scenarios
- State management with persistent sessions
- Command verification at each step
- Intelligent routing based on context and intent
Session Persistence
- Sessions stored as JSON in
.git/gitagent_sessions/ - Full command history with verification results
- Workflow context and step tracking
- Resumable across GitAgent invocations
Verification System
- Pre-execution prerequisite checking
- Post-execution state verification
- Semantic validation of command outcomes
- Detailed error reporting with recovery suggestions
๐ Project Structure
GitAgent/
โโโ git_agent_langgraph.py # Main unified agent implementation
โโโ gitagent # Executable script
โโโ main.py # Alternative entry point
โโโ demo.py # Interactive demonstration
โโโ services/
โ โโโ git_service.py # Legacy service (deprecated)
โ โโโ groq_api_service.py # AI service integration
โโโ utils/
โ โโโ git_commands.py # Git command execution utilities
โ โโโ input_handler.py # User interaction handling
โ โโโ streaming.py # Output formatting utilities
โโโ controllers/ # Legacy controllers (deprecated)
๐ What's New in Unified Version
โ Fixed Issues
- Context persistence - No more losing context between steps
- Execution tracking - Full visibility into what worked/failed
- Session management - Resume interrupted workflows
- Command verification - Reliable success/failure detection
- Unified experience - No confusion between basic/advanced modes
๐ New Capabilities
- Intelligent workflow decomposition for complex requests
- Automatic error recovery with specific guidance
- Session-based context that survives interruptions
- Advanced verification beyond simple error checking
- Production-ready automation with auto-approve mode
๐ Demo
Run the interactive demo to see all features:
python demo.py
The demo showcases:
- Context-aware information queries
- Multi-step workflow management
- Session persistence and resumption
- Command verification in action
- Auto-approve mode for automation
๐ค Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests for any improvements.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
If you encounter any issues or have questions:
- Check the demo for usage examples
- Run
./gitagent --helpfor options - Look in
.git/gitagent_sessions/for session logs - Open an issue with session details for debugging
GitAgent Unified - Intelligent Git assistance with persistent context and reliable execution tracking.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitagent_ai-1.0.0.tar.gz.
File metadata
- Download URL: gitagent_ai-1.0.0.tar.gz
- Upload date:
- Size: 35.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e9cad27f63da41d2bfb7fd543b45829f4bde97fab77df331ed760eb0f450761
|
|
| MD5 |
ff010cf9f9717d74ebc88aa41b7f3620
|
|
| BLAKE2b-256 |
0d9b413d054bd1f663d5ea843f81b527b81399fc5e0968945edca37ae0b2c6dc
|
File details
Details for the file gitagent_ai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gitagent_ai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 35.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35d217d35fd04d9761e20b90ab3a488b1e557bb1c527427726edfa7d6fafd7db
|
|
| MD5 |
17bc4e8759bb50c1b4c9f18ccf4aad15
|
|
| BLAKE2b-256 |
d8ae268ce31e333e08761ea8e8a718fd02e3e53822598517c780ff2d8f6f01a9
|