feat(search_files): clarify description and standardise implementation

Previously description was confusing/ambigious about whether this was doing text content matching or filename matching. This clarifies it's by filename.

Also the implementation for globs was confusing - it would sometimes use glob and sometimes substring match. This makes it all globs.

Fixes #896

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Adam Jones
2025-08-23 06:51:19 +00:00
parent fd886fac9c
commit c4450cea6c
4 changed files with 32 additions and 35 deletions

View File

@@ -350,7 +350,7 @@ export async function headFile(filePath: string, numLines: number): Promise<stri
export async function searchFilesWithValidation(
rootPath: string,
pattern: string,
patterns: string[],
allowedDirectories: string[],
options: SearchOptions = {}
): Promise<string[]> {
@@ -373,8 +373,12 @@ export async function searchFilesWithValidation(
if (shouldExclude) continue;
// Use glob matching for the search pattern
if (minimatch(relativePath, pattern, { dot: true })) {
// Check if the path matches any of the patterns
const matches = patterns.some(pattern =>
minimatch(relativePath, pattern, { dot: true })
);
if (matches) {
results.push(fullPath);
}