This commit is contained in:
Overtorment 2026-06-19 18:39:19 +01:00
parent 2f279f57be
commit 0d3e992aec
4 changed files with 12 additions and 13 deletions

View File

@ -45,7 +45,6 @@ try {
} else if (n.subject?.url) {
console.log(` ${subjectUrlToWebUrl(n.subject.url)}`);
}
console.log();
if (n.reason === "review_requested") {
const ok = await processReviewRequest(n, { githubToken: token, cursorApiKey });

View File

@ -28,7 +28,7 @@ export async function postGithubReview(
if (demoted.length > 0) {
console.error(
`${demoted.length} comment(s) not on the diff — moved to review body`,
` ${demoted.length} comment(s) not on the diff — moved to review body`,
);
}
@ -50,7 +50,7 @@ export async function postGithubReview(
comments: anchored.length > 0 ? anchored : undefined,
});
console.log(
`Posted ${review.event} review (${anchored.length} inline): ${data.html_url}`,
` Posted ${review.event} review (${anchored.length} inline): ${data.html_url}`,
);
return;
} catch (err) {
@ -61,12 +61,12 @@ export async function postGithubReview(
// Safety net: validation should make this unreachable, but if GitHub still
// rejects the inline batch, fall back to a body-only review rather than lose
// the findings entirely.
console.error("Inline batch still rejected, posting body-only...");
console.error(" Inline batch still rejected, posting body-only...");
const { data } = await octokit.rest.pulls.createReview({
...baseParams,
body: appendCommentsToBody(body, anchored),
});
console.log(`Posted ${review.event} review (no inline): ${data.html_url}`);
console.log(` Posted ${review.event} review (no inline): ${data.html_url}`);
}
}

View File

@ -46,14 +46,14 @@ export function buildReviewPrompt(prUrl: string): string {
"110% over-the-top roleplay: always sound like GlaDOS from Portal conducting tests and doing sarcastic remarks, Absolute immersion into the world of video game Portal.",
"You are delighted that you have job to do and have tests and experiments to run.",
"Be sharp, cynical, sarcastic, and technically competent.",
"Be concise.",
"Be very concise.",
"Technical usefulness is mandatory. Personality is mandatory.",
`Avoid bland phrases like: "Looks good", "Seems fine", "Internally consistent", "No issues found".`,
"Jokes are allowed occasionally if they are short and tied to the code, architecture, naming etc.",
"The voice applies to EVERY piece of text you emit, not just the summary: each finding's `body` must be fully in-character GlaDOS too, never a dry technical note. A reader should hear GlaDOS in every inline comment (concise).",
"The voice applies to EVERY piece of text you emit, not just the summary: each finding's `body` must be fully in-character GlaDOS too, never a dry technical note. A reader should hear GlaDOS in every inline comment (very concise).",
"",
"Return ONLY valid JSON matching this schema:",
`{ "summary": "overall review in markdown", "findings": [{ "severity": "${SEVERITIES.join("|")}", "path": "relative/path.ts", "line": 42, "body": "in-character GlaDOS critique of this exact line, still technically precise and concise" }] }`,
`{ "summary": "overall very concise review in markdown", "findings": [{ "severity": "${SEVERITIES.join("|")}", "path": "relative/path.ts", "line": 42, "body": "in-character GlaDOS critique of this exact line, still technically precise and very concise" }] }`,
"",
].join("\n");
}

View File

@ -21,7 +21,7 @@ export async function processReviewRequest(
let workDir: string | undefined;
try {
console.log(`Cloning ${pr.owner}/${pr.repo}...`);
console.log(` Cloning ${pr.owner}/${pr.repo}...`);
const workspace = await preparePrWorkspace(
pr.owner,
pr.repo,
@ -30,7 +30,7 @@ export async function processReviewRequest(
);
workDir = workspace.workDir;
console.log(`Reviewing ${pr.prUrl}...`);
console.log(` Reviewing ${pr.prUrl}...`);
const payload = await runAgentReview(
workspace.repoDir,
pr.prUrl,
@ -38,14 +38,14 @@ export async function processReviewRequest(
);
const githubReview = buildGithubReview(payload);
console.log(`Verdict: ${githubReview.event}`);
console.log(`${githubReview.comments.length} inline comment(s)`);
console.log(` Verdict: ${githubReview.event}`);
console.log(` ${githubReview.comments.length} inline comment(s)`);
await postGithubReview(options.githubToken, pr, githubReview);
return true;
} catch (err) {
if (err instanceof CursorAgentError) {
console.error(`Review startup failed: ${err.message}`);
console.error(` Review startup failed: ${err.message}`);
return false;
}
if (err instanceof Error) {