diff --git a/bin/sync-up.sh b/bin/sync-up.sh new file mode 100755 index 00000000..a6ce778b --- /dev/null +++ b/bin/sync-up.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# sync-up.sh — Push live ~/.hermes config changes UP to timmy-config repo. +# The harness is the source. The repo is the record. +# Run periodically or after significant config changes. + +set -euo pipefail + +REPO_DIR="$HOME/.timmy/timmy-config" +HERMES_HOME="$HOME/.hermes" + +log() { echo "[sync-up] $*"; } + +# === Copy live config into repo === +cp "$HERMES_HOME/config.yaml" "$REPO_DIR/config.yaml" +log "config.yaml" + +# === Playbooks === +for f in "$HERMES_HOME"/playbooks/*.yaml; do + [ -f "$f" ] && cp "$f" "$REPO_DIR/playbooks/" +done +log "playbooks/" + +# === Skins === +for f in "$HERMES_HOME"/skins/*; do + [ -f "$f" ] && cp "$f" "$REPO_DIR/skins/" +done +log "skins/" + +# === Channel directory === +[ -f "$HERMES_HOME/channel_directory.json" ] && cp "$HERMES_HOME/channel_directory.json" "$REPO_DIR/" +log "channel_directory.json" + +# === Commit and push if there are changes === +cd "$REPO_DIR" +if [ -n "$(git status --porcelain)" ]; then + git add -A + git commit -m "sync: live config from ~/.hermes $(date +%Y-%m-%d_%H:%M)" + git push + log "Pushed changes to Gitea." +else + log "No changes to sync." +fi