()
| 116 | } |
| 117 | |
| 118 | async function main(): Promise<void> { |
| 119 | const args = process.argv.slice(2); |
| 120 | |
| 121 | if (args.length === 0) { |
| 122 | usage(); |
| 123 | process.exit(1); |
| 124 | } |
| 125 | |
| 126 | const filePath = args[0]; |
| 127 | let runs: EvaluationRunExport[]; |
| 128 | |
| 129 | try { |
| 130 | const fileContent = readFileSync(filePath, "utf-8"); |
| 131 | runs = JSON.parse(fileContent) as EvaluationRunExport[]; |
| 132 | } catch (error) { |
| 133 | console.error(`Error reading file ${filePath}:`, error); |
| 134 | process.exit(1); |
| 135 | } |
| 136 | |
| 137 | if (runs.length === 0) { |
| 138 | console.error("No evaluation runs found in the provided file."); |
| 139 | process.exit(1); |
| 140 | } |
| 141 | |
| 142 | runs.sort((a, b) => b.finalScore - a.finalScore); |
| 143 | |
| 144 | const output = await generateAnalysis(runs); |
| 145 | process.stdout.write(`${output.trimEnd()}\n`); |
| 146 | } |
| 147 | |
| 148 | if (import.meta.main) { |
| 149 | main().catch((error) => { |
no test coverage detected