#!/usr/bin/env bash # Sync upstream `matter/` package, `spec/` directory, and curated example images # into the Space directory. Run this BEFORE `git push` to ashu-1069/matter. set -euo pipefail SPACE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_DIR="$(cd "$SPACE_DIR/.." && pwd)" echo "==> Syncing matter/ → space/matter/" rm -rf "$SPACE_DIR/matter" rsync -a --exclude="__pycache__" --exclude="*.pyc" "$REPO_DIR/matter/" "$SPACE_DIR/matter/" echo "==> Syncing spec/ → space/spec/" rm -rf "$SPACE_DIR/spec" rsync -a --exclude="__pycache__" "$REPO_DIR/spec/" "$SPACE_DIR/spec/" echo "==> Resizing + converting example images → space/examples/ (JPEG, max 1280px)" mkdir -p "$SPACE_DIR/examples" python3 - < 1280: r = 1280 / m img = img.resize((int(w * r), int(h * r)), Image.LANCZOS) out = out_dir / (src.stem + ".jpg") img.save(out, "JPEG", quality=85, optimize=True) print(f" ✓ {out.name} ({out.stat().st_size // 1024} KB)") PY echo "✅ Space directory ready at: $SPACE_DIR" echo " Push with: cd $SPACE_DIR && git add -A && git commit -m 'sync' && git push"