Skip to content
Closed
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
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions .github/workflows/ai-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: AI Code Reviewer

on:
pull_request:
types: [opened, synchronize]

permissions:
contents: read
pull-requests: write

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Dependencies
run: |
pip install -r scripts/requirements.txt

- name: Run AI Reviewer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
run: |
python scripts/ai_reviewer.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
.temp_ag_kit/
antigravity-doc
tests
__pycache__
38 changes: 38 additions & 0 deletions docs/PLAN-ai-code-reviewer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Plan: Custom AI Code Reviewer (GitHub Actions + OpenRouter)

## Goal Description
Implement AI Code Reviewer using **OpenRouter** (Mistral) instead of Gemini. Fix dependency conflicts and ensure compliance with OpenRouter API standards.

## User Review Required
> [!IMPORTANT]
> **API Key**: Ensure `OPENROUTER_API_KEY` is set in GitHub Secrets.
> **Model**: Using `mistralai/devstral-2512:free` as requested (Note: verification of exact model ID recommended).

## Proposed Changes

### Dependencies
#### [MODIFY] [requirements.txt](file:///Users/nghialuutrung/Desktop/antigravity-kit/scripts/requirements.txt)
* Update `openai>=1.55.0` to resolve `httpx` proxy argument conflict.
* Keep `PyGithub`.

### Logic Script
#### [MODIFY] [ai_reviewer.py](file:///Users/nghialuutrung/Desktop/antigravity-kit/scripts/ai_reviewer.py)
* **Client Initialization**:
```python
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=api_key,
default_headers={
"HTTP-Referer": "https://github.com/hapo-nghialuu/antigravity-kit", # Attribution
"X-Title": "Antigravity AI Reviewer"
}
)
```
* **Model**: Set `MODEL_NAME = "mistralai/devstral-2512:free"`.
* **JSON Handling**: Add robust try-catch for JSON parsing as free models might chatter.

## Verification Plan

### Manual Verification
1. **Re-run GitHub Action**: Trigger the workflow again on the existing PR.
2. **Check Logs**: Verify "OpenRouter response received" and no 404/401 errors.
Loading