Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(verbose): Disable spinner when verbose. Add trace logs #331

Merged
merged 2 commits into from
Feb 1, 2025

Conversation

yamadashy
Copy link
Owner

Checklist

  • Run npm run test
  • Run npm run lint

Copy link

codecov bot commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 90.19%. Comparing base (8f9209c) to head (bc0033b).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/cli/cliSpinner.ts 37.50% 5 Missing ⚠️
src/shared/logger.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #331      +/-   ##
==========================================
- Coverage   90.41%   90.19%   -0.22%     
==========================================
  Files          48       48              
  Lines        2588     2602      +14     
  Branches      535      536       +1     
==========================================
+ Hits         2340     2347       +7     
- Misses        248      255       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

coderabbitai bot commented Feb 1, 2025

📝 Walkthrough

Walkthrough

This pull request updates the command used for running Repomix locally and refines some internal logging behavior. The CLI command in documentation and contributing guidelines has been changed from npm run cli-run to npm run repomix. In package.json, the previous "cli-run" script is removed and replaced with a new "repomix" script, along with additional scripts ("repomix-src" and "repomix-website") to handle different directories. In the source code, logging has been enhanced by adding trace messages in file processing, metrics calculation, and security check functions. Additionally, the Spinner class now has an isEnabled property that is set based on whether verbose logging is active, and the Logger class includes a new isVerboseEnabled() method to support this functionality.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Terminal as Terminal
    participant Package as package.json
    participant App as Repomix App

    User->>Terminal: Run "npm run repomix"
    Terminal->>Package: Invoke "repomix" script
    Package->>Package: Execute build process
    Package->>App: Run repomix.cjs (optionally via repomix-src/repomix-website)
    App-->>User: Application starts
Loading
sequenceDiagram
    participant Logger as Logger
    participant Spinner as Spinner

    Logger->>Spinner: Call isVerboseEnabled()
    Spinner->>Spinner: Set isEnabled = (not verbose)
    Spinner->>Spinner: start() method checks isEnabled
    alt Spinner is enabled
        Spinner->>UI: Display spinner animation
    else
        Spinner-->>Spinner: Skip spinner updates
    end
Loading

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8f9209c and bc0033b.

📒 Files selected for processing (19)
  • CONTRIBUTING.md (1 hunks)
  • package.json (1 hunks)
  • src/cli/cliSpinner.ts (2 hunks)
  • src/core/file/fileProcess.ts (1 hunks)
  • src/core/metrics/calculateAllFileMetrics.ts (1 hunks)
  • src/core/security/securityCheck.ts (1 hunks)
  • src/shared/logger.ts (1 hunks)
  • website/client/src/en/guide/development/index.md (1 hunks)
  • website/client/src/en/guide/development/setup.md (1 hunks)
  • website/client/src/es/guide/development/index.md (1 hunks)
  • website/client/src/es/guide/development/setup.md (1 hunks)
  • website/client/src/ja/guide/development/index.md (1 hunks)
  • website/client/src/ja/guide/development/setup.md (1 hunks)
  • website/client/src/ko/guide/development/index.md (1 hunks)
  • website/client/src/ko/guide/development/setup.md (1 hunks)
  • website/client/src/pt-br/guide/development/index.md (1 hunks)
  • website/client/src/pt-br/guide/development/setup.md (1 hunks)
  • website/client/src/zh-cn/guide/development/index.md (1 hunks)
  • website/client/src/zh-cn/guide/development/setup.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • website/client/src/en/guide/development/index.md
🧰 Additional context used
🪛 GitHub Check: codecov/patch
src/shared/logger.ts

[warning] 12-13: src/shared/logger.ts#L12-L13
Added lines #L12 - L13 were not covered by tests

src/cli/cliSpinner.ts

[warning] 20-21: src/cli/cliSpinner.ts#L20-L21
Added lines #L20 - L21 were not covered by tests


[warning] 33-35: src/cli/cliSpinner.ts#L33-L35
Added lines #L33 - L35 were not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Test (windows-latest, 23.x)
  • GitHub Check: Test (windows-latest, 22.x)
  • GitHub Check: Test (windows-latest, 21.x)
  • GitHub Check: Test (windows-latest, 20.x)
  • GitHub Check: Test (windows-latest, 19.x)
  • GitHub Check: Test (windows-latest, 18.x)
  • GitHub Check: Test (windows-latest, 18.0.0)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (19)
src/shared/logger.ts (1)

11-13: Add test coverage for isVerboseEnabled method.

The implementation looks good, but test coverage is missing for this new method.

