Files
Douglas Eichelberger 5bd5146875 Type AbstractSubcommand#context and #targets
- Both were `T.untyped`. Only `Bundle` subcommands read `context`
  (a `SubcommandContext`) and only `Services` subcommands read
  `targets` (`T::Array[FormulaWrapper]`), so the base class keeps
  them `T.anything`, Sorbet's top type, per `AGENTS.md`.
- Each group narrows its own attribute via a small mixin
  (`SubcommandContextReader` for `Bundle`, `SubcommandTargetsReader`
  for `Services`) rather than an intermediate abstract class, since
  `AbstractSubcommand.subclasses` (used throughout subcommand
  discovery) only walks direct subclasses; inserting a class
  between `AbstractSubcommand` and the real subcommands would
  silently drop them from that list.
- Each mixin's reader raises if the underlying value isn't actually
  present, rather than returning `nil`, since every real subcommand
  is constructed with one by its command's `dispatch`. Only
  `include`d where a subcommand actually reads the attribute, so
  `Services::ListSubcommand`/`CleanupSubcommand` (which never read
  `targets`) are unaffected.
- Typing `context` as a real `SubcommandContext` surfaced a latent
  gap in `Bundle::AddSubcommand#run`: `Array#first` on
  `selected_types` was already `T.nilable(Symbol)` regardless of
  the preceding count check, just invisible while `context` was
  untyped. Switched to `fetch(0)`, which the count check already
  guarantees is safe.
- Added specs for both mixins' narrowing and raising behaviour.
2026-09-25 14:40:24 -07:00
..
…

Library

This directory contains all the code run by the official brew command in Homebrew and all formulae (package descriptions) in taps (repositories containing formulae) in Taps subdirectories.