if [ -f $REMOTE_PROGRESS ]; then
	echo "Waiting for remote-local.sh to finish..."
	exit 0
fi

sshpass -p "${SERVER_PASSWORD}" \
    rsync -avzu --delete \
    `# Version control and editor files` \
    --exclude .git \
    --exclude .vscode \
    --exclude .DS_Store \
    `# Dependencies` \
    --exclude node_modules \
    --exclude vendor \
    `# Dynamic content directories` \
    --exclude storage \
    --exclude uploads \
    --exclude temp \
    --exclude cache \
    --exclude sitepress-multilingual-cms \
    `# Build assets - include specific file types only` \
    --include 'public/build/assets/**.js' \
    --include 'public/build/assets/**.css' \
    --include 'public/build/assets/**.json' \
    --include 'public/build/assets' \
    --exclude 'public/build/assets/**' \
    `# Claudshit AI shit` \
    --exclude ".claude" \
    --exclude ".playwright-mcp" \
    `# Project scripts` \
    --exclude "lazygit" \
    --exclude ssh.sh \
    --exclude remote-local.sh \
    --exclude local-remote.sh \
    --exclude .build-cache \
    --exclude watch-build.sh \
    --exclude sftp-watch.sh \
    --exclude split-conflicts.sh \
    --exclude $REMOTE_PROGRESS \
    -e ssh . "${SERVER_USER}@${SERVER_HOST}:${SERVER_PATH}"
