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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +175 -0
  3. package/agents/brew.md +146 -0
  4. package/package.json +22 -0
  5. package/src/AGENTS.md +172 -0
  6. package/src/scripts/brew-analyze.sh +373 -0
  7. package/src/scripts/brew-deps.sh +140 -0
  8. package/src/scripts/brew-env.sh +288 -0
  9. package/src/scripts/brew-search.sh +150 -0
  10. package/src/scripts/brew-template.sh +263 -0
  11. package/src/scripts/package.json +21 -0
  12. package/src/skills/homebrew-agent/SKILL.md +203 -0
  13. package/src/skills/homebrew-tap/SKILL.md +97 -0
  14. package/src/templates/taps/01-full-ci/AGENTS.md +71 -0
  15. package/src/templates/taps/01-full-ci/tap-structure/.github/workflows/autobump.yml +24 -0
  16. package/src/templates/taps/01-full-ci/tap-structure/.github/workflows/publish.yml +33 -0
  17. package/src/templates/taps/01-full-ci/tap-structure/.github/workflows/tests.yml +33 -0
  18. package/src/templates/taps/01-full-ci/tap-structure/Formula/_formula.rb +31 -0
  19. package/src/templates/taps/01-full-ci/tap-structure/README.md +27 -0
  20. package/src/templates/taps/01-full-ci/tap-structure/cmd/.gitkeep +0 -0
  21. package/src/templates/taps/01-full-ci/tap-structure/formula_renames.json +1 -0
  22. package/src/templates/taps/01-full-ci/tap-structure/lib/.gitkeep +0 -0
  23. package/src/templates/taps/01-full-ci/tap-structure/require/.gitkeep +0 -0
  24. package/src/templates/taps/01-full-ci/tap-structure/tap_migrations.json +1 -0
  25. package/src/templates/taps/01-full-ci/template.md +45 -0
  26. package/src/templates/taps/02-root-level/AGENTS.md +72 -0
  27. package/src/templates/taps/02-root-level/tap-structure/README.md +27 -0
  28. package/src/templates/taps/02-root-level/tap-structure/_formula.rb +29 -0
  29. package/src/templates/taps/02-root-level/template.md +35 -0
  30. package/src/templates/taps/03-simple-script/AGENTS.md +71 -0
  31. package/src/templates/taps/03-simple-script/tap-structure/Formula/_formula.rb +27 -0
  32. package/src/templates/taps/03-simple-script/tap-structure/README.md +27 -0
  33. package/src/templates/taps/03-simple-script/tap-structure/scripts/release.rb +46 -0
  34. package/src/templates/taps/03-simple-script/template.md +41 -0
  35. package/src/templates/taps/04-python-venv/AGENTS.md +83 -0
  36. package/src/templates/taps/04-python-venv/tap-structure/Formula/_formula.rb +57 -0
  37. package/src/templates/taps/04-python-venv/tap-structure/README.md +27 -0
  38. package/src/templates/taps/04-python-venv/tap-structure/scripts/release.rb +44 -0
  39. package/src/templates/taps/04-python-venv/template.md +58 -0
  40. package/src/templates/taps/05-node-npm/AGENTS.md +90 -0
  41. package/src/templates/taps/05-node-npm/tap-structure/Formula/_formula.rb +46 -0
  42. package/src/templates/taps/05-node-npm/tap-structure/README.md +27 -0
  43. package/src/templates/taps/05-node-npm/tap-structure/scripts/release.rb +40 -0
  44. package/src/templates/taps/05-node-npm/template.md +74 -0
  45. package/src/templates/taps/06-keg-only/AGENTS.md +82 -0
  46. package/src/templates/taps/06-keg-only/tap-structure/Formula/_formula.rb +45 -0
  47. package/src/templates/taps/06-keg-only/tap-structure/README.md +27 -0
  48. package/src/templates/taps/06-keg-only/template.md +60 -0
  49. package/src/templates/taps/07-cask-only/AGENTS.md +97 -0
  50. package/src/templates/taps/07-cask-only/tap-structure/Casks/_app.rb +26 -0
  51. package/src/templates/taps/07-cask-only/tap-structure/README.md +27 -0
  52. package/src/templates/taps/07-cask-only/template.md +58 -0
  53. package/src/templates/taps/08-go-binary/AGENTS.md +86 -0
  54. package/src/templates/taps/08-go-binary/tap-structure/Formula/_formula.rb +40 -0
  55. package/src/templates/taps/08-go-binary/tap-structure/README.md +27 -0
  56. package/src/templates/taps/08-go-binary/tap-structure/scripts/release.rb +38 -0
  57. package/src/templates/taps/08-go-binary/template.md +60 -0
  58. package/src/workflows/analyze-source.sh +124 -0
  59. package/src/workflows/convert-npm-to-bun.sh +112 -0
  60. package/src/workflows/create-tap.sh +196 -0
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "homebrew-tap",
3
+ "type": "module",
4
+ "private": true,
5
+ "description": "Homebrew tap creator — analyze projects, scaffold formulae, validate packages",
6
+ "scripts": {
7
+ "test": "bun test",
8
+ "test:bun": "bun test --test-name-pattern 'bun'",
9
+ "build": "bun build test-bun.test.ts --target=bun --outdir ../../dist/tests && bun build test-bun.test.ts --compile --outfile=../../dist/tests/brew-test-bun",
10
+ "compile": "bun build test-bun.test.ts --target=bun --outdir ../../dist/tests",
11
+ "bundle": "bun build test-bun.test.ts --compile --outfile=../../dist/tests/brew-test-bun",
12
+ "analyze": "bash brew-analyze.sh",
13
+ "env": "bash brew-env.sh",
14
+ "deps": "bash brew-deps.sh",
15
+ "search": "bash brew-search.sh",
16
+ "template": "bash brew-template.sh"
17
+ },
18
+ "devDependencies": {
19
+ "@types/bun": "latest"
20
+ }
21
+ }
@@ -0,0 +1,203 @@
1
+ # opencode-autopilot
2
+ name: homebrew-agent
3
+ description: >-
4
+ Homebrew expert agent: inspect brew environments, analyze source code, recommend tap templates,
5
+ scaffold formula files, convert npm to bun, validate formulae. Your complete Homebrew packaging assistant.
6
+ mode: primary
7
+ permission:
8
+ edit: allow
9
+ bash: allow
10
+ read: allow
11
+ glob: allow
12
+ grep: allow
13
+ list: allow
14
+ task: allow
15
+ lsp: allow
16
+ webfetch: allow
17
+ websearch: allow
18
+ external_directory:
19
+ /opt/homebrew/Library/Taps/**/*: allow
20
+ /opt/homebrew/**: allow
21
+ /Users/bendz/.config/opencode/**/*: allow
22
+ /Users/bendz/Projects/Opencode/homebrew-tap/**/*: allow
23
+ todowrite: allow
24
+ question: allow
25
+ ---
26
+
27
+ # Homebrew Agent Skill
28
+
29
+ A Homebrew tap expert that helps inspect environments, analyze source code, create formulae, and validate packages.
30
+
31
+ ## Overview
32
+
33
+ This agent provides complete Homebrew packaging assistance:
34
+ - **Environment inspection**: Check brew config, taps, Cellar, Ruby version
35
+ - **Dependency analysis**: Show dependency trees and reverse dependencies
36
+ - **Search**: Find formulae and casks with rich output
37
+ - **Source analysis**: Determine project type (Go, Python, Node, etc.)
38
+ - **Tap creation**: Scaffold complete tap structures from templates
39
+ - **Formula conversion**: Convert npm-based formulas to use bun
40
+ - **Validation**: Run `ruby -c`, `brew style`, and `brew audit`
41
+
42
+ ## Natural Language Triggers
43
+
44
+ When the user says anything matching these patterns, AUTOMATICALLY run the corresponding tool without asking for confirmation:
45
+
46
+ | User Says | Agent Action |
47
+ |-----------|-------------|
48
+ | "create a tap for [path/url]" | Run `workflows/create-tap.sh --source [path/url] --non-interactive` |
49
+ | "analyze [path/url]" | Run `workflows/analyze-source.sh --dir [path]` or `--url [url]` |
50
+ | "what type of project is [path]" | Run `scripts/brew-analyze.sh --dir [path] --human` |
51
+ | "show my brew environment" | Run `scripts/brew-env.sh` |
52
+ | "what are the dependencies of [formula]" | Run `scripts/brew-deps.sh [formula]` |
53
+ | "search for [query] in brew" | Run `scripts/brew-search.sh [query]` |
54
+ | "convert [formula] to bun" | Run `workflows/convert-npm-to-bun.sh --formula [path] --dry-run` |
55
+
56
+ **CRITICAL**: When the user asks to "create a tap", you MUST:
57
+ 1. Automatically detect the source path/URL from their message
58
+ 2. If not provided, ask for it
59
+ 3. If they provide an output folder, use it. Otherwise default to `./homebrew-<projectname>`
60
+ 4. Run the full `create-tap.sh` workflow with `--non-interactive`
61
+ 5. Show the results and next steps
62
+
63
+ ## Default Output Directory
64
+
65
+ When the user doesn't specify an output folder for tap creation, use:
66
+ - `./homebrew-<projectname>` (e.g., `./homebrew-mycli`)
67
+ - Or create a temp directory and tell the user where it is
68
+
69
+ ## Available Tool Scripts
70
+
71
+ All scripts are located in `scripts/` and `workflows/` under the project root.
72
+
73
+ ### `scripts/brew-env.sh`
74
+ - **Purpose**: Inspect Homebrew environment
75
+ - **Usage**: `bash scripts/brew-env.sh [--config|--taps|--cellar|--ruby|--json|--help]`
76
+ - **Example**: `bash scripts/brew-env.sh --json` outputs full environment as JSON
77
+
78
+ ### `scripts/brew-deps.sh`
79
+ - **Purpose**: Show dependencies and reverse dependencies for a formula
80
+ - **Usage**: `bash scripts/brew-deps.sh [--tree|--flat|--reverse|--json] <formula>`
81
+ - **Example**: `bash scripts/brew-deps.sh --json git`
82
+
83
+ ### `scripts/brew-search.sh`
84
+ - **Purpose**: Search Homebrew formulae and casks
85
+ - **Usage**: `bash scripts/brew-search.sh [--formulae|--casks|--desc|--json] <query>`
86
+ - **Example**: `bash scripts/brew-search.sh --json python`
87
+
88
+ ### `scripts/brew-analyze.sh`
89
+ - **Purpose**: Analyze source code to determine project type
90
+ - **Usage**: `bash scripts/brew-analyze.sh [--dir <path>|--url <github-url>] [--json|--human]`
91
+ - **Output**: JSON with `type`, `template`, `confidence`, `markers`, `details`
92
+
93
+ ### `scripts/brew-template.sh`
94
+ - **Purpose**: Apply a Homebrew tap template
95
+ - **Usage**: `bash scripts/brew-template.sh <type> --name <formula> --output <path> [--convert-to-bun]`
96
+ - **Example**: `bash scripts/brew-template.sh go-binary --name MyCli --output ./mytap`
97
+
98
+ ## Available Workflow Scripts
99
+
100
+ ### `workflows/create-tap.sh`
101
+ - **Purpose**: End-to-end tap creation from source
102
+ - **Usage**: `bash workflows/create-tap.sh --source <url|path> --name <formula> --tap <user/tap> --output <path> --non-interactive`
103
+ - **Runs**: analyze + template + validation
104
+ - **IMPORTANT**: This is the ONE command to run when user says "create a tap"
105
+
106
+ ### `workflows/analyze-source.sh`
107
+ - **Purpose**: Rich analysis report with template recommendation
108
+ - **Usage**: `bash workflows/analyze-source.sh [--dir <path>|--url <url>]`
109
+ - **Output**: Human-readable report with complexity estimate and next steps
110
+
111
+ ### `workflows/convert-npm-to-bun.sh`
112
+ - **Purpose**: Convert npm-based formula to use bun
113
+ - **Usage**: `bash workflows/convert-npm-to-bun.sh --formula <path> [--check|--dry-run]`
114
+
115
+ ## Template Selection Guide
116
+
117
+ | Marker Files | Type | Template | Confidence |
118
+ |-------------|------|----------|------------|
119
+ | `*.app` / `Info.plist` | cask | 07 | high |
120
+ | `Cargo.toml` | rust | 01 | high |
121
+ | `go.mod` + `main.go` | go-binary | 08 | high |
122
+ | `pyproject.toml` / `setup.py` | python-venv | 04 | high |
123
+ | `package.json` with `bin` | node-npm | 05 | high |
124
+ | `Makefile` / `CMakeLists.txt` | full-ci | 01 | medium |
125
+ | Single `.sh` / `.py` | simple-script | 03 | medium |
126
+ | None match | unknown | 02 (root-level) | low |
127
+
128
+ ## npm to bun Conversion
129
+
130
+ When a project uses npm but bun is preferred:
131
+ 1. Check if bun is installed: `which bun`
132
+ 2. Run: `bash workflows/convert-npm-to-bun.sh --formula Formula/my-cli.rb --dry-run`
133
+ 3. Review the diff, then run without `--dry-run`
134
+
135
+ ## Formula Validation Checklist
136
+
137
+ Every generated formula must pass:
138
+ 1. `ruby -c Formula/<name>.rb`
139
+ 2. `brew style --tap <user>/<tapname> Formula/<name>.rb`
140
+ 3. `brew audit --new-formula Formula/<name>.rb`
141
+
142
+ ## Homebrew DSL Reference
143
+
144
+ For complete Formula DSL documentation, see:
145
+ - `.opencode/docs/homebrew-dsl/01-formula-dsl.md`
146
+ - `.opencode/docs/homebrew-dsl/02-cask-dsl.md`
147
+
148
+ ## One-Shot Tap Creation
149
+
150
+ When the user says "create a tap for /path/to/my-project", execute this exact sequence:
151
+
152
+ ```bash
153
+ # 1. Analyze
154
+ bash workflows/analyze-source.sh --dir /path/to/my-project
155
+
156
+ # 2. Create (auto-generate name from project folder, use default output)
157
+ bash workflows/create-tap.sh \
158
+ --source /path/to/my-project \
159
+ --name MyProject \
160
+ --tap user/homebrew-myproject \
161
+ --output ./homebrew-myproject \
162
+ --non-interactive
163
+
164
+ # 3. Show results
165
+ ls -la ./homebrew-myproject/Formula/
166
+ ruby -c ./homebrew-myproject/Formula/myproject.rb
167
+ ```
168
+
169
+ ## Pitfalls and Solutions
170
+
171
+ 1. **macOS bash 3.2**: Scripts use `tr` instead of `${var^^}` for portability
172
+ 2. **API vs Git mode**: `HOMEBREW_NO_INSTALL_FROM_API=1` uses local git taps (slower but required for tap development)
173
+ 3. **Formula class names**: Must be CamelCase matching filename (e.g., `MyCli` → `Formula/mycli.rb`)
174
+ 4. **Dependency order**: Build deps before runtime deps (enforced by rubocop)
175
+ 5. **Desc stanza**: Max 80 chars, no leading article, capitalized first word, no trailing period
176
+
177
+ ## Directory Structure
178
+
179
+ ```
180
+ homebrew-tap/
181
+ ├── scripts/
182
+ │ ├── brew-env.sh
183
+ │ ├── brew-deps.sh
184
+ │ ├── brew-search.sh
185
+ │ ├── brew-analyze.sh
186
+ │ └── brew-template.sh
187
+ ├── workflows/
188
+ │ ├── create-tap.sh
189
+ │ ├── analyze-source.sh
190
+ │ └── convert-npm-to-bun.sh
191
+ ├── commands/
192
+ │ ├── homebrew-env.md
193
+ │ ├── homebrew-deps.md
194
+ │ ├── homebrew-search.md
195
+ │ ├── homebrew-create.md
196
+ │ └── homebrew-analyze.md
197
+ ├── agents/
198
+ │ ├── homebrew-agent.md
199
+ │ └── homebrew-subagent.md
200
+ └── skills/
201
+ └── homebrew-agent/
202
+ └── SKILL.md
203
+ ```
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: homebrew-tap
3
+ description: Master skill for the 8-pattern Homebrew tap template reference collection. Use when creating, maintaining, or validating Homebrew formula, cask, and workflow files.
4
+ stacks:
5
+ - homebrew
6
+ - ruby
7
+ - github-actions
8
+ - nodejs
9
+ - bun
10
+ - python
11
+ - go
12
+ requires:
13
+ - basic-homebrew-knowledge
14
+ ---
15
+
16
+ # homebrew-tap
17
+
18
+ Master skill for the Homebrew tap pattern reference project.
19
+
20
+ ## Description
21
+ A curated collection of 8 Homebrew tap patterns, each with:
22
+ - `template.md` — reference describing the pattern, structure, and when to use it
23
+ - `tap-structure/` — skeleton with copy-paste-ready file stubs (.rb, .yml, .sh)
24
+ - `AGENTS.md` — agent definition that can be installed to `~/.config/opencode/agents/`
25
+
26
+ ## Available Templates
27
+
28
+ | # | Template | Directory | File Stubs |
29
+ |---|---|---|---|
30
+ | 01 | Full CI suite | `templates/taps/01-full-ci/` | `.github/workflows/tests.yml`, `publish.yml`, `autobump.yml`, `Formula/<formula>.rb` |
31
+ | 02 | Root-level `.rb` | `templates/taps/02-root-level/` | `<formula>.rb` at root |
32
+ | 03 | Simple + script | `templates/taps/03-simple-script/` | `Formula/<formula>.rb`, `scripts/release.rb` |
33
+ | 04 | Python virtualenv | `templates/taps/04-python-venv/` | `Formula/<formula>.rb`, `scripts/release.rb` |
34
+ | 05 | JS Runtime (npm/bun) | `templates/taps/05-node-npm/` | `Formula/<formula>.rb`, `scripts/release.rb` |
35
+ | 06 | Keg-only system tool | `templates/taps/06-keg-only/` | `Formula/<formula>.rb` |
36
+ | 07 | Cask-only | `templates/taps/07-cask-only/` | `Casks/<app>.rb` |
37
+ | 08 | Go binary | `templates/taps/08-go-binary/` | `Formula/<formula>.rb`, `scripts/release.rb` |
38
+
39
+ ## Quick Start
40
+
41
+ 1. Pick a template that matches your formula type
42
+ 2. Copy the `tap-structure/` directory to create a new tap:
43
+ ```sh
44
+ cp -r templates/taps/<pattern>/tap-structure /path/to/homebrew-<tapname>/
45
+ ```
46
+ 3. Optionally install the agent:
47
+ ```sh
48
+ cp templates/taps/<pattern>/AGENTS.md ~/.config/opencode/agents/<name>.md
49
+ ```
50
+ 4. Edit the `.rb` stubs with your formula details
51
+ 5. Validate with Ruby LSP (if available) for syntax and DSL correctness:
52
+ ```sh
53
+ ruby-lsp --version # Verify LSP is installed
54
+ ```
55
+ 6. Run verification inside `brew sh --ruby`:
56
+ ```sh
57
+ ruby -c Formula/<formula>.rb
58
+ brew style --tap <user>/<tapname> Formula/<formula>.rb
59
+ ```
60
+
61
+ ## Development Shells
62
+
63
+ ```sh
64
+ brew sh --ruby # For .rb syntax/style/audit checks
65
+ brew sh # For testing formula installation
66
+ ```
67
+
68
+ ## LSP Validation
69
+
70
+ Before finishing any formula, the agent MUST validate the `.rb` file:
71
+
72
+ 1. **Verify Ruby LSP is available**:
73
+ ```sh
74
+ ruby-lsp --version
75
+ ```
76
+ 2. **Run `ruby -c`** for syntax validation:
77
+ ```sh
78
+ ruby -c Formula/<formula>.rb
79
+ ```
80
+ 3. **Run `brew style`** for Homebrew-specific linting:
81
+ ```sh
82
+ brew style --tap <user>/<tapname> Formula/<formula>.rb
83
+ ```
84
+ 4. **Run `brew audit`** for formula correctness:
85
+ ```sh
86
+ brew audit --new-formula Formula/<formula>.rb
87
+ ```
88
+
89
+ The agent should NOT mark a formula as complete until all LSP diagnostics and `brew style` pass.
90
+
91
+ ## Verification
92
+
93
+ ```sh
94
+ ls templates/taps/*/template.md # 8 template descriptions
95
+ ls templates/taps/*/AGENTS.md # 8 agent definitions
96
+ ls templates/taps/*/tap-structure/ # skeleton stubs per template
97
+ ```
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: homebrew-tap-full-ci
3
+ description: Creates and maintains Homebrew taps with full CI workflows — test-bot, bottle publishing, and autobump (gromgit/homebrew-fuse pattern).
4
+ ---
5
+
6
+ # homebrew-tap-full-ci
7
+
8
+ Agent for working with Full CI Suite tap templates.
9
+
10
+ ## Description
11
+ Helps create and maintain Homebrew taps with full CI workflows including brew test-bot, bottle publishing, and autobump.
12
+
13
+ ## Stacks
14
+ - homebrew
15
+ - ruby
16
+ - github-actions
17
+
18
+ ## Requires
19
+ - basic-homebrew-knowledge
20
+
21
+ ## Key Actions
22
+
23
+ ### brew tap-new
24
+ Always start with `brew tap-new <user>/homebrew-<tapname>` to generate the CI skeleton.
25
+
26
+ ### Workflow Files
27
+ - `.github/workflows/tests.yml` — brew test-bot on push + PR
28
+ - `.github/workflows/publish.yml` — brew pr-pull on labeled PRs
29
+ - `.github/workflows/autobump.yml` — scheduled formula bumps via livecheck (uses `dawidd6/action-homebrew-bump-formula@v4`)
30
+
31
+ ### Permissions
32
+ - Read/write access to `.github/workflows/`
33
+ - `secrets.GITHUB_TOKEN` has sufficient scope for private repo CI
34
+ - `contents: write`, `packages: write`, `pull-requests: write` for publish workflow
35
+
36
+ ### Common Pitfalls
37
+
38
+ - `brew test-bot` requires a clean git working tree — commit or stash before running.
39
+ - `publish.yml` needs the `pr-pull` label on the PR. Missing label = no bottle published.
40
+ - `autobump.yml` runs every 6 hours. Force-trigger via workflow_dispatch if you need an immediate bump.
41
+ - `secrets.GITHUB_TOKEN` has limited scope in forked PRs. Use a personal access token for PRs from forks.
42
+ - The PR number in `pr-pull` must match the merged PR, not the auto-bump commit.
43
+
44
+ ### LSP Validation
45
+
46
+ Before finishing any formula, validate with the Ruby LSP:
47
+
48
+ 1. Ensure LSP is available:
49
+ ```sh
50
+ ruby-lsp --version # Verify LSP is installed
51
+ ```
52
+ 2. Run syntax check:
53
+ ```sh
54
+ ruby -c Formula/<formula>.rb
55
+ ```
56
+ 3. Run Homebrew linting:
57
+ ```sh
58
+ brew style --tap <user>/<tapname> Formula/<formula>.rb
59
+ ```
60
+ 4. Run formula audit:
61
+ ```sh
62
+ brew audit --new-formula Formula/<formula>.rb
63
+ ```
64
+
65
+ Do NOT mark work as complete until all diagnostics pass.
66
+
67
+ ### Verification
68
+ ```sh
69
+ brew style --tap <user>/<tapname> Formula/<formula>.rb
70
+ brew audit --new-formula Formula/<formula>.rb
71
+ ```
@@ -0,0 +1,24 @@
1
+ name: Autobump
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ - cron: "0 */6 * * *" # Every 6 hours
7
+
8
+ jobs:
9
+ autobump:
10
+ runs-on: macos-latest
11
+ steps:
12
+ - name: Set up Homebrew
13
+ uses: Homebrew/actions/setup-homebrew@master
14
+
15
+ - name: Install Bundler RubyGems
16
+ run: brew install-bundler-gems
17
+
18
+ - name: Bump formulae
19
+ uses: dawidd6/action-homebrew-bump-formula@v4
20
+ with:
21
+ token: ${{ secrets.GITHUB_TOKEN }}
22
+ tap: ${{ github.repository }}
23
+ livecheck: true
24
+ force: false
@@ -0,0 +1,33 @@
1
+ name: Publish
2
+
3
+ on:
4
+ pull_request:
5
+ types: [labeled]
6
+ paths:
7
+ - "Formula/**/*.rb"
8
+ - "Casks/**/*.rb"
9
+
10
+ jobs:
11
+ upload:
12
+ if: contains(github.event.pull_request.labels.*.name, 'pr-pull')
13
+ runs-on: macos-latest
14
+ steps:
15
+ - name: Set up Homebrew
16
+ uses: Homebrew/actions/setup-homebrew@master
17
+
18
+ - name: Install Bundler RubyGems
19
+ run: brew install-bundler-gems
20
+
21
+ - name: Pull PR bottle
22
+ env:
23
+ HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24
+ run: brew pr-pull --debug --tap ${{ github.repository }} ${{ github.event.pull_request.number }}
25
+
26
+ - name: Push commits
27
+ uses: Homebrew/actions/git-try-push@master
28
+ with:
29
+ token: ${{ secrets.GITHUB_TOKEN }}
30
+ branch: main
31
+
32
+ - name: Tag bottle commits
33
+ uses: Homebrew/actions/tag-bottles@master
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: ["*"]
8
+
9
+ jobs:
10
+ test-bot:
11
+ runs-on: macos-latest
12
+ steps:
13
+ - name: Set up Homebrew
14
+ id: set-up-homebrew
15
+ uses: Homebrew/actions/setup-homebrew@master
16
+
17
+ - name: Cache Homebrew Bundler RubyGems
18
+ id: cache
19
+ uses: actions/cache@v4
20
+ with:
21
+ path: ${{ steps.set-up-homebrew.outputs.gems-path }}
22
+ key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
23
+ restore-keys: |
24
+ ${{ runner.os }}-rubygems-
25
+
26
+ - name: Install Bundler RubyGems
27
+ run: brew install-bundler-gems
28
+
29
+ - name: Run brew test-bot
30
+ run: brew test-bot --only-cleanup-before
31
+
32
+ - name: Run brew test-bot again
33
+ run: brew test-bot --only-formulae --setup-command "brew tap ${{ github.repository }}"
@@ -0,0 +1,31 @@
1
+
2
+ # Template formula for a Full CI tap (gromgit/homebrew-fuse 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
+ strategy :github_latest
17
+ end
18
+
19
+ depends_on "<dep>" => :build
20
+ depends_on "<runtime-dep>"
21
+
22
+ def install
23
+ # Replace with actual build/install logic
24
+ system "./configure", "--prefix=#{prefix}"
25
+ system "make", "install"
26
+ end
27
+
28
+ test do
29
+ system "#{bin}/<cli>", "--version"
30
+ end
31
+ 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,45 @@
1
+ # Template 01: Full CI Suite
2
+
3
+ ## Pattern: `gromgit/homebrew-fuse`
4
+
5
+ A full-featured tap with `brew test-bot` CI, bottle publishing, and auto-bump.
6
+ Best for **multi-formula taps** that need CI validation, binary bottles, and
7
+ automated version bumps.
8
+
9
+ ### Structure
10
+
11
+ ```
12
+ homebrew-<tap>/
13
+ ├── .github/workflows/
14
+ │ ├── tests.yml # brew test-bot on push + PR
15
+ │ ├── publish.yml # brew pr-pull on pr-pull label
16
+ │ └── autobump.yml # Schedule: livecheck-driven formula bumps
17
+ ├── Formula/
18
+ │ └── <formula>.rb # Formula definition
19
+ ├── cmd/ # (optional) Custom brew subcommands
20
+ │ └── brew-<cmd>
21
+ ├── lib/ # (optional) Shared libraries
22
+ ├── require/ # (optional) Ruby require files
23
+ ├── formula_renames.json # (optional) Track formula renames
24
+ ├── tap_migrations.json # (optional) Track formula moves
25
+ ├── LICENSE
26
+ ├── README.md
27
+ └── .gitignore
28
+ ```
29
+
30
+ ### When to Use
31
+
32
+ - You maintain 3+ formulae in one tap
33
+ - You want CI to verify every PR with `brew test-bot`
34
+ - You want automated bottle publishing to GitHub Container Registry
35
+ - You want `livecheck`-driven auto-bump via scheduled workflow
36
+
37
+ ### When NOT to Use
38
+
39
+ - You have a single formula (use template 03 or 04 instead)
40
+ - You don't need CI in the tap itself
41
+
42
+ ### Reference
43
+
44
+ - `brew tap-new <user>/homebrew-<tap>` generates the CI skeleton
45
+ - `dawidd6/action-homebrew-bump-formula@v4` for autobump
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: homebrew-tap-root-level
3
+ description: Creates and maintains minimal Homebrew taps with formula files at the repository root (yakitrak/homebrew-yakitrak pattern).
4
+ ---
5
+
6
+ # homebrew-tap-root-level
7
+
8
+ Agent for working with Root-Level `.rb` tap templates.
9
+
10
+ ## Description
11
+ Helps create and maintain minimal Homebrew taps with formula files at the repository root.
12
+
13
+ ## Stacks
14
+ - homebrew
15
+ - ruby
16
+
17
+ ## Requires
18
+ - basic-homebrew-knowledge
19
+
20
+ ## Key Actions
21
+
22
+ ### Structure
23
+ Place `.rb` files at the repository root (no `Formula/` subdirectory).
24
+ Homebrew scans root, `Formula/`, and `HomebrewFormula/` automatically.
25
+
26
+ ### Minimal Required Files
27
+ ```
28
+ <tap-root>/
29
+ ├── <formula>.rb
30
+ ├── LICENSE
31
+ └── README.md
32
+ ```
33
+
34
+ ### Permissions
35
+ - Read/write to root directory for `.rb` files
36
+
37
+ ### Common Pitfalls
38
+
39
+ - With root-level .rb files, `brew install <tap>/<formula>` is required (not just `brew install <formula>`).
40
+ - Homebrew scans root, Formula/, and HomebrewFormula/. Root-level files work but are non-standard.
41
+ - Root-level taps confuse `brew tap-info` and `brew style` — you may need `--tap` flag explicitly.
42
+ - Keep to 1-2 formulae max. Beyond 2, create a Formula/ subdirectory instead.
43
+ - The formula file name must exactly match the formula class name (e.g., `my-tool.rb` → `class MyTool`).
44
+
45
+ ### LSP Validation
46
+
47
+ Before finishing any formula, validate with the Ruby LSP:
48
+
49
+ 1. Ensure LSP is available:
50
+ ```sh
51
+ ruby-lsp --version # Verify LSP is installed
52
+ ```
53
+ 2. Run syntax check:
54
+ ```sh
55
+ ruby -c Formula/<formula>.rb
56
+ ```
57
+ 3. Run Homebrew linting:
58
+ ```sh
59
+ brew style --tap <user>/<tapname> Formula/<formula>.rb
60
+ ```
61
+ 4. Run formula audit:
62
+ ```sh
63
+ brew audit --new-formula Formula/<formula>.rb
64
+ ```
65
+
66
+ Do NOT mark work as complete until all diagnostics pass.
67
+
68
+ ### Verification
69
+ ```sh
70
+ brew style --tap <user>/<tapname> <formula>.rb
71
+ brew audit --new-formula <formula>.rb
72
+ ```