How alibaba/open-code-review works
OpenCodeReview is an AI code-review product exposed as a CLI and editor integrations, with an ACP adapter and a session viewer. The principal flow selects changed files (or scans whole files), reviews them with an LLM agent and code tools, then presents structured comments. The README documents the review stages and capabilities; sampled source confirms selected IDE coordination and webview behavior. Several core modules and integration paths were not sampled, so their internal call relationships are left undocumented here.
Main entry points: main.go OCR CLI · agent.go Review agent · ReviewProjectService.kt IDEA integration · diff Git diff
Components 23
Review engine
- Git diff
internal/diff - Whole-file scan
internal/scan - File selection
internal/agent/selection.go - File bundling
internal/agent/grouping.go - Review agent
internal/agent/agent.go - Review tasks
internal/reviewtask/task.go - Code tools
internal/tool/definitions.go - LLM client
internal/llm/client.go - Review comments
internal/model/review.go
User interfaces
- OCR CLI
cmd/opencodereview/main.go - Session viewer
internal/viewer/server.go - IDEA integration
extensions/idea/src/main/kotlin/com/alibaba/opencodereview/idea/review/ReviewProjectService.kt - IDE Git service
extensions/idea/src/main/kotlin/com/alibaba/opencodereview/idea/services/GitService.kt - IDE comments
extensions/idea/src/main/kotlin/com/alibaba/opencodereview/idea/providers/CommentService.kt - IDE CLI service
extensions/idea/src/main/kotlin/com/alibaba/opencodereview/idea/services/CliService.kt - Review webview
extensions/frontend/src/webview/App.tsx - VS Code integration
extensions/vscode/src/extension/services/CliService.ts
Review state
- Review configuration
internal/config - Review sessions
internal/session/persist.go
ACP adapter
- ACP process
acp/cmd/ocr-acp/main.go - ACP review agent
acp/internal/adapter/agent.go
Other components
- Developer
- Model endpoint
Connections 21
- Developer → OCR CLI: invokes
- OCR CLI → Git diff: reviews changes
- OCR CLI → Whole-file scan: scans files
- Git diff → File selection: selects files
- File selection → File bundling: groups files
- File bundling → Review agent: runs subagents
- Review agent → Review tasks: delegates reviews
- Review agent → Code tools: retrieves context
- Review agent → LLM client: requests review
- LLM client → Model endpoint: sends prompts
- Review agent → Review comments: produces findings
- OCR CLI → Review configuration: uses settings
- OCR CLI → Review sessions: stores results
- Session viewer → Review sessions: reads sessions
- IDEA integration → IDE Git service: coordinates Git
extensions/idea/src/main/kotlin/com/alibaba/opencodereview/idea/review/ReviewProjectService.kt - IDEA integration → IDE comments: mounts comments
extensions/idea/src/main/kotlin/com/alibaba/opencodereview/idea/review/ReviewProjectService.kt - IDEA integration → IDE CLI service: runs CLI
extensions/idea/src/main/kotlin/com/alibaba/opencodereview/idea/review/ReviewProjectService.kt - Review webview → IDEA integration: exchanges messages
- VS Code integration → OCR CLI: runs executable
- Developer → ACP process: connects ACP
- ACP process → ACP review agent: creates agent
acp/cmd/ocr-acp/main.go