























@@ -10,14 +10,16 @@ Options:
1010 Target selection. Default: auto.
1111 --base REF Base ref for branch review. Default: PR base or origin/main.
1212 --commit REF Commit ref for commit review. Default: HEAD.
13- --reviewer codex|claude|pi|opencode|auto
13+ --reviewer codex|claude|pi|opencode|droid|copilot|auto
1414 Review engine. Default: auto (Codex, fallback reviewer on error).
15- --fallback-reviewer claude|pi|opencode|none
15+ --fallback-reviewer claude|pi|opencode|droid|copilot|none
1616 Fallback when Codex is unavailable or exits nonzero. Default: claude.
1717 --codex-bin PATH Codex binary. Default: codex.
1818 --claude-bin PATH Claude binary. Default: claude.
1919 --pi-bin PATH Pi binary. Default: pi.
2020 --opencode-bin PATH OpenCode binary. Default: opencode.
21+ --droid-bin PATH Droid binary. Default: droid.
22+ --copilot-bin PATH GitHub Copilot binary. Default: copilot.
2123 --full-access Keep yolo/full-access mode enabled. Default.
2224 --no-yolo Run nested Codex review with normal sandbox/approval prompts.
2325 --output FILE Also save output to file.
@@ -42,6 +44,8 @@ codex_bin=${CODEX_BIN:-codex}
4244claude_bin=${CLAUDE_BIN:-claude}
4345pi_bin=${PI_BIN:-pi}
4446opencode_bin=${OPENCODE_BIN:-opencode}
47+droid_bin=${DROID_BIN:-droid}
48+copilot_bin=${COPILOT_BIN:-copilot}
4549codex_args=()
4650yolo=${AUTOREVIEW_YOLO:-${CODEX_REVIEW_YOLO:-1}}
4751output=${AUTOREVIEW_OUTPUT:-${CODEX_REVIEW_OUTPUT:-}}
@@ -86,6 +90,14 @@ while [[ $# -gt 0 ]]; do
8690 opencode_bin=${2:-}
8791shift 2
8892 ;;
93+ --droid-bin)
94+ droid_bin=${2:-}
95+shift 2
96+ ;;
97+ --copilot-bin)
98+ copilot_bin=${2:-}
99+shift 2
100+ ;;
89101 --full-access)
90102 yolo=1
91103shift
@@ -131,15 +143,15 @@ case "$mode" in
131143esac
132144133145case "$reviewer" in
134- auto|codex|claude|pi|opencode) ;;
146+ auto|codex|claude|pi|opencode|droid|copilot) ;;
135147*)
136148echo "invalid --reviewer: $reviewer" >&2
137149exit 2
138150 ;;
139151esac
140152141153case "$fallback_reviewer" in
142- claude|pi|opencode|none) ;;
154+ claude|pi|opencode|droid|copilot|none) ;;
143155*)
144156echo "invalid --fallback-reviewer: $fallback_reviewer" >&2
145157exit 2
@@ -198,6 +210,15 @@ printf 'reviewer: %s\n' "$reviewer"
198210if [[ "$reviewer" == auto ]]; then
199211printf 'fallback-reviewer: %s\n' "$fallback_reviewer"
200212fi
213+case "$reviewer" in
214+ codex) ;;
215+ auto)
216+printf 'note: Codex native review mode is the recommended and best-supported review path; fallback reviewers use a generated diff prompt.\n'
217+ ;;
218+*)
219+printf 'note: Codex native review mode is the recommended and best-supported review path; %s uses a generated diff prompt.\n' "$reviewer"
220+ ;;
221+esac
201222if [[ "$reviewer" == auto || "$reviewer" == codex ]]; then
202223printf 'review:'
203224printf ' %q' "${review_cmd[@]}"
@@ -284,10 +305,14 @@ Base: ${base_ref:-}
284305Commit: ${commit_ref:-}
285306286307Rules:
287-- Review only the diff below.
308+- Review the proposed code change as a closeout reviewer.
309+- Focus on the diff below. If your CLI exposes read-only repository tools, inspect surrounding code and tests to verify findings; never modify files.
288310- Do not modify files.
289-- Prioritize correctness bugs, regressions, security issues, and missing tests.
290-- Ignore speculative edge cases and broad rewrites.
311+- Report only discrete, actionable issues introduced by this change.
312+- Prioritize correctness, regressions, security, data loss, performance cliffs, and missing tests that would catch a real bug.
313+- Do not report pre-existing issues, speculative risks, broad rewrites, style nits, changelog gaps, or findings that depend on unstated assumptions.
314+- Identify the concrete scenario where the issue appears, and keep the line reference as small as possible.
315+- A finding should overlap changed code or clearly cite changed code as the cause.
291316- For each accepted/actionable finding, use exactly this format:
292317 [P<0-3>] Short title
293318 File: path:line
@@ -302,8 +327,15 @@ EOF
302327 } > "$prompt_file" || return
303328}
304329330+reviewer_output_has_clean_marker() {
331+local path=$1
332+ grep -Eq '^[^[:alnum:]]*autoreview clean: no accepted/actionable findings reported[[:space:]]*$' "$path"
333+}
334+305335run_prompt_reviewer() {
306336local selected=$1
337+local copilot_prompt=
338+local prompt_bytes=0
307339local reviewer_output
308340local status=0
309341@@ -343,13 +375,46 @@ run_prompt_reviewer() {
343375echo "fallback reviewer unavailable: $opencode_bin" >&2
344376 status=127
345377elif printf 'fallback: opencode run\n' | tee -a "$review_output"; then
346-"$opencode_bin" run --pure --dir "$(dirname "$prompt_file")" --file "$prompt_file" \
347-"Review the attached prompt file. Do not modify files." 2>&1 | tee -a "$review_output" "$reviewer_output"
378+"$opencode_bin" run --pure --dir "$repo_root" \
379+"Review the attached prompt file. Do not modify files." \
380+ --file "$prompt_file" 2>&1 | tee -a "$review_output" "$reviewer_output"
348381 status=$?
349382else
350383 status=$?
351384fi
352385 ;;
386+ droid)
387+if ! command -v "$droid_bin" >/dev/null 2>&1; then
388+echo "fallback reviewer unavailable: $droid_bin" >&2
389+ status=127
390+elif printf 'fallback: droid exec\n' | tee -a "$review_output"; then
391+"$droid_bin" exec --cwd "$repo_root" -f "$prompt_file" 2>&1 | tee -a "$review_output" "$reviewer_output"
392+ status=$?
393+else
394+ status=$?
395+fi
396+ ;;
397+ copilot)
398+if ! command -v "$copilot_bin" >/dev/null 2>&1; then
399+echo "fallback reviewer unavailable: $copilot_bin" >&2
400+ status=127
401+elif printf 'fallback: copilot\n' | tee -a "$review_output"; then
402+ prompt_bytes=$(wc -c < "$prompt_file" | tr -d '[:space:]')
403+if (( prompt_bytes > 120000 )); then
404+echo "copilot reviewer unavailable: generated prompt is too large for copilot -p; use codex, droid, or another file/stdin-capable reviewer" \
405+2>&1 | tee -a "$review_output" "$reviewer_output"
406+ status=1
407+else
408+ copilot_prompt=$(< "$prompt_file")
409+"$copilot_bin" -C "$repo_root" --available-tools=none --stream off --output-format text --silent \
410+ -p "$copilot_prompt" \
411+2>&1 | tee -a "$review_output" "$reviewer_output"
412+ status=$?
413+fi
414+else
415+ status=$?
416+fi
417+ ;;
353418*)
354419echo "unsupported prompt reviewer: $selected" >&2
355420 status=2
@@ -360,7 +425,7 @@ run_prompt_reviewer() {
360425 status=1
361426elif ! grep -q '[^[:space:]]' "$reviewer_output"; then
362427 status=1
363-elif ! grep -Fxq 'autoreview clean: no accepted/actionable findings reported' "$reviewer_output"; then
428+elif ! reviewer_output_has_clean_marker "$reviewer_output"; then
364429 status=1
365430fi
366431fi
@@ -380,7 +445,7 @@ run_selected_review() {
380445fi
381446 run_review
382447 ;;
383- claude|pi|opencode)
448+ claude|pi|opencode|droid|copilot)
384449 run_prompt_reviewer "$selected"
385450 ;;
386451*)
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。