716ef407fe
Wire Portal and TKMind proxy to loopback Goose v1.49 via canary env blocks, with verification scripts, Phase 2/3 evidence baselines, and rollback runbooks so local upgrade stays isolated from stable 1.41 and production. Co-authored-by: Cursor <cursoragent@cursor.com>
58 lines
2.2 KiB
Bash
Executable File
58 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Ensure rusty_v8 static library is cached for Goose code-mode builds.
|
|
set -euo pipefail
|
|
|
|
ARCH="$(uname -m)"
|
|
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
if [[ "${ARCH}" != "arm64" || "${OS}" != "darwin" ]]; then
|
|
echo "[goose-v149-v8] unsupported platform ${OS}/${ARCH}; download manually if needed" >&2
|
|
exit 0
|
|
fi
|
|
|
|
V8_VERSION="v145.0.0"
|
|
FILE="librusty_v8_release_aarch64-apple-darwin.a.gz"
|
|
URL="https://github.com/denoland/rusty_v8/releases/download/${V8_VERSION}/${FILE}"
|
|
# rusty_v8 build.rs expects the escaped URL path to be a FILE, not a directory.
|
|
CACHE_FILE="${HOME}/.cargo/.rusty_v8/https___github_com_denoland_rusty_v8_releases_download_v145_0_0_librusty_v8_release_aarch64_apple_darwin_a_gz"
|
|
MIN_BYTES=$((30 * 1024 * 1024))
|
|
|
|
mkdir -p "$(dirname "${CACHE_FILE}")"
|
|
|
|
# Legacy layout stored the gzip inside a same-named directory — migrate once.
|
|
if [[ -d "${CACHE_FILE}" ]]; then
|
|
legacy="${CACHE_FILE}/${FILE}"
|
|
if [[ -f "${legacy}" ]]; then
|
|
mv "${legacy}" "${CACHE_FILE}.migrate"
|
|
rmdir "${CACHE_FILE}"
|
|
mv "${CACHE_FILE}.migrate" "${CACHE_FILE}"
|
|
echo "[goose-v149-v8] migrated legacy directory cache -> file"
|
|
else
|
|
echo "[goose-v149-v8] legacy cache dir is empty: ${CACHE_FILE}" >&2
|
|
rm -rf "${CACHE_FILE}"
|
|
fi
|
|
fi
|
|
|
|
if [[ -f "${CACHE_FILE}" ]]; then
|
|
size="$(wc -c < "${CACHE_FILE}" | tr -d ' ')"
|
|
if [[ "${size}" -ge "${MIN_BYTES}" ]]; then
|
|
echo "[goose-v149-v8] cache ok (${size} bytes): ${CACHE_FILE}"
|
|
exit 0
|
|
fi
|
|
echo "[goose-v149-v8] cache too small (${size} bytes), re-downloading" >&2
|
|
rm -f "${CACHE_FILE}"
|
|
fi
|
|
|
|
echo "[goose-v149-v8] downloading ${URL}"
|
|
curl -fL --retry 5 --retry-delay 2 -o "${CACHE_FILE}.partial" "${URL}"
|
|
mv "${CACHE_FILE}.partial" "${CACHE_FILE}"
|
|
size="$(wc -c < "${CACHE_FILE}" | tr -d ' ')"
|
|
echo "[goose-v149-v8] downloaded ${size} bytes -> ${CACHE_FILE}"
|
|
|
|
GOOSED_ROOT="${GOOSED_V149_ROOT:-/Users/john/Project/tkmind_go-v149}"
|
|
GN_OUT="${GOOSED_ROOT}/target/release/gn_out/obj"
|
|
if [[ -d "${GOOSED_ROOT}/target/release" ]]; then
|
|
rm -rf "${GOOSED_ROOT}/target/release/gn_out"
|
|
rm -f "${GOOSED_ROOT}/target/release/build"/v8-*/out/*.a 2>/dev/null || true
|
|
echo "[goose-v149-v8] cleared stale gn_out under ${GOOSED_ROOT}/target/release"
|
|
fi
|