Skip to content

Conversation

@a-c-m
Copy link
Contributor

@a-c-m a-c-m commented Jun 20, 2025

  • Add --live flag to blocks command for real-time monitoring
  • Display session progress, token usage, burn rate, and cost projections
  • Implement efficient incremental data loading to minimize file I/O
  • Default to 'max' token limit when not specified in live mode
  • Support customizable refresh intervals (1-60 seconds)
  • Add professional box-based terminal UI with proper alignment
  • Extract live monitoring logic to dedicated blocks-live.ts module
  • Add LiveMonitor class for efficient file change tracking

The live mode provides a dashboard that updates every few seconds showing:

  • Current session progress with time remaining
  • Token usage with burn rate indicators (normal/moderate/high)
  • Cost projections to help users stay within limits
  • Model information for the active session

Example usage:
bun run start blocks --live bun run start blocks --live --token-limit 60000 bun run start blocks --live --refresh-interval 5

BREAKING CHANGE: None

                    ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                    │                                        CLAUDE CODE - LIVE TOKEN USAGE MONITOR                                        │
                    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
                    │                                                                                                                      │
                    │ ⏱️ SESSION     [█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   16.9%                 │
                    │    Started: 11:53:28 AM                          Elapsed: 51m                         Remaining: 4h 9m (04:53:28 PM) │
                    │                                                                                                                      │
                    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
                    │                                                                                                                      │
                    │ 🔥 USAGE       [████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░]    4.8% (2.9k/60.0k)    │
                    │    Tokens: 2,854 (153 per min ✓ NORMAL)          Limit: 60,000 tokens                 Cost: $26.67                   │
                    │                                                                                                                      │
                    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
                    │                                                                                                                      │
                    │ 📈 PROJECTION  [███████████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░]   68.3% (41.0k/60.0k)   │
                    │    Status: ✓ WITHIN LIMIT                        Tokens: 40,966                       Cost: $382.80                  │
                    │                                                                                                                      │
                    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
                    │ ⚙️  Models: <synthetic>, opus-4                                                                                      │
                    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
                    │                                    ↻ Refreshing every 3s  •  Press Ctrl+C to stop                                    │
                    └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Summary by CodeRabbit

  • New Features
    • Introduced a live monitoring mode for the "blocks" report, providing a real-time terminal dashboard with session progress, token usage, cost, and model details.
    • Added options to configure session duration, enable live monitoring, and set refresh intervals.
  • Documentation
    • Updated the README with usage instructions and examples for the new live monitoring feature and related CLI options.
  • Chores
    • Added new development dependencies for terminal display enhancements.

@coderabbitai
Copy link

coderabbitai bot commented Jun 20, 2025

Warning

Rate limit exceeded

@ryoppippi has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 46 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9813950 and 7613f4d.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • package.json (2 hunks)
  • src/_terminal-utils.ts (1 hunks)
  • src/commands/_blocks.live.ts (1 hunks)

Walkthrough

This update introduces a live monitoring feature to the blocks command in the CLI tool, enabling real-time tracking of session blocks. New CLI options for live monitoring, session length, and refresh interval are documented and implemented. Supporting modules for live data loading and terminal display are added, along with related dependency updates.

Changes

File(s) Change Summary
README.md Added documentation for live monitoring in the blocks report, including new CLI options and examples.
src/commands/blocks.ts Implemented live mode logic, CLI argument parsing, and integration with live monitoring functionality.
src/commands/_blocks.live.ts New module: Implements terminal UI and control flow for live monitoring of active session blocks.
src/_live-monitor.ts New module: Provides incremental loading, caching, and processing of usage data for live updates.
src/_terminal-utils.ts New module: Utilities for terminal control, progress bars, formatting, and display alignment.
src/_consts.ts Added constants for live monitoring refresh interval defaults and limits.
package.json Added @jsr/std__async and ansi-escapes to devDependencies.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI (blocksCommand)
    participant LiveMonitor
    participant TerminalManager

    User->>CLI (blocksCommand): Run blocks --live [options]
    CLI (blocksCommand)->>LiveMonitor: Initialize with config
    loop Every refreshInterval seconds
        CLI (blocksCommand)->>LiveMonitor: getActiveBlock()
        LiveMonitor-->>CLI (blocksCommand): Active session block data
        CLI (blocksCommand)->>TerminalManager: Render live dashboard
    end
    User-->>CLI (blocksCommand): Send SIGINT/SIGTERM
    CLI (blocksCommand)->>TerminalManager: Cleanup and restore terminal
Loading

Possibly related PRs

Poem

Hopping through the terminal night,
Live blocks now gleam in dashboard light.
With colors and bars, the stats unfold,
Session tales in real time told.
A rabbit’s cheer for features new—
May your tokens last and costs stay few!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
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 @a-c-m, 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 blocks command by adding a dynamic, real-time monitoring dashboard. The primary goal is to provide users with immediate insights into their Claude API usage, including token consumption, cost, and session progress, through an intuitive terminal interface. This feature is built with efficiency in mind, ensuring minimal overhead during continuous updates.

Highlights

  • New Live Monitoring Mode: I've introduced a new --live flag to the blocks command, enabling a real-time, interactive dashboard for monitoring Claude usage directly in the terminal. This mode automatically focuses on the active session block.
  • Real-time Dashboard UI: The live mode presents a professional, box-based terminal UI that updates incrementally. It displays current session progress, token usage with burn rate indicators (normal/moderate/high), cost projections, and active model information. It also includes a compact display for narrower terminals.
  • Efficient Data Loading: To ensure responsiveness, I've implemented an efficient incremental data loading mechanism using a new LiveMonitor class. This class tracks file modifications and only processes new or changed usage data entries, minimizing file I/O during refreshes.
  • Configurable Options: The live monitoring mode supports customizable refresh intervals (1-60 seconds, defaulting to 3 seconds) via --refresh-interval. When --live is used without a specified token limit, it now defaults to using the 'max' token limit from previous sessions.
  • Terminal Utilities: A new terminal-utils.internal.ts module has been added, providing a TerminalManager class and helper functions for advanced terminal control, such as hiding/showing the cursor, clearing the screen, creating progress bars, and handling ANSI escape codes for a richer UI experience.
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 configure Gemini 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

The pull request introduces a live monitoring mode for the blocks command, providing a real-time dashboard of Claude usage. The code is well-structured and includes features such as incremental data loading and a terminal UI. Some suggestions were made to improve error handling, logging, and documentation.

Comment on lines 229 to 231
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The refresh interval is validated, but the result of the validation is not used. It should be assigned back to ctx.values.refreshInterval to ensure that the validated value is used in subsequent calculations.

Suggested change
const refreshInterval = Math.max(1, Math.min(60, ctx.values.refreshInterval));
if (refreshInterval !== ctx.values.refreshInterval) {
logger.warn(`Refresh interval adjusted to ${refreshInterval} seconds (valid range: 1-60)`);
}
// Validate refresh interval
const refreshInterval = Math.max(1, Math.min(60, ctx.values.refreshInterval));
ctx.values.refreshInterval = refreshInterval;
if (refreshInterval !== ctx.values.refreshInterval) {
logger.warn(`Refresh interval adjusted to ${refreshInterval} seconds (valid range: 1-60)`);
}

Comment on lines 100 to 101
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Consider adding a check for process.exitCode before calling process.exit(0). This can prevent accidentally overriding a non-zero exit code set elsewhere in the application, which could mask errors.

if (isRunning) {
				// Get active block with lightweight refresh
				const activeBlock = await monitor.getActiveBlock();

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 (2)
src/live-monitor.internal.ts (1)

26-28: Use top-level type-only imports for better code organization.

According to the ESLint configuration, prefer top-level type-only imports:

-import {
-	identifySessionBlocks,
-	type LoadedUsageEntry,
-	type SessionBlock,
-} from './session-blocks.internal.ts';
+import type { LoadedUsageEntry, SessionBlock } from './session-blocks.internal.ts';
+import { identifySessionBlocks } from './session-blocks.internal.ts';
src/commands/blocks-live.ts (1)

23-24: Use top-level type-only import for consistency.

-import {
-	calculateBurnRate,
-	projectBlockUsage,
-	type SessionBlock,
-} from '../session-blocks.internal.ts';
+import type { SessionBlock } from '../session-blocks.internal.ts';
+import { calculateBurnRate, projectBlockUsage } from '../session-blocks.internal.ts';
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0a09818 and 4b7cac16c1a73710702cc64d460b372d18c8f49b.

📒 Files selected for processing (5)
  • README.md (2 hunks)
  • src/commands/blocks-live.ts (1 hunks)
  • src/commands/blocks.ts (4 hunks)
  • src/live-monitor.internal.ts (1 hunks)
  • src/terminal-utils.internal.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/commands/blocks.ts (5)
src/session-blocks.internal.ts (1)
  • DEFAULT_SESSION_DURATION_HOURS (7-7)
src/logger.ts (1)
  • logger (8-8)
src/utils.internal.ts (1)
  • formatNumber (208-210)
src/commands/blocks-live.ts (1)
  • startLiveMonitoring (72-125)
src/data-loader.ts (1)
  • getDefaultClaudePath (55-79)
🪛 ESLint
src/live-monitor.internal.ts

[error] 26-26: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)


[error] 27-27: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 76-76: Unsafe member access .length on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 99-99: Unsafe member access .trim on an error typed value.

(ts/no-unsafe-member-access)


[error] 100-100: Unsafe member access .split on an error typed value.

(ts/no-unsafe-member-access)


[error] 101-101: Unsafe member access .filter on an error typed value.

(ts/no-unsafe-member-access)


[error] 101-101: Unsafe member access .length on an any value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 123-123: Unsafe member access .costUSD 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 string | number | Date.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)

