#!/usr/bin/env bash # /workspace/push-all-to-git-libre-audio.sh # Release v2.15.0: Pre-push verification & topological push of all 6 repositories to git.libre.audio. set -euo pipefail on_error() { local exit_code=$? local line_no="${1:-unknown}" echo "[ERROR] push-all-to-git-libre-audio.sh failed at line ${line_no} with exit code ${exit_code} while running: ${BASH_COMMAND}" >&2 exit "${exit_code}" } trap 'on_error ${LINENO}' ERR run_checked() { local label="$1" shift local out="" local rc=0 out="$("$@" 2>&1)" || rc=$? if [[ "${rc}" -ne 0 ]]; then echo "[ERROR] ${label} failed (exit code ${rc}): $*" >&2 if [[ -n "${out}" ]]; then echo "${out}" >&2 fi return "${rc}" fi } ensure_remote_url() { local repo_dir="$1" local remote_name="$2" local target_url="$3" if git -C "${repo_dir}" remote | grep -qx "${remote_name}"; then run_checked "git remote set-url ${remote_name} (${repo_dir})" git -C "${repo_dir}" remote set-url "${remote_name}" "${target_url}" else run_checked "git remote add ${remote_name} (${repo_dir})" git -C "${repo_dir}" remote add "${remote_name}" "${target_url}" fi } SCRIPT_PATH="${BASH_SOURCE[0]:-$0}" DEFAULT_WS_DIR="$(cd "$(dirname "${SCRIPT_PATH}")" && pwd)" if [[ ! -d "${DEFAULT_WS_DIR}/hyperstitionstudio-core/src" ]] && [[ -d "/workspace/hyperstitionstudio-core/src" ]]; then DEFAULT_WS_DIR="/workspace" fi export WORKSPACE_DIR="${WORKSPACE_DIR:-${DEFAULT_WS_DIR}}" export PYTHONPATH="${WORKSPACE_DIR}/hyperstitionstudio-core/src${PYTHONPATH:+:${PYTHONPATH}}" export HYPERSTITIONSTUDIO_CONFIG="${HYPERSTITIONSTUDIO_CONFIG:-${WORKSPACE_DIR}/workspace.toml}" FORGE_SSH="${FORGE_SSH:-ssh://git@git.libre.audio:2222/seasharp}" echo "[info] WORKSPACE_DIR=${WORKSPACE_DIR}" echo "[info] PYTHONPATH=${PYTHONPATH}" echo "[1/3] Running pre-push verification gates (hs-archive-rotate, hs-closeups-sync, hs-readme-sync, version_sync, hs-doctor, logrotate.d/hyperstition-sqlite-meta check, periodic harvest CI/CD flow diagram PNG test, closeups check, test_core_suite, 6-gate graph verifier)..." run_checked "hs-archive-rotate --enforce-single-compression" python3 -m hyperstitionstud_io.publishing.archive_rotator --workspace-root "${WORKSPACE_DIR}" --enforce-single-compression run_checked "verify docs/archive/archive-manifest.json" test -s "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/docs/archive/archive-manifest.json" run_checked "verify docs/plans/inactive/inactive-archive-manifest.json" test -s "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/docs/plans/inactive/inactive-archive-manifest.json" run_checked "hs-closeups-sync" python3 -m hyperstitionstud_io.publishing.closeups_sync run_checked "hs-readme-sync --install-hooks" python3 -m hyperstitionstud_io.publishing.readme_sync --install-hooks run_checked "version_sync --check" python3 -m hyperstitionstud_io.version_sync --check run_checked "version_sync --corpus-delta" python3 -m hyperstitionstud_io.version_sync --corpus-delta run_checked "hs-doctor" python3 -m hyperstitionstud_io.ci.doctor run_checked "verify deploy/logrotate.d/hyperstition-sqlite-meta" test -f "${WORKSPACE_DIR}/hyperstitionstudio-core/deploy/logrotate.d/hyperstition-sqlite-meta" run_checked "verify site/assets/hs-matrix-coderain.js" test -s "${WORKSPACE_DIR}/hyperstitionstudio-core/site/assets/hs-matrix-coderain.js" run_checked "verify site/assets/matrix-font.woff2" test -s "${WORKSPACE_DIR}/hyperstitionstudio-core/site/assets/matrix-font.woff2" for q_png in \ "quadrant-1-cybermemetics-calc-graph.png" \ "quadrant-1-tab-2-graph.png" \ "quadrant-2-esoteric-finance-quant.png" \ "quadrant-2-tab-2-bayesian-fred.png" \ "quadrant-2-tab-3-leaderboard-card.png" \ "quadrant-3-info-science-novice-learn-polyglot.png" \ "quadrant-3-tab-2-math-guile.png" \ "quadrant-3-tab-3-math-ts-rust.png" \ "quadrant-4-operators-deployment-vps.png" \ "quadrant-4-tab-2-mcp-etag.png" \ "quadrant-4-tab-3-ci-gates.png"; do run_checked "verify site/assets/closeups/${q_png}" test -s "${WORKSPACE_DIR}/hyperstitionstudio-core/site/assets/closeups/${q_png}" done run_checked "generate & verify periodic-harvest-cicd-to-vps-flow-diagram.png" python3 -m hyperstitionstud_io.publishing.flow_diagram run_checked "verify periodic-harvest-cicd-to-vps-flow-diagram.png exists" test -s "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/docs/periodic-harvest-cicd-to-vps-flow-diagram.png" run_checked "verify Fedora 41 packaging scripts & spec" "${WORKSPACE_DIR}/ingglish-hyperdope-gematria/packaging/build-fedora41-rpm.sh" run_checked "verify Fedora 41 exegesis push worker dry-run" "${WORKSPACE_DIR}/ingglish-hyperdope-gematria/packaging/bundle/scripts/run_exegesis_and_push_fedora41.sh" --dry-run python3 "${WORKSPACE_DIR}/hyperstitionstudio-core/tests/test_core_suite.py" run_checked "build_encyclopedia_knowledge_graph.py --verify-only" python3 "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only echo "[2/3] Verifying git.libre.audio remote URLs across all repositories..." for pair in \ "hyperstitionstudio-core:hyperstitionstudio-core.git" \ "ingglish-hyperdope-gematria:ingglish-hyperdope-gematria.git" \ "technocapital-singularity-zoology:technocapital-singularity-zoology.git" \ "encyclopedia-knowledge-graph:encyclopedia-knowledge-graph.git" \ "hyperdope-ci-build:ingglish-hyperdope-ci.git"; do rdir="${WORKSPACE_DIR}/${pair%%:*}" rslug="${pair##*:}" ensure_remote_url "${rdir}" origin "${FORGE_SSH}/${rslug}" done push_head_tag() { local repo_dir="$1" local remote_name="$2" local head_tag="" head_tag="$(git -C "${repo_dir}" tag --points-at HEAD | sort -V | tail -n 1)" if [[ -n "${head_tag}" ]]; then run_checked "git push tag ${head_tag} (${repo_dir})" git -C "${repo_dir}" push --force "${remote_name}" "refs/tags/${head_tag}" fi } echo "[3/3] Rebasing any automated VPS telemetry commits & pushing all 6 repositories and HEAD release tags in topological dependency order to ${FORGE_SSH}..." echo " -> (1/6) hyperstitionstudio-core (main + HEAD tag)" git -C "${WORKSPACE_DIR}/hyperstitionstudio-core" pull --rebase --autostash origin main || true git -C "${WORKSPACE_DIR}/hyperstitionstudio-core" push -u origin main push_head_tag "${WORKSPACE_DIR}/hyperstitionstudio-core" origin echo " -> (2/6) ingglish-hyperdope-gematria (main + HEAD tag)" git -C "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" pull --rebase --autostash origin main || true git -C "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" push -u origin main push_head_tag "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" origin echo " -> (3/6) technocapital-singularity-zoology (main + HEAD tag)" git -C "${WORKSPACE_DIR}/technocapital-singularity-zoology" pull --rebase --autostash origin main || true git -C "${WORKSPACE_DIR}/technocapital-singularity-zoology" push -u origin main push_head_tag "${WORKSPACE_DIR}/technocapital-singularity-zoology" origin echo " -> (4/6) encyclopedia-knowledge-graph (main + HEAD tag)" git -C "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" pull --rebase --autostash origin main || true git -C "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" push -u origin main push_head_tag "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" origin echo " -> (5/6) hyperdope-ci-build (feat/ingglish-aq-corpus + HEAD tag)" git -C "${WORKSPACE_DIR}/hyperdope-ci-build" pull --rebase --autostash origin feat/ingglish-aq-corpus || true git -C "${WORKSPACE_DIR}/hyperdope-ci-build" push -u origin feat/ingglish-aq-corpus push_head_tag "${WORKSPACE_DIR}/hyperdope-ci-build" origin if [[ -d "${WORKSPACE_DIR}/haiperdohp-jemaytreeah/.git" ]]; then echo " -> (6/6) haiperdohp-jemaytreeah (downstream main, feat/ingglish-aq-corpus, feat/ingglish-priority-toggle + HEAD tag)" ensure_remote_url "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" downstream "${FORGE_SSH}/haiperdohp-jemaytreeah.git" git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" push downstream main feat/ingglish-aq-corpus feat/ingglish-priority-toggle push_head_tag "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" downstream fi echo "[OK] All 6 repositories and release tags pushed to ${FORGE_SSH}."