from __future__ import annotations

import argparse
import json
import pathlib


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--bootstrapped-path", required=True, type=pathlib.Path)
    parser.add_argument("--observed-path", required=True, type=pathlib.Path)
    args = parser.parse_args()
    payload = json.loads(args.bootstrapped_path.read_text(encoding="utf-8"))
    args.observed_path.write_text(json.dumps({"bootstrapped_before_target_import": payload.get("status") == "BOOTSTRAPPED", "launcher_pid": payload.get("pid")}, sort_keys=True), encoding="utf-8")
    return 0


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