更新API文档日期
()
| 72 | |
| 73 | |
| 74 | def update_api_doc(): |
| 75 | """更新API文档日期""" |
| 76 | doc = PROJECT_ROOT / "docs" / "api" / "workflow_platform_api.md" |
| 77 | |
| 78 | if not doc.exists(): |
| 79 | print(f" [WARN] File not found: {doc}") |
| 80 | return False |
| 81 | |
| 82 | try: |
| 83 | content = doc.read_text(encoding="utf-8") |
| 84 | lines = content.split("\n") |
| 85 | |
| 86 | # 检查是否已有更新日期 |
| 87 | has_date = any("最后更新" in line or "Last Updated" in line for line in lines[:5]) |
| 88 | |
| 89 | if not has_date: |
| 90 | # 在标题后添加日期(假设第一行是标题) |
| 91 | if lines and lines[0].startswith("#"): |
| 92 | lines.insert(1, "") |
| 93 | lines.insert(2, "**Last Updated**: 2025-12-13") |
| 94 | lines.insert(3, "") |
| 95 | |
| 96 | doc.write_text("\n".join(lines), encoding="utf-8") |
| 97 | print(" [OK] Updated workflow_platform_api.md") |
| 98 | print(" - Added update date: 2025-12-13") |
| 99 | return True |
| 100 | else: |
| 101 | print(" [INFO] workflow_platform_api.md - already has date marker") |
| 102 | return True |
| 103 | except Exception as e: |
| 104 | print(f" [ERROR] Update failed: {e}") |
| 105 | return False |
| 106 | |
| 107 | |
| 108 | def main(): |