Skip to content

Commit 279f2c8

Browse files
feat: Enhance configuration system with smart mode selection and multi-pass processing
- Added comprehensive TypeScript configuration interface for PatchBotConfig - Implemented mode-specific configuration with support for architect, patcher, and hybrid modes - Added multi-pass processing configuration with flexible mode sequencing - Enhanced environment variable handling with type-safe helpers - Supported multiple API keys for OpenAI, Anthropic, and OpenRouter providers - Updated .env.example with new configuration options and detailed comments - Improved mode selection logic with repository-specific configuration support
1 parent 1bb5f34 commit 279f2c8

17 files changed

+2023
-938
lines changed

.env.example

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,29 @@ LOG_LEVEL=debug
88
# Go to https://smee.io/new set this to the URL that you are redirected to.
99
WEBHOOK_PROXY_URL=
1010

11+
# GitHub App Setup (required)
12+
# Your GitHub App's private key, get this from the GitHub App settings page
13+
# To generate: Go to https://github.com/settings/apps -> Your app -> General -> Private keys -> Generate a private key
14+
# Copy the contents of the downloaded .pem file and paste it here
15+
# For multi-line values in .env, use quotes and \n for line breaks:
16+
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
17+
...
18+
-----END RSA PRIVATE KEY-----"
19+
1120
# patchmycode Configuration
1221
# API keys for LLM services (required for code fixing)
22+
# OpenAI API Key - Required for GPT models
1323
OPENAI_API_KEY=
24+
# Anthropic API Key - Required for Claude models
1425
ANTHROPIC_API_KEY=
26+
# OpenRouter API Key - Optional for access to multiple models through OpenRouter
27+
OPENROUTER_API_KEY=
28+
29+
# Multiple key setup (optional)
30+
# For load balancing or fallbacks, you can configure multiple API keys
31+
# Separate multiple keys with commas (,)
32+
OPENAI_API_KEYS=key1,key2,key3
33+
ANTHROPIC_API_KEYS=key1,key2,key3
1534

1635
# Label that triggers patchmycode to fix an issue
1736
PATCH_TRIGGER_LABEL=fix:auto
@@ -26,22 +45,37 @@ GIT_TIMEOUT=60000
2645
PATCH_PR_LABELS=automated-fix,patchmycode-generated
2746

2847
# Comment templates
29-
PATCH_PROCESSING_COMMENT="🤖 Im working on fixing this issue automatically..."
30-
PATCH_SUCCESS_COMMENT="Ive created a pull request with a fix for this issue."
31-
PATCH_FAILURE_COMMENT="❌ I wasnt able to automatically fix this issue."
48+
PATCH_PROCESSING_COMMENT="🤖 I'm working on fixing this issue automatically..."
49+
PATCH_SUCCESS_COMMENT="I've created a pull request with a fix for this issue."
50+
PATCH_FAILURE_COMMENT="❌ I wasn't able to automatically fix this issue."
3251

33-
# LLM model to use
34-
# For OpenAI models:
52+
# Mode-specific model configuration
53+
# Default model to use for all modes if mode-specific models aren't specified
3554
PATCH_MODEL=gpt-4o
36-
# For Anthropic/Claude models (MUST use --use-anthropic flag):
37-
# PATCH_MODEL=claude-3-7-sonnet-20250219
38-
# PATCH_MODEL=claude-3-opus-20240229
39-
# PATCH_MODEL=claude-3-sonnet-20240229
55+
56+
# Mode-specific models (optional)
57+
PATCH_MODEL_ARCHITECT=claude-3-7-sonnet-20250219
58+
PATCH_MODEL_PATCHER=gpt-4o
59+
PATCH_MODEL_HYBRID_SECURITY=claude-3-opus-20240229
60+
PATCH_MODEL_HYBRID_PERFORMANCE=gpt-4o-mini
61+
PATCH_MODEL_HYBRID_TYPESCRIPT=gpt-4o
62+
63+
# Default processing mode
64+
PATCH_DEFAULT_MODE=patcher
4065

4166
# Additional arguments to pass to the AI engine (comma-separated)
4267
# IMPORTANT: When using Claude models, you MUST include --use-anthropic here
4368
# PATCH_EXTRA_ARGS=--use-anthropic
4469

