import argparse import logging from services.shopify_ingest_service import reindex_all, reindex_brand, sync_new_workspace def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description="Sync or re-index Shopify workspace policies.") parser.add_argument("--reindex", metavar="SLUG", help="Force re-index one workspace slug.") parser.add_argument("--reindex-all", action="store_true", help="Re-index every workspace.") return parser.parse_args() def main() -> None: logging.basicConfig( level=logging.INFO, format="%(asctime)s | %(levelname)s | %(name)s | %(message)s", ) args = parse_args() if args.reindex and args.reindex_all: raise SystemExit("Use either --reindex or --reindex-all, not both.") if args.reindex: reindex_brand(args.reindex) elif args.reindex_all: reindex_all() else: sync_new_workspace() if __name__ == "__main__": main()