Skip to content

Feature: estimate reclaimable space before cleaning (menu option 99) #44

@giuseppelanzi

Description

@giuseppelanzi

Summary

Add a read-only menu option 99 that estimates how much disk space
each cleanup entry would free, then redraws the menu with
(Estimate: <size>) next to every option plus a total on Clear All.

Today the tool only shows total free disk space and a before/after figure;
there's no way to know which options are worth running, or how much each
would reclaim, before deleting anything.

Proposed behaviour

  • New option 99 (non-contiguous on purpose, so it stays stable if the menu
    is renumbered by future PRs). Existing options 0-N and the "Invalid
    choice" message are unchanged.
  • Strictly read-only: it only runs du (bash) / Measure-Object
    (PowerShell). It deletes nothing and behaves identically under --dry-run.
  • Per-entry estimate mirrors exactly the paths the matching cleanup routine
    would remove.
  • Best-effort for tool-managed caches (npm/yarn/pnpm, Homebrew, etc.) using
    their known cache dirs; approximate values are marked with a leading ~.
  • Flutter and PlatformIO estimates cover the global cache only (fast and
    deterministic, no recursive project scan); Time Machine reports the local
    snapshot count rather than bytes.
  • Sizes use the same binary units as df -h on macOS (Gi/Mi/Ki) so the
    estimate matches the existing "Free Space" figure.
  • Implemented in both dev-cleaner.sh and dev-cleaner.ps1 (parity).

Environment

  • OS: macOS (bash 3.2-safe, validated with shellcheck) and Windows
    (PowerShell 5.1+) — feature added to both ports.
  • Shell: bash / PowerShell.

I have an implementation ready and would like to submit it as a PR if the
maintainers are happy with the approach (especially: option number 99,
read-only guarantee, and the ~ = approximate convention).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions