| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 5 | tmp_dir="$(mktemp -d)" |
| 6 | trap 'rm -rf "${tmp_dir}"' EXIT |
| 7 | |
| 8 | manifest="${tmp_dir}/codewhale-artifacts-sha256.txt" |
| 9 | formula="${tmp_dir}/codewhale.rb" |
| 10 | legacy="${tmp_dir}/deepseek-tui.rb" |
| 11 | |
| 12 | assets=( |
| 13 | codewhale-macos-arm64 |
| 14 | codew-macos-arm64 |
| 15 | codewhale-macos-x64 |
| 16 | codew-macos-x64 |
| 17 | codewhale-linux-arm64 |
| 18 | codew-linux-arm64 |
| 19 | codewhale-linux-x64 |
| 20 | codew-linux-x64 |
| 21 | ) |
| 22 | |
| 23 | for asset in "${assets[@]}"; do |
| 24 | printf '%064d %s\n' 0 "${asset}" >> "${manifest}" |
| 25 | done |
| 26 | |
| 27 | TAG=v1.2.3 \ |
| 28 | MANIFEST="${manifest}" \ |
| 29 | TAP_REPO=Hmbown/homebrew-deepseek-tui \ |
| 30 | FORMULA_OUTPUT="${formula}" \ |
| 31 | FORMULA_LEGACY_OUTPUT="${legacy}" \ |
| 32 | bash "${repo_root}/.github/scripts/update-homebrew-tap.sh" |
| 33 | |
| 34 | ruby -c "${formula}" >/dev/null |
| 35 | ruby -c "${legacy}" >/dev/null |
| 36 | grep -Fq 'class Codewhale < Formula' "${formula}" |
| 37 | grep -Fq 'class DeepseekTui < Formula' "${legacy}" |
| 38 | grep -Fq 'deprecate! date: "2026-08-14", because: "renamed to codewhale"' "${legacy}" |
| 39 | grep -Fq 'desc "Agentic terminal for open-source and open-weight coding models"' "${formula}" |
| 40 | grep -Fq 'depends_on "node"' "${formula}" |
| 41 | test "$(grep -Fc 'resource "codew" do' "${formula}")" -eq 4 |
| 42 | grep -Fq 'bin.install Dir["*"].first => "codew"' "${formula}" |
| 43 | grep -Fq 'system "#{bin}/codew", "--version"' "${formula}" |
| 44 | if grep -Fq 'codewhale-tui' "${formula}"; then |
| 45 | echo "Homebrew formula must not install the legacy TUI compatibility asset" >&2 |
| 46 | exit 1 |
| 47 | fi |
| 48 | if grep -Fq 'class DeepseekTui' "${formula}"; then |
| 49 | echo "Primary Homebrew formula must be Codewhale, not DeepseekTui" >&2 |
| 50 | exit 1 |
| 51 | fi |
| 52 | |
| 53 | echo "update-homebrew-tap tests passed" |
| 54 |