/** * 一次性脚本:回填过去 N 天的 cost_events(基于已同步的 commits/tasks) * 用法: bun run scripts/backfill-cost-events.ts [days=60] */ import dayjs from 'dayjs'; import { runCostEventIngest } from '../src/services/roi/cost-ingest'; const days = Number(process.argv[2] || 60); const from = dayjs().subtract(days, 'day').startOf('day').toDate(); const to = dayjs().endOf('day').toDate(); console.log(`Backfilling cost events from ${from.toISOString()} to ${to.toISOString()}...`); await runCostEventIngest({ from, to }); console.log('Done.'); process.exit(0);