Skip to content

feat(usage_limits): add {reset_at} absolute reset-time placeholder#192

Merged
stephenleo merged 1 commit into
stephenleo:mainfrom
Romboter:feat/usage-limits-reset-at
Jun 29, 2026
Merged

feat(usage_limits): add {reset_at} absolute reset-time placeholder#192
stephenleo merged 1 commit into
stephenleo:mainfrom
Romboter:feat/usage-limits-reset-at

Conversation

@Romboter

Copy link
Copy Markdown
Contributor

Adds a {reset_at} placeholder to $cship.usage_limits (five-hour, seven-day, and per-model formats), giving an absolute local clock time alongside the existing relative {reset} countdown.

  • Format — clock-only if the reset falls on today's local date (e.g. 7:42 PM), weekday-prefixed otherwise (e.g. Mon 9:00 AM); ? when the reset time is unknown, now when it's already past. Mirrors {reset}'s None/past handling.
  • New dependencychrono (clock feature only). Std has no portable local-timezone/DST API, and hand-rolling that conversion is a correctness trap; chrono::Local is the standard, minimal way to get it right.
  • Wired into format_output (five-hour/seven-day sections) and format_single_model (per-model breakdown) alongside the existing {pct}/{remaining}/{reset}/{pace} substitutions.
  • Docs updated: docs/configuration.md placeholder table + example block, and cship.toml (repo's own showcase config) updated to demonstrate {reset_at} in both formats.

Verification

  • cargo fmt --check
  • cargo clippy -- -D warnings
  • cargo test ✅ (476 unit + 73 integration)
  • cargo build --release

🤖 Generated with Claude Code

The existing {reset} placeholder only shows time-until-reset (e.g.
4h12m), which forces a mental "what time is that" calculation. Add
{reset_at} alongside it for the five-hour, seven-day, and per-model
usage_limits formats, rendering the absolute local clock time instead:
clock-only if the reset falls on today's local date (7:42 PM), weekday-
prefixed otherwise (Mon 9:00 AM). Mirrors {reset}'s None/past handling
(? / now).

Local-time/DST conversion has no portable std API, so this adds chrono
(clock feature only) rather than hand-rolling timezone arithmetic.

Updates docs/configuration.md (placeholder table + example) and the
repo's own cship.toml showcase config to demonstrate {reset_at} in both
formats.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stephenleo

Copy link
Copy Markdown
Owner

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Confirmed the {reset_at} placeholder does not already exist on main — the existing {reset} renders a relative countdown (e.g. 4h12m), whereas {reset_at} is a new absolute local clock time (e.g. 7:42 PM / Mon 9:00 AM).

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@stephenleo stephenleo merged commit 86a0ada into stephenleo:main Jun 29, 2026
3 checks passed
@stephenleo

Copy link
Copy Markdown
Owner

Thank you for your submission!

stephenleo added a commit that referenced this pull request Jun 29, 2026
#192 (the {reset_at} usage_limits placeholder) landed on main but was
omitted from the release notes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
stephenleo added a commit that referenced this pull request Jun 29, 2026
- Bump crate version to 1.8.0
- Promote the Unreleased changelog section to [1.8.0], including the
  previously-omitted {reset_at} entry (#192)
- Drop {reset_at} from the cship.toml showcase usage_limits formats

Ships the security fix (#191), the breaking cost-duration formatting
change, and the new effort (#187) and account (#153) modules.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
stephenleo added a commit that referenced this pull request Jun 29, 2026
- Bump crate version to 1.8.0
- Promote the Unreleased changelog section to [1.8.0], including the
  previously-omitted {reset_at} entry (#192)
- Drop {reset_at} from the cship.toml showcase usage_limits formats

Ships the security fix (#191), the breaking cost-duration formatting
change, and the new effort (#187) and account (#153) modules.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Romboter Romboter deleted the feat/usage-limits-reset-at branch July 7, 2026 13:41
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.

2 participants