import os,json,pathlib
p=pathlib.Path(os.environ.get("HOOK_LOG", str(pathlib.Path(__file__).with_name("app-hooks.jsonl"))))
x=json.load(__import__("sys").stdin)
args=pathlib.Path(f"/proc/{os.getppid()}/cmdline").read_bytes().replace(b"\0",b" ").decode()
with p.open("a") as f:f.write(json.dumps({"event":x.get("hook_event_name"),"argv":args})+"\n")
