test: 固定项目红线集成检查 (#317)

This commit is contained in:
chengma
2026-08-26 17:23:35 +08:00
parent 6df27b6a5b
commit 9fbed74e86
3 changed files with 35 additions and 2 deletions
+21
View File
@@ -368,6 +368,26 @@ def check_agent_efficiency_rules(errors: list[str], root: Path = ROOT) -> None:
errors.append(f"AGENTS.md 缺少:{section}")
def check_project_redlines(errors: list[str], root: Path = ROOT) -> None:
"""固定检查 cmautobuy 五条产品红线和跨端契约入口。"""
path = root / "AGENTS.md"
if not path.is_file():
return
content = path.read_text(encoding="utf-8")
required = (
"Qt 绑定固定 PyQt5",
"Admin 新建采购任务固定为真实下单(不支付)",
"不自动注册登录,不自动付款",
"公开引导默认密码固定为 `chengma`",
"只准核对订单,绝不重新下单",
"Client 侧文档",
"唯一事实来源",
)
for section in missing_sections(content, required):
errors.append(f"AGENTS.md 缺少项目红线:{section}")
def check_repository_readme(errors: list[str], root: Path = ROOT) -> None:
"""检查快速开始包含线上 Wiki 初始化顺序和产品编码门禁。"""
@@ -596,6 +616,7 @@ def run_check(args: argparse.Namespace) -> int:
check_core_documents(errors)
check_task_template(errors)
check_agent_efficiency_rules(errors)
check_project_redlines(errors)
check_repository_readme(errors)
check_claude_code_entry(errors)
check_archives(errors)