Would you like me to help generate test cases for this method? The tests should verify:

  1. Default state (false)
  2. State after enabling verbose mode
  3. State after disabling verbose mode
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 12-13: src/shared/logger.ts#L12-L13
Added lines #L12 - L13 were not covered by tests

src/cli/cliSpinner.ts (2)

11-11: LGTM! Clean implementation of spinner toggle.

The isEnabled property is correctly initialized based on the logger's verbose mode.

Also applies to: 15-15


19-21: Add test coverage for disabled spinner state.

The early returns look good but need test coverage for scenarios when the spinner is disabled.

Would you like me to help generate test cases? The tests should verify:

  1. Spinner doesn't start when disabled
  2. Spinner doesn't update when disabled
  3. Spinner works normally when enabled

Also applies to: 33-35

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 20-21: src/cli/cliSpinner.ts#L20-L21
Added lines #L20 - L21 were not covered by tests

src/core/file/fileProcess.ts (1)

43-43: LGTM! Well-placed trace logging.

The trace log provides valuable debugging information without interfering with the progress callback.

src/core/security/securityCheck.ts (1)

46-46: LGTM! Consistent trace logging.

The trace log follows the same pattern as file processing, maintaining consistency across the codebase.

src/core/metrics/calculateAllFileMetrics.ts (1)

44-44: LGTM! Trace logging enhances debugging capabilities.

The added trace log provides detailed visibility into metrics calculation progress, which aligns well with the PR's objective to improve logging during verbose execution.

website/client/src/zh-cn/guide/development/index.md (1)

15-15: LGTM! Documentation updated consistently.

The CLI command has been updated to match the new npm run repomix command structure.

website/client/src/ja/guide/development/index.md (1)

15-15: LGTM! Documentation updated consistently.

The CLI command has been updated to match the new npm run repomix command structure.

website/client/src/ko/guide/development/index.md (1)

15-15: LGTM! Documentation updated consistently.

The CLI command has been updated to match the new npm run repomix command structure.

website/client/src/zh-cn/guide/development/setup.md (1)

20-20: Updated CLI Command in Chinese Setup Guide
The command to run the CLI has been updated to npm run repomix, which is consistent with the updated script in the project's configuration. This improves clarity and consistency across all documentation.

website/client/src/ko/guide/development/setup.md (1)

20-20: Consistent CLI Command in Korean Setup Guide
The local development instructions now use npm run repomix instead of the old command. This change is clear and aligns with the overall documentation updates.

website/client/src/ja/guide/development/setup.md (1)

20-20: Updated CLI Command in Japanese Setup Guide
The command has been updated to npm run repomix, matching the revised CLI invocation across other language guides. This ensures a consistent developer experience.

website/client/src/pt-br/guide/development/index.md (1)

15-15: Updated CLI Command in Portuguese Development Guide
The CLI execution instruction now shows npm run repomix. This update maintains consistency with the changes in the repository’s package.json and the rest of the documentation.

website/client/src/es/guide/development/index.md (1)

15-15: Consistent CLI Command in Spanish Development Guide
The updated command npm run repomix replaces the former npm run cli-run command, aligning this guide with the new standard across the project.

website/client/src/en/guide/development/setup.md (1)

20-20: Update CLI Command in Developer Setup Instructions
The CLI command has been updated from the legacy cli-run to repomix, ensuring consistency with the new package scripts. Verify that this change is reflected across all documentation and that users are aware of the new command.

website/client/src/pt-br/guide/development/setup.md (1)

20-20: Atualização do Comando da CLI
O comando foi alterado para npm run repomix, alinhando-se à nova nomenclatura definida nos scripts do projeto. Certifique-se de que a mudança é consistente com os demais arquivos de documentação.

website/client/src/es/guide/development/setup.md (1)

20-20: Update of the Local CLI Command
The command in the local development section now uses npm run repomix instead of the previous command. This update brings clarity and consistency with the new command pattern present in the package scripts.

CONTRIBUTING.md (1)

38-38: Revise Local Development Instructions
The instructions to run Repomix locally now correctly reference npm run repomix. This ensures that contributors are directed to the updated command. No further action is required unless additional notes on verbose behavior are desired.

package.json (1)

30-32: Incorporate New CLI Scripts and Trace Logging
The new scripts "repomix", "repomix-src", and "repomix-website" have been added. Notably, the "repomix" script now uses the --trace-warnings flag, which contributes to enhanced trace logging as per the PR goals. Please ensure that, when verbose mode is active, the application's spinner is disabled appropriately (this behavior is likely implemented within the application logic).

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

@yamadashy yamadashy merged commit 532954f into main Feb 1, 2025
54 checks passed
@yamadashy yamadashy deleted the feat/verbose-no-spinner branch February 1, 2025 15:17
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.

1 participant