Add ordinary user delivery preflight
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check ordinary-user delivery paths before publishing a Jyotish build."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
APP = ROOT / "jyotish-app"
|
||||
|
||||
|
||||
def read(path: Path) -> str:
|
||||
return path.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def require(condition: bool, label: str, failures: list[str]) -> None:
|
||||
if not condition:
|
||||
failures.append(label)
|
||||
|
||||
|
||||
def delivery_matrix() -> list[dict]:
|
||||
return [
|
||||
{
|
||||
"id": "local-dev",
|
||||
"label": "Local dev",
|
||||
"user_url": "http://127.0.0.1:5173",
|
||||
"commands": [
|
||||
"cd jyotish-app && npm run dev -- --host 127.0.0.1 --port 5173",
|
||||
"python3 scripts/jyotish_api_server.py --host 127.0.0.1 --port 5200",
|
||||
],
|
||||
"api_required": True,
|
||||
"scope": "Full web/app user experience with local API.",
|
||||
},
|
||||
{
|
||||
"id": "docker-compose",
|
||||
"label": "Docker Compose",
|
||||
"user_url": "http://localhost:5300",
|
||||
"commands": ["docker compose up -d"],
|
||||
"api_required": True,
|
||||
"scope": "Bundled API + web shell for local ordinary-user trials.",
|
||||
},
|
||||
{
|
||||
"id": "static-demo-pwa",
|
||||
"label": "Static demo / PWA",
|
||||
"user_url": "https://<static-host>/",
|
||||
"commands": ["cd jyotish-app && npm run build"],
|
||||
"api_required": False,
|
||||
"scope": "public demo shell; full advanced techniques require a local API service.",
|
||||
},
|
||||
{
|
||||
"id": "desktop-shell",
|
||||
"label": "Desktop shell",
|
||||
"user_url": "pwa://installed-app or pake://local-url",
|
||||
"commands": [
|
||||
"cd jyotish-app && npm run build && npm run preview -- --host 127.0.0.1 --port 4173",
|
||||
"python3 scripts/desktop_packaging_preflight.py",
|
||||
],
|
||||
"api_required": True,
|
||||
"scope": "PWA/Pake now; Tauri sidecar only after API lifecycle and signing are fixed.",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def main() -> int:
|
||||
failures: list[str] = []
|
||||
readme = read(ROOT / "README.md")
|
||||
dockerfile = read(ROOT / "Dockerfile")
|
||||
compose = read(ROOT / "docker-compose.yml")
|
||||
package = json.loads(read(APP / "package.json"))
|
||||
manifest = json.loads(read(APP / "public" / "manifest.webmanifest"))
|
||||
sw = read(APP / "public" / "sw.js")
|
||||
|
||||
require("普通用户交付形态" in readme, "README missing ordinary-user delivery matrix", failures)
|
||||
require("python3 scripts/deployment_preflight.py" in readme, "README missing deployment preflight command", failures)
|
||||
require("http://localhost:5300" in compose, "docker-compose missing ordinary web URL note", failures)
|
||||
require("python3 scripts/deployment_preflight.py" in dockerfile, "Dockerfile must run deployment preflight", failures)
|
||||
require("build" in package.get("scripts", {}), "jyotish-app missing build script", failures)
|
||||
require("preview" in package.get("scripts", {}), "jyotish-app missing preview script", failures)
|
||||
require(manifest.get("display") == "standalone", "PWA manifest must remain standalone", failures)
|
||||
require("url.pathname.startsWith('/api/')" in sw, "service worker must bypass API requests", failures)
|
||||
|
||||
result = {
|
||||
"valid": not failures,
|
||||
"failures": failures,
|
||||
"delivery_matrix": delivery_matrix(),
|
||||
"ordinary_user_note": "公开演示环境只能完整展示静态壳;完整高级技法需要本地 API 服务。",
|
||||
}
|
||||
print(json.dumps(result, ensure_ascii=False, indent=2))
|
||||
return 0 if not failures else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -23,6 +23,7 @@ COMPILE_DIRS = [
|
||||
EXTRA_COMPILE_TARGETS = [
|
||||
ROOT / "mcp_server.py",
|
||||
ROOT / "scripts" / "audit_fragments.py",
|
||||
ROOT / "scripts" / "deployment_preflight.py",
|
||||
ROOT / "tests" / "run_golden_cases.py",
|
||||
ROOT / "tests" / "run_frontend_runtime_smoke.py",
|
||||
]
|
||||
@@ -55,6 +56,7 @@ RELEASE_CRITICAL_UNTRACKED_PATHS = [
|
||||
"progress.md",
|
||||
"scripts/audit_fragments.py",
|
||||
"scripts/deep_varga_avastha.py",
|
||||
"scripts/deployment_preflight.py",
|
||||
"scripts/desktop_packaging_preflight.py",
|
||||
"scripts/ephemeris_adapter_contract.py",
|
||||
"scripts/ephemeris_backend_probe.py",
|
||||
@@ -278,6 +280,7 @@ def main() -> int:
|
||||
validate_json_files()
|
||||
run([PYTHON, "scripts/audit_capabilities.py", "--mode", "validate"])
|
||||
run([PYTHON, "scripts/audit_fragments.py", "--strict"])
|
||||
run([PYTHON, "scripts/deployment_preflight.py"])
|
||||
if profile["check_release_hygiene"]:
|
||||
release_hygiene_check()
|
||||
run([PYTHON, "scripts/validate_bphs_invariants.py"])
|
||||
|
||||
Reference in New Issue
Block a user