()
| 406 | } |
| 407 | |
| 408 | function main() { |
| 409 | const args = parseArgs(process.argv.slice(2)); |
| 410 | if (args.help) { |
| 411 | process.stdout.write(`${usage()}\n`); |
| 412 | return; |
| 413 | } |
| 414 | |
| 415 | const consoleState = buildConsole(args.projectRoot, { |
| 416 | run: args.run, |
| 417 | maxSteps: args.maxSteps, |
| 418 | }); |
| 419 | |
| 420 | if (args.summary) process.stdout.write(`${JSON.stringify(consoleState.summary, null, 2)}\n`); |
| 421 | else if (args.json) process.stdout.write(`${JSON.stringify(consoleState, null, 2)}\n`); |
| 422 | else { |
| 423 | process.stdout.write(renderConsole(consoleState)); |
| 424 | process.stdout.write(`Report: ${consoleState.reportPath}\n`); |
| 425 | } |
| 426 | |
| 427 | if (consoleState.status === 'failed') { |
| 428 | const failed = consoleState.decision.steps.find((step) => step.result.status !== 0); |
| 429 | process.exitCode = failed?.result.status || 1; |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | if (require.main === module) main(); |
| 434 |
no test coverage detected