wonder 6f0fabf934
Deploy PR-Helper / deploy (push) Successful in 2m20s
refactor: 合并 AI 评审按钮到审查 Tab,移除重复入口
- 移除 Diff 视图中的「🤖 AI 评审」按钮及行内进度/总结区域
- Review Tab 的「开始审查」现在具备行内 Diff 建议插入能力
- 合并 startInlineReview 到 startReview,统一 SSE 流和变量
- 移除独立的 review-diff-container,建议直接插入 Diff Tab 的 diff 视图
- 完成后 Review Tab 显示总结/备注/卡片,Diff Tab 显示行内建议
2026-06-23 22:10:35 +08:00
2026-06-18 21:53:05 +08:00

PR-Helper

AI-powered PR description generator and code review tool. Self-hosted, designed for internal/local use.

Features

  • PR Description Generation — Select commits from an interactive Git graph, get a structured PR description via LLM
  • AI Code Review — Per-file analysis with severity ratings, inline suggestions on the diff view
  • Interactive Git Graph — D3.js visualization with click-to-select base/head refs
  • Diff Viewer — Split/unified view powered by diff2html with syntax highlighting
  • Review Notes — Add markdown notes at overall, file, or suggestion level
  • PDF Export — Generate printable review reports
  • Repository Caching — Cloned repos are cached with configurable expiry

Quick Start

docker compose up --build

Open http://localhost:8080.

Manual Build

Requirements: Go 1.22+, CGO enabled (for SQLite), Chromium (for PDF export)

# Install dependencies
go mod download

# Build
CGO_ENABLED=1 go build -o pr-helper .

# Run
./pr-helper

Server listens on :8080 by default.

Configuration

LLM Settings (required)

Navigate to Settings (/settings) and configure:

Setting Description Default
API Endpoint OpenAI-compatible API URL https://api.openai.com/v1
API Key Your API key (empty)
Model Model name gpt-4o

Works with any OpenAI-compatible API: OpenAI, Deepseek, Ollama, vLLM, etc.

Review Settings

Setting Description Default
Top-N Files Max files to analyze per review (0 = all) 20
Concurrency Parallel file analyses 5

Cache Settings

Setting Description Default
Max Age (days) Auto-cleanup threshold 7
Max Size (MB) Total cache size limit 5000

Environment Variables

Variable Description Default
PORT Server port 8080
GIN_MODE Gin mode (debug/release) debug
DATA_DIR Data directory path ./data
CHROME_BIN Chromium binary path (for PDF) /usr/bin/chromium-browser

Usage

  1. Clone a repo — Paste a Git URL on the homepage, optionally provide credentials for private repos
  2. Browse the graph — View branches, tags, and commit history in the interactive D3.js graph
  3. Select refs — Click nodes in the graph or use the dropdown selectors to pick base and head
  4. Generate PR description — Navigate to Generate, select refs, click Generate
  5. Run code review — Navigate to Review, configure Top-N and concurrency, click Start Review
  6. Add notes — Click into any suggestion or the overall section to add markdown notes
  7. Export PDF — Click Export PDF to download a formatted report

API Routes

Pages

Method Path Description
GET / Homepage — clone form and cached repos
GET /repo/:id Repository — Git graph and diff viewer
GET /repo/:id/generate PR description generation
GET /repo/:id/review AI code review
GET /settings Settings page

API

Method Path Description
POST /api/repos Clone repository (SSE stream)
GET /api/repos List cached repositories
DELETE /api/repos/:id Delete repository cache
POST /api/repos/:id/cleanup Trigger cache cleanup
GET /api/repos/:id/graph Git graph data (JSON)
GET /api/repos/:id/refs Branches and tags
GET /api/repos/:id/commits Commit log for a ref
GET /api/repos/:id/diff Diff between two refs
POST /api/repos/:id/generate Generate PR description (SSE)
POST /api/repos/:id/review AI code review (SSE)
GET /api/repos/:id/review/analyses List past reviews
GET /api/repos/:id/review/analyses/:aid Get single review
POST /api/repos/:id/review/notes Save a review note
GET /api/repos/:id/review/notes Get review notes
POST /api/repos/:id/review/pdf Generate PDF report
GET /api/settings Get settings
PUT /api/settings Update settings

Tech Stack

  • Backend: Go, Gin, SQLite (go-sqlite3), go-git, chromedp
  • Frontend: Go html/template, HTMX, D3.js, diff2html, Tailwind CSS
  • LLM: OpenAI-compatible API with SSE streaming

Security

No authentication. Do not expose to the public internet. Intended for internal/local use only.

License

MIT

S
Description
🤗 帮助生成 PR 信息,Review 代码
http://47.121.181.112:8081/
Readme MIT 1.3 MiB
Languages
Go 41.3%
HTML 27.3%
JavaScript 26.9%
CSS 2.9%
Shell 1.4%
Other 0.2%