diff --git a/scripts/morning_health_check.py b/scripts/morning_health_check.py index b2e4b8e..518c7f8 100755 --- a/scripts/morning_health_check.py +++ b/scripts/morning_health_check.py @@ -646,7 +646,27 @@ def run_check(item): if unregistered: ok = False - detail = f"{len(gaps)}条未验证 + {len(unregistered)}个组件未注册管道" + detail = f"{len(gaps)}条待验证 + {len(unregistered)}个新组件未注册" + # 自动修复:把未注册的脚本加入注册表(占位) + try: + for s in unregistered: + reg["pipelines"].append({ + "id": f"auto-{s}", + "name": f"{s}(自动发现)", + "source": f"{s}.py (自动发现)", + "consumer": "未知(需确认)", + "end_user": "未知(需确认)", + "verified": False, + "verified_at": None, + "gap": "自动发现的组件,数据流待确认", + "fix": "手动编辑pipeline_registry.json完善此项", + "deadline": "发现后3天内" + }) + open(str(DATA / "pipeline_registry.json"), 'w').write( + j2.dumps(reg, ensure_ascii=False, indent=2)) + detail += f" → 已自动添加{len(unregistered)}条占位记录" + except Exception: + pass elif gaps: ok = False detail = f"{len(gaps)}条管道未验证: {', '.join(gaps[:5])}"