diff --git a/src-tauri/src/commands/blueprint.rs b/src-tauri/src/commands/blueprint.rs index 41c6cc6..64a98c3 100644 --- a/src-tauri/src/commands/blueprint.rs +++ b/src-tauri/src/commands/blueprint.rs @@ -775,6 +775,40 @@ fn read_blueprint_summary(root: &Path) -> String { if parts.is_empty() { "(蓝图目录为空)".to_string() } else { parts.join("\n\n") } } +/// manifest.yaml 硬约束骨架——就近、简短、高亮,防止子项目 AI 凭感觉或沿用非法旧格式。 +/// (CONVENTIONS 全文 900+ 行,manifest 规范埋在中间,实测会被忽略——noteapp 事故) +fn manifest_schema_hint() -> &'static str { + r##"## ⚠️ manifest.yaml 严格格式(解析器强校验,违反则蓝图无法识别) + +```yaml +version: 1 +name: 项目名 +iteration: 1 +updated: YYYY-MM-DD + +areas: # 至少定义一个 + - id: frontend + name: 前端 + color: "#3B82F6" + +modules: + - id: kebab-case-id # 必填,唯一 + name: 显示名称 # 必填 + area: frontend # 必填!必须是上方 areas 中已定义的 id + status: done # 必填,只允许:done | in_progress | planned | concept | blocked | abandoned + position: [0, 0] # 可选 + +edges: # 可选 + - from: module-a + to: module-b + type: dependency # 只允许 dependency | related +``` + +硬性规定: +- 禁止自造字段与取值(如 `project:`、`stable`、`in-progress`、`depends_on:` 均非法)——依赖关系写入顶层 edges +- **若项目中已存在不符合此格式的 manifest.yaml,必须重写为合法格式**(保留其中的有效信息),不要沿用旧结构"## +} + fn build_init_prompt( project_name: &str, tech_stack: &str, @@ -819,6 +853,8 @@ fn build_init_prompt( {conventions} +{schema_hint} + ## 你的任务 1. 识别项目的主要功能模块({module_hint}),合理划分 area(前端/后端/基础设施等) 2. 创建 `.blueprint/manifest.yaml`(含 areas、modules、edges) @@ -830,6 +866,7 @@ fn build_init_prompt( 请直接输出需要创建的文件内容。 "#, conventions = effective_conventions_content(), + schema_hint = manifest_schema_hint(), ) } @@ -912,6 +949,8 @@ fn build_sync_prompt( {conventions} +{schema_hint} + ## 你的任务 {tasks} @@ -931,6 +970,7 @@ fn build_sync_prompt( tasks = tasks, output_hint = output_hint, conventions = effective_conventions_content(), + schema_hint = manifest_schema_hint(), ) }