Add brew doctor and brew cleanup for corrupt Caskroom directories
Caskroom directories can be left behind without valid installed metadata
(e.g. from a manual or incomplete uninstall). Rather than silently
filtering these in listing commands, surface and fix them:
- Add `Cask::Caskroom.corrupt_cask_dirs` to find directories missing
expected `.metadata/<version>/<timestamp>/Casks/*.{rb,json}` files
- Add `check_cask_corrupt_dirs` doctor check that warns and suggests
`brew cleanup`
- Add `cleanup_corrupt_cask_dirs` to `brew cleanup` to remove them
(also runs during periodic automatic cleanup)
- Add unit tests for `corrupt_cask_dirs`
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> K
Kristján Oddsson committed
a6ac45c8a5508d2a7ebbbb2844cc825fad9084d1
Parent: c6c8636