Turn issues into solutions with the power of GPT-4o
Blech Bot is a smart GitHub companion that transforms how you manage repositories. Powered by OpenAI's GPT-4o and Autogen, this intelligent bot automatically analyzes issues, suggests code changes, and even implements solutions - all while you focus on what matters most: building great software.
- 🔍 Smart Monitoring - Keeps an eye on your repositories listed in
config/repos.txt - 🏷️ Automatic Response - Springs into action when issues have the
blech_botlabel or mention - 🧠 AI-Powered Analysis - Leverages GPT-4o to understand issue context and codebase
- 💡 Code Suggestions - Identifies relevant files and proposes precise code changes
- 🔄 Repository Management - Clones and updates local copies to stay current
- 📝 Detailed Reviews - Provides comprehensive code reviews and actionable suggestions
- 🧵 Context Awareness - Tracks conversation history to avoid repetition
- 🌿 Branch Creation - Automatically creates development branches from issues
- 🚀 PR Generation - Turns issues into pull requests with implemented solutions
- 🛠️ Automated Implementation - Uses Aider to apply changes directly to code
- 💬 Feedback Processing - Learns from user comments to improve responses
- 🔗 URL Analysis - Extracts and processes content from links in issues
- 🔄 Self-Maintenance - Updates itself while preserving your configuration
- 🐍 Python 3.8+
- 🔑 OpenAI API key
- 🔐 GitHub API access token
- 🖥️ GitHub CLI (gh)
- ⚙️ Aider CLI
- 📦 Required Python packages:
- pyautogen - AI agent framework
- PyGithub - GitHub API integration
- python-dotenv - Environment management
- gitpython - Git operations
- requests - HTTP requests
- pyyaml - Configuration parsing
- urlextract - URL processing
- beautifulsoup4 - Web scraping
- aider-chat - Code editing
git clone https://github.com/abuzarmahmood/blech_github_bot.git
cd blech_github_botpython -m venv venv
source venv/bin/activate # On Linux/Mac
# OR
.\venv\Scripts\activate # On Windows# One command installs it all
make install
# Or install components separately
make install-deps # Just Python dependencies
make install-aider # Just aider toolCreate a .env file with your API tokens:
GITHUB_TOKEN=your_github_token_here
OPENAI_API_KEY=your_openai_key_here
Add repositories to config/repos.txt:
owner/repo1
owner/repo2
Configure in config/params.json:
{
"auto_update": true
}auto_update: Set to
trueto keep your bot current with the latest features
# Run once
python src/response_agent.py
# Or keep it running 24/7
./src/run_response_agent.sh --delay 300 # Check every 5 minutespython src/response_agent.py- 🔗 Connects to GitHub using your secure API token
- 📥 Syncs repositories to ensure it's working with the latest code
- 🔍 Scans for actionable issues that:
- Have the
blech_botlabel or "[ blech_bot ]" in the title - Need an initial response (new issues)
- Have received user feedback (requiring follow-up)
- Contain development commands (PR creation requests)
- Have the
- 💬 Generates intelligent responses powered by GPT-4o
- 🌿 Creates branches and PRs when triggered with "[ develop_issue ]"
- ✏️ Implements code changes automatically via Aider when feedback is received
- Get Everything Ready
- Clone the repo and set up your environment
- Configure your API tokens in
.env - Add your repositories to
config/repos.txt
- Start Your Assistant
Or keep it running continuously:
python src/response_agent.py
./src/run_response_agent.sh --delay 300
-
Issue Analysis & Response
User creates an issue:
"[ blech_bot ] Feature Request: Add logging system for better debugging"
Blech Bot responds:
"I've analyzed your logging feature request and found these relevant files:
src/utils.py- Current error handlingsrc/config.py- Configuration settings
Recommendation: We can implement a structured logging system using Python's
loggingmodule with configurable levels. Here's how we could approach this..." -
Automatic Implementation
User comments:
"[ develop_issue ] This looks good, please implement it"
Blech Bot creates a solution:
"✅ Created branch
feature/logging-system✅ Implemented logging with configurable levels
✅ Pull request #42 is now open for review
The changes include a new
logger.pymodule and updates to existing files to use the new logging system." -
Refinement Based on Feedback
User comments on PR:
"Could we add file rotation to prevent logs from growing too large?"
Blech Bot improves the solution:
"Updated PR #42 with log rotation functionality:
- Added
TimedRotatingFileHandler - Set 7-day rotation period
- Configured compression for old logs
The changes are ready for your review."
- Added
This real-world workflow shows how Blech Bot transforms issue management into an automated, AI-powered process that saves time and improves code quality.
blech_github_bot/
├── 🧠 src/
│ ├── response_agent.py # Main bot orchestration
│ ├── git_utils.py # GitHub API interactions
│ ├── bot_tools.py # File & utility operations
│ ├── agents.py # AI agent definitions
│ ├── branch_handler.py # Git branch management
│ ├── triggers.py # Issue trigger detection
│ └── run_response_agent.sh # Continuous operation
├── ⚙️ config/
│ ├── repos.txt # Repositories to monitor
│ └── params.json # Bot behavior settings
└── 📚 docs/ # Documentation
Blech Bot employs a team of specialized GPT-4o agents that collaborate through Autogen:
- Scans repository structure with precision
- Maps issue requirements to relevant code files
- Provides context-aware file recommendations
- Extracts key documentation and function signatures
- Crafts precise code changes with line-by-line accuracy
- Suggests implementation strategies with rationale
- Provides complete code snippets ready for integration
- Validates changes against repository constraints
- Synthesizes technical insights into clear explanations
- Creates actionable, user-friendly summaries
- Maintains technical accuracy while being accessible
- Ensures consistent communication style
- Interprets user comments with contextual understanding
- Refines solutions based on developer input
- Maintains continuity between conversations
- Generates improved recommendations
- Distills lengthy comment threads into key points
- Identifies critical requirements and constraints
- Provides concise context for other agents
- Tracks conversation evolution
- Translates discussions into precise edit commands
- Generates Aider-compatible implementation instructions
- Ensures accurate code transformation
- Bridges the gap between ideas and implementation
The agents form a seamless pipeline that:
- Analyzes issues to understand requirements
- Identifies relevant files and code sections
- Designs specific code modifications
- Generates comprehensive, actionable responses
- Processes user feedback to refine solutions
- Implements changes automatically via Aider
- Creates and manages pull requests
We welcome contributions to make Blech Bot even better!
- 🍴 Fork the repository
- 🌿 Create a feature branch (
git checkout -b amazing-feature) - 💻 Code your improvements
- 🔄 Commit your changes (
git commit -m 'Add amazing feature') - 📤 Push to your branch (
git push origin amazing-feature) - 🔍 Open a Pull Request
MIT License - See LICENSE file for details