merge: PR #30을 합친 검사 브랜치에 넣는다

This commit is contained in:
DongHyeonka
2026-11-13 07:16:02 +09:00
3 changed files with 147 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
/**
* 1112/08-13. What a failed `ci:gate` prints to stderr: the gate, the command
* that failed (or that none did), the log with the whole output, and the end
* of that output, where the cause usually is.
*/
export function formatGateFailure(input: Readonly<{
gateId: string;
gateName: string;
logPath: string;
failedCommand?: string | undefined;
output: readonly string[];
tailLines?: number;
}>): string {
const tail = input.output
.flatMap((chunk) => chunk.split(/\r?\n/u))
.filter((line) => line.trim() !== "")
.slice(-(input.tailLines ?? 20));
return [
`${input.gateId} ${input.gateName}: FAIL`,
` failed command: ${input.failedCommand ?? "none (a check outside the commands)"}`,
` log: ${input.logPath}`,
" last lines of the log:",
...tail.map((line) => ` ${line}`),
].join("\n");
}