@@ -25,6 +25,13 @@ fixes exactly when it is not `Yes`, and Minor issues alone never block. For UI
|
||||
changes, check that the result is aligned, clean, and pixel-perfect, and that
|
||||
included screenshots prove the intended result was achieved.
|
||||
|
||||
The review must read at a glance: everything outside `<details>` blocks totals
|
||||
under 512 bytes. Keep only the assessment line, the section headings, and a
|
||||
one-line `@bot` instruction visible. Put each strength, each issue, and each
|
||||
recommendation in its own top-level `<details>` block, never inside a list item,
|
||||
with a `<summary>` of the `file:line` and a few words and the what, why, and how
|
||||
inside. The template's `**Reasoning:**` goes in a `<details>` block too.
|
||||
|
||||
For an `issue_comment` or `pull_request_review_comment` event, treat the `body`
|
||||
in the triggering comment payload below as the user's exact instruction.
|
||||
|
||||
|
||||
@@ -52,6 +52,16 @@ async function postComment(body: string): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
// A review must read at a glance: when the agent left more than VISIBLE_BYTES
|
||||
// outside <details> blocks, the whole review folds under its verdict line.
|
||||
const VISIBLE_BYTES = 512;
|
||||
function fold(body: string): string {
|
||||
const visible = body.replace(/<details>[\s\S]*?<\/details>/g, "");
|
||||
if (new TextEncoder().encode(visible).length <= VISIBLE_BYTES) return body;
|
||||
const verdict = body.match(/\*\*Ready to merge\?\*\*.*/)?.[0] ?? "Review";
|
||||
return `${verdict}\n\n<details>\n<summary>Details</summary>\n\n${body}\n\n</details>`;
|
||||
}
|
||||
|
||||
// A pull request event is a review request, so the response becomes a review:
|
||||
// changes are requested when the agent asked @bot to fix something, a failed
|
||||
// run only comments, and anything else approves.
|
||||
@@ -63,7 +73,7 @@ async function postResult(body: string): Promise<void> {
|
||||
? "COMMENT"
|
||||
: "APPROVED";
|
||||
await gitea(REVIEWER_TOKEN, `repos/${REPO}/pulls/${INDEX}/reviews`, {
|
||||
body: stripAnsi(body),
|
||||
body: fold(stripAnsi(body)),
|
||||
event,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user