Repository navigation
feat(cli): add date ranges, model filter and JSON output to report commands - #51
Merged
Merged
Conversation
Any --format value other than csv used to fall back to JSON silently, so a typo such as xml produced JSON. Validate the option and report an error for anything but json or csv (case-insensitive).
A BarChart without items throws when rendered. Providers always emit the current hour, but guard the renderer so an empty trend shows a note instead of failing the command.
…mmands today takes --date; week and month take --from/--to or --last (month also --month); models takes --model. The report commands (today, week, month, models, hours, sessions) take --json, which prints camelCase JSON without a progress bar and skips the update check so scripted calls make no network request. Date input is validated in DateRangeResolver (years 2000-2999, at most 3650 days) and invalid values exit with code 1 and a message on stderr. Session durations are emitted as seconds.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
today,week,month,models,hours,sessions) accept--json: camelCase JSON on stdout, no progress bar, and the update check is skipped so scripted calls make no network request. Session durations are emitted as seconds.today --date,week/monthwith--from [--to]or--last <days>, andmonth --month yyyy-MM. Input is validated inDateRangeResolver(years 2000-2999, at most 3650 days); invalid values print a message to stderr and exit with code 1 instead of throwing.models --model <text>filters by name (case-insensitive). With no match, the table view prints a hint to stderr and--jsonprints[].export --formatnow rejects anything butjsonorcsvinstead of silently falling back to JSON.BuildHourlyTokenChartrenders a note for an empty trend, since an emptyBarChartthrows.Notes
week/month/todaytake no--modelfilter:DailySummaryonly carries per-model token counts, so per-model messages and cost would need Core changes.sessionsstill shows aggregate stats only;--top/--sortneed a session list thatDataServicedoes not expose yet.todayis now built from the injected clock's own time zone (previously the machine's).Test plan
dotnet build AIUsageMonitor.slnx(no warnings)dotnet test AIUsageMonitor.slnx(303 passed)--json,--last,--month, invalid ranges andexport --format xmlagainst real local data