Skip to content

Add --month to report a past billing period - #58

Merged
geoffreywiseman merged 1 commit into
mainfrom
feat/month-option
Sep 11, 2026
Merged

Add --month to report a past billing period#58
geoffreywiseman merged 1 commit into
mainfrom
feat/month-option

Conversation

@geoffreywiseman

Copy link
Copy Markdown
Contributor

Closes #54.

Summary

  • Adds --month YYYY-MM, defaulting to the current month, to select the calendar month in UTC to report. A past month runs from its first instant through its last second; the current month runs up to now, as before.
  • Rejects values that do not parse as YYYY-MM and months that have not started yet, routing the error through printError so it prints cleanly without --verbose.
  • usage.Period(month, now) replaces CurrentPeriod; the collector is unchanged apart from receiving its bounds from the config.
  • Help text, README, and Copilot instructions now describe the selected billing period, current month by default, and document the flag.

Testing

  • just (fmt, vet, staticcheck, golangci-lint, race tests, govulncheck) passes.
  • New tests cover Period (current month, past month, leap February, December, moments after a month ends), parseMonth (valid values plus future, empty, unpadded, out-of-range, full-date, and month-name inputs), and the clean error output.
  • Real runs against codiform/gh-actions-usage: --month=2026-03 reported 10h 35m across 61 commits, consistent with the API's 208 runs for that window; --month=2026-07 and 2026-08 report zero, which the API confirms; future and malformed months print the clean error and usage text.

🤖 Generated with Claude Code

The extension always reported the current billing period, which early in
a month is a thin window; the interesting comparison is usually a
completed month. A --month YYYY-MM flag now selects the calendar month
in UTC to report, defaulting to the current one. A past month runs from
its first instant through its last second; the current month runs up to
now, as before.

Values that do not parse as YYYY-MM, and months that have not started
yet, are rejected through printError so the message prints cleanly
without --verbose. usage.Period replaces CurrentPeriod and takes the
selected month; the collector is unchanged apart from receiving its
bounds from the config. The help text, README, and Copilot instructions
now describe the selected billing period rather than the current one.

Closes #54

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

README documentation corrections remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds --month=YYYY-MM to report current or past UTC billing months, with validation, period-bound calculation, tests, and documentation updates.

Changes:

  • Adds month parsing and validation with clean error handling.
  • Calculates selected calendar-month boundaries.
  • Updates CLI help, tests, README, and project instructions.
File summaries
File Summary
usage/collector.go Calculates selected month bounds.
usage/collector_test.go Tests period boundary edge cases.
README.md Documents the new flag; two nit-level corrections are requested for the description and 2026-08 example (2 votes each).
main.go Parses and validates --month.
main_test.go Tests parsing and invalid-month errors.
.github/copilot-instructions.md Updates project guidance.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md
Comment thread README.md
@geoffreywiseman
geoffreywiseman merged commit 41706b6 into main Sep 11, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --month to report a past billing period

2 participants