vault scripts: publish canonical Obsidian vault into the repo mirror

This commit is contained in:
jimmy
2026-09-13 12:07:50 -07:00
parent aa52eecb5c
commit e8ee99f046
2 changed files with 62 additions and 32 deletions
+17 -10
View File
@@ -1,14 +1,17 @@
#!/usr/bin/env bash
# Zero-token vault change log
# Dumps raw git log to a file for agents to read.
# Zero-token vault change log.
# Reads the vault's publish history (the mirror subtree in the AgentOS repo) and
# writes it into the vault itself so agents can read it.
VAULT_DIR="/c/Users/fight/AgentOS/memory-systems/agent-os"
VAULT_DIR="/c/Users/fight/Documents/Obsidian Vault"
REPO_DIR="/c/Users/fight/AgentOS"
MIRROR_PATH="memory-systems/agent-os"
LOG_FILE="$VAULT_DIR/03_shared/vault-updates-log.md"
cd "$VAULT_DIR" || exit 1
cd "$REPO_DIR" || exit 1
# Refresh from remote first (best-effort: --rebase refuses on a dirty tree).
git pull --rebase > /dev/null 2>&1
# Refresh from remote first (best-effort; --autostash so a dirty repo can't block it).
git pull --rebase --autostash > /dev/null 2>&1
{
echo "# Vault Updates Log"
@@ -19,21 +22,25 @@ git pull --rebase > /dev/null 2>&1
echo ""
echo "## Last 24 Hours"
echo ""
git log --since="24 hours ago" --oneline --no-merges 2>/dev/null || echo "No recent commits."
git log --since="24 hours ago" --oneline --no-merges -- "$MIRROR_PATH" 2>/dev/null \
|| echo "No recent commits."
echo ""
echo "---"
echo ""
echo "## Last 7 Days"
echo ""
git log --since="7 days ago" --oneline --no-merges 2>/dev/null | head -20
git log --since="7 days ago" --oneline --no-merges -- "$MIRROR_PATH" 2>/dev/null | head -20
echo ""
echo "---"
echo ""
echo "## Files Changed (Last 24h)"
echo ""
# `HEAD@{24.hours.ago}` fails on a young reflog; derive the list from the log instead.
git log --since="24 hours ago" --name-only --pretty=format: -- . 2>/dev/null \
| sed '/^[[:space:]]*$/d' | sort -u
# The mirror path prefix is stripped so the list reads as vault-relative paths.
git log --since="24 hours ago" --name-only --pretty=format: -- "$MIRROR_PATH" 2>/dev/null \
| sed '/^[[:space:]]*$/d' \
| sed "s|^$MIRROR_PATH/||" \
| sort -u
} > "$LOG_FILE"
echo "Vault change log updated: $LOG_FILE"