fix(tools): 恢复 OpenAPI 抓取脚本 + 重抓 backend-api.json (W1 / F2-1A)

历史: 2026-04-06 commit 779b2f6 大批量清理时被 Claude Opus 4.6
误归档到 _DEL/_DEL/scripts/ops/_export_openapi.py, 28 天 stale。

恢复:
- cp _DEL/_DEL/scripts/ops/_export_openapi.py scripts/ops/
- 跑脚本重抓: 137 -> 167 paths (新增 30) / 194 -> 234 schemas
- 0 个 removed (后端无废弃)

新增 30 端点分布: admin-ai 5 + runtime-context 3 + task-engine 7 +
triggers 1 + db-health 1 + execution/internal/trigger-jobs 5 + xcx 5

附 F3-2B prompt 文件清单 (本地 8 个 + App1 缺本地副本):
docs/_overview/wave1-findings/F3-2-prompt-files-list.md
Neo 决策 B 云端权威, 用清单对照云端 prompt 检查/更新本地副本。

详细 diff 见审计:
docs/audit/changes/2026-05-04__wave1_f2_1_openapi_script_restored.md
This commit is contained in:
Neo
2026-05-05 00:30:10 +08:00
parent 8458cfaae2
commit f92f2d98f3
4 changed files with 4334 additions and 171 deletions

View File

@@ -0,0 +1,12 @@
"""从运行中的 FastAPI app 导出 OpenAPI spec 到 docs/contracts/openapi/backend-api.json"""
import json
import pathlib
import sys
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2] / "apps" / "backend"))
from app.main import app
spec = app.openapi()
out = pathlib.Path(r"C:\Project\NeoZQYY\docs\contracts\openapi\backend-api.json")
out.write_text(json.dumps(spec, ensure_ascii=False, indent=2), encoding="utf-8")
print(f"Done: {len(spec['paths'])} paths, {len(spec['components']['schemas'])} schemas")