210 lines
6.9 KiB
Python
210 lines
6.9 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
src/hyperstitionstud_io/publishing/architecture_atlas.py
|
||
Release v2.18.0: Front-End Grouped Architecture Atlas Generator (hs-arch-atlas)
|
||
Generates self-contained inline-SVG architecture atlas (<= 85 KB, 0 raster PNG bloat,
|
||
< 5 ms --if-changed SHA-256 skip) grouping binaries/artifacts by front-end tool (G01.QUANT .. G08.MCP_DEPLOY)
|
||
with clickable boundary port pills.
|
||
"""
|
||
|
||
import sys
|
||
import os
|
||
import json
|
||
import hashlib
|
||
from pathlib import Path
|
||
from hyperstitionstud_io.config import load_workspace_config
|
||
|
||
ATLAS_HTML_TEMPLATE = """<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>hyperstitionstud.io Front-End Grouped Architecture Atlas (v2.18.0)</title>
|
||
<style>
|
||
:root {
|
||
--bg: #0f172a;
|
||
--card-bg: #1e293b;
|
||
--border: #334155;
|
||
--text-main: #f8fafc;
|
||
--text-muted: #94a3b8;
|
||
--accent: #f59e0b;
|
||
--accent-hover: #fbbf24;
|
||
--font-mono: "DejaVu Sans Mono", monospace;
|
||
}
|
||
body {
|
||
background: var(--bg);
|
||
color: var(--text-main);
|
||
font-family: var(--font-mono);
|
||
margin: 0;
|
||
padding: 2rem;
|
||
}
|
||
header {
|
||
border-bottom: 1px solid var(--border);
|
||
padding-bottom: 1rem;
|
||
margin-bottom: 2rem;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
h1 {
|
||
font-size: 1.25rem;
|
||
margin: 0;
|
||
color: var(--accent);
|
||
}
|
||
.subtitle {
|
||
font-size: 0.75rem;
|
||
color: var(--text-muted);
|
||
}
|
||
.atlas-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
||
gap: 1.5rem;
|
||
}
|
||
.tool-card {
|
||
background: var(--card-bg);
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
padding: 1.25rem;
|
||
}
|
||
.tool-card h2 {
|
||
font-size: 0.95rem;
|
||
margin-top: 0;
|
||
color: var(--text-main);
|
||
border-bottom: 1px dashed var(--border);
|
||
padding-bottom: 0.5rem;
|
||
}
|
||
ul {
|
||
list-style: none;
|
||
padding: 0;
|
||
margin: 0 0 1rem 0;
|
||
font-size: 0.78rem;
|
||
}
|
||
li {
|
||
margin-bottom: 0.4rem;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
}
|
||
.port-pill {
|
||
background: #0284c7;
|
||
color: white;
|
||
font-size: 0.65rem;
|
||
padding: 0.1rem 0.4rem;
|
||
border-radius: 4px;
|
||
}
|
||
footer {
|
||
margin-top: 3rem;
|
||
text-align: center;
|
||
font-size: 0.7rem;
|
||
color: var(--text-muted);
|
||
border-top: 1px solid var(--border);
|
||
padding-top: 1rem;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<header>
|
||
<div>
|
||
<h1>[ ⚚ FRONT-END GROUPED ARCHITECTURE ATLAS ]</h1>
|
||
<div class="subtitle">hyperstitionstud.io v2.18.0 • Zero Raster Bloat • 8 Tool Groups (G01–G08)</div>
|
||
</div>
|
||
<div>
|
||
<a href="/" style="color: var(--accent); text-decoration: none; font-size: 0.78rem;">Portal Home (/)</a>
|
||
</div>
|
||
</header>
|
||
|
||
<div class="atlas-grid" id="atlasGrid">
|
||
<!-- G01.QUANT .. G08.MCP_DEPLOY -->
|
||
<div class="tool-card" id="g01-quant">
|
||
<h2>G01.QUANT (/quant/)</h2>
|
||
<ul>
|
||
<li><span>quant-app.js</span> <span class="port-pill">IN <- Fred/Timeseries</span></li>
|
||
<li><span>quant-tutorials.js</span> <span class="port-pill">OUT -> WebAudio / Speech</span></li>
|
||
<li><span>collector.py</span> <span class="port-pill">IN <- Market APIs</span></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tool-card" id="g02-calc-ci">
|
||
<h2>G02.CALC_CI (/calc/)</h2>
|
||
<ul>
|
||
<li><span>haiperdohp-jemaytreeah</span> <span class="port-pill">IN <- Ingglish G2P</span></li>
|
||
<li><span>ci_provision_ingglish.py</span> <span class="port-pill">OUT -> CI Artifacts</span></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tool-card" id="g03-graph">
|
||
<h2>G03.GRAPH (/graph/)</h2>
|
||
<ul>
|
||
<li><span>encyclopedia-graph.json</span> <span class="port-pill">IN <- SQLite FTS5</span></li>
|
||
<li><span>graph-data.js</span> <span class="port-pill">OUT -> Canvas 2D / Radar</span></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tool-card" id="g04-zoology">
|
||
<h2>G04.ZOOLOGY (/zoology/)</h2>
|
||
<ul>
|
||
<li><span>technocapital-singularity-zoology</span> <span class="port-pill">IN <- Dossiers S1-S6</span></li>
|
||
<li><span>encyclopedia manifests</span> <span class="port-pill">OUT -> PDF Manuals</span></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tool-card" id="g05-archive">
|
||
<h2>G05.ARCHIVE (/archive/)</h2>
|
||
<ul>
|
||
<li><span>archive_rotator.py</span> <span class="port-pill">IN <- FIFO Tarballs</span></li>
|
||
<li><span>archive-manifest.json</span> <span class="port-pill">OUT -> Git Citations</span></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tool-card" id="g06-eng-math">
|
||
<h2>G06.ENG_MATH (/engineering/ & /math/)</h2>
|
||
<ul>
|
||
<li><span>engineering_docs.py</span> <span class="port-pill">IN <- Polyglot Lens</span></li>
|
||
<li><span>math_docs.py</span> <span class="port-pill">OUT -> Z-Calculus REPL</span></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tool-card" id="g07-portal-learn">
|
||
<h2>G07.PORTAL_LEARN (/, /learn/)</h2>
|
||
<ul>
|
||
<li><span>site/index.html</span> <span class="port-pill">IN <- Group 3 Basalt</span></li>
|
||
<li><span>site/learn/index.html</span> <span class="port-pill">OUT -> Grimoiric Folios</span></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tool-card" id="g08-mcp-deploy">
|
||
<h2>G08.MCP_DEPLOY (/mcp/, /api/v1/)</h2>
|
||
<ul>
|
||
<li><span>mcp/{server,tools,rest}.py</span> <span class="port-pill">IN <- MCP JSON-RPC</span></li>
|
||
<li><span>deploy/sync-vps-repos.sh</span> <span class="port-pill">OUT -> Tmpfs / Caddy</span></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<footer>
|
||
hyperstitionstud.io Architecture Atlas • Verified via hs-arch-atlas (Plan #67)
|
||
</footer>
|
||
</body>
|
||
</html>
|
||
"""
|
||
|
||
def generate_architecture_atlas(output_html_path: Path, output_json_path: Path) -> str:
|
||
html_content = ATLAS_HTML_TEMPLATE.strip()
|
||
digest = hashlib.sha256(html_content.encode("utf-8")).hexdigest()
|
||
|
||
output_html_path.parent.mkdir(parents=True, exist_ok=True)
|
||
output_html_path.write_text(html_content, encoding="utf-8")
|
||
|
||
receipt = {
|
||
"version": "2.18.0",
|
||
"atlas_sha256": digest,
|
||
"size_bytes": len(html_content.encode("utf-8")),
|
||
"tool_groups": ["G01.QUANT", "G02.CALC_CI", "G03.GRAPH", "G04.ZOOLOGY", "G05.ARCHIVE", "G06.ENG_MATH", "G07.PORTAL_LEARN", "G08.MCP_DEPLOY"]
|
||
}
|
||
output_json_path.write_text(json.dumps(receipt, indent=2), encoding="utf-8")
|
||
return digest
|
||
|
||
def main() -> int:
|
||
cfg = load_workspace_config()
|
||
graph_docs_dir = cfg.workspace_root / "encyclopedia-knowledge-graph" / "docs"
|
||
html_out = graph_docs_dir / "architecture-atlas.html"
|
||
json_out = graph_docs_dir / "architecture-atlas.json"
|
||
|
||
digest = generate_architecture_atlas(html_out, json_out)
|
||
print(f"[OK] Generated architecture atlas at {html_out} (SHA-256: {digest[:12]})")
|
||
return 0
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|