diff --git a/package.json b/package.json index 24c96c8..33aff65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperstitionstud.io/workspace-core", - "version": "2.0.0", + "version": "2.0.13", "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 69b1159..2a35c23 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.0.0", + "version": "2.0.13", "type": "module", "main": "index.js", "license": "MIT" diff --git a/pyproject.toml b/pyproject.toml index 8ea974c..e213905 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "hyperstitionstudio-core" -version = "2.0.0" +version = "2.0.13" 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" @@ -26,6 +26,7 @@ hs-pdf-build = "hyperstitionstud_io.publishing.pdf_compiler:main" hs-kg-build = "hyperstitionstud_io.graph.cli:main" hs-quant-harvest = "hyperstitionstud_io.quant.collector:main" hs-mcp = "hyperstitionstud_io.mcp.server:main" +hs-sync-version = "hyperstitionstud_io.version_sync:main" [tool.setuptools.packages.find] where = ["src"] diff --git a/scripts/build_gallery_manifest.py b/scripts/build_gallery_manifest.py index f199ae2..2df0c81 100755 --- a/scripts/build_gallery_manifest.py +++ b/scripts/build_gallery_manifest.py @@ -144,8 +144,8 @@ def main() -> int: }) manifest = { - "version": "2.0.0", - "namespace_urn": "urn:io:hyperstitionstud:gallery:2.0.0", + "version": "2.0.13", + "namespace_urn": "urn:io:hyperstitionstud:gallery:2.0.13", "total_items": len(items), "items": items, } diff --git a/site/gallery/gallery-data.js b/site/gallery/gallery-data.js index 68b68d1..dae5479 100644 --- a/site/gallery/gallery-data.js +++ b/site/gallery/gallery-data.js @@ -1,7 +1,7 @@ window.HyperstitionStudio = window.HyperstitionStudio || {}; window.HyperstitionStudio.GalleryData = { - "version": "2.0.0", - "namespace_urn": "urn:io:hyperstitionstud:gallery:2.0.0", + "version": "2.0.13", + "namespace_urn": "urn:io:hyperstitionstud:gallery:2.0.13", "total_items": 37, "items": [ { diff --git a/site/gallery/index.html b/site/gallery/index.html index c666169..962a1fc 100644 --- a/site/gallery/index.html +++ b/site/gallery/index.html @@ -217,7 +217,7 @@
diff --git a/site/index.html b/site/index.html index 3b84c11..82dbe65 100644 --- a/site/index.html +++ b/site/index.html @@ -131,7 +131,7 @@

HYPERSTITIONSTUD.IO // TECHNOCAPITAL SINGULARITY ZOOLOGY WORKBENCH

-

100% Offline-Portable & HTTP/3 Edge-Ready Research Corpus • Namespace Authority: urn:io:hyperstitionstud (v2.0.0)

+

100% Offline-Portable & HTTP/3 Edge-Ready Research Corpus • Namespace Authority: urn:io:hyperstitionstud (v2.0.13)

Start Learning Track (/learn/) @@ -253,7 +253,7 @@
diff --git a/site/learn/index.html b/site/learn/index.html index 3dab9e6..30e5568 100644 --- a/site/learn/index.html +++ b/site/learn/index.html @@ -413,7 +413,7 @@ diff --git a/site/learn/learn-app.js b/site/learn/learn-app.js index 48ee776..6707e6d 100644 --- a/site/learn/learn-app.js +++ b/site/learn/learn-app.js @@ -265,7 +265,7 @@ const base = { $schema: "../schemas/v1/learn-progress-state.schema.json", $id: SCHEMA_ID, - version: "2.0.0", + version: "2.0.13", updated_at_utc: new Date().toISOString(), preferred_register: "fund_manager", completed_modules: [], diff --git a/src/hyperstitionstud_io/__init__.py b/src/hyperstitionstud_io/__init__.py index 0c603df..c6e22bf 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.0.0).""" -__version__ = "2.0.0" +"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.0.13).""" +__version__ = "2.0.13" NAMESPACE_URN = "urn:io:hyperstitionstud" diff --git a/src/hyperstitionstud_io/mcp/server.py b/src/hyperstitionstud_io/mcp/server.py index 20a08ab..b0f8473 100755 --- a/src/hyperstitionstud_io/mcp/server.py +++ b/src/hyperstitionstud_io/mcp/server.py @@ -32,8 +32,8 @@ from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA, call_mcp_tool # noq SERVER_INFO = { "name": "hyperstitionstudio-mcp", - "version": "2.0.0", - "namespace_urn": "urn:io:hyperstitionstud:mcp:2.0.0", + "version": "2.0.13", + "namespace_urn": "urn:io:hyperstitionstud:mcp:2.0.13", } diff --git a/src/hyperstitionstud_io/quant/collector.py b/src/hyperstitionstud_io/quant/collector.py index ab25f8f..bbe2d09 100755 --- a/src/hyperstitionstud_io/quant/collector.py +++ b/src/hyperstitionstud_io/quant/collector.py @@ -241,7 +241,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.0.0", + "version": "2.0.13", "target_date_utc": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"), "harvest_mode": harvest_mode, "regime_summary": { diff --git a/src/hyperstitionstud_io/version_sync.py b/src/hyperstitionstud_io/version_sync.py new file mode 100755 index 0000000..d5cadc1 --- /dev/null +++ b/src/hyperstitionstud_io/version_sync.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python3 +""" +hyperstitionstud_io.version_sync — Single-Source-of-Truth Version Synchronizer & Verifier (`hs-sync-version`). + +Ensures that every visible version badge across all HTML site surfaces (`/`, `/learn/`, `/gallery/`, +`/graph/`, `/graph/docs/cross-repo-dependency-and-audit-flow-diagram.html`, `/calc/`), JS bundles, +MCP/Quant servers, and package manifests updates in lockstep on every version change. +""" + +from __future__ import annotations + +import argparse +import json +import re +import sys +from pathlib import Path +from typing import Any + +_SRC_DIR = Path(__file__).resolve().parents[1] +if _SRC_DIR.is_dir() and str(_SRC_DIR) not in sys.path: + sys.path.insert(0, str(_SRC_DIR)) + +from hyperstitionstud_io import __version__ as CURRENT_VERSION # noqa: E402 +from hyperstitionstud_io.config import load_workspace_config # noqa: E402 + +SEMVER_RE = r"\d+\.\d+\.\d+" + + +def get_version_targets(ws_root: Path | None = None) -> list[tuple[Path, list[tuple[str, str]]]]: + cfg = load_workspace_config(workspace_root=ws_root) + core = cfg.core_dir + kg = cfg.knowledge_graph_dir + calc = cfg.paths["gematria_js_dir"] + + return [ + ( + core / "src" / "hyperstitionstud_io" / "__init__.py", + [ + (rf'\(v{SEMVER_RE}\)', "(v{V})"), + (rf'__version__\s*=\s*"{SEMVER_RE}"', '__version__ = "{V}"'), + ], + ), + ( + core / "pyproject.toml", + [(rf'^version\s*=\s*"{SEMVER_RE}"', 'version = "{V}"')], + ), + ( + core / "package.json", + [(rf'"version":\s*"{SEMVER_RE}"', '"version": "{V}"')], + ), + ( + core / "packages-js" / "ciphers-aq" / "package.json", + [(rf'"version":\s*"{SEMVER_RE}"', '"version": "{V}"')], + ), + ( + core / "workspace.example.toml", + [(rf'schema_version\s*=\s*"{SEMVER_RE}"', 'schema_version = "{V}"')], + ), + ( + cfg.workspace_root / "workspace.toml", + [(rf'schema_version\s*=\s*"{SEMVER_RE}"', 'schema_version = "{V}"')], + ), + ( + core / "site" / "index.html", + [ + (rf'urn:io:hyperstitionstud \(v{SEMVER_RE}\)', "urn:io:hyperstitionstud (v{V})"), + (rf'urn:io:hyperstitionstud v{SEMVER_RE}\)', "urn:io:hyperstitionstud v{V})"), + ], + ), + ( + core / "site" / "learn" / "index.html", + [ + (rf'learn-progress-state v{SEMVER_RE}\)', "learn-progress-state v{V})"), + ], + ), + ( + core / "site" / "learn" / "learn-app.js", + [ + (rf'version:\s*"{SEMVER_RE}"', 'version: "{V}"'), + ], + ), + ( + core / "site" / "gallery" / "index.html", + [ + (rf'urn:io:hyperstitionstud:gallery:{SEMVER_RE}\)', "urn:io:hyperstitionstud:gallery:{V})"), + ], + ), + ( + core / "scripts" / "build_gallery_manifest.py", + [ + (rf'"version":\s*"{SEMVER_RE}"', '"version": "{V}"'), + (rf'urn:io:hyperstitionstud:gallery:{SEMVER_RE}', "urn:io:hyperstitionstud:gallery:{V}"), + ], + ), + ( + core / "src" / "hyperstitionstud_io" / "mcp" / "server.py", + [ + (rf'"version":\s*"{SEMVER_RE}"', '"version": "{V}"'), + (rf'urn:io:hyperstitionstud:mcp:{SEMVER_RE}', "urn:io:hyperstitionstud:mcp:{V}"), + ], + ), + ( + core / "src" / "hyperstitionstud_io" / "quant" / "collector.py", + [ + (rf'"version":\s*"{SEMVER_RE}"', '"version": "{V}"'), + ], + ), + ( + kg / "index.html", + [ + (rf'Interactive Knowledge Graph \(v{SEMVER_RE}\)', "Interactive Knowledge Graph (v{V})"), + (rf'Zero Glossary Leak(?: • v{SEMVER_RE})?

', "Zero Glossary Leak • v{V}

"), + (rf'(?:hyperstitionstud\.io/graph v{SEMVER_RE} • )?Made with dict[str, Any]: + v = target_version.lstrip("v").strip() + if not re.match(rf"^{SEMVER_RE}$", v): + raise ValueError(f"Invalid semantic version '{target_version}' (expected X.Y.Z)") + + targets = get_version_targets(ws_root=ws_root) + modified_files: list[str] = [] + mismatched_files: list[str] = [] + + for path, patterns in targets: + if not path.is_file(): + continue + orig = path.read_text(encoding="utf-8") + updated = orig + for pat_re, repl_tmpl in patterns: + repl = repl_tmpl.replace("{V}", v) + updated = re.sub(pat_re, repl, updated, flags=re.M) + if f"v{v}" not in updated and f'"{v}"' not in updated and f":{v}" not in updated: + mismatched_files.append(str(path)) + elif updated != orig: + if check_only: + mismatched_files.append(str(path)) + else: + path.write_text(updated, encoding="utf-8") + modified_files.append(str(path)) + + return { + "target_version": v, + "check_only": check_only, + "all_in_sync": len(mismatched_files) == 0, + "modified_files": modified_files, + "mismatched_files": mismatched_files, + } + + +def main(argv: list[str] | None = None) -> int: + ap = argparse.ArgumentParser(prog="hs-sync-version", description="Synchronize or verify version numbers across all site elements and manifests.") + ap.add_argument("--set", dest="set_version", default=None, help="Set new version X.Y.Z across all site HTML elements, JS bundles, and manifests.") + ap.add_argument("--check", action="store_true", help="Verify that all site elements match hyperstitionstud_io.__version__ without modifying files.") + args = ap.parse_args(argv) + + target_v = args.set_version.lstrip("v") if args.set_version else CURRENT_VERSION + res = sync_workspace_version(target_v, check_only=args.check) + print(json.dumps(res, indent=2)) + return 0 if res["all_in_sync"] else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/test_core_suite.py b/tests/test_core_suite.py index 6d00d5c..e9e2d95 100644 --- a/tests/test_core_suite.py +++ b/tests/test_core_suite.py @@ -62,6 +62,13 @@ def test_offline_urn_namespaces_and_no_external_https_fonts() -> None: assert s_obj["$id"].startswith("urn:io:hyperstitionstud:schema:v1:") assert "https://hyperstitionstud.io" not in sp.read_text(encoding="utf-8") + # Verify all visible site version numbers match hyperstitionstud_io.__version__ + from hyperstitionstud_io import __version__ as cur_ver + from hyperstitionstud_io.version_sync import sync_workspace_version + + v_sync = sync_workspace_version(cur_ver, check_only=True, ws_root=cfg.workspace_root) + assert v_sync["all_in_sync"] is True, f"Site version drift detected: {v_sync['mismatched_files']}" + def test_ciphers_and_bilingual_ledger_parity() -> None: cfg = load_workspace_config() diff --git a/workspace.example.toml b/workspace.example.toml index 9ce2997..ca31166 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.0.0" +schema_version = "2.0.13" namespace_urn = "urn:io:hyperstitionstud" [paths]