Skip to content

feat: add today and this-week shortcuts - #1321

Closed
jsiu93 wants to merge 1 commit into
ccusage:mainfrom
jsiu93:feat/1300-today-this-week-shortcuts
Closed

jsiu93 wants to merge 1 commit into
ccusage:mainfrom
jsiu93:feat/1300-today-this-week-shortcuts

Conversation

@jsiu93

@jsiu93 jsiu93 commented Jun 15, 2026 •

Copy link
Copy Markdown

Summary

  • add top-level ccusage today and ccusage this-week shortcuts for unified all-agent daily reports
  • calculate today from the selected timezone, and calculate this-week from Monday through today
  • update generated CLI help snapshots plus README and guide docs

Test plan

  • cargo fmt --manifest-path rust/Cargo.toml --all --check
  • git diff --check
  • cargo test --manifest-path rust/Cargo.toml --workspace
  • CCUSAGE_PRICING_JSON_PATH="$(pwd)/rust/crates/ccusage/src/models-dev-pricing.json" cargo run --manifest-path rust/Cargo.toml -p ccusage --bin ccusage -- today --offline --json --no-cost --jq '.daily | length'
  • CCUSAGE_PRICING_JSON_PATH="$(pwd)/rust/crates/ccusage/src/models-dev-pricing.json" cargo run --manifest-path rust/Cargo.toml -p ccusage --bin ccusage -- this-week --offline --json --no-cost --jq '.daily | length'

Closes #1300


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Adds ccusage today and ccusage this-week as fast shortcuts for unified daily reports across all detected sources. Both respect --timezone and map to daily reports with the correct since/until.

  • New Features
    • ccusage today: today’s daily rows across all sources.
    • ccusage this-week: daily rows from Monday through today.
    • Shortcuts honor --timezone; internally set since/until.
    • CLI gains a Shortcut command path; parser, types, and main dispatch updated.
    • Root and contextual --help updated; README and guides refreshed.
    • Tests and help snapshots added for parsing and help output.

Written for commit 6e71eec. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added ccusage today shortcut command for viewing today's usage
    • Added ccusage this-week shortcut command for viewing this week's usage grouped by date
    • Both shortcuts respect --timezone setting when computing date ranges
  • Documentation

    • Updated usage guides with new shortcut command examples and options

@pullfrog

pullfrog Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

no API key found — this repo is configured to use deepseek/deepseek-v4-pro, which needs DEEPSEEK_API_KEY, but the runner has no key for it.

To fix: add the key as a GitHub Actions secret (referenced from your workflow's env: block) or as a Pullfrog secret in the console — or switch this repo to a different model (free models need no key).

Open repo secrets → · Configure model → · Setup docs → · Ask in Discord →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9430457c-8e65-45ed-a840-5663584e409a

📥 Commits

Reviewing files that changed from the base of the PR and between 10e3730 and 6e71eec.

⛔ Files ignored due to path filters (2)
  • rust/crates/ccusage-cli/src/snapshots/ccusage_cli__tests__root_help.snap is excluded by !**/*.snap
  • rust/crates/ccusage-cli/src/snapshots/ccusage_cli__tests__snapshots_representative_cli_parse_shapes.snap is excluded by !**/*.snap
📒 Files selected for processing (13)
  • apps/ccusage/README.md
  • docs/guide/all-reports.md
  • docs/guide/cli-options.md
  • docs/guide/daily-reports.md
  • docs/guide/getting-started.md
  • docs/guide/index.md
  • rust/crates/ccusage-cli/src/cli-commands.json
  • rust/crates/ccusage-cli/src/lib.rs
  • rust/crates/ccusage-cli/src/parser.rs
  • rust/crates/ccusage-cli/src/tests.rs
  • rust/crates/ccusage-cli/src/types.rs
  • rust/crates/ccusage/src/commands/mod.rs
  • rust/crates/ccusage/src/main.rs

📝 Walkthrough

Walkthrough

Two new top-level CLI shortcut commands—ccusage today and ccusage this-week—are added. A ShortcutCommand enum is introduced, the parser routes these strings to a new parse_shortcut_command helper, and shortcut_shared_args computes timezone-aware since/until date bounds. The main dispatcher routes Command::Shortcut through adapter::all::run. CLI config, tests, and documentation are updated accordingly.

Changes

today / this-week shortcut commands

Layer / File(s) Summary
ShortcutCommand type and re-export
rust/crates/ccusage-cli/src/types.rs, rust/crates/ccusage-cli/src/lib.rs
ShortcutCommand enum (Today, ThisWeek) and Command::Shortcut(ShortcutCommand, SharedArgs) variant are added; ShortcutCommand is re-exported from the crate root.
Parser dispatch and CLI config
rust/crates/ccusage-cli/src/parser.rs, rust/crates/ccusage-cli/src/cli-commands.json
parse_command routes "today" and "this-week" to parse_shortcut_command; is_command recognizes both strings; cli-commands.json gains command and page entries for both shortcuts.
Date-range computation and main dispatch
rust/crates/ccusage/src/commands/mod.rs, rust/crates/ccusage/src/main.rs
shortcut_shared_args computes timezone-aware since/until for today or current Monday-bounded week; shortcut_agent_args builds AgentCommandArgs with AgentReportKind::Daily; main dispatches Command::Shortcut to adapter::all::run.
Parser and business logic tests
rust/crates/ccusage-cli/src/tests.rs, rust/crates/ccusage/src/commands/mod.rs
Adds command_snapshot branch for Command::Shortcut, parsing tests for today/this-week, help-text assertions, snapshot cases, and unit tests for shortcut_shared_args with Tokyo and UTC timezone scenarios.
Documentation updates
apps/ccusage/README.md, docs/guide/...
Updates README, getting-started, index, daily-reports, all-reports, and cli-options guides to document ccusage today and ccusage this-week, including usage examples and --timezone interaction notes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 Hippity-hop, no more --since today,
Just type ccusage today and you're on your way!
this-week finds Monday with timezone delight,
The rabbit computes your date bounds just right.
Less typing, more hopping — what a glorious sprint! 🌟

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions

Copy link
Copy Markdown
Contributor

This PR was auto-closed. Only contributors approved with lgtm can open PRs. Open an issue first.

Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply.

If a maintainer replies lgtmi, your future issues will stay open. If a maintainer replies lgtm, your future issues and PRs will stay open.

See CONTRIBUTING.md.

@github-actions github-actions Bot closed this Jun 15, 2026
@ryoppippi ryoppippi added the triage:resolved Resolved by a later change or current implementation. label Aug 31, 2026
@ryoppippi

Copy link
Copy Markdown
Member

Historical audit: this pull request was auto-closed by the legacy contributor gate. That closure did not assess technical importance.

Audit result: resolved. A later merged change or the current main implementation covers this request. This PR is kept for history and does not need to be revived.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:resolved Resolved by a later change or current implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add today and this-week shortcut commands

2 participants