"""Package the bounded, read-only development reference UI on the actual public baseline.""" from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timezone import difflib import hashlib import json from pathlib import Path import re from urllib.request import Request, urlopen from urllib.error import HTTPError import zipfile ROOT = Path(__file__).resolve().parents[1] RELEASE = 'ksf-development-references-20261108-r15' OUT = ROOT / 'artifacts' / RELEASE PACK = OUT / 'package' WORK = ROOT / 'work' / RELEASE HOME = 'dfeb6a6d0b63e8e1190f9308bf6619a5ca523a5a2f91af5f7ca5ad5fc9642db3' FILES = ['src/core/industry-navigation.js', 'src/core/development-references.js', 'src/services/development-service.js', 'src/pages/industry-development-view.js', 'src/pages/view-industry.js', 'src/data/development-references.json'] def sha(raw): return hashlib.sha256(raw).hexdigest() def normal(raw): return raw.replace(b'\r\n', b'\n') def save(name, value): path = PACK / name path.parent.mkdir(parents=True, exist_ok=True) path.write_text(json.dumps(value, ensure_ascii=False, indent=2) + '\n', encoding='utf-8') def copy(source, name): target = PACK / name target.parent.mkdir(parents=True, exist_ok=True) target.write_bytes(source.read_bytes()) def capture(name): try: with urlopen(Request('https://kangshifu.fmode.cn/' + name, headers={'Cache-Control': 'no-cache'}), timeout=35) as response: raw = response.read(3000001) kind = response.headers.get('Content-Type', '') assert len(raw) < 3000001 exists = name == 'index.html' or ('application/json' in kind if name.endswith('.json') else 'javascript' in kind) if not exists: assert b'