Prefill `app` and `zap` in `brew create --cask` #24316

Merged
bevanjkay opened 3:31pm on October 21, 2026 wanted to merge 276 Ξ” into homebrew/brew main from
brew_create_zap

Pull Request Overview

  • Opened on October 21, 2026
  • Status Merged
  • Commit count 1 with first commit October 21, 2026

Total Delta

276 Total Diff Delta

Open Days

Open 15 weekdays

Test Delta

14 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.2 days Authoring 1 commit before pull request opened for review
 
0.2 days Awaiting first review
 
0.6 days Revising work with 0 commits in response to 5 reviews that left 13 comments
Set up deploy tracking to begin tracking full PR start-to-deploy times

Total time for pull request 1.0 business day from first commit authored to merge
Deploy tracking has not been set up

Author avatar

Prefill `app` and `zap` in `brew create --cask`


  • New casks now need a zap stanza, which contributors find the most confusing part of a cask. Prefill it by running brew generate-zap on an installed copy of the app.

  • The cask name defaults to the download's file name, e.g. AgentIDE-0.9.11, not the app's, so unpack the download to find the app instead. Use it to fill in app, read its appcast for livecheck and find the installed copy.

  • Only scan an installed copy, so that a generic app name doesn't match unrelated files, and skip suites of apps rather than guess.

  • Unpacking only helps prefill the template, so warn rather than fail when the download can't be unpacked.

  • Have brew generate-zap --name also match the installed app's bundle identifier, which names most preference and cache files.



  • [x] Have you followed our Contributing guidelines?

  • [x] Have you checked for other open Pull Requests for the same change?

  • [x] Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.

  • [x] Have you explained why you'd like these changes included, not just what they do?

  • [ ] For bug fixes, have you given step-by-step brew commands to reproduce the bug?

  • [x] Have you written new tests (excluding integration tests)? Here's an example.

  • [x] Have you successfully run brew lgtm (style, typechecking and tests) locally?



  • [ ] I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.


Comments Threads Pending Resolution

MikeMcQuaid reviewed and approved this work on October 21, 2026
MikeMcQuaid left a comment

Nice, great work!

coderabbitai[bot] reviewed on October 21, 2026
coderabbitai[bot] reviewed on October 21, 2026
coderabbitai[bot] reviewed on October 21, 2026
coderabbitai[bot] reviewed on October 21, 2026
coderabbitai[bot] left a comment

**Actionable comments posted: 4**

---

ℹ️ Review info

βš™οΈ Run configuration

- **Configuration used**: Organization UI
- **Review profile**: CHILL
- **Plan**: Advanced
- **Run ID**: `7310b9b9-508c-47ae-90be-6136f73ed2c1`

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 59ef86242da3de0ef7b3498f3475cc71c63d9b8e and 109f0157c32992824143a0a207756ca172ce9c35.

πŸ“’ Files selected for processing: 4

* `Library/Homebrew/dev-cmd/create.rb`
* `Library/Homebrew/dev-cmd/generate-zap.rb`
* `Library/Homebrew/test/dev-cmd/create_spec.rb`
* `Library/Homebrew/test/dev-cmd/generate-zap_spec.rb`

**Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Library/Homebrew/dev-cmd/create.rb
218
      def generate_zap_for(app)
219
        return unless app.directory?
220
221
        Utils.popen_read_text(HOMEBREW_BREW_FILE, "generate-zap", "--name", app.basename(".app").to_s, err: :err)
222
             .slice(/^zap (?:trash|delete):.*/m)&.chomp

Resolved Comment Threads

coderabbitai[bot] reviewed on October 21, 2026
coderabbitai[bot] left a comment

**Actionable comments posted: 4**

---

ℹ️ Review info

βš™οΈ Run configuration

- **Configuration used**: Organization UI
- **Review profile**: CHILL
- **Plan**: Advanced
- **Run ID**: `7310b9b9-508c-47ae-90be-6136f73ed2c1`

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 59ef86242da3de0ef7b3498f3475cc71c63d9b8e and 109f0157c32992824143a0a207756ca172ce9c35.

πŸ“’ Files selected for processing: 4

* `Library/Homebrew/dev-cmd/create.rb`
* `Library/Homebrew/dev-cmd/generate-zap.rb`
* `Library/Homebrew/test/dev-cmd/create_spec.rb`
* `Library/Homebrew/test/dev-cmd/generate-zap_spec.rb`

**Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Library/Homebrew/dev-cmd/generate-zap.rb
Outdated
97
      sig { override.void }
98
      def run
99
        patterns = if args.name?
100
          patterns_from_app_paths([Pathname.new("/Applications/#{args.named.fetch(0)}.app")])
Library/Homebrew/dev-cmd/create.rb
Outdated
205
206
          shallowest_app = shallowest_apps.fetch(0)
207
          [shallowest_app.relative_path_from(unpack_dir), find_appcast_for(shallowest_app)]
208
        end
209
      rescue => e
Library/Homebrew/dev-cmd/create.rb
Outdated
134
        end
135
136
        app, appcast = find_app_in(download) if download
137
        installed_app = Pathname("/Applications")/(app&.basename || "#{name}.app")
134 138
        appcast 
||
= find_appcast_for(
installed_app
)