Skip to content

Conversation

@constantins2001
Copy link
Contributor

@constantins2001 constantins2001 commented Jun 10, 2025

fixes: #14
image
image
image
image

Summary by CodeRabbit

  • New Features

    • Usage reports now display detailed per-model token and cost breakdowns in both JSON and table formats for daily, session, and monthly views.
    • Added a "Models" column to usage tables, summarizing models used per period.
    • Introduced a new command-line flag to show or hide per-model breakdowns.
  • Enhancements

    • Improved display formatting for model names and model summaries in reports.
  • Tests

    • Updated and extended test cases to cover new model breakdown data in usage reports.
  • Documentation

    • Updated README with instructions and examples for the new per-model breakdown features and the --breakdown flag.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @constantins2001, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the usage reporting capabilities of the tool by introducing model-specific breakdowns. Users can now see not just total usage and cost per day, month, or session, but also how that usage and cost is distributed among the different models employed, providing much finer-grained insights.

Highlights

  • Enhanced Usage Reports: The daily, monthly, and session usage reports now include a 'Models' column showing which models were used, and nested rows providing a breakdown of token usage and cost per model for each entry.
  • Data Structure Updates: Added modelsUsed (array of strings) and modelBreakdowns (array of objects detailing usage/cost per model) fields to the daily, monthly, and session usage data structures.
  • Data Aggregation Logic: Modified the data loading functions (loadDailyUsageData, loadSessionData, loadMonthlyUsageData) to parse model information from usage entries, aggregate tokens and cost by model, and include this breakdown data in the final report objects.
  • CLI Output Formatting: Updated the CLI commands (daily, monthly, session) to display the new 'Models' column and render the model breakdown data as indented, grayed-out rows beneath the main entry in the table output.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces model usage breakdowns and a list of models used into the daily, monthly, and session-based usage reports. This is a significant enhancement for users wanting more detailed insights. My review includes suggestions aimed at improving maintainability and robustness.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 10, 2025

Open in StackBlitz

npm i https://pkg.pr.new/ryoppippi/ccusage@52

commit: 89f85d5

@ryoppippi
Copy link
Owner

Hi @constantins2001
Thanks for your contribution
Could you run formatter before committing

@ryoppippi
Copy link
Owner

The new table looks really good!
But I'd like you to display the cost summation per model when we pass some options to cli and keep the simple table if the option is not enabled

@constantins2001
Copy link
Contributor Author

The new table looks really good! But I'd like you to display the cost summation per model when we pass some options to cli and keep the simple table if the option is not enabled

will implement soon, thanks for the feedback!

@ryoppippi
Copy link
Owner

pkg.pr.new fails, but you can ignore it!

@ryoppippi ryoppippi requested a review from Copilot June 11, 2025 11:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances usage reports by including per-model breakdowns and a summary of models used.

  • Introduces formatModelName and formatModelsDisplay utilities to normalize and list model identifiers.
  • Extends schemas (ModelBreakdownSchema) and data loaders to collect modelsUsed and compute modelBreakdowns in daily, session, and monthly reports.
  • Updates CLI commands (daily, session, monthly) to display models and their cost/token breakdowns, and adjusts corresponding tests.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils.internal.ts Added helpers to parse and format model names for reporting.
src/data-loader.ts Extended data loading to capture and aggregate model usage.
src/data-loader.test.ts Updated tests to assert new model fields in monthly reports.
src/commands/session.ts Updated session command to render models and breakdown rows.
src/commands/monthly.ts Updated monthly command to render models and breakdown rows.
src/commands/daily.ts Updated daily command to render models and breakdown rows.
src/calculate-cost.test.ts Added fields in cost aggregation tests for model usage.
Comments suppressed due to low confidence (1)

src/utils.internal.ts:29

  • There are no unit tests for formatModelName or formatModelsDisplay. Adding tests to cover parsing, fallback, and unique/ sorting behavior would improve confidence in these utilities.
