Skip to content

Conversation

@ryoppippi
Copy link
Owner

@ryoppippi ryoppippi commented Oct 1, 2025

Summary

  • Fix model name formatting regex to support multi-part version numbers like Claude Sonnet 4.5
  • Previously claude-sonnet-4-5-20250929 displayed as "sonnet-4", now shows "sonnet-4-5"

Changes

  • Updated regex from /claude-(\w+)-(\d+)-\d+/ to /claude-(\w+)-([\d-]+)-(\d{8})/
  • Added [\d-]+ pattern to match version numbers with hyphens
  • Updated JSDoc with new examples
  • Added test cases for Claude 4.5 and mixed version formats

Test Plan

  • All existing tests pass
  • New tests added for Claude 4.5 model formatting
  • Verified output shows "sonnet-4-5" in daily reports

Summary by CodeRabbit

  • New Features
    • Model names like “claude-sonnet-4-5-20250929” now display as “sonnet-4-5”.
    • Improved list formatting and ordering for mixed Claude model versions (e.g., includes “opus-4-1” and multiple sonnet variants).
  • Bug Fixes
    • Correct multiline rendering for model variants (e.g., “- sonnet-4-5”).
  • Documentation
    • Updated notes to reflect expanded model naming inputs and displayed outputs.
  • Tests
    • Added coverage for 4.5-style names and mixed-version scenarios.

Updated the model name regex pattern to properly handle version numbers
with hyphens (e.g., claude-sonnet-4-5-20250929). Previously, only single
digit versions were supported (e.g., claude-sonnet-4-20250514).

Changes:
- Modified regex from /claude-(\w+)-(\d+)-\d+/ to /claude-(\w+)-([\d-]+)-(\d{8})/
- Added [\d-]+ pattern to match multi-part version numbers like "4-5"
- Updated JSDoc examples to include claude-sonnet-4-5-20250929 format
- Added test cases for Claude 4.5 and mixed version formats

Fixes the issue where claude-sonnet-4-5-20250929 was being displayed as
"sonnet-4" instead of "sonnet-4-5" in usage reports.
@ryoppippi ryoppippi added the bug Something isn't working label Oct 1, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Expands Claude model name parsing in packages/terminal/src/table.ts to recognize 4.5-style identifiers with an optional sub-version and an 8-digit date, updating the regex and documentation. The formatter now outputs “sonnet-4-5” for inputs like “claude-sonnet-4-5-20250929”.

Changes

Cohort / File(s) Summary
Model name parsing update
packages/terminal/src/table.ts
Broadened regex to accept optional dash-separated sub-version and 8-digit date for Claude 4.5 models; formatter returns normalized variant (e.g., "sonnet-4-5"); updated doc comment accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

In terminals bright, my whiskers twitch,
New names hop in with a 4.5 switch.
Dates trail softly—footprints fine—
Regex burrows catch the line.
Sonnet, opus, versions play—
I thump approval: parsed today! 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/claude-sonnet-4-5-display

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 18a88a9 and 0822e4f.

📒 Files selected for processing (1)
  • packages/terminal/src/table.ts (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 1, 2025

Open in StackBlitz

npm i https://pkg.pr.new/ryoppippi/ccusage@681
npm i https://pkg.pr.new/ryoppippi/ccusage/@ccusage/codex@681
npm i https://pkg.pr.new/ryoppippi/ccusage/@ccusage/mcp@681

commit: 0822e4f

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide 0822e4f Oct 01 2025, 11:01 AM

@ryoppippi ryoppippi changed the title fix(terminal): support claude-sonnet-4-5 model name formatting fix(terminal): support multi-part model version numbers (4.5, 4.1, etc.) Oct 1, 2025
@ryoppippi ryoppippi merged commit 1bd304e into main Oct 1, 2025
16 of 17 checks passed
@ryoppippi ryoppippi deleted the fix/claude-sonnet-4-5-display branch October 1, 2025 11:02
@coderabbitai coderabbitai bot mentioned this pull request Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants