()
| 955 | } |
| 956 | |
| 957 | async function main(): Promise<void> { |
| 958 | const argv = process.argv.slice(2); |
| 959 | if (argv.includes("--help") || argv.includes("-h")) { |
| 960 | console.log(printUsage()); |
| 961 | return; |
| 962 | } |
| 963 | |
| 964 | const projectDirectory = resolve(import.meta.dir, "../.."); |
| 965 | const config = parseRunnerConfig(argv, projectDirectory); |
| 966 | await ensureOutputArea(config); |
| 967 | await appendLog(config.paths.logFile, `Runner started with dataset ${config.datasetPath}`); |
| 968 | |
| 969 | const dataset = await loadDataset(config.datasetPath); |
| 970 | const workItems = selectQuestions(dataset, config); |
| 971 | const state = await loadState(config); |
| 972 | const resultsMap = await loadResultsMap(config.paths.resultsFile); |
| 973 | reconcileStateWithResults(state, resultsMap); |
| 974 | await persistState(config, state); |
| 975 | const client = createClient(config); |
| 976 | |
| 977 | try { |
| 978 | await runWithParallelism({ |
| 979 | client, |
| 980 | config, |
| 981 | workItems, |
| 982 | state, |
| 983 | resultsMap, |
| 984 | }); |
| 985 | } finally { |
| 986 | await writeSummary(config, resultsMap, workItems.length); |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | main().catch((error) => { |
| 991 | const typed = asError(error); |
no test coverage detected