Skip to content

feat: add HTML and README file exclusion options to download command#46

Merged
luxass merged 4 commits intomainfrom
luxass/feat-add-HTML-and-README-file-exclusion-options-to-download-command
Jun 9, 2025
Merged

feat: add HTML and README file exclusion options to download command#46
luxass merged 4 commits intomainfrom
luxass/feat-add-HTML-and-README-file-exclusion-options-to-download-command

Conversation

@luxass
Copy link
Copy Markdown
Member

@luxass luxass commented Jun 9, 2025

Summary by CodeRabbit

  • New Features
    • Enhanced the CLI download command to support multiple file filtering patterns via a new flag, allowing more flexible file exclusion.
  • Bug Fixes
    • Improved file exclusion logic to handle multiple patterns and standard exclusion flags more reliably.
  • Tests
    • Expanded and updated test coverage for file filtering, including new scenarios for excluding HTML and README files.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 9, 2025

⚠️ No Changeset found

Latest commit: 921ea71

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 9, 2025

Walkthrough

The CLI download command was updated to replace the single exclude string flag with a patterns array flag for file filtering. Internal logic now constructs a consolidated patterns array based on various exclusion flags and user-supplied patterns. Corresponding tests were updated and expanded to cover the revised flag and filtering behavior.

Changes

File(s) Change Summary
packages/cli/src/cmd/download.ts Replaced exclude string flag with patterns string array; refactored filtering logic.
packages/cli/test/cmd/download.test.ts Updated and expanded tests for new patterns flag and filtering logic; enabled skipped tests.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant DownloadLogic

    User->>CLI: Run download command with flags (e.g., --patterns, --exclude-html-files)
    CLI->>CLI: Build patterns array from flags and user input
    CLI->>DownloadLogic: Call download(patterns)
    DownloadLogic-->>CLI: Download and filter files based on patterns
    CLI-->>User: Output results and summary
Loading

Possibly related PRs

Poem

A rabbit hopped through CLI code,
Replacing "exclude" with patterns bestowed.
Now filters are many, not just one,
Tests were expanded, more filtering fun!
With globs and flags, the files align,
Downloading clean—oh, how divine! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/cli/src/cmd/download.ts

Oops! Something went wrong! :(

ESLint: 9.28.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

packages/cli/test/cmd/download.test.ts

Oops! Something went wrong! :(

ESLint: 9.28.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.


📜 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 d9184b4 and 921ea71.

📒 Files selected for processing (2)
  • packages/cli/src/cmd/download.ts (3 hunks)
  • packages/cli/test/cmd/download.test.ts (7 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/cli/src/cmd/download.ts (2)
packages/ucd-store/src/filter.ts (1)
  • PRECONFIGURED_FILTERS (3-8)
packages/ucd-store/src/download.ts (1)
  • download (111-257)
🔇 Additional comments (10)
packages/cli/src/cmd/download.ts (4)

13-13: Good interface improvement for better flexibility

The change from a single exclude string to a patterns array allows users to specify multiple filtering patterns, which aligns well with the PR objective of providing more granular control over file exclusion.


32-32: Help text accurately reflects the new functionality

The updated help description correctly indicates that the --patterns flag can be used multiple times, which matches the array-based implementation.


92-108: Well-structured pattern consolidation logic

The pattern construction logic is clean and follows a logical flow:

  1. Initialize empty patterns array
  2. Conditionally add predefined filters based on boolean flags
  3. Add user-provided custom patterns
  4. Pass consolidated patterns to download function

This approach maintains backward compatibility while adding the new functionality.


113-113: Correct parameter update for download function

The function call correctly passes the new patterns array instead of the previous exclude parameter, maintaining consistency with the refactored interface.

packages/cli/test/cmd/download.test.ts (6)

49-52: Good addition of HTML file for testing

Adding the "Data.html" mock file entry enables proper testing of the HTML file exclusion functionality introduced in this PR.


77-77: Appropriate mock content for HTML file

The HTML mock content is simple but sufficient for testing file filtering behavior.


187-237: Comprehensive test coverage for new exclusion flags

The new test cases thoroughly verify both excludeHTMLFiles and excludeReadmes functionality:

  • Tests verify that excluded file types are not downloaded
  • Tests verify that non-excluded files are still downloaded correctly
  • Test assertions are specific and comprehensive

This ensures the new filtering features work as intended.


247-247: Correct update to use patterns array

The test correctly updates from the single exclude parameter to the new patterns array, maintaining test functionality while validating the new interface.


270-272: Enhanced combined exclusion test

The test now validates the interaction between multiple exclusion flags (excludeTest, excludeHTMLFiles, excludeReadmes) along with custom patterns, providing better coverage of the consolidated filtering logic.


290-291: Test enabling with appropriate todo marking

Enabling the error handling test suite while marking the API error test as todo is a reasonable approach. The test logic is preserved for future execution while avoiding potential test failures during development.

✨ 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
Copy Markdown
Member Author

luxass commented Jun 9, 2025

@luxass luxass marked this pull request as ready for review June 9, 2025 05:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Member Author

luxass commented Jun 9, 2025

Merge activity

  • Jun 9, 5:36 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 9, 5:37 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 9, 5:39 AM UTC: @luxass merged this pull request with Graphite.

@luxass luxass changed the base branch from luxass/refactor-remove-unused-file-filtering-options to graphite-base/46 June 9, 2025 05:36
@luxass luxass changed the base branch from graphite-base/46 to main June 9, 2025 05:36
@luxass luxass force-pushed the luxass/feat-add-HTML-and-README-file-exclusion-options-to-download-command branch from bffc1a3 to 921ea71 Compare June 9, 2025 05:37
@luxass luxass merged commit 93eaa0c into main Jun 9, 2025
5 of 6 checks passed
@luxass luxass deleted the luxass/feat-add-HTML-and-README-file-exclusion-options-to-download-command branch June 9, 2025 05:39
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