Skip to content

feat: move folders to the Trash instead of deleting them - #9

Merged
devloop01 merged 2 commits into
mainfrom
claude/bold-gauss-71xj8f
Nov 14, 2026
Merged

devloop01 merged 2 commits into
mainfrom
claude/bold-gauss-71xj8f

Conversation

@devloop01

@devloop01 devloop01 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

sweep no longer deletes anything. Every folder it removes goes to the Trash, so one removed by mistake (by you or by sweep) can be dragged back out.

What changes

  • Where folders go: ~/.Trash, or .Trashes/<uid> on an external drive, like Finder. sweep creates it if it's missing. If a disk has no usable Trash, sweep stops before scanning. -n still works there.
  • How the move works: every existing re-check runs first. The move is then a single renameatx_np with RENAME_EXCL, made from the parent folder Remove already holds open. It moves exactly the folder the scan saw, never overwrites anything in the Trash, and is instant whatever the folder's size.
  • Names in the Trash: Finder's Put Back doesn't cover folders sweep moves, so each one is named after where it came from, e.g. Code › web › node_modules. Starting with the projects folder's name also keeps .next and similar folders visible in Finder.
  • What sweep skips: the scan never enters .Trash or .Trashes, and neither can be a target in targets.conf.
  • Wording: the prompt, dialog, statuses and summary all say Trash, and remind you that emptying it gets the space back.
  • Docs and demo: the README, DEVELOPMENT.md and the demo GIF are updated. The recording uses its own HOME, so make demo never touches your Trash.

There's no flag to delete for good. That's deliberate, to keep sweep predictable.

Testing

  • go test -race ./... passes on an Apple Silicon Mac. Tests use a temporary Trash (TestMain) and never touch the real one.
  • New tests cover the move, names that clash, failures that lose nothing, FindTrash, a disk-image volume's .Trashes, and the screen's wording. The random-use safety test now runs against a Trash.
  • I ran the built binary by hand with -y against the real ~/.Trash.
  • I also ran it from Terminal.app, which doesn't have Full Disk Access, and the folder reached ~/.Trash intact.

🤖 Generated with Claude Code

claude and others added 2 commits November 14, 2026 20:11
A folder removed by mistake can be dragged back out of the Trash. sweep never deletes anything itself any more. The Trash is ~/.Trash, or the disk's .Trashes/<uid>; the move is one renameatx_np (RENAME_EXCL) from the parent Remove holds open, after every existing check. Folders are named after where they came from ("Code › web › .next"). The scan never enters Trash folders, and tests never touch the real Trash.
The recording gets a home of its own, so the two folders it moves go to demo/home/.Trash, which make demo removes, not to your Trash.
@changeset-bot

changeset-bot Bot commented Nov 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: eb40f9c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devloop01
devloop01 merged commit 479ec7a into main Nov 14, 2026
1 check passed
@devloop01
devloop01 deleted the claude/bold-gauss-71xj8f branch November 14, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants