Skip to content

fix(brew): also recognize legacy "cask: true" metadata key#45

Merged
kevinelliott merged 1 commit intomainfrom
fix/brew-cask-metadata
Apr 25, 2026
Merged

fix(brew): also recognize legacy "cask: true" metadata key#45
kevinelliott merged 1 commit intomainfrom
fix/brew-cask-metadata

Conversation

@kevinelliott
Copy link
Copy Markdown
Owner

Summary

Five catalog entries (`block-goose`, `openclaw`, `droid`, `claude-squad`, `amazon-q-cli`) declare cask-ness via `metadata.cask: "true"` rather than the canonical `metadata.type: "cask"`. `parseBrewPackage` only checked the canonical key, so `brew install` ran without `--cask` for those agents and Homebrew rejected them as unknown formulae.

`parseBrewPackage` now accepts either form:

  • `"type": "cask"` (canonical)
  • `"cask": "true"` (legacy, also common in user-customized catalogs)

Why no catalog edits

`brew install/upgrade/uninstall` already build their own arg lists from `isCask` — the `command`/`update_cmd`/`uninstall_cmd` strings in the catalog are documentation only. With the parser fix, all five existing entries Just Work; bumping the catalog version to canonicalize would force a refresh round-trip without changing behavior.

Tests

`TestBrewProviderParseBrewPackage` extended with three new cases:

  • `cask from metadata (legacy cask=true)`
  • `cask metadata both keys agree` (canonical wins, no false-negative)
  • `cask=false metadata not a cask` (truthy check is strict)

Closes

Copilot review comment on PR #28 (catalog.json:707).

🤖 Generated with Claude Code

Five catalog entries (block-goose, openclaw, droid, claude-squad,
amazon-q-cli at lines 468/706/2149/2212/2630) declare cask-ness via
metadata.cask: "true" rather than the canonical metadata.type: "cask".
parseBrewPackage only checked the canonical key, so "brew install"
ran without --cask for those agents and Homebrew rejected them as
unknown formulae.

Now accepts either form:
  - "type": "cask"  (canonical)
  - "cask": "true"  (legacy, common in user-customized catalogs too)

Provider behavior change is the entire fix — no catalog edits needed.
brew install/upgrade/uninstall already build their own arg lists
from isCask, so the catalog command/update_cmd strings (which lack
--cask for these legacy entries) are documentation only.

Closes the corresponding Copilot review comment from PR #28.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 25, 2026 02:00
Copy link
Copy Markdown

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

Updates the Homebrew installer provider to correctly treat certain catalog entries as casks when they use the legacy metadata.cask: "true" flag, ensuring brew install/upgrade/uninstall includes --cask where needed.

Changes:

  • Extend parseBrewPackage cask detection to accept both metadata.type == "cask" and legacy metadata.cask == "true".
  • Add/adjust unit tests for canonical and legacy cask metadata handling.

Reviewed changes

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

File Description
pkg/installer/providers/brew.go Updates cask detection logic (and adds documentation) in parseBrewPackage.
pkg/installer/providers/providers_test.go Extends TestBrewProviderParseBrewPackage with new cask-metadata cases.

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

Comment on lines +189 to +192
// Cask is detected from method.Metadata using either of two keys:
// - "type": "cask" — canonical form, used by current catalog entries
// - "cask": "true" — legacy form, accepted for back-compat with custom
// user catalogs and historical catalog entries
Comment on lines +199 to 204
// Check metadata for cask indicator (both canonical and legacy forms).
if method.Metadata != nil {
if method.Metadata["type"] == "cask" {
if method.Metadata["type"] == "cask" || method.Metadata["cask"] == "true" {
isCask = true
}
}
Comment on lines +1053 to +1056
name: "cask metadata both keys agree",
method: catalog.InstallMethodDef{
Package: "firefox",
Metadata: map[string]string{"type": "cask", "cask": "true"},
@kevinelliott kevinelliott merged commit 56bd082 into main Apr 25, 2026
16 checks passed
@kevinelliott kevinelliott deleted the fix/brew-cask-metadata branch April 25, 2026 02:08
kevinelliott added a commit that referenced this pull request Apr 25, 2026
Patch release. The notable shipping fix is the brew cask metadata
recognition (#45) — five catalog entries declared cask-ness via the
legacy "cask: true" key that the parser ignored, so brew install
ran without --cask and Homebrew rejected those agents. Also rolls
up the broader review-feedback batch in #44 (race fix, ctx-error
caching, concurrent-write safety, /usr/share probe path, removed
dead --all/--check-updates flags, etc.).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants