Skip to content
Open
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
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ body:
label: Installation Method
options:
- npm (global)
- Homebrew
- MacPorts
- GitHub Release binary
- Built from source
validations:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@ name: CI
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- '**/LICENSE'
- '**/.gitignore'
pull_request:
branches: [main]
paths-ignore:
- '**.md'
- '**/LICENSE'
- '**/.gitignore'

permissions:
contents: read
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
branches: [main]
paths:
- 'pages/**'
- 'install.sh'
- 'install.ps1'
- '.github/workflows/deploy-pages.yml'
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -45,16 +42,6 @@ jobs:
mkdir -p _site
cp -r pages/dist/* _site/
cp pages/logo.svg _site/logo.svg
cp install.sh _site/install.sh
cp install.ps1 _site/install.ps1

- name: Verify install scripts
run: |
test -f _site/install.sh
test -f _site/install.ps1
sh -n _site/install.sh
cmp install.sh _site/install.sh
cmp install.ps1 _site/install.ps1

- uses: actions/upload-pages-artifact@v5
with:
Expand Down
2 changes: 0 additions & 2 deletions README.ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ Gitのdiffを読み取り、変更されたファイルをツール利用機能

実際のコードレビューに基づくベンチマーク。**50**の人気オープンソースリポジトリから**200**の実際のPull Requestを厳選し、**10**のプログラミング言語をカバー——80人以上のシニアエンジニアによるクロスバリデーション(**1,505**件のアノテーション済み欠陥)。

<a href="https://huggingface.co/datasets/Alibaba-Aone/aacr-bench"><img src="https://huggingface.co/favicon.ico" alt="Hugging Face" width="20" height="20" /> Hugging FaceでAACR-Benchデータセットを見る</a>。

| 指標 | 測定内容 | 重要性 |
|------|----------|--------|
| **F1** | 精度とリコールの調和平均 | レビュー品質を示す最良の単一指標 |
Expand Down
2 changes: 0 additions & 2 deletions README.ko-KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ Open Code Review는 AI 기반 코드 리뷰 CLI 도구입니다. Alibaba Group

실제 코드 리뷰 기반 벤치마크. **50**개 인기 오픈소스 저장소에서 **200**개 실제 Pull Request를 엄선하고, **10**개 프로그래밍 언어를 커버 — 80명 이상의 시니어 엔지니어가 교차 검증(**1,505**개 어노테이션된 결함).

<a href="https://huggingface.co/datasets/Alibaba-Aone/aacr-bench"><img src="https://huggingface.co/favicon.ico" alt="Hugging Face" width="20" height="20" /> Hugging Face에서 AACR-Bench 데이터셋 살펴보기</a>.

| 지표 | 측정 내용 | 중요한 이유 |
|------|-----------|-------------|
| **F1** | 정밀도와 재현율의 조화 평균 | 리뷰 품질을 나타내는 최적의 단일 지표 |
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ Visit the [official website](https://open-codereview.ai) for more details.

A real-world code review benchmark built from **50** popular open-source repositories, **200** real Pull Requests, and **10** programming languages — cross-validated by 80+ senior engineers (**1,505** annotated ground-truth issues).

<a href="https://huggingface.co/datasets/Alibaba-Aone/aacr-bench"><img src="https://huggingface.co/favicon.ico" alt="Hugging Face" width="20" height="20" /> Explore the AACR-Bench dataset on Hugging Face</a>.

| Metric | What it measures | Why it matters |
|--------|-----------------|----------------|
| **F1** | Harmonic mean of precision and recall | Best single number for overall review quality |
Expand Down
2 changes: 0 additions & 2 deletions README.ru-RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ Open Code Review — это CLI-инструмент для код-ревью н

Бенчмарк собран на основе реальных код-ревью и включает **50** популярных open-source-репозиториев, **200** реальных пул-реквестов и **10** языков программирования. Разметку из **1 505** дефектов перекрёстно проверили более 80 ведущих инженеров.

<a href="https://huggingface.co/datasets/Alibaba-Aone/aacr-bench"><img src="https://huggingface.co/favicon.ico" alt="Hugging Face" width="20" height="20" /> Открыть датасет AACR-Bench на Hugging Face</a>.

| Метрика | Что измеряет | Почему важна |
|---------|-------------|--------------|
| **F1** | Гармоническое среднее precision и recall | Лучший единый показатель качества ревью |
Expand Down
2 changes: 0 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ Open Code Review 是一款 AI 驱动的代码审查 CLI 工具。它的前身是

基于真实场景的代码审查基准测试,从 **50** 个热门开源仓库中精选 **200** 个真实的 Pull Request,覆盖 **10** 种编程语言——由 80+ 位资深工程师交叉标注验证(共 **1,505** 个标注缺陷)。

<a href="https://huggingface.co/datasets/Alibaba-Aone/aacr-bench"><img src="https://huggingface.co/favicon.ico" alt="Hugging Face" width="20" height="20" /> 在 Hugging Face 上探索 AACR-Bench 数据集</a>。

| 指标 | 含义 | 为什么重要 |
|------|------|-----------|
| **F1** | 准确率与召回率的调和均值 | 综合衡量审查质量的最佳单一指标 |
Expand Down
10 changes: 1 addition & 9 deletions cmd/opencodereview/compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@

package main

import (
"context"

"github.com/spf13/cobra"
)

func executeReview(opts reviewOptions) error {
return executeReviewContext(context.Background(), opts)
}
import "github.com/spf13/cobra"

// parseReviewFlags provides test compatibility: parses args through a fresh
// cobra command instance and returns the resulting reviewOptions.
Expand Down
31 changes: 16 additions & 15 deletions cmd/opencodereview/review_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"os"
"os/signal"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -47,8 +46,9 @@ type reviewOptions struct {
maxGitProcs int
maxTokens int
maxTokensBudget int
noFilter bool
preview bool
noFilter bool
preview bool
resumeIncremental bool
}

var reviewOpts reviewOptions
Expand Down Expand Up @@ -97,17 +97,15 @@ var reviewCmd = &cobra.Command{
if err := validateReviewOptions(&reviewOpts); err != nil {
return err
}
ctx, stop := signal.NotifyContext(cmd.Context(), os.Interrupt)
defer stop()
return executeReviewContext(ctx, reviewOpts)
return executeReview(reviewOpts)
},
}

func init() {
registerReviewFlags(reviewCmd, &reviewOpts)
}

func executeReviewContext(ctx context.Context, opts reviewOptions) error {
func executeReview(opts reviewOptions) error {
cc, err := loadCommonContext(opts.repoDir, opts.rulePath, opts.maxTools, opts.maxGitProcs, true)
if err != nil {
return err
Expand Down Expand Up @@ -140,7 +138,7 @@ func executeReviewContext(ctx context.Context, opts reviewOptions) error {
}

if opts.preview {
return runPreviewContext(ctx, cc, opts)
return runPreview(cc, opts)
}

resumeState, err := loadReviewResumeState(cc.RepoDir, opts)
Expand All @@ -165,7 +163,7 @@ func executeReviewContext(ctx context.Context, opts reviewOptions) error {
// Strictly before agent.New, so a rejected resume persists nothing. The sealed
// input it returns pins the run to the very commits this check passed on, so
// the decision cannot be undone by a ref moving afterwards.
sealed, err := validateResumeIdentity(ctx, cc, opts, rt, resumeState)
sealed, err := validateResumeIdentity(context.Background(), cc, opts, rt, resumeState)
if err != nil {
return err
}
Expand All @@ -189,7 +187,7 @@ func executeReviewContext(ctx context.Context, opts reviewOptions) error {
}
tools := buildToolRegistry(rt.Collector, fileReader)

mcpClients := initMCPClients(ctx, rt.AppCfg, tools, cc.RepoDir, Version)
mcpClients := initMCPClients(context.Background(), rt.AppCfg, tools, cc.RepoDir, Version)
defer func() {
for _, mc := range mcpClients {
if err := mc.Close(); err != nil {
Expand Down Expand Up @@ -235,7 +233,7 @@ func executeReviewContext(ctx context.Context, opts reviewOptions) error {
q := newQuietHandle(opts.outputFormat, opts.audience)
defer q.Restore()

runCtx, span := telemetry.StartSpan(telemetry.ContextWithTraceParentFromEnv(ctx), "review.run")
ctx, span := telemetry.StartSpan(telemetry.ContextWithTraceParentFromEnv(context.Background()), "review.run")
defer span.End()
telemetry.SetAttr(span, "review.repo", cc.RepoDir)
telemetry.SetAttr(span, "review.from", opts.from)
Expand All @@ -250,7 +248,7 @@ func executeReviewContext(ctx context.Context, opts reviewOptions) error {
}
startTime := time.Now()

comments, runErr := ag.Run(runCtx)
comments, runErr := ag.Run(ctx)
manifest := ag.RunManifest()

// Freeze the retry report at the same boundary as the manifest: ag.Run has
Expand Down Expand Up @@ -280,7 +278,7 @@ func executeReviewContext(ctx context.Context, opts reviewOptions) error {
var emitErr error
emitted := manifest != nil || runErr == nil
if emitted {
emitErr = emitRunResult(runCtx, ag, comments, startTime, opts.outputFormat, opts.audience, q, llmIdentity, retryReport)
emitErr = emitRunResult(ctx, ag, comments, startTime, opts.outputFormat, opts.audience, q, llmIdentity, retryReport)
if emitErr != nil {
emitErr = fmt.Errorf("emit review result: %w", emitErr)
}
Expand Down Expand Up @@ -396,6 +394,9 @@ func validateResumeIdentity(ctx context.Context, cc *commonContext, opts reviewO
Model: rt.Model,
ProviderExplicit: opts.provider != "",
ModelExplicit: opts.model != "",
Incremental: opts.resumeIncremental,
ResolvedBase: sealed.Resolution.ResolvedBase,
PerFileMaxTokens: cc.Template.MaxTokens,
}); err != nil {
return nil, err
}
Expand Down Expand Up @@ -481,8 +482,8 @@ func validateReviewRefs(repoDir string, opts reviewOptions) error {
return nil
}

func runPreviewContext(ctx context.Context, cc *commonContext, opts reviewOptions) error {
preview, err := agent.Preview(ctx, agent.Args{
func runPreview(cc *commonContext, opts reviewOptions) error {
preview, err := agent.Preview(context.Background(), agent.Args{
RepoDir: cc.RepoDir,
From: opts.from,
To: opts.to,
Expand Down
4 changes: 0 additions & 4 deletions cmd/opencodereview/review_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import (
"github.com/alibaba/open-code-review/internal/tool"
)

func runPreview(cc *commonContext, opts reviewOptions) error {
return runPreviewContext(context.Background(), cc, opts)
}

func TestRunPreview(t *testing.T) {
dir := initTestGitRepo(t)
gitCommitFile(t, dir, "x.go", "package x\n", "add x")
Expand Down
14 changes: 3 additions & 11 deletions cmd/opencodereview/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,17 +403,9 @@ func emitRunResult(
}

if !machineReadable {
telemetry.PrintTraceSummary(telemetry.TraceSummary{
FilesReviewed: ag.FilesReviewed(),
CommentsGenerated: int64(len(comments)),
InputTokens: ag.TotalInputTokens(),
OutputTokens: ag.TotalOutputTokens(),
TotalTokens: ag.TotalTokensUsed(),
CacheReadTokens: ag.TotalCacheReadTokens(),
CacheWriteTokens: ag.TotalCacheWriteTokens(),
Duration: duration,
SessionID: ag.SessionID(),
})
telemetry.PrintTraceSummary(ag.FilesReviewed(), int64(len(comments)),
ag.TotalInputTokens(), ag.TotalOutputTokens(), ag.TotalTokensUsed(),
ag.TotalCacheReadTokens(), ag.TotalCacheWriteTokens(), duration)
}

if outputFormat == "json" {
Expand Down
10 changes: 10 additions & 0 deletions cmd/opencodereview/shared_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ func validateReviewOptions(opts *reviewOptions) error {
if opts.preview && opts.resume != "" {
return fmt.Errorf("--preview and --resume cannot be used together")
}
if opts.preview && opts.resumeIncremental {
return fmt.Errorf("--preview and --resume-incremental cannot be used together")
}
if opts.resumeIncremental && opts.resume == "" {
return fmt.Errorf("--resume-incremental requires --resume <session-id>")
}
if opts.resumeIncremental && (opts.from == "" || opts.to == "") {
return fmt.Errorf("--resume-incremental is only supported in range mode (--from and --to)")
}
if err := validateAudience(opts.audience); err != nil {
return err
}
Expand Down Expand Up @@ -172,6 +181,7 @@ func registerReviewFlags(cmd *cobra.Command, opts *reviewOptions) {
addDiffFlags(cmd, &opts.from, &opts.to, &opts.commit)
cmd.Flags().StringVar(&opts.resume, "resume", "", "resume from a previous review session id")
cmd.RegisterFlagCompletionFunc("resume", completeSessionIDs)
cmd.Flags().BoolVar(&opts.resumeIncremental, "resume-incremental", false, "allow resuming range mode when the head commit has moved (reuses unchanged file reviews)")
addExcludeFlag(cmd, &opts.excludes)
addOutputFlags(cmd, &opts.outputFormat, &opts.audience)
addConcurrencyFlags(cmd, &opts.concurrency, &opts.perFileTimeout, &opts.maxTools, &opts.maxGitProcs, &opts.maxTokens, &opts.maxTokensBudget)
Expand Down
4 changes: 2 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Install the ocr (Open Code Review) CLI from GitHub releases on Windows.
# irm https://open-codereview.ai/install.ps1 | iex
# irm https://raw.githubusercontent.com/alibaba/open-code-review/main/install.ps1 | iex
# Prefer to inspect first:
# irm https://open-codereview.ai/install.ps1 -OutFile install.ps1
# irm https://raw.githubusercontent.com/alibaba/open-code-review/main/install.ps1 -OutFile install.ps1
# notepad install.ps1 # review, then: .\install.ps1
# Env: OCR_INSTALL_DIR (default $env:LOCALAPPDATA\Programs\ocr), OCR_VERSION (default latest).
# Requires PowerShell 5.1+ or PowerShell 7+.
Expand Down
6 changes: 3 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# Copyright 2026 alibaba/open-code-review Contributors

# Install the ocr (Open Code Review) CLI from GitHub releases.
# curl -fsSL https://open-codereview.ai/install.sh | sh
# curl -fsSL https://raw.githubusercontent.com/alibaba/open-code-review/main/install.sh | sh
# Prefer to inspect first:
# curl -fsSL https://open-codereview.ai/install.sh -o install.sh
# curl -fsSL https://raw.githubusercontent.com/alibaba/open-code-review/main/install.sh -o install.sh
# less install.sh && sh install.sh
# Env: OCR_INSTALL_DIR (default /usr/local/bin), OCR_VERSION (default latest).
set -eu
Expand All @@ -23,7 +23,7 @@ main() {
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "$os" in
darwin|linux) ;;
*) err "unsupported OS: $os (on Windows use: irm https://open-codereview.ai/install.ps1 | iex)" ;;
*) err "unsupported OS: $os (on Windows use: irm https://raw.githubusercontent.com/alibaba/open-code-review/main/install.ps1 | iex)" ;;
esac

arch="$(uname -m)"
Expand Down
Loading