Created
January 22, 2026 11:43
-
-
Save 3rd/1c059f954e1de14d43afed927823a72b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| GCS_BUCKET="https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases" | |
| VERSION="2.1.15" | |
| PLATFORM="linux-x64" | |
| tmp_dir="$(mktemp -d)" | |
| cleanup() { | |
| rm -rf "$tmp_dir" | |
| } | |
| trap cleanup EXIT | |
| bin_path="$tmp_dir/claude-code-download" | |
| DOWNLOADER="" | |
| if command -v curl >/dev/null 2>&1; then | |
| DOWNLOADER="curl" | |
| elif command -v wget >/dev/null 2>&1; then | |
| DOWNLOADER="wget" | |
| else | |
| echo "error: need curl or wget to download the binary" >&2 | |
| exit 1 | |
| fi | |
| binary_url="$GCS_BUCKET/$VERSION/$PLATFORM/claude" | |
| if [ "$DOWNLOADER" = "curl" ]; then | |
| curl -fsSL -o "$bin_path" "$binary_url" | |
| elif [ "$DOWNLOADER" = "wget" ]; then | |
| wget -q -O "$bin_path" "$binary_url" | |
| else | |
| echo "error: need curl or wget to download the binary" >&2 | |
| exit 1 | |
| fi | |
| if [ ! -s "$bin_path" ]; then | |
| echo "error: download failed" >&2 | |
| exit 1 | |
| fi | |
| if ! command -v bun >/dev/null 2>&1; then | |
| echo "error: bun is required" >&2 | |
| exit 1 | |
| fi | |
| bun -e ' | |
| const fs = require("fs"); | |
| const path = process.argv[1]; | |
| const data = fs.readFileSync(path); | |
| const marker = Buffer.from("// @bun @bytecode @bun-cjs"); | |
| const isPrintable = (b) => b === 9 || b === 10 || b === 13 || (b >= 0x20 && b <= 0x7e); | |
| const needle = "you agree that all code"; | |
| for (let i = data.indexOf(marker); i !== -1; i = data.indexOf(marker, i + 1)) { | |
| let j = i; | |
| while (j < data.length && isPrintable(data[j])) j++; | |
| const seg = data.subarray(i, j).toString("utf8"); | |
| const lines = seg.split("\n"); | |
| const idx = lines.findIndex((l) => l.toLowerCase().includes(needle)); | |
| if (idx === -1) continue; | |
| const strip = (l) => (l.endsWith("\r") ? l.slice(0, -1) : l); | |
| let s = idx; | |
| while (s - 1 >= 0 && strip(lines[s - 1]).startsWith("//")) s--; | |
| let e = idx; | |
| while (e + 1 < lines.length && strip(lines[e + 1]).startsWith("//")) e++; | |
| const eol = seg.includes("\r\n") ? "\r\n" : "\n"; | |
| process.stdout.write(lines.slice(s, e + 1).map(strip).join(eol)); | |
| process.exit(0); | |
| } | |
| process.exit(1); | |
| ' "$bin_path" |
Author
3rd
commented
Jan 22, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment