#!/bin/bash # Elizabeth Xet Data Preparation Script # Prepares all data for Xet push - can be manually uploaded if CLI not available echo "=== Preparing Elizabeth Data for Xet Push ===" # Create backup directory structure BACKUP_DIR="/workspace/elizabeth_xet_ready" TIMESTAMP=$(date +%Y%m%d_%H%M%S) XET_READY_DIR="$BACKUP_DIR/elizabeth_data_$TIMESTAMP" mkdir -p "$XET_READY_DIR" echo "Created Xet ready directory: $XET_READY_DIR" # 1. Database Files echo "1. Backing up database files..." mkdir -p "$XET_READY_DIR/databases" # SQLite databases if [ -f "/workspace/elizabeth_memory.db" ]; then cp "/workspace/elizabeth_memory.db" "$XET_READY_DIR/databases/" echo " ✓ elizabeth_memory.db" fi if [ -f "/workspace/nova_memory.db" ]; then cp "/workspace/nova_memory.db" "$XET_READY_DIR/databases/" echo " ✓ nova_memory.db" fi # 2. ChromaDB Data echo "2. Backing up ChromaDB data..." if [ -d "/workspace/elizabeth_chroma" ]; then mkdir -p "$XET_READY_DIR/chromadb" cp -r "/workspace/elizabeth_chroma"/* "$XET_READY_DIR/chromadb/" 2>/dev/null || echo " ⚠️ ChromaDB copy may have partial issues" echo " ✓ ChromaDB data" fi # 3. Log Files echo "3. Backing up log files..." if [ -d "/workspace/elizabeth_logs" ]; then mkdir -p "$XET_READY_DIR/logs" cp -r "/workspace/elizabeth_logs"/* "$XET_READY_DIR/logs/" 2>/dev/null echo " ✓ Log files" fi # 4. Configuration Files echo "4. Backing up configuration..." mkdir -p "$XET_READY_DIR/config" # Environment file if [ -f "/workspace/elizabeth-repo/.env" ]; then cp "/workspace/elizabeth-repo/.env" "$XET_READY_DIR/config/" echo " ✓ .env configuration" fi # 5. Repository Code echo "5. Backing up repository code..." mkdir -p "$XET_READY_DIR/code" cp -r "/workspace/elizabeth-repo"/* "$XET_READY_DIR/code/" 2>/dev/null # Remove any large or unnecessary files find "$XET_READY_DIR/code" -name "*.pyc" -delete find "$XET_READY_DIR/code" -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true echo " ✓ Repository code" # 6. Create manifest file echo "6. Creating data manifest..." cat > "$XET_READY_DIR/manifest.json" << EOF { "version": "1.0", "timestamp": "$(date -Iseconds)", "elizabeth_version": "v0.0.2", "data_sources": [ { "type": "sqlite_databases", "files": ["elizabeth_memory.db", "nova_memory.db"], "description": "Primary conversation and memory storage" }, { "type": "chromadb", "description": "Semantic search and vector memory" }, { "type": "logs", "description": "Conversation logs and activity history" }, { "type": "configuration", "files": [".env"], "description": "Environment configuration and API keys" }, { "type": "source_code", "description": "Complete Elizabeth repository with versions v0.0.1 and v0.0.2" } ], "total_size_mb": $(du -sm "$XET_READY_DIR" 2>/dev/null | cut -f1 || echo 0), "backup_type": "full_xet_ready", "instructions": "This directory contains all Elizabeth data ready for Xet push. Upload entire directory to Xet repository." } EOF echo " ✓ Manifest file" # 7. Create push instructions echo "7. Creating push instructions..." cat > "$XET_READY_DIR/XET_PUSH_INSTRUCTIONS.md" << 'EOF' # Xet Push Instructions for Elizabeth Data ## Prerequisites 1. Install Xet CLI: `curl -s https://xetbeta.com/install.sh | bash` 2. Ensure git-xet command is available: `git xet --help` ## Push to Xet Repository ### Option 1: Initialize New Repository ```bash cd /workspace/xet_data git xet init git remote add origin https://xetbeta.com/adaptnova/elizabeth-data git xet add . git xet commit -m "Elizabeth full data backup $(date +%Y-%m-%d)" git xet push origin main ``` ### Option 2: Manual Upload 1. Upload this entire directory to: https://xetbeta.com/adaptnova/elizabeth-data 2. Use Xet web interface or CLI ### Option 3: GitHub + Xet Sync 1. Push to GitHub first: https://github.com/adaptnova/elizabeth 2. Use Xet-GitHub integration for data versioning ## Data Contents - `/databases/` - SQLite databases with all conversations and memories - `/chromadb/` - Semantic search vector database - `/logs/` - Conversation logs and activity history - `/config/` - Environment configuration - `/code/` - Complete source code repository ## Verification After push, verify data integrity: ```bash git xet verify git xet log --oneline ``` EOF echo " ✓ Push instructions" # 8. Final summary echo "" echo "=== XET DATA PREPARATION COMPLETE ===" echo "Location: $XET_READY_DIR" echo "Total size: $(du -sh $XET_READY_DIR | cut -f1)" echo "" echo "Next steps:" echo "1. Install Xet CLI: curl -s https://xetbeta.com/install.sh | bash" echo "2. Push to Xet: cd $XET_READY_DIR && follow XET_PUSH_INSTRUCTIONS.md" echo "3. Or manually upload to: https://xetbeta.com/adaptnova/elizabeth-data" echo "" echo "All Elizabeth data is now prepared and ready for Xet push!" # Create symlink to latest ln -sfn "$XET_READY_DIR" "$BACKUP_DIR/latest" echo "Latest backup symlink: $BACKUP_DIR/latest"