Skip to content

Align ask dry-run prompts#22353

Merged
MikeMcQuaid merged 1 commit into
mainfrom
ask-dry-run-prompts
May 20, 2026
Merged

Align ask dry-run prompts#22353
MikeMcQuaid merged 1 commit into
mainfrom
ask-dry-run-prompts

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

  • Use dry-run-style --ask plans for install and reinstall commands.
  • Make single-package operations proceed without a prompt e.g. if you brew install foo and there's no dependencies or dependents to install: just install without the prompt.
  • Keep prompting when dependencies or dependents change the plan.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

OpenAI Codex 5.5 xhigh with local review and testing.


Copilot AI review requested due to automatic review settings May 20, 2026 13:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts --ask behavior for install/reinstall/upgrade to use --dry-run-style “Would …” plans, and to only prompt when the plan extends beyond what the user explicitly requested (e.g., dependencies/dependents).

Changes:

  • Reworked Install.ask_formulae/ask_casks output to match dry-run-style plans and introduced shared prompt decision logic (ask_prompt_needed?).
  • Updated brew install/reinstall to pass explicit flags into ask_formulae (instead of passing args) and updated CLI help text + specs to match new output.
  • Updated brew upgrade --ask to decide prompting based on the final dry-run plan vs. requested names, including dependency/dependent-driven plan expansion.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Library/Homebrew/install.rb Refactors --ask plan printing and introduces shared prompt gating logic.
Library/Homebrew/cmd/install.rb Uses new ask_formulae signature; --ask help text now references dry-run plan.
Library/Homebrew/cmd/reinstall.rb Uses new ask_formulae signature; --ask help text simplified to dry-run-style description.
Library/Homebrew/cmd/upgrade.rb Adds prompt gating based on planned vs requested upgrades and tracks whether dependencies require prompting.
Library/Homebrew/test/cmd/install_spec.rb Updates expectations to dry-run-style output and adds prompt-rule coverage.
Library/Homebrew/test/cmd/reinstall_spec.rb Updates --ask output expectation to new “Would reinstall …” format.
Library/Homebrew/test/cmd/upgrade_spec.rb Adds coverage that explicitly-named upgrades don’t prompt when nothing else changes the plan.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/install.rb Outdated
Comment thread Library/Homebrew/test/cmd/install_spec.rb
Comment thread Library/Homebrew/cmd/upgrade.rb Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread Library/Homebrew/cmd/upgrade.rb Outdated
- Use dry-run-style `--ask` plans for install and reinstall commands.
- Make single-package operations proceed without a prompt e.g. if you
  `brew install foo` and there's no dependencies or dependents to install:
  just install without the prompt.
- Keep prompting when dependencies or dependents change the plan.
@MikeMcQuaid MikeMcQuaid force-pushed the ask-dry-run-prompts branch from b0af8d5 to 49a2911 Compare May 20, 2026 14:28
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit c788485 May 20, 2026
36 checks passed
@MikeMcQuaid MikeMcQuaid deleted the ask-dry-run-prompts branch May 20, 2026 15:30
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.

3 participants