# -*- coding: utf-8 -*- """数据接入准备交付包(docs/数据接入准备_交付包.md)完整性检查。 检查项: 1. 必备章节齐全(交付物清单 / 接入确认清单 / 缺省策略 / 验收对照); 2. 交付物引用的文档/资产真实存在(#16/#17/#18/#19/#20/#27 成果); 3. EPIC #2 验收关键词存在(沸腾氯化炉 / LIMS / 能源计量 / 提前 2 周 / 缺省)。 用法:python _check_delivery_doc.py """ import os import sys HERE = os.path.dirname(os.path.abspath(__file__)) REPO_ROOT = os.path.dirname(HERE) DOC_PATH = os.path.join(HERE, "数据接入准备_交付包.md") REQUIRED_SECTIONS = [ "## 1. 交付物清单", "## 2. 数据项接入确认清单", "## 3. 缺省策略执行路径", "## 5. 验收对照", ] # 交付物引用的关键文档/资产(需存在) REFERENCED_PATHS = [ "docs/DCS点表需求模板.md", "docs/LIMS质检接口字段清单.md", "docs/数据准备清单.md", "docs/网络拓扑与隔离策略.md", "docs/采集网只读隔离与网闸配置.md", "templates/ti-cl4/point-dict/point_dict.default.csv", ] KEY_PHRASES = ["沸腾氯化炉", "精制还原", "LIMS", "能源计量", "提前 2 周", "缺省通用点位集"] def main() -> int: failures = [] text = open(DOC_PATH, "r", encoding="utf-8").read() for sec in REQUIRED_SECTIONS: if sec not in text: failures.append(f"缺少必备章节:{sec}") for rel in REFERENCED_PATHS: if not os.path.isfile(os.path.join(REPO_ROOT, rel)): failures.append(f"交付物引用缺失:{rel}") for phrase in KEY_PHRASES: if phrase not in text: failures.append(f"缺少验收关键词:{phrase}") if failures: print("FAIL") for f in failures: print(" -", f) return 1 print("OK: 章节/交付物引用/验收关键词校验通过") return 0 if __name__ == "__main__": sys.exit(main())