#!/usr/bin/env sh set -eu PROJECTOR_DIR="${PROJECTOR_DIR:-/Users/virgil/Developer/rta/tmp/markdown-projection-gitea/projector-checkout/rta-handbook}" HOME_LAB_DIR="${HOME_LAB_DIR:-/Users/virgil/Developer/Virgil-Info/home-lab-v7}" if [ ! -d "$PROJECTOR_DIR/.git" ]; then echo "Sync checkout not found: $PROJECTOR_DIR" >&2 exit 1 fi if [ ! -d "$HOME_LAB_DIR" ]; then echo "home-lab-v7 not found: $HOME_LAB_DIR" >&2 exit 1 fi echo "==> Pulling the Git docs checkout" git -C "$PROJECTOR_DIR" pull --ff-only echo "==> Checking the Git docs checkout is clean" if [ -n "$(git -C "$PROJECTOR_DIR" status --porcelain)" ]; then git -C "$PROJECTOR_DIR" status --short echo "Git docs checkout is dirty; refresh must read a clean source." >&2 exit 1 fi echo "==> Refreshing AFFiNE from Markdown" cd "$HOME_LAB_DIR" nix develop --command bash -lc "scripts/ops/sync-obsidian-affine.rb \ --name section0-rta-handbook \ --source '$PROJECTOR_DIR' \ --username projection-bot \ --authentik-sub rta-projection-bot \ --affine-workspace 'Agent Workspace' \ --affine-workspace-id 53ea0a0b-eca7-4887-8e31-f5b2a8ab7744 \ --affine-user-id ce42f50a-5367-4466-920b-7422c4e27de0 \ --affine-namespace 'Section 0/Git Projections/RTA Handbook' \ --include '**/*.md' \ --apply"