add: sync-up.sh — push live hermes config to repo
The harness is the source. The repo is the record. Changes flow UP from ~/.hermes, not down from the repo.
This commit is contained in:
42
bin/sync-up.sh
Executable file
42
bin/sync-up.sh
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user