Add automated setup system for easy installation
All checks were successful
AI Codebase Quality Review / ai-codebase-review (push) Successful in 36s

- Add setup.sh interactive wizard for 5-minute setup
- Add INSTALL.md comprehensive installation guide
- Add templates/workflows/ directory with parameterized workflow templates
- Update README.md with prominent Installation section
- Update docs/README.md with installation links

The setup wizard automates:
- Platform selection (Gitea/GitHub)
- Bot configuration
- LLM provider setup
- Workflow file generation
- Configuration file creation

Users can now add OpenRabbit to any repository in under 5 minutes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-16 11:33:05 +00:00
parent b24ae0dcda
commit 95937c4738
9 changed files with 964 additions and 5 deletions

View File

@@ -0,0 +1,61 @@
name: AI Chat ({{BOT_USERNAME}})
# WORKFLOW ROUTING:
# This workflow handles FREE-FORM questions/chat (no specific command)
# Other workflows: ai-issue-triage.yml (@{{BOT_NAME}} triage), ai-comment-reply.yml (specific commands)
# This is the FALLBACK for any @{{BOT_NAME}} mention that isn't a known command
on:
issue_comment:
types: [created]
# CUSTOMIZE YOUR BOT NAME:
# Change '@{{BOT_NAME}}' in all conditions below to match your config.yml mention_prefix
# Examples: '@bartender', '@uni', '@joey', '@codebot'
jobs:
ai-chat:
# Only run if comment mentions the bot but NOT a specific command
# This prevents duplicate runs with ai-comment-reply.yml and ai-issue-triage.yml
# CRITICAL: Ignore bot's own comments to prevent infinite loops (bot username: {{BOT_USERNAME}})
if: |
{{PLATFORM}}.event.comment.user.login != '{{BOT_USERNAME}}' &&
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}}') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} triage') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} help') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} explain') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} suggest') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} security') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} summarize') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} changelog') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} explain-diff') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} review-again') &&
!contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} setup-labels')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: {{OPENRABBIT_REPO}}
path: .ai-review
token: ${{ secrets.AI_REVIEW_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install requests pyyaml
- name: Run AI Chat
env:
AI_REVIEW_TOKEN: ${{ secrets.AI_REVIEW_TOKEN }}
AI_REVIEW_REPO: ${{ {{PLATFORM}}.repository }}
AI_REVIEW_API_URL: {{API_URL}}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }}
SEARXNG_URL: ${{ secrets.SEARXNG_URL }}
run: |
cd .ai-review/tools/ai-review
python main.py comment ${{ {{PLATFORM}}.repository }} ${{ {{PLATFORM}}.event.issue.number }} "${{ {{PLATFORM}}.event.comment.body }}"

View File

@@ -0,0 +1,58 @@
name: AI Codebase Quality Review
on:
# Weekly scheduled run
schedule:
- cron: "0 0 * * 0" # Every Sunday at midnight
# Manual trigger
workflow_dispatch:
inputs:
report_type:
description: "Type of report to generate"
required: false
default: "full"
type: choice
options:
- full
- security
- quick
jobs:
ai-codebase-review:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for analysis
# Checkout central AI tooling
- uses: actions/checkout@v4
with:
repository: {{OPENRABBIT_REPO}}
path: .ai-review
token: ${{ secrets.AI_REVIEW_TOKEN }}
# Setup Python
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# Install dependencies
- run: pip install requests pyyaml
# Run AI codebase analysis
- name: Run AI Codebase Analysis
env:
AI_REVIEW_TOKEN: ${{ secrets.AI_REVIEW_TOKEN }}
AI_REVIEW_REPO: ${{ {{PLATFORM}}.repository }}
AI_REVIEW_API_URL: {{API_URL}}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }}
run: |
cd .ai-review/tools/ai-review
python main.py codebase ${{ {{PLATFORM}}.repository }}

View File

