Skip to content

feat(website): Add include patterns support to web interface#249

Merged
yamadashy merged 2 commits intomainfrom
feat/website-include-pattern
Jan 4, 2025
Merged

feat(website): Add include patterns support to web interface#249
yamadashy merged 2 commits intomainfrom
feat/website-include-pattern

Conversation

@yamadashy
Copy link
Owner

@yamadashy yamadashy commented Jan 4, 2025

ref: #219 (comment)

Checklist

  • Run npm run test
  • Run npm run lint
image

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

@standard-input standard-input bot left a comment

Choose a reason for hiding this comment

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

No issues flagged.
Standard Input can make mistakes. Check important info.

@codecov
Copy link

codecov bot commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.26%. Comparing base (f2c612a) to head (cd2c172).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #249   +/-   ##
=======================================
  Coverage   92.26%   92.26%           
=======================================
  Files          44       44           
  Lines        2108     2108           
  Branches      462      462           
=======================================
  Hits         1945     1945           
  Misses        163      163           

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 4, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a new feature for specifying include patterns when processing GitHub repositories. The changes span multiple files across the client and server components, adding an includePatterns option that allows users to define which files or directories should be included during repository processing. The implementation includes client-side UI updates, backend validation, and analytics tracking for the new feature.

Changes

File Change Summary
website/client/.vitepress/theme/components/TryIt.vue Added includePatterns state variable, new input field, and handleIncludePatternsUpdate method to manage include patterns. Modified handleSubmit to include includePatterns. Removed ignorePatternList.
website/client/.vitepress/theme/components/api/client.ts Extended PackOptions interface with optional includePatterns property.
website/client/.vitepress/theme/components/utils/analytics.ts Added UPDATE_INCLUDE_PATTERNS action and trackIncludePatternsUpdate method for analytics.
website/server/src/remoteRepo.ts Updated to use new sanitizePattern function and include includePatterns in processing.
website/server/src/schemas/request.ts Added optional includePatterns field to packOptionsSchema with validation.
website/server/src/types.ts Added includePatterns to PackOptions interface.
website/server/src/utils/validation.ts Renamed sanitizeIgnorePattern to sanitizePattern.

Sequence Diagram

sequenceDiagram
    participant User
    participant ClientUI
    participant Analytics
    participant Backend

    User->>ClientUI: Enter include patterns
    ClientUI->>Analytics: Track include patterns update
    ClientUI->>Backend: Submit repository with include patterns
    Backend->>Backend: Validate and sanitize patterns
    Backend->>Backend: Process repository using include patterns
    Backend-->>ClientUI: Return processed repository
Loading

Possibly related PRs


📜 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 430457c and cd2c172.

📒 Files selected for processing (1)
  • website/client/.vitepress/theme/components/TryIt.vue (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • website/client/.vitepress/theme/components/TryIt.vue

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.

Copy link
Contributor

@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 (3)
website/server/src/types.ts (1)

7-7: Consider allowing an array type for multiple include patterns.
Currently, this property is defined as a string analogous to ignorePatterns. If supporting multiple patterns more naturally, consider making this an array of strings or clarifying the delimiter-based approach.

website/server/src/utils/validation.ts (1)

16-16: Double-check absolute paths on Windows.
This filter removes patterns that start with “/” or contain “../” or “..\”. If Windows drive letters (e.g., “C:\”) need to be excluded, consider adding a check for them as well.

website/server/src/schemas/request.ts (1)

17-21: Optionally align validation with ignorePatterns.
If you want to restrict the allowed characters for includePatterns similarly to ignorePatterns, consider applying the same regex for consistent pattern rules.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f2c612a and 430457c.

📒 Files selected for processing (7)
  • website/client/.vitepress/theme/components/TryIt.vue (5 hunks)
  • website/client/.vitepress/theme/components/api/client.ts (1 hunks)
  • website/client/.vitepress/theme/components/utils/analytics.ts (2 hunks)
  • website/server/src/remoteRepo.ts (3 hunks)
  • website/server/src/schemas/request.ts (1 hunks)
  • website/server/src/types.ts (1 hunks)
  • website/server/src/utils/validation.ts (1 hunks)
🔇 Additional comments (11)
website/client/.vitepress/theme/components/api/client.ts (1)

7-7: Property definition aligns with server schema.
No concerns — this property correctly mirrors the server interface addition.

website/server/src/remoteRepo.ts (3)

9-9: Use of a unified sanitizePattern is well-structured

Importing the unified sanitizePattern function to handle both include and ignore patterns keeps the code DRY and consistent.


44-45: Validate undefined or empty pattern arrays

Your sanitizePattern(validatedData.options.includePatterns) and sanitizePattern(validatedData.options.ignorePatterns) calls are well-placed, but please confirm that edge cases—like empty strings or null/undefined—won’t cause issues or bypass the validation.


60-60: Ensure proper mapping in CLI options

Including both include and ignore patterns in the cliOptions object is good. Just verify that the downstream library (repomix) handles them as expected, especially if the sanitized result is [] or [''].

website/client/.vitepress/theme/components/utils/analytics.ts (2)

27-27: Addition of UPDATE_INCLUDE_PATTERNS constant

Defining a separate analytics constant for include patterns helps clearly distinguish these events. Nicely done.


111-117: New method for tracking include patterns updates

The trackIncludePatternsUpdate method is straightforward and consistent with your analytics pattern. Ensure it’s called at all necessary points where includePatterns changes.

website/client/.vitepress/theme/components/TryIt.vue (5)

17-17: New state variable for includePatterns

Having a dedicated ref for include patterns is a clean approach.


71-71: Include patterns in request options

Sending includePatterns (when non-empty) aligns well with the server’s new logic. Consider an additional client-side safety check or preview before submission, if relevant to the UX.


145-148: Refined analytics for include patterns

The handleIncludePatternsUpdate function uses analytics to track changes, which is an excellent way to gain insights on how users use the feature.


247-258: User-friendly input for include patterns

Providing direct guidance and an external reference link (glob syntax doc) is a valuable addition to help users properly define patterns.


450-456: Good link styling

Highlighting the external link with a brand color and an underline on hover is a user-friendly approach.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 4, 2025

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: cd2c172
Status: ✅  Deploy successful!
Preview URL: https://d0a570c9.repomix.pages.dev
Branch Preview URL: https://feat-website-include-pattern.repomix.pages.dev

View logs

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