src/commands/blocks.ts

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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 216-216: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 220-220: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 224-224: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 229-229: Unsafe argument of type any assigned to a parameter of type number.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 231-231: Unsafe member access .warn on an error typed value.

(ts/no-unsafe-member-access)


[error] 237-237: Unsafe argument of type any assigned to a parameter of type string | undefined.

(ts/no-unsafe-argument)


[error] 239-239: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 240-240: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 241-241: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)

src/terminal-utils.internal.ts

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

(ts/no-unsafe-assignment)


[error] 31-31: Unsafe member access .stdout on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 33-33: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


[error] 50-50: Unsafe member access .isTTY on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 51-51: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 62-62: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


[error] 79-79: Unsafe member access .isTTY on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 80-80: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 97-97: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


[error] 104-104: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


[error] 111-111: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/strict-boolean-expressions)


[error] 111-111: Unsafe member access .rows on an error typed value.

(ts/no-unsafe-member-access)


[error] 118-118: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/no-unsafe-member-access)

src/commands/blocks-live.ts

[error] 23-23: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 81-81: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 82-82: Unsafe member access .exit 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 .on 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 .on 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 string.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


[error] 107-107: Unsafe member access .yellow 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 string.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 168-168: Unsafe member access .cyan on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 181-181: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 186-186: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 214-214: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 216-216: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 241-241: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 241-241: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 248-248: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 298-298: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 300-300: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 320-320: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 324-324: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 327-327: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 328-328: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 331-331: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 403-403: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 413-413: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 413-413: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)

🪛 Biome (1.9.4)
src/terminal-utils.internal.ts

[error] 241-241: Unexpected control character in a regular expression.

Control characters are unusual and potentially incorrect inputs, so they are disallowed.

(lint/suspicious/noControlCharactersInRegex)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (12)
src/terminal-utils.internal.ts (5)

1-21: Well-structured terminal control constants.

The ANSI escape sequences are correctly defined and the use of as const ensures type safety and immutability.


23-127: Excellent terminal state management with proper TTY checks.

The TerminalManager class correctly checks isTTY before writing any escape sequences, preventing issues when output is redirected. The cursor state tracking and cleanup method ensure proper terminal restoration.


148-217: Robust progress bar implementation with excellent customization options.

The function handles edge cases well (division by zero) and provides intuitive color coding based on percentage thresholds. The customization options allow for flexible usage across different contexts.


234-242: Correct ANSI stripping implementation.

The regex pattern correctly matches ANSI escape sequences. The control character warning from Biome is a false positive - \x1B (ESC) is the standard way to match ANSI codes.


219-260: Clean utility functions for duration formatting and text centering.

Both functions are well-implemented. The centerText function correctly accounts for ANSI codes when calculating padding, ensuring proper alignment in the terminal.

README.md (1)

261-296: Clear and comprehensive documentation for the live monitoring feature.

The examples effectively demonstrate the various usage patterns, and the new options are well-documented with appropriate defaults and ranges.

src/live-monitor.internal.ts (1)

43-164: Excellent implementation of incremental data loading.

The LiveMonitor class efficiently tracks file modifications and only processes new data, minimizing I/O overhead. The deduplication logic using hashes prevents redundant processing, and the implementation properly handles the Disposable pattern for resource cleanup.

src/commands/blocks.ts (2)

16-16: Clean integration of live monitoring arguments.

The new arguments are well-defined with appropriate defaults (3 seconds refresh, disabled by default). The formatting improvements in parseTokenLimit enhance readability.

Also applies to: 99-106, 128-145


212-244: Thoughtful implementation of live monitoring mode.

The code includes excellent UX considerations:

  • Automatically showing only active blocks in live mode makes sense
  • Defaulting to 'max' token limit is user-friendly
  • Refresh interval validation (1-60s) prevents unreasonable values
  • Clear logging keeps users informed of automatic behaviors
src/commands/blocks-live.ts (3)

72-125: Robust live monitoring implementation with proper error handling.

The function handles edge cases well:

  • Graceful shutdown on SIGINT/SIGTERM
  • Error display without crashing the monitor
  • Proper use of the disposable pattern for resource cleanup
  • Clear user feedback when no active session is found

127-387: Outstanding terminal UI implementation with attention to detail.

The rendering logic is exceptionally well-crafted:

  • Adaptive layout seamlessly handles different terminal widths
  • Professional box-drawing creates a polished dashboard appearance
  • Color-coded progress bars provide instant visual feedback
  • Fixed column widths (lines 64-67) ensure consistent alignment across detail rows
  • Comprehensive handling of edge cases (no token limit, projections, etc.)

The user experience is excellent with clear visual hierarchy and informative displays.


389-432: Well-designed compact display for narrow terminals.

The compact mode successfully distills the essential information into a minimal format while maintaining readability and functionality. Good UX consideration for users with narrow terminal windows.

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

♻️ Duplicate comments (1)
src/commands/blocks.ts (1)

228-231: Fix: Use the validated refresh interval value.

The validation is performed but the result is not assigned back to ctx.values.refreshInterval, so the original unvalidated value is still used in subsequent code.

		// Validate refresh interval
		const refreshInterval = Math.max(1, Math.min(60, ctx.values.refreshInterval));
+		ctx.values.refreshInterval = refreshInterval;
		if (refreshInterval !== ctx.values.refreshInterval) {
			logger.warn(`Refresh interval adjusted to ${refreshInterval} seconds (valid range: 1-60)`);
		}
🧹 Nitpick comments (4)
src/live-monitor.internal.ts (2)

21-21: Fix the import extension to maintain consistency.

The import uses .js extension instead of .ts, which is inconsistent with other TypeScript imports in the file.

-import { LiveMonitor } from '../live-monitor.internal.js';
+import { LiveMonitor } from '../live-monitor.internal.ts';

100-144: Improve error handling in JSON parsing loop.

The current error handling silently skips malformed lines, which could hide important parsing errors or data corruption issues. Consider logging parsing errors for debugging purposes.

					catch {
-						// Skip malformed lines
+						// Skip malformed lines - consider logging in debug mode
+						// logger.debug(`Failed to parse line in ${file}: ${line.substring(0, 100)}...`);
					}
src/commands/blocks-live.ts (2)

21-21: Fix the import extension for consistency.

The import uses .js extension instead of .ts, which is inconsistent with TypeScript conventions used elsewhere in the codebase.

-import { LiveMonitor } from '../live-monitor.internal.js';
+import { LiveMonitor } from '../live-monitor.internal.ts';

120-126: Enhance error logging for better debugging.

While error handling is present, the logging could be more comprehensive for debugging purposes as suggested in previous reviews.

	catch (error) {
		terminal.clearScreen();
		const errorMessage = error instanceof Error ? error.message : String(error);
		terminal.write(pc.red(`Error: ${errorMessage}\n`));
-		logger.error(`Live monitoring error: ${errorMessage}`);
+		logger.error(`Live monitoring error: ${errorMessage}`, error instanceof Error ? error.stack : undefined);
		await sleep(config.refreshInterval);
	}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4b7cac16c1a73710702cc64d460b372d18c8f49b and f8fa2276a9f4362f932e4af05cbe86e5a54057f3.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • README.md (2 hunks)
  • package.json (1 hunks)
  • src/commands/blocks-live.ts (1 hunks)
  • src/commands/blocks.ts (4 hunks)
  • src/live-monitor.internal.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
🧰 Additional context used
🪛 ESLint
src/commands/blocks-live.ts

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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 78-78: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 80-80: Unsafe member access .exitCode on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 81-81: Unsafe member access .exit 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 .on 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 .on 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 string.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


[error] 107-107: Unsafe member access .yellow 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 call of a(n) error type typed value.

(ts/no-unsafe-call)


[error] 123-123: Unsafe member access .red 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 .error on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 170-170: Unsafe member access .cyan on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 183-183: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 188-188: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 216-216: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 218-218: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 243-243: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 243-243: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 250-250: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 300-300: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 302-302: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 322-322: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 326-326: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 329-329: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 330-330: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 333-333: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 405-405: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 415-415: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 415-415: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)

src/commands/blocks.ts

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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 215-215: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 219-219: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 223-223: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 228-228: Unsafe argument of type any assigned to a parameter of type number.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 230-230: Unsafe member access .warn on an error typed value.

(ts/no-unsafe-member-access)


[error] 236-236: Unsafe argument of type any assigned to a parameter of type string | undefined.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 239-239: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 240-240: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)

src/live-monitor.internal.ts

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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 96-96: Unsafe member access .trim on an error typed value.

(ts/no-unsafe-member-access)


[error] 97-97: Unsafe member access .split on an error typed value.

(ts/no-unsafe-member-access)


[error] 98-98: Unsafe member access .filter on an error typed value.

(ts/no-unsafe-member-access)


[error] 98-98: Unsafe member access .length on an any value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 103-103: Unsafe member access .safeParse on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 129-129: Unsafe argument of type error typed assigned to a parameter of type string | number | Date.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 138-138: Unsafe member access .version on an error typed value.

(ts/no-unsafe-member-access)

🔇 Additional comments (6)
src/live-monitor.internal.ts (1)

58-60: LGTM: Proper resource cleanup with Disposable pattern.

The implementation correctly implements the Disposable interface and properly cleans up the PricingFetcher resource.

src/commands/blocks.ts (2)

16-16: LGTM: Clean integration of live monitoring functionality.

The import and integration of the live monitoring feature is well-structured and follows the existing patterns in the codebase.


211-243: LGTM: Comprehensive live mode implementation with proper defaults.

The live monitoring mode implementation properly handles default values, validates inputs, and provides clear user feedback about enforced settings.

src/commands/blocks-live.ts (3)

79-82: LGTM: Proper exit code handling implemented.

The implementation correctly checks for existing process.exitCode before calling process.exit(0), addressing the concern from previous reviews about not overriding non-zero exit codes.


92-97: LGTM: Efficient resource management with using declaration.

The implementation correctly uses the using declaration for automatic resource cleanup of the LiveMonitor instance, ensuring proper disposal even if exceptions occur.


132-389: LGTM: Comprehensive and well-structured display rendering.

The display rendering logic is well-implemented with proper terminal width detection, responsive layout, and clear visual hierarchy. The separation between compact and full-width modes provides good user experience across different terminal sizes.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 20, 2025

Open in StackBlitz

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

commit: 7613f4d

package.json Outdated
Copy link
Owner

Choose a reason for hiding this comment

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

please move it to devDependencies

Copy link
Owner

Choose a reason for hiding this comment

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

