bundle: add cleanup support to npm, cargo, go, and uv extensions#21883
bundle: add cleanup support to npm, cargo, go, and uv extensions#21883mvanhorn wants to merge 1 commit intoHomebrew:mainfrom
Conversation
`brew bundle cleanup` already handles formulae, casks, taps, VSCode extensions, and Flatpak packages. But npm, cargo, go, and uv packages not listed in the Brewfile are silently ignored. Add `cleanup_heading`, `cleanup_items`, and `cleanup!` overrides to all four extensions, following the existing flatpak/vscode_extension pattern.
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Hey @mvanhorn! Thanks, looking good so far.
Main concern here is that folks are may be surprised when they brew bundle cleanup --force and it nukes all their global cargo/go/npm/uv files.
I'm not sure how best to handle this. Any thoughts?
|
Good question. A few thoughts:
Open to other ideas too. |
brew lgtm(style, typechecking and tests) with your changes locally?brew lgtm --online, and verified by runningbrew bundle cleanupagainst a real Brewfile on my machine.brew bundle cleanuphandles formulae, casks, taps, VSCode extensions, and Flatpak packages not listed in the Brewfile. But it silently ignores npm, cargo, go, and uv packages.The Extension base class already defines
cleanup_heading,cleanup_items, andcleanup!hooks. Flatpak and VSCode Extension override them. The other 4 extensions don't, so their packages are invisible to cleanup.This PR adds the same 3 overrides to npm, cargo, go, and uv, following the flatpak pattern:
cleanup!commandnpm uninstall -g NAMEcargo uninstall NAME(withCARGO_HOME/RUSTUP_HOMEenv)GOBIN/GOPATHafter matching viago version -muv tool uninstall NAMETested locally. With 6 go packages installed and a Brewfile listing only one, cleanup now reports the other 5: