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
15 changes: 15 additions & 0 deletions CLAUDE.md
Comment thread
myakove marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -672,3 +672,18 @@ External AI service integration for test recommendations via [pr-test-oracle](ht
- Health check failure: PR comment posted, continue flow
- Analyze errors: log only, no PR comment
- Never breaks webhook processing

### AI Features

AI-powered enhancements controlled by `ai-features` config (global or per-repo).

**Config keys:** `ai-provider` (required: claude/gemini/cursor), `ai-model` (required), `conventional-title` (optional: "true"/"false"/"fix", default: "false")

**Conventional title modes:**
- `"true"`: Show AI-suggested title in check run output when validation fails
- `"false"`: Disabled (default)
- `"fix"`: Auto-update PR title with AI suggestion when validation fails (suggestion is validated before applying)

**On AI CLI failure:** Error is logged, flow continues without suggestion

**Module:** `webhook_server/libs/ai_cli.py` - shared AI CLI wrapper
Comment thread
coderabbitai[bot] marked this conversation as resolved.
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ RUN mkdir -p $BIN_DIR \
&& mkdir -p $DATA_DIR \
&& mkdir -p $DATA_DIR/logs

COPY entrypoint.py pyproject.toml uv.lock README.md $APP_DIR/
COPY webhook_server $APP_DIR/webhook_server/
COPY scripts $APP_DIR/scripts/

RUN usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USERNAME \
&& chown -R $USERNAME:$USERNAME $HOME_DIR

Expand All @@ -59,7 +55,7 @@ ENV UV_PYTHON=python3.13 \
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx ${BIN_DIR}/
RUN uv tool install pre-commit && uv tool install poetry && uv tool install prek && uv tool install tox

# Install AI CLI tools for pr-test-oracle integration
# Install AI CLI tools
# Claude Code CLI (installs to ~/.local/bin)
RUN /bin/bash -o pipefail -c "curl -fsSL https://claude.ai/install.sh | bash"

Expand All @@ -79,10 +75,17 @@ RUN set -ex \
&& curl --fail -vL https://github.com/mislav/hub/releases/download/v2.14.2/hub-linux-amd64-2.14.2.tgz | tar --wildcards --strip-components=2 -C $BIN_DIR -xzvf - '*/bin/hub' \
&& chmod +x $BIN_DIR/hub

WORKDIR $APP_DIR
# Copy dependency manifests first for uv sync cache stability
COPY --chown=$USERNAME:$USERNAME pyproject.toml uv.lock README.md $APP_DIR/

WORKDIR $APP_DIR
RUN uv sync

# Copy application code after dependency install
COPY --chown=$USERNAME:$USERNAME entrypoint.py $APP_DIR/
COPY --chown=$USERNAME:$USERNAME webhook_server $APP_DIR/webhook_server/
COPY --chown=$USERNAME:$USERNAME scripts $APP_DIR/scripts/

HEALTHCHECK CMD curl --fail http://127.0.0.1:5000/webhook_server/healthcheck || exit 1

ENTRYPOINT ["tini", "--", "uv", "run", "entrypoint.py"]
29 changes: 18 additions & 11 deletions examples/.github-webhook-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ auto-verified-and-merged-users:
- "trusted-user"

# Auto-verify cherry-picked PRs (default: true)
auto-verify-cherry-picked-prs: false # Set to false to require manual verification for cherry-picked PRs
auto-verify-cherry-picked-prs: false # Set to false to require manual verification for cherry-picked PRs

# Repository-specific GitHub tokens
github-tokens:
Expand Down Expand Up @@ -119,9 +119,9 @@ conventional-title: "feat,fix,build,chore,ci,docs,style,refactor,perf,test,rever
minimum-lgtm: 2

# Issue creation for new pull requests
create-issue-for-new-pr: true # Create tracking issues for new PRs
create-issue-for-new-pr: true # Create tracking issues for new PRs

cherry-pick-assign-to-pr-author: true # Assign cherry-pick PRs to the original PR author (default: true)
cherry-pick-assign-to-pr-author: true # Assign cherry-pick PRs to the original PR author (default: true)

# Custom PR size labels for this repository (overrides global configuration)
# Define custom categories based on total lines changed (additions + deletions)
Expand All @@ -131,28 +131,35 @@ cherry-pick-assign-to-pr-author: true # Assign cherry-pick PRs to the original
# Always sorted last, regardless of definition order
pr-size-thresholds:
Quick:
threshold: 20 # PRs with 0-19 lines changed
threshold: 20 # PRs with 0-19 lines changed
color: lightgreen
Normal:
threshold: 100 # PRs with 20-99 lines changed
threshold: 100 # PRs with 20-99 lines changed
color: green
Complex:
threshold: 300 # PRs with 100-299 lines changed
threshold: 300 # PRs with 100-299 lines changed
color: orange
Critical:
threshold: 1000 # PRs with 300-999 lines changed
threshold: 1000 # PRs with 300-999 lines changed
color: darkred
Extreme:
threshold: inf # PRs with 1000+ lines changed (unbounded largest category)
color: black # 'inf' means no upper limit - catches all PRs above 1000 lines
threshold: inf # PRs with 1000+ lines changed (unbounded largest category)
color: black # 'inf' means no upper limit - catches all PRs above 1000 lines

# AI Features configuration
# Enables AI-powered enhancements (e.g., conventional title suggestions)
ai-features:
ai-provider: "claude" # claude | gemini | cursor
ai-model: "claude-opus-4-6[1m]"
conventional-title: "true" # "true": suggest in checkrun | "false": disabled | "fix": auto-update PR title

# PR Test Oracle integration (overrides global config)
# Analyzes PR diffs with AI and recommends which tests to run
# See: https://github.com/myk-org/pr-test-oracle
test-oracle:
server-url: "http://localhost:8000"
ai-provider: "claude" # claude | gemini | cursor
ai-model: "sonnet"
ai-provider: "claude" # claude | gemini | cursor
ai-model: "claude-opus-4-6[1m]"
test-patterns:
- "tests/**/*.py"
triggers:
Expand Down
51 changes: 32 additions & 19 deletions examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ auto-verified-and-merged-users:
- "renovate[bot]"
- "pre-commit-ci[bot]"

auto-verify-cherry-picked-prs: true # Default: true - automatically verify cherry-picked PRs. Set to false to require manual verification.
auto-verify-cherry-picked-prs: true # Default: true - automatically verify cherry-picked PRs. Set to false to require manual verification.

create-issue-for-new-pr: true # Global default: create tracking issues for new PRs
create-issue-for-new-pr: true # Global default: create tracking issues for new PRs

cherry-pick-assign-to-pr-author: true # Default: true - assign cherry-pick PRs to the original PR author
cherry-pick-assign-to-pr-author: true # Default: true - assign cherry-pick PRs to the original PR author

# Commands allowed on draft PRs (optional)
# If not set: commands are blocked on draft PRs (default behavior)
Expand Down Expand Up @@ -86,20 +86,20 @@ labels:
# Always sorted last, regardless of definition order
pr-size-thresholds:
Tiny:
threshold: 10 # PRs with 0-9 lines changed
threshold: 10 # PRs with 0-9 lines changed
color: lightgray
Small:
threshold: 50 # PRs with 10-49 lines changed
threshold: 50 # PRs with 10-49 lines changed
color: green
Medium:
threshold: 150 # PRs with 50-149 lines changed
threshold: 150 # PRs with 50-149 lines changed
color: orange
Large:
threshold: 300 # PRs with 150-299 lines changed
threshold: 300 # PRs with 150-299 lines changed
color: red
Massive:
threshold: inf # PRs with 300+ lines changed (unbounded largest category)
color: darkred # 'inf' means no upper limit - catches all PRs above 300 lines
threshold: inf # PRs with 300+ lines changed (unbounded largest category)
color: darkred # 'inf' means no upper limit - catches all PRs above 300 lines

branch-protection:
strict: True
Expand All @@ -114,15 +114,22 @@ branch-protection:
# See: https://github.com/myk-org/pr-test-oracle
test-oracle:
server-url: "http://localhost:8000"
ai-provider: "claude" # claude | gemini | cursor
ai-model: "sonnet"
ai-provider: "claude" # claude | gemini | cursor
ai-model: "claude-opus-4-6[1m]"
test-patterns:
- "tests/**/*.py"
triggers: # Default: [approved]
- approved # Run when PR gets approved
triggers: # Default: [approved]
- approved # Run when /approve command is used
# - pr-opened # Run when PR is opened
Comment thread
coderabbitai[bot] marked this conversation as resolved.
# - pr-synchronized # Run when new commits pushed

# AI Features configuration
# Enables AI-powered enhancements (e.g., conventional title suggestions)
ai-features:
ai-provider: "claude" # claude | gemini | cursor
ai-model: "claude-opus-4-6[1m]"
Comment thread
myakove marked this conversation as resolved.
conventional-title: "true" # "true": suggest in checkrun | "false": disabled | "fix": auto-update PR title

repositories:
my-repository:
name: my-org/my-repository
Expand Down Expand Up @@ -169,7 +176,7 @@ repositories:
auto-verified-and-merged-users: # override auto verified users per repository
- "my[bot]"

auto-verify-cherry-picked-prs: false # Disable auto-verification for cherry-picked PRs in this repository
auto-verify-cherry-picked-prs: false # Disable auto-verification for cherry-picked PRs in this repository

github-tokens: # override GitHub tokens per repository
- <GITHUB TOKEN1>
Expand Down Expand Up @@ -216,7 +223,7 @@ repositories:

# Allow commands on draft PRs (overrides global setting)
allow-commands-on-draft-prs:
- build-and-push-container # Allow building containers on draft PRs
- build-and-push-container # Allow building containers on draft PRs

# Repository-specific labels configuration (overrides global)
labels:
Expand All @@ -230,18 +237,24 @@ repositories:
# Repository-specific PR size labels (overrides global configuration)
pr-size-thresholds:
Express:
threshold: 25 # PRs with 0-24 lines changed
threshold: 25 # PRs with 0-24 lines changed
color: lightblue
Standard:
threshold: 100 # PRs with 25-99 lines changed
threshold: 100 # PRs with 25-99 lines changed
color: green
Premium:
threshold: 500 # PRs with 100-499 lines changed
color: orange # PRs with 500+ lines changed get this category
threshold: 500 # PRs with 100-499 lines changed
color: orange # PRs with 500+ lines changed get this category

set-auto-merge-prs:
- main

# AI Features configuration (overrides global)
# Enables AI-powered enhancements (e.g., conventional title suggestions)
# ai-features:
# ai-provider: "claude" # claude | gemini | cursor
# ai-model: "sonnet"

# PR Test Oracle (overrides global)
# See: https://github.com/myk-org/pr-test-oracle
test-oracle:
Expand Down
38 changes: 38 additions & 0 deletions webhook_server/config/schema.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
$schema: https://json-schema.org/draft-07/schema#
title: Webhook Server Configuration
$defs:
ai-features:
type: object
description: |
AI features configuration. Enables AI-powered enhancements such as
conventional title suggestions when validation fails.
Supported AI providers: claude, gemini, cursor.
properties:
ai-provider:
type: string
enum:
- claude
- gemini
- cursor
description: AI CLI provider to use
ai-model:
type: string
description: AI model identifier (e.g., claude-opus-4-6[1m], sonnet, gemini-2.5-pro)
conventional-title:
type: string
enum:
- "true"
- "false"
- "fix"
description: |
AI-powered conventional title suggestions.
- "true": Show AI-suggested title in check run output when validation fails
- "false": Disabled (default)
- "fix": Auto-fix PR title with AI suggestion when validation fails
default: "false"
required:
- ai-provider
- ai-model
additionalProperties: false
type: object
properties:
log-level:
Expand Down Expand Up @@ -143,6 +177,8 @@ properties:
- ai-provider
- ai-model
additionalProperties: false
ai-features:
$ref: '#/$defs/ai-features'
labels:
type: object
description: Configure which labels are enabled and their colors
Expand Down Expand Up @@ -505,6 +541,8 @@ properties:
- ai-provider
- ai-model
additionalProperties: false
ai-features:
$ref: '#/$defs/ai-features'
custom-check-runs:
type: array
description: |
Expand Down
Loading