feat: estimate reclaimable space before cleaning (menu option 99)#45
Open
giuseppelanzi wants to merge 1 commit into
Open
feat: estimate reclaimable space before cleaning (menu option 99)#45giuseppelanzi wants to merge 1 commit into
giuseppelanzi wants to merge 1 commit into
Conversation
Adds a read-only menu option 99 that estimates how much disk space each cleanup entry would free, then redraws the menu with "(Estimate: <size>)" plus a total on Clear All. It only runs du / Measure-Object and deletes nothing (works the same under --dry-run). - Mirrors the cleanup_* / Clear-* paths so the estimate matches what cleanup would remove. - Best-effort for tool-managed caches; approximate values marked "~". - Flutter/PlatformIO cover the global cache only; Time Machine reports the snapshot count. macOS sizes use df-style binary units (Gi/Mi/Ki). - Implemented in both dev-cleaner.sh and dev-cleaner.ps1. - Stable string category keys keep it robust to future menu renumbering. Refs: jemishavasoya#44 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #44
What
Adds a read-only menu option
99that estimates how much disk spaceeach cleanup entry would free, then redraws the menu with
(Estimate: <size>)next to every option and a total on Clear All.Why
The tool only shows total free space and a before/after figure. There was no
way to see which options are worth running, or how much each would reclaim,
before deleting anything.
How
du(bash) /Measure-Object(PowerShell). Deletes nothing; behaves identically under
--dry-run.would remove (kept in a dedicated, commented section).
known cache dirs; approximate values are prefixed with
~.no recursive project scan); Time Machine reports the local snapshot count.
df -h(Gi/Mi/Ki) so theestimate matches the existing "Free Space" figure.
dev-cleaner.shanddev-cleaner.ps1.99is intentionally non-contiguous and categories use stablestring keys, so existing options
0-N, the "Invalid choice" message andany future menu renumbering are unaffected.
Testing
bash -n dev-cleaner.sh: passes.shellcheck dev-cleaner.sh: no new findings introduced by this change(only pre-existing, unrelated warnings remain; the two intentional
glob-expansion lines mirror
safe_rmand carry a scoped# shellcheck disablewith a reason).human_kb,du_kb_sum,est) and anend-to-end
estimate_allrun against a sandboxed$HOME: all 14categories + total populated, approximations marked
~, Time Machine asa count, and a before/after filesystem snapshot confirming nothing is
deleted (read-only guarantee, identical under
--dry-run).dev-cleaner.ps1: feature implemented at parity (no PowerShell availableon the dev machine to execute it locally — Windows validation by reviewers
welcome).
🤖 Generated with Claude Code