PEP-230: образ платформы знает свой коммит (переезд на сервер, шаг 1) #218

Merged
peppa-bot merged 15 commits from task/pep-230 into main 2026-11-22 05:09:53 +00:00
Showing only changes of commit 379ae6a845 - Show all commits

View File

@ -20,13 +20,14 @@ SERVICES="bot watchdog web observer"
S true || die "сервер недоступен"
say "живых сессий агентов: $(sqlite3 -readonly "$PH/peppa.db" "select count(*) from sessions where status not in ('done','failed')")"
DIRS=$(sqlite3 -readonly "$PH/peppa.db" "select workspace_path from projects where deleted_at is null; select workspace_path from sessions where workspace_path is not null and status not in ('done','failed');" | sort -u)
LIVE=$(sqlite3 -readonly "$PH/peppa.db" "select workspace_path from projects where key = '${PEPPA_PLATFORM_KEY:-PEP}'")
LOST=0
for d in $DIRS; do
[ -d "$d/.git" ] || [ -f "$d/.git" ] || continue
[ -d "$d/scripts/server-move" ] || [ -f "$d/scripts/live-deploy.sh" ] && continue # сама платформа: её код уже в Gitea
[ "$d" = "$LIVE" ] && continue # живая копия платформы: в ней не коммитят, её код уже в Gitea
br=$(git -C "$d" branch --show-current 2>/dev/null || true)
dirty=$(git -C "$d" status --porcelain 2>/dev/null | grep -v '^?? .peppa/' | wc -l | tr -d ' ')
ahead=$(git -C "$d" log --oneline --branches --not --remotes 2>/dev/null | wc -l | tr -d ' ')
dirty=$(git -C "$d" status --porcelain 2>/dev/null | { grep -v '^?? .peppa/' || true; } | wc -l | tr -d ' ')
ahead=$(git -C "$d" log --oneline HEAD --not --remotes 2>/dev/null | wc -l | tr -d ' ')
[ "$dirty" = 0 ] && [ "$ahead" = 0 ] && continue
say "не в Gitea: $d (ветка ${br:-?}, изменённых файлов $dirty, неотправленных коммитов $ahead)"
[ "$MODE" = go ] || continue