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

allow ! ( and ) in ignorePatterns via website #396

Merged
merged 1 commit into from
Mar 9, 2025

Conversation

eastlondoner
Copy link
Contributor

Allow ! ( and ) in ignorePatterns submitted via the website.

These are useful if you want to have a pattern like !.(cursor)/** which ignores all dot-prefixed folders in the root except .cursor/.

Checklist

  • Run npm run test
  • Run npm run lint

Manual test

you can manually test that negations ! and parentheses () are not just valid but useful in the ignorePattern using this script:

#!/bin/bash

# Set up error handling
set -e

# Create a temporary test directory
echo "📁 Creating test directory structure..."
TEST_DIR="repomix-test"
mkdir -p "$TEST_DIR"
cd "$TEST_DIR"

# Create test directories and files
echo "📝 Creating test files..."
mkdir -p .hidden .cursor .git
echo "Hidden file content" > .hidden/file.txt
echo "Cursor file content" > .cursor/file.txt
echo "Git file content" > .git/file.txt
echo "Regular file content" > regular.txt

# Create repomix config
echo "⚙️ Creating repomix configuration..."
cat > repomix.config.json << 'EOF'
{
  "output": {
    "filePath": "test-output.txt"
  },
  "ignore": {
    "useGitignore": false,
    "useDefaultPatterns": false,
    "customPatterns": [
      "**/.!(cursor)/**"
    ]
  }
}
EOF

# Show the created structure
echo -e "\n📂 Created directory structure:"
ls -la

# Run repomix
echo -e "\n🚀 Running repomix..."
npx repomix -c repomix.config.json

# Show the contents of the output file
echo -e "\n📄 Contents of test-output.txt:"
cat test-output.txt

# Clean up
echo -e "\n🧹 Cleaning up..."
cd ..
rm -rf "$TEST_DIR"

echo -e "\n✨ Demo completed successfully!" 

@eastlondoner eastlondoner requested a review from yamadashy as a code owner March 8, 2025 15:20
@yamadashy yamadashy requested a review from Copilot March 8, 2025 15:28

Choose a reason for hiding this comment

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

PR Overview

This PR updates the ignore pattern validation to allow the characters "!", "(", and ")" to be used via the website.

  • Updated the regular expression in the ignore pattern schema to include "!", "(", and ")"
  • Adjusted the documentation comment to reflect the expanded set of allowed characters

Reviewed Changes

File Description
website/server/src/schemas/request.ts Updated regex and its documentation to allow new characters in ignore patterns

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

website/server/src/schemas/request.ts:5

  • Consider adding unit tests to explicitly confirm that patterns containing '!', '(', and ')' are correctly accepted by the regex.
// Allowed characters: alphanumeric, *, ?, /, -, _, ., !, (, ), space, comma
Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.21%. Comparing base (990cef7) to head (93c5ac3).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #396   +/-   ##
=======================================
  Coverage   90.21%   90.21%           
=======================================
  Files          72       72           
  Lines        3484     3484           
  Branches      755      755           
=======================================
  Hits         3143     3143           
  Misses        341      341           

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yamadashy
Copy link
Owner

Hi, @eastlondoner !
Thank you for your contribution!

I've been testing the functionality, but it seems that the ! negation pattern doesn't work properly.

After investigation, it appears this is related to limitations in fast-glob's handling of negative ignore patterns:
mrmlnc/fast-glob#86 (comment)

However, I think it's still better for the user experience to allow these characters rather than displaying an error. I'll merge this PR and create a separate issue to track the problem with negative ignore patterns not working as expected.

@eastlondoner
Copy link
Contributor Author

thanks!

@yamadashy
Copy link
Owner

@eastlondoner
I'll go ahead and merge this!
I'll create a separate issue to track the problem.

Thank you for your contribution!

@yamadashy yamadashy merged commit cf57371 into yamadashy:main Mar 9, 2025
52 checks passed
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