Repository navigation
feat(cleaner): built-in Cleaner plugin to free disk space safely (CLI, TUI, desktop, MCP) - #82
Merged
Merged
Conversation
…, TUI, desktop, MCP) A new built-in plugin, enabled by default, that analyses what is using and growing a disk (filesystems, biggest directories, live writers from /proc io deltas, growth since the last report), classifies every finding as safe, safe-if-idle or needs-a-human with the reason, ranks them by bytes freed per unit of risk, and removes only safe-class items on an explicit apply, re-checking every guard on the target at deletion time. Runs locally or on any known server over ssh (POSIX sh fed on stdin, no scratch files, so it works on a full disk). Surfaces: `diskpush clean` (report, run, targets, cron, mcp), a TUI/desktop folder action, the desktop Cleaner tab, an MCP server, docs and a homepage section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…e du -d 1 pass per root; cancel kills the whole process group Found by a real read-only report on a 1.8 TB box: per-child du with a 20 s budget left the biggest folders as '?', the case that matters most. A du that runs out of time has already printed every subfolder it finished, so their sum is a true lower bound. Roots are sized in one bounded pass and only the unfinished children are sized one by one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Merging on local evidence: the org's Actions runners are jammed (this PR's CI and ThreatCrush runs are still queued). Local, Node 24.22.2, branch head c8e5b63:
|
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.
What
A built-in Cleaner plugin (
cleaner, CLI aliasdiskpush clean), enabled by default, that frees disk space intelligently on this machine or on any server DiskPush can ssh to.The heart of it is the analysis:
du -d 1per root, falling back to parallel per-folderduwith a timeout each, so one huge tree shows as?instead of stalling the scan), the processes writing right now (per-process/proc/<pid>/iowrite_bytesdeltas, mapped to docker container names), and growth since the last report (a snapshot per target in the plugin's settings).safe(regenerable),safe-if-idle(removable only because the guards prove nobody uses it), orneeds-a-human(databases, backups, docker volumes, stopped containers, media: reported with a command to look closer, never deleted). Each item carries its reason and a suggested command.Then, only on an explicit apply (CLI
--apply, MCPapply: true, desktop confirm dialog), it removes the chosen safe-class items, re-checking every guard on the target at the moment of deletion.Categories
caches: npm, pnpm (store prune), yarn, bun, uv, pip, cargo registry, go build cache; skipped while the tool runsdocker:docker builder prune -f,docker image prune -a -f --filter until=72h; volumes and containers never touchedlogs: journald vacuum to a cap, gzip of rotated logs nobody has open (root or--sudo, otherwise listed with the command)build:node_modules/.next/target/dist/... only next to a project marker, git-ignored, whole repo idle N days (default 3), no live process cwd/exe inside it, not referenced by a linked command, crontab, cron.d, systemd unit or a running container's bind mountpartials:*.partial/*.part/*.crdownloaduntouched 24 h and not openSafety
$XDG_RUNTIME_DIR) means two cleans never overlap;--min-free-gb Ndoes nothing while N GB are free and stops once they are (cron-safe;diskpush clean cronprints the line).du/findchildren too).Surfaces (one core:
packages/plugin-cleaner)diskpush clean report [TARGET],diskpush clean [TARGET] [--apply] [--only ...] [--idle-days N] [--min-free-gb N] [--roots ...] [--sudo] [--json],clean targets,clean crondiskpush clean mcp(stdio):clean_targets,clean_report,clean_applya/ right-click on a folder: "Disk report: what can be freed here"docs/cleaner.md(also in the site docs and llms.txt)scanTarget,applyClean,listTargetsexported from@diskpush/plugin-cleanerAlso:
cleanis a reserved plugin id, the cleaner is in the release manifests and gets the strict ThreatCrush plugin scan.Tests
packages/plugin-cleaner/src/cleaner.test.tsruns the real scan and apply programs in a real shell against a fixture home (docker, npm, journalctl, crontab, pgrep shimmed on PATH): an idle repo, an active repo, a repo with a live process inside, a repo named by a crontab line, committeddist, anode_modulesoutside any project, old and fresh.partialfiles, a rotated log. It asserts the dry run deletes nothing, apply deletes exactly the eligible set, category filtering, re-verification at delete time, the lock, threshold mode, the MCP dry-run, and quoting. Plus CLI alias tests, desktop contract and helper tests.Local results (Node 24, this branch): full suite 959 tests, 958 passed in the full run; the one failure (mediaanalyzer ffmpeg sampling, 5 s timeout) passes alone (21/21), the box was at load average 82.
pnpm -r typecheckclean. Cleaner suite 15/15.Desktop Cleaner tab screenshotted in both themes (static renderer export + stubbed preload bridge): report, ranked plan, kept-and-why, needs-a-human with commands, confirm dialog.
🤖 Generated with Claude Code