What happens
rtk cc-economics errors out:
Failed to parse ccusage JSON output: Invalid JSON structure for monthly data: missing field `month`
(rtk 0.43.0 / master, ccusage fetched via npx.)
Cause
Current ccusage emits period as the per-record key. Its monthly --json record keys are now:
period, inputTokens, outputTokens, cacheCreationTokens, cacheReadTokens, totalTokens, totalCost, ...
In src/analytics/ccusage.rs, the deserializer still requires the old key names:
MonthlyEntry.month
DailyEntry.date
WeeklyEntry.week
Since ccusage renamed the key to period, every record fails to deserialize and the whole feature is unusable. All three granularities are affected, not just monthly.
Expected vs actual
- Expected:
cc-economics renders spend-vs-savings.
- Actual: hard parse error.
Suggested fix
Accept period as an alias for the existing key field on each granularity (backward-compatible with older ccusage that still emits month/date/week). PR incoming.
What happens
rtk cc-economicserrors out:(rtk 0.43.0 / master, ccusage fetched via npx.)
Cause
Current ccusage emits
periodas the per-record key. Itsmonthly --jsonrecord keys are now:In
src/analytics/ccusage.rs, the deserializer still requires the old key names:MonthlyEntry.monthDailyEntry.dateWeeklyEntry.weekSince ccusage renamed the key to
period, every record fails to deserialize and the whole feature is unusable. All three granularities are affected, not just monthly.Expected vs actual
cc-economicsrenders spend-vs-savings.Suggested fix
Accept
periodas an alias for the existing key field on each granularity (backward-compatible with older ccusage that still emitsmonth/date/week). PR incoming.