// sysutil/backfill-recording-history.ts
// scope: one-time Tape-to-Ledger recorded history backfill

import { capture } from "../capture";

async function main(): Promise<void> {
  const minArg = process.argv.find(arg => arg.startsWith("--min="));
  const minRuns = Math.max(1, Math.floor(Number(minArg?.split("=")[1] || 10)) || 10);
  const result = await capture.tape.backfillRecordedHistory(minRuns);
  console.log(JSON.stringify(result, null, 2));
}

main().catch(err => {
  console.error(err?.stack || err?.message || err);
  process.exit(1);
});
