alibaba / alibaba/open-code-review

Feature: Add `ocr delegate task` command to emit a single structured review task

Open
#985 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
24.4k
Forks
1.8k
Avg merge
2d 4m
Merged PRs (30d)
102

Description

### Problem Statement

`ocr delegate` currently provides the `preview` and `rule` subcommands, which output the "reviewable scope + exclusions" and "review rules grouped by content" respectively. Both are deterministic, LLM-free outputs. Yet they are scattered fragments — there is no command that aggregates everything a host coding agent needs into a single document:

1. **Scattered context.** A host coding agent needs scope, excludes, rules, background, and diffs together to take over a review. Today it must call multiple subcommands and assemble the pieces itself, easily dropping fields.

2. **Missing real diffs.** `preview`/`rule` only describe which files and which rules apply; they do not carry the actual change content. A host agent must obtain the git diff separately, but diff retrieval (commit / range / workspace) is coupled to the internal diff provider and hard to replicate consistently from outside.

3. **Lost fields.** An earlier design summarized the task into Markdown, dropping fields such as `repository`, `merge_base`, the full excluded file paths, and `rules.files`. A host agent reading Markdown saw data not equivalent to the JSON variant, making behavior unverifiable.

### Proposed Solution

Add a `task` subcommand under `ocr delegate` that aggregates all of the above context in one command and emits a single structured review task document:

```bash
# Default Markdown output (human-readable)
ocr delegate task

# Machine-consumable structured JSON
ocr delegate task --format json

# Explicit excludes + background note
ocr delegate task --excludes "**/*_test.go" --background "Payment channel integration; mind concurrency safety"
```

`task` reuses the existing `--format` (`text` = default Markdown / `json`), `--excludes`, and `--background` flags and the `delegateCmd`/`registerDelegateFlags` infrastructure. No new flag design was needed.

### Alternatives Considered

_No response_

### Affected Area

CLI / Commands

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the existing `ocr delegate` `preview` and `rule` subcommands, the `delegateCmd` entry point, and `registerDelegateFlags`. Run those commands in text and JSON modes to compare their current outputs; done means `task` combines scope, excludes, rules, background, repository, merge base, and the relevant diff while honoring the existing format and flag behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.