summaryrefslogtreecommitdiffhomepage
path: root/packages/trace-store/src/cli.ts
blob: 80a5c8b291168abb339313f135841770a386a374 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { createTraceStore } from "./store.js";

const turnId = process.argv[2];
if (turnId === undefined) {
  console.error("Usage: bun packages/trace-store/src/cli.ts <turnId> [dbPath]");
  process.exit(1);
}

const dbPath = process.argv[3] ?? process.env.TRACE_DB_PATH ?? "./.dispatch-data/traces.db";
const store = createTraceStore({ path: dbPath });
try {
  const output = store.easyView(turnId);
  console.log(output);
} finally {
  store.close();
}