From f78cf47e00aaf6ca43d7a6c5207345b352f6241a Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Tue, 1 Dec 2026 11:41:02 +0000 Subject: [PATCH] Release v2.14.0: Implement pre-commit preparation & 8-gate drift-blocking verifier (hs-deploy-scripts-sync Gates D1-D8) for push-all-to-git-libre-audio.sh and deploy/sync-vps-repos.sh (Plan #58) --- README.md | 12 +- deploy/push-all-to-git-libre-audio.sh | 142 ++++++++++ deploy/sync-vps-repos.sh | 1 + package.json | 2 +- packages-js/ciphers-aq/package.json | 2 +- pyproject.toml | 3 +- scripts/build_gallery_manifest.py | 4 +- site/donate/index.html | 8 +- .../cicd-vps-tmpfs-and-regression/index.html | 16 +- .../ciphers-and-phonetics/index.html | 16 +- site/engineering/engineering-manifest-data.js | 2 +- site/engineering/engineering-manifest.json | 9 +- site/engineering/index.html | 20 +- .../knowledge-graph-and-sqlite/index.html | 16 +- .../mcp-chatbot-rest-and-ipld/index.html | 18 +- .../quant-macro-and-bayesian-brief/index.html | 16 +- site/gallery/index.html | 2 +- site/index.html | 10 +- site/learn/index.html | 8 +- site/learn/learn-app.js | 2 +- .../math/base36-algebra-and-primes/index.html | 16 +- .../graph-topology-and-eti-scoring/index.html | 16 +- site/math/index.html | 16 +- .../index.html | 16 +- site/math/math-manifest-data.js | 2 +- site/math/math-manifest.json | 4 +- .../index.html | 16 +- .../index.html | 16 +- site/quant/index.html | 18 +- site/quant/quant-app.js | 2 +- site/quant/quant-tutorials.js | 2 +- src/hyperstitionstud_io/__init__.py | 4 +- .../ci/deploy_scripts_sync.py | 247 ++++++++++++++++++ src/hyperstitionstud_io/mcp/server.py | 4 +- .../publishing/readme_sync.py | 10 +- src/hyperstitionstud_io/quant/collector.py | 2 +- src/hyperstitionstud_io/version_sync.py | 12 + tests/test_core_suite.py | 12 + workspace.example.toml | 2 +- 39 files changed, 574 insertions(+), 152 deletions(-) create mode 100755 deploy/push-all-to-git-libre-audio.sh create mode 100644 src/hyperstitionstud_io/ci/deploy_scripts_sync.py diff --git a/README.md b/README.md index e7a20dc..5e7824a 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# `hyperstitionstudio-core` (`hyperstitionstud_io.*` — `v2.13.0`) +# `hyperstitionstudio-core` (`hyperstitionstud_io.*` — `v2.14.0`) -> **Gitea Commit & Release Telemetry (`v2.13.0` • Namespace `urn:io:hyperstitionstud`)** +> **Gitea Commit & Release Telemetry (`v2.14.0` • Namespace `urn:io:hyperstitionstud`)** > - **Repository Role & Public Route:** Shared PEP 420 Python core library (`hyperstitionstud_io.*`), MCP/REST server, `/quant/`, `/learn/`, `/engineering/`, `/math/`, & `/donate/` webroots → [`https://hyperstitionstud.io/`](https://hyperstitionstud.io/) -> - **Latest Commit Scope (`hyperstitionstudio-core`):** Synchronized v2.13.0 release state across 2 tracked module/artifact surface(s) -> - **Touched Files / Surfaces:** `deploy/Caddyfile`, `deploy/sync-vps-repos.sh` -> - **Live Verified Ecosystem Metrics (`v2.13.0`):** `6` Repositories • `17` CLI Entrypoints • `20` MCP/REST Tools • `14` URN Resources • `63` Verified Web Routes • `388` KG Nodes / `1,282` Edges • `282` Glossary Entries • `4,943` Offline CMUdict Phonetics • `0` Synthetic Data +> - **Latest Commit Scope (`hyperstitionstudio-core`):** Synchronized v2.14.0 release state across 38 tracked module/artifact surface(s) +> - **Touched Files / Surfaces:** `deploy/push-all-to-git-libre-audio.sh`, `deploy/sync-vps-repos.sh`, `package.json`, `packages-js/ciphers-aq/package.json`, `pyproject.toml`, `scripts/build_gallery_manifest.py`, `site/donate/index.html`, `site/engineering/cicd-vps-tmpfs-and-regression/index.html` (+30 more) +> - **Live Verified Ecosystem Metrics (`v2.14.0`):** `6` Repositories • `17` CLI Entrypoints • `20` MCP/REST Tools • `14` URN Resources • `63` Verified Web Routes • `388` KG Nodes / `1,282` Edges • `282` Glossary Entries • `4,943` Offline CMUdict Phonetics • `0` Synthetic Data Shared Python common library (`hyperstitionstud_io.*`), stateless read-only Model Context Protocol (`/mcp`) & OpenAPI 3.1 REST (`/api/v1/*`) server, SQLite FTS5 metadata catalog (`hs-db-build`), offline `URN:` JSON Schema registry (`urn:io:hyperstitionstud:schema:v1:*`), and Group 3 Stealth Basalt web workbenches (`/`, `/learn/`, `/quant/`, `/engineering/`, `/math/`, `/donate/`) with the 4-Ring Hardened Polyglot REPL (`Guile Scheme`, `TypeScript`, `Rust`) and Subtle Cybernetic Code Rain (`hs-matrix-coderain.js`). @@ -50,7 +50,7 @@ python3 hyperstitionstudio-core/tests/test_core_suite.py --- -## Key Architecture & Capabilities (`v2.13.0`) +## Key Architecture & Capabilities (`v2.14.0`) 1. **17 CLI Entrypoints (`pyproject.toml [project.scripts]`):** - `hs-doctor`, `hs-citations`, `hs-pdf-build`, `hs-kg-build`, `hs-quant-harvest`, `hs-macro-harvest`, `hs-daily-brief`, `hs-ticker-card`, `hs-mcp`, `hs-db-build`, `hs-sync-version`, `hs-readme-sync`, `hs-archive-rotate`, `hs-public-smoke`, `hs-eng-docs`, `hs-math-docs`, and `hs-highlights`. diff --git a/deploy/push-all-to-git-libre-audio.sh b/deploy/push-all-to-git-libre-audio.sh new file mode 100755 index 0000000..3c142f6 --- /dev/null +++ b/deploy/push-all-to-git-libre-audio.sh @@ -0,0 +1,142 @@ +#!/usr/bin/env bash +# /workspace/push-all-to-git-libre-audio.sh +# Release v2.14.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}." diff --git a/deploy/sync-vps-repos.sh b/deploy/sync-vps-repos.sh index 71c9229..58e2188 100755 --- a/deploy/sync-vps-repos.sh +++ b/deploy/sync-vps-repos.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash # /workspace/hyperstitionstudio-core/deploy/sync-vps-repos.sh +# Release v2.14.0: Self-re-executing tmpfs VPS hydration & service sync. # Hydrates per-repository install directories from REPOS_ROOT into LIVE_REPOS (tmpfs RAM mount), # supplies untracked haiperdohp-jemaytreeah/.gitignore files (config.js, db.json, db_lite.json), # creates top-level route symlinks, pre-compresses (.br / .gz) static assets, and idempotently diff --git a/package.json b/package.json index e16d9c0..979c2b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperstitionstud.io/workspace-core", - "version": "2.13.0", + "version": "2.14.0", "private": true, "description": "Offline-first ESM & browser global (@hyperstitionstud.io/* / window.HyperstitionStudio.*) packages for Base-36 AQ ciphers and interactive knowledge graph workbenches.", "license": "MIT", diff --git a/packages-js/ciphers-aq/package.json b/packages-js/ciphers-aq/package.json index e2be974..44af4f0 100644 --- a/packages-js/ciphers-aq/package.json +++ b/packages-js/ciphers-aq/package.json @@ -1,6 +1,6 @@ { "name": "@hyperstitionstud.io/ciphers-aq", - "version": "2.13.0", + "version": "2.14.0", "type": "module", "main": "index.js", "license": "MIT" diff --git a/pyproject.toml b/pyproject.toml index 39faf2d..74f5b7d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "hyperstitionstudio-core" -version = "2.13.0" +version = "2.14.0" description = "Shared PEP 420 common library (hyperstitionstud_io.*) for Base-36 AQ ciphers, offline CMUdict Ingglish phonetics, ReportLab/Pillow publishing, SHA-256 glossary isolation guards, local-config citation verification, and multi-format knowledge graphs." readme = "README.md" requires-python = ">=3.10" @@ -42,6 +42,7 @@ hs-highlights = "hyperstitionstud_io.publishing.highlights:main" hs-readme-sync = "hyperstitionstud_io.publishing.readme_sync:main" hs-closeups-sync = "hyperstitionstud_io.publishing.closeups_sync:main" hs-quant-voice-build = "hyperstitionstud_io.publishing.quant_voice:main" +hs-deploy-scripts-sync = "hyperstitionstud_io.ci.deploy_scripts_sync:main" [tool.setuptools.packages.find] where = ["src"] diff --git a/scripts/build_gallery_manifest.py b/scripts/build_gallery_manifest.py index 4c42287..2643f6a 100755 --- a/scripts/build_gallery_manifest.py +++ b/scripts/build_gallery_manifest.py @@ -144,8 +144,8 @@ def main() -> int: }) manifest = { - "version": "2.13.0", - "namespace_urn": "urn:io:hyperstitionstud:gallery:2.13.0", + "version": "2.14.0", + "namespace_urn": "urn:io:hyperstitionstud:gallery:2.14.0", "total_items": len(items), "items": items, } diff --git a/site/donate/index.html b/site/donate/index.html index 4870954..836022f 100644 --- a/site/donate/index.html +++ b/site/donate/index.html @@ -4,7 +4,7 @@ Signal Patronage & Open-Instrument Notes — hyperstitionstud.io/donate - + - +

hyperstitionstud.io/quant — Quantitative Finance & Memetic Gematria Time-Series Workbench

-

Strictly Periodic Telemetry (21:30 UTC US Closing Bell × 00:00 UTC News-Wire Dossiers • 24 Watchlist Instruments • 14 FRED Macro Series) • Lens-Neutral Schema (urn:io:hyperstitionstud:quant-timeseries:v2.13.0)

+

Strictly Periodic Telemetry (21:30 UTC US Closing Bell × 00:00 UTC News-Wire Dossiers • 24 Watchlist Instruments • 14 FRED Macro Series) • Lens-Neutral Schema (urn:io:hyperstitionstud:quant-timeseries:v2.14.0)

- - - - - + + + + + diff --git a/site/quant/quant-app.js b/site/quant/quant-app.js index fd02b23..d1aefd7 100644 --- a/site/quant/quant-app.js +++ b/site/quant/quant-app.js @@ -1,5 +1,5 @@ // /workspace/hyperstitionstudio-core/site/quant/quant-app.js -// Interactive Quantitative Finance & Memetic Gematria Time-Series Workbench (v2.13.0) +// Interactive Quantitative Finance & Memetic Gematria Time-Series Workbench (v2.14.0) (function () { "use strict"; diff --git a/site/quant/quant-tutorials.js b/site/quant/quant-tutorials.js index 6813c94..5931cd7 100644 --- a/site/quant/quant-tutorials.js +++ b/site/quant/quant-tutorials.js @@ -992,7 +992,7 @@ } const exportedApi = { - version: "2.13.0", + version: "2.14.0", episodes: EPISODES, allHighlightableDomIds: ALL_HIGHLIGHTABLE_DOM_IDS, cleanTextForSpeech: cleanTextForSpeech, diff --git a/src/hyperstitionstud_io/__init__.py b/src/hyperstitionstud_io/__init__.py index 407c043..62d41b3 100644 --- a/src/hyperstitionstud_io/__init__.py +++ b/src/hyperstitionstud_io/__init__.py @@ -1,3 +1,3 @@ -"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.13.0).""" -__version__ = "2.13.0" +"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.14.0).""" +__version__ = "2.14.0" NAMESPACE_URN = "urn:io:hyperstitionstud" diff --git a/src/hyperstitionstud_io/ci/deploy_scripts_sync.py b/src/hyperstitionstud_io/ci/deploy_scripts_sync.py new file mode 100644 index 0000000..6dfdf13 --- /dev/null +++ b/src/hyperstitionstud_io/ci/deploy_scripts_sync.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python3 +""" +hyperstitionstud_io.ci.deploy_scripts_sync (`hs-deploy-scripts-sync`) +Pre-Commit Preparation & 8-Gate Drift-Blocking Verifier (`Gates D1-D8`) for the Two Manual Operator +Deployment Scripts (`/workspace/push-all-to-git-libre-audio.sh` and `deploy/sync-vps-repos.sh`). + +Wired directly into `.git/hooks/pre-commit`, `version_sync.py`, and `tests/test_core_suite.py` so that +`push-all-to-git-libre-audio.sh` (and its tracked mirror `hyperstitionstudio-core/deploy/push-all-to-git-libre-audio.sh`) +and `deploy/sync-vps-repos.sh` are always prepared, validated, and staged PRIOR to every commit. +""" + +from __future__ import annotations + +import argparse +import json +import os +import re +import subprocess +from pathlib import Path +from typing import Any + +from hyperstitionstud_io import __version__ as CURRENT_VERSION +from hyperstitionstud_io.config import load_workspace_config + + +def _norm_ws_path(p: Path | str, workspace_root: str | Path | None = None) -> str: + cfg = load_workspace_config(workspace_root=workspace_root) + ws_res = str(cfg.workspace_root.resolve()) + s = str(Path(p).resolve()) + if s.startswith(ws_res): + return "/workspace" + s[len(ws_res):] + return str(p) + + +def prepare_and_verify_deploy_scripts( + workspace_root: str | Path | None = None, + target_version: str | None = None, + check_only: bool = False, + stage: bool = False, +) -> dict[str, Any]: + """ + Prepare and verify `/workspace/push-all-to-git-libre-audio.sh`, + `/workspace/hyperstitionstudio-core/deploy/push-all-to-git-libre-audio.sh`, + and `/workspace/hyperstitionstudio-core/deploy/sync-vps-repos.sh` across Gates D1-D8. + """ + cfg = load_workspace_config(workspace_root=workspace_root) + ws_root = cfg.workspace_root + core_dir = cfg.core_dir + ver = (target_version or CURRENT_VERSION).lstrip("v").strip() + + ws_push_sh = ws_root / "push-all-to-git-libre-audio.sh" + tracked_push_sh = core_dir / "deploy" / "push-all-to-git-libre-audio.sh" + sync_vps_sh = core_dir / "deploy" / "sync-vps-repos.sh" + caddyfile_p = core_dir / "deploy" / "Caddyfile" + + modified_files: list[str] = [] + errors: list[str] = [] + + # Gate D1: Version Header & Tracked Mirror Parity + if ws_push_sh.is_file(): + push_txt = ws_push_sh.read_text(encoding="utf-8") + upd_push = re.sub(r"^#\s*Release\s+v\d+\.\d+\.\d+:", f"# Release v{ver}:", push_txt, count=1, flags=re.M) + if upd_push != push_txt: + if check_only: + errors.append(f"Gate D1: {ws_push_sh} release header does not match v{ver}") + else: + ws_push_sh.write_text(upd_push, encoding="utf-8") + ws_push_sh.chmod(0o755) + modified_files.append(_norm_ws_path(ws_push_sh, workspace_root=ws_root)) + push_txt = upd_push + + # Ensure tracked mirror inside hyperstitionstudio-core/deploy/push-all-to-git-libre-audio.sh is byte-identical + tracked_txt = tracked_push_sh.read_text(encoding="utf-8") if tracked_push_sh.is_file() else "" + if tracked_txt != push_txt: + if check_only: + errors.append(f"Gate D1: Tracked mirror {tracked_push_sh} is out of sync with {ws_push_sh}") + else: + tracked_push_sh.parent.mkdir(parents=True, exist_ok=True) + tracked_push_sh.write_text(push_txt, encoding="utf-8") + tracked_push_sh.chmod(0o755) + modified_files.append(_norm_ws_path(tracked_push_sh, workspace_root=ws_root)) + else: + errors.append(f"Gate D1: Missing {ws_push_sh}") + + if sync_vps_sh.is_file(): + sync_txt = sync_vps_sh.read_text(encoding="utf-8") + if re.search(r"^#\s*Release\s+v\d+\.\d+\.\d+:", sync_txt, flags=re.M): + upd_sync = re.sub(r"^#\s*Release\s+v\d+\.\d+\.\d+:", f"# Release v{ver}:", sync_txt, count=1, flags=re.M) + else: + upd_sync = sync_txt.replace( + "# /workspace/hyperstitionstudio-core/deploy/sync-vps-repos.sh\n", + f"# /workspace/hyperstitionstudio-core/deploy/sync-vps-repos.sh\n# Release v{ver}: Self-re-executing tmpfs VPS hydration & service sync.\n", + 1, + ) + if upd_sync != sync_txt: + if check_only: + errors.append(f"Gate D1: {sync_vps_sh} release header does not match v{ver}") + else: + sync_vps_sh.write_text(upd_sync, encoding="utf-8") + sync_vps_sh.chmod(0o755) + modified_files.append(_norm_ws_path(sync_vps_sh, workspace_root=ws_root)) + sync_txt = upd_sync + else: + errors.append(f"Gate D1: Missing {sync_vps_sh}") + + gate_d1_ok = len(errors) == 0 + + # Gate D2 & D3: bash -n Syntax, Executable Permissions & Zero-/dev/null Redirections + scripts_to_audit = [ + ws_push_sh, + tracked_push_sh, + sync_vps_sh, + core_dir / "deploy" / "run-vps-data-production.sh", + core_dir / "deploy" / "run-vps-archive-rotation.sh", + cfg.archive_dir / "packaging" / "build-fedora41-rpm.sh", + cfg.archive_dir / "packaging" / "bundle" / "scripts" / "run_exegesis_and_push_fedora41.sh", + ] + gate_d2_ok = True + gate_d3_ok = True + for sp in scripts_to_audit: + if not sp.is_file(): + continue + if not check_only and not os.access(sp, os.X_OK): + sp.chmod(0o755) + proc = subprocess.run(["bash", "-n", str(sp)], capture_output=True, text=True, check=False) + if proc.returncode != 0: + gate_d2_ok = False + errors.append(f"Gate D2: bash -n syntax error in {sp}: {proc.stderr.strip()}") + stxt = sp.read_text(encoding="utf-8") + if "/dev/null" in stxt: + gate_d3_ok = False + errors.append(f"Gate D3: Forbidden /dev/null found in {sp}") + + # Gate D4: Untracked Runtime Artifact Hydration Parity (.gitignore vs. sync-vps-repos.sh) + sync_txt_cur = sync_vps_sh.read_text(encoding="utf-8") if sync_vps_sh.is_file() else "" + core_gi = (core_dir / ".gitignore").read_text(encoding="utf-8") if (core_dir / ".gitignore").is_file() else "" + gate_d4_ok = True + if "site/quant/audio/" in core_gi: + if "quant_voice" not in sync_txt_cur or "--filter='P site/quant/audio/***'" not in sync_txt_cur: + gate_d4_ok = False + errors.append("Gate D4: site/quant/audio/ is in .gitignore but quant_voice / rsync filter is missing in deploy/sync-vps-repos.sh") + if "generate_db_json.py" not in sync_txt_cur or "config.default.js" not in sync_txt_cur: + gate_d4_ok = False + errors.append("Gate D4: haiperdohp-jemaytreeah untracked artifact hydration missing in deploy/sync-vps-repos.sh") + + # Gate D5: Cold *.tar.gz Archive Exclusion & Explicit rm -f Safety in sync-vps-repos.sh + gate_d5_ok = ( + "--exclude='completed-plans-archive.tar.gz'" in sync_txt_cur + and "--exclude='inactive-plans-archive.tar.gz'" in sync_txt_cur + and 'docs/archive/completed-plans-archive.tar.gz"' in sync_txt_cur + and 'docs/plans/inactive/inactive-plans-archive.tar.gz"' in sync_txt_cur + ) + if not gate_d5_ok: + errors.append("Gate D5: Cold plan .tar.gz exclusion or rm -f cleanup missing in deploy/sync-vps-repos.sh") + + # Gate D6: Single-Layer 1x Compression & Caddyfile Media Extension Parity + caddy_txt = caddyfile_p.read_text(encoding="utf-8") if caddyfile_p.is_file() else "" + push_txt_cur = ws_push_sh.read_text(encoding="utf-8") if ws_push_sh.is_file() else "" + gate_d6_ok = ( + "--enforce-single-compression" in push_txt_cur + and "--enforce-single-compression" in sync_txt_cur + and "@compressible not path" in caddy_txt + and "*.wav" in caddy_txt + and "*.pdf" in caddy_txt + ) + if not gate_d6_ok: + errors.append("Gate D6: Single-layer compression enforcement or Caddyfile media extension parity missing") + + # Gate D7: Topological 6-Repository Push & Force-Tag Sync Parity in push-all-to-git-libre-audio.sh + required_push_markers = ( + "hyperstitionstudio-core", + "ingglish-hyperdope-gematria", + "technocapital-singularity-zoology", + "encyclopedia-knowledge-graph", + "hyperdope-ci-build", + "haiperdohp-jemaytreeah", + 'push --force "${remote_name}" "refs/tags/${head_tag}"', + "build-fedora41-rpm.sh", + "run_exegesis_and_push_fedora41.sh", + ) + gate_d7_ok = all(m in push_txt_cur for m in required_push_markers) + if not gate_d7_ok: + errors.append("Gate D7: Missing required repository, force-tag, or verification marker in push-all-to-git-libre-audio.sh") + + # Gate D8: Automatic Git Staging Prior to Commit (--stage) + staged_files: list[str] = [] + if stage and not check_only and (core_dir / ".git").exists(): + for rel_s in ("deploy/push-all-to-git-libre-audio.sh", "deploy/sync-vps-repos.sh", "deploy/Caddyfile"): + cand_p = core_dir / rel_s + if cand_p.is_file(): + subprocess.run(["git", "-C", str(core_dir), "add", rel_s], check=False) + staged_files.append(f"/workspace/hyperstitionstudio-core/{rel_s}") + + all_ok = ( + gate_d1_ok + and gate_d2_ok + and gate_d3_ok + and gate_d4_ok + and gate_d5_ok + and gate_d6_ok + and gate_d7_ok + and len(errors) == 0 + ) + + return { + "ok": all_ok, + "version": ver, + "check_only": check_only, + "gates": { + "D1_version_header_and_tracked_mirror_parity": gate_d1_ok, + "D2_bash_syntax_and_exec_permissions": gate_d2_ok, + "D3_zero_dev_null_redirections": gate_d3_ok, + "D4_gitignore_untracked_runtime_hydration_parity": gate_d4_ok, + "D5_cold_tar_gz_tmpfs_exclusion_and_rm": gate_d5_ok, + "D6_single_layer_compression_and_caddy_parity": gate_d6_ok, + "D7_topological_6_repo_push_and_force_tags": gate_d7_ok, + "D8_pre_commit_auto_stage_ready": True, + }, + "modified_files": modified_files, + "staged_files": staged_files, + "errors": errors, + } + + +def main(argv: list[str] | None = None) -> int: + ap = argparse.ArgumentParser( + prog="hs-deploy-scripts-sync", + description="Prepare, synchronize, and verify push-all-to-git-libre-audio.sh and deploy/sync-vps-repos.sh prior to commits.", + ) + ap.add_argument("--check", action="store_true", help="Verify Gates D1-D8 without modifying files.") + ap.add_argument("--stage", action="store_true", help="Stage updated deploy scripts in hyperstitionstudio-core via git add.") + ap.add_argument("--version", default=None, help="Optional target semantic version override.") + ap.add_argument("--workspace-root", default=None, help="Optional workspace root directory.") + args = ap.parse_args(argv) + + res = prepare_and_verify_deploy_scripts( + workspace_root=args.workspace_root, + target_version=args.version, + check_only=args.check, + stage=args.stage, + ) + print(json.dumps(res, indent=2)) + return 0 if res["ok"] else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/src/hyperstitionstud_io/mcp/server.py b/src/hyperstitionstud_io/mcp/server.py index 08ca2a3..ef54f69 100755 --- a/src/hyperstitionstud_io/mcp/server.py +++ b/src/hyperstitionstud_io/mcp/server.py @@ -39,8 +39,8 @@ from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA, call_mcp_tool # noq SERVER_INFO = { "name": "hyperstitionstudio-mcp", - "version": "2.13.0", - "namespace_urn": "urn:io:hyperstitionstud:mcp:2.13.0", + "version": "2.14.0", + "namespace_urn": "urn:io:hyperstitionstud:mcp:2.14.0", } diff --git a/src/hyperstitionstud_io/publishing/readme_sync.py b/src/hyperstitionstud_io/publishing/readme_sync.py index edb5545..77f84ea 100644 --- a/src/hyperstitionstud_io/publishing/readme_sync.py +++ b/src/hyperstitionstud_io/publishing/readme_sync.py @@ -475,7 +475,8 @@ def sync_all_repo_readmes( PRE_COMMIT_HOOK_SCRIPT = """#!/usr/bin/env bash # Auto-installed by hyperstitionstud_io.publishing.readme_sync (hs-readme-sync --install-hooks) -# Re-renders homepage UI closeups when page UI elements change and synchronizes root README.md before every commit. +# Prepares & validates push-all-to-git-libre-audio.sh and deploy/sync-vps-repos.sh (Gates D1-D8), +# re-renders homepage UI closeups when page UI elements change, and synchronizes root README.md before every commit. set -euo pipefail REPO_ROOT="$(git rev-parse --show-toplevel)" @@ -485,6 +486,11 @@ CORE_SRC="${WS_ROOT}/hyperstitionstudio-core/src" if [[ -d "${CORE_SRC}" ]]; then export PYTHONPATH="${CORE_SRC}${PYTHONPATH:+:${PYTHONPATH}}" + if [[ "${REPO_NAME}" == "hyperstitionstudio-core" ]]; then + python3 -m hyperstitionstud_io.ci.deploy_scripts_sync --workspace-root "${WS_ROOT}" --stage + else + python3 -m hyperstitionstud_io.ci.deploy_scripts_sync --workspace-root "${WS_ROOT}" + fi python3 -m hyperstitionstud_io.publishing.closeups_sync if [[ -d "${WS_ROOT}/hyperstitionstudio-core/site/assets/closeups" ]] && [[ "${REPO_NAME}" == "hyperstitionstudio-core" ]]; then git -C "${REPO_ROOT}" add site/assets/closeups/ @@ -535,7 +541,7 @@ def install_git_pre_commit_hooks(ws_root: Path | None = None, check_only: bool = if not hooks_dir.is_dir(): continue for h_name, h_script, markers in ( - ("pre-commit", PRE_COMMIT_HOOK_SCRIPT, ("readme_sync", "closeups_sync")), + ("pre-commit", PRE_COMMIT_HOOK_SCRIPT, ("readme_sync", "closeups_sync", "deploy_scripts_sync")), ("commit-msg", COMMIT_MSG_HOOK_SCRIPT, ("COMMIT-MSG GATE",)), ): hook_path = hooks_dir / h_name diff --git a/src/hyperstitionstud_io/quant/collector.py b/src/hyperstitionstud_io/quant/collector.py index b0b21fb..e8378c5 100755 --- a/src/hyperstitionstud_io/quant/collector.py +++ b/src/hyperstitionstud_io/quant/collector.py @@ -684,7 +684,7 @@ def build_financial_quant_harvest( payload: dict[str, Any] = { "$schema": "./schemas/v1/financial-aq-harvest.schema.json", "$id": "urn:io:hyperstitionstud:schema:v1:financial-aq-harvest", - "version": "2.13.0", + "version": "2.14.0", "target_date_utc": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"), "harvest_mode": harvest_mode, "synthetic_data_eliminated": True, diff --git a/src/hyperstitionstud_io/version_sync.py b/src/hyperstitionstud_io/version_sync.py index 4c820fe..2019fb0 100755 --- a/src/hyperstitionstud_io/version_sync.py +++ b/src/hyperstitionstud_io/version_sync.py @@ -476,8 +476,20 @@ def sync_workspace_version(target_version: str, check_only: bool = False, ws_roo ws_toml.write_text(upd_ws, encoding="utf-8") modified_files.append(str(ws_toml)) + from hyperstitionstud_io.ci.deploy_scripts_sync import prepare_and_verify_deploy_scripts from hyperstitionstud_io.publishing.readme_sync import sync_all_repo_readmes + deploy_res = prepare_and_verify_deploy_scripts( + workspace_root=cfg.workspace_root, + target_version=v, + check_only=check_only, + stage=False, + ) + if check_only and not deploy_res["ok"]: + mismatched_files.extend(deploy_res["errors"]) + elif not check_only: + modified_files.extend(deploy_res["modified_files"]) + readme_res = sync_all_repo_readmes(ws_root=cfg.workspace_root, version=v, check_only=check_only) if check_only and not readme_res["all_in_sync"]: mismatched_files.extend(readme_res["mismatched_readmes"]) diff --git a/tests/test_core_suite.py b/tests/test_core_suite.py index f0ba4e0..95636be 100644 --- a/tests/test_core_suite.py +++ b/tests/test_core_suite.py @@ -1325,6 +1325,18 @@ def test_ipld_quant_and_mcp_server() -> None: assert pkg_f.is_file(), f"Missing Fedora 41 packaging file {pkg_f}" assert "/dev/null" not in pkg_f.read_text(encoding="utf-8") + # Verify Plan #58: Pre-Commit Preparation & Gates D1-D8 for push-all-to-git-libre-audio.sh & deploy/sync-vps-repos.sh + from hyperstitionstud_io.ci.deploy_scripts_sync import prepare_and_verify_deploy_scripts + + dep_sync = prepare_and_verify_deploy_scripts(workspace_root=cfg.workspace_root, check_only=False) + assert dep_sync["ok"] is True, f"Deploy scripts sync failed: {dep_sync}" + assert all(dep_sync["gates"].values()), f"Deploy scripts gates failed: {dep_sync['gates']}" + dep_chk = prepare_and_verify_deploy_scripts(workspace_root=cfg.workspace_root, check_only=True) + assert dep_chk["ok"] is True, f"Deploy scripts check_only failed: {dep_chk}" + assert (cfg.core_dir / "deploy" / "push-all-to-git-libre-audio.sh").read_text(encoding="utf-8") == ( + cfg.workspace_root / "push-all-to-git-libre-audio.sh" + ).read_text(encoding="utf-8") + # Verify PLAN-INTROSPECTIVE-PROTECT-SYSTEM-STRICT-EROFS-TEST-HARNESS from hyperstitionstud_io.ci.erofs_harness import run_introspective_erofs_suite diff --git a/workspace.example.toml b/workspace.example.toml index 84f49c3..2ff90d3 100644 --- a/workspace.example.toml +++ b/workspace.example.toml @@ -1,6 +1,6 @@ # workspace.example.toml — Location-Independent Workspace Configuration Template (v1.2.0) # Copy to your parent workspace folder: cp hyperstitionstudio-core/workspace.example.toml ./workspace.toml -schema_version = "2.13.0" +schema_version = "2.14.0" namespace_urn = "urn:io:hyperstitionstud" [paths]