Skip to content

feat(peak_usage): add peak-time indicator module#148

Open
timoklein wants to merge 3 commits intostephenleo:mainfrom
timoklein:feat/gh-146-peak-time-indicator
Open

feat(peak_usage): add peak-time indicator module#148
timoklein wants to merge 3 commits intostephenleo:mainfrom
timoklein:feat/gh-146-peak-time-indicator

Conversation

@timoklein
Copy link
Copy Markdown

Summary

Closes #146.

  • Adds cship.peak_usage module that shows ⏰ Peak when Anthropic's peak-time rate limiting is likely active (Mon–Fri 07:00–17:00 US Pacific by default)
  • Zero new dependencies: uses Howard Hinnant's civil date algorithm and Tomohiko Sakamoto's day-of-week algorithm for DST-aware UTC→Pacific conversion
  • Configurable start_hour/end_hour with validation warnings for invalid ranges
  • 23 unit tests covering peak/off-peak, DST transitions, custom hours, weekday boundaries, and config validation

Configuration

[cship.peak_usage]
symbol = ""
style  = "fg:#e0af68"
# start_hour = 7   # optional, default
# end_hour = 17    # optional, default (use 24 for "through end of day")

Test plan

  • cargo test --lib modules::peak_usage — 23 tests pass
  • cargo test — full suite (343 unit + 66 integration) passes
  • cargo clippy -- -D warnings — clean
  • cargo build --release — clean
  • Manual test: verified indicator appears in live statusline with start_hour=0, end_hour=24

🤖 Generated with Claude Code

timoklein and others added 3 commits April 8, 2026 08:28
Add `cship.peak_usage` module that shows when Anthropic's peak-time rate
limiting is likely active, based on current time relative to US Pacific
business hours (Mon–Fri 07:00–17:00 PT by default).

- Zero new dependencies: uses Howard Hinnant's civil date algorithm and
  Tomohiko Sakamoto's day-of-week algorithm for DST-aware UTC→Pacific
  conversion
- Configurable start_hour/end_hour with validation and tracing::warn on
  invalid ranges
- 21 unit tests covering peak/off-peak, DST transitions, custom hours,
  weekday boundaries, and config validation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Accept end_hour=24 to mean "through end of day" (exclusive upper bound)
- Add [cship.peak_usage] section to cship.toml with default symbol/style
- Add validation tests for end_hour=24 boundary

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@timoklein
Copy link
Copy Markdown
Author

@stephenleo I've let Claude add it to the cost guardian example config, where I think it is a good fit. I wasn't able to generate a good example screenshot because I couldn't replicate the theme. We can also just remove it again, then the screenshot doesn't need to get updated.

Indicator shows up properly when you set start_hour=0 and end_hour=24 (debug setting).

One minor thing: CONTRIBUTING.md doesn't say which BMAD module you need to use /bmad-quick-dev. I just installed all.

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.

Peak-time indicator

1 participant