Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Name all five things Peel deletes outright, and hold the list

Țugui Dragoșf160d887c0df
diff --git a/AGENTS.md b/AGENTS.md
index 21e767f9..c298d405 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -74,11 +74,14 @@ checked by hand. If a change makes one of them fail, the rule is right and the c
- **Nothing of the user's is ever deleted for good.** Every removal goes to the Trash through `TrashService` and is
recorded, so History can put it back. In the app it runs inside `QuitGuard.shared.run` from its first move until
- History has it, and so does a Put Back, so quitting waits for them. Peel deletes outright only three things, none of
+ History has it, and so does a Put Back, so quitting waits for them. Peel deletes outright only five things, none of
them the user's: the empty placeholder `TrashMover` makes to hold a name on a disk that can't rename without
replacing (exFAT), once the move it was made for has failed; the folder `PreferenceBackup` makes for a reset's saved
- settings, when saving fails while it is still empty; and the empty file cfprefsd writes back where a moved settings
- file was, when `PreferenceCleanup` forgets a domain cfprefsd still holds. Peel's list of refusals, with any copy of it
+ settings, when saving fails while it is still empty; the folders Put Back makes on the way back
+ (`DirectoryHandle.child(_:makingIfMissing:)`), when the item then stays in the Trash and each is still the empty
+ folder it made; the folder Remove Peel gathers its own files in (`SelfRemoval`), once they are back out of it because
+ its move was refused; and the empty file cfprefsd writes back where a moved settings file was, when
+ `PreferenceCleanup` forgets a domain cfprefsd still holds. Peel's list of refusals, with any copy of it
set aside because it couldn't be read, goes to the Trash when `peel history --refused --clear` asks.
- **What History can't undo says so where the person confirms it**: Homebrew's own uninstall and its cleanups,
resetting an app's privacy permissions, and Force Quit for an app that is still open 10 seconds after Peel asked
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 170f706c..af10da46 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -208,7 +208,8 @@ A handful of ideas carry most of the weight. Each is enforced in one place and t
replacing (exFAT), when the move it was made for fails; the folder `PreferenceBackup` makes for a reset's saved
settings, when saving fails while it is still empty; the folders Put Back makes on the way back
(`DirectoryHandle.child(_:makingIfMissing:)`), when the item then stays in the Trash and each is still the empty
- folder it made; and the empty file cfprefsd writes back where a moved settings file was when `PreferenceCleanup`
+ folder it made; the folder Remove Peel gathers its own files in (`SelfRemoval`), once they are back out of it because
+ its move was refused; and the empty file cfprefsd writes back where a moved settings file was when `PreferenceCleanup`
forgets a domain it still holds, which would keep History from putting that file back. Peel's list of refusals, with
any copy of it set aside because it couldn't be read, goes to the Trash when `peel history --refused --clear` asks.
Four actions can't be undone by History, and each says so
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DocumentationTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DocumentationTests.swift
index 5f9df7b1..c805fdd9 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DocumentationTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DocumentationTests.swift
@@ -56,6 +56,7 @@ struct DocumentationTests {
("SAFETY.md", "and the \(LibraryFolder.plugIns.count) that hold plug-ins"),
("ARCHITECTURE.md", "at most \(HelperRequest.maximumItems) items"),
("ARCHITECTURE.md", "JSON keeps each value whole"),
+ ("AGENTS.md", "Peel deletes outright only five things"),
("ARCHITECTURE.md", "answers, within \(Int(PrivilegedHelper.answerWait)) seconds"),
("ARCHITECTURE.md", "at most \(Int(PrivilegedHelper.requestWait)) seconds for a request"),
("SAFETY.md", "quits \(idle) seconds after its last request ends"),
@@ -81,6 +82,21 @@ struct DocumentationTests {
#expect(wrong.isEmpty, "\(wrong)")
}
+ @Test func everyPlaceThatDeletesOutrightIsOneTheDocumentsName() throws {
+ let call = try Regex(#"\b(unlinkat?|rmdir|removefile|removeItem)\("#)
+ var calls: [String: Int] = [:]
+ for file in try LineLengthTests.swiftFiles() where !file.path(percentEncoded: false).contains("/Tests/") {
+ let code = try String(contentsOf: file, encoding: .utf8).split(separator: "\n")
+ .filter { !$0.trimmingCharacters(in: .whitespaces).hasPrefix("//") }
+ let count = code.reduce(0) { $0 + $1.matches(of: call).count }
+ if count > 0 { calls[file.lastPathComponent] = count }
+ }
+
+ #expect(calls == [
+ "TrashMover.swift": 2, "PreferenceBackup.swift": 1, "DirectoryHandle.swift": 3, "SelfRemoval.swift": 1,
+ ], "Name a new one in AGENTS.md, SAFETY.md, and ARCHITECTURE.md, and say why it holds nothing of the person's.")
+ }
+
@Test func everyAddressPrivacyMDNamesIsInSettingsPrivacy() throws {
let privacy = try String(contentsOf: LineLengthTests.repository.appending(path: "PRIVACY.md"), encoding: .utf8)
let addresses = privacy.split(separator: "\n").compactMap { line in
diff --git a/SAFETY.md b/SAFETY.md
index 2bba7110..9259bc13 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -205,7 +205,8 @@ free name allows, and the move then replaces the placeholder.
What Peel deletes outright holds nothing of yours: such a placeholder, when the move it was made for fails; the folder
it makes to save an app's settings before a reset, when saving fails before anything is written in it; the folders it
makes again on the way back for a Put Back, when the item then stays in the Trash and each is still the empty folder it
-made; and the empty settings file macOS writes back when Peel forgets a preference domain, as described below. Its list
+made; the folder Remove Peel gathers its own files in, once they are back out of it because its move was refused; and
+the empty settings file macOS writes back when Peel forgets a preference domain, as described below. Its list
of refusals, with any copy of it set aside because it couldn't be read, goes to the Trash when
`peel history --refused --clear` is asked to forget it, after a question.