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.

Developer lists opencode's cache

Țugui Dragoș04a2ffd0e9fb
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index 1b2cef16..4ec41aee 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -684,6 +684,9 @@ public enum DeveloperCaches {
Folder(".local/state/nvim/lazy", .cache, source: "https://github.com/folke/lazy.nvim/blob/main/lua/lazy/core/config.lua#L220-L225"),
Folder(".local/state/nvim/logs", .logs, source: "https://github.com/neovim/neovim/blob/master/runtime/doc/starting.txt#L1409-L1410"),
]),
+ Definition(id: "opencode", name: "opencode", systemImage: "terminal", appBundleIdentifiers: [], folders: [
+ Folder(".cache/opencode", .cache, source: "https://github.com/anomalyco/opencode/blob/dev/packages/core/src/global.ts#L12"),
+ ]),
// Cloud tools
Definition(id: "gcloud", name: "Google Cloud CLI", systemImage: "cloud", appBundleIdentifiers: [], folders: [
Folder(".config/gcloud/logs", .logs, source: "https://docs.cloud.google.com/compute/docs/troubleshooting/general-tips"),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index a939f3b4..95b745ec 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -814,6 +814,18 @@ struct DeveloperCachesTests {
#expect(locations.map(\.url.lastPathComponent) == ["cache.ets"])
}
+ @Test func offersOpencodesCacheAndNeverItsData() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file(".cache/opencode/models.json", bytes: 400_000)
+ try directory.file(".local/share/opencode/storage/session.json", bytes: 400_000)
+ let opencode = DeveloperCaches.definitions.filter { $0.id == "opencode" }
+
+ let locations = await DeveloperCaches.scan(opencode, homeDirectory: directory.url).flatMap(\.locations)
+
+ #expect(locations.map(\.url.lastPathComponent) == ["opencode"])
+ #expect(locations.first?.kind == .cache)
+ }
+
/// virtualenvwrapper keeps the user's hook scripts beside the environments in `~/.virtualenvs`, so only the
/// environments are offered, and a link among them is left where it is, never followed.
@Test func offersVirtualenvwrappersEnvironmentsAndNotItsHooks() async throws {