diff --git a/analyze b/analyze deleted file mode 100755 index 1a18621..0000000 Binary files a/analyze and /dev/null differ diff --git a/bin/analyze-go b/bin/analyze-go index 8cd0b9e..8a6c4c7 100755 Binary files a/bin/analyze-go and b/bin/analyze-go differ diff --git a/bin/clean.sh b/bin/clean.sh index dbc417d..9371b79 100755 --- a/bin/clean.sh +++ b/bin/clean.sh @@ -403,11 +403,12 @@ clean_ds_store_tree() { -path "*/Library/Caches" -prune -o ) - # Limit depth for HOME to avoid slow scans - local -a max_depth=() + # Build find command to avoid unbound array expansion with set -u + local -a find_cmd=("find" "$target") if [[ "$target" == "$HOME" ]]; then - max_depth=(-maxdepth 5) + find_cmd+=("-maxdepth" "5") fi + find_cmd+=("${exclude_paths[@]}" "-type" "f" "-name" ".DS_Store" "-print0") # Find .DS_Store files with exclusions and depth limit while IFS= read -r -d '' ds_file; do @@ -423,7 +424,7 @@ clean_ds_store_tree() { if [[ $file_count -ge 500 ]]; then break fi - done < <(find "$target" "${max_depth[@]}" "${exclude_paths[@]}" -type f -name '.DS_Store' -print0 2> /dev/null) + done < <("${find_cmd[@]}" 2> /dev/null) if [[ "$spinner_active" == "true" ]]; then stop_inline_spinner @@ -941,24 +942,42 @@ perform_cleanup() { # Clean project build caches in home directory (safe - can be rebuilt) # Find .next/cache directories (limit depth to avoid slow scans) - find "$HOME" -type d -name ".next" -maxdepth 4 \ - -not -path "*/Library/*" \ - -not -path "*/.Trash/*" \ - -not -path "*/node_modules/*" \ - 2>/dev/null | while read -r next_dir; do + if [[ -t 1 ]]; then + MOLE_SPINNER_PREFIX=" " + start_inline_spinner "Searching Next.js caches..." + fi + while IFS= read -r next_dir; do if [[ -d "$next_dir/cache" ]]; then safe_clean "$next_dir/cache"/* "Next.js build cache" || true fi - done + done < <( + find "$HOME" -type d -name ".next" -maxdepth 4 \ + -not -path "*/Library/*" \ + -not -path "*/.Trash/*" \ + -not -path "*/node_modules/*" \ + 2>/dev/null || true + ) + if [[ -t 1 ]]; then + stop_inline_spinner + fi # Clean Python bytecode cache (limit depth to avoid slow scans) - find "$HOME" -type d -name "__pycache__" -maxdepth 5 \ - -not -path "*/Library/*" \ - -not -path "*/.Trash/*" \ - -not -path "*/node_modules/*" \ - 2>/dev/null | while read -r pycache; do + if [[ -t 1 ]]; then + MOLE_SPINNER_PREFIX=" " + start_inline_spinner "Searching Python caches..." + fi + while IFS= read -r pycache; do safe_clean "$pycache"/* "Python bytecode cache" || true - done + done < <( + find "$HOME" -type d -name "__pycache__" -maxdepth 5 \ + -not -path "*/Library/*" \ + -not -path "*/.Trash/*" \ + -not -path "*/node_modules/*" \ + 2>/dev/null || true + ) + if [[ -t 1 ]]; then + stop_inline_spinner + fi safe_clean ~/Library/Caches/Google/AndroidStudio*/* "Android Studio cache" safe_clean ~/Library/Caches/com.unity3d.*/* "Unity cache" safe_clean ~/Library/Caches/com.jetbrains.toolbox/* "JetBrains Toolbox cache" diff --git a/cmd/analyze/main.go b/cmd/analyze/main.go index 327ab9c..9a6ab25 100644 --- a/cmd/analyze/main.go +++ b/cmd/analyze/main.go @@ -934,8 +934,28 @@ func (m model) View() string { if m.isOverview { fmt.Fprintf(&b, "%sAnalyze Disk%s\n", colorPurple, colorReset) if m.overviewScanning { - fmt.Fprintf(&b, "%sSelect a location to explore:%s ", colorGray, colorReset) - fmt.Fprintf(&b, "%s%s%s%s Scanning...\n", colorCyan, colorBold, spinnerFrames[m.spinner], colorReset) + // Check if we're in initial scan (all entries are pending) + allPending := true + for _, entry := range m.entries { + if entry.size >= 0 { + allPending = false + break + } + } + + if allPending { + // Show prominent loading screen for initial scan + fmt.Fprintf(&b, "\n%s%s%s%s Measuring disk usage across system directories...\n", + colorCyan, colorBold, + spinnerFrames[m.spinner], + colorReset) + fmt.Fprintf(&b, "%sThis may take a moment on first run%s\n", colorGray, colorReset) + return b.String() + } else { + // Progressive scanning - show subtle indicator + fmt.Fprintf(&b, "%sSelect a location to explore:%s ", colorGray, colorReset) + fmt.Fprintf(&b, "%s%s%s%s Scanning...\n", colorCyan, colorBold, spinnerFrames[m.spinner], colorReset) + } } else { fmt.Fprintf(&b, "%sSelect a location to explore:%s\n", colorGray, colorReset) } diff --git a/mole b/mole index ea6a645..9aedd8b 100755 --- a/mole +++ b/mole @@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/lib/common.sh" # Version info -VERSION="1.9.2" +VERSION="1.9.3" MOLE_TAGLINE="can dig deep to clean your Mac." # Get latest version from remote repository diff --git a/optimize b/optimize deleted file mode 100755 index a8a84fe..0000000 Binary files a/optimize and /dev/null differ