You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BrewUI has no way to run brew cleanup, so Cakebrew users switching over must open Terminal to see what is stale and reclaim the space, and this adds Tools › Clean Up…, which previews exactly what will be removed and then runs it.
Special things to note
Following review, this replaces the earlier Cleanup tab: the sidebar and ⌘1–⌘6 are back to what main has. The new Tools menu is named so other occasional commands can join it later.
Following review, the preview (brew cleanup --dry-run) is read-only, so it runs directly through the command runner like brew config rather than through the command centre: it stays out of the console and never queues behind a running install or upgrade. Lines the parser does not read are shown verbatim in the sheet under a warning that the list may be incomplete.
A Remove all cached downloads toggle adds --prune=all to both the preview and the run.
What runs is what was reviewed: Clean Up runs brew cleanup with the same flags as a mutating maintenance operation in the console, then closes the sheet. It stays disabled until a current, non-empty preview for those flags has loaded. brew cleanup already autoremoves unneeded dependencies, so there is no separate brew autoremove action. Unreferenced cached downloads are the one thing a run removes that the preview cannot list, because Homebrew's dry run skips them, so the command summary mentions them.
Out of scope: brew bundle cleanup. It uninstalls everything a chosen Brewfile does not list, so it needs a file picker and its own review.
Change outline
The menu command opens a sheet on the focused main window:
BrewApp
.commands
+ ToolsCommands # Tools › Clean Up…, disabled with no main window
MainWindowView
+ .focusedSceneValue(\.showCleanup)+ .sheet(isPresented: $showsCleanup)+ CleanupSheetRoot # BrewFeatureCleanup+ CleanupSheet(viewModel: CleanupViewModel)+ "Remove all cached downloads" toggle # adds --prune=all+ unneeded formulae + paths to remove, Homebrew's own sizes and total+ footer: copyable command, Cancel, destructive Clean Up (never default)
Each time the sheet opens it previews, then the button runs the real command:
sheet appears / prune toggle changes
BrewCleanupRepository.load(pruneAll:)
commandRunner.run(brew cleanup --dry-run [--prune=all]) # read-only, not in the console
CleanupOutputParser.parse(stdout) -> CleanupReport # unknown lines kept as unreadLines
Clean Up pressed (canCleanUp: loaded, not empty, no failure, same pruneAll)
commandCenter.perform(brew cleanup [--prune=all]) # mutating maintenance op
console streams output, installed inventory reconciles
sheet closes
The parsed preview is a small new model:
structCleanupReport{varpruneAll:Bool // which preview this is
varunneededFormulae:[String] // "Would autoremove N unneeded formulae"
varremovals:[CleanupRemoval] // path, kind (file, broken link, empty folder), size
varreclaimableSpace:String? // "would free approximately X"
varunreadLines:[String] // anything else, shown under a warning
}
macOS 27.0.1, Apple M5 Pro, Xcode 27.1, Swift 6.4. upstream/main is merged in.
scripts/test on the latest upstream/main merge: 1,245 package tests pass, including the parser, repository, view model, command and AXID tests.
mint run swiftformat --lint ., mint run swiftlint lint --strict, BrewUILint over the production tree and scripts/localize verify: all pass.
scripts/localize sync stops on Xcode 27.1, which names package build folders <Target>-t.build while the script looks for <Target>.build. I ran xcstringstool sync with that path widened, kept its package-catalog output and added the two new app-catalog keys (Tools, Clean Up…) by hand, because its app-catalog pass also reorders existing translations.
scripts/test-ui -only-testing:BrewUITests/CleanupUITests -only-testing:BrewUITests/NavigationUITests: 5 of 5 pass. The Cleanup tests open Tools › Clean Up… and check the fixture rows before pressing Cancel, and check the empty state before pressing Done.
CI on 2c026c8: 11 checks pass (including build and unit tests, UI tests, live end-to-end canaries, SwiftFormat/SwiftLint/BrewUILint and workflow syntax) and 3 deploy jobs are skipped.
Manual: ran the app against real Homebrew 7.0.12 and opened Tools › Clean Up…. The sheet listed the 9 paths and the 124.9MB total from brew cleanup --dry-run, then Cancel closed it without running anything. Not repeated since the preview moved out of the console.
Not run: Clean Up for real against this machine's Homebrew.
I added regression coverage for bug fixes or explained why automated coverage is impractical, and reported the relevant validation above.
Screenshots
Before
After
No Tools menu; brew cleanup needs Terminal.
Tools › Clean Up…
The Clean Up sheet with a real dry run:
Screenshots were taken from a debug build (hence the Debug menu) against real Homebrew, in light appearance. They predate the preview moving out of the console; the sheet looks the same unless Homebrew prints a line the parser does not read.
AI assistance
AI was used to generate or assist with generating this PR.
Claude Code wrote the implementation, tests and this description, and ran the checks listed above.
Preview `brew cleanup --dry-run` through the command centre so the
Cleanup tab lists unneeded dependencies, old versions, stale downloads
and logs with Homebrew's own sizes and total. Clean Up runs
`brew cleanup` with the same flags after a confirmation, and an option
adds `--prune=all` to both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the unused raw output from CleanupReport, share the card chrome
and error text within the view, derive the row id from its path and
give the cleanup fixture its own scenario arm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
New Features
Added Tools › Clean Up…, with a preview of removable formulae and files and Homebrew’s estimated reclaimable space.
Choose whether to include additional pruning, retry a failed preview, or run cleanup. Unrecognised preview output is flagged so the list may be incomplete.
Cancel closes the sheet without running cleanup; an empty installation shows a clean state. Running cleanup closes the sheet, with the result shown in the console. Homebrew may also remove unneeded dependencies unless automatic removal is disabled in Homebrew settings.
Documentation
Documented that previews run outside the command centre and console, without waiting behind other operations, and that cleanup results appear in the console.
The change adds a Cleanup sheet that previews brew cleanup --dry-run, displays eligible formulae and removals, and can run brew cleanup. It adds command and repository support, connects the sheet to the Tools menu, and adds unit and UI test coverage. It also changes how workflow checks pass values to grep.
Changes: Cleanup feature
Layer / File(s)
Summary
Cleanup contracts and commands Sources/BrewCore/Models/*, Sources/BrewCore/Operations/*, Sources/BrewRepositoryInterfaces/*, Sources/BrewAppEnvironment/*, Sources/BrewCLI/*, Tests/BrewCoreTests/*
Adds cleanup report and operation types, command builders, repository interfaces, and supporting fakes and preview data. Tests cover cleanup command arguments and operation kind.
Parses recognised Homebrew dry-run output and loads previews through the cleanup repository. The repository tracks refresh state and handles command failures. Tests cover parsing, option selection, and refresh behaviour.
Cleanup interface and actions Sources/BrewFeatureCleanup/*, Sources/BrewUIComponents/Theme/BrewSpacing.swift, Sources/BrewAccessibilityID/AXID.swift, Tests/BrewFeatureCleanupTests/*, Tests/BrewAccessibilityIDTests/*
Adds the cleanup view model and sheet. The interface presents report items, clean and failed states, prune-all controls, confirmation text, and cleanup actions.
Adds the feature package to the app, provides its repository through the environment, connects the Tools menu action to sheet presentation, and adds populated and empty cleanup UI scenarios.
Workflow grep input handling
Layer / File(s)
Summary
Build and release checks .github/workflows/build.yml, .github/workflows/release.yml
Changes the identity and version checks to pass values to grep through Bash here-strings. The patterns and failure handling remain unchanged.
Merge Risk: Low · up to 617df
The Clean Up preview may not list every item a real run removes, such as unreferenced cached downloads or downloads cached after the preview. This is a bounded copy and documentation accuracy concern. It is mergeable with owner awareness.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "Add Clean Up… to a new Tools menu" matches the main change. The PR adds a Tools menu with a Clean Up… command that previews and runs brew cleanup, as shown in the changed files ToolsCommand…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description explains the change: a new Tools › Clean Up… sheet that previews brew cleanup --dry-run and then runs brew cleanup, plus a Remove all cached downloads toggle (--prune=all), valid…
Full details: Title check
Explanation
The title "Add Clean Up… to a new Tools menu" matches the main change. The PR adds a Tools menu with a Clean Up… command that previews and runs brew cleanup, as shown in the changed files ToolsCommands.swift, MainWindowView.swift, and the new BrewFeatureCleanup package. The title is concise and specific, and it does not describe anything absent from the changeset.
Full details: Description check
Explanation
The description explains the change: a new Tools › Clean Up… sheet that previews brew cleanup --dry-run and then runs brew cleanup, plus a Remove all cached downloads toggle (--prune=all), validation steps and screenshots. It matches the changeset, including the new CleanupSheet, BrewCleanupRepository, CleanupOutputParser, ToolsCommands and the Package.swift BrewFeatureCleanup target, so it is not off-topic.
Reviewing files that changed from the base of the PR and between f6a168f and 617df07.
Files selected for processing: 2
.github/workflows/build.yml
.github/workflows/release.yml
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Expose one ViewModel property for the disabled state of the controls.
Both the "Check Again" button and the prune-all toggle compose viewModel.isRefreshing || viewModel.isCleaningUp in the view. The two sites must stay in step. The repository guideline requires one ViewModel property for each UI decision.
Add a derived property to CleanupViewModel and bind to it.
Proposed fix
// CleanupViewModel.swift
+ /// Header controls wait while a preview or a cleanup run is in progress.+ var areHeaderControlsDisabled: Bool {+ isRefreshing || isCleaningUp+ }
.font(.system(size: 44)) uses a fixed size. It does not scale with Dynamic Type. It is also a magic number in a view. The design system requires relative SwiftUI font styles. The coding conventions require the theme for typography.
Use a semantic font token from BrewUIComponents, or add one for large empty-state icons.
As per coding guidelines: "Support Dynamic Type – Yes – use relative SwiftUI font styles, not fixed sizes" and "Extend semantic tokens … instead of introducing raw colours or magic numbers in views."
Wait for cleanup completion, not scheduler yields.
The tests wait for !viewModel.isCleaningUp, but waitUntil only performs 500 Task.yield() calls. The cleanup task can still be awaiting the command centre or the repository reload when those iterations finish. Use a target-shared readiness helper or an explicit test completion signal. Do not rely on the phase stream alone because the view model reloads before it clears isCleaningUp.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
- Clear a stale refresh failure when the preview switches option.
- Expose one view model property for disabling the header controls.
- Wait on a deadline in the view model tests rather than a yield count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Header controls: added CleanupViewModel.areHeaderControlsDisabled; both controls bind to it.
Test waits: waitUntil now polls against a 5s deadline instead of 500 yields.
Fixed 44pt icon: kept on purpose. It matches the Doctor empty state (DoctorView.swift:97), and BrewFonts has no icon-sized token. Happy to change both in a separate PR if maintainers want one.
@MikeMcQuaid Fair point — automatic cleanup covers most of it. What it doesn't give a GUI user:
Visibility: what would be removed and how much space it frees. The automatic run is silent and only happens as part of brew install/upgrade/reinstall (a full sweep at most every 30 days).
--prune=all: clearing the whole download cache on demand. Automatic cleanup only removes downloads older than 120 days.
Parity for Cakebrew users: this is the one tool I missed after switching. Cleaning up on demand meant opening Terminal.
If you'd rather not have a dedicated tab, I'm happy to shrink it to a "Clean Up" action inside Doctor or wherever you see best fit.
Replace the wall-clock deadline with a readiness signal.
If command-centre execution or the subsequent reload takes more than five seconds on a busy test worker, waitUntil records a failure even when both complete correctly. Wait for an explicit completion signal from the test double. Use an injected clock if the test must check timeout behaviour. As per coding guidelines, “Drive timeout tests from explicit readiness signals and injected clocks rather than short wall-clock deadlines.”
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set chat.allow_non_org_members: true in your configuration.
The view model tests now await the stub repository's reload signal,
which every cleanup run ends with, rather than polling against a
wall-clock deadline that a busy worker could miss.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
Agree with @MikeMcQuaid. This is really not a fundamental enough feature to have its own tab I think adding it to Doctor in a way that doesn't look weird would need a bit of thought.
Alternatively a simpler option would just be to create a "Tools" menu in the menu bar. I'd imagine that will become the home for a few other similar commands.
Stick this in there as "Clean up..." and have that launch a confirmation dialog which says what would be removed.
Review asked for a menu command rather than a sidebar tab. Tools > Clean
Up… opens a sheet that previews brew cleanup with a dry run, lists what
it would remove and runs it only from the sheet's Clean Up button. The
Cleanup tab, its sidebar entry and its shortcut are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
tongliuTL
changed the title
Add a Cleanup tab for brew cleanup
Add Clean Up… to a new Tools menu
Nov 3, 2026
The prune-all test keeps the pruneAll: false report and never runs cleanUp(). A change that drops --prune=all from the submitted cleanup would pass the suite. Add a test that supplies a pruneAll: true report, runs cleanup after enabling prune-all, and checks the submitted operation. The helper must also map the prune-all argument list so the run succeeds.
Record brew invocations and check that Cancel starts no cleanup.
The test checks only that the sheet closes after Cancel. A regression that starts brew cleanup before the sheet is dismissed would still pass. FakeBrew does not record invocations, so the test cannot observe a submitted command.
Record each invocation in a form the UI test can read. Match whole argument lines. The sheet runs cleanup --dry-run when it opens, so a prefix match would also match that preview.
After Cancel, the test must wait for any pending asynchronous work before it checks for a cleanup line. The synchronisation point must complete whether or not a command was submitted. The current UI provides no completion state for a cleanup submission, so this point must be added. A fixed delay cannot prove absence, and an immediate check can pass before a submitted command starts.
SwiftUI does not pass an accessibility identifier from a Commands button
to its menu item, so the Clean Up UI tests could not find it. Look the
item up by its English title and pin the stubbed launch to English, as
the live suite already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
Thanks @graeme, that makes sense. I've moved it to a new Tools menu as "Clean Up…", which opens a sheet showing what brew cleanup would remove (with the --prune=all option) before anything runs. The tab is gone.
Disable Clean Up after a failed refresh and when the loaded preview was
made without the prune option the run would use. Move the confirmation
message into the scrolling list so a long formula list cannot push the
footer out of the sheet. Cover the prune-all run with a test.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
Review-body nitpicks from the latest CodeRabbit review:
Prune-all submission test: added in 1c9faa1 (prune all runs brew cleanup with --prune=all when the preview matches); the recording helper now takes the argument list.
Recording brew invocations in CleanupUITests: not changing here. Fake brew's fixtures live in the app's own temporary directory and proving an absence needs a new completion signal in the UI, which is a harness change of its own. cleanUp() is the only submit path and only the Clean Up button calls it; unit tests cover that it never submits without a removable, current preview.
Add a repository test for recovery after a failed refresh.
BrewCleanupRepository clears refreshFailure when a same-option load succeeds. No test covers a same-option failure followed by a successful load, so a regression that keeps the failure set would not fail any current test. The existing tests cover a failure that stays set and an option switch that clears the failure.
Add a test to BrewCleanupRepositoryTests that uses SequencedRunner to succeed, fail, then succeed on the same option:
🧪 Suggested test
+ @Test func `a successful refresh after a failed one clears the failure`() async {+ let success = MockBrewCommandRunnerBehavior.output(CommandOutput(+ standardOutput: "Would remove: /cache/a.tar.gz (1MB)\n",+ standardError: "",+ terminationStatus: 0,+ ))+ let runner = SequencedRunner([+ success,+ .throw(BrewCommandError.launchFailed(underlying: "spawn failed")),+ success,+ ])+ let context = BrewCommandExecutionContext(commandRunner: runner, locator: BrewExecutableLocator(overrideURL: Self.brewURL))+ let repository = BrewCleanupRepository(+ commandCenter: SerialBrewCommandCenter(executionContext: context, reconciler: NoopBrewOperationReconciler()),+ )++ await repository.load(pruneAll: false)+ await repository.load(pruneAll: false)+ await repository.load(pruneAll: false)++ #expect(repository.refreshFailure == nil && repository.state.value?.removals.count == 1)+ }
Place the test after a failed refresh keeps the prior report and records the failure. The test drives the production load(pruneAll:) path, so it does not reset any state by hand.
The view-model stub cannot clear refreshFailure on load. A view-model assertion would need a manual reset, so this test covers recovery at the repository boundary.
The irreversibility statement sat at the end of the scroll region, so a
long report pushed it out of view while Clean Up stayed enabled. It now
sits above the list as a fixed short line; the variable list of formulae
autoremove uninstalls stays inside the scroll region.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
The only uninstallMessage test uses a report with formulae. Nothing asserts the nil case. A change that returns text for a removal-only report would still pass, and CleanupSheet would show a false uninstall statement. The suggested test covers this case.
Suggested test
@Test func `the confirmation names the formulae it will uninstall`() {
let viewModel = Self.viewModel(repository: StubCleanupRepository(report: Self.report))
#expect(viewModel.uninstallMessage == "This also uninstalls libyaml, m4.")
}
++ @Test func `the confirmation is absent when no formulae are uninstalled`() {+ let report = CleanupReport(+ pruneAll: false,+ unneededFormulae: [],+ removals: [CleanupRemoval(path: "/cache/a.tar.gz", kind: .file, size: "12.7MB")],+ reclaimableSpace: "12.7MB",+ )+ let viewModel = Self.viewModel(repository: StubCleanupRepository(report: report))+ #expect(viewModel.uninstallMessage == nil)+ }
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
Add a test that Clean Up stays enabled for a cache-only preview.
The cache-only test checks only the confirmation. A change that disables Clean Up when unneededFormulae is empty would still pass the suite. Add a separate test that asserts canCleanUp for a report with removals and no formulae.
Suggested test
+ @Test func `clean up is enabled for a cache-only preview`() {+ let report = CleanupReport(+ pruneAll: false,+ unneededFormulae: [],+ removals: [CleanupRemoval(path: "/cache/a.tar.gz", kind: .file, size: "12.7MB")],+ reclaimableSpace: "12.7MB",+ )+ let viewModel = Self.viewModel(repository: StubCleanupRepository(report: report))+ #expect(viewModel.canCleanUp)+ }+
Make the recovery test detect a stale report after a successful refresh.
The recovery test loads the same output before and after the failure. A regression that keeps the previous report after a successful refresh that follows a failure would still pass. Return different output on the third load and assert its path.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Assert that Clean Up stays enabled for a cache-only preview, and make the
refresh recovery test return a different report after the failure so a
stale report would be caught.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
@coderabbitai Both follow-up nitpicks fixed in 806a3d7: added a test that Clean Up stays enabled for a cache-only preview, and the recovery test now returns a different report after the failure and asserts its path.
The cache-only test checks only canCleanUp. No test submits cleanup for a cache-only preview, so an added formulae requirement in cleanUp() would pass the suite. Add a test that builds the view model from cacheOnlyReport, calls cleanUp(), and asserts that the recording command center receives a .cleanup entry. This follows the pattern of the existing submission tests.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set chat.allow_non_org_members: true in your configuration.
The reason will be displayed to describe this comment to others. Learn more.
I still think this could be simpler.
Please do not show the cleanup preview run in the console. I know there's an exception to the "only mutating commands in the console" rule with the Doctor, but I'd still rather we didn't add more unless adding value. To achieve this, you have to queue it behind mutating commands which isn't necessary; you could have it run in parallel with them creating a more responsive experience.
If you want to handle lines the parser doesn't read, better to add that as a partial error message in the clean-up sheet.
General advice for opening PRs here: if you keep the feature as simple as possible to achieve the goal, it'll get reviewed quicker. That's a good practice in general.
It's almost there. I think once you address this item, it'll be good to go.
The dry run changes nothing, so it now runs directly through the
command runner, like `brew config`, instead of the command centre. It
stays out of the console and no longer queues behind mutating commands.
Lines the parser does not read are kept on the report and shown in the
sheet as a partial error, so the list is never silently incomplete.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
@graeme Thanks, done in 2e3f27b: the dry run now runs directly through the command runner (like brew config) instead of the command centre, so it no longer appears in the console or queues behind mutating commands, and the .cleanupPreview operation kind is gone. Lines the parser doesn't read are now shown verbatim in the sheet as a partial error. I also merged main in (a9da668).
Files skipped from review as they are similar to previous changes: 1
Homebrew/Localizable.xcstrings
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Waiting load calls recheck the in-flight preview after each wait and only
the finished task clears the handle, so two callers waiting for the other
option share one dry run. A retained report now shows the re-check spinner
and a failure with Retry in both the empty and the non-empty state, and the
command summary says a run also removes unreferenced cached downloads,
which the dry run does not list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
Reviewing files that changed from the base of the PR and between b78bbfa and f6a168f.
Files selected for processing: 5
ARCHITECTURE.md
Homebrew.xcodeproj/project.pbxproj
Homebrew/BrewApp.swift
Homebrew/Localizable.xcstrings
Package.swift
Files skipped from review as they are similar to previous changes: 1
Homebrew/Localizable.xcstrings
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Hi @graeme, thanks again for the steer on keeping this simple. Your points from 12 November are addressed: the preview no longer goes through the console or queues behind other commands, and lines the parser doesn't read now show as a partial warning in the sheet. I've also brought the branch up to date with main. I'm happy to make further changes whenever you have time for another look.
Newer shellcheck flags piping into grep -q under pipefail (SC2337).
Feed grep from a here-string instead; behaviour is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
Upstream fixed the same shellcheck SC2337 warnings in Homebrew#341, so take
main's versions of build.yml and release.yml. This PR no longer
touches the workflows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPohgvgVhj9yTCLQRiEYE7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review: move to a Tools menu
What and why
Why the change
BrewUI has no way to run
brew cleanup, so Cakebrew users switching over must open Terminal to see what is stale and reclaim the space, and this adds Tools › Clean Up…, which previews exactly what will be removed and then runs it.Special things to note
mainhas. The new Tools menu is named so other occasional commands can join it later.brew cleanup --dry-run) is read-only, so it runs directly through the command runner likebrew configrather than through the command centre: it stays out of the console and never queues behind a running install or upgrade. Lines the parser does not read are shown verbatim in the sheet under a warning that the list may be incomplete.--prune=allto both the preview and the run.brew cleanupwith the same flags as a mutating maintenance operation in the console, then closes the sheet. It stays disabled until a current, non-empty preview for those flags has loaded.brew cleanupalready autoremoves unneeded dependencies, so there is no separatebrew autoremoveaction. Unreferenced cached downloads are the one thing a run removes that the preview cannot list, because Homebrew's dry run skips them, so the command summary mentions them.brew bundle cleanup. It uninstalls everything a chosen Brewfile does not list, so it needs a file picker and its own review.Change outline
The menu command opens a sheet on the focused main window:
Each time the sheet opens it previews, then the button runs the real command:
The parsed preview is a small new model:
Where it lives:
Validation
macOS 27.0.1, Apple M5 Pro, Xcode 27.1, Swift 6.4.
upstream/mainis merged in.scripts/teston the latestupstream/mainmerge: 1,245 package tests pass, including the parser, repository, view model, command and AXID tests.mint run swiftformat --lint .,mint run swiftlint lint --strict, BrewUILint over the production tree andscripts/localize verify: all pass.scripts/localize syncstops on Xcode 27.1, which names package build folders<Target>-t.buildwhile the script looks for<Target>.build. I ranxcstringstool syncwith that path widened, kept its package-catalog output and added the two new app-catalog keys (Tools,Clean Up…) by hand, because its app-catalog pass also reorders existing translations.scripts/test-ui -only-testing:BrewUITests/CleanupUITests -only-testing:BrewUITests/NavigationUITests: 5 of 5 pass. The Cleanup tests open Tools › Clean Up… and check the fixture rows before pressing Cancel, and check the empty state before pressing Done.brew cleanup --dry-run, then Cancel closed it without running anything. Not repeated since the preview moved out of the console.Screenshots
brew cleanupneeds Terminal.The Clean Up sheet with a real dry run:
Screenshots were taken from a debug build (hence the Debug menu) against real Homebrew, in light appearance. They predate the preview moving out of the console; the sheet looks the same unless Homebrew prints a line the parser does not read.
AI assistance
Claude Code wrote the implementation, tests and this description, and ran the checks listed above.
🤖 Generated with Claude Code