detect cached downloads in doctor

and recommend "brew cask cleanup" if present.

Closes #4857.

Also includes complete refactor of `cleanup.rb`.