Skip to content
Closed
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
38 changes: 38 additions & 0 deletions cmd/opencodereview/delegate_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package main
import (
"context"
"testing"

"github.com/spf13/cobra"
)

func TestValidateDelegateOptions(t *testing.T) {
Expand Down Expand Up @@ -34,6 +36,42 @@ func TestValidateDelegateOptions(t *testing.T) {
}
}

func TestDelegateFlags_RegisterJSONFormat(t *testing.T) {
var opts delegateOptions
cmd := &cobra.Command{
Use: "preview",
SilenceUsage: true,
SilenceErrors: true,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return validateDelegateOptions(&opts)
},
}
registerDelegateFlags(cmd, &opts)
cmd.SetArgs([]string{"--format", "json"})

if err := cmd.Execute(); err != nil {
t.Fatalf("delegate preview rejected --format json: %v", err)
}
if opts.format != "json" {
t.Fatalf("format = %q, want json", opts.format)
}

formatFlag := cmd.Flags().Lookup("format")
if formatFlag == nil {
t.Fatal("delegate preview did not register --format")
}
if formatFlag.Shorthand != "f" {
t.Fatalf("format shorthand = %q, want f", formatFlag.Shorthand)
}

for _, command := range []*cobra.Command{delegatePreviewCmd, delegateRuleCmd} {
if command.Flags().Lookup("format") == nil {
t.Errorf("%s did not register --format", command.Name())
}
}
}

func TestDelegateContextReviewMode(t *testing.T) {
cases := []struct {
name string
Expand Down
14 changes: 14 additions & 0 deletions plugins/open-code-review/skills/open-code-review-delegate/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ npm install -g @alibaba-group/open-code-review

No LLM configuration is needed for delegation mode.

The delegation JSON workflow requires an OCR CLI release that supports the
`--format` flag on both `delegate preview` and `delegate rule`. Verify the
installed binary before starting:

```bash
ocr delegate preview --help
```

Continue only when the help output includes `--format` (or `-f`). If the flag
is missing, the installed CLI is older than this skill's JSON protocol. Upgrade
OCR to a release that supports delegation JSON output before continuing; do not
silently fall back to text output because the steps below consume structured
fields such as `reviewable_files`, `mode`, and `merge_base`.

## Workflow

### Step 1: Preview — Determine What to Review
Expand Down
14 changes: 14 additions & 0 deletions skills/open-code-review-delegate/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ npm install -g @alibaba-group/open-code-review

No LLM configuration is needed for delegation mode.

The delegation JSON workflow requires an OCR CLI release that supports the
`--format` flag on both `delegate preview` and `delegate rule`. Verify the
installed binary before starting:

```bash
ocr delegate preview --help
```

Continue only when the help output includes `--format` (or `-f`). If the flag
is missing, the installed CLI is older than this skill's JSON protocol. Upgrade
OCR to a release that supports delegation JSON output before continuing; do not
silently fall back to text output because the steps below consume structured
fields such as `reviewable_files`, `mode`, and `merge_base`.

## Workflow

### Step 1: Preview — Determine What to Review
Expand Down
Loading