From e288b4136575b1c84f8d1d91d13763184169229a Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Wed, 29 Jul 2026 12:40:33 -0600 Subject: [PATCH] fix: improper handling of fd-style globbing for directories in fs_glob --- assets/functions/tools/fs_glob.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/assets/functions/tools/fs_glob.sh b/assets/functions/tools/fs_glob.sh index 8271300..479b2d7 100644 --- a/assets/functions/tools/fs_glob.sh +++ b/assets/functions/tools/fs_glob.sh @@ -33,7 +33,18 @@ main() { --exclude '.build' \ 2>/dev/null | head -n "$MAX_RESULTS") || true else - results=$(find "$search_path" -type f -name "$glob_pattern" \ + local name_pattern dir_prefix effective_search + name_pattern="${glob_pattern##*/}" + [[ -z "$name_pattern" || "$name_pattern" == "**" ]] && name_pattern="*" + if [[ "$glob_pattern" == */* ]]; then + dir_prefix="${glob_pattern%%\**}" + dir_prefix="${dir_prefix%/}" + effective_search="${search_path}${dir_prefix:+/$dir_prefix}" + else + effective_search="$search_path" + fi + [[ -d "$effective_search" ]] || effective_search="$search_path" + results=$(find "$effective_search" -type f -name "$name_pattern" \ -not -path '*/.git/*' \ -not -path '*/node_modules/*' \ -not -path '*/target/*' \