Skip to content

Update brew extension - #30598

Open
chrismessina wants to merge 16 commits into
raycast:mainfrom
chrismessina:ext/brew
Open

Update brew extension#30598
chrismessina wants to merge 16 commits into
raycast:mainfrom
chrismessina:ext/brew

Conversation

@chrismessina

@chrismessina chrismessina commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Description

Adds Homebrew's install analytics to the extension. The detail sidebar shows a package's install counts and any deprecation warning, and Search gains an optional "Sort by Popularity" that orders results by installs over the last 30 days.

With sidebar hidden and stats accessory, sorted by popularity

image

Two data sources, deliberately. The per-package endpoint (~5KB) carries the 30/90/365-day counts plus the deprecation flags, and is fetched only for the selected row — Raycast constructs the detail element for every row in the list, so the fetch is gated on selection. The bulk 30-day rankings (~2.6MB, cached on disk) are only downloaded when the popularity sort is enabled, because ranking has to order the whole matching set before the search truncates it to 100 results; otherwise "most popular" would mean "most popular of the first hundred alphabetically".

The new toggle sidebar and show description actions

image

With sidebar and description visible

image

With sidebar visible and description hidden

image

This also moves the extension to @raycast/api 2.x. That needed no source changes — nothing here used the aliases v2 deprecates.

Changes

  • Search: "Sort by Popularity" (⇧⌘P) orders results by installs over the last 30 days. An empty query lists the most installed packages outright, and each row shows its install count while the sort is on.
  • The detail sidebar shows install counts for 30, 90 and 365 days plus build errors, matching the analytics table on a package's formulae.brew.sh page.
  • Deprecated and disabled packages carry a warning at the top of the sidebar, with the reason, the date, and the replacement package where Homebrew names one.
  • "Hide Description" (⇧⌘Y) drops the description pane and shows the sidebar as a pure metadata list, with a Caveats indicator. The full caveats text stays in Show Details, which renders it as prose.
  • "Show Details" is now offered even when the sidebar is open. It previously disappeared in that state, which left "Show in Finder" as the default action on an installed package. Install and Upgrade remain the default action where they apply.
  • Display toggles are grouped in a "View" section. "Toggle Details" is now "Toggle Sidebar" (⇧⌘D) and works in Search as well as Show Installed; "Hide Dependencies" no longer appears in Search, where nothing filtered by it. Show Installed adds an install date and marks pinned formulae.
  • Updated to @raycast/api 2.x, and to a brace-expansion release without GHSA-rgw5-rvv9-x895.

Notes for review

  • src/utils/brew/analyticsParse.check.ts is a self-check for the parsing that has no types to protect it — comma-formatted counts, per-invocation buckets, disabled-outranks-deprecated. It is not imported by any command and is not bundled. Run it with:
    npx esbuild src/utils/brew/analyticsParse.check.ts --bundle --platform=node --outfile=/tmp/check.js && node /tmp/check.js
  • The bulk rankings refresh via a Last-Modified check on each launch, so the 2.6MB is paid once per Homebrew republish rather than once per launch.

Checklist

  • I read the extension guidelines
  • I read the documentation about publishing
  • I ran npm run build and tested this distribution build in Raycast
  • I ran npm run lint and npx tsc --noEmit — both clean
  • I checked that this change does not break existing commands or remove functionality
  • I updated CHANGELOG.md per the changelog conventions

- fix: use the ambient Preferences.Search type; keep shipped changelog spacing
- docs: changelog entry and README section for install statistics
- feat: surface statistics in the sidebar, and regroup the display actions
- feat: read Homebrew install analytics, and rank search results by them
- chore: upgrade to @raycast/api 2.x and patch brace-expansion advisory
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: brew Issues related to the brew extension platform: macOS OP is contributor The OP of the PR is a contributor of the extension labels Aug 28, 2026
@raycastbot

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

🔔 @nhojb @Aayush9029 @mathieudutour @urwrstkn8mare @ashokbaruaakas @MillerApps @pernielsentikaer @jfkisafk @vpukhanov @j3lte @alexander-cato @ViGeng @ridemountainpig @clins1994 @alexibuild you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="ext/brew"
FORK_URL="https://github.com/chrismessina/extensions.git"
EXTENSION_NAME="brew"
REPO_NAME="extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Homebrew install analytics, popularity-based search ordering, richer package metadata, and improved installed/outdated package presentation. It also introduces atomic cache downloads and updates the Raycast API and supporting dependencies.

  • Fetches per-package analytics only for the selected row.
  • Downloads and caches bulk rankings when popularity sorting is enabled.
  • Adds deprecation, disablement, install-date, pinned, caveat, and version metadata.
  • Improves cache invalidation, temporary-file cleanup, and download writes.
  • Updates action panels, sidebar controls, package icons, and dependencies.

