update
All checks were successful
Enterprise AI Code Review / ai-review (pull_request) Successful in 32s

This commit is contained in:
2025-12-28 14:10:04 +00:00
parent c17a61b27a
commit 69d9963597
17 changed files with 627 additions and 444 deletions

118
README.md
View File

@@ -1,6 +1,6 @@
# OpenRabbit
Enterprise-grade AI code review system for **GitHub** and **Gitea** with automated PR review, issue triage, interactive chat (Bartender), and codebase analysis.
Enterprise-grade AI code review system for **Gitea** with automated PR review, issue triage, interactive chat, and codebase analysis.
---
@@ -9,13 +9,13 @@ Enterprise-grade AI code review system for **GitHub** and **Gitea** with automat
| Feature | Description |
|---------|-------------|
| **PR Review** | Inline comments, security scanning, severity-based CI failure |
| **Issue Triage** | Auto-classification, labeling, priority assignment |
| **Chat (Bartender)** | Interactive AI chat with codebase search and web search tools |
| **@ai-bot Commands** | `@ai-bot summarize`, `explain`, `suggest` in issue comments |
| **Issue Triage** | On-demand classification, labeling, priority assignment via `@codebot triage` |
| **Chat** | Interactive AI chat with codebase search and web search tools |
| **@codebot Commands** | `@codebot summarize`, `explain`, `suggest`, `triage` in issue comments |
| **Codebase Analysis** | Health scores, tech debt tracking, weekly reports |
| **Security Scanner** | 17 OWASP-aligned rules for vulnerability detection |
| **Enterprise Ready** | Audit logging, metrics, Prometheus export |
| **Multi-Platform** | Works with both GitHub and Gitea |
| **Gitea Native** | Built for Gitea workflows and API |
---
@@ -38,49 +38,14 @@ The built-in `GITHUB_TOKEN` is used automatically.
### 2. Add Workflows to Repository
Workflows are provided for both platforms:
| Platform | Location |
|----------|----------|
| GitHub | `.github/workflows/` |
| Gitea | `.gitea/workflows/` |
#### GitHub Example
```yaml
# .github/workflows/ai-review.yml
name: AI PR Review
on: [pull_request]
jobs:
ai-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install requests pyyaml
- name: Run AI Review
env:
AI_REVIEW_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_REVIEW_REPO: ${{ github.repository }}
AI_REVIEW_API_URL: https://api.github.com
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
cd tools/ai-review
python main.py pr ${{ github.repository }} ${{ github.event.pull_request.number }}
```
Workflows are located in `.gitea/workflows/`.
#### Gitea Example
#### Gitea PR Review Workflow
```yaml
# .gitea/workflows/ai-review.yml
# .gitea/workflows/enterprise-ai-review.yml
name: AI PR Review
on: [pull_request]
@@ -115,7 +80,7 @@ jobs:
python main.py pr ${{ gitea.repository }} ${{ gitea.event.pull_request.number }}
```
For full workflow examples, see [Workflows Documentation](docs/workflows.md).
See `.gitea/workflows/` for all workflow examples.
### 3. Create Labels
@@ -132,10 +97,10 @@ Create these labels in your repository for auto-labeling:
tools/ai-review/
├── agents/ # Agent implementations
│ ├── base_agent.py # Abstract base agent
│ ├── issue_agent.py # Issue triage & @ai-bot commands
│ ├── issue_agent.py # Issue triage & @codebot commands
│ ├── pr_agent.py # PR review with security scan
│ ├── codebase_agent.py # Codebase health analysis
│ └── chat_agent.py # Bartender chat with tool calling
│ └── chat_agent.py # Interactive chat with tool calling
├── clients/ # API clients
│ ├── gitea_client.py # Gitea REST API wrapper
│ └── llm_client.py # Multi-provider LLM client with tool support
@@ -152,8 +117,8 @@ tools/ai-review/
├── ai-review.yml # PR review workflow
├── ai-issue-triage.yml # Issue triage workflow
├── ai-codebase-review.yml # Codebase analysis
├── ai-comment-reply.yml # @ai-bot command responses
└── ai-chat.yml # Bartender chat
├── ai-comment-reply.yml # @codebot command responses
└── ai-chat.yml # Interactive AI chat
.gitea/workflows/ # Gitea Actions workflows
├── enterprise-ai-review.yml
@@ -174,35 +139,36 @@ python main.py pr owner/repo 123
# Triage an issue
python main.py issue owner/repo 456
# Respond to @ai-bot command
python main.py comment owner/repo 456 "@ai-bot explain"
# Respond to @codebot command
python main.py comment owner/repo 456 "@codebot explain"
# Analyze codebase
python main.py codebase owner/repo
# Chat with Bartender
# Chat with the AI bot
python main.py chat owner/repo "How does authentication work?"
python main.py chat owner/repo "Find all API endpoints" --issue 789
```
---
## @ai-bot Commands
## @codebot Commands
In any issue comment:
| Command | Description |
|---------|-------------|
| `@ai-bot summarize` | Summarize the issue in 2-3 sentences |
| `@ai-bot explain` | Explain what the issue is about |
| `@ai-bot suggest` | Suggest solutions or next steps |
| `@ai-bot` (any question) | Chat with Bartender using codebase/web search |
| `@codebot triage` | Full issue triage with auto-labeling and analysis |
| `@codebot summarize` | Summarize the issue in 2-3 sentences |
| `@codebot explain` | Explain what the issue is about |
| `@codebot suggest` | Suggest solutions or next steps |
| `@codebot` (any question) | Chat with AI using codebase/web search tools |
---
## Bartender Chat
## Interactive Chat
Bartender is an interactive AI assistant with tool-calling capabilities:
The chat agent is an interactive AI assistant with tool-calling capabilities:
**Tools Available:**
- `search_codebase` - Search repository files and code
@@ -211,10 +177,10 @@ Bartender is an interactive AI assistant with tool-calling capabilities:
**Example:**
```
@ai-bot How do I configure rate limiting in this project?
@codebot How do I configure rate limiting in this project?
```
Bartender will search the codebase, read relevant files, and provide a comprehensive answer.
The bot will search the codebase, read relevant files, and provide a comprehensive answer.
---
@@ -242,12 +208,11 @@ agents:
enabled: true
chat:
enabled: true
name: "Bartender"
searxng_url: "" # Or set SEARXNG_URL env var
interaction:
respond_to_mentions: true
mention_prefix: "@ai-bot" # Customize your bot name here!
mention_prefix: "@codebot" # Customize your bot name here!
commands:
- summarize
- explain
@@ -258,34 +223,25 @@ interaction:
## Customizing the Bot Name
You can change the bot's mention trigger from `@ai-bot` to any name you prefer:
The default bot name is `@codebot`. To change it:
**Step 1:** Edit `tools/ai-review/config.yml`:
```yaml
interaction:
mention_prefix: "@bartender" # or "@uni", "@joey", "@codebot", etc.
mention_prefix: "@yourname" # e.g., "@assistant", "@reviewer", etc.
```
**Step 2:** Update the workflow files to match:
**Step 2:** Update all workflow files in `.gitea/workflows/`:
- `ai-comment-reply.yml`
- `ai-chat.yml`
- `ai-issue-triage.yml`
For GitHub (`.github/workflows/ai-comment-reply.yml` and `ai-chat.yml`):
Look for and update:
```yaml
if: contains(github.event.comment.body, '@bartender')
if: contains(github.event.comment.body, '@codebot')
```
For Gitea (`.gitea/workflows/ai-comment-reply.yml` and `ai-chat.yml`):
```yaml
if: contains(github.event.comment.body, '@bartender')
```
**Example bot names:**
| Name | Use Case |
|------|----------|
| `@bartender` | Friendly, conversational |
| `@uni` | Short, quick to type |
| `@joey` | Personal assistant feel |
| `@codebot` | Technical, code-focused |
| `@reviewer` | Review-focused |
Change `@codebot` to your new bot name.
---