export function formatModelName(modelName: string): string {


return entries.reduce(
// Aggregate by model first
const modelAggregates = new Map<string, {
Copy link

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The aggregation logic for model breakdowns is duplicated across daily, session, and monthly loaders. Extract this into a shared helper to reduce duplication and simplify future maintenance.

Copilot uses AI. Check for mistakes.
pc.gray(formatNumber(breakdown.outputTokens)),
pc.gray(formatNumber(breakdown.cacheCreationTokens)),
pc.gray(formatNumber(breakdown.cacheReadTokens)),
pc.gray(formatNumber(breakdown.inputTokens + breakdown.outputTokens + breakdown.cacheCreationTokens + breakdown.cacheReadTokens)),
Copy link

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of manually summing token fields here, consider reusing the existing getTotalTokens helper to ensure consistent total calculation.

Suggested change
pc.gray(formatNumber(breakdown.inputTokens + breakdown.outputTokens + breakdown.cacheCreationTokens + breakdown.cacheReadTokens)),
pc.gray(formatNumber(getTotalTokens(breakdown))),

Copilot uses AI. Check for mistakes.
@coderabbitai
Copy link

coderabbitai bot commented Jun 11, 2025

Walkthrough

The codebase was updated to add per-model usage and cost breakdowns to daily, session, and monthly reports. Data loading, aggregation, and reporting functions were modified to collect, aggregate, and display detailed model-level statistics in both JSON and CLI table formats, with a new breakdown flag controlling detailed output.

Changes

Files Change Summary
src/data-loader.ts, src/data-loader.test.ts Added per-model breakdown schema/types, aggregation logic, and extended data structures and tests to include modelsUsed and modelBreakdowns.
src/commands/daily.ts, src/commands/monthly.ts, src/commands/session.ts Enhanced CLI and JSON output to display models used and per-model breakdowns, updated table layouts, and formatting.
src/shared-args.internal.ts Added breakdown boolean CLI flag to control per-model breakdown display.
src/utils.internal.ts Added utilities for formatting model names and display strings.
src/calculate-cost.test.ts Updated test data to include modelsUsed and modelBreakdowns fields.
README.md Updated documentation and examples to describe new model tracking and breakdown features with usage instructions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI_Command
    participant DataLoader
    participant Utils

    User->>CLI_Command: Run daily/monthly/session command [--breakdown]
    CLI_Command->>DataLoader: load*UsageData()
    DataLoader->>DataLoader: Aggregate usage by model
    DataLoader->>CLI_Command: Return usage with modelsUsed & modelBreakdowns
    CLI_Command->>Utils: formatModelsDisplay(modelsUsed)
    CLI_Command->>User: Display table/JSON with per-model breakdown (if --breakdown)
Loading

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Show usage and cost per model (#14)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Poem

A rabbit hopped through fields of code,
Counting tokens each model showed.
Now Sonnet, Opus, all in view—
Costs and usage, clear and true!
With breakdowns neat and models named,
This carrot patch is well proclaimed.
🥕✨


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (2)
src/commands/session.ts (1)

52-67: 🛠️ Refactor suggestion

Strong typing missing for modelsUsed / modelBreakdowns in JSON payload

sessionData is inferred as any, so every field access here is flagged by no-unsafe-* rules.
Define a proper interface for the loader output (e.g. SessionUsageRow) and make loadSessionData() return SessionUsageRow[]. That single change will eliminate the 10-plus ESLint errors downstream and give editors proper autocompletion.

🧰 Tools
🪛 ESLint

[error] 52-52: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 52-52: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 56-56: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 56-56: Unsafe member access .projectPath on an error typed value.

(ts/no-unsafe-member-access)


[error] 57-57: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 57-57: Unsafe member access .sessionId on an error typed value.

(ts/no-unsafe-member-access)


[error] 58-58: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 58-58: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 59-59: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 59-59: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 60-60: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 60-60: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 61-61: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 61-61: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 62-62: Unsafe argument of type error typed assigned to a parameter of type TokenData.

(ts/no-unsafe-argument)


[error] 63-63: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 63-63: Unsafe member access .totalCost on an error typed value.

(ts/no-unsafe-member-access)


[error] 64-64: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 64-64: Unsafe member access .lastActivity on an error typed value.

(ts/no-unsafe-member-access)


[error] 65-65: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 65-65: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 66-66: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 66-66: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)

src/commands/monthly.ts (1)

63-76: 🛠️ Refactor suggestion

Unsafe member access – add proper types for monthly rows

Same issue as in session.ts: introduce a MonthlyUsageRow type and make loadMonthlyUsageData() return MonthlyUsageRow[].
This cleans up the no-unsafe-* warnings on modelsUsed / modelBreakdowns.

🧰 Tools
🪛 ESLint

[error] 63-63: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 63-63: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 67-67: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 67-67: Unsafe member access .month on an error typed value.

(ts/no-unsafe-member-access)


[error] 68-68: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 68-68: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 69-69: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 69-69: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 70-70: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 70-70: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 71-71: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 71-71: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 72-72: Unsafe argument of type error typed assigned to a parameter of type TokenData.

(ts/no-unsafe-argument)


[error] 73-73: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 73-73: Unsafe member access .totalCost on an error typed value.

(ts/no-unsafe-member-access)


[error] 74-74: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 74-74: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 75-75: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 75-75: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)

♻️ Duplicate comments (5)
src/utils.internal.ts (1)

33-33: Fix regex pattern to support hyphens in model names.

The regex pattern won't match model names containing hyphens in the model segment.

src/data-loader.ts (2)

223-223: Extract the '' string literal as a constant.

The string literal is used multiple times across different functions.

Also applies to: 275-275, 428-428, 480-480, 543-543, 577-577


211-250: Extract duplicated model aggregation logic into a shared helper.

The model aggregation and breakdown creation logic is duplicated across daily, session, and monthly data loaders.

Also applies to: 416-455, 531-570

🧰 Tools
🪛 ESLint

[error] 235-235: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 235-235: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 236-236: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 236-236: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 237-237: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 237-237: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 238-238: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 238-238: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)

src/commands/session.ts (1)

133-149: 🛠️ Refactor suggestion

Don’t hand-roll total-token math for every breakdown row

The same four-field addition appears in all three commands and is easy to get out of sync with getTotalTokens().

- pc.gray(formatNumber(
-   breakdown.inputTokens
-   + breakdown.outputTokens
-   + breakdown.cacheCreationTokens
-   + breakdown.cacheReadTokens)),
+ pc.gray(formatNumber(getTotalTokens(breakdown))),

Even better: add a totalTokens property to ModelBreakdown when you build the data once in data-loader.ts and simply display it here.

🧰 Tools
🪛 ESLint

[error] 134-134: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 134-134: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 135-135: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 136-136: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 137-137: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 137-137: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 140-140: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 140-140: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 140-140: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 140-140: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 141-141: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 141-141: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 141-141: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 141-141: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 142-142: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 142-142: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 142-142: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 142-142: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 143-143: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 143-143: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 143-143: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 143-143: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 144-144: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 144-144: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 145-145: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 145-145: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 145-145: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 145-145: Unsafe member access .cost on an error typed value.

(ts/no-unsafe-member-access)

src/commands/daily.ts (1)

117-129: Total-token math duplicated – see earlier comment

The manual summation of four token fields repeats here. Please reuse getTotalTokens() or add a totalTokens field in the loader.

🧰 Tools
🪛 ESLint

[error] 117-117: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 118-118: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 118-118: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 119-119: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 119-119: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 121-121: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 121-121: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 121-121: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 121-121: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 122-122: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 122-122: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 122-122: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 122-122: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 123-123: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 123-123: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 123-123: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 123-123: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 124-124: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 124-124: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 124-124: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 124-124: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 125-125: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 125-125: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 126-126: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 126-126: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 126-126: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 126-126: Unsafe member access .cost on an error typed value.

(ts/no-unsafe-member-access)

🧹 Nitpick comments (5)
src/data-loader.ts (1)

525-609: Consider simplifying the monthly aggregation logic.

While the current implementation is correct, it could be more concise by leveraging array methods effectively.

You could simplify the aggregation by using a combination of flatMap and reduce:

-	const monthlyArray: MonthlyUsage[] = [];
-	for (const [month, dailyEntries] of Object.entries(groupedByMonth)) {
-		if (dailyEntries == null) {
-			continue;
-		}
-
-		// Aggregate model breakdowns across all days
-		const modelAggregates = new Map<string, {
-			inputTokens: number;
-			outputTokens: number;
-			cacheCreationTokens: number;
-			cacheReadTokens: number;
-			cost: number;
-		}>();
-
-		for (const daily of dailyEntries) {
-			for (const breakdown of daily.modelBreakdowns) {
-				// Skip synthetic model
-				if (breakdown.modelName === '<synthetic>') {
-					continue;
-				}
-				const existing = modelAggregates.get(breakdown.modelName) ?? {
-					inputTokens: 0,
-					outputTokens: 0,
-					cacheCreationTokens: 0,
-					cacheReadTokens: 0,
-					cost: 0,
-				};
-
-				modelAggregates.set(breakdown.modelName, {
-					inputTokens: existing.inputTokens + breakdown.inputTokens,
-					outputTokens: existing.outputTokens + breakdown.outputTokens,
-					cacheCreationTokens: existing.cacheCreationTokens + breakdown.cacheCreationTokens,
-					cacheReadTokens: existing.cacheReadTokens + breakdown.cacheReadTokens,
-					cost: existing.cost + breakdown.cost,
-				});
-			}
-		}
-
-		// Create model breakdowns
-		const modelBreakdowns: ModelBreakdown[] = Array.from(modelAggregates.entries())
-			.map(([modelName, stats]) => ({
-				modelName,
-				...stats,
-			}))
-			.sort((a, b) => b.cost - a.cost);
-
-		// Collect unique models
-		const modelsSet = new Set<string>();
-		for (const data of dailyEntries) {
-			for (const model of data.modelsUsed) {
-				// Skip synthetic model
-				if (model !== '<synthetic>') {
-					modelsSet.add(model);
-				}
-			}
-		}
-
-		// Calculate totals from daily entries
-		let totalInputTokens = 0;
-		let totalOutputTokens = 0;
-		let totalCacheCreationTokens = 0;
-		let totalCacheReadTokens = 0;
-		let totalCost = 0;
-
-		for (const daily of dailyEntries) {
-			totalInputTokens += daily.inputTokens;
-			totalOutputTokens += daily.outputTokens;
-			totalCacheCreationTokens += daily.cacheCreationTokens;
-			totalCacheReadTokens += daily.cacheReadTokens;
-			totalCost += daily.totalCost;
-		}
-		const monthlyUsage: MonthlyUsage = {
-			month,
-			inputTokens: totalInputTokens,
-			outputTokens: totalOutputTokens,
-			cacheCreationTokens: totalCacheCreationTokens,
-			cacheReadTokens: totalCacheReadTokens,
-			totalCost,
-			modelsUsed: Array.from(modelsSet),
-			modelBreakdowns,
-		};
-
-		monthlyArray.push(monthlyUsage);
-	}
+	const monthlyArray: MonthlyUsage[] = Object.entries(groupedByMonth)
+		.filter(([_, dailyEntries]) => dailyEntries != null)
+		.map(([month, dailyEntries]) => {
+			// Aggregate model breakdowns across all days
+			const modelAggregates = new Map<string, {
+				inputTokens: number;
+				outputTokens: number;
+				cacheCreationTokens: number;
+				cacheReadTokens: number;
+				cost: number;
+			}>();
+
+			// Aggregate breakdowns
+			dailyEntries.forEach(daily => {
+				daily.modelBreakdowns
+					.filter(breakdown => breakdown.modelName !== '<synthetic>')
+					.forEach(breakdown => {
+						const existing = modelAggregates.get(breakdown.modelName) ?? {
+							inputTokens: 0,
+							outputTokens: 0,
+							cacheCreationTokens: 0,
+							cacheReadTokens: 0,
+							cost: 0,
+						};
+
+						modelAggregates.set(breakdown.modelName, {
+							inputTokens: existing.inputTokens + breakdown.inputTokens,
+							outputTokens: existing.outputTokens + breakdown.outputTokens,
+							cacheCreationTokens: existing.cacheCreationTokens + breakdown.cacheCreationTokens,
+							cacheReadTokens: existing.cacheReadTokens + breakdown.cacheReadTokens,
+							cost: existing.cost + breakdown.cost,
+						});
+					});
+			});
+
+			// Create sorted model breakdowns
+			const modelBreakdowns: ModelBreakdown[] = Array.from(modelAggregates.entries())
+				.map(([modelName, stats]) => ({
+					modelName,
+					...stats,
+				}))
+				.sort((a, b) => b.cost - a.cost);
+
+			// Collect unique models
+			const modelsUsed = Array.from(new Set(
+				dailyEntries.flatMap(data => 
+					data.modelsUsed.filter(model => model !== '<synthetic>')
+				)
+			));
+
+			// Calculate totals
+			const totals = dailyEntries.reduce((acc, daily) => ({
+				inputTokens: acc.inputTokens + daily.inputTokens,
+				outputTokens: acc.outputTokens + daily.outputTokens,
+				cacheCreationTokens: acc.cacheCreationTokens + daily.cacheCreationTokens,
+				cacheReadTokens: acc.cacheReadTokens + daily.cacheReadTokens,
+				totalCost: acc.totalCost + daily.totalCost,
+			}), {
+				inputTokens: 0,
+				outputTokens: 0,
+				cacheCreationTokens: 0,
+				cacheReadTokens: 0,
+				totalCost: 0,
+			});
+
+			return {
+				month,
+				...totals,
+				modelsUsed,
+				modelBreakdowns,
+			};
+		});
🧰 Tools
🪛 ESLint

[error] 541-541: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 543-543: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 546-546: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 546-546: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 554-554: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 554-554: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 555-555: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 555-555: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 556-556: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 556-556: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 557-557: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 557-557: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 558-558: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 558-558: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 559-559: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 559-559: Unsafe member access .cost on an error typed value.

(ts/no-unsafe-member-access)


[error] 575-575: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 578-578: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 591-591: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 592-592: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 593-593: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 594-594: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 595-595: Unsafe member access .totalCost on an error typed value.

(ts/no-unsafe-member-access)

src/commands/session.ts (2)

76-106: Table header / alignment logic is now copy-pasted in 3 commands

daily.ts, monthly.ts and session.ts contain virtually identical code blocks for:

  • header text
  • column alignments
  • separator row building ('─'.repeat(...))

Extract a tiny helper such as buildUsageTable(head: string[]): Table and reuse it.
This will DRY 70+ lines and keep future column tweaks in one place.

🧰 Tools
🪛 ESLint

[error] 77-105: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 77-105: Unsafe construction of a(n) error type typed value.

(ts/no-unsafe-call)


134-135: Boolean flag check violates strict-boolean-expressions

ctx.values.breakdown is typed as any, so the truthiness check is unsafe. Either:

if (Boolean(ctx.values.breakdown)) {

or tighten the type in shared-args.internal.ts:

breakdown: { type: 'boolean', default: false } satisfies Arg<boolean>

This removes the ESLint error and clarifies intent.

🧰 Tools
🪛 ESLint

[error] 134-134: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 134-134: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 135-135: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)

src/commands/monthly.ts (1)

127-128: Boolean flag check should be explicit

Same strict-boolean-expressions issue: wrap with Boolean(ctx.values.breakdown) or type the arg as boolean.

🧰 Tools
🪛 ESLint

[error] 127-127: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 127-127: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 128-128: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)

