chore: remove 120-day period, shrink Cursor lookback to 35 days

120 days was for testing. Max dashboard period is 30 days, so
Cursor SQL lookback is now 35 days (30 + margin for This Month).
Smaller scan window = faster cold starts, smaller cache file.
This commit is contained in:
AgentSeal 2026-04-15 05:24:34 -07:00
parent 3fabc105d8
commit 91edd6f14a
3 changed files with 8 additions and 14 deletions

View file

@ -50,11 +50,10 @@ function getDateRange(period: string): { range: DateRange; label: string } {
}
}
function toPeriod(s: string): 'today' | 'week' | '30days' | '120days' | 'month' {
function toPeriod(s: string): 'today' | 'week' | '30days' | 'month' {
if (s === 'today') return 'today'
if (s === 'month') return 'month'
if (s === '30days') return '30days'
if (s === '120days') return '120days'
return 'week'
}
@ -70,7 +69,7 @@ program.hook('preAction', async () => {
program
.command('report', { isDefault: true })
.description('Interactive usage dashboard')
.option('-p, --period <period>', 'Starting period: today, week, 30days, 90days, month', 'week')
.option('-p, --period <period>', 'Starting period: today, week, 30days, month', 'week')
.option('--provider <provider>', 'Filter by provider: all, claude, codex, cursor', 'all')
.option('--refresh <seconds>', 'Auto-refresh interval in seconds', parseInt)
.action(async (opts) => {

View file

@ -8,14 +8,13 @@ import { parseAllSessions } from './parser.js'
import { loadPricing } from './models.js'
import { getAllProviders } from './providers/index.js'
type Period = 'today' | 'week' | 'month' | '30days' | '120days'
type Period = 'today' | 'week' | '30days' | 'month'
const PERIODS: Period[] = ['today', 'week', '30days', '120days', 'month']
const PERIODS: Period[] = ['today', 'week', '30days', 'month']
const PERIOD_LABELS: Record<Period, string> = {
today: 'Today',
week: '7 Days',
'30days': '30 Days',
'120days': '120 Days',
month: 'This Month',
}
@ -87,7 +86,6 @@ function getDateRange(period: Period): { start: Date; end: Date } {
case 'today': return { start: new Date(now.getFullYear(), now.getMonth(), now.getDate()), end }
case 'week': return { start: new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7), end }
case '30days': return { start: new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30), end }
case '120days': return { start: new Date(now.getFullYear(), now.getMonth(), now.getDate() - 120), end }
case 'month': return { start: new Date(now.getFullYear(), now.getMonth(), 1), end }
}
}
@ -458,10 +456,8 @@ function StatusBar({ width, showProvider }: { width: number; showProvider?: bool
<Text color={ORANGE} bold>2</Text>
<Text dimColor> week </Text>
<Text color={ORANGE} bold>3</Text>
<Text dimColor> 30d </Text>
<Text dimColor> 30 days </Text>
<Text color={ORANGE} bold>4</Text>
<Text dimColor> 120d </Text>
<Text color={ORANGE} bold>5</Text>
<Text dimColor> month</Text>
{showProvider && (
<>
@ -493,7 +489,7 @@ function DashboardContent({ projects, period, columns, activeProvider }: { proje
}
const pw = wide ? halfWidth : dashWidth
const days = period === 'month' || period === '30days' ? 31 : period === '120days' ? 120 : 14
const days = period === 'month' || period === '30days' ? 31 : 14
return (
<Box flexDirection="column" width={dashWidth}>
@ -613,8 +609,7 @@ function InteractiveDashboard({ initialProjects, initialPeriod, initialProvider,
} else if (input === '1') switchPeriodImmediate('today')
else if (input === '2') switchPeriodImmediate('week')
else if (input === '3') switchPeriodImmediate('30days')
else if (input === '4') switchPeriodImmediate('120days')
else if (input === '5') switchPeriodImmediate('month')
else if (input === '4') switchPeriodImmediate('month')
})
if (loading) {

View file

@ -135,7 +135,7 @@ function parseBubbles(db: SqliteDatabase, seenKeys: Set<string>): { calls: Parse
const results: ParsedProviderCall[] = []
let skipped = 0
const DEFAULT_LOOKBACK_DAYS = 120
const DEFAULT_LOOKBACK_DAYS = 35
const timeFloor = new Date(Date.now() - DEFAULT_LOOKBACK_DAYS * 24 * 60 * 60 * 1000).toISOString()
const userMessages = buildUserMessageMap(db, timeFloor)