tap-to-latest
tap-to-latest
Generates a Homebrew formula from the latest GitHub release of a repo, so formulae in this tap don't have to be maintained by hand.
It pulls the release's version, its checksums file (SHA256SUMS.txt or similar) and every build asset, streams each asset and compares its SHA256 against the checksums file, and only then writes <repo>.rb. If any checksum mismatches, or a platform asset is missing from the checksums file, nothing is written and the exit status is 1.
Assets are never written to disk — they are hashed while streaming.
Usage
cd homebrew-tap/Formula/
tap-to-latest claude-statusline # creates/updates ./claude-statusline.rb
tap-to-latest claude-statusline.rb # same — tab-complete an existing formula
tap-to-latest [options] <repo>
<repo> repository name (e.g. claude-statusline or claude-statusline.rb),
owner/repo, or a GitHub URL
-o, --owner OWNER GitHub owner (default: $TAP_TO_LATEST_OWNER or bitmand)
-t, --tag TAG Use this release tag instead of the latest release
-d, --dir DIR Directory to write the formula into (default: .)
-n, --dry-run Print the formula to stdout instead of writing it
--no-color Disable colored output
-h, --help Show help
-V, --version Show version
Set GITHUB_TOKEN (or GH_TOKEN) to raise the GitHub API rate limit or to read a private repo.
What it recognises
| Release contents | Expectation |
|---|---|
| Checksums asset | SHA256SUMS[.txt], SHASUMS[.txt], CHECKSUMS[.txt] (case-insensitive) |
| Platform assets | File name contains an OS (darwin/macos/linux) and an arch (arm64/aarch64/x86_64/amd64) |
| Tag | v1.2.3 or 1.2.3 — the leading v is stripped for version |
macOS arm64/x86_64 and Linux arm64/x86_64 are emitted as on_macos/on_linux with on_arm/on_intel blocks. Other platforms (Windows, riscv64, …) and non-build assets (.asc, .sbom, .deb, …) are skipped. When several assets fit one slot, archives win over bare binaries, and plain builds win over musl/static ones.
The generated install block is bin.install "<repo>" for archives, and bin.install Dir["<repo>*"].first => "<repo>" when the release ships bare binaries. The test block asserts the version appears in <repo> --version.
Development
crystal spec # specs (no network)
shards build --release # ./bin/tap-to-latest
crystal tool format
After generating a formula, brew style ./<repo>.rb should be clean.
tap-to-latest
- 0
- 0
- 0
- 0
- 0
- 44 minutes ago
- November 29, 2026
MIT License
Sun, 29 Nov 2026 12:39:08 GMT