Skip to content
Merged
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
20 changes: 19 additions & 1 deletion multi-review/dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2494,6 +2494,23 @@ ${r.content}`;
});
return "**Multi-Review (fallback \u2014 coordinator failed)**\n\n" + parts.join("\n\n---\n\n");
}
function buildReviewerDetails(reviews) {
const details = reviews.map((r) => {
const body = r.success ? r.content : `\uFF08\u5BA1\u67E5\u5931\u8D25: ${r.error}\uFF09`;
return `<details>
<summary>${r.reviewer}</summary>

${body}

</details>`;
});
return `<details>
<summary>\u{1F4CB} \u5404 Reviewer \u8BE6\u7EC6\u5BA1\u67E5\u7ED3\u679C</summary>

${details.join("\n\n")}

</details>`;
}

// src/comment.ts
var import_node_child_process2 = require("child_process");
Expand Down Expand Up @@ -2618,11 +2635,12 @@ async function main() {
}
let comment;
try {
comment = await runCoordinator(client2, reviews, {
const synthesis = await runCoordinator(client2, reviews, {
globalTimeoutMs: globalTimeout * 1e3,
coordinatorTimeoutMs: coordinatorTimeout * 1e3,
coordinatorPrompt: env("MULTI_REVIEW_COORDINATOR_PROMPT")
});
comment = synthesis + "\n\n---\n\n" + buildReviewerDetails(reviews);
} catch (err) {
console.error(`Coordinator failed: ${err}`);
comment = buildFallbackComment(reviews);
Expand Down
5 changes: 3 additions & 2 deletions multi-review/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createOpencode } from "@opencode-ai/sdk";
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { loadReviewers, resolveModel, env, intEnv } from "./reviewers.js";
import { runParallelReviewers, runCoordinator, buildFallbackComment } from "./orchestrator.js";
import { runParallelReviewers, runCoordinator, buildFallbackComment, buildReviewerDetails } from "./orchestrator.js";
import { postPRComment, cleanupErrorComments, parseExtraEnv } from "./comment.js";

async function main(): Promise<number> {
Expand Down Expand Up @@ -64,11 +64,12 @@ async function main(): Promise<number> {
// 6. Run coordinator
let comment: string;
try {
comment = await runCoordinator(client, reviews, {
const synthesis = await runCoordinator(client, reviews, {
globalTimeoutMs: globalTimeout * 1000,
coordinatorTimeoutMs: coordinatorTimeout * 1000,
coordinatorPrompt: env("MULTI_REVIEW_COORDINATOR_PROMPT"),
});
comment = synthesis + "\n\n---\n\n" + buildReviewerDetails(reviews);
} catch (err) {
console.error(`Coordinator failed: ${err}`);
comment = buildFallbackComment(reviews);
Expand Down
8 changes: 8 additions & 0 deletions multi-review/src/orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,11 @@ export function buildFallbackComment(reviews: ReviewResult[]): string {
});
return "**Multi-Review (fallback — coordinator failed)**\n\n" + parts.join("\n\n---\n\n");
}

export function buildReviewerDetails(reviews: ReviewResult[]): string {
const details = reviews.map((r) => {
const body = r.success ? r.content : `(审查失败: ${r.error})`;
return `<details>\n<summary>${r.reviewer}</summary>\n\n${body}\n\n</details>`;
});
return `<details>\n<summary>📋 各 Reviewer 详细审查结果</summary>\n\n${details.join("\n\n")}\n\n</details>`;
}
Loading