JSR packages are basically put in devDependencies because of acquisition errors during npm install. Also, in this project, basically all dependencies are put in devDependencies and bundled. ` (See Claude.md)

@ryoppippi
Copy link
Owner

So I compared with #120 and personally I like this design!

@ryoppippi ryoppippi requested a review from Copilot June 20, 2025 23:14
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

Adds a live monitoring mode to the existing blocks command, providing a real-time dashboard of usage data in the terminal.

  • Introduces terminal control utilities and progress bar helpers for live updates.
  • Implements LiveMonitor to incrementally load and cache usage entries.
  • Integrates a --live flag (with --refresh-interval) into blocks.ts and updates README.

Reviewed Changes

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

File Description
src/terminal-utils.internal.ts New TerminalManager and helper functions for rendering the UI.
src/live-monitor.internal.ts Adds LiveMonitor class for efficient incremental data loading.
src/commands/blocks.ts Integrates live mode options and early-exit logic into blocks.
README.md Documents --live mode usage and related CLI options.
Comments suppressed due to low confidence (2)

README.md:322

  • You've documented the default and range here, but consider adding a note in the option description (under ### Options) so it’s clear in both the examples and the CLI help.
- `--refresh-interval <seconds>`: Refresh interval for live mode (default: 3, range: 1-60)

src/terminal-utils.internal.ts:148

  • Key utility functions like createProgressBar, formatDuration, and centerText lack dedicated unit tests. Adding tests will help catch formatting or edge-case regressions.
export function createProgressBar(

Comment on lines 29 to 33
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

[nitpick] The originalWrite property is assigned but never used. Consider removing it or using it to restore the original write behavior during cleanup.

Suggested change
private originalWrite: typeof process.stdout.write;
constructor(stream: WriteStream = process.stdout) {
this.stream = stream;
this.originalWrite = stream.write.bind(stream);
constructor(stream: WriteStream = process.stdout) {
this.stream = stream;

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

The allEntries array accumulates data indefinitely, which may lead to high memory usage long-term; consider pruning entries outside the configured session window or capping its size.

Suggested change
/**
* Prunes entries outside the configured session window
*/
private pruneOldEntries(): void {
const now = Date.now();
const sessionWindowMs = this.config.sessionDurationHours * 60 * 60 * 1000;
this.allEntries = this.allEntries.filter(entry => {
return now - new Date(entry.timestamp).getTime() <= sessionWindowMs;
});
}

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

Reading files in series can be slow if there are many; you might parallelize the reads with Promise.all (while still processing results in timestamp order) to improve responsiveness.

Copilot uses AI. Check for mistakes.
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.

I reviewed the code.
Overall, I like the design.

Copy link
Owner

@ryoppippi ryoppippi Jun 20, 2025

Choose a reason for hiding this comment

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

use import {setTimeout} from 'node:timers/promises'; instead

Copy link
Owner

Choose a reason for hiding this comment

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

if you want to use abortsignal for sleep function, you can use delay function from jsr https://jsr.io/@std/async/doc/delay/~/delay
you can choose whichever

Copy link
Owner

@ryoppippi ryoppippi Jun 20, 2025

Choose a reason for hiding this comment

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

becuase blocks-live is not an independent subcomand and a part of block command, you can include the implementation in blocks.ts .
or you can define the filename like _blocks.live.ts

Copy link
Owner

Choose a reason for hiding this comment

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

I changed the file name rule for internals, so please change the filename

Copy link
Owner

@ryoppippi ryoppippi Jun 20, 2025

Choose a reason for hiding this comment

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

we need test. you can write a test with CC. We'd like to make sure that functions works fine

Copy link
Owner

Choose a reason for hiding this comment

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

maybe you need to use the newest const values in main branch

Comment on lines 239 to 251
Copy link
Owner

Choose a reason for hiding this comment

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

Comment on lines 7 to 21
Copy link
Owner

Choose a reason for hiding this comment

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

Comment on lines 33 to 34
Copy link
Owner

Choose a reason for hiding this comment

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

you can re-use those types from _types.ts maybe

@ryoppippi
Copy link
Owner

We also saw that the layout of the table was a broken a little bit!
SCR-20250621-blrv

@ryoppippi
Copy link
Owner

I will not see your change tomorrow, Saturday, as I will be travelling with my wife. I think the next review will be as early as Sunday night.

@ryoppippi
Copy link
Owner

Also you can paste your screenshot on README, this live command is too good to miss

@ryoppippi
Copy link
Owner

and in the future we want to support costs per models just like @infonobody implemented in #120

@ryoppippi
Copy link
Owner

maybe you need to rebase this branch upon origin/main

@ryoppippi
Copy link
Owner

Ok I make cc to fix it and ship it soon!

- Add --live flag to blocks command for real-time monitoring
- Display session progress, token usage, burn rate, and cost projections
- Implement efficient incremental data loading to minimize file I/O
- Default to 'max' token limit when not specified in live mode
- Support customizable refresh intervals (1-60 seconds)
- Add professional box-based terminal UI with proper alignment
- Extract live monitoring logic to dedicated blocks-live.ts module
- Add LiveMonitor class for efficient file change tracking

The live mode provides a dashboard that updates every few seconds showing:
- Current session progress with time remaining
- Token usage with burn rate indicators (normal/moderate/high)
- Cost projections to help users stay within limits
- Model information for the active session

Example usage:
  bun run start blocks --live
  bun run start blocks --live --token-limit 60000
  bun run start blocks --live --refresh-interval 5

BREAKING CHANGE: None

Co-authored-by: Assistant <[email protected]>
…ement

- Replace custom ANSI implementations with ansi-escapes and string-width packages

- Fix table layout issues in live monitoring dashboard

- Add comprehensive tests for LiveMonitor class with proper fixture setup

- Reuse shared types from _types.ts instead of duplicating

- Fix readonly assignment error in refresh interval validation

- Update README documentation to highlight live monitoring feature

Co-authored-by: a-c-m <[email protected]>
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

♻️ Duplicate comments (1)
src/commands/blocks.ts (1)

228-231: Apply the validated refresh interval back to context.

This is the same issue identified in a previous review. The refresh interval is validated but the result is not assigned back to ctx.values.refreshInterval.

 // Validate refresh interval
 const refreshInterval = Math.max(1, Math.min(60, ctx.values.refreshInterval));
+ctx.values.refreshInterval = refreshInterval;
 if (refreshInterval !== ctx.values.refreshInterval) {
 	logger.warn(`Refresh interval adjusted to ${refreshInterval} seconds (valid range: 1-60)`);
 }
🧹 Nitpick comments (1)
src/_terminal-utils.ts (1)

242-245: Consider using a character class instead of control character in regex.

The Biome warning about the control character \x1B in the regex is valid. While functional, using a character class might be more readable.

-	return str.replace(/\x1B\[[0-9;]*m/g, '');
+	return str.replace(/\u001B\[[0-9;]*m/g, '');

Alternatively, since the function is deprecated and stringWidth() should be used instead, this might not need fixing.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6b4f80e613e2e55f3b7ae572464b1eddc0e38f8d and 58d0b07.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • README.md (3 hunks)
  • package.json (1 hunks)
  • src/_live-monitor.ts (1 hunks)
  • src/_terminal-utils.ts (1 hunks)
  • src/commands/_blocks.live.ts (1 hunks)
  • src/commands/blocks.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • package.json
  • README.md
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/commands/blocks.ts (5)
src/_session-blocks.ts (1)
  • DEFAULT_SESSION_DURATION_HOURS (7-7)
src/logger.ts (1)
  • logger (8-8)
src/_utils.ts (1)
  • formatNumber (293-295)
src/commands/_blocks.live.ts (1)
  • startLiveMonitoring (63-145)
src/data-loader.ts (1)
  • getDefaultClaudePath (117-145)
🪛 ESLint
src/_live-monitor.ts

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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 96-96: Unsafe member access .trim on an error typed value.

(ts/no-unsafe-member-access)


[error] 97-97: Unsafe member access .split on an error typed value.

(ts/no-unsafe-member-access)


[error] 98-98: Unsafe member access .filter on an error typed value.

(ts/no-unsafe-member-access)


[error] 98-98: Unsafe member access .length on an any value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 103-103: Unsafe member access .safeParse on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 129-129: Unsafe argument of type error typed assigned to a parameter of type string | number | Date.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 138-138: Unsafe member access .version on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 181-181: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


[error] 185-200: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


[error] 185-185: Unsafe call of a(n) any typed value.

(ts/no-unsafe-call)


[error] 201-201: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


[error] 201-201: Unsafe member access .path on an any value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 218-218: Unsafe member access .not on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 223-223: Unsafe member access .not on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 229-229: Unsafe member access .not on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 231-231: Unsafe member access .toBe on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 232-232: Unsafe member access .toBe on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 233-233: Unsafe member access .toBe on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 234-234: Unsafe member access .toContain on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 239-239: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


[error] 240-240: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


[error] 240-240: Unsafe call of a(n) any typed value.

(ts/no-unsafe-call)


[error] 243-243: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


[error] 243-243: Unsafe member access .path on an any value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 250-250: Unsafe member access .toBeNull on an error typed value.

(ts/no-unsafe-member-access)

src/_terminal-utils.ts

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

(ts/no-unsafe-assignment)


[error] 11-11: Unsafe member access .cursorHide on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 12-12: Unsafe member access .cursorShow on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 15-15: Unsafe member access .clearScreen on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 16-16: Unsafe member access .eraseLine on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 17-17: Unsafe member access .cursorTo on an error typed value.

(ts/no-unsafe-member-access)


[error] 20-20: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/no-unsafe-call)


[error] 20-20: Unsafe member access .cursorUp on an error typed value.

(ts/no-unsafe-member-access)


[error] 21-21: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/no-unsafe-call)


[error] 21-21: Unsafe member access .cursorDown on an error typed value.

(ts/no-unsafe-member-access)


[error] 22-22: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/no-unsafe-call)


[error] 22-22: Unsafe member access .cursorTo on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 33-33: Unsafe member access .stdout on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 35-35: 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 .write on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


[error] 42-42: Unsafe member access .isTTY on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 43-43: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


[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 .isTTY on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 53-53: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


[error] 62-62: Unsafe member access .isTTY on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


[error] 81-81: Unsafe member access .isTTY on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


[error] 90-90: Unsafe member access .isTTY on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 91-91: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 99-99: Unsafe member access .write on an error typed value.

(ts/no-unsafe-member-access)


[error] 106-106: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


[error] 113-113: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/strict-boolean-expressions)


[error] 113-113: Unsafe member access .rows on an error typed value.

(ts/no-unsafe-member-access)


[error] 120-120: Unsafe return of a value of type error.

(ts/no-unsafe-return)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)

src/commands/_blocks.live.ts

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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 69-69: Unsafe member access .abort 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 .info on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 80-80: Unsafe member access .on 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] 90-90: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


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

(ts/strict-boolean-expressions)


[error] 94-94: Unsafe member access .signal on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 102-102: Unsafe member access .signal on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 119-119: Unsafe member access .signal 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 string.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


[error] 136-136: Unsafe member access .red 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 .error on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 139-139: Unsafe member access .signal on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 188-188: Unsafe member access .cyan on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 201-201: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 206-206: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 234-234: Unsafe member access .green 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 .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 256-256: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 261-261: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 261-261: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 268-268: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 318-318: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 320-320: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 340-340: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 344-344: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 347-347: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 348-348: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 351-351: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 379-379: Unsafe member access .gray 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 call of a(n) error type typed value.

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 423-423: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 433-433: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 433-433: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)

src/commands/blocks.ts

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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 215-215: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 219-219: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 223-223: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 228-228: Unsafe argument of type any assigned to a parameter of type number.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 230-230: Unsafe member access .warn on an error typed value.

(ts/no-unsafe-member-access)


[error] 236-236: Unsafe argument of type any assigned to a parameter of type string | undefined.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 239-239: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 240-240: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)

🪛 Biome (1.9.4)
src/_terminal-utils.ts

[error] 244-244: Unexpected control character in a regular expression.

Control characters are unusual and potentially incorrect inputs, so they are disallowed.

(lint/suspicious/noControlCharactersInRegex)

🔇 Additional comments (9)
src/_terminal-utils.ts (1)

1-264: LGTM! Well-structured terminal utilities module.

This module provides comprehensive terminal control utilities for the live monitoring feature. The implementation is clean and follows good patterns with proper error checking and fallback values.

src/commands/blocks.ts (2)

211-243: Live monitoring integration looks solid.

The live mode implementation properly:

  • Enforces active block filtering automatically
  • Defaults to 'max' token limit when unspecified
  • Validates refresh interval (though needs the fix above)
  • Exits early to avoid showing table output

135-144: New CLI arguments are well-designed.

The --live and --refresh-interval flags are appropriately defined with good defaults and descriptions.

src/commands/_blocks.live.ts (3)

63-145: Excellent live monitoring implementation with proper error handling.

The monitoring loop is well-designed with:

  • Proper signal handling for graceful shutdown
  • AbortController for clean cancellation
  • Error recovery without crashing
  • Efficient data loading via LiveMonitor

150-407: Sophisticated terminal UI with responsive design.

The rendering logic provides a rich, professional dashboard that:

  • Adapts to terminal width
  • Shows progress bars with color coding
  • Displays comprehensive session metrics
  • Maintains proper alignment and formatting

The complexity is justified by the feature richness and user experience benefits.


412-452: Good fallback for narrow terminals.

The compact display ensures usability across different terminal sizes while preserving essential information.

src/_live-monitor.ts (3)

40-61: Well-designed class with proper resource management.

The LiveMonitor class correctly implements the Disposable pattern and initializes the pricing fetcher only when needed (mode !== 'display').


66-161: Efficient incremental data loading strategy.

The implementation provides excellent performance optimization through:

  • File timestamp tracking to avoid unnecessary reads
  • Hash-based deduplication to prevent duplicate processing
  • Incremental entry accumulation
  • Proper error handling for malformed data

This approach minimizes I/O operations during live monitoring, which is crucial for responsive updates.


173-255: Comprehensive test coverage.

The unit tests cover key scenarios including:

  • Normal data processing
  • Cache clearing functionality
  • Empty directory handling
  • Proper resource cleanup

ryoppippi and others added 2 commits June 21, 2025 21:01
…en limit explanation

- Clarify automatic token limit detection from usage history

- Add comprehensive live monitoring features section

- Provide more usage examples with explicit token limits

- Explain refresh interval and graceful shutdown capabilities

Co-authored-by: a-c-m <[email protected]>
- Replace hardcoded emoji width calculations with dynamic stringWidth() measurements

- Fix session, usage, and projection label padding to account for variable emoji widths

- Ensure consistent table alignment across all display sections

- Improve visual consistency of live monitoring dashboard borders

Co-authored-by: a-c-m <[email protected]>
@ryoppippi ryoppippi force-pushed the main branch 2 times, most recently from 48c5932 to 7cc0893 Compare June 21, 2025 20:25
@ryoppippi
Copy link
Owner

SCR-20250621-soou Now it is all right!!!

- Add docs/blocks-live.png to showcase the live monitoring feature

- Display new screenshot alongside existing screenshot for better visual documentation
- Update live monitoring description to reflect 1 second default

- Update command examples to show new default value

- Update blocks-specific options documentation
- Add DEFAULT_REFRESH_INTERVAL_SECONDS, MIN_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS to _consts.ts

- Update blocks.ts to use these constants instead of hardcoded values

- Improve maintainability by centralizing refresh interval configuration
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 (1)
src/commands/blocks.ts (1)

228-231: Fix: Refresh interval validation result is not used.

The validation logic correctly clamps the refresh interval but doesn't assign the result back to ctx.values.refreshInterval, so the original invalid value is still used.

// Validate refresh interval
const refreshInterval = Math.max(MIN_REFRESH_INTERVAL_SECONDS, Math.min(MAX_REFRESH_INTERVAL_SECONDS, ctx.values.refreshInterval));
+ctx.values.refreshInterval = refreshInterval;
if (refreshInterval !== ctx.values.refreshInterval) {
	logger.warn(`Refresh interval adjusted to ${refreshInterval} seconds (valid range: ${MIN_REFRESH_INTERVAL_SECONDS}-${MAX_REFRESH_INTERVAL_SECONDS})`);
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 58d0b07 and 9813950.

⛔ Files ignored due to path filters (1)
  • docs/blocks-live.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • README.md (4 hunks)
  • src/_consts.ts (1 hunks)
  • src/commands/_blocks.live.ts (1 hunks)
  • src/commands/blocks.ts (5 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/_consts.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/commands/blocks.ts (6)
src/_session-blocks.ts (1)
  • DEFAULT_SESSION_DURATION_HOURS (7-7)
src/_consts.ts (3)
  • DEFAULT_REFRESH_INTERVAL_SECONDS (92-92)
  • MIN_REFRESH_INTERVAL_SECONDS (98-98)
  • MAX_REFRESH_INTERVAL_SECONDS (104-104)
src/logger.ts (1)
  • logger (8-8)
src/_utils.ts (1)
  • formatNumber (293-295)
src/commands/_blocks.live.ts (1)
  • startLiveMonitoring (63-145)
src/data-loader.ts (1)
  • getDefaultClaudePath (117-145)
🪛 ESLint
src/commands/blocks.ts

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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/strict-boolean-expressions)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 215-215: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 219-219: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 223-223: Unsafe member access .info on an error typed value.

(ts/no-unsafe-member-access)


[error] 228-228: Unsafe argument of type any assigned to a parameter of type number.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 230-230: Unsafe member access .warn on an error typed value.

(ts/no-unsafe-member-access)


[error] 236-236: Unsafe argument of type any assigned to a parameter of type string | undefined.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 239-239: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


[error] 240-240: Unsafe assignment of an any value.

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)

src/commands/_blocks.live.ts

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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


[error] 69-69: Unsafe member access .abort 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 .info on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 80-80: Unsafe member access .on 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] 90-90: Unsafe assignment of an error typed value.

(ts/no-unsafe-assignment)


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

(ts/strict-boolean-expressions)


[error] 94-94: Unsafe member access .signal on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 102-102: Unsafe member access .signal on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 119-119: Unsafe member access .signal 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 string.

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


[error] 136-136: Unsafe member access .red 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 .error on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 139-139: Unsafe member access .signal on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 188-188: Unsafe member access .cyan on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 201-201: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 206-206: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 235-235: Unsafe member access .green 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 .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 257-257: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 262-262: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 262-262: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 269-269: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


[error] 320-320: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


[error] 322-322: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 342-342: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 346-346: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 349-349: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 350-350: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 353-353: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 426-426: Unsafe member access .bold on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-assignment)


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

(ts/no-unsafe-call)


[error] 436-436: Unsafe member access .red on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-call)


[error] 436-436: Unsafe member access .green on an error typed value.

(ts/no-unsafe-member-access)


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

(ts/no-unsafe-argument)


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

(ts/no-unsafe-call)


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

(ts/no-unsafe-member-access)

🪛 markdownlint-cli2 (0.17.2)
README.md

19-19: Images should have alternate text (alt text)
null

(MD045, no-alt-text)

🪛 LanguageTool
README.md

[uncategorized] ~333-~333: Loose punctuation mark.
Context: ...ions - -t, --token-limit <number|max>: Set token limit for quota warnings (use...

(UNLIKELY_OPENING_PUNCTUATION)

🔇 Additional comments (19)
README.md (3)

55-55: Excellent addition to the features list.

The live monitoring feature is well-documented with clear benefits highlighted.


292-297: Comprehensive usage examples for live monitoring.

The examples clearly demonstrate the various ways to use the live monitoring feature with different options.


336-338: Well-documented CLI options.

The new CLI options are clearly explained with appropriate defaults and ranges.

src/commands/blocks.ts (6)

4-4: Good import organization.

The imports are well-organized and include all necessary constants for the live monitoring feature.


135-144: Well-defined CLI arguments for live monitoring.

The new arguments are properly typed with clear descriptions and sensible defaults.


98-98: Improved readability with blank lines.

The added blank lines in the parseTokenLimit function improve code readability.

Also applies to: 102-102


212-217: Good automatic behavior for live mode.

The logic to automatically filter to active blocks in live mode and inform the user is well-implemented.


218-225: Smart default token limit handling.

The automatic fallback to 'max' token limit in live mode with user notification is a good user experience decision.


234-242: Clean integration with live monitoring module.

The call to startLiveMonitoring with proper parameter mapping and early return is well-structured.

src/commands/_blocks.live.ts (10)

1-14: Excellent documentation and file structure.

The comprehensive file-level documentation clearly explains the module's purpose and functionality.


31-38: Well-defined configuration interface.

The LiveMonitoringConfig type provides a clean interface with all necessary parameters properly typed.


45-50: Useful utility function for display formatting.

The formatTokensShort function provides nice formatting for token counts in the UI.


63-91: Robust monitoring setup with proper resource management.

The function properly sets up signal handlers, abort controllers, and uses the using declaration for automatic cleanup. The graceful shutdown logic is well-implemented.


94-127: Solid main monitoring loop with error handling.

The monitoring loop properly handles active block detection, graceful shutdown on abort signals, and maintains the refresh interval. Error handling is comprehensive.


150-163: Smart responsive design.

The automatic switch to compact mode for narrow terminals is a thoughtful UX decision.


165-227: Comprehensive session progress display.

The session progress section with proper time formatting, progress bars, and aligned columns provides excellent user feedback.


229-306: Feature-rich usage tracking display.

The usage section with color-coded progress bars, burn rate indicators, and conditional token limit display is very informative and well-implemented.


312-395: Excellent projection visualization.

The projection section with color-coded status indicators and detailed metrics helps users understand their usage trajectory.


415-455: Well-designed compact mode.

The compact display provides essential information while working within narrow terminal constraints.

Comment on lines +18 to +20
<div align="center">
<img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/blocks-live.png">
</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add alt text to the live monitoring dashboard image.

The image lacks alt text, which is important for accessibility. Add a descriptive alt attribute.

-    <img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/blocks-live.png">
+    <img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/blocks-live.png" alt="Live monitoring dashboard showing real-time session progress, token usage, and cost projections">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div align="center">
<img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/blocks-live.png">
</div>
<div align="center">
<img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/blocks-live.png" alt="Live monitoring dashboard showing real-time session progress, token usage, and cost projections">
</div>
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

19-19: Images should have alternate text (alt text)
null

(MD045, no-alt-text)

🤖 Prompt for AI Agents
In README.md around lines 18 to 20, the image tag for the live monitoring
dashboard lacks an alt attribute, which is important for accessibility. Add a
descriptive alt attribute to the img tag, such as alt="Live monitoring dashboard
showing block usage", to improve accessibility and provide context for screen
readers.

- Remove formatDuration function that was just a wrapper around prettyMs

- Use prettyMs directly in blocks.live.ts for better code clarity

- Remove unused stripAnsi function

- Add pretty-ms as devDependency
@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpretty-ms@​9.2.010010010078100

View full report

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.

SCR-20250621-syck

LGTM

@ryoppippi ryoppippi merged commit c938bff into ryoppippi:main Jun 21, 2025
7 checks passed
ryoppippi added a commit that referenced this pull request Jun 22, 2025
feat(blocks): add live monitoring mode with real-time usage dashboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants