#!/usr/bin/env node /** * Seed script — pre-warm the SQLite cache with a set of known VINs. * Also used for the startup eviction sweep. * Usage: node scripts/seed.js [VIN1 VIN2 ...] */ import { decodeVin, evictExpired } from '../src/cache.js'; const DEFAULT_VINS = [ '1HGCM82633A004352', // 2003 Honda Accord EX 'WBABW33486PX01612', // BMW ]; async function main() { const vins = process.argv.slice(2).length > 0 ? process.argv.slice(2) : DEFAULT_VINS; const evicted = evictExpired(); console.log(`Evicted ${evicted} expired cache entries.`); for (const vin of vins) { try { const { result, fromCache } = await decodeVin(vin); console.log(`${vin}: ${fromCache ? 'CACHE HIT' : 'FETCHED'} — ${result.make} ${result.model} ${result.model_year}`); } catch (err) { console.error(`${vin}: ERROR — ${err.message}`); } } } main().catch(console.error);