src/commands/daily.ts (1)

116-117: Explicit boolean cast recommended

if (ctx.values.breakdown) triggers strict-boolean-expressions; cast or type the flag as boolean.

🧰 Tools
🪛 ESLint

[error] 116-116: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 116-116: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 117-117: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f97cd3e and f4530c7.

📒 Files selected for processing (8)
  • src/calculate-cost.test.ts (4 hunks)
  • src/commands/daily.ts (6 hunks)
  • src/commands/monthly.ts (6 hunks)
  • src/commands/session.ts (7 hunks)
  • src/data-loader.test.ts (3 hunks)
  • src/data-loader.ts (13 hunks)
  • src/shared-args.internal.ts (1 hunks)
  • src/utils.internal.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/commands/session.ts (1)
src/utils.internal.ts (2)
  • formatModelsDisplay (41-45)
  • formatModelName (29-39)
src/commands/monthly.ts (2)
src/utils.internal.ts (2)
  • formatModelsDisplay (41-45)
  • formatModelName (29-39)
src/calculate-cost.ts (1)
  • getTotalTokens (39-46)
src/commands/daily.ts (2)
src/utils.internal.ts (4)
  • formatModelsDisplay (41-45)
  • formatNumber (1-3)
  • formatCurrency (5-7)
  • formatModelName (29-39)
