fix: extract printCheckDiff helper to satisfy max-depth lint rule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nate 2026-02-07 21:05:29 -08:00
parent 2587e61e60
commit ff124c293e

View file

@ -120,6 +120,26 @@ const STATE_ICONS: Record<string, string> = {
pending: chalk.yellow("\u25CB"),
};
/**
* Fetch and print the diff for a check, indented under the check output.
*/
async function printCheckDiff(check: CheckStatus): Promise<void> {
try {
const diffResponse = await get<{ diff: string }>(
`agents/${check.sessionId}/diff`,
);
if (!diffResponse.data.diff) {
return;
}
console.log(`\n${chalk.bold(` Diff:`)}`);
for (const line of diffResponse.data.diff.split("\n")) {
console.log(` ${line}`);
}
} catch (err) {
logger.debug(`Failed to fetch diff for ${check.sessionId}: ${err}`);
}
}
/**
* List check statuses for a PR, including diffs for checks with commits.
*/
@ -156,19 +176,7 @@ async function listChecks(prUrl: string): Promise<void> {
}
if (check.commitMessage) {
try {
const diffResponse = await get<{ diff: string }>(
`agents/${check.sessionId}/diff`,
);
if (diffResponse.data.diff) {
console.log(`\n${chalk.bold(` Diff:`)}`);
for (const line of diffResponse.data.diff.split("\n")) {
console.log(` ${line}`);
}
}
} catch (err) {
logger.debug(`Failed to fetch diff for ${check.sessionId}: ${err}`);
}
await printCheckDiff(check);
}
console.log();