Confidence Score: 5/5

The PR appears safe to merge based on the available follow-up review context.

No blocking failure remains.

Important Files Changed

Filename Overview
extensions/brew/src/hooks/usePopularityRanks.ts Lazily loads disk-cached Homebrew ranking data and coordinates cancellation, progress reporting, and refresh versions.
extensions/brew/src/hooks/usePackageDetail.ts Fetches selected-package analytics and lifecycle metadata while avoiding requests for unselected rows.
extensions/brew/src/hooks/useBrewSearch.ts Integrates popularity rankings into cached search execution and invalidates ranking state when caches are cleared.
extensions/brew/src/utils/brew/analytics.ts Defines analytics endpoints, ranking-cache loading, and generation-based invalidation.
extensions/brew/src/utils/brew/analyticsParse.ts Parses install counts, formats analytics rows and package status, and provides deterministic popularity ordering.
extensions/brew/src/utils/brew/search.ts Sorts the complete matching index before truncation and annotates returned packages with install counts.
extensions/brew/src/utils/cache.ts Makes downloaded-cache publication atomic through unique temporary files and expands cache cleanup.
extensions/brew/src/components/list.tsx Adds selection tracking, analytics-aware details, install statistics, install dates, pin indicators, and view controls.
extensions/brew/src/components/packageMetadata.tsx Centralizes formula and cask metadata rows for sidebar and detail presentation.
extensions/brew/package.json Updates Raycast and utility dependencies while preserving the extension’s package contract.

Reviews (17): Last reviewed commit: "feat: group pinned formulae in Show Outd..." | Re-trigger Greptile

@chrismessina
chrismessina marked this pull request as ready for review August 28, 2026 00:45
@chrismessina
chrismessina marked this pull request as draft August 28, 2026 00:47
@chrismessina
chrismessina marked this pull request as ready for review August 28, 2026 00:51

@nhojb nhojb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice 😄

Couple of minor comments:

  • Because the install analytics load lazily, the detail metadata scrollview jumps after the analytics load. Perhaps we could add placeholder rows to avoid this?
  • The install analytics are missing from the non-detail info view:
Image

@chrismessina

Copy link
Copy Markdown
Contributor Author

Very nice 😄

Thanks! :)

Couple of minor comments:

  • Because the install analytics load lazily, the detail metadata scrollview jumps after the analytics load. Perhaps we could add placeholder rows to avoid this?
  • The install analytics are missing from the non-detail info view...

Both addressed and pushed (25c4b35).

1. The layout jump. Root cause was mine: the statistics block returned null until the fetch landed, so the rows appeared underneath the cursor. analyticsRows() now always returns the three install rows, carrying an em dash until the counts are known — the panel reserves their height and only the values change. Build errors stay conditional, since they're absent for nearly every package and a permanent 0 row would be noise.

2. Missing from the Details view. Real gap — I'd only wired the sidebar. Detail.Metadata.Label and List.Item.Detail.Metadata.Label are different components so the JSX can't be shared, but everything deciding what to show now is (analyticsRows, packageStatus, usePackageDetail), so the two views can't drift in content. The deprecation warning comes along with it, at the top where it is in the sidebar.

image

@chrismessina
chrismessina requested a review from nhojb August 28, 2026 20:36
@chrismessina
chrismessina marked this pull request as draft August 29, 2026 21:22
- fix: order versions instead of comparing them, and leave cask policy to brew
- refactor: define package metadata once, render it in both namespaces
- fix: one icon vocabulary for install state, across all three views
- fix: detect an available update in Search, and stop the version row lying
@chrismessina

Copy link
Copy Markdown
Contributor Author

@nhojb since your first pass, my latest batch adds: outdated formulae detection so that available upgrades are called out in the metadata, changed from red to yellow the update icon, condensed the sidebar metadata renderer (which killed three duplicated formatters and dependencies.tsx), improved the skip toast and its "Skipped" marker for pinned formulae that shouldn't be upgraded, changed the Pin icon to use Tack, and added a Pinned Formulae section.

file-724e170482abb63cf50afa663f350ffb file-b1d2ab57ee6e1f4dcde16193696a2cfa file-60fe0bf8a5b16aa47bfa08018842c00b file-219ce7723b8a1bac504982c0efab2063

@chrismessina
chrismessina marked this pull request as ready for review August 30, 2026 01:39
@chrismessina

Copy link
Copy Markdown
Contributor Author

@greptile could you take another look?

@0xdhrv 0xdhrv self-assigned this Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension: brew Issues related to the brew extension extension fix / improvement Label for PRs with extension's fix improvements OP is contributor The OP of the PR is a contributor of the extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants