"""
从 docsdeployment.md 对话记录中提取缺失文件的关键信息。
"""
from pathlib import Path

recovery = Path(r"C:\Users\Administrator\Downloads\RECOVERY\docsdeployment.md")
text = recovery.read_text(encoding="utf-8")

# 搜索关键文件名的上下文
keywords = [
    "ENV-MANAGEMENT",
    "PRE-TEST-VERIFICATION",
    "MINIPROGRAM-RELEASE",
    "config.ts",
]

lines = text.split("\n")
for kw in keywords:
    print(f"\n{'='*40}")
    print(f"搜索: {kw}")
    print(f"{'='*40}")
    for i, line in enumerate(lines):
        if kw in line:
            start = max(0, i - 1)
            end = min(len(lines), i + 3)
            for j in range(start, end):
                marker = ">>>" if j == i else "   "
                print(f"  {marker} L{j+1}: {lines[j][:120]}")
            print()
