Files
AutoMetabuilder/backend/autometabuilder/workflow/plugins/utils/utils_check_mvp.py
2026-01-10 16:46:58 +00:00

44 lines
1.3 KiB
Python

"""Workflow plugin: check if MVP is reached."""
import os
import re
def _is_mvp_reached() -> bool:
"""Check if the MVP section in ROADMAP.md is completed."""
if not os.path.exists("ROADMAP.md"):
return False
with open("ROADMAP.md", "r", encoding="utf-8") as f:
content = f.read()
# Find the header line containing (MVP)
header_match = re.search(r"^## .*?\(MVP\).*?$", content, re.MULTILINE | re.IGNORECASE)
if not header_match:
return False
# Get the position of the header
start_pos = header_match.end()
# Find the next header starting from start_pos
next_header_match = re.search(r"^## ", content[start_pos:], re.MULTILINE)
if next_header_match:
mvp_section = content[start_pos : start_pos + next_header_match.start()]
else:
mvp_section = content[start_pos:]
# Check if there are any unchecked items [ ]
if "[ ]" in mvp_section:
return False
# If there are checked items [x], and no unchecked items, we consider it reached
if "[x]" in mvp_section:
return True
return False
def run(_runtime, _inputs):
"""Check if the MVP section in ROADMAP.md is completed."""
mvp_reached = _is_mvp_reached()
return {"mvp_reached": mvp_reached}