feat(peak_usage): add peak-time indicator module#148
Open
timoklein wants to merge 3 commits intostephenleo:mainfrom
Open
feat(peak_usage): add peak-time indicator module#148timoklein wants to merge 3 commits intostephenleo:mainfrom
timoklein wants to merge 3 commits intostephenleo:mainfrom
Conversation
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>
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 One minor thing: |
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
Closes #146.
cship.peak_usagemodule that shows⏰ Peakwhen Anthropic's peak-time rate limiting is likely active (Mon–Fri 07:00–17:00 US Pacific by default)start_hour/end_hourwith validation warnings for invalid rangesConfiguration
Test plan
cargo test --lib modules::peak_usage— 23 tests passcargo test— full suite (343 unit + 66 integration) passescargo clippy -- -D warnings— cleancargo build --release— cleanstart_hour=0, end_hour=24🤖 Generated with Claude Code