用途:使 tap 中的 Homebrew formula 与 PyPI 发行版本保持同步。流程为更新版本与 sha、必要时刷新资源块、运行 brew install/test/audit,然后推送 tap 更新(手动或经 CI)。
主要能力:
- 确认 PyPI 发行存在,获取 sdist URL 与 SHA256。
- 更新 formula 中的 url 与 sha256,版本通过 sdist URL 隐式体现。
- 若 formula 使用 Language::Python::Virtualenv 与 virtualenv_install_with_resources,在依赖变化后重新生成资源块。
- 测试与审计:brew install --build-from-source ./Formula/<name>.rb、brew test <name>、brew audit --strict ./Formula/<name>.rb、brew style ./Formula/<name>.rb。
- 按 tap 工作流更新 CHANGELOG.md、提交、打 tag 并推送。
常用本地脚本:homebrew-claude-mpm/scripts/update_formula.sh <version>(校验 PyPI、更新 url/sha、重新生成资源,可选 brew test/audit);homebrew-claude-mpm/scripts/generate_resources.py(从 PyPI 生成 Python 依赖资源块);homebrew-claude-mpm/scripts/test_formula.sh(端到端 install/test/audit/style);mcp-vector-search/scripts/update_homebrew_formula.py(端到端 tap 更新,支持 --dry-run、--version、--tap-repo-path 与 HOMEBREW_TAP_TOKEN)。
典型 formula 模式:完整 Virtualenv formula(含 include Language::Python::Virtualenv、virtualenv_install_with_resources、大量资源块,测试使用 --version 和子命令);最小 Venv formula(显式创建 venv、pip install -v buildpath、bin.install_symlink,测试使用 --version 与 --help)。
CI 自动化:GitHub Actions 在 tag 或 CI 成功后触发,运行 scripts/update_homebrew_formula.py,需 HOMEBREW_TAP_TOKEN(可选 HOMEBREW_TAP_REPO);失败时创建 issue 并附手动更新步骤。
排查:PyPI 无发行时确认 tag 推送与发布完成;SHA 不匹配时从 PyPI JSON 重新获取;audit 失败时确认资源块与 sdist 匹配且存在 python@x.y 依赖;安装失败时确认 python@x.y 依赖与 virtualenv_install_with_resources 用法。
限制:资料未提供具体价格、平台支持范围或性能数据,暂未提供。