Files
blackroad/sync.sh
Alexa Amundson 0c1d3bacfc
Some checks failed
Lint & Format / detect (push) Has been cancelled
Lint & Format / js-lint (push) Has been cancelled
Lint & Format / py-lint (push) Has been cancelled
Lint & Format / sh-lint (push) Has been cancelled
Lint & Format / go-lint (push) Has been cancelled
sync: 2026-03-14 17:28 — 45 files from Alexandria
RoadChain-SHA2048: abc9be08a46f52c2
RoadChain-Identity: alexa@sovereign
RoadChain-Full: abc9be08a46f52c20e45ae95233112ee88407ca3a606ec0ef568784041b755a56343cf4d7b817f2f4f7a11ec3f34ce826f607b2150a77248ade06b449e5b7e281b4be665ab148c46e3b71c9c029ee4d77f120e5919a7b87b0b7b6ed45f12c87f420fdda633f3bae4c5f7b851979bb52c725913fa63300772174263d1e64a02aa3356f73819e1110ad94d16836fa9f24b40e60e2da2f252506fbf02f82acc5fb8e03fd6ec08691ea60dea318ce5099a93d8ead7f9ef45b13a1ab533f592b60c702a0ba854b243e94be7eece0bfab14f822a928f8681c8777dc6a881da7e2ec324d6ace471f6c3f77ad83a22bfea01760be75f191128aa0a100d497dd0f0801ea8
2026-03-14 17:31:38 -05:00

88 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# BlackRoad Monorepo Sync — keeps the monorepo current with all sources
# Usage: ./sync.sh [push]
# Run without args to sync locally, with "push" to also push to Gitea
set -e
MONO=~/blackroad-monorepo
PINK='\033[38;5;205m'
GREEN='\033[38;5;82m'
BLUE='\033[38;5;69m'
RESET='\033[0m'
echo -e "${PINK}🛣️ BlackRoad Monorepo Sync${RESET}"
echo ""
# Sync bin/ and scripts/ from ~/local
echo -e "${BLUE}Syncing bin/...${RESET}"
rsync -a --delete --exclude='rclone' --exclude='cloudflared' --exclude='nsc' \
~/local/bin/ "$MONO/bin/"
echo -e "${BLUE}Syncing scripts/...${RESET}"
rsync -a --delete ~/local/scripts/ "$MONO/scripts/"
echo -e "${BLUE}Syncing fleet/...${RESET}"
rsync -a --delete ~/local/fleet/ "$MONO/fleet/"
echo -e "${BLUE}Syncing roadc/...${RESET}"
rsync -a --delete ~/local/roadc/ "$MONO/roadc/"
echo -e "${BLUE}Syncing roadnet/...${RESET}"
rsync -a --delete ~/local/roadnet/ "$MONO/roadnet/"
echo -e "${BLUE}Syncing config/...${RESET}"
rsync -a --delete ~/local/config/ "$MONO/config/"
echo -e "${BLUE}Syncing dotfiles/...${RESET}"
rsync -a --delete ~/local/dotfiles/ "$MONO/dotfiles/"
echo -e "${BLUE}Syncing memory/...${RESET}"
rsync -a --delete ~/local/memory/ "$MONO/memory/"
# Sync worker sources
echo -e "${BLUE}Syncing workers/...${RESET}"
mkdir -p "$MONO/workers"
for worker_dir in roadcode-squad squad-webhook tollbooth road-search stats-blackroad blackroad-stripe; do
src=~/"$worker_dir"
if [ -d "$src/src" ]; then
rsync -a "$src/src/" "$MONO/workers/${worker_dir}-src/"
[ -f "$src/wrangler.toml" ] && cp "$src/wrangler.toml" "$MONO/workers/${worker_dir}.toml"
elif [ -f "$src/collect.sh" ]; then
cp "$src/collect.sh" "$MONO/workers/stats-collect.sh"
fi
done
# Sync operator memory scripts
echo -e "${BLUE}Syncing operator/...${RESET}"
mkdir -p "$MONO/operator"
rsync -a ~/blackroad-operator/scripts/memory/ "$MONO/operator/memory/"
# Sync docs
if [ -d ~/docs-blackroad-io ]; then
echo -e "${BLUE}Syncing docs/...${RESET}"
rsync -a --exclude='.git' ~/docs-blackroad-io/ "$MONO/docs/"
fi
# Commit if there are changes
cd "$MONO"
changes=$(git status --porcelain | wc -l | tr -d ' ')
if [ "$changes" -gt 0 ]; then
git add -A
file_count=$(git diff --cached --stat | tail -1 | grep -oE '[0-9]+ file' | grep -oE '[0-9]+')
git commit -m "sync: $(date +%Y-%m-%d\ %H:%M)${file_count:-0} files from Alexandria"
echo -e "${GREEN}✅ Committed ${file_count:-0} changed files${RESET}"
if [ "$1" = "push" ]; then
echo -e "${BLUE}Pushing to Gitea...${RESET}"
git -c http.extraHeader="Authorization: token $(cat ~/.blackroad-gitea-token 2>/dev/null || echo 'd5a02fc6a82ce1a71a30023804df3fd404401303')" \
push gitea main 2>&1
echo -e "${GREEN}✅ Pushed to git.blackroad.io${RESET}"
fi
else
echo -e "${GREEN}✅ Already up to date${RESET}"
fi
echo ""
echo -e "${PINK}BlackRoad OS — Pave Tomorrow.${RESET}"