feat(overview): full comma-grouped numbers for a precise, spacious look

Render token counts as full thousands-grouped integers (e.g.
3,926,923,819) instead of abbreviated M/B, so the roomy tables read like
a precise statement. Update the overview test to match.
This commit is contained in:
AgentSeal 2026-06-20 19:12:26 +02:00
parent 40042365ea
commit 8d727d9cc4
2 changed files with 6 additions and 6 deletions

View file

@ -4,18 +4,17 @@ import { homedir } from 'os'
import { CATEGORY_LABELS, type ProjectSummary, type TaskCategory } from './types.js'
import { formatCost as baseCost } from './currency.js'
import { formatTokens as baseTokens } from './format.js'
import { getShortModelName } from './models.js'
import { dateKey } from './day-aggregator.js'
// Display-only helpers. The shared formatters omit thousands separators and stop
// at M; aggregation uses raw numbers, these only affect rendering.
// Display-only helpers. The shared formatters omit thousands separators and
// abbreviate; here we show full, comma-grouped numbers so the tables read like
// a precise statement. Aggregation uses raw numbers; these only affect render.
function formatCost(usd: number): string {
return baseCost(usd).replace(/(\d)(?=(\d{3})+(\.|$))/g, '$1,')
}
function formatTokens(n: number): string {
if (n >= 1_000_000_000) return `${(n / 1_000_000_000).toFixed(2)}B`
return baseTokens(n)
return Math.round(n).toLocaleString()
}
function projectName(p: ProjectSummary): string {
const path = p.projectPath

View file

@ -89,7 +89,8 @@ describe('renderOverview', () => {
})], { label: 'June 2026', color: false })
expect(out).toContain('$1,234.56')
expect(out).toMatch(/2\.\d\dB/)
// tokens render as full, comma-grouped numbers (not abbreviated)
expect(out).toContain('2,002,000,000')
// no-color mode must not emit ANSI escape codes
// eslint-disable-next-line no-control-regex
expect(out).not.toMatch(/\[/)