from __future__ import annotations

import os
from pathlib import Path

from watchfiles import run_process
from gateway_runtime.main import start


def _runGateway() -> None:
    start()

def main() -> None:
    repoRoot = Path(os.getenv("GATEWAY_REPO_ROOT", "/workspaces/gateway"))

    watchPaths = [
        str(repoRoot / "apps"),
        str(repoRoot / "packages"),
    ]

    run_process(
        *watchPaths,
        target=_runGateway,
        debounce=200,
    )

if __name__ == "__main__":
    main()