src/calculate-cost.ts (1)
  • getTotalTokens (39-46)
🪛 ESLint
src/commands/session.ts

[error] 65-65: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 65-65: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 66-66: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 66-66: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 120-120: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 120-120: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 123-123: Unsafe argument of type error typed assigned to a parameter of type string[].

(ts/no-unsafe-argument)


[error] 123-123: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 134-134: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 134-134: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 135-135: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 136-136: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 137-137: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 137-137: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 140-140: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 140-140: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 140-140: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 140-140: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 141-141: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 141-141: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 141-141: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 141-141: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 142-142: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 142-142: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 142-142: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 142-142: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 143-143: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 143-143: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 143-143: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 143-143: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 144-144: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 144-144: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 144-144: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 145-145: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 145-145: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 145-145: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 145-145: Unsafe member access .cost on an error typed value.

(ts/no-unsafe-member-access)


[error] 153-153: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 153-153: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)

src/commands/monthly.ts

[error] 74-74: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 74-74: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 75-75: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 75-75: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 115-115: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 115-115: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 116-116: Unsafe member access .month on an error typed value.

(ts/no-unsafe-member-access)


[error] 117-117: Unsafe argument of type error typed assigned to a parameter of type string[].

(ts/no-unsafe-argument)


[error] 117-117: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 118-118: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 118-118: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 119-119: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 119-119: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 120-120: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 120-120: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 121-121: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 121-121: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 122-122: Unsafe argument of type error typed assigned to a parameter of type TokenData.

