Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
24a9faa
feat: Add URL scraping and extraction functionality to bot
abuzarmahmood Feb 26, 2025
8be72e1
fix: Correct undefined variable name from `filepath` to `file_path`
abuzarmahmood Feb 26, 2025
0ae8378
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 26, 2025
d2140ea
feat: Implement auto-update feature for bot with config file preserva…
abuzarmahmood Mar 9, 2025
148a3ae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 9, 2025
1e3e3f5
refactor: Externalize configuration and update repository tracking
abuzarmahmood Mar 9, 2025
5e8f16c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 9, 2025
202e3bf
refactor: Import llm_config from config.py in response_agent.py
abuzarmahmood Mar 9, 2025
9edf164
Merge branch 'main' into 9-add-util-to-scrape-text-from-urls-which-ar…
abuzarmahmood Mar 17, 2025
799e0f6
feat: Add urlextract, beautifulsoup4, and aider-chat dependencies
abuzarmahmood Mar 17, 2025
77b8731
refactor(bot_tools): Remove unused functions and migrate required fun…
abuzarmahmood Mar 17, 2025
49cf143
refactor(branch_handler): enhance branch name detection and improve e…
abuzarmahmood Mar 17, 2025
cc0ed6a
fix(imports): update import statement and standardize directory paths
abuzarmahmood Mar 17, 2025
1451636
feat: Add URL scraping and summarization capabilities to GitHub bot
abuzarmahmood Mar 17, 2025
91ffce3
feat: Remove duplicate imports and functions
abuzarmahmood Mar 17, 2025
d48d8df
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 17, 2025
3601458
Merge branch '9-add-util-to-scrape-text-from-urls-which-are-sometimes…
abuzarmahmood Mar 17, 2025
c6e9114
refactor(scraping): restructure logic for improved organization
abuzarmahmood Mar 17, 2025
5be9380
refactor: clean up imports and remove duplicate function
abuzarmahmood Mar 17, 2025
6d9e1e2
Merge pull request #76 from abuzarmahmood/9-add-util-to-scrape-text-f…
abuzarmahmood Mar 17, 2025
f1e3380
Update max number of turns to 20
abuzarmahmood Mar 17, 2025
9244505
Checkout local changes before making any other changes
abuzarmahmood Mar 17, 2025
7e5422f
Merge pull request #101 from abuzarmahmood/tweaks
abuzarmahmood Mar 17, 2025
6a68cbd
Merge branch '22-auto-update-blech_github_bot-by-pulling-latest-commi…
abuzarmahmood Mar 17, 2025
b445d98
feat(update): enhance repository update process
abuzarmahmood Mar 17, 2025
81b2531
feat(config): add auto-update parameter
abuzarmahmood Mar 17, 2025
b6c3d35
refactor(git_utils): format function definition and add logging state…
abuzarmahmood Mar 17, 2025
387a828
refactor(git_utils): improve repository name extraction logic
abuzarmahmood Mar 17, 2025
5fcf2fa
Merge pull request #94 from abuzarmahmood/22-auto-update-blech_github…
abuzarmahmood Mar 17, 2025
8364c12
Fix logic for cleaning repo
abuzarmahmood Mar 17, 2025
03d13ea
refactor(git-utils): remove unused import and update push error handling
abuzarmahmood Mar 17, 2025
5403af1
feat(agent): add change detection after Aider execution
abuzarmahmood Mar 17, 2025
dcb17ea
Merge pull request #104 from abuzarmahmood/push_fixes
abuzarmahmood Mar 17, 2025
5f590bb
fix(branch_handler): allow underscores in branch names
abuzarmahmood Mar 17, 2025
a156e5e
chore(response_agent): add git module import
abuzarmahmood Mar 17, 2025
4ef28a6
Merge pull request #105 from abuzarmahmood/fix_underscore_handling
abuzarmahmood Mar 17, 2025
7c0e407
fix: Prevent double signatures in bot responses
abuzarmahmood Mar 17, 2025
e8f87e1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 17, 2025
507beb2
fix: Prevent double signatures by cleaning responses before adding mo…
abuzarmahmood Mar 17, 2025
a1433f3
feat: Add clean_response function to remove signatures and TERMINATE …
abuzarmahmood Mar 17, 2025
58e0e43
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 17, 2025
e0f810e
Merge pull request #110 from abuzarmahmood/107-something-is-generatin…
abuzarmahmood Mar 18, 2025
6ffea33
Fix clean_response usage
abuzarmahmood Mar 19, 2025
d45970b
Merge pull request #112 from abuzarmahmood/111-fix-bug-with-clean-res…
abuzarmahmood Mar 19, 2025
d3c43a5
feat: Update README.md with new features, agents, and usage instructions
abuzarmahmood Mar 19, 2025
a503ec7
docs: Add documentation for `auto_update` parameter in README
abuzarmahmood Mar 19, 2025
94c1000
Merge pull request #114 from abuzarmahmood/113-update-readme-to-descr…
abuzarmahmood Mar 19, 2025
cff659b
Update README.md
abuzarmahmood Mar 19, 2025
cb8bf7a
The changes look good! I see you've added the `search_github` functio…
abuzarmahmood Mar 21, 2025
caf334d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 21, 2025
66733bd
refactor(git-utils): simplify GitHub search function and add max snip…
abuzarmahmood Mar 24, 2025
593eea5
refactor(git_utils): remove commented-out code
abuzarmahmood Mar 24, 2025
5ac573d
feat(agents): enhance prompt guidance with search_github suggestions
abuzarmahmood Mar 24, 2025
5e468ad
Merge pull request #115 from abuzarmahmood/109-create-a-bot_tool-to-a…
abuzarmahmood Mar 24, 2025
58e17b2
refactor: Update issue and PR processing logic to handle blech_bot la…
abuzarmahmood Mar 31, 2025
2ea45da
fix: Import PullRequest to resolve undefined name error
abuzarmahmood Mar 31, 2025
090caf7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 31, 2025
f283242
feat(git_utils): enhance branch and issue association logic for PRs
abuzarmahmood Mar 31, 2025
9bf9e84
refactor(response_agent): streamline PR handling logic
abuzarmahmood Mar 31, 2025
f4d4175
fix(git_utils): correct attribute access for PR determination
abuzarmahmood Mar 31, 2025
292da08
feat(response_agent): enhance issue processing with comment summariza…
abuzarmahmood Mar 31, 2025
b62fbd9
feat: Enhance GitHub bot to process PRs and issues with improved cont…
abuzarmahmood Mar 31, 2025
0bf877a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 31, 2025
56cd333
refactor(response_agent): modularize and streamline flow functions
abuzarmahmood Apr 1, 2025
132e526
Merge branch '103-formally-segregate-issues-and-prs-during-processing…
abuzarmahmood Apr 1, 2025
368a7e1
refactor(response): encapsulate PR comment writing logic
abuzarmahmood Apr 1, 2025
43fd805
refactor(response_agent): simplify process_issue logic and remove red…
abuzarmahmood Apr 1, 2025
f214d02
feat(git-integration): enhance issue and PR processing
abuzarmahmood Apr 1, 2025
6cf5730
fix(response_agent): handle PR comment flow exceptions and improve lo…
abuzarmahmood Apr 1, 2025
02d93de
refactor: Improve PR and issue processing logic in response agent
abuzarmahmood Apr 1, 2025
62088ab
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 1, 2025
aed3c88
refactor(response_agent): remove redundant PR processing logic
abuzarmahmood Apr 1, 2025
d852311
103 formally segregate issues and prs during processing (#119)
abuzarmahmood Apr 1, 2025
18bd156
feat: Add content type check to prevent scraping non-text URLs
abuzarmahmood Apr 1, 2025
00060d7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 1, 2025
fbdeeef
refactor(logging): streamline output with `tab_print` and fix minor bugs
abuzarmahmood Apr 1, 2025
ec5b7e4
fix(response_agent): remove unreachable code in respond_pr_comment_flow
abuzarmahmood Apr 1, 2025
48c60b1
fix(response_agent): correct print function for process completion
abuzarmahmood Apr 1, 2025
4c66657
feat: Add content type check to prevent scraping non-text URLs (#123)
abuzarmahmood Apr 1, 2025
d73e677
feat: Add content type check to prevent scraping non-text URLs
abuzarmahmood Apr 1, 2025
3986d09
fix(git_utils): update text to identify Graphite-related comments
abuzarmahmood Apr 1, 2025
4672a85
refactor: Filter out Graphite-related comments in get_issue_comments …
abuzarmahmood Apr 1, 2025
9effbbf
feat: Add process termination after bot repository self-update
abuzarmahmood Apr 1, 2025
7e1b3f1
Merge pull request #129 from abuzarmahmood/128-if-self-update-was-run…
abuzarmahmood Apr 1, 2025
62cb737
feat(config, response_agent): add silent mode for LLM output control
abuzarmahmood Apr 1, 2025
f598284
refactor(chat-config): refactor chat configuration for consistency
abuzarmahmood Apr 1, 2025
c6f51d2
refactor(response_agent): remove redundant parameters from chat confi…
abuzarmahmood Apr 1, 2025
1cf0ad8
fix(response_agent): add max_turns parameter to chat_config
abuzarmahmood Apr 1, 2025
81165e3
chore: Add src/repos to .gitignore
abuzarmahmood Apr 1, 2025
9f236da
Merge pull request #133 from abuzarmahmood/130-add-srcrepos-to-gitignore
abuzarmahmood Apr 1, 2025
ed34f5a
feat(config, response_agent): add silent mode for LLM output control …
abuzarmahmood Apr 1, 2025
15b43cd
refactor(codebase): remove unused function and streamline PR processing
abuzarmahmood Apr 1, 2025
9399542
refactor(codebase): remove unused function and streamline PR processi…
abuzarmahmood Apr 1, 2025
ccb7ec7
refactor: Improve self-repo update logic with better branch detection…
abuzarmahmood Apr 2, 2025
a0dcb6e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 2, 2025
423e0eb
Merge pull request #135 from abuzarmahmood/134-only-update-self-repo-…
abuzarmahmood Apr 2, 2025
0317c29
Update git_utils.py self_update func
abuzarmahmood Apr 2, 2025
63becce
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 2, 2025
a115b50
Update response_agent.py
abuzarmahmood Apr 2, 2025
47fbe3e
Merge pull request #136 from abuzarmahmood/abuzarmahmood-patch-bug-in…
abuzarmahmood Apr 2, 2025
2e8ea2a
Update git_utils.py
abuzarmahmood Apr 2, 2025
76667b6
refactor: Add consistent error logging with model signature across bo…
abuzarmahmood Apr 2, 2025
d64b0fb
fix: Import add_signature_to_comment function in response_agent.py
abuzarmahmood Apr 2, 2025
d90adb2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 2, 2025
92de045
fix(response_agent): improve PR creation comment check logic
abuzarmahmood Apr 2, 2025
0a40f95
fix(response_agent): correct function call parameters
abuzarmahmood Apr 2, 2025
c435ee1
feat(branch-handler): force align branch with remote after checkout
abuzarmahmood Apr 2, 2025
40d12f3
Merge pull request #139 from abuzarmahmood/bug_fixes
abuzarmahmood Apr 2, 2025
12a9aa0
Merge branch 'main' of https://github.com/abuzarmahmood/blech_github_…
abuzarmahmood Apr 2, 2025
d683ae3
feat: Improve error handling and logging across bot components
abuzarmahmood Apr 2, 2025
a07ce9e
feat: Add consistent error logging signature across bot components
abuzarmahmood Apr 2, 2025
287ec43
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 2, 2025
3a1b213
refactor(git_utils): remove duplicate add_signature_to_comment function
abuzarmahmood Apr 2, 2025
b7914d2
69 any issues while running bot should be written to either the issue…
abuzarmahmood Apr 3, 2025
49ec743
docs(response_agent): document outcome types for issue processing
abuzarmahmood Apr 2, 2025
dd9028e
fix(git_utils): correct filter logic and streamline comment handling
abuzarmahmood Apr 2, 2025
3d6b6c9
refactor: improve comment filtering and error detection logic
abuzarmahmood Apr 2, 2025
62da62b
feat: Differentiate between error and skip outcomes in GitHub issue p…
abuzarmahmood Apr 2, 2025
ddd381f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 2, 2025
f5f4ce9
fix(response_agent): improve logging with PR number context
abuzarmahmood Apr 2, 2025
caa7d5e
feat(logging): add debug prints for branch management in get_developm…
abuzarmahmood Apr 2, 2025
fb78b66
fix(branch): improve branch retrieval logic
abuzarmahmood Apr 2, 2025
3fdfd91
fix(config): disable auto_update in params configuration
abuzarmahmood Apr 3, 2025
ec7ee57
refactor(error-handling): streamline error handling and messaging
abuzarmahmood Apr 2, 2025
2a6b928
Add outcome type (error vs skip) and post error to github only if err…
abuzarmahmood Apr 3, 2025
031c87c
feat: Add error handling to skip processing for issues/PRs with repor…
abuzarmahmood Apr 4, 2025
f3d0853
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 4, 2025
1aa6968
Update triggers.py
abuzarmahmood Apr 4, 2025
43fa477
Merge pull request #149 from abuzarmahmood/148-stop-processing-of-iss…
abuzarmahmood Apr 4, 2025
f940491
feat: Implement intelligent text summarization using summary agent
abuzarmahmood Apr 5, 2025
824d9cb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 5, 2025
04ff7fb
refactor: Enhance summary agent prompt to prioritize technical detail…
abuzarmahmood Apr 5, 2025
b1a56e3
refactor: Update summarize_text to use summary agent without length c…
abuzarmahmood Apr 6, 2025
3732217
test: Add comprehensive unit tests for triggers.py module
abuzarmahmood Apr 21, 2025
3755454
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 21, 2025
27f2555
ci: add GitHub Actions workflow to run tests for triggers.py
abuzarmahmood Apr 21, 2025
5a3b493
Update requirements.txt
abuzarmahmood Apr 21, 2025
fd3e8f2
Update requirements.txt
abuzarmahmood Apr 21, 2025
ad41579
Update test.yml
abuzarmahmood Apr 21, 2025
756b091
fix: update import path for triggers module in test file
abuzarmahmood Apr 22, 2025
8bd22b1
fix: Update import paths and sys.path for test_triggers.py
abuzarmahmood Apr 22, 2025
a3b685f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 22, 2025
8e6a937
Update test_triggers.py
abuzarmahmood Apr 22, 2025
a1d6c08
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 22, 2025
00ac092
fix: correct import paths and sys.path in test_triggers.py
abuzarmahmood Apr 22, 2025
1028bb0
fix: resolve import errors in test_triggers.py by updating path and i…
abuzarmahmood Apr 22, 2025
cf5312e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 22, 2025
915dd4d
Update test_triggers.py
abuzarmahmood Apr 22, 2025
d20b66b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 22, 2025
d1352e1
fix(imports): update import paths to include 'src' module
abuzarmahmood Apr 22, 2025
3f798d7
refactor(triggers): optimize imports for linked PR functions
abuzarmahmood Apr 22, 2025
8e2bbb9
Merge pull request #155 from abuzarmahmood/154-write-tests-for-trigge…
abuzarmahmood Apr 22, 2025
b97b938
feat: Add code coverage reporting with pytest-cov and Codecov integra…
abuzarmahmood Apr 22, 2025
adc8866
Update test.yml
abuzarmahmood Apr 22, 2025
248e050
Update test.yml
abuzarmahmood Apr 22, 2025
2f0409a
Merge pull request #157 from abuzarmahmood/156-get-code-coverage-for-…
abuzarmahmood Apr 22, 2025
11f2219
Merge branch 'main' of https://github.com/abuzarmahmood/blech_github_…
abuzarmahmood Apr 22, 2025
2563b75
Merge pull request #153 from abuzarmahmood/120-in-summarize_text-inst…
abuzarmahmood Apr 29, 2025
829c966
fix: Add missing summary_agent configuration to agents.py
abuzarmahmood Apr 30, 2025
9ada16c
refactor(agents): remove duplicate summary agent and update references
abuzarmahmood Apr 30, 2025
06f3327
ci(workflow): update test dependencies installation
abuzarmahmood Apr 30, 2025
eeb4a2a
ci(test): remove redundant pytest installation in workflow
abuzarmahmood Apr 30, 2025
2ed1a69
chore(dependencies): update pytest and pytest-cov requirements
abuzarmahmood Apr 30, 2025
dda0bea
chore(dependencies): add numpy to requirements
abuzarmahmood Apr 30, 2025
7cedb53
chore(ci): update GitHub Actions versions for checkout and setup-python
abuzarmahmood Apr 30, 2025
b9e9590
chore(dependencies): update numpy version specifier in requirements
abuzarmahmood Apr 30, 2025
ab5943c
fix: Add missing summary_agent configuration to agents.py (#161)
abuzarmahmood Apr 30, 2025
3cbf9ba
feat(setup): simplify installation process with aider-install script
abuzarmahmood Apr 30, 2025
76ffe22
build: add Makefile for project installation and management
abuzarmahmood Apr 30, 2025
0b8783b
Move commands from aider_intall to Makefile
abuzarmahmood Apr 30, 2025
7494801
chore: update workflow to use makefile for dependency installation
abuzarmahmood Apr 30, 2025
cf2bf68
fix(ci): correct make command for installing dependencies
abuzarmahmood Apr 30, 2025
4af6a9f
chore(ci): update CI configuration for test trigger
abuzarmahmood Apr 30, 2025
d778e2f
docs: Update README with improved installation instructions
abuzarmahmood Apr 30, 2025
5f19187
refactor(script): modify paths and improve environment activation
abuzarmahmood Apr 30, 2025
04856f5
fix(triggers): reorder imports and remove duplicate entries
abuzarmahmood Apr 30, 2025
a381780
feat(setup) : Use makefile to install aider separately (#162)
abuzarmahmood Apr 30, 2025
7d4df02
refactor: Externalize configuration and update repository tracking
abuzarmahmood May 2, 2025
cca6217
refactor: Import llm_config from config.py in response_agent.py
abuzarmahmood Mar 9, 2025
227fa00
Merge branch '93-put-llm_config-in-a-separate-file' of https://github…
abuzarmahmood May 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run Tests

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
make install

- name: Run tests with coverage
run: |
pytest tests/test_triggers.py -v --cov --cov-branch --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.aider*
.env
src/repos
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.PHONY: all install install-deps install-aider test clean

all: install

install: install-deps install-aider

install-deps:
@echo "Installing Python dependencies..."
python -m pip install -r requirements.txt

install-aider:
@echo "Installing aider..."
python -m pip install aider-install
aider-install

test:
@echo "Running tests..."
pytest

clean:
@echo "Cleaning up..."
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.pyd" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -type d -name "*.egg" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".coverage" -exec rm -rf {} +
find . -type d -name "htmlcov" -exec rm -rf {} +
find . -type d -name "dist" -exec rm -rf {} +
find . -type d -name "build" -exec rm -rf {} +

help:
@echo "Available targets:"
@echo " all : Install dependencies and aider (default)"
@echo " install : Install dependencies and aider"
@echo " install-deps : Install Python dependencies from requirements.txt"
@echo " install-aider: Install aider tool"
@echo " test : Run tests with pytest"
@echo " clean : Remove Python cache files and build artifacts"
@echo " help : Show this help message"
106 changes: 63 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/abuzarmahmood/blech_github_bot/main.svg)](https://results.pre-commit.ci/latest/github/abuzarmahmood/blech_github_bot/main)
[![codecov](https://codecov.io/gh/abuzarmahmood/blech_github_bot/branch/main/graph/badge.svg)](https://codecov.io/gh/abuzarmahmood/blech_github_bot)

# GitHub Monitor Bot

Expand All @@ -7,27 +8,37 @@ A Python bot that monitors GitHub repositories and automatically responds to iss
## Features

- Monitors configured GitHub repositories from `config/repos.txt`
- Automatically responds to issues with the `blech_bot` label
- Analyzes issue content using GPT-4
- Automatically responds to issues with the `blech_bot` label or title mention
- Analyzes issue content using GPT-4o
- Suggests relevant files and code changes
- Clones and updates local repository copies
- Provides detailed code review and suggestions
- Tracks response history to avoid duplicates
- Creates development branches and pull requests from issues
- Implements changes automatically using Aider
- Processes user feedback on responses and pull requests
- Extracts and analyzes content from URLs in issues
- Self-updates while preserving configuration

## Requirements

- Python 3.8+
- OpenAI API key
- GitHub API access token
- GitHub CLI (gh)
- Aider CLI
- Required Python packages (see requirements.txt):
- pyautogen
- PyGithub
- python-dotenv
- gitpython
- requests
- pyyaml
- urlextract
- beautifulsoup4
- aider-chat

## Setup
## Get Started

1. Clone the repository:
```bash
Expand All @@ -43,9 +54,14 @@ source venv/bin/activate # On Linux/Mac
.\venv\Scripts\activate # On Windows
```

3. Install dependencies:
3. Install dependencies and tools:
```bash
pip install -r requirements.txt
# Install all dependencies and aider
make install

# Or install components separately
make install-deps # Just Python dependencies
make install-aider # Just aider tool
```

4. Create a `.env` file with your API tokens:
Expand All @@ -60,6 +76,23 @@ owner/repo1
owner/repo2
```

6. Configure bot behavior in `config/params.json`:
```json
{
"auto_update": true
}
```
- `auto_update`: Controls whether the bot automatically updates itself with the latest changes from its repository. Set to `true` to enable auto-updates or `false` to disable them.

7. Run the bot:
```bash
# Run once
python src/response_agent.py

# Or run continuously with the shell script
./src/run_response_agent.sh --delay 300 # Check every 5 minutes
```

## Usage

Run the bot:
Expand All @@ -71,54 +104,29 @@ The bot will:
1. Connect to GitHub using your API token
2. Clone/update configured repositories locally
3. Process open issues that:
- Have the `blech_bot` label
- Don't already have a bot response
- Don't have associated branches/PRs
4. Generate and post responses using GPT-4
- Have the `blech_bot` label or "[ blech_bot ]" in the title
- Don't already have a bot response (for new issues)
- Have user feedback (for follow-up responses)
- Have development commands (for creating PRs)
4. Generate and post responses using GPT-4o
5. Create branches and PRs when requested with "[ develop_issue ]" command
6. Apply changes automatically using Aider when feedback is provided on PRs

## Code Structure

- `src/response_agent.py`: Main bot logic and Autogen agents
- `src/git_utils.py`: GitHub API interaction utilities
- `src/bot_tools.py`: Helper functions for file operations
- `src/agents.py`: Agent definitions and prompt generation
- `src/branch_handler.py`: Git branch management utilities
- `src/triggers.py`: Issue trigger detection functions
- `src/run_response_agent.sh`: Script for continuous bot operation
- `config/repos.txt`: List of repositories to monitor

## Get Started

1. Set up your environment:
```bash
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt
```

2. Configure your environment variables in `.env`:
```
GITHUB_TOKEN=your_github_token
OPENAI_API_KEY=your_openai_key
```

3. Add repositories to monitor in `config/repos.txt`:
```
owner/repo1
owner/repo2
```

4. Run the bot:
```bash
# Run once
python src/response_agent.py

# Or run continuously with the shell script
./src/run_response_agent.sh --delay 300 # Check every 5 minutes
```
- `config/params.json`: Bot configuration parameters

## AI Agent Architecture

The bot uses specialized GPT-4 agents working together through Autogen:
The bot uses specialized GPT-4o agents working together through Autogen:

- **File Assistant**: Analyzes repository structure
- Reviews issue content and codebase
Expand All @@ -144,11 +152,23 @@ The bot uses specialized GPT-4 agents working together through Autogen:
- Maintains context from original response
- Generates updated recommendations

- **Comment Summary Assistant**: Summarizes issue comments
- Extracts relevant information from comment threads
- Identifies key points and requirements
- Provides concise summaries for other agents

- **Generate Edit Command Assistant**: Creates Aider commands
- Converts discussion into actionable edit instructions
- Generates precise commands for automated implementation
- Formats instructions for Aider compatibility

The agents work together to:
1. Analyze issues and identify affected files
2. Propose specific code changes
3. Generate comprehensive responses
4. Process user feedback and improve suggestions
5. Automatically implement changes via Aider
6. Create and manage pull requests

## Contributing

Expand Down
4 changes: 4 additions & 0 deletions config/params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"auto_update": false,
"print_llm_output": false
}
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts = --cov=src --cov-report=term-missing --cov-report=xml
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ python-dotenv>=0.19.0
requests>=2.26.0
pyyaml>=5.4.1
pyautogen>=0.2.0
gitpython>=3.1.40
pre-commit>=3.5.0
urlextract>=1.0.0
beautifulsoup4>=4.9.3
gitpython
pytest
pytest-cov
13 changes: 7 additions & 6 deletions src/run_response_agent.sh → run_response_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ while [[ "$#" -gt 0 ]]; do
done

# Navigate to the script directory
cd "$(dirname "$0")"
echo "Directory: $(pwd)"
# cd "$(dirname "$0")"
# echo "Directory: $(pwd)"

# Activate virtual environment if it exists
if [ -f "../venv/bin/activate" ]; then
source ../venv/bin/activate
echo "Virtual environment activated from" $(realpath ../venv/bin/activate)
VENV_ACTIVATE_PATH=$(realpath ./venv/bin/activate)
if [ -f "$VENV_ACTIVATE_PATH" ]; then
source $VENV_ACTIVATE_PATH
echo "Virtual environment activated from" $VENV_ACTIVATE_PATH
fi

# Run the response_agent.py script in a loop with the specified delay
echo "Running response_agent.py with delay of $DELAY seconds"
while true; do
python3 response_agent.py
python3 src/response_agent.py
echo "Next run in $DELAY seconds"
sleep "$DELAY" # Wait for the specified delay before running again
done
Expand Down
Empty file added src/__init__.py
Empty file.
Loading