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
Compare apps Homebrew didn't install with its catalog
Țugui Dragoș7a4eeab57063
diff --git a/GUIDE.md b/GUIDE.mdindex cc61044d..718c6c79 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -79,20 +79,24 @@ and how to get it, [SAFETY.md](SAFETY.md) what it protects, [PRIVACY.md](PRIVACY- **What it opens.** An app's page lists the kinds of files and links it opens by default, and what would openthem once it's gone. Peel never changes that itself.- **Updates for your apps.** Peel checks your apps for new versions, through the update feed each app names, the App- Store for apps bought there, iPhone and iPad apps on the Mac included, or Homebrew for apps it installed, in the order- Prefer updates from in Settings > General sets, and shows what is new in the version that waits, as the app's own- notes say it, even with no connection. Apps that came with macOS are left to Software Update, and apps from Setapp to- Setapp, which keep them current. What Homebrew says counts for a day after it last checked for new versions, the time- Homebrew itself waits before it checks again. Past that, an app only Homebrew can answer for reads Can't check for- updates until Homebrew checks again, with Update Homebrew on the Homebrew page or `brew update` in Terminal, and Peel- reads Homebrew again once it has. Homebrew can't say at all for a cask that installs whatever is newest each time,- nor, when its settings leave apps that update themselves to their own updates, for such an app, so those read Can't- check for updates too, unless the app names a feed. Peel asks about each app again on a schedule of its own, less- often while nothing changes, and when it opens, about every app it last asked a day ago or more. Rescan in- Applications asks about every app again at once. Skip This Version and Never Check This App keep it quiet about the- ones you want left alone, and Settings > General lists them under Muted Updates, where Check Again brings their- updates back. Turning off Check for app updates there stops the checks, and after a week an app's Up to date, which- Peel then no longer renews, says the day it was found.+ Store for apps bought there, iPhone and iPad apps on the Mac included, or Homebrew, for apps it installed and, through+ the catalog of casks it keeps on this Mac, for apps whose bundle a cask names, in the order Prefer updates from in+ Settings > General sets, and shows what is new in the version that waits, as the app's own notes say it, even with no+ connection. Apps that came with macOS are left to Software Update, and apps from Setapp to Setapp, which keep them+ current. For an app Homebrew didn't install, never one from the App Store, its catalog answers last, after the app's+ own feed, and counts an update only when its version is written with as many numbers as the app's and they are higher,+ and since Homebrew can't upgrade that copy, the app's page says to update it from inside the app or from its homepage.+ What Homebrew says counts for a day after it last checked for new versions, the time Homebrew itself waits before it+ checks again. Past that, an app only Homebrew can answer for reads Can't check for updates until Homebrew checks+ again, with Update Homebrew on the Homebrew page or `brew update` in Terminal, and Peel reads Homebrew again once it+ has. Homebrew can't say at all for a cask that installs whatever is newest each time, nor, when its settings leave+ apps that update themselves to their own updates, for such an app it installed, so those read Can't check for updates+ too, unless the app names a feed. Peel asks about each app again on a schedule of its own, less often while nothing+ changes, and when it opens, about every app it last asked a day ago or more. Rescan in Applications asks about every+ app again at once. Skip This Version and Never Check This App keep it quiet about the ones you want left alone, and+ Settings > General lists them under Muted Updates, where Check Again brings their updates back. Turning off Check for+ app updates there stops the checks, and after a week an app's Up to date, which Peel then no longer renews, says the+ day it was found.## Free up disk spacediff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 2932b596..535b6b5f 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -23271,108 +23271,108 @@}}},- "Automatic asks Homebrew first about an app Homebrew installed, then the app’s own feed or the App Store. Any other choice puts the source you prefer first, then the app’s own feed, then Homebrew for an app it installed." : {+ "Automatic asks Homebrew first about an app Homebrew installed, then the app’s own feed or the App Store. Any other choice puts the source you prefer first, then the app’s own feed, then Homebrew for an app it installed. Homebrew’s catalog answers last, for an app Homebrew didn’t install." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Volba Automaticky se u aplikace nainstalované přes Homebrew ptá nejprve Homebrew, potom vlastního kanálu aplikace nebo App Storu. Jakákoli jiná volba řadí na první místo zdroj, kterému dáváte přednost, potom vlastní kanál aplikace a nakonec Homebrew u aplikace, kterou nainstaloval."+ "value" : "Volba Automaticky se u aplikace nainstalované přes Homebrew ptá nejprve Homebrew, potom vlastního kanálu aplikace nebo App Storu. Jakákoli jiná volba řadí na první místo zdroj, kterému dáváte přednost, potom vlastní kanál aplikace a nakonec Homebrew u aplikace, kterou nainstaloval. U aplikace, kterou Homebrew nenainstaloval, odpovídá jako poslední katalog Homebrew."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "„Automatisch“ fragt bei einer von Homebrew installierten App zuerst Homebrew, dann den eigenen Feed der App oder den App Store. Bei jeder anderen Option kommt zuerst die bevorzugte Quelle, dann der eigene Feed der App und bei einer von Homebrew installierten App zuletzt Homebrew."+ "value" : "„Automatisch“ fragt bei einer von Homebrew installierten App zuerst Homebrew, dann den eigenen Feed der App oder den App Store. Bei jeder anderen Option kommt zuerst die bevorzugte Quelle, dann der eigene Feed der App und danach, bei einer von Homebrew installierten App, Homebrew. Bei einer App, die Homebrew nicht installiert hat, antwortet zuletzt der Katalog von Homebrew."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "La opción Automático pregunta primero a Homebrew por una app instalada con Homebrew, y después al canal de la propia app o a App Store. Cualquier otra opción pone primero el origen que prefieres, después el canal de la propia app y luego Homebrew en el caso de una app instalada con él."+ "value" : "La opción Automático pregunta primero a Homebrew por una app instalada con Homebrew, y después al canal de la propia app o a App Store. Cualquier otra opción pone primero el origen que prefieres, después el canal de la propia app y luego Homebrew en el caso de una app instalada con él. El catálogo de Homebrew responde en último lugar, en el caso de una app que no se instaló con Homebrew."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "« Automatique » interroge d’abord Homebrew pour une app installée par Homebrew, puis le flux propre à l’app ou l’App Store. Tout autre choix place en premier la source que vous préférez, puis le flux propre à l’app, puis Homebrew pour une app qu’il a installée."+ "value" : "« Automatique » interroge d’abord Homebrew pour une app installée par Homebrew, puis le flux propre à l’app ou l’App Store. Tout autre choix place en premier la source que vous préférez, puis le flux propre à l’app, puis Homebrew pour une app qu’il a installée. Le catalogue de Homebrew répond en dernier, pour une app que Homebrew n’a pas installée."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "“Automatico” chiede prima a Homebrew di un’app installata da Homebrew, poi al feed dell’app o ad App Store. Qualsiasi altra scelta mette al primo posto la fonte che preferisci, poi il feed dell’app, poi Homebrew per un’app installata da Homebrew."+ "value" : "“Automatico” chiede prima a Homebrew di un’app installata da Homebrew, poi al feed dell’app o ad App Store. Qualsiasi altra scelta mette al primo posto la fonte che preferisci, poi il feed dell’app, poi Homebrew per un’app installata da Homebrew. Il catalogo di Homebrew risponde per ultimo, per un’app non installata da Homebrew."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "“自動”では、Homebrewでインストールしたアプリについては最初にHomebrewに問い合わせ、次にアプリ独自のフィードまたはApp Storeに問い合わせます。それ以外の選択肢では、優先するアップデート元、アプリ独自のフィードの順に問い合わせ、Homebrewでインストールしたアプリについては最後にHomebrewに問い合わせます。"+ "value" : "“自動”では、Homebrewでインストールしたアプリについては最初にHomebrewに問い合わせ、次にアプリ独自のフィードまたはApp Storeに問い合わせます。それ以外の選択肢では、優先するアップデート元、アプリ独自のフィードの順に問い合わせ、Homebrewでインストールしたアプリについては最後にHomebrewに問い合わせます。Homebrewでインストールしていないアプリについては、最後にHomebrewのカタログを確認します。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "‘자동’은 Homebrew가 설치한 앱에 대해 먼저 Homebrew에 묻고, 그다음 앱 자체 피드나 App Store에 묻습니다. 다른 항목을 선택하면 선호하는 출처에 먼저 묻고, 그다음 앱 자체 피드에, 그다음 Homebrew가 설치한 앱에 대해서는 Homebrew에 묻습니다."+ "value" : "‘자동’은 Homebrew가 설치한 앱에 대해 먼저 Homebrew에 묻고, 그다음 앱 자체 피드나 App Store에 묻습니다. 다른 항목을 선택하면 선호하는 출처에 먼저 묻고, 그다음 앱 자체 피드에, 그다음 Homebrew가 설치한 앱에 대해서는 Homebrew에 묻습니다. Homebrew가 설치하지 않은 앱에 대해서는 Homebrew 카탈로그가 마지막으로 응답합니다."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "'Automatisch' vraagt bij een app die Homebrew heeft geïnstalleerd eerst Homebrew, en daarna de eigen feed van de app of de App Store. Bij elke andere keuze komt eerst de bron van je voorkeur, daarna de eigen feed van de app en dan Homebrew bij een app die ermee is geïnstalleerd."+ "value" : "'Automatisch' vraagt bij een app die Homebrew heeft geïnstalleerd eerst Homebrew, en daarna de eigen feed van de app of de App Store. Bij elke andere keuze komt eerst de bron van je voorkeur, daarna de eigen feed van de app en dan Homebrew bij een app die ermee is geïnstalleerd. De catalogus van Homebrew komt als laatste aan bod, bij een app die Homebrew niet heeft geïnstalleerd."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Opcja Automatycznie najpierw pyta Homebrew o aplikację zainstalowaną przez Homebrew, a potem kanał aplikacji lub App Store. Każda inna opcja stawia na pierwszym miejscu preferowane źródło, potem kanał aplikacji, a potem Homebrew w przypadku aplikacji, którą zainstalował."+ "value" : "Opcja Automatycznie najpierw pyta Homebrew o aplikację zainstalowaną przez Homebrew, a potem kanał aplikacji lub App Store. Każda inna opcja stawia na pierwszym miejscu preferowane źródło, potem kanał aplikacji, a potem Homebrew w przypadku aplikacji, którą zainstalował. W przypadku aplikacji, której Homebrew nie zainstalował, na końcu odpowiada katalog Homebrew."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "A opção Automático pergunta primeiro ao Homebrew sobre um app que o Homebrew instalou, depois ao feed do próprio app ou à App Store. Qualquer outra opção coloca primeiro a fonte que você prefere, depois o feed do próprio app e depois o Homebrew no caso de um app que ele instalou."+ "value" : "A opção Automático pergunta primeiro ao Homebrew sobre um app que o Homebrew instalou, depois ao feed do próprio app ou à App Store. Qualquer outra opção coloca primeiro a fonte que você prefere, depois o feed do próprio app e depois o Homebrew no caso de um app que ele instalou. O catálogo do Homebrew responde por último, no caso de um app que o Homebrew não instalou."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Opțiunea „Automat” întreabă mai întâi Homebrew despre o aplicație instalată de Homebrew, apoi fluxul propriu al aplicației sau App Store. Orice altă opțiune pune sursa preferată pe primul loc, apoi fluxul propriu al aplicației, apoi Homebrew pentru o aplicație instalată de acesta."+ "value" : "Opțiunea „Automat” întreabă mai întâi Homebrew despre o aplicație instalată de Homebrew, apoi fluxul propriu al aplicației sau App Store. Orice altă opțiune pune sursa preferată pe primul loc, apoi fluxul propriu al aplicației, apoi Homebrew pentru o aplicație instalată de acesta. Catalogul Homebrew răspunde ultimul, pentru o aplicație pe care Homebrew nu a instalat‑o."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "В режиме «Автоматически» Peel сначала спрашивает Homebrew о приложениях, установленных через Homebrew, а затем ленту самого приложения или App Store. При выборе любого другого варианта Peel сначала спрашивает предпочитаемый источник, затем ленту самого приложения, а затем Homebrew о приложениях, установленных через него."+ "value" : "В режиме «Автоматически» Peel сначала спрашивает Homebrew о приложениях, установленных через Homebrew, а затем ленту самого приложения или App Store. При выборе любого другого варианта Peel сначала спрашивает предпочитаемый источник, затем ленту самого приложения, а затем Homebrew о приложениях, установленных через него. В последнюю очередь Peel спрашивает каталог Homebrew о приложениях, которые установил не Homebrew."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Med Automatiskt tillfrågas först Homebrew om en app som Homebrew har installerat, och därefter appens eget flöde eller App Store. Med alla andra val kommer källan du föredrar först, därefter appens eget flöde och sist Homebrew för en app som Homebrew har installerat."+ "value" : "Med Automatiskt tillfrågas först Homebrew om en app som Homebrew har installerat, och därefter appens eget flöde eller App Store. Med alla andra val kommer källan du föredrar först, därefter appens eget flöde och sedan Homebrew för en app som Homebrew har installerat. Homebrews katalog svarar sist, för en app som Homebrew inte har installerat."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Otomatik, Homebrew’un yüklediği bir uygulama için önce Homebrew’a, sonra uygulamanın kendi akışına veya App Store’a sorar. Diğer seçenekler ise tercih ettiğiniz kaynağı ilk sıraya koyar; ardından uygulamanın kendi akışı, sonra da Homebrew’un yüklediği bir uygulama için Homebrew gelir."+ "value" : "Otomatik, Homebrew’un yüklediği bir uygulama için önce Homebrew’a, sonra uygulamanın kendi akışına veya App Store’a sorar. Diğer seçenekler ise tercih ettiğiniz kaynağı ilk sıraya koyar; ardından uygulamanın kendi akışı, sonra da Homebrew’un yüklediği bir uygulama için Homebrew gelir. Homebrew’un yüklemediği bir uygulama için en son Homebrew’un kataloğu yanıt verir."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "«Автоматично» спершу запитує Homebrew про програму, яку інсталював Homebrew, а потім власну стрічку програми або App Store. Будь-який інший варіант ставить на перше місце вибране вами джерело, потім власну стрічку програми, а потім Homebrew для програми, яку він інсталював."+ "value" : "«Автоматично» спершу запитує Homebrew про програму, яку інсталював Homebrew, а потім власну стрічку програми або App Store. Будь-який інший варіант ставить на перше місце вибране вами джерело, потім власну стрічку програми, а потім Homebrew для програми, яку він інсталював. Для програми, яку Homebrew не інсталював, останнім відповідає каталог Homebrew."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "选择“自动”时,对于由Homebrew安装的App,会先询问Homebrew,然后询问App自己的更新源或App Store。选择其他选项时,会先询问你首选的来源,然后询问App自己的更新源,对于由Homebrew安装的App,最后询问Homebrew。"+ "value" : "选择“自动”时,对于由Homebrew安装的App,会先询问Homebrew,然后询问App自己的更新源或App Store。选择其他选项时,会先询问你首选的来源,然后询问App自己的更新源,对于由Homebrew安装的App,最后询问Homebrew。对于并非由Homebrew安装的App,最后询问的是Homebrew的软件目录。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "「自動」會先向Homebrew查詢由Homebrew安裝的App,再查詢App自己的Feed或App Store。其他選項則會先查詢你偏好的來源,再查詢App自己的Feed,最後才向Homebrew查詢由它安裝的App。"+ "value" : "「自動」會先向Homebrew查詢由Homebrew安裝的App,再查詢App自己的Feed或App Store。其他選項則會先查詢你偏好的來源,再查詢App自己的Feed,然後向Homebrew查詢由它安裝的App。至於並非由Homebrew安裝的App,最後才會查詢Homebrew的目錄。"}}}@@ -66211,6 +66211,112 @@}}},+ "Homebrew’s catalog has it, but Homebrew didn’t install this copy. Update from inside the app or from its homepage." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aktualizaci nabízí katalog Homebrew, ale tuto kopii Homebrew nenainstaloval. Aktualizujte přímo v aplikaci nebo z její domovské stránky."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Das Update steht im Katalog von Homebrew, aber Homebrew hat diese Kopie nicht installiert. Aktualisiere direkt in der App oder über ihre Homepage."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "El catálogo de Homebrew incluye esta versión, pero esta copia no se instaló con Homebrew. Actualízala desde la propia app o desde su página web."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Le catalogue de Homebrew la propose, mais Homebrew n’a pas installé cette copie. Mettez à jour depuis l’app elle-même ou depuis sa page d’accueil."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "L’aggiornamento è disponibile nel catalogo di Homebrew, ma Homebrew non ha installato questa copia. Aggiorna dall’interno dell’app o dal suo sito web."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "アップデートはHomebrewのカタログにありますが、このコピーはHomebrewでインストールされたものではありません。アプリ内から、またはアプリのホームページからアップデートしてください。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Homebrew 카탈로그에 업데이트가 있지만, 이 복사본은 Homebrew가 설치하지 않았습니다. 앱 안에서 또는 앱의 홈페이지에서 업데이트하십시오."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Deze update staat in de catalogus van Homebrew, maar Homebrew heeft deze kopie niet geïnstalleerd. Werk bij vanuit de app zelf of via de homepage ervan."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Uaktualnienie jest dostępne w katalogu Homebrew, ale Homebrew nie zainstalował tej kopii. Uaktualnij aplikację z jej poziomu lub z jej strony domowej."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O catálogo do Homebrew tem a atualização, mas não foi o Homebrew que instalou esta cópia. Atualize pelo próprio app ou pelo site dele."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Catalogul Homebrew o oferă, dar Homebrew nu a instalat această copie. Actualizați chiar din aplicație sau de pe site‑ul ei web."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Обновление есть в каталоге Homebrew, но эту копию установил не Homebrew. Установите его из самого приложения или с домашней страницы приложения."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Homebrews katalog har den, men Homebrew har inte installerat den här kopian. Uppdatera inifrån appen eller från dess hemsida."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Homebrew’un kataloğunda bu sürüm var, ancak bu kopyayı Homebrew yüklemedi. Uygulamanın içinden veya web sitesinden güncelleyin."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Оновлення є в каталозі Homebrew, але цю копію Homebrew не інсталював. Оновіть програму засобами самої програми або з її домашньої сторінки."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Homebrew的软件目录中有此更新,但此副本并非由Homebrew安装。请在App内或通过其主页更新。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Homebrew的目錄中有此更新,但這份副本並非由Homebrew安裝。請從App內或從其首頁更新。"+ }+ }+ }+ },"Homebrew’s own housekeeping, run by Homebrew. Peel adds nothing of its own." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swiftindex 9dfd0736..c3409644 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift@@ -192,7 +192,7 @@ struct LeftoversCommand: AsyncParsableCommand {let target = try AppLookup.app(matching: app, in: apps)let exclusions = await ExclusionStore().load()try AppLookup.refuseIfExcluded(target, by: exclusions)- let homebrew = await CaskLookup.evidence(for: target)+ let homebrew = await CaskLookup.evidence(for: [target])let uninstallation = await ProgressLine.counting {await Uninstallation.prepare(target,@@ -667,7 +667,7 @@ struct UninstallCommand: AsyncParsableCommand {let excluded = try Self.note(for: AppLookup.refusal(of: target, by: exclusions), dryRun: dryRun)let service = TrashService(exclusions: exclusions)let running = try Self.note(for: await Self.whileRunning(target, among: apps), dryRun: dryRun)- let homebrew = await CaskLookup.evidence(for: target)+ let homebrew = await CaskLookup.evidence(for: [target])let uninstallation = await ProgressLine.counting {await Uninstallation.prepare(target,@@ -934,8 +934,8 @@ struct UpdatesCommand: AsyncParsableCommand {let apps = catalog.apps// The Peel app's own update settings, so `peel` and the app agree on which updates are waiting.let preferences = UpdatePreferences.asTheAppSeesThem()- let homebrew = await CaskLookup.installed()let toCheck = apps.filter { !preferences.isIgnored($0) }+ let homebrew = await CaskLookup.evidence(for: toCheck)let checker = UpdateChecker()let statuses = await ProgressLine.reporting { show inawait Self.statuses(@@ -988,7 +988,7 @@ struct UpdatesCommand: AsyncParsableCommand {var notes = [note(aboutCasksNotCheckedRecently: casks(.notCheckedRecently), timeZone: timeZone)]let newest = casks(.installsTheNewest).countif newest > 0 {- notes.append("\(Output.count(newest, "app", "apps")) Homebrew installed \(newest == 1 ? "gets" : "get") whatever is newest each time, so Homebrew has no version to compare, and whether \(newest == 1 ? "it is" : "they are") up to date isn't known.")+ notes.append("Homebrew's \(newest == 1 ? "cask" : "casks") of \(Output.count(newest, "app", "apps")) \(newest == 1 ? "installs" : "install") whatever is newest each time, so Homebrew has no version to compare, and whether \(newest == 1 ? "it is" : "they are") up to date isn't known.")}let left = casks(.leftToTheApp).countif left > 0 {@@ -996,14 +996,14 @@ struct UpdatesCommand: AsyncParsableCommand {}let disabled = casks(.disabled).countif disabled > 0 {- notes.append("Homebrew no longer upgrades \(Output.count(disabled, "app", "apps")) it installed, since it has disabled \(disabled == 1 ? "its cask" : "their casks"), so whether \(disabled == 1 ? "it is" : "they are") up to date isn't known.")+ notes.append("Homebrew has disabled the \(disabled == 1 ? "cask" : "casks") of \(Output.count(disabled, "app", "apps")), so whether \(disabled == 1 ? "it is" : "they are") up to date isn't known.")}return notes.compactMap(\.self)}private static func note(aboutCasksNotCheckedRecently casks: [HomebrewPackage], timeZone: TimeZone) -> String? {guard !casks.isEmpty else { return nil }- let apps = "\(Output.count(casks.count, "app", "apps")) it installed \(casks.count == 1 ? "is" : "are")"+ let apps = "\(Output.count(casks.count, "app", "apps")) only Homebrew can answer for \(casks.count == 1 ? "is" : "are")"guard let checked = casks.compactMap(\.lastUpdateCheck).max() else {return "Homebrew doesn't say when it last checked for new versions, so whether \(apps) up to date isn't known."}diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/CaskLookup.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/CaskLookup.swiftindex beb5aecd..3ee05b6e 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/CaskLookup.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/CaskLookup.swift@@ -18,15 +18,15 @@ enum CaskLookup {}}- /// Returns the casks and installer receipts that are evidence for `app`. Homebrew is asked about casks only- /// when it has a local copy of its definitions: otherwise it would download them, and looking up an app's- /// leftovers is no reason to go online.- static func evidence(for app: InstalledApp) async -> Answer {+ /// Returns the casks and installer receipts that are evidence for `apps`: the casks Homebrew installed, and those+ /// its catalog lists for the rest. Homebrew is asked about casks only when it has a local copy of its definitions:+ /// otherwise it would download them, and looking up an app's leftovers or updates is no reason to go online.+ static func evidence(for apps: [InstalledApp]) async -> Answer {let receipts = await PackageReceipts.identifiers()// Receipts are evidence on their own, so they are returned even when Homebrew isn't asked.guard await Homebrew.hasLocalDefinitions() else { return Answer(receipts: receipts) }async let installed = Homebrew.installedPackages()- let known = await CaskEvidence.knownCasks(for: [app], receipts: receipts)+ let known = await CaskEvidence.knownCasks(for: apps, receipts: receipts)do {return Answer(casks: CaskEvidence.combined(installed: try await installed, known: known),@@ -41,17 +41,6 @@ enum CaskLookup {}}- /// Returns the casks Homebrew installed, for the update check. A cask Homebrew only has a definition for says- /// nothing about which version is installed.- static func installed() async -> Answer {- guard await Homebrew.hasLocalDefinitions() else { return Answer() }- do {- return Answer(casks: try await Homebrew.installedPackages())- } catch {- return Answer(failure: why(error))- }- }-/// Returns how Homebrew failed. It takes `any Error` because a typed `throws(Homebrew.CommandFailure)` arrives/// as `any Error` through `async let`.private static func why(_ error: any Error) -> Homebrew.CommandFailure {diff --git a/Packages/PeelCore/Sources/PeelCore/Homebrew/CaskEvidence.swift b/Packages/PeelCore/Sources/PeelCore/Homebrew/CaskEvidence.swiftindex c7483c0c..ad76946b 100644--- a/Packages/PeelCore/Sources/PeelCore/Homebrew/CaskEvidence.swift+++ b/Packages/PeelCore/Sources/PeelCore/Homebrew/CaskEvidence.swift@@ -130,10 +130,14 @@ public struct CaskEvidence: Sendable, Hashable {/// Returns the casks that describe `apps`, including apps Homebrew did not install. A cask lists what its/// app leaves behind, even a folder named nothing like the app, which name matching cannot find. Only/// Homebrew's local copy of its definitions is read, so nothing goes over the network, and no cask is- /// asked about when Homebrew or that copy is missing.+ /// asked about when Homebrew or that copy is missing. Each carries Homebrew's last check for new versions, which+ /// the version it lists is no more recent than.@concurrentpublic static func knownCasks(for apps: [InstalledApp], receipts: Set<String> = []) async -> [HomebrewPackage] {- guard !apps.isEmpty, await Homebrew.hasLocalDefinitions() else { return [] }+ let answers = Homebrew.Answers()+ guard !apps.isEmpty, await Homebrew.hasLocalDefinitions(asking: answers) else { return [] }+ // Read first, so a check made while the casks are read leaves them dated older than they are, never newer.+ let checked = await Homebrew.lastUpdateCheck(asking: answers)let known = await Homebrew.caskTokens()guard !known.isEmpty else { return [] }@@ -145,7 +149,9 @@ public struct CaskEvidence: Sendable, Hashable {}}- let found = await Homebrew.casks(named: wanted).map { $0.noting(receipts: receipts) }+ let found = await Homebrew.casks(named: wanted).map {+ $0.noting(receipts: receipts).noting(lastUpdateCheck: checked)+ }return found.filter { cask in apps.contains { proves(cask, isThe: $0) } }}diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateChecker.swift b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateChecker.swiftindex 03179f49..13373997 100644--- a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateChecker.swift+++ b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateChecker.swift@@ -91,7 +91,7 @@ public struct UpdateChecker: Sendable {earlier: UpdateStatus? = nil,notListedBefore: Bool = false) async -> UpdateAnswer {- let homebrew = homebrewStatus(for: app, casks: casks)+ let homebrew = homebrewAnswer(for: app, casks: casks)if let status = Self.statusWithoutAsking(for: app, preference: preference, homebrew: homebrew) {return UpdateAnswer(status: status)}@@ -102,9 +102,9 @@ public struct UpdateChecker: Sendable {: await feedAnswer(for: app, earlier: earlier, notListedBefore: notListedBefore)guard !own.wasOffline else { return own }// A feed can be down, and the App Store may not sell the app here: what Homebrew knows is used then.- if let homebrew, own.status == .unsupported || own.status == .failed {+ if let status = homebrew.status, own.status == .unsupported || own.status == .failed {return UpdateAnswer(- status: homebrew, developer: own.developer, standsInFor: own.status,+ status: status, developer: own.developer, standsInFor: own.status,reachedNoServer: own.reachedNoServer, isNotListed: own.isNotListed)}@@ -116,27 +116,30 @@ public struct UpdateChecker: Sendable {public func statusWithoutAsking(for app: InstalledApp, preference: UpdateSource, casks: [HomebrewPackage], known: UpdateStatus? = nil) -> UpdateStatus? {- let homebrew = homebrewStatus(for: app, casks: casks)+ let homebrew = homebrewAnswer(for: app, casks: casks)if let status = Self.statusWithoutAsking(for: app, preference: preference, homebrew: homebrew) {return status}- return known == .unsupported || known == .failed ? homebrew ?? known : nil+ return known == .unsupported || known == .failed ? homebrew.status ?? known : nil}+ /// What Homebrew's catalog says comes after the app's own source, whatever is preferred: Homebrew can't upgrade a+ /// copy it didn't install, and the app's own updater is what that copy follows.private static func statusWithoutAsking(- for app: InstalledApp, preference: UpdateSource, homebrew: UpdateStatus?+ for app: InstalledApp, preference: UpdateSource, homebrew: (status: UpdateStatus?, isFromTheCatalog: Bool)) -> UpdateStatus? {let asksNobody = asksNobody(about: app, preference: preference)+ let first = homebrew.isFromTheCatalog ? nil : homebrew.statusswitch preference {case .homebrew:- // A cask Homebrew knows but never installed says nothing about this app's version, and neither does one- // Homebrew can't tell about, so the app's own feed answers then instead of a false "up to date".- return homebrew ?? (asksNobody ? .unsupported : nil)+ // Where Homebrew can't tell, from what it installed or from its catalog, the app's own feed answers instead+ // of a false "up to date".+ return first ?? (asksNobody ? homebrew.status ?? .unsupported : nil)case .automatic, .developer, .appStore:- if preference == .automatic, case .updateAvailable = homebrew { return homebrew }+ if preference == .automatic, case .updateAvailable = first { return first }// An app from a cask may have no feed of its own: what Homebrew knows is used rather than "Can't check// for updates".- return asksNobody ? homebrew ?? .unsupported : nil+ return asksNobody ? homebrew.status ?? .unsupported : nil}}@@ -151,13 +154,65 @@ public struct UpdateChecker: Sendable {UpdateSource.allCases.allSatisfy { asksNobody(about: app, preference: $0) }}- /// Homebrew's answer for `app`, found without a network request, or nil when Homebrew did not install this copy- /// or can't tell (`homebrewStatus(of:appVersion:at:)`). For a cask it did not install, Homebrew has a definition- /// but no installed version to compare.+ /// Homebrew's answer for `app`, found without a network request, or nil when it can't tell: for a copy Homebrew+ /// installed, from what it installed (`homebrewStatus(of:appVersion:at:)`), and for one it didn't, from the version+ /// its catalog lists (`catalogStatus(of:appVersion:at:)`).public func homebrewStatus(for app: InstalledApp, casks: [HomebrewPackage]) -> UpdateStatus? {- CaskEvidence.installedCask(for: app, in: casks).flatMap {- Self.homebrewStatus(of: $0, appVersion: app.version, at: clock())+ homebrewAnswer(for: app, casks: casks).status+ }++ private func homebrewAnswer(+ for app: InstalledApp, casks: [HomebrewPackage]+ ) -> (status: UpdateStatus?, isFromTheCatalog: Bool) {+ if let cask = CaskEvidence.installedCask(for: app, in: casks) {+ return (Self.homebrewStatus(of: cask, appVersion: app.version, at: clock()), false)+ }+ let status = Self.catalogCask(for: app, in: casks).flatMap {+ Self.catalogStatus(of: $0, appVersion: app.version, at: clock())+ }+ return (status, true)+ }++ /// The cask Homebrew's catalog lists for `app` when Homebrew didn't install this copy: one its bundle proves+ /// (`CaskEvidence.proves`). An app from the App Store or Setapp, or one that came with macOS, is kept current by+ /// them, in versions of their own, so the catalog says nothing of it.+ public static func catalogCask(for app: InstalledApp, in casks: [HomebrewPackage]) -> HomebrewPackage? {+ guard !app.isFromAppStore, !app.isFromSetapp, !app.isSystemProtected,+ CaskEvidence.installedCask(for: app, in: casks) == nil+ else { return nil }+ return CaskEvidence.cask(for: app, in: casks)+ }++ /// What the version `cask` lists says at `now` of a copy Homebrew didn't install, at `appVersion`: an update when+ /// it is written with as many numbers and they are past the app's, since a catalog never lists an older version+ /// than it did, and up to date only as `isAlready` reads it, within a day of Homebrew's last check. Otherwise nil.+ static func catalogStatus(of cask: HomebrewPackage, appVersion: String?, at now: Date) -> UpdateStatus? {+ guard let appVersion, VersionComparison.isAVersion(appVersion), let latest = cask.latestVersion,+ cask.isStillUpgraded, latest != "latest"+ else { return nil }+ if VersionComparison.hasNewerNumbers(UpdateStatus.shownVersion(of: latest), than: appVersion) {+ return .updateAvailable(version: latest, source: .homebrew, releaseNotes: cask.homepage)}+ return isAlready(appVersion, at: latest) && isRecent(cask.lastUpdateCheck, at: now) ? .upToDate : nil+ }++ /// Why the version `cask` lists can't say at `now` whether a copy Homebrew didn't install, at `appVersion`, is up+ /// to date, when a later check of Homebrew's could: the cask lists no version to compare or Homebrew disabled it,+ /// or Homebrew last checked for new versions too long ago. Homebrew's settings for apps that update themselves+ /// don't count, since they decide only what Homebrew upgrades.+ static func whyTheCatalogCannotTell(+ about cask: HomebrewPackage, appVersion: String?, at now: Date+ ) -> HomebrewCannotTell.Reason? {+ if !cask.isStillUpgraded { return .disabled }+ if cask.latestVersion == "latest" { return .installsTheNewest }+ guard let latest = cask.latestVersion, isAlready(appVersion, at: latest) else { return nil }+ return isRecent(cask.lastUpdateCheck, at: now) ? nil : .notCheckedRecently+ }++ /// Whether Homebrew last checked for new versions at `checked`, less than `Homebrew.autoUpdateInterval` before+ /// `now`.+ private static func isRecent(_ checked: Date?, at now: Date) -> Bool {+ checked.map { now.timeIntervalSince($0) < Homebrew.autoUpdateInterval } ?? false}/// The status Homebrew reports at `now` for `cask`, known to be the app's at `appVersion`, or nil when it can't@@ -174,10 +229,7 @@ public struct UpdateChecker: Sendable {/// it last checked for new versions longer ago than `Homebrew.autoUpdateInterval`, or when isn't known.static func whyHomebrewCannotTell(about cask: HomebrewPackage, at now: Date) -> HomebrewCannotTell.Reason? {if let reason = cask.whyHomebrewCannotCompare { return reason }- guard let checked = cask.lastUpdateCheck, now.timeIntervalSince(checked) < Homebrew.autoUpdateInterval else {- return .notCheckedRecently- }- return nil+ return isRecent(cask.lastUpdateCheck, at: now) ? nil : .notCheckedRecently}/// Whether the app's own `version` is already the cask's `latest`, or past it. Homebrew counts a cask outdated by@@ -215,16 +267,22 @@ public struct UpdateChecker: Sendable {checked.map { clock().timeIntervalSince($0) <= UpdateSchedule.longest } ?? false}- /// The cask `app` came from, and why Homebrew can't tell, when only Homebrew could say whether the app is up to- /// date and it has no answer (`homebrewStatus(of:appVersion:at:)`), so a check has none for the app.+ /// The cask `app` came from or its catalog lists, and why Homebrew can't tell, when only Homebrew could say whether+ /// the app is up to date and it has no answer (`homebrewStatus(for:casks:)`), so a check has none for the app.public func homebrewCannotTell(about app: InstalledApp, preference: UpdateSource, casks: [HomebrewPackage]) -> HomebrewCannotTell? {let now = clock()- guard Self.asksNobody(about: app, preference: preference),- let cask = CaskEvidence.installedCask(for: app, in: casks),- Self.homebrewStatus(of: cask, appVersion: app.version, at: now) == nil,- let reason = Self.whyHomebrewCannotTell(about: cask, at: now)+ guard Self.asksNobody(about: app, preference: preference) else { return nil }+ if let cask = CaskEvidence.installedCask(for: app, in: casks) {+ guard Self.homebrewStatus(of: cask, appVersion: app.version, at: now) == nil,+ let reason = Self.whyHomebrewCannotTell(about: cask, at: now)+ else { return nil }+ return HomebrewCannotTell(cask: cask, reason: reason)+ }+ guard let cask = Self.catalogCask(for: app, in: casks),+ Self.catalogStatus(of: cask, appVersion: app.version, at: now) == nil,+ let reason = Self.whyTheCatalogCannotTell(about: cask, appVersion: app.version, at: now)else { return nil }return HomebrewCannotTell(cask: cask, reason: reason)}diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/VersionComparison.swift b/Packages/PeelCore/Sources/PeelCore/Updates/VersionComparison.swiftindex 8987a747..6d9f728a 100644--- a/Packages/PeelCore/Sources/PeelCore/Updates/VersionComparison.swift+++ b/Packages/PeelCore/Sources/PeelCore/Updates/VersionComparison.swift@@ -10,17 +10,23 @@ enum VersionComparison {compare(candidate, installed) == .orderedDescending}+ /// True when `candidate` has as many numbers as `installed` and they are past its numbers. A version written with+ /// another number of them, such as one with a build added as a fourth, and what follows the numbers, a build or a+ /// word such as beta, are not compared, since makers write them in ways another source of versions doesn't follow.+ static func hasNewerNumbers(_ candidate: String, than installed: String) -> Bool {+ let candidate = components(of: candidate).numbers+ let installed = components(of: installed).numbers+ return candidate.count == installed.count && compare(numbers: candidate, installed) == .orderedDescending+ }+/// Compares dotted numeric versions. A version with a suffix ("1.2 beta") is older than the same version/// without one.static func compare(_ lhs: String, _ rhs: String) -> ComparisonResult {let left = components(of: lhs)let right = components(of: rhs)- for index in 0..<max(left.numbers.count, right.numbers.count) {- let a = index < left.numbers.count ? left.numbers[index] : 0- let b = index < right.numbers.count ? right.numbers[index] : 0- if a != b { return a < b ? .orderedAscending : .orderedDescending }- }+ let numbers = compare(numbers: left.numbers, right.numbers)+ guard numbers == .orderedSame else { return numbers }switch (left.suffix.isEmpty, right.suffix.isEmpty) {case (true, true): return .orderedSame@@ -30,6 +36,15 @@ enum VersionComparison {}}+ private static func compare(numbers left: [Int], _ right: [Int]) -> ComparisonResult {+ for index in 0..<max(left.count, right.count) {+ let a = index < left.count ? left[index] : 0+ let b = index < right.count ? right[index] : 0+ if a != b { return a < b ? .orderedAscending : .orderedDescending }+ }+ return .orderedSame+ }+private static func components(of version: String) -> (numbers: [Int], suffix: String) {var text = Substring(version.trimmingCharacters(in: .whitespaces))if text.first == "v" || text.first == "V" {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swiftindex ad4b5ddd..b48963f8 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift@@ -1309,7 +1309,7 @@ struct CommandLineTests {#expect(!some.nothingAnswered)}- @Test func saysWhyAppsHomebrewInstalledGotNoAnswer() {+ @Test func saysWhyAppsOnlyHomebrewCanAnswerForGotNoAnswer() {let cask = HomebrewPackage(name: "example", kind: .cask, installedVersion: "1.0")let checked = cask.noting(lastUpdateCheck: Date(timeIntervalSince1970: 1_792_315_250))let utc = TimeZone(identifier: "UTC")!@@ -1317,14 +1317,18 @@ struct CommandLineTests {let notChecked = { (cask: HomebrewPackage) in HomebrewCannotTell(cask: cask, reason: .notCheckedRecently) }#expect(UpdatesCommand.notes(about: [], timeZone: utc).isEmpty)- #expect(UpdatesCommand.notes(about: [notChecked(checked)], timeZone: utc) == ["Homebrew last checked for new versions on 2026-10-18, so whether 1 app it installed is up to date isn't known. Run `brew update`, then check again."])- #expect(UpdatesCommand.notes(about: [notChecked(cask), notChecked(cask)], timeZone: utc) == ["Homebrew doesn't say when it last checked for new versions, so whether 2 apps it installed are up to date isn't known."])+ #expect(UpdatesCommand.notes(about: [notChecked(checked)], timeZone: utc) == ["Homebrew last checked for new versions on 2026-10-18, so whether 1 app only Homebrew can answer for is up to date isn't known. Run `brew update`, then check again."])+ #expect(UpdatesCommand.notes(about: [notChecked(cask), notChecked(cask)], timeZone: utc) == ["Homebrew doesn't say when it last checked for new versions, so whether 2 apps only Homebrew can answer for are up to date isn't known."])let reasons: [HomebrewCannotTell.Reason] = [.installsTheNewest, .leftToTheApp, .leftToTheApp, .disabled]let others = reasons.map { HomebrewCannotTell(cask: cask, reason: $0) }#expect(UpdatesCommand.notes(about: others, timeZone: utc) == [- "1 app Homebrew installed gets whatever is newest each time, so Homebrew has no version to compare, and whether it is up to date isn't known.",+ "Homebrew's cask of 1 app installs whatever is newest each time, so Homebrew has no version to compare, and whether it is up to date isn't known.","Homebrew's settings leave 2 apps to update themselves (HOMEBREW_NO_UPGRADE_AUTO_UPDATES_CASKS), so Homebrew doesn't compare their versions, and whether they are up to date isn't known.",- "Homebrew no longer upgrades 1 app it installed, since it has disabled its cask, so whether it is up to date isn't known.",+ "Homebrew has disabled the cask of 1 app, so whether it is up to date isn't known.",+ ])+ let disabled = HomebrewCannotTell(cask: cask, reason: .disabled)+ #expect(UpdatesCommand.notes(about: [disabled, disabled], timeZone: utc) == [+ "Homebrew has disabled the casks of 2 apps, so whether they are up to date isn't known.",])}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/KnownCasksTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/KnownCasksTests.swiftindex 8111b8bb..fac359a5 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/KnownCasksTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/KnownCasksTests.swift@@ -286,8 +286,9 @@ struct KnownCasksTests {}/// Reads Homebrew's local copy of the cask definitions and finds nothing without Homebrew. The result- /// depends on the machine running the test, so only its shape is checked: casks only, and no guessed token- /// Homebrew does not know. That nothing is downloaded rests on `hasLocalDefinitions`, which a test cannot see.+ /// depends on the machine running the test, so only its shape is checked: casks only, no guessed token+ /// Homebrew does not know, and each dated by Homebrew's last check. That nothing is downloaded rests on+ /// `hasLocalDefinitions`, which a test cannot see.@Test func readsOnlyCasksHomebrewKnowsOnThisMac() async {let apps = [app("Visual Studio Code", "com.microsoft.VSCode"),@@ -301,5 +302,7 @@ struct KnownCasksTests {}#expect(found.allSatisfy { $0.kind == .cask })#expect(!found.contains { $0.name == "definitely-not-a-real-app" })+ let checked = await Homebrew.lastUpdateCheck()+ #expect(found.allSatisfy { $0.lastUpdateCheck == checked })}}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UpdateCheckerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UpdateCheckerTests.swiftindex 5f6f3e9d..84f7e189 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/UpdateCheckerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/UpdateCheckerTests.swift@@ -471,6 +471,55 @@ private final class DroppedProtocol: URLProtocol, @unchecked Sendable {#expect(recent.homebrewCannotTell(about: feedlessApp, preference: .automatic, casks: [compared]) == nil)}+ @Test func answersFromTheCatalogAboutACopyHomebrewDidNotInstall() async {+ let recent = checking(at: homebrewChecked + 60 * 60)+ let later = checking(at: homebrewChecked + 2 * Homebrew.autoUpdateInterval)+ let checked = homebrewChecked+ func listed(_ latest: String, _ settings: Homebrew.Overrides = []) -> [HomebrewPackage] {+ [+ HomebrewPackage(+ name: "example", kind: .cask, latestVersion: latest, appNames: ["Example.app"],+ appUpdatesItself: true+ ).noting(lastUpdateCheck: checked).noting(settings),+ ]+ }+ let update = UpdateStatus.updateAvailable(version: "2.0", source: .homebrew, releaseNotes: nil)+ reply("nowhere.example.com", "")++ #expect(recent.statusWithoutAsking(for: feedlessApp, preference: .automatic, casks: listed("2.0")) == update)+ #expect(recent.statusWithoutAsking(for: feedlessApp, preference: .automatic, casks: listed("1.0")) == .upToDate)+ #expect(later.statusWithoutAsking(for: feedlessApp, preference: .automatic, casks: listed("1.0")) == .unsupported)+ #expect(await recent.status(for: feedlessApp, preference: .homebrew, casks: listed("1.0")) == .upToDate)+ let leftToTheApp = listed("1.0", [.leavesAppsThatUpdateThemselves])+ #expect(+ recent.statusWithoutAsking(for: feedlessApp, preference: .automatic, casks: leftToTheApp) == .upToDate,+ "Homebrew's settings decide only what it upgrades"+ )+ for preference in UpdateSource.allCases {+ let decided = { (known: UpdateStatus?) in+ recent.statusWithoutAsking(for: fedApp, preference: preference, casks: listed("2.0"), known: known)+ }+ #expect(decided(nil) == nil)+ #expect(decided(.failed) == update)+ }+ #expect(CannedProtocol.asked.withLock { $0 }.isEmpty)++ reply("feed.example.com", appcast("<item><enclosure url=\"https://feed.example.com/a.zip\" sparkle:version=\"100\" sparkle:shortVersionString=\"1.0\" /></item>"))+ #expect(await recent.status(for: fedApp, preference: .automatic, casks: listed("2.0")) == .upToDate, "its feed")+ reply("feed.example.com", status: 500, "")+ let answer = await recent.answer(for: fedApp, preference: .automatic, casks: listed("2.0"))+ #expect(answer.status == update)+ #expect(answer.standsInFor == .failed)++ let cannotTell = { (checker: UpdateChecker, casks: [HomebrewPackage]) in+ checker.homebrewCannotTell(about: feedlessApp, preference: .automatic, casks: casks)?.reason+ }+ #expect(cannotTell(later, listed("1.0")) == .notCheckedRecently)+ #expect(cannotTell(recent, listed("latest")) == .installsTheNewest)+ #expect(cannotTell(later, listed("1")) == nil, "a version written otherwise, which no check decides")+ #expect(cannotTell(recent, listed("1.0")) == nil)+ }+private var soldApp: InstalledApp {InstalledApp(url: feedlessApp.url, bundleIdentifier: feedlessApp.bundleIdentifier, name: feedlessApp.name,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swiftindex d56476e8..a72fd89f 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift@@ -840,6 +840,81 @@ struct UpdateSourceTests {#expect(status(behind, checked) == update)}+ @Test func comparesACopyHomebrewDidNotInstallWithTheVersionItsCatalogLists() {+ let checked = Date(timeIntervalSince1970: 1_792_315_250)+ let day = Homebrew.autoUpdateInterval+ let page = URL(string: "https://example.com")+ let status = { (listed: String, version: String, now: Date) in+ UpdateChecker(clock: { now }).homebrewStatus(+ for: InstalledApp(+ url: URL(filePath: "/Applications/Example.app"), bundleIdentifier: "com.example.app",+ name: "Example", version: version+ ),+ casks: [+ HomebrewPackage(+ name: "example", kind: .cask, homepage: page, latestVersion: listed, appNames: ["Example.app"]+ ).noting(lastUpdateCheck: checked),+ ]+ )+ }+ let update = { (version: String) in+ UpdateStatus.updateAvailable(version: version, source: .homebrew, releaseNotes: page)+ }++ #expect(status("2.0", "1.0", checked + 4 * day) == update("2.0"), "a catalog never lists an older version")+ #expect(status("1.0", "1.0", checked + 60) == .upToDate)+ #expect(status("1.0", "1.1", checked + 60) == .upToDate)+ #expect(status("1.0", "1.0", checked + day) == nil)+ #expect(status("27.1.0-58756", "26.3.2", checked) == update("27.1.0-58756"))+ #expect(status("27.1.0-58756", "27.1.0", checked) == .upToDate)+ #expect(status("2.1.0", "2.0.5", checked) == update("2.1.0"))+ #expect(status("1.2.3,456", "1.2.3", checked) == .upToDate)+ #expect(status("1.0b3", "1.0", checked) == .upToDate)+ #expect(status("17.0,2026-09", "17.0.24", checked) == nil)+ #expect(status("5", "5.0.1", checked) == nil)+ #expect(status("10.3.1", "10.3", checked) == nil, "versions written with another number of parts")+ #expect(status("26.10.2.103-stable", "26.10.2", checked) == nil, "a build added as a fourth number")+ #expect(status("2026-07-23", "2.5", checked) == nil)+ #expect(status("3.2.1", "3.2.1-1234", checked) == nil, "what follows the numbers is no newer version")+ #expect(status("latest", "1.0", checked) == nil)+ #expect(status("2.0", "Release 7", checked) == nil)+ }++ @Test func asksTheCatalogOnlyAboutACopyNothingElseKeepsCurrent() {+ let checked = Date(timeIntervalSince1970: 1_792_315_250)+ let checker = UpdateChecker(clock: { checked + 60 })+ let copy = { (path: String, fromTheAppStore: Bool, ofMacOS: Bool) in+ InstalledApp(+ url: URL(filePath: path), bundleIdentifier: "com.example.app", name: "Example", version: "1.0",+ isFromAppStore: fromTheAppStore, isSystemProtected: ofMacOS+ )+ }+ let listed = HomebrewPackage(name: "example", kind: .cask, latestVersion: "2.0", appNames: ["Example.app"])+ let installed = HomebrewPackage(+ name: "example", kind: .cask, installedVersion: "2.0", latestVersion: "2.0", appNames: ["Example.app"],+ appTargets: ["/Applications/Example.app"]+ ).noting(lastUpdateCheck: checked)+ let disabled = HomebrewPackage(+ name: "example", kind: .cask, latestVersion: "2.0", appNames: ["Example.app"],+ retirement: HomebrewRetirement(stage: .disabled, reason: nil, disableDate: nil, replacement: nil)+ )+ let update = UpdateStatus.updateAvailable(version: "2.0", source: .homebrew, releaseNotes: nil)++ #expect(checker.homebrewStatus(for: copy("/Applications/Example.app", false, false), casks: [listed]) == update)+ #expect(checker.homebrewStatus(for: copy("/Applications/Example.app", true, false), casks: [listed]) == nil)+ let setapp = copy("/Applications/Setapp/Example.app", false, false)+ #expect(checker.homebrewStatus(for: setapp, casks: [listed]) == nil)+ #expect(checker.homebrewStatus(for: copy("/Applications/Example.app", false, true), casks: [listed]) == nil)+ #expect(checker.homebrewStatus(for: copy("/Applications/Example.app", false, false), casks: [disabled]) == nil)+ #expect(+ checker.homebrewStatus(for: copy("/Users/me/Applications/Example.app", false, false), casks: [installed])+ == update,+ "a copy Homebrew didn't put there"+ )+ #expect(UpdateChecker.catalogCask(for: copy("/Applications/Example.app", false, false), in: [installed]) == nil)+ #expect(UpdateChecker.catalogCask(for: copy("/Applications/Example.app", false, false), in: [listed]) == listed)+ }+@Test func anUpdateHomebrewReportedHoldsOnlyWhileHomebrewReportsOne() {let homebrew = UpdateStatus.updateAvailable(version: "2.0", source: .homebrew)#expect(homebrew.holds(whileHomebrewSays: homebrew))diff --git a/Peel/Model/AppLibrary.swift b/Peel/Model/AppLibrary.swiftindex 5f840e1a..6a86f8a6 100644--- a/Peel/Model/AppLibrary.swift+++ b/Peel/Model/AppLibrary.swift@@ -141,6 +141,8 @@ final class AppLibrary {/// The cask each Homebrew-installed app came from. Matched with the same evidence everything else uses,/// rather than by guessing a token from the app's name.private(set) var homebrewApps: [InstalledApp.ID: HomebrewPackage] = [:]+ /// The apps Homebrew didn't install whose versions its catalog lists (`UpdateChecker.catalogCask(for:in:)`).+ private var appsInTheCatalog: Set<InstalledApp.ID> = []/// The same, by cask, since the Homebrew page asks about every outdated cask each time it is drawn.private var appsOfCasks: [HomebrewPackage.ID: [InstalledApp]] = [:]/// The rows chosen in the list, which the page beside it shows.@@ -976,13 +978,15 @@ final class AppLibrary {applyHomebrewStatuses()}- /// Forgets an update Homebrew reported and no longer reports, for an app it no longer counts as its own or whose- /// cask is no longer behind, saved answer included, so the app is due and its own feed answers at the next round.- /// One that stands in for the app's own source is decided again from that source's answer instead.+ /// Forgets an update Homebrew reported and no longer reports, for an app it no longer counts as its own or lists in+ /// its catalog, or whose cask is no longer behind, saved answer included, so the app is due and its own feed+ /// answers at the next round. One that stands in for the app's own source is decided again from that source's+ /// answer instead.private func forgetUpdatesHomebrewNoLongerOffers() {let outlived = Set(apps.filter { app inguard let status = updateStatuses[app.id], remembered(app)?.standsInFor == nil else { return false }- let homebrew = homebrewApps[app.id] == nil ? nil : updateChecker.homebrewStatus(for: app, casks: casks)+ let homebrew = homebrewApps[app.id] == nil && !appsInTheCatalog.contains(app.id)+ ? nil : updateChecker.homebrewStatus(for: app, casks: casks)return !status.holds(whileHomebrewSays: homebrew)}.map(\.id))guard !outlived.isEmpty else { return }@@ -994,14 +998,15 @@ final class AppLibrary {UpdateMemoryStore.save(memory, to: defaults)}- /// Shows what a check would answer without asking a server, for each app Homebrew installed or answers for in place- /// of its own source. Reading Homebrew costs no network request, so this doesn't wait for the update schedule, and- /// Applications agrees with the Homebrew page.+ /// Shows what a check would answer without asking a server, for each app Homebrew installed or lists in its+ /// catalog, or answers for in place of its own source. Reading Homebrew costs no network request, so this doesn't+ /// wait for the update schedule, and Applications agrees with the Homebrew page.private func applyHomebrewStatuses() {let preference = updateSourcefor app in apps where isAskedAboutUpdates(app) {let saved = remembered(app)- guard homebrewApps[app.id] != nil || saved?.standsInFor != nil else { continue }+ guard homebrewApps[app.id] != nil || appsInTheCatalog.contains(app.id) || saved?.standsInFor != nil+ else { continue }let decided = updateChecker.statusWithoutAsking(for: app, preference: preference, casks: casks, known: saved.map { $0.standsInFor ?? $0.status })@@ -1026,6 +1031,9 @@ final class AppLibrary {homebrewApps = Dictionary(uniqueKeysWithValues: apps.compactMap { app inCaskEvidence.installedCask(for: app, in: casks).map { (app.id, $0) }})+ appsInTheCatalog = Set(apps.filter { app in+ homebrewApps[app.id] == nil && UpdateChecker.catalogCask(for: app, in: casks) != nil+ }.map(\.id))groupHomebrewApps()}diff --git a/Peel/Model/HomebrewLibrary.swift b/Peel/Model/HomebrewLibrary.swiftindex 5b3240b4..0b903135 100644--- a/Peel/Model/HomebrewLibrary.swift+++ b/Peel/Model/HomebrewLibrary.swift@@ -112,6 +112,9 @@ final class HomebrewLibrary {}/// Casks describing installed apps that Homebrew didn't install, read from its local definitions.private(set) var knownCasks: [HomebrewPackage] = []+ /// The apps the known casks were read for, so a reading that finds Homebrew checked for new versions since reads+ /// them again, with what its catalog lists now.+ private var appsOfKnownCasks: [InstalledApp]?/// The identifiers of the installer receipts on the Mac. A cask that installs a package proves which app/// it is through its receipt.private(set) var receipts: Set<String> = []@@ -224,6 +227,7 @@ final class HomebrewLibrary {private(set) var evidenceRevision = 0func loadKnownCasks(for apps: [InstalledApp]) async {+ appsOfKnownCasks = appslet found = await PackageReceipts.identifiers()let known = await CaskEvidence.knownCasks(for: apps, receipts: found)guard known != knownCasks || found != receipts else { return }@@ -404,6 +408,7 @@ final class HomebrewLibrary {}),isInstalledelse { return }+ let checkedBefore = checkedForUpdatescheckedForUpdates = checkedguard let (found, installed, preview, overridden) = reading else {needsDefinitions = true@@ -435,6 +440,10 @@ final class HomebrewLibrary {overrides = overridden ?? overridesunreadSettingsFile = found.flatMap { Homebrew.unreadSettingsFile(prefix: $0.prefix) }settingsFolders = found.map { Homebrew.settingsFolders(prefix: $0.prefix) } ?? []+ // A check for new versions also changes what the catalog lists for the apps Homebrew didn't install.+ if checked != checkedBefore, let apps = appsOfKnownCasks {+ await loadKnownCasks(for: apps)+ }revision += 1keepSelectionOnItsPage()}diff --git a/Peel/Views/AppPageHeader.swift b/Peel/Views/AppPageHeader.swiftindex 582969a0..e83fc877 100644--- a/Peel/Views/AppPageHeader.swift+++ b/Peel/Views/AppPageHeader.swift@@ -172,6 +172,8 @@ struct AppPageHeader: View {private func updateExplanation(for source: UpdateSource) -> LocalizedStringResource {switch source {case .appStore: "The App Store has it. Update from the App Store."+ case .homebrew where library.cask(for: plan.app) == nil:+ "Homebrew’s catalog has it, but Homebrew didn’t install this copy. Update from inside the app or from its homepage."case .homebrew where upgradeRefusal != nil:upgradeRefusal ?? .excludedAppcase .homebrew where library.cask(for: plan.app)?.upgradeNeedsAnAdministrator == true:@@ -202,6 +204,8 @@ struct AppPageHeader: View {NSWorkspace.shared.open(page ?? URL(string: "macappstore://showUpdatesPage")!)}.buttonStyle(.borderedProminent)+ case .homebrew where library.cask(for: plan.app) == nil:+ openAppButtoncase .homebrew where upgradeRefusal != nil:EmptyView()case .homebrew where upgradeNeedsTerminal:@@ -230,11 +234,15 @@ struct AppPageHeader: View {.buttonStyle(.borderedProminent).disabled(homebrew.runningCommand != nil || homebrew.quittingToUpgrade.isWaiting)case .developer, .automatic:- Button("Open \(plan.app.name)") {- NSWorkspace.shared.open(plan.app.url)- }- .buttonStyle(.borderedProminent)+ openAppButton+ }+ }++ private var openAppButton: some View {+ Button("Open \(plan.app.name)") {+ NSWorkspace.shared.open(plan.app.url)}+ .buttonStyle(.borderedProminent)}private var isUpgrading: Bool {diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swiftindex 92974244..28f05582 100644--- a/Peel/Views/Settings/SettingsView.swift+++ b/Peel/Views/Settings/SettingsView.swift@@ -252,7 +252,7 @@ private struct GeneralSettingsView: View {.disabled(!checksForAppUpdates)} label: {titled("Prefer updates from",- "Automatic asks Homebrew first about an app Homebrew installed, then the app’s own feed or the App Store. Any other choice puts the source you prefer first, then the app’s own feed, then Homebrew for an app it installed.")+ "Automatic asks Homebrew first about an app Homebrew installed, then the app’s own feed or the App Store. Any other choice puts the source you prefer first, then the app’s own feed, then Homebrew for an app it installed. Homebrew’s catalog answers last, for an app Homebrew didn’t install.")}.onChange(of: updateSource) { _, _ inTask { await library.updateSourceChanged() }diff --git a/PeelTests/AppLibraryTests.swift b/PeelTests/AppLibraryTests.swiftindex df154b28..a09d6ff1 100644--- a/PeelTests/AppLibraryTests.swift+++ b/PeelTests/AppLibraryTests.swift@@ -382,6 +382,29 @@ private nonisolated final class TestClock: Sendable {#expect(library.shownUpdateStatus(of: app) == .unsupported)}+ @Test func showsWhatHomebrewsCatalogSaysOfAnAppItDidNotInstallAsSoonAsHomebrewIsRead() async throws {+ let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")+ let bundle = try caskApp("Tool", in: folder)+ defer { try? FileManager.default.removeItem(at: folder) }+ let made = try MadeUpDefaults()+ defer { made.forget() }+ let library = library(with: made.defaults, notesIn: folder, clock: TestClock(homebrewChecked + 60 * 60))+ let checked = homebrewChecked+ let listed = { (latest: String) in+ HomebrewPackage(name: "tool", kind: .cask, latestVersion: latest, appNames: ["Tool.app"])+ .noting(lastUpdateCheck: checked)+ }++ #expect(await library.reveal([bundle]))+ let app = try #require(library.apps.first { $0.bundleIdentifier == "org.example.tool" })+ library.loadHomebrewCasks([listed("2.0")], knowsItsOwnApps: true)+ #expect(library.shownUpdateStatus(of: app)?.version == "2.0")+ #expect(library.cask(for: app) == nil, "Homebrew didn't install it, so it can't upgrade it")++ library.loadHomebrewCasks([listed("1.0")], knowsItsOwnApps: true)+ #expect(library.shownUpdateStatus(of: app) == .upToDate)+ }+@Test func anUpdateHomebrewLearnsOfReplacesTheUpToDateItGaveBefore() async throws {let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")let bundle = try caskApp("Tool", in: folder)