(ts/no-unsafe-argument)


[error] 123-123: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 123-123: Unsafe member access .totalCost on an error typed value.

(ts/no-unsafe-member-access)


[error] 127-127: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 127-127: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 128-128: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 129-129: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 129-129: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 130-130: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 130-130: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 132-132: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 132-132: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 132-132: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 132-132: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 133-133: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 133-133: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 133-133: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 133-133: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 134-134: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 134-134: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 134-134: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 134-134: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 135-135: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 135-135: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 135-135: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 135-135: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 136-136: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 136-136: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 137-137: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 137-137: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 137-137: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 137-137: Unsafe member access .cost on an error typed value.

(ts/no-unsafe-member-access)


[error] 156-156: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 156-156: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 157-157: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 157-157: Unsafe member access .yellow on an error typed value.

(ts/no-unsafe-member-access)

src/commands/daily.ts

[error] 63-63: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 63-63: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 64-64: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 64-64: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 104-104: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 104-104: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 105-105: Unsafe member access .date on an error typed value.

(ts/no-unsafe-member-access)


[error] 106-106: Unsafe argument of type error typed assigned to a parameter of type string[].

(ts/no-unsafe-argument)


[error] 106-106: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 107-107: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 107-107: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 108-108: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 108-108: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 109-109: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 109-109: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 110-110: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 110-110: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 111-111: Unsafe argument of type error typed assigned to a parameter of type TokenData.

(ts/no-unsafe-argument)


[error] 112-112: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 112-112: Unsafe member access .totalCost on an error typed value.

(ts/no-unsafe-member-access)


[error] 116-116: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 116-116: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 117-117: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 118-118: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 118-118: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 119-119: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 119-119: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 121-121: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 121-121: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 121-121: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 121-121: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 122-122: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 122-122: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 122-122: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 122-122: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 123-123: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 123-123: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 123-123: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 123-123: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 124-124: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 124-124: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 124-124: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 124-124: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 125-125: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 125-125: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 125-125: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 126-126: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 126-126: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 126-126: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 126-126: Unsafe member access .cost on an error typed value.

(ts/no-unsafe-member-access)


