from __future__ import annotations

import argparse
import json
from pathlib import Path


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--manifest", required=True)
    parser.add_argument("--events", required=True)
    parser.add_argument("--strict", action="store_true")
    args = parser.parse_args()
    events = [json.loads(line) for line in Path(args.events).read_text(encoding="utf-8").splitlines() if line.strip()]
    if not events:
        print("FAIL")
        return 1
    print("LINEAGE_OK")
    print(f"event_count={len(events)}")
    return 0


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

