feat: 更新冲突解决文档和模式,增加输出模式和策略要求,优化JSON架构

This commit is contained in:
catlog22
2025-12-26 15:40:40 +08:00
parent 02930bd56b
commit 1cf0d92ec2
2 changed files with 148 additions and 298 deletions

View File

@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Conflict Resolution Schema",
"description": "Simplified schema for conflict detection and resolution",
"description": "Schema for conflict detection, strategy generation, and resolution output",
"type": "object",
"required": ["conflicts", "summary"],
@@ -10,7 +10,7 @@
"type": "array",
"items": {
"type": "object",
"required": ["id", "brief", "severity", "category", "strategies"],
"required": ["id", "brief", "severity", "category", "strategies", "recommended"],
"properties": {
"id": {
"type": "string",
@@ -38,10 +38,41 @@
"type": "string",
"description": "详细冲突描述"
},
"clarification_questions": {
"type": "array",
"items": { "type": "string" },
"description": "需要用户澄清的问题(可选)"
"impact": {
"type": "object",
"properties": {
"scope": { "type": "string", "description": "影响的模块/组件" },
"compatibility": { "enum": ["Yes", "No", "Partial"] },
"migration_required": { "type": "boolean" },
"estimated_effort": { "type": "string", "description": "人天估计" }
}
},
"overlap_analysis": {
"type": "object",
"description": "仅当 category=ModuleOverlap 时需要",
"properties": {
"new_module": {
"type": "object",
"properties": {
"name": { "type": "string" },
"scenarios": { "type": "array", "items": { "type": "string" } },
"responsibilities": { "type": "string" }
}
},
"existing_modules": {
"type": "array",
"items": {
"type": "object",
"properties": {
"file": { "type": "string" },
"name": { "type": "string" },
"scenarios": { "type": "array", "items": { "type": "string" } },
"overlap_scenarios": { "type": "array", "items": { "type": "string" } },
"responsibilities": { "type": "string" }
}
}
}
}
},
"strategies": {
"type": "array",
@@ -49,26 +80,34 @@
"maxItems": 4,
"items": {
"type": "object",
"required": ["name", "approach", "complexity", "risk"],
"required": ["name", "approach", "complexity", "risk", "effort", "pros", "cons"],
"properties": {
"name": {
"type": "string",
"description": "策略名称(中文)"
},
"approach": {
"type": "string",
"description": "实现方法简述"
},
"complexity": {
"enum": ["Low", "Medium", "High"]
},
"risk": {
"enum": ["Low", "Medium", "High"]
},
"constraints": {
"name": { "type": "string", "description": "策略名称(中文)" },
"approach": { "type": "string", "description": "实现方法简述" },
"complexity": { "enum": ["Low", "Medium", "High"] },
"risk": { "enum": ["Low", "Medium", "High"] },
"effort": { "type": "string", "description": "时间估计" },
"pros": { "type": "array", "items": { "type": "string" }, "description": "优点" },
"cons": { "type": "array", "items": { "type": "string" }, "description": "缺点" },
"clarification_needed": {
"type": "array",
"items": { "type": "string" },
"description": "实施此策略的约束条件(传递给 task-generate"
"description": "需要用户澄清的问题(尤其是 ModuleOverlap"
},
"modifications": {
"type": "array",
"items": {
"type": "object",
"required": ["file", "section", "change_type", "old_content", "new_content", "rationale"],
"properties": {
"file": { "type": "string", "description": "相对项目根目录的完整路径" },
"section": { "type": "string", "description": "Markdown heading 用于定位" },
"change_type": { "enum": ["update", "add", "remove"] },
"old_content": { "type": "string", "description": "原始内容片段20-100字符用于唯一匹配" },
"new_content": { "type": "string", "description": "修改后的内容" },
"rationale": { "type": "string", "description": "修改理由" }
}
}
}
}
}
@@ -77,13 +116,20 @@
"type": "integer",
"minimum": 0,
"description": "推荐策略索引0-based"
},
"modification_suggestions": {
"type": "array",
"minItems": 2,
"maxItems": 5,
"items": { "type": "string" },
"description": "自定义处理建议2-5条中文"
}
}
}
},
"summary": {
"type": "object",
"required": ["total"],
"required": ["total", "critical", "high", "medium"],
"properties": {
"total": { "type": "integer" },
"critical": { "type": "integer" },
@@ -93,45 +139,13 @@
}
},
"examples": [
{
"conflicts": [
{
"id": "CON-001",
"brief": "新认证模块与现有 AuthManager 功能重叠",
"severity": "High",
"category": "ModuleOverlap",
"affected_files": ["src/auth/AuthManager.ts"],
"description": "计划新增的 UserAuthService 与现有 AuthManager 在登录和 Token 验证场景存在重叠",
"clarification_questions": [
"新模块的核心职责边界是什么?",
"哪些场景应该由新模块独立处理?"
],
"strategies": [
{
"name": "扩展现有模块",
"approach": "在 AuthManager 中添加新功能",
"complexity": "Low",
"risk": "Low",
"constraints": ["保持 AuthManager 作为唯一认证入口", "新增 MFA 方法"]
},
{
"name": "职责拆分",
"approach": "AuthManager 负责基础认证,新模块负责高级认证",
"complexity": "Medium",
"risk": "Medium",
"constraints": ["定义清晰的接口边界", "基础认证 = 密码+token", "高级认证 = MFA+OAuth"]
}
],
"recommended": 0
}
],
"summary": {
"total": 1,
"critical": 0,
"high": 1,
"medium": 0
}
}
]
"_quality_standards": {
"modifications": [
"old_content: 20-100字符确保 Edit 工具能唯一匹配",
"new_content: 保持 markdown 格式",
"change_type: update(替换), add(插入), remove(删除)"
],
"user_facing_text": "brief, name, pros, cons, modification_suggestions 使用中文",
"technical_fields": "severity, category, complexity, risk 使用英文"
}
}