| 190 | } |
| 191 | |
| 192 | function formatStepHistory(): string { |
| 193 | const recent = stepHistory.slice(-8); |
| 194 | if (recent.length === 0) { |
| 195 | return '(empty)'; |
| 196 | } |
| 197 | return recent |
| 198 | .map((stepRecord) => { |
| 199 | const error = |
| 200 | stepRecord.errorCode || stepRecord.errorMessage |
| 201 | ? ` error=${stepRecord.errorCode ?? ''}${stepRecord.errorMessage ? `:${stepRecord.errorMessage}` : ''}` |
| 202 | : ''; |
| 203 | return `${stepRecord.timestamp} status=${stepRecord.status}${error} ${stepRecord.step} :: ${stepRecord.command}`; |
| 204 | }) |
| 205 | .join('\n'); |
| 206 | } |
| 207 | |
| 208 | function ensureArtifactDir(): string { |
| 209 | if (artifactDir) { |