Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
pull_request:
push:
branches: ["main"]

permissions:
contents: read

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: requirements-dev.txt

- name: Install dev dependencies
run: pip install -r requirements-dev.txt

- name: Ruff lint
run: ruff check .

- name: Ruff format
run: ruff format --check .
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Merci de contribuer a PatchworkAgent ! Ce guide explique comment ajouter un nouv

## Ajouter un nouveau provider IA

Pour ajouter un provider `myprovider` avec le label de declenchement `ai-pr-myprovider` :
Pour ajouter un provider `myprovider` configure par le label `ai-pr-myprovider` :

### 1. Script provider : `providers/myprovider.sh`

Expand Down Expand Up @@ -191,7 +191,7 @@ docker save worker-myprovider:latest | sudo k3s ctr images import -
kubectl -n ai-bot apply -f k8s/debug-myprovider.yaml
kubectl -n ai-bot logs -f job/debug-myprovider

# Test end-to-end : ajouter le label ai-pr-myprovider sur une issue
# Test end-to-end : ajouter le label ai-pr-myprovider puis commenter /agent implement sur une issue
```

---
Expand Down Expand Up @@ -242,7 +242,8 @@ kubectl -n ai-bot logs -f deploy/orchestrator --tail=200

| Element | Convention | Exemple |
|---------|-----------|---------|
| Label GitHub | `ai-pr-<provider>` | `ai-pr-claude` |
| Label provider GitHub | `ai-pr-<provider>` | `ai-pr-claude` |
| Commande agent | `/agent <action>` | `/agent implement` |
| Image Docker | `worker-<provider>:latest` | `worker-aider:latest` |
| Secret K8s | `<service>-api-key` | `openrouter-api-key` |
| Script provider | `providers/<provider>.sh` | `providers/aider.sh` |
Expand Down
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Kubernetes orchestrator that turns GitHub issues into pull requests using AI age

## Why this project

This project automates the **Issue -> Label -> Pull Request** flow: an `ai-pr-*` label on an issue triggers an AI worker that clones the repo, solves the problem, and opens a PR.
This project automates the **Issue -> Provider Label -> /agent command -> Pull Request** flow: an `ai-pr-*` label configures the AI worker provider, and an issue comment such as `/agent implement` starts the worker that clones the repo, solves the problem, and opens a PR.

It avoids AI vendor lock-in with 3 built-in worker providers:

Expand Down Expand Up @@ -32,7 +32,7 @@ Tested on: VPS / 8 GB RAM / 4 vCPU / k3s single-node.
![PatchworkAgent Architecture](illustration.png)

```
GitHub Issue (label ai-pr-*)
GitHub Issue (ai-pr-* label + /agent implement comment)
|
v
POST /webhook/github
Expand All @@ -59,9 +59,10 @@ GitHub Issue (label ai-pr-*)
Workers receive only the short-lived token and never receive the PEM key.

**Job environment (metadata)** : the orchestrator injects source-agnostic
variables for each worker Job: `SOURCE_REPO`, `SOURCE_ISSUE_NUMBER`,
`SOURCE_ISSUE_TITLE`, `SOURCE_ISSUE_BODY` (GitHub issue description, bounded to
64 KiB), `SOURCE_ISSUE_URL`, `SOURCE_EVENT_ACTION`, `SOURCE_INSTALLATION_ID`.
variables for each worker Job: `SOURCE_REPO`, `SOURCE_ISSUE_NUMBER`,
`SOURCE_ISSUE_TITLE`, `SOURCE_ISSUE_BODY` (GitHub issue description, bounded to
64 KiB), `SOURCE_ISSUE_URL`, `SOURCE_INSTALLATION_ID`, `SOURCE_ACTION`,
`SOURCE_TRIGGER`, `SOURCE_TRIGGER_COMMAND`.
See `docs/adr/0001-source-provider-abstraction.md`. The clone credential secret
key remains `GITHUB_TOKEN` (installation token).

Expand Down Expand Up @@ -158,7 +159,10 @@ kubectl -n ai-bot apply -f k8s/orchestrator.yaml

### 4. Usage

Add a label `ai-pr-claude`, `ai-pr-codex`, or `ai-pr-aider` to a GitHub issue. The bot automatically creates a PR.
Add a label `ai-pr-claude`, `ai-pr-codex`, or `ai-pr-aider` to configure the provider, then comment `/agent implement` on the issue. The bot creates a PR.

Migration note: `TRIGGER_PREFIX` has been removed. Use
`PROVIDER_LABEL_PREFIX` to configure provider label matching.

---

Expand Down Expand Up @@ -330,9 +334,9 @@ sudo systemctl status k3s --no-pager -l
| |-- ai-issue-*.yaml # Manual jobs per provider
| |-- debug-*.yaml # Debug jobs per provider
| `-- secrets/ # Templates (no values)
|-- prompt/
| |-- issue_prompt.sh # Optional SOURCE_ISSUE_BODY appendix
| `-- issue_start_prompt.sh # Shared task instructions (all workers)
|-- prompt/
| |-- action_prompt.sh # Dispatches prompts by SOURCE_ACTION
| `-- actions/ # Action-specific worker prompts
|-- providers/
| |-- source/ # SourceProvider interface + GitHub implementation
| |-- git_workflow.sh # Shared Git logic
Expand Down
Loading
Loading