Skip to content

Commit a2c66ba

Browse files
committed
fix: implement glob pattern matching for search_files pattern argument
- Use minimatch for pattern matching instead of substring matching - Remove automatic conversion of excludePatterns to **/<pattern>/** format - Both pattern and excludePatterns now use consistent glob matching
1 parent 89e2aaf commit a2c66ba

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/filesystem/lib.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,14 @@ export async function searchFilesWithValidation(
367367
await validatePath(fullPath);
368368

369369
const relativePath = path.relative(rootPath, fullPath);
370-
const shouldExclude = excludePatterns.some(excludePattern => {
371-
const globPattern = excludePattern.includes('*') ? excludePattern : `**/${excludePattern}/**`;
372-
return minimatch(relativePath, globPattern, { dot: true });
373-
});
370+
const shouldExclude = excludePatterns.some(excludePattern =>
371+
minimatch(relativePath, excludePattern, { dot: true })
372+
);
374373

375374
if (shouldExclude) continue;
376375

377-
if (entry.name.toLowerCase().includes(pattern.toLowerCase())) {
376+
// Use glob matching for the search pattern
377+
if (minimatch(relativePath, pattern, { dot: true })) {
378378
results.push(fullPath);
379379
}
380380

0 commit comments

Comments
 (0)