70+
# Mode-specific extra arguments (comma-separated, optional)
71+
# PATCH_EXTRA_ARGS_ARCHITECT=--use-anthropic,--extra-arg
72+
# PATCH_EXTRA_ARGS_PATCHER=--timeout=300
73+
# PATCH_EXTRA_ARGS_HYBRID_SECURITY=--use-anthropic,--security-focus
74+
75+
# Multi-pass processing configuration
76+
PATCH_ENABLE_MULTIPASS=true
77+
PATCH_MULTIPASS_SEQUENCE=architect,patcher
78+
4579
# Branch configuration
4680
PATCH_BRANCH_PREFIX=patch-fix-
4781

@@ -54,3 +88,6 @@ PATCH_PR_DRAFT=false
5488
PATCH_INCLUDE_FILES=
5589
# Files to exclude from analysis (glob patterns, comma-separated)
5690
PATCH_EXCLUDE_FILES=node_modules/**,.git/**
91+
92+
# Repository specific configuration path
93+
PATCH_CONFIG_PATH=.patchmycode/config.json
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us fix issues
4+
title: 'Bug: '
5+
labels: 'bug'
6+
assignees: ''
7+
---
8+
9+
## Description
10+
<!-- A clear and concise description of what the bug is -->
11+
12+
## Reproduction Steps
13+
<!-- Steps to reproduce the behavior -->
14+
1.
15+
2.
16+
3.
17+
18+
## Expected Behavior
19+
<!-- A clear and concise description of what you expected to happen -->
20+
21+
## Current Behavior
22+
<!-- A clear description of what actually happens -->
23+
24+
## Error Messages
25+
<!-- If applicable, add error messages or logs to help explain your problem -->
26+
```
27+
// Paste error message or logs here
28+
```
29+
30+
## Code Context
31+
<!-- If you can identify where the issue is occurring, please share code snippets -->
32+
```
33+
// Paste relevant code here
34+
```
35+
36+
## Fix Scope
37+
<!-- This helps the bot choose the right mode for fixing the issue -->
38+
- [ ] This is likely a small, isolated bug (patcher mode)
39+
- [ ] This might require architectural changes (architect mode)
40+
- [ ] This might be related to security issues (hybrid:security mode)
41+
- [ ] This is likely a performance problem (hybrid:performance mode)
42+
- [ ] This is related to TypeScript types (hybrid:typescript mode)
43+
44+
## Additional Context
45+
<!-- Add any other context about the problem here -->
46+
47+
## Screenshots
48+
<!-- If applicable, add screenshots to help explain your problem -->
49+
50+
## Environment
51+
- OS: [e.g. Windows 10, macOS 14.0]
52+
- Browser/Version: [e.g. Chrome 121, Firefox 125]
53+
- App Version: [e.g. 1.0.5]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: 'Feature: '
5+
labels: 'enhancement'
6+
assignees: ''
7+
---
8+
9+
## Feature Description
10+
<!-- A clear and concise description of the feature you want to be implemented -->
11+
12+
## Problem Context
13+
<!-- Why is this feature needed? What problem does it solve? -->
14+
15+
## Proposed Implementation
16+
<!-- Describe how you think this could be implemented. Include code snippets if possible.
17+
The more details you provide, the more accurately the bot can select the best mode. -->
18+
```
19+
// Example code or pseudocode here
20+
```
21+
22+
## Architectural Considerations
23+
<!-- Describe any architectural impacts this feature might have.
24+
This will help the bot determine if it should use architect mode. -->
25+
26+
## Alternative Solutions
27+
<!-- Describe any alternative solutions or features you've considered -->
28+
29+
## Additional Context
30+
<!-- Add any other context or screenshots about the feature request here -->
31+
32+
## Mode Hints (Optional)
33+
<!-- If you have preferences for how this should be fixed, uncomment one of the options below -->
34+
<!-- - I suggest using architect mode for this issue -->
35+
<!-- - I suggest using patcher mode for this issue -->
36+
<!-- - I suggest using multipass (architect+patcher) mode for this issue -->
37+
<!-- - I suggest using hybrid:security mode for this issue -->
38+
<!-- - I suggest using hybrid:performance mode for this issue -->
39+
<!-- - I suggest using hybrid:typescript mode for this issue -->

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ npm-debug.log
66
coverage
77
lib
88
.env.archive
9+
.cursor/mcp.json

0 commit comments

Comments
 (0)