@@ -0,0 +1,98 @@
name: AI Comment Reply
# WORKFLOW ROUTING:
# This workflow handles SPECIFIC commands: help, explain, suggest, security, summarize, changelog, explain-diff, review-again, setup-labels
# Other workflows: ai-issue-triage.yml (@{{BOT_NAME}} triage), ai-chat.yml (free-form questions)
on:
issue_comment:
types: [created]
# CUSTOMIZE YOUR BOT NAME:
# Change '@{{BOT_NAME}}' in the 'if' condition below to match your config.yml mention_prefix
# Examples: '@bartender', '@uni', '@joey', '@codebot'
jobs:
ai-reply:
runs-on: ubuntu-latest
# Only run for specific commands (not free-form chat or triage)
# This prevents duplicate runs with ai-chat.yml and ai-issue-triage.yml
# CRITICAL: Ignore bot's own comments to prevent infinite loops (bot username: {{BOT_USERNAME}})
if: |
{{PLATFORM}}.event.comment.user.login != '{{BOT_USERNAME}}' &&
(contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} help') ||
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} explain') ||
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} suggest') ||
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} security') ||
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} summarize') ||
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} changelog') ||
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} explain-diff') ||
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} review-again') ||
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} setup-labels'))
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: {{OPENRABBIT_REPO}}
path: .ai-review
token: ${{ secrets.AI_REVIEW_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install requests pyyaml
- name: Run AI Comment Response
env:
AI_REVIEW_TOKEN: ${{ secrets.AI_REVIEW_TOKEN }}
AI_REVIEW_API_URL: {{API_URL}}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }}
run: |
cd .ai-review/tools/ai-review
# Determine if this is a PR or issue comment
IS_PR="${{ {{PLATFORM}}.event.issue.pull_request != null }}"
REPO="${{ {{PLATFORM}}.repository }}"
ISSUE_NUMBER="${{ {{PLATFORM}}.event.issue.number }}"
# Validate inputs
if [ -z "$REPO" ] || [ -z "$ISSUE_NUMBER" ]; then
echo "Error: Missing required parameters"
exit 1
fi
# Validate repository format (owner/repo)
if ! echo "$REPO" | grep -qE '^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$'; then
echo "Error: Invalid repository format: $REPO"
exit 1
fi
if [ "$IS_PR" = "true" ]; then
# This is a PR comment - use safe dispatch with minimal event data
# Build minimal event payload (does not include sensitive user data)
EVENT_DATA=$(cat <<EOF
{
"action": "created",
"issue": {
"number": ${{ {{PLATFORM}}.event.issue.number }},
"pull_request": {}
},
"comment": {
"id": ${{ {{PLATFORM}}.event.comment.id }},
"body": $(echo '${{ {{PLATFORM}}.event.comment.body }}' | jq -Rs .)
}
}
EOF
)
# Use safe dispatch utility
python utils/safe_dispatch.py issue_comment "$REPO" "$EVENT_DATA"
else
# This is an issue comment - use the comment command
COMMENT_BODY='${{ {{PLATFORM}}.event.comment.body }}'
python main.py comment "$REPO" "$ISSUE_NUMBER" "$COMMENT_BODY"
fi

View File

@@ -0,0 +1,44 @@
name: AI Issue Triage
# WORKFLOW ROUTING:
# This workflow handles ONLY the 'triage' command
# Other workflows: ai-comment-reply.yml (specific commands), ai-chat.yml (free-form questions)
on:
issue_comment:
types: [created]
jobs:
ai-triage:
runs-on: ubuntu-latest
# Only run if comment contains @{{BOT_NAME}} triage
# CRITICAL: Ignore bot's own comments to prevent infinite loops (bot username: {{BOT_USERNAME}})
if: |
{{PLATFORM}}.event.comment.user.login != '{{BOT_USERNAME}}' &&
contains({{PLATFORM}}.event.comment.body, '@{{BOT_NAME}} triage')
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: {{OPENRABBIT_REPO}}
path: .ai-review
token: ${{ secrets.AI_REVIEW_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install requests pyyaml
- name: Run AI Issue Triage
env:
AI_REVIEW_TOKEN: ${{ secrets.AI_REVIEW_TOKEN }}
AI_REVIEW_REPO: ${{ {{PLATFORM}}.repository }}
AI_REVIEW_API_URL: {{API_URL}}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }}
run: |
cd .ai-review/tools/ai-review
python main.py issue ${{ {{PLATFORM}}.repository }} ${{ {{PLATFORM}}.event.issue.number }}

View File

@@ -0,0 +1,53 @@
name: Enterprise AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
ai-review:
runs-on: ubuntu-latest
steps:
# Checkout the PR repository
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Checkout the CENTRAL AI tooling repo
- uses: actions/checkout@v4
with:
repository: {{OPENRABBIT_REPO}}
path: .ai-review
token: ${{ secrets.AI_REVIEW_TOKEN }}
# Setup Python
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# Install dependencies
- run: pip install requests pyyaml
# Run the AI review
- name: Run Enterprise AI Review
env:
AI_REVIEW_TOKEN: ${{ secrets.AI_REVIEW_TOKEN }}
AI_REVIEW_REPO: ${{ {{PLATFORM}}.repository }}
AI_REVIEW_API_URL: {{API_URL}}
AI_REVIEW_PR_NUMBER: ${{ {{PLATFORM}}.event.pull_request.number }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }}
run: |
cd .ai-review/tools/ai-review
python main.py pr ${{ {{PLATFORM}}.repository }} ${{ {{PLATFORM}}.event.pull_request.number }} \
--title "${{ {{PLATFORM}}.event.pull_request.title }}"
# Fail CI on HIGH severity (optional)
- name: Check Review Result
if: failure()
run: |
echo "AI Review found HIGH severity issues. Please address them before merging."
exit 1