#!/usr/bin/env python3
"""Copy compact diff files to patch files for VS Code:."""

from pathlib import Path


def main() -> int:
    src_dir = Path("中间文件/润色输出/Kimi版-脚本润色-diff")
    dst_dir = Path("中间文件/润色输出/Kimi版-脚本润色-patch")
    dst_dir.mkdir(parents=True, exist_ok=True)

    for src in sorted(src_dir.glob("*-compact.diff")):
        stem = src.stem.replace("-compact", "")
        dst = dst_dir / f"{stem}.patch"
        dst.write_text(src.read_text(encoding="utf-8"), encoding="utf-8")
        print(f"Copied {src.name} -> {dst.name}")

    return 0


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