import { scanUsage, formatCompact } from "@tokenmaxx/usage";

const summary = await scanUsage();
const usd = new Intl.NumberFormat(undefined, {
  style: "currency",
  currency: "USD",
  maximumFractionDigits: 2
});

console.log(`Tokenmaxx Local scan`);
console.log(`Generated: ${summary.generatedAt}`);
console.log(`Claude: ${summary.sourceStats.claudeEvents} events from ${summary.sourceStats.claudeFiles} files`);
console.log(`Codex:  ${summary.sourceStats.codexEvents} events from ${summary.sourceStats.codexFiles} files`);
console.log(`Today:  ${formatCompact(summary.windows.today.totalTokens)} tokens / ${usd.format(summary.windows.today.costUsd)} list`);
console.log(`7 days: ${formatCompact(summary.windows.week.totalTokens)} tokens / ${usd.format(summary.windows.week.costUsd)} list`);
console.log(`30 days:${formatCompact(summary.windows.month.totalTokens)} tokens / ${usd.format(summary.windows.month.costUsd)} list`);
console.log(`All:    ${formatCompact(summary.totals.totalTokens)} tokens / ${usd.format(summary.totals.costUsd)} list`);
console.log(`Title:  ${summary.title}`);
