disktree-cli: the scan, findings and removal guards without a window - #32
Open
NakliTechie wants to merge 3 commits into
Open
NakliTechie wants to merge 3 commits into
NakliTechie wants to merge 3 commits into
Conversation
What git knows about a checkout (changes, stashes, unpushed commits) is the question to ask before removing one, whether from the window or from a script. Moving it next to removal.rs lets code without a window ask it too. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Worth a look listed only space known to come back. The largest things a developer machine forgets are often not that: checkpoints and adapters left in a project, and archives downloaded, unpacked and left. Both are now findings, labelled so the panel says to check for a copy rather than suggesting they are safe. - Weights: a directory holding .safetensors, .gguf, .ggml, .ckpt, .pt, .pth, .onnx or .tflite directly; .bin only beside a config.json, the Hugging Face shape. Only the weight files are counted. - Stale archive: an archive or disk image untouched for 30 days, outside a synced folder, where an old archive is a backup. - .worktrees counts as agent worktrees, like worktrees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An agent asked what fills a disk reaches for find and du. This prints what the window shows as JSON instead: totals, free space and Worth a look, each finding with a tier (regenerable or judge) and, for worktrees, what git says about each checkout. check and trash take --root and run removal::plan, the same guards the review screen uses. trash is the only way it removes anything. --store names a directory kept on purpose, such as a model store: its contents are not findings, and a weight file elsewhere with the same name and size as one in it is reported as a copy. Co-Authored-By: Claude Opus 5.5 <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.
Disk cleanup is becoming agent work, and disktree already knows it: its review screen hands the marked list to a coding agent, and "Agent scratch" is one of its categories. This PR adds the other direction: an agent can ask disktree what fills a disk, and remove only through disktree's own guards.
Three commits, each reviewable on its own:
git.rsmoves from the app to core, unchanged, so a checkout's changes, stashes and unpushed commits can be read without a window. No behaviour change..worktrees. Worth a look now lists two things a developer machine forgets. The panel labels both "check for a copy", not "safe to delete"..safetensors,.gguf,.ggml,.ckpt,.pt,.pth,.onnxor.tflitedirectly. A.bincounts only beside aconfig.json, the Hugging Face shape. Only the weight files are counted..worktreesis treated likeworktrees.tier.regenerableis space a tool or build writes again.judgeis space that may be the only copy. Worktree findings include each checkout's git state.--storenames a directory kept on purpose, such as a model store. Findings inside it are left out. A weight file elsewhere with the same name and size is reported as a copy of the one in the store.--rootis required forcheckandtrash, as the scanned root is the consent boundary in the window.trashis the only way it removes anything. There is no permanent mode.The one new dependency is
serde_json, in the CLI crate only.Checks
cargo xtask lint: clean on Rust 1.98.1.cargo xtask test: 173 passed, 0 failed. That includes 5 new insights tests and 3 CLI tests: a store match, guard refusals, and--rootrequired.disktree-cli scan ~/Codetook 22 s for 1.63M files, 206 GB.checkrefused home, the scanned root, and a path under/private.trashmoved a test directory to the macOS Trash.cfg(unix)block size, with alen()fallback elsewhere.README gains a "Without a window" section. AGENTS.md's map gains
git.rsand the CLI.Happy to split this into three PRs, or to drop the CLI and keep only the findings, if that fits the project better.
🤖 Generated with Claude Code