feat(#80): Brew Doctor + Cleanup cache maintenance - #82
Merged
Merged
Conversation
Scoped PLAN for issue #80 (doctor + cleanup buttons, cache visual). Grounded in the existing streaming-action path (actions.rs brew_update -> exec.rs run_brew_streaming), the already-measured Download cache entry in disk_usage.rs / the Storage card, and the warnings-only non-zero classification for doctor. Heavy reuse, both shells in parity, confirm-gated destructive cleanup. Not yet built — targets the 0.x.1 batch. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds cache-maintenance actions on the Dashboard Storage card (which already shows the Download cache size), per issue #80. Backend: - brew_doctor_stream + brew_cleanup(verbose) — streaming commands mirroring brew_update (run_brew_streaming). Named *_stream to avoid colliding with the existing env-probe brew_doctor. cleanup runs --prune=all --scrub [--verbose]. - doctor_advisory_exit() classifier: brew doctor exits 1 on advisories, so exec.rs treats a non-zero doctor exit as effective-success (advisory text lands in the Activity log, no error toast). - brew_cleanup_preview command + parse_reclaimable/parse_size_token: dry-run estimate for the 'frees ~X' hint. Best-effort (None hides the hint). - cleanup invalidates only the disk-usage cache (packages unchanged). Frontend: - api wrappers brewDoctorStream / brewCleanup / brewCleanupPreview. - Storage-card maintenance row: Run brew doctor + Clean up cache… buttons (both stream into the Activity drawer), reclaimable hint, and an inline confirm gate for the destructive cleanup with a verbose toggle (default on). Tests: +6 (doctor classifier, size-token + reclaimable parsing). cargo 649, vitest 35, svelte-check 0 errors. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Mirrors the Tauri implementation in the SwiftUI build: - BrewErrorPatterns.doctorAdvisoryExit + parseReclaimableBytes/parseSizeToken (byte-identical behavior to the Rust catalog; same test fixtures). - startJob treats a non-zero brew doctor exit as success (advisories). - BrewService.cleanupReclaimableBytes() — dry-run estimate. - AppModel.runDoctor / runCleanup(verbose:) + reclaimable/busy state; loadStorage also fetches the estimate; cleanup re-measures storage on success. - StorageCard maintenance row (stock SwiftUI: Button/Label/Toggle/role:.destructive confirm) with the same copy + reclaimable hint as Tauri. Tests: +6 parity (swift 137). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #80.
Summary
Adds Brew Doctor and Cleanup as cache-maintenance actions on the Dashboard Storage card (which already shows the Download cache size), per @modeezie's request in #80. Both shells, in parity.
brew doctorinto the Activity drawer. A non-zero exit (advisories) is treated as success, so the diagnostics show in the log without a scary "failed" notice.brew cleanup --prune=all --scrub [--verbose], streamed. Confirm-gated (destructive of cached downloads incl. current versions; installed packages untouched), with a "frees ~X" estimate from abrew cleanup -ndry-run and a verbose toggle (default on, per the reporter).Design notes
brew_doctor_streamis named to avoid colliding with the existing onboardingbrew_doctorenv-probe.doctor_advisory_exit), in both shells.Tests
cargo 649 (+6) · vitest 35 · swift 137 (+6) · svelte-check 0 errors. New tests cover the doctor classifier and the size-token / reclaimable parsing in both Rust and Swift (same fixtures).
Follow-up question for the reporter
Default
--scrubon (most aggressive, frees the most), or offer non-scrub as the default? Currently scrub-on with a verbose toggle. Open to feedback.Scoped plan:
memory-bank/tasks/2026-06/15-doctor-cleanup-plan.md.🤖 Generated with Claude Code