opencode-homebrew-agent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +175 -0
- package/agents/brew.md +146 -0
- package/package.json +22 -0
- package/src/AGENTS.md +172 -0
- package/src/scripts/brew-analyze.sh +373 -0
- package/src/scripts/brew-deps.sh +140 -0
- package/src/scripts/brew-env.sh +288 -0
- package/src/scripts/brew-search.sh +150 -0
- package/src/scripts/brew-template.sh +263 -0
- package/src/scripts/package.json +21 -0
- package/src/skills/homebrew-agent/SKILL.md +203 -0
- package/src/skills/homebrew-tap/SKILL.md +97 -0
- package/src/templates/taps/01-full-ci/AGENTS.md +71 -0
- package/src/templates/taps/01-full-ci/tap-structure/.github/workflows/autobump.yml +24 -0
- package/src/templates/taps/01-full-ci/tap-structure/.github/workflows/publish.yml +33 -0
- package/src/templates/taps/01-full-ci/tap-structure/.github/workflows/tests.yml +33 -0
- package/src/templates/taps/01-full-ci/tap-structure/Formula/_formula.rb +31 -0
- package/src/templates/taps/01-full-ci/tap-structure/README.md +27 -0
- package/src/templates/taps/01-full-ci/tap-structure/cmd/.gitkeep +0 -0
- package/src/templates/taps/01-full-ci/tap-structure/formula_renames.json +1 -0
- package/src/templates/taps/01-full-ci/tap-structure/lib/.gitkeep +0 -0
- package/src/templates/taps/01-full-ci/tap-structure/require/.gitkeep +0 -0
- package/src/templates/taps/01-full-ci/tap-structure/tap_migrations.json +1 -0
- package/src/templates/taps/01-full-ci/template.md +45 -0
- package/src/templates/taps/02-root-level/AGENTS.md +72 -0
- package/src/templates/taps/02-root-level/tap-structure/README.md +27 -0
- package/src/templates/taps/02-root-level/tap-structure/_formula.rb +29 -0
- package/src/templates/taps/02-root-level/template.md +35 -0
- package/src/templates/taps/03-simple-script/AGENTS.md +71 -0
- package/src/templates/taps/03-simple-script/tap-structure/Formula/_formula.rb +27 -0
- package/src/templates/taps/03-simple-script/tap-structure/README.md +27 -0
- package/src/templates/taps/03-simple-script/tap-structure/scripts/release.rb +46 -0
- package/src/templates/taps/03-simple-script/template.md +41 -0
- package/src/templates/taps/04-python-venv/AGENTS.md +83 -0
- package/src/templates/taps/04-python-venv/tap-structure/Formula/_formula.rb +57 -0
- package/src/templates/taps/04-python-venv/tap-structure/README.md +27 -0
- package/src/templates/taps/04-python-venv/tap-structure/scripts/release.rb +44 -0
- package/src/templates/taps/04-python-venv/template.md +58 -0
- package/src/templates/taps/05-node-npm/AGENTS.md +90 -0
- package/src/templates/taps/05-node-npm/tap-structure/Formula/_formula.rb +46 -0
- package/src/templates/taps/05-node-npm/tap-structure/README.md +27 -0
- package/src/templates/taps/05-node-npm/tap-structure/scripts/release.rb +40 -0
- package/src/templates/taps/05-node-npm/template.md +74 -0
- package/src/templates/taps/06-keg-only/AGENTS.md +82 -0
- package/src/templates/taps/06-keg-only/tap-structure/Formula/_formula.rb +45 -0
- package/src/templates/taps/06-keg-only/tap-structure/README.md +27 -0
- package/src/templates/taps/06-keg-only/template.md +60 -0
- package/src/templates/taps/07-cask-only/AGENTS.md +97 -0
- package/src/templates/taps/07-cask-only/tap-structure/Casks/_app.rb +26 -0
- package/src/templates/taps/07-cask-only/tap-structure/README.md +27 -0
- package/src/templates/taps/07-cask-only/template.md +58 -0
- package/src/templates/taps/08-go-binary/AGENTS.md +86 -0
- package/src/templates/taps/08-go-binary/tap-structure/Formula/_formula.rb +40 -0
- package/src/templates/taps/08-go-binary/tap-structure/README.md +27 -0
- package/src/templates/taps/08-go-binary/tap-structure/scripts/release.rb +38 -0
- package/src/templates/taps/08-go-binary/template.md +60 -0
- package/src/workflows/analyze-source.sh +124 -0
- package/src/workflows/convert-npm-to-bun.sh +112 -0
- package/src/workflows/create-tap.sh +196 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
# JavaScript/TypeScript CLI formula — npm or bun pattern.
|
|
3
|
+
# Replace <formula>, <description>, <url>, <sha256> with real values.
|
|
4
|
+
# IMPORTANT: Rename class <Formula> to CamelCase matching the filename (e.g., MyTool for my-tool.rb).
|
|
5
|
+
|
|
6
|
+
class <Formula> < Formula
|
|
7
|
+
desc "<one-line description>"
|
|
8
|
+
homepage "https://github.com/<user>/<repo>"
|
|
9
|
+
url "https://github.com/<user>/<repo>/archive/refs/tags/v<version>.tar.gz"
|
|
10
|
+
sha256 "<sha256>"
|
|
11
|
+
version "<version>"
|
|
12
|
+
license "MIT"
|
|
13
|
+
|
|
14
|
+
livecheck do
|
|
15
|
+
url :stable
|
|
16
|
+
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# ---- npm pattern (uncomment if using npm) ----
|
|
20
|
+
# depends_on "node"
|
|
21
|
+
#
|
|
22
|
+
# def install
|
|
23
|
+
# system "npm", "install", *std_npm_args
|
|
24
|
+
# bin.install_symlink Dir["#{libexec}/bin/*"]
|
|
25
|
+
# end
|
|
26
|
+
|
|
27
|
+
# ---- bun pattern (uncomment if using bun) ----
|
|
28
|
+
# depends_on "bun"
|
|
29
|
+
#
|
|
30
|
+
# def install
|
|
31
|
+
# system "bun", "install", "--production"
|
|
32
|
+
# bin.install_symlink Dir["#{libexec}/bin/*"]
|
|
33
|
+
# end
|
|
34
|
+
|
|
35
|
+
# ---- bun compiled binary pattern (uncomment if compiling with bun) ----
|
|
36
|
+
# depends_on "bun"
|
|
37
|
+
#
|
|
38
|
+
# def install
|
|
39
|
+
# system "bun", "install"
|
|
40
|
+
# system "bun", "build", "--compile", "--outfile=#{bin}/<cli>", "./src/index.ts"
|
|
41
|
+
# end
|
|
42
|
+
|
|
43
|
+
test do
|
|
44
|
+
assert_match "<expected>", shell_output("#{bin}/<cli> --version")
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# <Tap Name>
|
|
2
|
+
|
|
3
|
+
Homebrew tap for <formula>.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
brew tap <user>/<tapname>
|
|
9
|
+
brew install <formula>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Upgrade
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
brew upgrade <formula>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Uninstall
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
brew uninstall <formula>
|
|
22
|
+
brew untap <user>/<tapname>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
MIT
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# Version bump script for JS Runtime formula.
|
|
5
|
+
# Usage: ruby scripts/update-formula.rb <version>
|
|
6
|
+
|
|
7
|
+
require "open-uri"
|
|
8
|
+
require "digest"
|
|
9
|
+
|
|
10
|
+
TAP_DIR = File.dirname(__dir__)
|
|
11
|
+
FORMULA_FILE = File.join(TAP_DIR, "Formula", "_formula.rb") # rename to your formula name
|
|
12
|
+
|
|
13
|
+
def usage
|
|
14
|
+
puts "Usage: ruby scripts/update-formula.rb <version>"
|
|
15
|
+
puts " e.g., ruby scripts/update-formula.rb 1.2.3"
|
|
16
|
+
exit 1
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def fetch_sha256(url)
|
|
20
|
+
uri = URI.parse(url)
|
|
21
|
+
puts " Downloading #{url}..."
|
|
22
|
+
content = URI.open(uri).read
|
|
23
|
+
Digest::SHA256.hexdigest(content)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
version = ARGV.first || usage()
|
|
27
|
+
# NOTE: This URL assumes GitHub releases. For npm-published tools, use:
|
|
28
|
+
# tarball_url = "https://registry.npmjs.org/<package>/-/package-#{version}.tgz"
|
|
29
|
+
tarball_url = "https://github.com/<user>/<repo>/archive/refs/tags/v#{version}.tar.gz"
|
|
30
|
+
|
|
31
|
+
puts "Updating Formula/<formula>.rb to version #{version}..."
|
|
32
|
+
sha = fetch_sha256(tarball_url)
|
|
33
|
+
|
|
34
|
+
formula_content = File.read(FORMULA_FILE)
|
|
35
|
+
formula_content.sub!(/version "\d+\.\d+\.\d+"/, "version \"#{version}\"")
|
|
36
|
+
formula_content.sub!(/sha256 "[0-9a-f]{64}"/, "sha256 \"#{sha}\"")
|
|
37
|
+
|
|
38
|
+
File.write(FORMULA_FILE, formula_content)
|
|
39
|
+
puts "Done. Formula updated to v#{version}."
|
|
40
|
+
puts "Review: git diff Formula/<formula>.rb"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Template 05: JavaScript Runtime (npm + bun)
|
|
2
|
+
|
|
3
|
+
## Pattern: CLI tools distributed via npm or built with bun
|
|
4
|
+
|
|
5
|
+
For JavaScript/TypeScript CLI tools. Two sub-patterns depending on the
|
|
6
|
+
runtime/bundler:
|
|
7
|
+
|
|
8
|
+
- **npm pattern**: `depends_on "node"` + `std_npm_args` (standard Homebrew convention)
|
|
9
|
+
- **bun pattern**: `depends_on "bun"` + `bun install`/`bun build` (for bun-native toolchains)
|
|
10
|
+
|
|
11
|
+
### Structure
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
homebrew-<tap>/
|
|
15
|
+
├── Formula/
|
|
16
|
+
│ └── <formula>.rb # Formula with depends_on "node" or "bun"
|
|
17
|
+
├── scripts/
|
|
18
|
+
│ └── release.rb # (optional) Version bump script
|
|
19
|
+
├── .gitignore
|
|
20
|
+
├── LICENSE
|
|
21
|
+
└── README.md
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Key Formula Patterns
|
|
25
|
+
|
|
26
|
+
**npm-based** (standard — for packages distributed via npm registry):
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
depends_on "node"
|
|
30
|
+
|
|
31
|
+
def install
|
|
32
|
+
system "npm", "install", *std_npm_args
|
|
33
|
+
bin.install_symlink Dir["#{libexec}/bin/*"]
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**bun-based** (for bun-native tools or when bun produces smaller builds):
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
depends_on "bun"
|
|
41
|
+
|
|
42
|
+
def install
|
|
43
|
+
# Install dependencies and build
|
|
44
|
+
system "bun", "install"
|
|
45
|
+
system "bun", "build", "--compile", "--outfile=#{bin}/<cli-name>", "./src/index.ts"
|
|
46
|
+
|
|
47
|
+
# Or for a simpler install (package with bin field):
|
|
48
|
+
# system "bun", "install", "--production"
|
|
49
|
+
# bin.install_symlink Dir["#{libexec}/bin/*"]
|
|
50
|
+
end
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
See also: `scripts/` can include `bunx` stubs that invoke `bunx <package>`
|
|
54
|
+
without requiring the package to be installed globally.
|
|
55
|
+
|
|
56
|
+
### When to Use
|
|
57
|
+
|
|
58
|
+
- **npm**: Your CLI tool is published to npm and uses Node.js runtime
|
|
59
|
+
- **bun**: Your tool uses bun as runtime, or bun is specifically required/bundled
|
|
60
|
+
- **Either**: You want Homebrew as the install method instead of `npm install -g` / `bun install -g`
|
|
61
|
+
|
|
62
|
+
### When NOT to Use
|
|
63
|
+
|
|
64
|
+
- The tool has native C++ extensions (may need additional build deps like `pkgconf`)
|
|
65
|
+
- The tool is a Python CLI (use template 04 instead)
|
|
66
|
+
|
|
67
|
+
### Reference
|
|
68
|
+
|
|
69
|
+
- `std_npm_args` is a Homebrew helper that sets `--prefix`, `--global`, `--no-save`
|
|
70
|
+
- `depends_on "bun"` — bun is a formula in `oven-sh/homebrew-bun` tap
|
|
71
|
+
- `bun build --compile` produces a standalone binary (no runtime dep needed)
|
|
72
|
+
- For bun packages: `bun install --production` only installs runtime deps (no devDependencies)
|
|
73
|
+
|
|
74
|
+
- Start with `brew tap-new <user>/homebrew-<tapname>` to generate the CI skeleton (optional — manual structure works too)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homebrew-tap-keg-only
|
|
3
|
+
description: Creates and maintains Homebrew taps for system tool replacements that are keg-only (not symlinked into PATH).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# homebrew-tap-keg-only
|
|
7
|
+
|
|
8
|
+
Agent for working with Keg-Only System Tool tap templates.
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
Helps create and maintain Homebrew taps for system tool replacements that are keg-only (not symlinked into PATH) with caveats explaining PATH setup.
|
|
12
|
+
|
|
13
|
+
## Stacks
|
|
14
|
+
- homebrew
|
|
15
|
+
- ruby
|
|
16
|
+
|
|
17
|
+
## Requires
|
|
18
|
+
- basic-homebrew-knowledge
|
|
19
|
+
|
|
20
|
+
## Key Actions
|
|
21
|
+
|
|
22
|
+
### keg_only Declaration
|
|
23
|
+
```ruby
|
|
24
|
+
keg_only "this is an alternate version of another formula"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### PATH Caveat
|
|
28
|
+
```ruby
|
|
29
|
+
def caveats
|
|
30
|
+
<<~EOS
|
|
31
|
+
<command> is keg-only, which means it was not symlinked into
|
|
32
|
+
#{HOMEBREW_PREFIX}, because this is an alternate version of
|
|
33
|
+
another formula.
|
|
34
|
+
|
|
35
|
+
If you need to have <command> first in your PATH, run:
|
|
36
|
+
echo 'export PATH="#{opt_bin}:$PATH"' >> ~/.zshrc
|
|
37
|
+
EOS
|
|
38
|
+
end
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### GNU Prefix Convention
|
|
42
|
+
Use `--program-prefix=g` with GNU configure scripts to shadow system binaries safely.
|
|
43
|
+
|
|
44
|
+
### Permissions
|
|
45
|
+
- Read/write to `Formula/`
|
|
46
|
+
- No special permissions needed beyond standard formula creation
|
|
47
|
+
|
|
48
|
+
### Common Pitfalls
|
|
49
|
+
|
|
50
|
+
- `keg_only` reason must explain WHY the formula conflicts with a system binary (e.g., "this is an alternate version of another formula"). Vague reasons will fail `brew audit`.
|
|
51
|
+
- Always provide `def caveats` with a PATH export example. Users won't know the tool is installed otherwise.
|
|
52
|
+
- GNU tools should use `--program-prefix=g` to avoid shadowing `/usr/bin/<tool>` on macOS.
|
|
53
|
+
|
|
54
|
+
### LSP Validation
|
|
55
|
+
|
|
56
|
+
Before finishing any formula, validate with the Ruby LSP:
|
|
57
|
+
|
|
58
|
+
1. Ensure LSP is available:
|
|
59
|
+
```sh
|
|
60
|
+
ruby-lsp --version # Verify LSP is installed
|
|
61
|
+
```
|
|
62
|
+
2. Run syntax check:
|
|
63
|
+
```sh
|
|
64
|
+
ruby -c Formula/<formula>.rb
|
|
65
|
+
```
|
|
66
|
+
3. Run Homebrew linting:
|
|
67
|
+
```sh
|
|
68
|
+
brew style --tap <user>/<tapname> Formula/<formula>.rb
|
|
69
|
+
```
|
|
70
|
+
4. Run formula audit:
|
|
71
|
+
```sh
|
|
72
|
+
brew audit --new-formula Formula/<formula>.rb
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Do NOT mark work as complete until all diagnostics pass.
|
|
76
|
+
|
|
77
|
+
### Verification
|
|
78
|
+
```sh
|
|
79
|
+
ruby -c Formula/<formula>.rb
|
|
80
|
+
brew style --tap <user>/<tapname> Formula/<formula>.rb
|
|
81
|
+
brew audit --strict Formula/<formula>.rb
|
|
82
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
# Keg-only system tool formula.
|
|
3
|
+
# Replace <formula>, <description>, <url>, <sha256> with real values.
|
|
4
|
+
# IMPORTANT: Rename class <Formula> to CamelCase matching the filename (e.g., MyTool for my-tool.rb).
|
|
5
|
+
|
|
6
|
+
class <Formula> < Formula
|
|
7
|
+
desc "<one-line description>"
|
|
8
|
+
homepage "https://github.com/<user>/<repo>"
|
|
9
|
+
url "https://github.com/<user>/<repo>/archive/refs/tags/v<version>.tar.gz"
|
|
10
|
+
sha256 "<sha256>"
|
|
11
|
+
version "<version>"
|
|
12
|
+
license "<license>"
|
|
13
|
+
|
|
14
|
+
livecheck do
|
|
15
|
+
url :stable
|
|
16
|
+
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
keg_only "this is an alternate version of another formula"
|
|
20
|
+
|
|
21
|
+
# Optional: GNU prefix to avoid shadowing macOS system binaries
|
|
22
|
+
# depends_on "autoconf" => :build
|
|
23
|
+
# depends_on "automake" => :build
|
|
24
|
+
|
|
25
|
+
def install
|
|
26
|
+
# GNU-style --program-prefix avoids collision with /usr/bin/<tool>
|
|
27
|
+
system "./configure", "--prefix=#{prefix}", "--program-prefix=g"
|
|
28
|
+
system "make", "install"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def caveats
|
|
32
|
+
<<~EOS
|
|
33
|
+
<formula> is keg-only, which means it was not symlinked into
|
|
34
|
+
#{HOMEBREW_PREFIX}, because this is an alternate version of
|
|
35
|
+
another formula.
|
|
36
|
+
|
|
37
|
+
If you need to have <formula> first in your PATH, run:
|
|
38
|
+
echo 'export PATH="#{opt_bin}:$PATH"' >> ~/.zshrc
|
|
39
|
+
EOS
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
test do
|
|
43
|
+
assert_match "<expected>", shell_output("#{bin}/g<cli> --version")
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# <Tap Name>
|
|
2
|
+
|
|
3
|
+
Homebrew tap for <formula>.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
brew tap <user>/<tapname>
|
|
9
|
+
brew install <formula>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Upgrade
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
brew upgrade <formula>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Uninstall
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
brew uninstall <formula>
|
|
22
|
+
brew untap <user>/<tapname>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
MIT
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Template 06: Keg-Only System Tool
|
|
2
|
+
|
|
3
|
+
## Pattern: `homebrew-core` keg-only formulae (e.g., `gnuwhich`, `coreutils`)
|
|
4
|
+
|
|
5
|
+
For tools that provide alternative versions of common system utilities.
|
|
6
|
+
These are typically `keg_only` (not symlinked into PATH) with caveats
|
|
7
|
+
telling the user how to add them to their PATH. Often have a `gnubin/`
|
|
8
|
+
and `gnuman/` directory structure.
|
|
9
|
+
|
|
10
|
+
### Structure
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
homebrew-<tap>/
|
|
14
|
+
├── Formula/
|
|
15
|
+
│ └── <formula>.rb # Formula with keg_only + caveats
|
|
16
|
+
├── .gitignore
|
|
17
|
+
├── LICENSE
|
|
18
|
+
└── README.md
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Key Formula Pattern
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
keg_only "this is an alternate version of another formula"
|
|
25
|
+
|
|
26
|
+
def install
|
|
27
|
+
system "./configure", "--prefix=#{prefix}", "--program-prefix=g"
|
|
28
|
+
system "make", "install"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def caveats
|
|
32
|
+
<<~EOS
|
|
33
|
+
<command> is keg-only, which means it was not symlinked into
|
|
34
|
+
#{HOMEBREW_PREFIX}, because this is an alternate version of
|
|
35
|
+
another formula.
|
|
36
|
+
|
|
37
|
+
If you need to have <command> first in your PATH, run:
|
|
38
|
+
echo 'export PATH="#{opt_bin}:$PATH"' >> ~/.zshrc
|
|
39
|
+
EOS
|
|
40
|
+
end
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### When to Use
|
|
44
|
+
|
|
45
|
+
- You're packaging a newer/macOS-specific version of a system tool
|
|
46
|
+
- The formula shadows an existing macOS binary (`/usr/bin/<tool>`)
|
|
47
|
+
- You want the `--program-prefix=g` convention (GNU-style)
|
|
48
|
+
|
|
49
|
+
### When NOT to Use
|
|
50
|
+
|
|
51
|
+
- There's no conflict with system binaries (use template 01 or 03 instead)
|
|
52
|
+
- The tool has no macOS equivalent
|
|
53
|
+
|
|
54
|
+
### Reference
|
|
55
|
+
|
|
56
|
+
- `keg_only` prevents symlinking into `HOMEBREW_PREFIX/bin`
|
|
57
|
+
- Caveats explain how to add to PATH
|
|
58
|
+
- GNU tools typically use `--program-prefix=g` to avoid shadowing system versions
|
|
59
|
+
|
|
60
|
+
- Start with `brew tap-new <user>/homebrew-<tapname>` to generate the CI skeleton (optional — manual structure works too)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homebrew-tap-cask-only
|
|
3
|
+
description: Creates and maintains Homebrew taps for macOS GUI applications using the Cask DSL.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# homebrew-tap-cask-only
|
|
7
|
+
|
|
8
|
+
Agent for working with Cask-Only tap templates.
|
|
9
|
+
|
|
10
|
+
## Description
|
|
11
|
+
Helps create and maintain Homebrew taps for macOS GUI applications using the Cask DSL.
|
|
12
|
+
|
|
13
|
+
## Stacks
|
|
14
|
+
- homebrew
|
|
15
|
+
- ruby
|
|
16
|
+
|
|
17
|
+
## Requires
|
|
18
|
+
- basic-homebrew-knowledge
|
|
19
|
+
|
|
20
|
+
## Key Actions
|
|
21
|
+
|
|
22
|
+
### Cask Structure
|
|
23
|
+
Casks go in `Casks/` directory (not `Formula/`). The DSL is different from formula:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
cask "<app-name>" do
|
|
27
|
+
version "<version>"
|
|
28
|
+
sha256 "<sha256>"
|
|
29
|
+
url "https://..."
|
|
30
|
+
name "<App Name>"
|
|
31
|
+
desc "Description"
|
|
32
|
+
homepage "https://..."
|
|
33
|
+
app "<App>.app"
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Install Command
|
|
38
|
+
```sh
|
|
39
|
+
brew install --cask <user>/<tap>/<app>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Livecheck Strategies
|
|
43
|
+
Casks use different livecheck strategies than formulae:
|
|
44
|
+
- `strategy :github_latest` — for GitHub releases
|
|
45
|
+
- `strategy :page_match` — for pages with version numbers in HTML
|
|
46
|
+
- `strategy :sparkle` — for apps using Sparkle auto-update framework
|
|
47
|
+
|
|
48
|
+
### Zap vs Uninstall
|
|
49
|
+
- `zap` defines cleanup paths for user data (Preferences, Caches, etc.)
|
|
50
|
+
- `uninstall` handles app removal, pkg scripts, and launch jobs
|
|
51
|
+
- Use both for complete removal: `brew uninstall --zap --cask <app>`
|
|
52
|
+
|
|
53
|
+
### Architecture Support
|
|
54
|
+
For universal binaries or separate Intel/Apple Silicon builds:
|
|
55
|
+
```ruby
|
|
56
|
+
arch arm: "arm64", intel: "x64"
|
|
57
|
+
url "https://.../#{arch}/<app>.dmg"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Permissions
|
|
61
|
+
- Read/write to `Casks/` directory
|
|
62
|
+
|
|
63
|
+
### Common Pitfalls
|
|
64
|
+
|
|
65
|
+
- Cask filenames must be lowercase with hyphens (e.g., `my-app.rb` → `cask "my-app"`)
|
|
66
|
+
- The `sha256` must match the downloaded `.dmg`/`.zip`/`.pkg` file, not the app bundle
|
|
67
|
+
- `livecheck` `url :url` points to the cask's download URL — use `url :stable` or an explicit GitHub releases URL instead
|
|
68
|
+
- Always test `brew install --cask` and `brew uninstall --cask` before committing
|
|
69
|
+
|
|
70
|
+
### LSP Validation
|
|
71
|
+
|
|
72
|
+
Before finishing any cask, validate with the Ruby LSP:
|
|
73
|
+
|
|
74
|
+
1. Ensure LSP is available:
|
|
75
|
+
```sh
|
|
76
|
+
ruby-lsp --version # Verify LSP is installed
|
|
77
|
+
```
|
|
78
|
+
2. Run syntax check:
|
|
79
|
+
```sh
|
|
80
|
+
ruby -c Casks/<app>.rb
|
|
81
|
+
```
|
|
82
|
+
3. Run Homebrew linting:
|
|
83
|
+
```sh
|
|
84
|
+
brew style --tap <user>/<tapname> Casks/<app>.rb
|
|
85
|
+
```
|
|
86
|
+
4. Run new-cask audit:
|
|
87
|
+
```sh
|
|
88
|
+
brew audit --new-cask Casks/<app>.rb
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Do NOT mark work as complete until all diagnostics pass.
|
|
92
|
+
|
|
93
|
+
### Verification
|
|
94
|
+
```sh
|
|
95
|
+
ruby -c Casks/<app>.rb
|
|
96
|
+
brew style --tap <user>/<tapname> Casks/<app>.rb
|
|
97
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
# Cask template for macOS GUI applications.
|
|
3
|
+
# Replace <app>, <version>, <sha256>, <url> with real values.
|
|
4
|
+
|
|
5
|
+
cask "<app>" do
|
|
6
|
+
version "<version>"
|
|
7
|
+
sha256 "<sha256>"
|
|
8
|
+
|
|
9
|
+
url "https://github.com/<user>/<repo>/releases/download/v#{version}/<app>.dmg"
|
|
10
|
+
name "<App Name>"
|
|
11
|
+
desc "<one-line description>"
|
|
12
|
+
homepage "https://github.com/<user>/<repo>"
|
|
13
|
+
|
|
14
|
+
livecheck do
|
|
15
|
+
url :stable
|
|
16
|
+
strategy :github_latest
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
app "<App>.app"
|
|
20
|
+
|
|
21
|
+
zap trash: [
|
|
22
|
+
"~/Library/Application Support/<app>",
|
|
23
|
+
"~/Library/Preferences/<app>.plist",
|
|
24
|
+
"~/Library/Caches/<app>",
|
|
25
|
+
]
|
|
26
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# <Tap Name>
|
|
2
|
+
|
|
3
|
+
Homebrew tap for <app>.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
brew tap <user>/<tapname>
|
|
9
|
+
brew install --cask <app>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Upgrade
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
brew upgrade --cask <app>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Uninstall
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
brew uninstall --cask <app>
|
|
22
|
+
brew untap <user>/<tapname>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
MIT
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Template 07: Cask-Only
|
|
2
|
+
|
|
3
|
+
## Pattern: Personal cask taps for GUI applications
|
|
4
|
+
|
|
5
|
+
For macOS GUI applications distributed as `.app` bundles, `.dmg` files,
|
|
6
|
+
or `.pkg` installers. Uses Homebrew Cask DSL instead of the formula DSL.
|
|
7
|
+
|
|
8
|
+
### Structure
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
homebrew-<tap>/
|
|
12
|
+
├── Casks/
|
|
13
|
+
│ └── <app>.rb # Cask definition (not a formula)
|
|
14
|
+
├── .gitignore
|
|
15
|
+
├── LICENSE
|
|
16
|
+
└── README.md
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Key Cask Pattern
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
cask "<app-name>" do
|
|
23
|
+
version "<version>"
|
|
24
|
+
sha256 "<sha256>"
|
|
25
|
+
|
|
26
|
+
url "https://github.com/<user>/<repo>/releases/download/v#{version}/<app>.dmg"
|
|
27
|
+
name "<App Name>"
|
|
28
|
+
desc "Description of the application"
|
|
29
|
+
homepage "https://github.com/<user>/<repo>"
|
|
30
|
+
|
|
31
|
+
app "<App>.app"
|
|
32
|
+
|
|
33
|
+
zap trash: [
|
|
34
|
+
"~/Library/Application Support/<app>",
|
|
35
|
+
"~/Library/Preferences/<app>.plist",
|
|
36
|
+
]
|
|
37
|
+
end
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### When to Use
|
|
41
|
+
|
|
42
|
+
- You distribute a macOS GUI application
|
|
43
|
+
- You want users to install via `brew install --cask <user>/<tap>/<app>`
|
|
44
|
+
- The app comes as `.app`, `.dmg`, or `.pkg`
|
|
45
|
+
|
|
46
|
+
### When NOT to Use
|
|
47
|
+
|
|
48
|
+
- Your tool is CLI-only (use a formula template instead)
|
|
49
|
+
- The app is already in `homebrew/cask`
|
|
50
|
+
|
|
51
|
+
### Reference
|
|
52
|
+
|
|
53
|
+
- Casks go in `Casks/` directory, not `Formula/`
|
|
54
|
+
- Use `brew install --cask` to install
|
|
55
|
+
- `zap` block defines uninstall cleanup paths
|
|
56
|
+
- `app` stanza moves the `.app` to `/Applications`
|
|
57
|
+
|
|
58
|
+
- Start with `brew tap-new <user>/homebrew-<tapname>` to generate the CI skeleton (optional — manual structure works too)
|