#!/usr/bin/env python3
"""
Deprecated compatibility shim.

Historically this script restarted `gui_backend.py` and `bridge/gold_trader.py --daemon`.
That behavior conflicts with the current single-entry runtime design and can revive stale
repo/release processes after reboot. Keep the file as a harmless no-op so legacy callers
do not break, but never respawn old trading processes from here.
"""

from __future__ import annotations

import time
from pathlib import Path

PROJECT_DIR = Path(__file__).resolve().parents[1]
LOG_FILE = PROJECT_DIR / "logs" / "keepalive.log"


def log(message: str) -> None:
    ts = time.strftime("%Y-%m-%d %H:%M:%S")
    line = f"[{ts}] [KEEPALIVE] {message}"
    print(line)
    try:
        LOG_FILE.parent.mkdir(parents=True, exist_ok=True)
        with LOG_FILE.open("a", encoding="utf-8") as fh:
            fh.write(line + "\n")
    except Exception:
        pass


def main() -> int:
    log("Deprecated keepalive invoked; no action taken. Use launchd + gui_backend.py only.")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
