Audit and optimize for CapableMind development
Brewfile: stripped to essential tools (~600MB freed), removed boost, cmake, aerc, newsboat, fontforge, starship, and 24 auto-dependencies. Added caffeine, ollama, fastfetch, ocrmypdf, tea, sshpass, vitetris. Dropped 1password, iterm2, github-desktop, hazel, swiftbar, oversight. Shell: fixed all stale references (fzf, zoxide, starship, old paths, Homebrew node aliases). Updated project paths to ~/_Dev/. Added CapableMind aliases (cm, bmf, bmf-health, bmf-status, bmf-logs). Configs: removed iterm2, neofetch, swiftbar configs. Added capablemind (launchd plists, MCP example, bmf-start script). Updated SSH config with git.skemantix.com. Added CLAUDE.md to dotfiles. Scripts: consolidated 3 backup scripts into 1 (backup-all-secrets.sh), added pass store backup. Added setup-capablemind.sh for full environment reconstruction. Updated symlinks.sh for new config structure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
e7bb361bd2
commit
066a47a26b
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
########################################
|
||||
# CONFIG — EDIT THESE 4 LINES
|
||||
########################################
|
||||
VAULT_PATH="/Users/davidglidden/Library/Mobile Documents/iCloud~md~obsidian/Documents/David, root-and-branch"
|
||||
MIRROR_PATH="/Users/davidglidden/_Dev/david-root-and-branch-vault-git"
|
||||
GIT_REMOTE="https://git.skemantix.com/David/david-root-and-branch-vault-git.git"
|
||||
GIT_BRANCH="main"
|
||||
|
||||
# Optional: set your git identity here (comment out if already global)
|
||||
# GIT_NAME="David Glidden"
|
||||
# GIT_EMAIL="you@example.com"
|
||||
|
||||
# Excludes file lives alongside this script
|
||||
EXCLUDES_FILE="$(dirname "$0")/obsidian_rsync_excludes.txt"
|
||||
LOG_FILE="${HOME}/Library/Logs/vaultsync.log"
|
||||
########################################
|
||||
|
||||
timestamp() { date "+%Y-%m-%d %H:%M:%S"; }
|
||||
log() { printf "[%s] %s\n" "$(timestamp)" "$*" | tee -a "$LOG_FILE"; }
|
||||
|
||||
ensure_paths() {
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
mkdir -p "$MIRROR_PATH"
|
||||
}
|
||||
|
||||
# Guard: skip if iCloud still downloading placeholders (*.icloud)
|
||||
icloud_busy() {
|
||||
# Any placeholder files inside vault?
|
||||
# NOTE: adjust -prune if you want to skip very large folders from scanning
|
||||
if find "$VAULT_PATH" -type f -name "*.icloud" -print -quit | grep -q . ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
init_git_repo() {
|
||||
if [ ! -d "$MIRROR_PATH/.git" ]; then
|
||||
log "Initializing git repo in $MIRROR_PATH"
|
||||
git init "$MIRROR_PATH"
|
||||
git -C "$MIRROR_PATH" checkout -b "$GIT_BRANCH" || true
|
||||
git -C "$MIRROR_PATH" remote add origin "$GIT_REMOTE" || true
|
||||
git -C "$MIRROR_PATH" config user.name "$GIT_NAME" || true
|
||||
git -C "$MIRROR_PATH" config user.email "$GIT_EMAIL" || true
|
||||
fi
|
||||
}
|
||||
|
||||
do_rsync() {
|
||||
log "Syncing from iCloud vault → mirror"
|
||||
rsync -av --delete \
|
||||
--exclude-from="$EXCLUDES_FILE" \
|
||||
"$VAULT_PATH"/ "$MIRROR_PATH"/ | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
do_commit_push() {
|
||||
log "Checking for changes to commit"
|
||||
if ! git -C "$MIRROR_PATH" diff --quiet || \
|
||||
! git -C "$MIRROR_PATH" diff --cached --quiet || \
|
||||
[ -n "$(git -C "$MIRROR_PATH" ls-files --others --exclude-standard)" ]; then
|
||||
git -C "$MIRROR_PATH" add -A
|
||||
git -C "$MIRROR_PATH" commit -m "Mirror sync $(date +%Y-%m-%d_%H-%M-%S)" --no-verify
|
||||
log "Committed changes"
|
||||
# Push; if first push, set upstream
|
||||
if git -C "$MIRROR_PATH" rev-parse --verify "$GIT_BRANCH" >/dev/null 2>&1; then
|
||||
git -C "$MIRROR_PATH" push origin "$GIT_BRANCH" || log "Push failed (network?). Will retry next run."
|
||||
else
|
||||
git -C "$MIRROR_PATH" push -u origin "$GIT_BRANCH" || log "First push failed. Check remote."
|
||||
fi
|
||||
else
|
||||
log "No changes to commit"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
ensure_paths
|
||||
|
||||
if icloud_busy; then
|
||||
log "iCloud still downloading placeholders (*.icloud). Skipping this run."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
init_git_repo
|
||||
do_rsync
|
||||
do_commit_push
|
||||
|
||||
log "Done."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user