#!/usr/bin/env python3
"""删除 out/ 中 >= 1400 字节的摘要文件（疑似被截断），以便重新生成。"""
from pathlib import Path

from _env_paths import ensure_repo_root

ensure_repo_root()

OUT = Path("export/session_summaries/out")
threshold = 1400
removed = 0
for f in sorted(OUT.glob("*.txt")):
    if f.stat().st_size >= threshold:
        f.unlink()
        removed += 1
        print(f"  删除: {f.name} ({f.stat().st_size if f.exists() else '?'}B)")

total = len(list(OUT.glob("*.txt")))
print(f"\n删除 {removed} 个文件，剩余 {total} 个")
