fix(brew search): Improve hints for apps migrated within the same tap#21881
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Homebrew’s missing-formula hinting to produce more accurate guidance when a formula has been migrated to a cask within the same tap, improving the brew search/missing formula messaging for third-party taps using tap_migrations.json.
Changes:
- Add a “same tap” migration path that changes the message and avoids suggesting
brew tap …when the migration stays within the same tap. - Adjust the suggested install command to use
brew install --caskfor same-tap formula→cask migrations. - Simplify/reshape the output formatting to better fit the new messaging.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks for the PR @yermulnik! This logic all looks good and makes sense to me and the wording improvements are 😍.
Just requesting @cho-m give it another look as I'm always a bit twitchy about this sort of logic.
cho-m
left a comment
There was a problem hiding this comment.
I'm fine with changes.
There are some scenarios that may not be handled ideally, but that also holds for original code so those could be improved later on. For example, it should be possible to do the reverse (cask-to-formula migration). Also I think we do support { "<name>": "<tap-name>" } as an alternative to perform same migration.
DRY-ing the code would help as we duplicate the handling of this in multiple locations.
brew lgtm(style, typechecking and tests) with your changes locally?Since the #21224 was merged and released via https://github.com/Homebrew/brew/releases/tag/5.0.6, the tap migrations within the same tap are working for the third-party taps. However the same wasn't implemented for
brew searchwhich still outputs odd hints for such apps that were migrated from a formula to a cask within the same tap. E.g.:This is a follow up to #21207 and attempts to provide a more meaningful and correct hints for apps migrated within the same tap.
Cc @MikeMcQuaid