Skip to content

feat: take descriptions from Homebrew instead of a hand-written catalog - #3

Merged
batuhan-bas merged 1 commit into
mainfrom
feat/brew-descriptions
Oct 8, 2026
Merged

batuhan-bas merged 1 commit into
mainfrom
feat/brew-descriptions

Conversation

@batuhan-bas

Copy link
Copy Markdown
Owner

Stacked on #2. Merge after it.

Why

brew info --json=v2 --installed returns the official description of every installed package in one call (~0.5 s). The hand-written PKG_DESC catalog duplicated that, and anything outside it had no description at all.

Measured on a real machine (153 formulas, 10 casks):

Before After
Formulas under "Other" with a description 0 / 29 29 / 29
Casks with a real description 5 / 10 (rest: "GUI application") 10 / 10
Rows without a description 34 3 (untrusted tap / removed formula, see below)

Changes

  • Descriptions come from Homebrew. The catalog now only maps categories: all 159 entries kept, including the ones from feat: categorize missing formulas and casks #1.
  • JSON parsing without new dependencies: jq when available (ships with macOS 15+), otherwise JavaScript via osascript, which every macOS has. Both produce identical output on the real machine (verified with diff).
  • The package list still comes from brew list. Homebrew leaves formulas from untrusted taps (e.g. mongodb/brew) and removed formulas out of the JSON. They stay listed and categorized, just without a description.
  • brew desc was considered and rejected: it aborts entirely if a single package comes from an untrusted tap.
  • If brew info fails, every package is still shown.

Tests (28 checks, was 17)

Homebrew descriptions for formulas and casks, uncategorized formulas, formulas missing from the JSON, tab/newline flattening, failing brew info, and both parsers (BREWSHELF_JSON_PARSER=jq|osascript).

`brew info --json=v2 --installed` returns the official description of
every installed formula and cask in one call. The hand-written catalog
duplicated them, and everything outside it had no description: 29
"Other" formulas and 5 casks ("GUI application") on a real machine.

- read descriptions from Homebrew; the catalog now only maps categories
- uncategorized formulas under "Other" are described too
- parse the JSON with jq when available (bundled with macOS 15+),
  otherwise with JavaScript via osascript, which every macOS has —
  both produce identical output
- the package list still comes from `brew list`: formulas from untrusted
  taps or removed from Homebrew are missing from the JSON, they are
  listed without a description instead of disappearing
- a failing `brew info` no longer hides any package
- tests: Homebrew descriptions, casks, uncategorized and missing
  formulas, tab/newline handling, both JSON parsers (28 checks)
Base automatically changed from fix/robustness to main October 8, 2026 08:18
@batuhan-bas
batuhan-bas merged commit e354115 into main Oct 8, 2026
1 check passed
@batuhan-bas
batuhan-bas deleted the feat/brew-descriptions branch October 8, 2026 08:18
@batuhan-bas batuhan-bas self-assigned this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant