diff --git a/README.md b/README.md index 70730ec..8cc6a21 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ > **Gitea Commit & Release Telemetry (`v2.17.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.17.0 release state across 1 tracked module/artifact surface(s) -> - **Touched Files / Surfaces:** `deploy/sync-vps-repos.sh` +> - **Latest Commit Scope (`hyperstitionstudio-core`):** Synchronized v2.17.0 release state across 2 tracked module/artifact surface(s) +> - **Touched Files / Surfaces:** `src/hyperstitionstud_io/ci/shorthand_lint.py`, `src/hyperstitionstud_io/publishing/architecture_atlas.py` > - **Live Verified Ecosystem Metrics (`v2.17.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 diff --git a/src/hyperstitionstud_io/ci/shorthand_lint.py b/src/hyperstitionstud_io/ci/shorthand_lint.py new file mode 100644 index 0000000..02ce8ab --- /dev/null +++ b/src/hyperstitionstud_io/ci/shorthand_lint.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python3 +""" +src/hyperstitionstud_io/ci/shorthand_lint.py +Release v2.18.0: Tokenizer-based shorthand linting helper (hs-shorthand-lint) +Enforces Plan #68: Human-Read Text & Comment Shorthand Disambiguation (.), +with strict global exemption for executable code, strings, tests, and runtime data structures. +""" + +import sys +import os +import re +import tokenize +import io +from pathlib import Path +from typing import List, Tuple, Dict, Any + +CANONICAL_ALLOWLIST = { + "HTTP", "HTTPS", "API", "REST", "JSON", "MCP", "TCP", "UDP", "SSH", "HTML", "CSS", "SVG", "URL", "URI", + "SHA", "CID", "CPU", "RAM", "SSD", "RPM", "CLI", "UI", "UX", "EOF", "UTF", "AI", "EUV", "FRED", "USD", "BPS", + "H1", "H2", "H3", "V8", "M1", "M2", "P20", "P50", "P90" +} + +# Regex for un-disambiguated bare shorthands like G1..G8, M0..M7, S1..S7, E0..E5, D0..D8, P1..P6, R1..R6 +BARE_SHORTHAND_PATTERN = re.compile(r"\b([GDMESPR])([0-9]{1,2})\b") + +def extract_python_comments(source_code: str) -> List[Tuple[int, str]]: + comments = [] + try: + tokens = tokenize.generate_tokens(io.StringIO(source_code).readline) + for tok in tokens: + if tok.type == tokenize.COMMENT: + comments.append((tok.start[0], tok.string)) + except Exception: + pass + return comments + +def extract_markdown_prose_lines(markdown_text: str) -> List[Tuple[int, str]]: + lines = markdown_text.splitlines() + prose_lines = [] + in_fence = False + for idx, line in enumerate(lines, start=1): + stripped = line.strip() + if stripped.startswith("```"): + in_fence = not in_fence + continue + if in_fence: + continue + # Remove inline backtick code spans + clean_line = re.sub(r"`[^`]*`", "", line) + prose_lines.append((idx, clean_line)) + return prose_lines + +def extract_js_css_comments(text: str) -> List[Tuple[int, str]]: + # Extracts // ... and /* ... */ and + lines = text.splitlines() + extracted = [] + in_block = False + for idx, line in enumerate(lines, start=1): + stripped = line.strip() + if "/*" in stripped: + in_block = True + if "*/" in stripped: + in_block = False + continue + if in_block: + extracted.append((idx, line)) + continue + if stripped.startswith("//") or stripped.startswith(" +
+

G01.QUANT (/quant/)

+
    +
  • quant-app.js IN <- Fred/Timeseries
  • +
  • quant-tutorials.js OUT -> WebAudio / Speech
  • +
  • collector.py IN <- Market APIs
  • +
+
+
+

G02.CALC_CI (/calc/)

+
    +
  • haiperdohp-jemaytreeah IN <- Ingglish G2P
  • +
  • ci_provision_ingglish.py OUT -> CI Artifacts
  • +
+
+
+

G03.GRAPH (/graph/)

+
    +
  • encyclopedia-graph.json IN <- SQLite FTS5
  • +
  • graph-data.js OUT -> Canvas 2D / Radar
  • +
+
+
+

G04.ZOOLOGY (/zoology/)

+
    +
  • technocapital-singularity-zoology IN <- Dossiers S1-S6
  • +
  • encyclopedia manifests OUT -> PDF Manuals
  • +
+
+
+

G05.ARCHIVE (/archive/)

+
    +
  • archive_rotator.py IN <- FIFO Tarballs
  • +
  • archive-manifest.json OUT -> Git Citations
  • +
+
+
+

G06.ENG_MATH (/engineering/ & /math/)

+
    +
  • engineering_docs.py IN <- Polyglot Lens
  • +
  • math_docs.py OUT -> Z-Calculus REPL
  • +
+
+
+

G07.PORTAL_LEARN (/, /learn/)

+
    +
  • site/index.html IN <- Group 3 Basalt
  • +
  • site/learn/index.html OUT -> Grimoiric Folios
  • +
+
+
+

G08.MCP_DEPLOY (/mcp/, /api/v1/)

+
    +
  • mcp/{server,tools,rest}.py IN <- MCP JSON-RPC
  • +
  • deploy/sync-vps-repos.sh OUT -> Tmpfs / Caddy
  • +
+
+ + + + + +""" + +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())