[error] 145-145: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 145-145: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 146-146: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 146-146: Unsafe member access .yellow on an error typed value.

(ts/no-unsafe-member-access)

src/data-loader.ts

[error] 35-42: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 35-35: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 35-35: Unsafe member access .object on an error typed value.

(ts/no-unsafe-member-access)


[error] 36-36: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 36-36: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 36-36: Unsafe member access .string on an error typed value.

(ts/no-unsafe-member-access)


[error] 37-37: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 37-37: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 37-37: Unsafe member access .number on an error typed value.

(ts/no-unsafe-member-access)


[error] 38-38: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 38-38: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 38-38: Unsafe member access .number on an error typed value.

(ts/no-unsafe-member-access)


[error] 39-39: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 39-39: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 39-39: Unsafe member access .number on an error typed value.

(ts/no-unsafe-member-access)


[error] 40-40: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 40-40: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 40-40: Unsafe member access .number on an error typed value.

(ts/no-unsafe-member-access)


[error] 41-41: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 41-41: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 41-41: Unsafe member access .number on an error typed value.

(ts/no-unsafe-member-access)


[error] 56-56: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 56-56: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 56-56: Unsafe member access .array on an error typed value.

(ts/no-unsafe-member-access)


[error] 56-56: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 56-56: Unsafe member access .string on an error typed value.

(ts/no-unsafe-member-access)


[error] 57-57: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 57-57: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 57-57: Unsafe member access .array on an error typed value.

(ts/no-unsafe-member-access)


[error] 72-72: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 72-72: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 72-72: Unsafe member access .array on an error typed value.

(ts/no-unsafe-member-access)


[error] 72-72: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 72-72: Unsafe member access .string on an error typed value.

(ts/no-unsafe-member-access)


[error] 73-73: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 73-73: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 73-73: Unsafe member access .array on an error typed value.

(ts/no-unsafe-member-access)


[error] 88-88: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 88-88: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 88-88: Unsafe member access .array on an error typed value.

(ts/no-unsafe-member-access)


[error] 88-88: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 88-88: Unsafe member access .string on an error typed value.

(ts/no-unsafe-member-access)


[error] 89-89: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 89-89: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 89-89: Unsafe member access .array on an error typed value.

(ts/no-unsafe-member-access)


[error] 193-193: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 193-193: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 193-193: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 193-193: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 235-235: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 235-235: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 236-236: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 236-236: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 237-237: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 237-237: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 238-238: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 238-238: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 381-381: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 381-381: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 440-440: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 440-440: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 441-441: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 441-441: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 442-442: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 442-442: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 443-443: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 443-443: Unsafe member access .message on an error typed value.

(ts/no-unsafe-member-access)


[error] 541-541: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 543-543: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 546-546: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 546-546: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 554-554: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 554-554: Unsafe member access .modelName on an error typed value.

(ts/no-unsafe-member-access)


[error] 555-555: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 555-555: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 556-556: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 556-556: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 557-557: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 557-557: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 558-558: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 558-558: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 559-559: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 559-559: Unsafe member access .cost on an error typed value.

(ts/no-unsafe-member-access)


[error] 575-575: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 578-578: Unsafe argument of type error typed assigned to a parameter of type string.

(ts/no-unsafe-argument)


[error] 591-591: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 592-592: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 593-593: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 594-594: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 595-595: Unsafe member access .totalCost on an error typed value.

(ts/no-unsafe-member-access)

🔇 Additional comments (4)
src/utils.internal.ts (1)

41-45: LGTM!

The function correctly handles deduplication, formatting, and sorting of model names.

src/shared-args.internal.ts (1)

67-72: LGTM!

The new breakdown CLI argument is well-defined and follows the existing pattern.

src/calculate-cost.test.ts (1)

19-20: LGTM!

Test data correctly updated to match the new schema with modelsUsed and modelBreakdowns properties.

Also applies to: 29-30, 54-55, 67-68

src/data-loader.test.ts (1)

367-376: LGTM!

Test assertions correctly validate the new model breakdown functionality with appropriate expectations for the 'unknown' model when no model information is provided.

Also applies to: 384-393, 439-448

@ryoppippi
Copy link
Owner

when you done, mention me

@ryoppippi
Copy link
Owner

also please update README as well

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
src/utils.internal.ts (1)

31-40: Regex still rejects model names containing hyphens

Previous feedback pointed out that (\w+) fails for names like sonnet-pro-4. The regex is unchanged, so such models will still be reported as the full, un-shortened string and will break duplicate-removal logic in formatModelsDisplay.

-const match = modelName.match(/claude-(\w+)-(\d+)-\d+/);
+const match = modelName.match(/claude-([\w-]+)-(\d+)-\d+/);
src/commands/session.ts (1)

133-137: Same boolean-flag issue as in daily.ts

Please apply the explicit boolean check (or stronger typing) here too to silence ESLint and avoid accidental truthy coercion.

