Skip to content

Commit ff124c2

Browse files
sestinjclaude
andcommitted
fix: extract printCheckDiff helper to satisfy max-depth lint rule
Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 2587e61 commit ff124c2

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

extensions/cli/src/commands/checks.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,26 @@ const STATE_ICONS: Record<string, string> = {
120120
pending: chalk.yellow("\u25CB"),
121121
};
122122

123+
/**
124+
* Fetch and print the diff for a check, indented under the check output.
125+
*/
126+
async function printCheckDiff(check: CheckStatus): Promise<void> {
127+
try {
128+
const diffResponse = await get<{ diff: string }>(
129+
`agents/${check.sessionId}/diff`,
130+
);
131+
if (!diffResponse.data.diff) {
132+
return;
133+
}
134+
console.log(`\n${chalk.bold(` Diff:`)}`);
135+
for (const line of diffResponse.data.diff.split("\n")) {
136+
console.log(` ${line}`);
137+
}
138+
} catch (err) {
139+
logger.debug(`Failed to fetch diff for ${check.sessionId}: ${err}`);
140+
}
141+
}
142+
123143
/**
124144
* List check statuses for a PR, including diffs for checks with commits.
125145
*/
@@ -156,19 +176,7 @@ async function listChecks(prUrl: string): Promise<void> {
156176
}
157177

158178
if (check.commitMessage) {
159-
try {
160-
const diffResponse = await get<{ diff: string }>(
161-
`agents/${check.sessionId}/diff`,
162-
);
163-
if (diffResponse.data.diff) {
164-
console.log(`\n${chalk.bold(` Diff:`)}`);
165-
for (const line of diffResponse.data.diff.split("\n")) {
166-
console.log(` ${line}`);
167-
}
168-
}
169-
} catch (err) {
170-
logger.debug(`Failed to fetch diff for ${check.sessionId}: ${err}`);
171-
}
179+
await printCheckDiff(check);
172180
}
173181

174182
console.log();

0 commit comments

Comments
 (0)