#!/usr/bin/env bash # One-time migration: copy activity-core PVC daily-triage notes into the # railiance01 the-custodian clone so consistency sweep can commit them. set -euo pipefail KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config-hosteurope}" CLONE_DIR="${CLONE_DIR:-/home/tegwick/the-custodian/memory/working}" NAMESPACE="${NAMESPACE:-activity-core}" echo "=== Source: actcore-worker PVC mount (legacy) ===" KUBECONFIG="${KUBECONFIG}" kubectl -n "${NAMESPACE}" exec deploy/actcore-worker -- \ sh -c 'ls -1 /var/custodian/memory/working/daily-triage-*.md 2>/dev/null | wc -l' || echo "0" echo "=== Copying daily-triage notes to ${CLONE_DIR} ===" KUBECONFIG="${KUBECONFIG}" kubectl -n "${NAMESPACE}" exec deploy/actcore-worker -- \ tar czf - -C /var/custodian/memory/working . 2>/dev/null \ | ssh -i "${OPS_SSH_KEY:-$HOME/.ssh/id_ops}" tegwick@92.205.62.239 \ "mkdir -p '${CLONE_DIR}' && tar xzf - -C '${CLONE_DIR}'" echo "=== Destination file count ===" ssh -i "${OPS_SSH_KEY:-$HOME/.ssh/id_ops}" tegwick@92.205.62.239 \ "ls -1 '${CLONE_DIR}'/daily-triage-*.md 2>/dev/null | wc -l" echo "Done. Run consistency sweep on the-custodian to commit migrated notes."