fix: make grep regex implementation skip hidden files to match ripgrep behavior

Carlos Alexandro Becker and Crush created

The regex fallback implementation for grep was including hidden files (starting with '.')
while ripgrep naturally excludes them by default. This caused inconsistent behavior between
the two search implementations.

This change adds explicit hidden file filtering to the regex implementation to ensure
both search methods behave consistently and match the documented behavior.

Fixes failing TestSearchImplementations/regex test.

💖 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

Change summary

internal/llm/tools/grep.go | 6 ++++++
1 file changed, 6 insertions(+)

Detailed changes

internal/llm/tools/grep.go 🔗

@@ -365,6 +365,12 @@ func searchFilesWithRegex(pattern, rootPath, include string) ([]grepMatch, error
 			return nil
 		}
 
+		// Skip hidden files (starting with a dot) to match ripgrep's default behavior
+		base := filepath.Base(path)
+		if base != "." && strings.HasPrefix(base, ".") {
+			return nil
+		}
+
 		if includePattern != nil && !includePattern.MatchString(path) {
 			return nil
 		}