-if (ctx.values.breakdown) {
+if (Boolean(ctx.values.breakdown) === true) {
   // Session has 2 extra columns before data and 1 trailing column
   pushBreakdownRows(table, data.modelBreakdowns, 2, 1);
 }
🧰 Tools
🪛 ESLint

[error] 134-134: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 134-134: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe argument of type error typed assigned to a parameter of type any[].

(ts/no-unsafe-argument)


[error] 136-136: Unsafe argument of type error typed assigned to a parameter of type { modelName: string; inputTokens: number; outputTokens: number; cacheCreationTokens: number; cacheReadTokens: number; cost: number; }[].

(ts/no-unsafe-argument)


[error] 136-136: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)

src/commands/monthly.ts (1)

126-129: Boolean-flag guard needed

Same strict-boolean-expressions warning here; wrap ctx.values.breakdown in Boolean() or enforce proper typing.

-if (ctx.values.breakdown) {
+if (Boolean(ctx.values.breakdown) === true) {
   pushBreakdownRows(table, data.modelBreakdowns);
 }
🧰 Tools
🪛 ESLint

[error] 127-127: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 127-127: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 128-128: Unsafe argument of type error typed assigned to a parameter of type any[].

(ts/no-unsafe-argument)


[error] 128-128: Unsafe argument of type error typed assigned to a parameter of type { modelName: string; inputTokens: number; outputTokens: number; cacheCreationTokens: number; cacheReadTokens: number; cost: number; }[].

(ts/no-unsafe-argument)


[error] 128-128: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)

🧹 Nitpick comments (1)
src/utils.internal.ts (1)

78-88: Reuse getTotalTokens for consistency & future-proofing

pushBreakdownRows manually re-derives the total token count. We already have a single-source helper (getTotalTokens) – using it prevents divergence if fields ever change.

-import {
-   // …
-} from '../calculate-cost.ts';
+import { getTotalTokens } from '../calculate-cost.ts';

-const totalTokens = breakdown.inputTokens + breakdown.outputTokens
-  + breakdown.cacheCreationTokens + breakdown.cacheReadTokens;
+const totalTokens = getTotalTokens(breakdown);
🧰 Tools
🪛 ESLint

[error] 82-82: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 82-82: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 83-83: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 83-83: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 84-84: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 84-84: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 85-85: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 85-85: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 86-86: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 86-86: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 87-87: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 87-87: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4530c7 and bc1484e.

📒 Files selected for processing (4)
  • src/commands/daily.ts (6 hunks)
  • src/commands/monthly.ts (6 hunks)
  • src/commands/session.ts (7 hunks)
  • src/utils.internal.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/commands/session.ts (1)
src/utils.internal.ts (2)
  • formatModelsDisplay (43-47)
  • pushBreakdownRows (56-97)
src/commands/daily.ts (2)
src/utils.internal.ts (4)
  • formatModelsDisplay (43-47)
  • formatNumber (3-5)
  • formatCurrency (7-9)
  • pushBreakdownRows (56-97)
src/calculate-cost.ts (1)
  • getTotalTokens (39-46)
src/commands/monthly.ts (2)
src/utils.internal.ts (4)
  • formatModelsDisplay (43-47)
  • formatNumber (3-5)
  • formatCurrency (7-9)
  • pushBreakdownRows (56-97)
src/calculate-cost.ts (1)
  • getTotalTokens (39-46)
🪛 ESLint
src/commands/session.ts

[error] 65-65: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 65-65: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 66-66: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 66-66: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 120-120: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 120-120: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 123-123: Unsafe argument of type error typed assigned to a parameter of type string[].

(ts/no-unsafe-argument)


[error] 123-123: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 134-134: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 134-134: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 136-136: Unsafe argument of type error typed assigned to a parameter of type any[].

(ts/no-unsafe-argument)


[error] 136-136: Unsafe argument of type error typed assigned to a parameter of type { modelName: string; inputTokens: number; outputTokens: number; cacheCreationTokens: number; cacheReadTokens: number; cost: number; }[].

(ts/no-unsafe-argument)


[error] 136-136: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 141-141: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 141-141: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)

src/commands/daily.ts

[error] 63-63: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 63-63: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 64-64: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 64-64: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 104-104: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 104-104: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 105-105: Unsafe member access .date on an error typed value.

(ts/no-unsafe-member-access)


[error] 106-106: Unsafe argument of type error typed assigned to a parameter of type string[].

(ts/no-unsafe-argument)


[error] 106-106: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 107-107: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 107-107: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 108-108: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 108-108: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 109-109: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 109-109: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 110-110: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 110-110: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 111-111: Unsafe argument of type error typed assigned to a parameter of type TokenData.

(ts/no-unsafe-argument)


[error] 112-112: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 112-112: Unsafe member access .totalCost on an error typed value.

(ts/no-unsafe-member-access)


[error] 116-116: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 116-116: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 117-117: Unsafe argument of type error typed assigned to a parameter of type any[].

(ts/no-unsafe-argument)


