Skip to content

Commit 894a4cb

Browse files
authored
fix(homebrew): show logo in brew install, guard empty tap token (#22)
* fix(homebrew): show logo in brew install, guard empty tap token Two Homebrew install problems, both rooted in the tap pipeline: 1. `brew install` showed no logo. The Tetris/robot-head banner lived only in the curl (install.sh) and PowerShell (install.ps1) installers, which Homebrew never runs. Add a `caveats` block to the formula template so `brew install` prints the static settled frame of that same logo (brew caveats are plain text, so this is the uncoloured robot head). 2. The tap auto-update workflow has failed on every release since the org migration: the `HOMEBREW_TAP_TOKEN` secret did not carry over, so `git push` to the tap repo fails with a cryptic exit-128 auth error and the tap stays frozen at the last good push (0.23.0). Add a fail-fast guard that detects an empty TAP_TOKEN and prints an actionable error instead of the opaque git failure. Also add a test asserting the rendered formula carries the logo caveats. The token secret itself must be re-added out-of-band (a fine-grained PAT with Contents: Read and write on the tap repo); this change only makes the failure obvious and ships the logo. * test(homebrew): extract _fake_assets helper to dedupe asset setup
1 parent 3e85740 commit 894a4cb

3 files changed

Lines changed: 48 additions & 4 deletions

File tree

.github/workflows/homebrew-tap.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ jobs:
7676
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
7777
run: |
7878
set -euxo pipefail
79+
if [ -z "${TAP_TOKEN:-}" ]; then
80+
echo "::error::HOMEBREW_TAP_TOKEN secret is empty or unset — cannot push to ${TAP_OWNER}/${TAP_REPO}. Add a fine-grained PAT (Contents: Read and write on the tap repo) as the HOMEBREW_TAP_TOKEN secret, then re-run this workflow." >&2
81+
exit 1
82+
fi
7983
# We do NOT use actions/checkout for the tap repo because on the
8084
# very first run the tap is empty and has no refs/heads/main yet.
8185
# `git init` + `git fetch || true` + `git push -u origin main`

packages/homebrew-tap/pythinker-code.rb.tmpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,23 @@ class PythinkerCode < Formula
4141
bin.write_exec_script libexec/"pythinker"
4242
end
4343

44+
def caveats
45+
# Static settled frame of the curl/PowerShell installers' "Tetris" logo
46+
# (install.sh / install.ps1). Homebrew renders caveats as plain text, so
47+
# this is the uncoloured robot-head. The squiggly heredoc strips the common
48+
# leading indent, so the art sits one column left of the curl banner.
49+
<<~EOS
50+
51+
52+
53+
▛▀▀▀▀▀▀▀▜
54+
◖█ ◉ ◉ █◗
55+
▙▄▄▄≡▄▄▄▟
56+
57+
pythinker code · your next CLI agent
58+
EOS
59+
end
60+
4461
test do
4562
assert_path_exists libexec/".pythinker-native"
4663
assert_match version.to_s, shell_output("#{bin}/pythinker --version")

tests/test_homebrew_formula.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,22 @@ def load_generator() -> ModuleType:
2020
return module
2121

2222

23-
def test_native_homebrew_formula_renders_release_tarballs() -> None:
24-
generator = load_generator()
25-
version = "1.2.3"
26-
assets = {}
23+
def _fake_assets(generator: ModuleType, version: str) -> dict[str, dict[str, str]]:
24+
"""Build a fake GitHub release-asset map covering every native target."""
25+
assets: dict[str, dict[str, str]] = {}
2726
for target in generator.NATIVE_TARGETS:
2827
name = target.asset_name(version)
2928
assets[name] = {
3029
"browser_download_url": f"https://example.invalid/{name}",
3130
"digest": "sha256:" + ("a" * 64),
3231
}
32+
return assets
33+
34+
35+
def test_native_homebrew_formula_renders_release_tarballs() -> None:
36+
generator = load_generator()
37+
version = "1.2.3"
38+
assets = _fake_assets(generator, version)
3339

3440
formula = generator.render_formula(
3541
TEMPLATE.read_text(encoding="utf-8"), generator.native_replacements(version, assets)
@@ -59,3 +65,20 @@ def test_native_homebrew_formula_fails_when_asset_missing() -> None:
5965
assert "release asset missing" in str(exc)
6066
else:
6167
raise AssertionError("expected missing native asset to fail formula generation")
68+
69+
70+
def test_native_homebrew_formula_caveats_show_logo() -> None:
71+
generator = load_generator()
72+
version = "1.2.3"
73+
assets = _fake_assets(generator, version)
74+
75+
formula = generator.render_formula(
76+
TEMPLATE.read_text(encoding="utf-8"), generator.native_replacements(version, assets)
77+
)
78+
79+
# Homebrew prints `caveats` after install — this is where the static robot
80+
# logo (parity with install.sh / install.ps1) must live.
81+
assert "def caveats" in formula
82+
assert "pythinker code · your next CLI agent" in formula
83+
# The robot-head mouth row is the most distinctive line of the art.
84+
assert "▙▄▄▄≡▄▄▄▟" in formula

0 commit comments

Comments
 (0)