brew bundle: make non-core DSLs a single file#21721
Conversation
5b62352 to
476fae2
Compare
There was a problem hiding this comment.
Pull request overview
Refactors brew bundle to support “extension” package types (e.g., Go packages and uv tools) via a shared Homebrew::Bundle::Extension base, and updates bundle command plumbing (dump/list/install/check/DSL) to use the extension registry instead of hard-coded per-type modules.
Changes:
- Introduces an extension framework (
bundle/extensions/*) and registers Go/uv as extensions (with compatibility aliases for existing constants/requires). - Updates
brew bundleCLI flags/help text and the dump/list/install/check paths to dynamically include registered extensions. - Updates the Brewfile DSL to route unknown stanza methods to registered extensions via
method_missing.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/cmd/bundle.rb | Switches bundle CLI flag handling/help text to use registered extensions. |
| Library/Homebrew/bundle/extensions/extension.rb | Adds the extension base class + registry and shared dump/install/check behavior. |
| Library/Homebrew/bundle/extensions/go.rb | Implements Go as an extension; provides compatibility aliases. |
| Library/Homebrew/bundle/extensions/uv.rb | Implements uv as an extension; provides compatibility aliases. |
| Library/Homebrew/bundle/extensions.rb | Loads all extension implementations from bundle/extensions/. |
| Library/Homebrew/bundle/extension.rb | Compatibility require shim for the new extension base. |
| Library/Homebrew/bundle/go.rb | Compatibility require shim for Go extension. |
| Library/Homebrew/bundle/uv.rb | Compatibility require shim for uv extension. |
| Library/Homebrew/bundle/go_installer.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/go_dumper.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/go_checker.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/uv_installer.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/uv_dumper.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/uv_checker.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/installer.rb | Routes unknown entry types to extension installers. |
| Library/Homebrew/bundle/dumper.rb | Includes extension dumps via registry and **extension_types options. |
| Library/Homebrew/bundle/lister.rb | Adds extension-type filtering to list output. |
| Library/Homebrew/bundle/dsl.rb | Routes extension stanzas through method_missing + extension registry. |
| Library/Homebrew/bundle/checker.rb | Adds a “registered extensions” check step and resets extensions. |
| Library/Homebrew/bundle/checker/base.rb | Compatibility require shim for checker base relocation. |
| Library/Homebrew/bundle/commands/list.rb | Plumbs extension-type keyword args through bundle list. |
| Library/Homebrew/bundle/commands/dump.rb | Plumbs extension-type keyword args through bundle dump. |
| Library/Homebrew/bundle/tap_checker.rb | Broadens entry typing to align with updated checker base. |
| Library/Homebrew/bundle/mac_app_store_checker.rb | Adds casts for stricter typing. |
| Library/Homebrew/bundle/flatpak_checker.rb | Broadens entry typing + casts for stricter typing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
476fae2 to
5754eb9
Compare
p-linnane
left a comment
There was a problem hiding this comment.
Some feedback on the refactoring — the overall direction is solid. A few things stood out.
fe3e68d to
819f0ee
Compare
There was a problem hiding this comment.
Pull request overview
Refactors brew bundle’s non-core package support (notably Go and uv) into a generalized “extension” framework, with compatibility shims for the old *_installer/*_dumper/*_checker entrypoints and updated CLI/docs/tests.
Changes:
- Introduces a new
Homebrew::Bundle::Extensionbase + registration/loading mechanism and migrates Go/uv to extension implementations. - Updates
bundleCLI argument handling,dump/list/checkplumbing, and installer/dumper/lister code paths to route through registered extensions. - Adds/updates specs to ensure same-process dump output updates and preserves legacy dump ordering + DSL option validation.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/test/bundle/uv_installer_spec.rb | Adds coverage for uv install affecting dump output within the same process; updates stubbing. |
| Library/Homebrew/test/bundle/go_installer_spec.rb | Adds coverage for preserving upgrade_formulae during Go bootstrap; adds same-process dump update test; updates stubbing. |
| Library/Homebrew/test/bundle/dumper_spec.rb | Adds regression test for legacy dump ordering including extensions and Flatpak. |
| Library/Homebrew/test/bundle/dsl_spec.rb | Adds tests for extension DSL positional option hashes and validates uv/go option errors. |
| Library/Homebrew/cmd/bundle.rb | Adds extension-driven CLI switch generation and help text construction; refactors dump/list/add/remove type selection. |
| Library/Homebrew/bundle/uv.rb | New compatibility require forwarding to the uv extension implementation. |
| Library/Homebrew/bundle/uv_installer.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/uv_dumper.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/uv_checker.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/tap_checker.rb | Adjusts Sorbet types to accept generic entry arrays. |
| Library/Homebrew/bundle/mac_app_store_checker.rb | Adds explicit T.cast for typed access to entry options. |
| Library/Homebrew/bundle/lister.rb | Adds extension support for bundle list filtering and adjusts typing/casts. |
| Library/Homebrew/bundle/installer.rb | Routes unknown entry types through registered extensions when install is supported. |
| Library/Homebrew/bundle/go.rb | New compatibility require forwarding to the go extension implementation. |
| Library/Homebrew/bundle/go_installer.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/go_dumper.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/go_checker.rb | Replaced implementation with compatibility require. |
| Library/Homebrew/bundle/flatpak_checker.rb | Adjusts typing/casts for the checker base changes and keeps option-hash checking behavior. |
| Library/Homebrew/bundle/extensions/uv.rb | New uv extension: parsing, normalization, dump formatting, install, and compatibility aliases. |
| Library/Homebrew/bundle/extensions/go.rb | New go extension: package discovery/dump/install and compatibility aliases. |
| Library/Homebrew/bundle/extensions/extension.rb | Introduces shared checker base + extension base class, plus extension registry helpers. |
| Library/Homebrew/bundle/extensions.rb | Adds loader that requires all extension implementations from the extensions directory. |
| Library/Homebrew/bundle/extension.rb | Compatibility require path for the new extension base. |
| Library/Homebrew/bundle/dumper.rb | Adds extension-aware dump support and preserves legacy output ordering. |
| Library/Homebrew/bundle/dsl.rb | Removes hardcoded go/uv DSL methods and adds extension-driven method_missing + loads extensions after DSL definition. |
| Library/Homebrew/bundle/commands/list.rb | Threads extension keyword selection through to Lister. |
| Library/Homebrew/bundle/commands/dump.rb | Threads extension keyword selection through to Dumper. |
| Library/Homebrew/bundle/checker/base.rb | Compatibility require for the moved checker base. |
| Library/Homebrew/bundle/checker.rb | Adds registered extension check step and resets extension state; refactors check steps. |
| Library/Homebrew/bundle.rb | Adds TODO notes around go/uv helpers used by specs during the transition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Consolidate the bundle go and uv dumper, checker, and installer behavior into single-file extension classes and infer the shared bundle command flags, docs, and workflows for those types from the registered extensions instead of hardcoding them separately. Keep the existing explicit plumbing for the other dependency types for now so the refactor stays focused on establishing the new extension pattern and compatibility path with a smaller review surface.
819f0ee to
eac1886
Compare
Refactor
brew bundlecode such that adding a new provider e.g.go,uvin future should only require adding a single file.I've tried to keep tests as-is for now to allow refactoring those in a future pass and to build more confidence the behaviour changes actually work.
brew lgtm(style, typechecking and tests) with your changes locally?Use OpenAI Codex
gpt-5.4 xhigh.