[error] 117-117: Unsafe argument of type error typed assigned to a parameter of type { modelName: string; inputTokens: number; outputTokens: number; cacheCreationTokens: number; cacheReadTokens: number; cost: number; }[].

(ts/no-unsafe-argument)


[error] 117-117: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 134-134: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 134-134: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 135-135: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 135-135: Unsafe member access .yellow on an error typed value.

(ts/no-unsafe-member-access)

src/commands/monthly.ts

[error] 74-74: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 74-74: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 75-75: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


[error] 75-75: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 115-115: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 115-115: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 116-116: Unsafe member access .month on an error typed value.

(ts/no-unsafe-member-access)


[error] 117-117: Unsafe argument of type error typed assigned to a parameter of type string[].

(ts/no-unsafe-argument)


[error] 117-117: Unsafe member access .modelsUsed on an error typed value.

(ts/no-unsafe-member-access)


[error] 118-118: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 118-118: Unsafe member access .inputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 119-119: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 119-119: Unsafe member access .outputTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 120-120: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 120-120: Unsafe member access .cacheCreationTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 121-121: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 121-121: Unsafe member access .cacheReadTokens on an error typed value.

(ts/no-unsafe-member-access)


[error] 122-122: Unsafe argument of type error typed assigned to a parameter of type TokenData.

(ts/no-unsafe-argument)


[error] 123-123: Unsafe argument of type error typed assigned to a parameter of type number.

(ts/no-unsafe-argument)


[error] 123-123: Unsafe member access .totalCost on an error typed value.

(ts/no-unsafe-member-access)


[error] 127-127: Unexpected any value in conditional. An explicit comparison or type conversion is required.

(ts/strict-boolean-expressions)


[error] 127-127: Unsafe member access .values on an any value.

(ts/no-unsafe-member-access)


[error] 128-128: Unsafe argument of type error typed assigned to a parameter of type any[].

(ts/no-unsafe-argument)


[error] 128-128: Unsafe argument of type error typed assigned to a parameter of type { modelName: string; inputTokens: number; outputTokens: number; cacheCreationTokens: number; cacheReadTokens: number; cost: number; }[].

(ts/no-unsafe-argument)


[error] 128-128: Unsafe member access .modelBreakdowns on an error typed value.

(ts/no-unsafe-member-access)


[error] 145-145: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 145-145: Unsafe member access .push on an error typed value.

(ts/no-unsafe-member-access)


[error] 146-146: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 146-146: Unsafe member access .yellow on an error typed value.

(ts/no-unsafe-member-access)

src/utils.internal.ts

[error] 82-82: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 82-82: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 83-83: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 83-83: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 84-84: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 84-84: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 85-85: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 85-85: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 86-86: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 86-86: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)


[error] 87-87: Unsafe call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 87-87: Unsafe member access .gray on an error typed value.

(ts/no-unsafe-member-access)

@constantins2001
Copy link
Contributor Author

@ryoppippi for me, this is finished.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
README.md (1)

323-323: Specify language on fenced code block
Add a language identifier (e.g., bash or console) to the fenced code block to satisfy markdown linting.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

323-323: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc1484e and 89f85d5.

📒 Files selected for processing (1)
  • README.md (7 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~223-~223: Loose punctuation mark.
Context: ...asc(oldest first). --b, --breakdown`: Show per-model cost breakdown (splits u...

(UNLIKELY_OPENING_PUNCTUATION)

🪛 markdownlint-cli2 (0.17.2)
README.md

323-323: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🔇 Additional comments (7)
README.md (7)

44-45: New Feature Bullets Added
The Model Tracking and Model Breakdown features are clearly introduced in the feature list.


223-223: Document CLI breakdown flag in Options
The -b, --breakdown option is properly added to the options list to control per-model cost breakdown.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~223-~223: Loose punctuation mark.
Context: ...asc(oldest first). --b, --breakdown`: Show per-model cost breakdown (splits u...

(UNLIKELY_OPENING_PUNCTUATION)


147-148: Add --breakdown to daily report examples
The daily CLI examples now demonstrate the --breakdown flag, aligning with the new feature.


179-180: Add --breakdown to monthly report examples
Monthly report usage examples are updated to include the --breakdown flag.


209-210: Add --breakdown to session report examples
Session report usage examples correctly include the --breakdown option.


310-317: Update daily output example with Models column
The daily report example has been enhanced with a new Models column showing per‐day model usage.


330-339: Illustrate breakdown example in output
The example under --breakdown clearly shows nested per‐model rows with token and cost details.

Copy link
Owner

@ryoppippi ryoppippi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you so much

@ryoppippi ryoppippi merged commit ca52e9a into ryoppippi:main Jun 11, 2025
7 checks passed
ryoppippi added a commit that referenced this pull request Jun 11, 2025
Add model breakdowns and usage details in usage reports
ryoppippi added a commit that referenced this pull request Jun 22, 2025
Add model breakdowns and usage details in usage reports
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.

Show usage per model

2 participants