Homebrew Deployment Guide โ
Publishing OpenPets to Homebrew for macOS and Linux users.
๐บ Package Information โ
Package Name: openpetsFormula Location: homebrew-tap/openpets.rbTap Repository: raggle-ai/homebrew-pets
Installation Command:
bash
brew tap raggle-ai/pets
brew install openpets๐ Initial Setup โ
1. Create Homebrew Tap Repository โ
Run the automated setup script:
bash
cd homebrew-tap
./setup-tap.shThis will:
- Initialize git repository
- Create GitHub repo at
raggle-ai/homebrew-pets - Push formula to GitHub
Manual Setup (Alternative) โ
bash
cd homebrew-tap
# Initialize git
git init
git add .
git commit -m "Initial commit: OpenPets formula"
# Create GitHub repository
gh repo create raggle-ai/homebrew-pets \
--public \
--description "Homebrew tap for OpenPets" \
--homepage "https://pets.raggle.co"
# Push to GitHub
git remote add origin https://github.com/raggle-ai/homebrew-pets.git
git branch -M main
git push -u origin main๐ Formula Structure โ
Current Formula โ
ruby
# typed: strict
# frozen_string_literal: true
# OpenPets Homebrew Formula
class Openpets < Formula
desc "AI plugin infrastructure and shared utilities for OpenCode"
homepage "https://pets.raggle.co"
url "https://registry.npmjs.org/openpets/-/openpets-1.0.4.tgz"
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
license "MIT"
depends_on "node@20"
def install
system "npm", "install", *Language::Node.std_npm_args(libexec)
(bin/"pets").write_env_script "#{Formula["node@20"].opt_bin}/node",
"#{libexec}/lib/node_modules/openpets/cli.ts",
NODE_PATH: "#{libexec}/lib/node_modules"
(bin/"pets-mcp").write_env_script "#{Formula["node@20"].opt_bin}/node",
"#{libexec}/lib/node_modules/openpets/mcp-server.ts",
NODE_PATH: "#{libexec}/lib/node_modules"
end
test do
system bin/"pets", "--help"
end
end๐ Updating for New Version โ
After Publishing to NPM โ
Run the checksum updater:
bash
./scripts/update-openpets-checksums.shThis automatically:
- Fetches latest version from npm
- Downloads package
- Calculates SHA256
- Updates formula
Manual Update โ
bash
VERSION=1.0.5
# Get SHA256
curl -sL "https://registry.npmjs.org/openpets/-/openpets-${VERSION}.tgz" | shasum -a 256
# Update homebrew-tap/openpets.rb
# 1. Change url to new version
# 2. Update sha256 with calculated value
# Commit and push
cd homebrew-tap
git add openpets.rb
git commit -m "Update to version ${VERSION}"
git push๐งช Testing Formula โ
Local Testing โ
bash
cd homebrew-tap
# Install from local formula
brew install --build-from-source ./openpets.rb
# Verify installation
pets --version
pets --help
pets-mcp --help
# Run formula test
brew test openpets
# Uninstall
brew uninstall openpetsValidation โ
bash
# Check style
brew style openpets.rb
# Audit formula
brew audit --strict openpets
# Auto-fix style issues
brew style --fix openpets.rb๐ฆ Formula Components โ
Dependencies โ
ruby
depends_on "node@20"Requires Node.js 20+ to be installed via Homebrew.
Installation โ
ruby
def install
# Install npm package to libexec
system "npm", "install", *Language::Node.std_npm_args(libexec)
# Create wrapper scripts with NODE_PATH
(bin/"pets").write_env_script ...
(bin/"pets-mcp").write_env_script ...
endWhat this does:
- Installs npm package to isolated libexec directory
- Creates wrapper scripts in
bin/that:- Point to correct Node.js
- Set NODE_PATH for module resolution
- Execute TypeScript files with tsx
Testing โ
ruby
def test
system bin/"pets", "--help"
endVerifies the pets command works after installation.
๐ฅ User Installation โ
Add Tap โ
bash
brew tap raggle-ai/petsInstall OpenPets โ
bash
brew install openpetsVerify โ
bash
pets --version
pets list
pets-mcp --helpUpgrade โ
bash
brew upgrade openpetsUninstall โ
bash
brew uninstall openpets
brew untap raggle-ai/pets๐ Troubleshooting โ
Formula Fails to Install โ
Check logs:
bash
brew install --verbose --debug openpetsCommon issues:
- Node.js not found โ Install with
brew install node@20 - Network error โ Check npm registry accessibility
- Permission error โ Check Homebrew permissions
Wrong Version Installed โ
Clear cache:
bash
brew cleanup openpets
brew uninstall openpets
brew install openpetsCommand Not Found โ
Check installation:
bash
brew list openpets
which petsFix PATH:
bash
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc๐จ Formula Best Practices โ
Style Guidelines โ
- โ
Use
typed: strictsigil - โ
Use
frozen_string_literal: true - โ Add descriptive comment before class
- โ
Use
std_npm_argsfor npm install - โ Align multi-line arguments
- โ Include test block
Testing โ
bash
# Run all checks
brew style openpets.rb
brew audit --strict openpets.rb
brew install --build-from-source ./openpets.rb
brew test openpets๐ค Automation โ
GitHub Actions โ
The main repository includes automation for updating the formula:
.github/workflows/publish-distributions.yml:
yaml
- name: Update Homebrew formula
uses: mislav/bump-homebrew-formula-action@v3
with:
formula-name: openpets
homebrew-tap: raggle-ai/homebrew-pets
download-url: https://registry.npmjs.org/openpets/-/openpets-${{ version }}.tgz
env:
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}Manual Trigger โ
bash
gh workflow run publish-distributions.yml -f version=1.0.5๐ Formula Info โ
View Formula โ
bash
brew info openpets
brew info raggle-ai/pets/openpetsCheck Dependencies โ
bash
brew deps openpetsView Caveats โ
bash
brew info openpets | grep -A20 "^==> Caveats"๐ Publishing to Official Homebrew โ
Submit to homebrew-core โ
For wider distribution, submit to official Homebrew:
Prepare formula:
bashbrew install --build-from-source ./openpets.rb brew test openpets brew audit --strict openpets.rbSubmit PR:
bash# Fork homebrew-core gh repo fork Homebrew/homebrew-core # Add formula cp openpets.rb ~/homebrew-core/Formula/ # Create PR cd ~/homebrew-core git checkout -b openpets git add Formula/openpets.rb git commit -m "openpets 1.0.4 (new formula)" gh pr createRequirements:
- โ Formula passes all audits
- โ Package has 75+ GitHub stars OR 30+ forks
- โ Notable project (20,000+ downloads/month)
- โ Stable release (not beta)
- โ Active maintenance
Note: Start with custom tap, submit to core later as project grows.
๐ Release Checklist โ
When releasing new version:
- [ ] Publish to npm
- [ ] Run
./scripts/update-openpets-checksums.sh - [ ] Test formula locally
- [ ] Verify checksums match
- [ ] Push to tap repository
- [ ] Test user installation
- [ ] Update tap README if needed