cocottetech/@platform/scripts/extract-archive.sh
autocommit 340f71519a fix(scripts): exclude python venvs from archive builds; add platform.3 support
cache-v0.sh / build-archives.sh: exclude venv/.venv/__pycache__ and other
python caches. A stray @services/ml-moderation-python/venv was 9.58 GB —
95.9% — of the platform.0 archive; rebuilt platform.0 is now 337 MB.

extract-archive.sh / build-archives.sh / @platform/CLAUDE.md: recognize the
platform.3 (@atlilith) archive that the tooling previously ignored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 10:48:03 -07:00

57 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
# extract-archive.sh — mine code from an archived prior platform version.
#
# Tarballs live in <repo>/.archive/platform.{0,1,2,3}.tar.zst (LFS-tracked).
# Extracts to /tmp/cocottetech-archive/<name>/ so the working tree stays clean.
#
# Usage: ./scripts/extract-archive.sh <platform.0|platform.1|platform.2|platform.3>
set -euo pipefail
usage() {
echo "Usage: $0 <platform.0|platform.1|platform.2|platform.3>" >&2
echo "" >&2
echo " platform.0 — egirl-platform (viky-era)" >&2
echo " platform.1 — lilith-platform (V1, 54-feature SaaS)" >&2
echo " platform.2 — lilith-platform.live (V2, Quinn-personal, currently in prod)" >&2
echo " platform.3 — @atlilith (V3, brief intermediate workspace)" >&2
exit 2
}
if [[ $# -ne 1 ]]; then
usage
fi
name="$1"
case "$name" in
platform.0|platform.1|platform.2|platform.3) ;;
*) usage ;;
esac
# Resolve repo root (parent of @platform/, which contains this script).
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd "$script_dir/../.." && pwd)"
archive="$repo_root/.archive/${name}.tar.zst"
dest="/tmp/cocottetech-archive/${name}"
if [[ ! -f "$archive" ]]; then
echo "error: $archive not found." >&2
echo "Tarballs not yet built. On apricot, run:" >&2
echo " ./scripts/build-archives.sh # for platform.{1,2,3}" >&2
echo " ./scripts/cache-v0.sh # for platform.0 (from NFS)" >&2
exit 1
fi
if ! command -v unzstd >/dev/null 2>&1; then
echo "error: unzstd not found. Install zstd (brew install zstd / apt install zstd)." >&2
exit 1
fi
mkdir -p "$dest"
echo "Extracting $archive -> $dest ..."
tar --use-compress-program=unzstd -xf "$archive" -C "$dest"
echo "Done. Mined source at: $dest"
echo "Cleanup when finished: rm -rf $dest"