diff --git a/src/daemon/mail_handler.py b/src/daemon/mail_handler.py index bae70ac..2f125d0 100644 --- a/src/daemon/mail_handler.py +++ b/src/daemon/mail_handler.py @@ -9,7 +9,7 @@ import logging from pathlib import Path from src.daemon.base_task_handler import BaseTaskHandler, VerifyResult -from src.daemon.prompt_composer import PromptComposer, PromptContext, GiteaConventionSection, WikiGuideSection +from src.daemon.prompt_composer import PromptComposer, PromptContext, GiteaConventionSection, WikiGuideSection, DeliveryChecklistSection from src.blackboard.db import get_connection logger = logging.getLogger("moziplus-v2.handler.mail") @@ -36,7 +36,7 @@ class MailHandler(BaseTaskHandler): return composer.compose(context) def get_sections(self) -> list: - return [MailContextSection(), MailApiSection(), MailConstraintsSection(), GiteaConventionSection(), WikiGuideSection()] + return [MailContextSection(), MailApiSection(), MailConstraintsSection(), GiteaConventionSection(), WikiGuideSection(), DeliveryChecklistSection()] def verify_completion(self, task_id: str, db_path: Path) -> VerifyResult: """Mail 完成验证:区分 inform/request。 diff --git a/src/daemon/prompt_composer.py b/src/daemon/prompt_composer.py index b355442..10705de 100644 --- a/src/daemon/prompt_composer.py +++ b/src/daemon/prompt_composer.py @@ -174,3 +174,27 @@ class WikiGuideSection: def should_include(self, context: "PromptContext") -> bool: return True + + +# --------------------------------------------------------------------------- +# DeliveryChecklistSection — 交付检查清单 +# --------------------------------------------------------------------------- +class DeliveryChecklistSection: + """交付检查清单 — 提醒 Agent 完成前同步关联成果物。""" + + name: str = "delivery_checklist" + priority: int = 55 # CONSTRAINTS(50) 和 EXTENSION(60) 之间 + + CHECKLIST_TEXT = ( + "## 交付检查\n" + "完成代码改动前确认:\n" + "- 改了实现 → docs/design/ 对应设计文档是否需要更新\n" + "- 改了实现 → tests/ 是否有对应测试脚本需要更新\n" + "- 所有成果物变更通过 PR 流程:PR review 把关设计合理性,CI 把关代码质量,CD 把关部署正确性\n" + ) + + def render(self, context: "PromptContext") -> str: + return self.CHECKLIST_TEXT + + def should_include(self, context: "PromptContext") -> bool: + return True diff --git a/src/daemon/task_handler.py b/src/daemon/task_handler.py index ea3dccb..2127890 100644 --- a/src/daemon/task_handler.py +++ b/src/daemon/task_handler.py @@ -10,7 +10,7 @@ from pathlib import Path from typing import Dict, Optional from src.daemon.base_task_handler import BaseTaskHandler, VerifyResult -from src.daemon.prompt_composer import PromptComposer, PromptContext, GiteaConventionSection, WikiGuideSection +from src.daemon.prompt_composer import PromptComposer, PromptContext, GiteaConventionSection, WikiGuideSection, DeliveryChecklistSection from src.blackboard.db import get_connection logger = logging.getLogger("moziplus-v2.handler") @@ -315,6 +315,7 @@ class TaskHandler(BaseTaskHandler): TaskConstraintsSection(), GiteaConventionSection(), WikiGuideSection(), + DeliveryChecklistSection(), ] def build_prompt(self, context: PromptContext) -> str: diff --git a/src/daemon/toolchain_handler.py b/src/daemon/toolchain_handler.py index 55b9b11..d317b28 100644 --- a/src/daemon/toolchain_handler.py +++ b/src/daemon/toolchain_handler.py @@ -13,7 +13,7 @@ from pathlib import Path from typing import Dict, List from src.daemon.base_task_handler import BaseTaskHandler, VerifyResult -from src.daemon.prompt_composer import PromptComposer, PromptContext, GiteaConventionSection, WikiGuideSection +from src.daemon.prompt_composer import PromptComposer, PromptContext, GiteaConventionSection, WikiGuideSection, DeliveryChecklistSection from src.daemon.toolchain_templates import render_template, _TEMPLATE_MAP from src.blackboard.db import get_connection @@ -252,6 +252,7 @@ class ToolchainHandler(BaseTaskHandler): ToolchainConstraintsSection(), GiteaConventionSection(), WikiGuideSection(), + DeliveryChecklistSection(), ] def build_prompt(self, context: PromptContext) -> str: