Skip to content

feat(brew): add support for font artifact types from git urls - #11781

Merged
jdx merged 1 commit into
jdx:mainfrom
roele:issues/10582
Aug 9, 2026
Merged

jdx merged 1 commit into
jdx:mainfrom
roele:issues/10582

Conversation

@roele

@roele roele commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Homebrew casks can now be installed directly from Git repositories.
    • Casks support selecting a specific Git branch during installation.
    • Added support for extracting and staging files from a configured repository subdirectory.
    • Git metadata is excluded from staged installation files.
  • Bug Fixes

    • Git clone failures now report installation errors clearly.
    • Git-based and archive-based installations provide more consistent file placement and filename handling.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Homebrew casks now support Git sources with optional branch selection and only_path extraction. Installation stages Git and archive sources through one flow. Git metadata is excluded, and integration coverage verifies branch and subpath staging.

Changes

Homebrew cask Git staging

Layer / File(s) Summary
Cask source specifications
src/system/packages/brew/cask.rs
Cask metadata stores optional Git branch and only_path settings. Missing URL specifications receive defaults.
Unified source staging
src/system/packages/brew/cask.rs
Installation uses a shared fetch-and-stage path. .git sources clone the selected branch or HEAD, move selected contents into a clean directory, exclude .git, and report clone failures.
Integration validation and test support
src/system/packages/brew/cask.rs
The integration test creates a local Git repository and verifies branch and subpath staging. Fixtures and macOS chmod calls are updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CaskInstall
  participant GitRepository
  participant StagingDirectory
  CaskInstall->>GitRepository: Clone .git source at selected branch or HEAD
  GitRepository->>StagingDirectory: Copy selected source contents
  StagingDirectory->>CaskInstall: Return clean staged source
  CaskInstall->>CaskInstall: Install from staged source
Loading

Possibly related PRs

  • jdx/mise#11692: Both changes modify archive and source detection in src/system/packages/brew/cask.rs.

Poem

A rabbit clones a branch tonight,
Then trims the path to fit just right.
Git leaves its hidden coat behind,
Clean staged files are what we find.
Tests hop through the flow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title correctly identifies Git URL support, but it narrows the broader cask Git clone changes to font artifact types.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/system/packages/brew/cask.rs (1)

677-683: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add focused tests for the new archive contracts.

Add tests for Git branch URL construction and only_path relocation. Include a missing path and a parent-directory path. These cases prevent regressions that can empty or corrupt the cask extraction cache.

Also applies to: 756-787

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/system/packages/brew/cask.rs` around lines 677 - 683, Add focused tests
covering the new archive contracts around git_tarball_url and the only_path
relocation logic: verify branch-based Git archive URL construction, missing-path
handling, and relocation to a parent-directory path. Keep the tests targeted to
these behaviors and assert outcomes that prevent empty or corrupted cask
extraction caches.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/system/packages/brew/cask.rs`:
- Around line 758-768: Validate cask.url_specs.only_path before constructing
nested: reject empty, absolute, current-directory, and parent-directory
components, and return an error if nested is not a directory. In the
find_extracted_top_dir relocation flow, relocate entries only after validation
succeeds, then remove top_dir only after the relocation completes successfully.

---

Nitpick comments:
In `@src/system/packages/brew/cask.rs`:
- Around line 677-683: Add focused tests covering the new archive contracts
around git_tarball_url and the only_path relocation logic: verify branch-based
Git archive URL construction, missing-path handling, and relocation to a
parent-directory path. Keep the tests targeted to these behaviors and assert
outcomes that prevent empty or corrupted cask extraction caches.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 7fb56f4c-fdec-492f-8c0e-a842f40299e7

📥 Commits

Reviewing files that changed from the base of the PR and between bd7d113 and ceb516d.

📒 Files selected for processing (1)
  • src/system/packages/brew/cask.rs

Comment thread src/system/packages/brew/cask.rs Resolved
@roele
roele marked this pull request as ready for review August 9, 2026 06:35
Copilot AI balanced review requested due to automatic review settings August 9, 2026 06:35
@greptile-apps

greptile-apps Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces archive conversion for .git cask URLs with direct Git cloning, supports branch and repository-subdirectory selection, and excludes Git metadata from staging.

  • Adds deserialization for url_specs.branch and url_specs.only_path.
  • Routes .git URLs through a dedicated clone-and-stage flow.
  • Adds coverage for branch selection and restructuring an only_path directory.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/system/packages/brew/cask.rs Adds Git-backed cask staging with branch and subdirectory support; the previously reported failure for non-GitHub .git URLs is resolved by cloning rather than constructing a GitHub archive URL.

Reviews (4): Last reviewed commit: "feat(brew): add support for font artifac..." | Re-trigger Greptile

Comment thread src/system/packages/brew/cask.rs Resolved

Copilot AI 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.

Pull request overview

This PR extends the built-in Homebrew cask package manager to support casks whose url points at a Git repository (e.g. font casks like powerline/fonts). It teaches mise to translate a .git URL plus a branch into a GitHub archive tarball, download/cache it consistently, and—when an only_path is configured—hoist the contents of a nested subdirectory to the extraction root so the existing artifact-matching logic can find them.

Changes:

  • Adds a CaskUrlSpecs struct (branch, only_path) deserialized from cask metadata and wires it into Cask.
  • Adds git_tarball_url to build a GitHub archive/refs/heads/{branch}.tar.gz URL, used for download, cache filename hashing, and the raw-binary copy path.
  • Adds only_path restructuring in extract_archive (with path-traversal validation) plus a find_extracted_top_dir helper, and unit tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/system/packages/brew/cask.rs Resolved

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/system/packages/brew/cask.rs`:
- Around line 7306-7351: Update the git fixture around the repository setup and
Cask URL specs to explicitly create and select a dedicated non-default branch.
After committing the baseline files in the initial branch, create the test
branch, modify the font content, commit the change there, and set
CaskUrlSpecs.branch to that branch so the test verifies branch selection
independently of Git’s configured default.
- Around line 695-708: The clone setup around CloneOptions must not default
url_specs.branch to "HEAD". Preserve the absent-branch case without calling
CloneOptions::branch, and apply branch only when a concrete branch is present;
continue applying the PR ref through the existing pr handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 3122acc7-adff-472e-813b-e0dcc788e10d

📥 Commits

Reviewing files that changed from the base of the PR and between 7cf186e and ce730b2.

📒 Files selected for processing (1)
  • src/system/packages/brew/cask.rs

Comment thread src/system/packages/brew/cask.rs Resolved
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx merged commit b7f38fe into jdx:main Aug 9, 2026
30 checks passed
@roele
roele deleted the issues/10582 branch August 9, 2026 15:22
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