#!/usr/bin/env tsx // `archilyzer index` — rebuild the LMDB transcript index. Also runs on its own // as `tsx bin/build-index.ts` (export's build:index script). import { getPaths, type Paths } from "../lib/paths"; import { buildIndex } from "../controller/buildIndex"; import { settingsFromFile } from "../lib/settings"; import { applyHealthTimings } from "../lib/storageHealth"; import { runIfEntryPoint } from "./_cli"; export async function main(opts: { paths?: Paths } = {}): Promise { const paths = opts.paths ?? getPaths(); // A CLI process has no health pass: the drive-health timings the build's // watchdog runs on (settings.storage.health) are applied here, once. applyHealthTimings(settingsFromFile(paths.settingsFile).storage.health); await buildIndex({ paths }); } runIfEntryPoint(import.meta.url, () => main());