Skip to content

Conversation

@p-linnane
Copy link
Member

  • 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?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

This PR adds a new source command to open source repositories similar to how home opens homepages. Formulae homepages are often upstream marketing sites or documentation pages, which require extra work to get to the repository. The command extracts the repository URL from the formula's head URL, stable URL, or homepage. This initial implementation supports GitHub, GitLab, Bitbucket, Codeberg, and SourceHut.

Copilot AI review requested due to automatic review settings December 29, 2025 20:49
Copy link
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 introduces a new brew source command to open formula source repositories directly in a browser, complementing the existing brew home command which opens project homepages. The implementation extracts repository URLs from formula metadata and supports GitHub, GitLab, Bitbucket, Codeberg, and SourceHut.

Key Changes:

  • Adds repository URL extraction logic with regex patterns for five major hosting platforms
  • Implements fallback strategy checking head URL, stable URL, and homepage in sequence
  • Includes test coverage for basic GitHub scenarios and error handling

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
Library/Homebrew/cmd/source.rb Core command implementation with URL extraction methods for each supported platform
Library/Homebrew/test/cmd/source_spec.rb Test suite covering GitHub URLs and error cases when repository cannot be determined

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

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks, looking good so far!

Signed-off-by: Patrick Linnane <patrick@linnane.io>
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Dec 31, 2025
Merged via the queue into main with commit d460002 Dec 31, 2025
37 checks passed
@MikeMcQuaid MikeMcQuaid deleted the source-new-cmd branch December 31, 2025 09:39
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