跳到正文
GitHub·· 8 天前AI 评分62

alex-mvp 发布 Alex:像资深工程师一样审查每个 PR

niihhhall/alex-mvp

AI 导读

GitHub 项目 niihhhall/alex-mvp 发布 Alex,一个像资深工程师一样审查每个 PR 的 GitHub Action,每次审查会发布摘要卡片、行内评论和状态检查。

正文

Alex: AI code review that explains itself

status license python github action

Alex reviews every pull request like a senior engineer:
a verdict you can read in five seconds, and the exact fix in thirty.


What a review looks like

Example Alex review card

Every review posts three things:

Summary card Impact, merge verdict, confidence score from 0 to 5, numbered findings, file breakdown, a diagram of the change, and a review counter. Updated in place on every re-review.
Inline comments On the exact line, with 🔴 P0, 🟠 P1 or 🟡 P2 badges and a one-click Commit suggestion fix. Never posted twice.
Status check Alex review · Confidence 4/5 · 1 P1 on the commit. Can block merging while a P0 is open.

The confidence score is the model's judgment inside hard limits, so it can never contradict the findings: any P0 caps it at 2, two P1s at 3, one P1 at 4. Details in the design system.

How it works

flowchart LR
  A["PR opened or /alex"] --> B["Gate: trusted author, not a draft"]
  B --> C["Engine reads the diff and the repo"]
  C --> D["Card: summary, score, diagram"]
  D --> E["Inline comments, card, status check"]

Loading

Alex checks out the base branch and reads PR code as git objects. It never runs code from the PR, so it is safe on untrusted changes.

Add Alex to a repo

  1. Copy examples/workflows/alex-review.yml to .github/workflows/alex-review.yml.
  2. Add the repo secret ALEX_LLM_API_KEY: any OpenAI-compatible key. The default endpoint is Fireworks.
  3. Open a pull request. Alex reacts 👀, reviews, then 👍.
Command What it does
/alex Review the PR again

More commands (/alex review this at plus, questions, explain, tests) arrive in phase 2.

Optional: a bot with its own name and avatar

Create a GitHub App (permissions: Contents read, Pull requests write, Issues write, Commit statuses write), install it on your repos, then set the variable ALEX_APP_ID and the secret ALEX_APP_PRIVATE_KEY. Use docs/assets/alex-logo.svg as the avatar.

Action inputs

Input Default
llm_api_key required API key, from a secret
llm_url Fireworks OpenAI-compatible base URL
model DeepSeek V4.1 Flash Model that finds issues
card_model same as model Model that writes the card
token_budget 1500000 Spending cap per review
fail_on_p0 true Status check fails while a P0 is open
engine_version 1.12.10 Pinned engine version
app_id, app_private_key empty Optional bot identity

Roadmap

Alex is built phase by phase, and each phase is compared side by side with Greptile on a lab repo of real historical bugs.

Phase Scope
1 Triggers, summary card, inline comments, safety gate, status check ✅ done (comparison)
2 @alexreview-ai bot identity, review tiers (base, plus, apex), .alex/ config, install anywhere, questions planned
3 Security scan, auto-approve, related-repo context planned
4 Learning from reactions and replies, analytics, CLI planned
5 Run tests in a sandbox, codebase index, hosted app optional

Full plan: docs/blueprint.md.

Repository layout

alex/                 review logic: card, scoring, inline comments, GitHub client
tests/                unit tests
action.yml            the GitHub Action
examples/workflows/   workflow file to copy into a repo
docs/                 blueprint, design system, lab cases, comparisons, assets
evals/aacr/           AACR-Bench harness (industry benchmark)
evals/lab/            lab tooling: run the engine on a case, redact and scan snapshots
scripts/              developer helpers

Develop

python -m unittest discover -s tests -v
python -m alex.main preview --ocr-json engine.json --diff pr.diff --title "PR title" --out out --no-llm

Standard library only, nothing to install. Conventions: docs/engineering.md.

License

MIT

来源:GitHub · github.com