| 43 | No GitHub credentials, model token, network access, or live resources are used.`; |
| 44 | |
| 45 | export async function main(argv = process.argv.slice(2)): Promise<void> { |
| 46 | let json = false; |
| 47 | const paths: string[] = []; |
| 48 | for (const arg of argv) { |
| 49 | if (arg === "--help" || arg === "-h") { console.log(usage); return; } |
| 50 | if (arg === "--json") json = true; |
| 51 | else if (arg.startsWith("-")) throw new Error(`Unknown option: ${arg}\n${usage}`); |
| 52 | else paths.push(arg); |
| 53 | } |
| 54 | if (!paths.length) throw new Error(usage); |
| 55 | const results = await Promise.all(paths.map(replay)); |
| 56 | if (json) console.log(JSON.stringify(results, null, 2)); |
| 57 | else { |
| 58 | for (const item of results) { |
| 59 | console.log(`${item.passed ? "PASS" : "FAIL"} ${item.scenario} ${item.path}`); |
| 60 | for (const grader of item.graders) { |
| 61 | console.log(` ${grader.passed ? "PASS" : "FAIL"} ${grader.name}: ${grader.evidence}`); |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | if (results.some(result => !result.passed)) process.exitCode = 1; |
| 66 | } |
| 67 | |
| 68 | if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) { |
| 69 | main().catch(error => { |