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