diff --git a/prompt.md b/prompt.md index b03df2c..25de243 100644 --- a/prompt.md +++ b/prompt.md @@ -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 `
` 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 `
` block, never inside a list item, +with a `` of the `file:line` and a few words and the what, why, and how +inside. The template's `**Reasoning:**` goes in a `
` 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. diff --git a/run.ts b/run.ts index 8978dde..98aea80 100644 --- a/run.ts +++ b/run.ts @@ -52,6 +52,16 @@ async function postComment(body: string): Promise { }); } +// A review must read at a glance: when the agent left more than VISIBLE_BYTES +// outside
blocks, the whole review folds under its verdict line. +const VISIBLE_BYTES = 512; +function fold(body: string): string { + const visible = body.replace(/
[\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
\nDetails\n\n${body}\n\n
`; +} + // 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 { ? "COMMENT" : "APPROVED"; await gitea(REVIEWER_TOKEN, `repos/${REPO}/pulls/${INDEX}/reviews`, { - body: stripAnsi(body), + body: fold(stripAnsi(body)), event, }); }