Fix retention CLI import path when run from repo root.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-11 00:22:42 +08:00
parent 48e5872045
commit 659903506b

View file

@ -24,9 +24,15 @@ import argparse
import json
import os
import sys
from pathlib import Path
def main() -> int:
# Allow `python runtime/operations/scripts/...` from repo root without PYTHONPATH.
root = Path(__file__).resolve().parents[3]
if str(root) not in sys.path:
sys.path.insert(0, str(root))
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("--keep-days", type=int, default=30, help="Retain rows newer than this many days.")
p.add_argument("--dry-run", action="store_true", default=False, help="Force dry-run (default).")