#!/usr/bin/env bash # /workspace/hyperstitionstudio-core/deploy/test-first-deployment.sh # End-to-end verification of the per-repository deployment layout (including haiperdohp-jemaytreeah). # # Mode 1 (Default — Local / Staging Self-Contained HTTP Smoke Test): # Hydrates LIVE_REPOS (default: /tmp/hyperstition-live-repos), starts a local HTTP server # on 127.0.0.1:18090, and verifies HTTP 200 OK across all 26 portal, graph, encyclopedia, # haiperdohp-jemaytreeah calculator, CI & schema routes. # # Mode 2 (Remote VPS Verification): # ./test-first-deployment.sh https://hyperstitionstud.io set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" TARGET_BASE_URL="${1:-}" SERVER_PID="" cleanup() { if [[ -n "${SERVER_PID}" ]] && kill -0 "${SERVER_PID}" 2>/dev/null; then kill "${SERVER_PID}" 2>/dev/null || true fi } trap cleanup EXIT if [[ -z "${TARGET_BASE_URL}" ]]; then export LIVE_REPOS="${LIVE_REPOS:-/tmp/hyperstition-live-repos}" rm -rf "${LIVE_REPOS}" echo "[1/3] Hydrating per-repository webroot at ${LIVE_REPOS} via sync-vps-repos.sh --no-pull..." "${SCRIPT_DIR}/sync-vps-repos.sh" --no-pull PORT="${TEST_PORT:-18090}" echo "[2/3] Starting local HTTP server on http://127.0.0.1:${PORT} serving ${LIVE_REPOS}..." python3 -m http.server "${PORT}" --bind 127.0.0.1 --directory "${LIVE_REPOS}" >/dev/null 2>&1 & SERVER_PID="$!" sleep 0.6 TARGET_BASE_URL="http://127.0.0.1:${PORT}" fi echo "[3/3] Verifying all 35 portal, /learn/, /gallery/, graph, encyclopedia, haiperdohp-jemaytreeah (.gitignore artifacts), CI & schema routes against ${TARGET_BASE_URL}..." ROUTES=( "/" "/learn/index.html" "/learn/learn-app.js" "/gallery/index.html" "/gallery/gallery-data.js" "/gallery/media/meme_1_custom_pokedex_technocapital_zoology_m7_129_125.png" "/gallery/media/meme_1_custom_pokedex_technocapital_zoology_m7_129_125.pdf" "/graph/index.html" "/graph/graph-data.js" "/graph/encyclopedia-graph.json" "/graph/OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH.pdf" "/graph/docs/specification-concentric-eti-tier-ring-radar-d-periphery.pdf" "/graph/docs/cross-repo-dependency-and-audit-flow-diagram.html" "/graph/docs/cross-repo-dependency-and-audit-flow-diagram.pdf" "/graph/docs/VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE.pdf" "/encyclopedia/00-index-and-ontological-atlas/00-master-encyclopedia-index-a-to-z.pdf" "/technocapital-singularity-zoology/encyclopedia/00-index-and-ontological-atlas/00-master-encyclopedia-index-a-to-z.pdf" "/zoology/encyclopedia-of-technocapital-singularity-zoology-overview-and-manifest.pdf" "/zoology/technocapital-singularity-zoology-comprehensive-glossary.pdf" "/zoology/tier-list-technocapital-assemblage-builds.png" "/zoology/tier-list-technocapital-assemblage-builds.pdf" "/zoology/proposal-fund-manager-novel-investment-discovery.pdf" "/zoology/proposal-corporate-board-technocapital-allocation.pdf" "/zoology/m7-emergent-subclass-bidirectional-aq-nucleation.pdf" "/archive/00-index-and-methodology.md" "/calc/index.html" "/calc/config.js" "/calc/calc/ciphers.js" "/calc/calc/database.js" "/calc/db_lite.json" "/calc/db.json" "/ci/ONBOARDING-INGGLISH-AQ.pdf" "/ci/ci-audit-report.json" "/schemas/v1/encyclopedia-graph.schema.json" "/schemas/v1/learn-progress-state.schema.json" "/schemas/v1/financial-aq-harvest.schema.json" ) PASS_COUNT=0 for route in "${ROUTES[@]}"; do url="${TARGET_BASE_URL}${route}" code="$(curl -s -o /dev/null -w "%{http_code}" "${url}")" if [[ "${code}" == "200" ]]; then PASS_COUNT=$((PASS_COUNT + 1)) echo " [200 OK] ${route}" else echo " [FAIL ${code}] ${url}" >&2 exit 1 fi done echo "[OK] All ${PASS_COUNT}/${#ROUTES[@]} deployment routes verified (HTTP 200 OK)."