Public Access
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Report or apply deterministic recipe catalog quarantine decisions."""
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
import os
|
|
import sys
|
|
|
|
_ = sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
|
|
|
from app.database import SessionLocal
|
|
from app.services.recipe_catalog_audit import audit_recipe_catalog
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(
|
|
description="Audit recipe provenance and semantic quality"
|
|
)
|
|
parser.add_argument(
|
|
"--apply",
|
|
action="store_true",
|
|
help="Persist active/quarantined status and findings atomically",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
db = SessionLocal()
|
|
try:
|
|
report = audit_recipe_catalog(db, apply=args.apply)
|
|
if args.apply:
|
|
db.commit()
|
|
print(json.dumps(report, indent=2, sort_keys=True))
|
|
return 0
|
|
except Exception:
|
|
db.rollback()
|
|
raise
|
|
finally:
|
|
db.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|