Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Say that a CocoaPods clone of another repository may be your own
Țugui Dragoșe7cc08887617
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swiftindex ca5c802c..2928eeb7 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift@@ -385,8 +385,8 @@ struct CachesCommand: AsyncParsableCommand {/// the two must never disagree.static func reason(for location: DeveloperEnvironment.Location) -> String? {if isKeptByDefault(location.kind) { return "kept by default" }- if !location.isTheTools { return "nothing shows the tool made it" }if let heldBack = location.heldBack { return heldBack.summary }+ if !location.isTheTools { return "nothing shows the tool made it" }if let workspace = location.workspace, workspace.mayStillBeInUse {return workspace.lastUsed == nil? "Xcode wrote no date for its workspace" : "its workspace was opened in the last 7 days"diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swiftindex fd0c6f0f..1c533038 100644--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift@@ -69,7 +69,8 @@ public struct DeveloperEnvironment: Sendable, Hashable, Identifiable {public var isTheTools = true/// The newest write inside, from the walk that measured it. It is shown and never decides what is selected.public var lastWritten: Date?- /// A wallet, a signing key, or a password database seen inside. Never a repository: the tool clones it again.+ /// A wallet, a signing key, or a password database seen inside, a clone of another repository than the one+ /// its tool names, or a write in the last minutes where a program may still use it.public var heldBack: HoldBack?public var id: URL { url }@@ -1623,6 +1624,8 @@ public enum DeveloperCaches {// app shares.let contents = await measure(url)let derived = folder.rowsAreDerivedData ? Self.derivedDataRow(at: url) : nil+ let isTheTools = derived?.isXcodes ?? folder.isTheTools(at: url)+ let holdsAnotherRepository = folder.clonedFrom != nil && !isTheTools && contents?.holdsRepository == truelocations.append(DeveloperEnvironment.Location(url: url,kind: folder.kind(at: url),@@ -1633,9 +1636,10 @@ public enum DeveloperCaches {archive: folder.kind == .archives ? Self.archive(at: url) : nil,workspace: derived?.workspace,project: project,- isTheTools: derived?.isXcodes ?? folder.isTheTools(at: url),+ isTheTools: isTheTools,lastWritten: contents.flatMap { $0.couldNotBeRead ? nil : $0.newestChange },heldBack: contents.flatMap(HoldBack.secret(in:))+ ?? (holdsAnotherRepository ? .holdsRepository : nil)?? (folder.holdsBackRecentWrites && HoldBack.wasWrittenRecently(url, contents: contents)? .writtenRecently : nil)))diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swiftindex ab0cc7a5..abb7d2aa 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift@@ -1497,6 +1497,8 @@ struct DeveloperCachesTests {#expect(Set(byName.keys) == ["master", "cocoapods"])#expect(byName["master"]?.isRecommended == true)#expect(byName["cocoapods"]?.isRecommended == false)+ #expect(byName["master"]?.heldBack == nil)+ #expect(byName["cocoapods"]?.heldBack == .holdsRepository, "a clone of another repository may be the person's")}@Test func offersTheImagesTartKeepsAndNeverItsMachines() async throws {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swiftindex 77fe2cbf..5a3ffa4a 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift@@ -801,6 +801,7 @@ struct FileCommandTests {let tool = try environment("Rust", id: "rust", locations: [("Library/Caches/cargo", .cache), ("Library/Caches/wallet", .cache), ("Library/Caches/closed", .cache),("Library/Caches/other", .cache), ("Library/Caches/xcode", .buildData), ("Library/Models/llama", .models),+ ("Library/Caches/specs", .downloads),], in: directory)var locations = tool.locationslocations[1].heldBack = .holdsAWallet@@ -810,6 +811,8 @@ struct FileCommandTests {)locations[3].isTheTools = falselocations[4].workspace = DeveloperEnvironment.Workspace(name: "App", lastUsed: .now)+ locations[6].isTheTools = false+ locations[6].heldBack = .holdsRepositorylet held = DeveloperEnvironment(id: tool.id, name: tool.name, systemImage: tool.systemImage, appBundleIdentifiers: [], locations: locations)@@ -817,7 +820,7 @@ struct FileCommandTests {#expect(held.locations.map(CachesCommand.note(for:)) == ["suggested", "holds a wallet or a signing key, kept", "its permissions keep Peel out, kept","nothing shows the tool made it, kept", "its workspace was opened in the last 7 days, kept",- "kept by default",+ "kept by default", "holds a repository, kept",])#expect(held.locations.allSatisfy { ($0.isRecommended) == (CachesCommand.note(for: $0) == "suggested") })let json = try Output.jsonText(CachesCommand.records(for: [held]))@@ -826,7 +829,7 @@ struct FileCommandTests {#expect(written[0]["reason"] is NSNull && written[0]["heldBack"] is NSNull)#expect(written[1]["heldBack"] as? String == "holdsAWallet")#expect(written[1]["reason"] as? String == "holds a wallet or a signing key")- #expect(CachesCommand.staying(in: [held]).count == 5)+ #expect(CachesCommand.staying(in: [held]).count == 6)#expect(CachesCommand.staying(in: [held])[0].hasSuffix("wallet stays: holds a wallet or a signing key"))#expect(CachesCommand.notes(for: [held]) == ["Peel couldn't look inside \(Output.plain(Output.path(locations[2].url))), so something may be there that isn't listed.",