ae81e4b5ac
CI / check (pull_request) Successful in 1m44s
Implement the 3 read commands for eval framework: - report: read eval-run from CAS, render formatted text (task, overall, config, judges table, thread ID) - diff: side-by-side comparison with ▲/▼ delta indicators and config change markers - list: scan @uwf/eval/*/latest variables, sort by timestamp desc, --task filter, --limit pagination Architecture: pure formatting functions (format.ts) + data access (read.ts) + thin CLI handlers. Types in types.ts. 11 new tests (formatReport, formatDiff, formatList, selectEntries) Refs #72
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { createLogger } from "@united-workforce/util";
|
|
import type { Command } from "commander";
|
|
|
|
import { createEvalStore } from "../storage/index.js";
|
|
import { formatReport } from "./format.js";
|
|
import { readEvalRun } from "./read.js";
|
|
|
|
const log = createLogger({ sink: { kind: "stderr" } });
|
|
const LOG_REPORT = "R7QP2M4K";
|
|
|
|
export function registerReportCommand(program: Command): void {
|
|
program
|
|
.command("report <hash>")
|
|
.description("Show eval run results")
|
|
.action(async (hash: string) => {
|
|
try {
|
|
const evalStore = await createEvalStore();
|
|
const payload = readEvalRun(evalStore, hash);
|
|
if (payload === null) {
|
|
process.stderr.write(`eval run not found: ${hash}\n`);
|
|
process.exitCode = 1;
|
|
return;
|
|
}
|
|
log(LOG_REPORT, `report task=${payload.task} hash=${hash}`);
|
|
process.stdout.write(formatReport(payload, hash));
|
|
} catch (e) {
|
|
const message = e instanceof Error ? e.message : String(e);
|
|
process.stderr.write(`${message}\n`);
|
|
process.exitCode = 1;
|
|
}
|
|
});
|
|
}
|