#!/usr/bin/env bash # Build the frozen v1, v2, and v3 archives from their source paths on apricot. set -euo pipefail REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" ARCHIVE_DIR="$REPO_ROOT/.archive" mkdir -p "$ARCHIVE_DIR" EXCLUDES=( --exclude='.git' --exclude='.gitlab-ci-local' --exclude='.playwright-mcp' --exclude='.turbo' --exclude='.next' --exclude='dist' --exclude='build' --exclude='out' --exclude='node_modules' --exclude='.pnpm-store' --exclude='.yarn/cache' --exclude='.cache' --exclude='venv' --exclude='.venv' --exclude='__pycache__' --exclude='*.pyc' --exclude='*.pyo' --exclude='.pytest_cache' --exclude='.mypy_cache' --exclude='.ruff_cache' --exclude='*.egg-info' --exclude='.tox' --exclude='ml-service' --exclude='models' --exclude='checkpoints' --exclude='weights' --exclude='training/data' --exclude='training_data' --exclude='captcha-solver' --exclude='*.gguf' --exclude='*.safetensors' --exclude='*.bin' --exclude='*.ckpt' --exclude='*.pth' --exclude='*.pt' --exclude='*.onnx' --exclude='*.h5' --exclude='*.mp4' --exclude='*.mov' --exclude='*.webm' --exclude='*.zip' --exclude='*.tar.gz' --exclude='*.tar.zst' ) ZSTD_LEVEL="${ZSTD_LEVEL:-3}" build_archive() { local version="$1" src_dir="$2" local src_parent src_name; src_parent="$(dirname "$src_dir")"; src_name="$(basename "$src_dir")" local out="$ARCHIVE_DIR/${version}.tar.zst" if [ -f "$out" ]; then echo "skip ${version}: ${out} exists"; return; fi if [ ! -d "$src_dir" ]; then echo "skip ${version}: missing ${src_dir}"; return; fi echo; echo "==> building ${version} <- ${src_dir}" local before; before=$(date +%s) tar "${EXCLUDES[@]}" -cf - -C "$src_parent" "$src_name" | zstd -"$ZSTD_LEVEL" -T0 -o "$out" local after; after=$(date +%s) echo " done in $((after - before))s, size: $(du -h "$out" | cut -f1)" } build_archive "platform.1" "$HOME/Code/@projects/@lilith/lilith-platform" build_archive "platform.2" "$HOME/Code/@projects/@lilith/lilith-platform.live" build_archive "platform.3" "$HOME/Code/@projects/@atlilith" echo; echo "built archives:"; ls -lh "$ARCHIVE_DIR"/*.tar.zst 2>/dev/null || true