An automated tool that uses LLMs to fix code issues in GitHub repositories.
- Creates branches and fixes code issues automatically
- Uses LLM (OpenAI/Anthropic) to generate fixes
- Creates pull requests with proposed changes
- Monitors CI/CD tests and retries on failures
- Iteratively improves fixes based on test feedback
-
Clone this repository
-
Install dependencies:
pip install -r requirements.txt
-
Copy
.env.exampleto.envand fill in your credentials:cp .env.example .env
-
Edit
.envwith your GitHub token and LLM API key
python main.py --repo "DaveAlessi/ClockGPT" --file "server.js" --issue "Cross-site request forgery" --branch "auto-fix-working-branch" --base-branch "main" --line-numbers "9" --max-retries 2github-auto-fixer/
├── config/ # Configuration and prompt templates
├── models/ # Data models
├── services/ # External API integrations
├── parsers/ # Response parsing utilities
├── orchestration/ # Main workflow logic
├── utils/ # Helper utilities
└── tests/ # Unit tests
- Python 3.9+
- GitHub Personal Access Token with
repoandworkflowscopes - OpenAI or Anthropic API key
main.py
↓ creates FixRequest object (models/fix_request.py)
↓ passes to orchestrator
↓
fix_orchestrator.py
↓ uses github_service.py
↓ → create_branch()
↓ → get_file_contents()
↓
↓ passes file to llm_service.py
↓ → generate_fix()
↓
↓ receives LLM response
↓ passes to llm_response_parser.py
↓ → parse_with_fallback()
↓
↓ validates with validators.py
↓ → validate_code_syntax()
↓
↓ uses github_service.py
↓ → push_file()
↓ → create_pull_request()
↓
↓ uses test_monitor_service.py
↓ → wait_for_completion()
↓
↓ if FAIL:
↓ uses test_log_parser.py
↓ → extract_failures()
↓ checks retry_strategy.py
↓ → should_retry()
↓ back to llm_service.py
↓ → generate_retry_fix()
↓ [LOOP]
↓
↓ if PASS or max retries:
↓ creates FixResult object (models/fix_result.py)
↓ returns to main.py
↓
main.py displays results
GITHUB_TOKEN=ghp_xxxxxxxxxxxxx
OPENAI_API_KEY=sk-xxxxxxxxxxxxx
# or
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxx
MAX_RETRY_ATTEMPTS=3
TEST_POLL_INTERVAL=10
TEST_TIMEOUT=900
LOG_LEVEL=INFO
GITHUB_TOKEN=your_token_here
OPENAI_API_KEY=your_key_here
MAX_RETRY_ATTEMPTS=3
TEST_POLL_INTERVAL=10
TEST_TIMEOUT=900
LOG_LEVEL=INFO
requests
openai
anthropic
pydantic (for data models)
python-dotenv (for env vars)
pytest (for testing)