mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-15 02:42:45 +08:00
- Schema: add shared_context to plan-overview-base-schema, add pre_analysis/artifacts/inherited and polymorphic implementation (string|object with tdd_phase) to task-schema - Producer: action-planning-agent outputs flat fields (description, depends_on, focus_paths, convergence.criteria, files, implementation, pre_analysis) + plan.json generation - Orchestrator: plan.md/tdd-plan.md validate plan.json, task-generate-agent/tdd output dual-layer - Consumer: code-developer/tdd-developer/test-fix-agent/universal-executor read flat fields - Execute/review: read plan.json for execution strategy, use flat field paths - Remove all migration notes referencing old field names
586 lines
20 KiB
JSON
586 lines
20 KiB
JSON
{
|
||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||
"$id": "task-schema.json",
|
||
"title": "Unified Task JSON Schema",
|
||
"description": "统一任务定义 schema v1.0 — 每个任务一个独立 JSON 文件,自包含所有执行所需信息。融合 Unified JSONL (convergence)、6-field Task JSON (execution_config)、Solution Schema (modification_points) 三者优势。",
|
||
"type": "object",
|
||
"required": ["id", "title", "description", "depends_on", "convergence"],
|
||
|
||
"properties": {
|
||
|
||
"_comment_IDENTITY": "IDENTITY 区块 (必填) — 任务基本信息",
|
||
"id": {
|
||
"type": "string",
|
||
"description": "任务ID,前缀由生产者决定 (TASK-001 / IMPL-001 / L0 / T1 / FIX-001 等)"
|
||
},
|
||
"title": {
|
||
"type": "string",
|
||
"description": "任务标题 (动词+目标,如 'Create unified task schema')"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"description": "目标+原因 (1-3 句,描述做什么和为什么)"
|
||
},
|
||
|
||
"_comment_CLASSIFICATION": "CLASSIFICATION 区块 (可选) — 任务分类",
|
||
"type": {
|
||
"type": "string",
|
||
"enum": ["infrastructure", "feature", "enhancement", "fix", "refactor", "testing", "docs", "chore"],
|
||
"description": "任务类型"
|
||
},
|
||
"priority": {
|
||
"type": "string",
|
||
"enum": ["critical", "high", "medium", "low"],
|
||
"description": "优先级"
|
||
},
|
||
"effort": {
|
||
"type": "string",
|
||
"enum": ["small", "medium", "large"],
|
||
"description": "工作量估算"
|
||
},
|
||
"action": {
|
||
"type": "string",
|
||
"enum": ["Create", "Update", "Implement", "Refactor", "Add", "Delete", "Configure", "Test", "Fix"],
|
||
"description": "操作动作 (便于 issue 系统分类)"
|
||
},
|
||
|
||
"_comment_SCOPE": "SCOPE 区块 (可选) — 覆盖范围",
|
||
"scope": {
|
||
"oneOf": [
|
||
{ "type": "string" },
|
||
{ "type": "array", "items": { "type": "string" } }
|
||
],
|
||
"description": "覆盖范围 (模块路径或功能区域)"
|
||
},
|
||
"excludes": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "明确排除的范围"
|
||
},
|
||
"focus_paths": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "重点文件/目录路径"
|
||
},
|
||
|
||
"_comment_DEPENDENCIES": "DEPENDENCIES 区块 (必填) — 依赖关系",
|
||
"depends_on": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"default": [],
|
||
"description": "依赖任务 ID 列表 (无依赖则 [])"
|
||
},
|
||
"parallel_group": {
|
||
"type": "number",
|
||
"description": "并行分组编号 (同组可并行执行)"
|
||
},
|
||
|
||
"_comment_CONVERGENCE": "CONVERGENCE 区块 (必填) — 完成标准",
|
||
"convergence": {
|
||
"type": "object",
|
||
"required": ["criteria"],
|
||
"properties": {
|
||
"criteria": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"minItems": 1,
|
||
"description": "可测试的完成条件 (可写为断言或手动步骤)"
|
||
},
|
||
"verification": {
|
||
"type": "string",
|
||
"description": "可执行的验证步骤 (命令或明确步骤)"
|
||
},
|
||
"definition_of_done": {
|
||
"type": "string",
|
||
"description": "业务语言完成定义 (非技术人员可判断)"
|
||
}
|
||
},
|
||
"additionalProperties": false
|
||
},
|
||
|
||
"_comment_FILES": "FILES 区块 (可选) — 文件级修改点",
|
||
"files": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"required": ["path"],
|
||
"properties": {
|
||
"path": {
|
||
"type": "string",
|
||
"description": "文件路径"
|
||
},
|
||
"action": {
|
||
"type": "string",
|
||
"enum": ["modify", "create", "delete"],
|
||
"description": "文件操作类型"
|
||
},
|
||
"target": {
|
||
"type": "string",
|
||
"description": "修改目标 (函数名/类名,来自 Solution Schema)"
|
||
},
|
||
"changes": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "修改描述列表"
|
||
},
|
||
"change": {
|
||
"type": "string",
|
||
"description": "单条变更描述 (精确修改说明,合并自 modification_points.change)"
|
||
},
|
||
"conflict_risk": {
|
||
"type": "string",
|
||
"enum": ["low", "medium", "high"],
|
||
"description": "冲突风险等级"
|
||
}
|
||
},
|
||
"additionalProperties": false
|
||
},
|
||
"description": "涉及文件列表及修改详情"
|
||
},
|
||
|
||
"_comment_IMPLEMENTATION": "IMPLEMENTATION 区块 (可选) — 实施指南",
|
||
"implementation": {
|
||
"type": "array",
|
||
"items": {
|
||
"oneOf": [
|
||
{ "type": "string" },
|
||
{
|
||
"type": "object",
|
||
"required": ["step", "description"],
|
||
"properties": {
|
||
"step": { "type": "string", "description": "步骤编号/名称" },
|
||
"description": { "type": "string", "description": "步骤描述" },
|
||
"tdd_phase": { "type": "string", "enum": ["red", "green", "refactor"], "description": "TDD 阶段" },
|
||
"actions": { "type": "array", "items": { "type": "string" }, "description": "具体操作列表" },
|
||
"test_fix_cycle": {
|
||
"type": "object",
|
||
"properties": {
|
||
"max_iterations": { "type": "integer", "default": 3 }
|
||
},
|
||
"description": "测试修复循环配置"
|
||
}
|
||
},
|
||
"additionalProperties": false
|
||
}
|
||
]
|
||
},
|
||
"description": "步骤化实施指南 — 支持字符串 (简单步骤) 或对象 (含 TDD 阶段等详情)"
|
||
},
|
||
"test": {
|
||
"type": "object",
|
||
"properties": {
|
||
"commands": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "测试命令"
|
||
},
|
||
"unit": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "单元测试要求"
|
||
},
|
||
"integration": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "集成测试要求"
|
||
},
|
||
"coverage_target": {
|
||
"type": "number",
|
||
"minimum": 0,
|
||
"maximum": 100,
|
||
"description": "覆盖率目标 (%)"
|
||
},
|
||
"manual_checks": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "手动验证步骤 (合并自 verification_detail)"
|
||
},
|
||
"success_metrics": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "量化成功指标 (如 '响应时间 <200ms', '覆盖率 >80%',合并自 verification_detail)"
|
||
},
|
||
"reusable_tools": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "可复用测试工具/脚本"
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"description": "测试要求"
|
||
},
|
||
"regression": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "回归检查点"
|
||
},
|
||
|
||
"_comment_PLANNING": "PLANNING 区块 (可选) — 规划详情 (reference + rationale + risks + code_skeleton)",
|
||
"reference": {
|
||
"type": "object",
|
||
"properties": {
|
||
"pattern": {
|
||
"type": "string",
|
||
"description": "参考模式名称"
|
||
},
|
||
"files": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "参考文件路径"
|
||
},
|
||
"examples": {
|
||
"type": "string",
|
||
"description": "参考指南或示例"
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"description": "参考实现资料"
|
||
},
|
||
"rationale": {
|
||
"type": "object",
|
||
"properties": {
|
||
"chosen_approach": {
|
||
"type": "string",
|
||
"description": "选定方案及原因"
|
||
},
|
||
"alternatives_considered": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "被考虑但未选择的替代方案"
|
||
},
|
||
"decision_factors": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "影响决策的关键因素 (性能、可维护性、成本等)"
|
||
},
|
||
"tradeoffs": {
|
||
"type": "string",
|
||
"description": "选定方案的已知权衡"
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"description": "设计决策原因 (Medium/High complexity 时使用)"
|
||
},
|
||
"risks": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"required": ["description", "probability", "impact", "mitigation"],
|
||
"properties": {
|
||
"description": {
|
||
"type": "string",
|
||
"description": "风险描述"
|
||
},
|
||
"probability": {
|
||
"type": "string",
|
||
"enum": ["Low", "Medium", "High"],
|
||
"description": "发生概率"
|
||
},
|
||
"impact": {
|
||
"type": "string",
|
||
"enum": ["Low", "Medium", "High"],
|
||
"description": "影响程度"
|
||
},
|
||
"mitigation": {
|
||
"type": "string",
|
||
"description": "缓解策略"
|
||
},
|
||
"fallback": {
|
||
"type": "string",
|
||
"description": "缓解失败时的替代方案"
|
||
}
|
||
},
|
||
"additionalProperties": false
|
||
},
|
||
"description": "结构化风险评估"
|
||
},
|
||
"code_skeleton": {
|
||
"type": "object",
|
||
"properties": {
|
||
"interfaces": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": { "type": "string" },
|
||
"definition": { "type": "string" },
|
||
"purpose": { "type": "string" }
|
||
}
|
||
},
|
||
"description": "关键接口/类型定义"
|
||
},
|
||
"key_functions": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"signature": { "type": "string" },
|
||
"purpose": { "type": "string" },
|
||
"returns": { "type": "string" }
|
||
}
|
||
},
|
||
"description": "关键函数签名"
|
||
},
|
||
"classes": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": { "type": "string" },
|
||
"purpose": { "type": "string" },
|
||
"methods": {
|
||
"type": "array",
|
||
"items": { "type": "string" }
|
||
}
|
||
}
|
||
},
|
||
"description": "关键类结构"
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"description": "代码骨架 (High complexity 时使用)"
|
||
},
|
||
|
||
"_comment_EXECUTION": "EXECUTION 区块 (可选) — 执行策略",
|
||
"meta": {
|
||
"type": "object",
|
||
"properties": {
|
||
"agent": {
|
||
"type": "string",
|
||
"description": "分配的 agent (@code-developer / @test-fix-agent 等)"
|
||
},
|
||
"module": {
|
||
"type": "string",
|
||
"description": "所属模块 (frontend/backend/shared)"
|
||
},
|
||
"execution_config": {
|
||
"type": "object",
|
||
"properties": {
|
||
"method": {
|
||
"type": "string",
|
||
"enum": ["agent", "cli"],
|
||
"description": "执行方式"
|
||
},
|
||
"cli_tool": {
|
||
"type": "string",
|
||
"enum": ["codex", "gemini", "qwen", "auto"],
|
||
"description": "CLI 工具选择"
|
||
},
|
||
"enable_resume": {
|
||
"type": "boolean",
|
||
"description": "是否启用会话恢复"
|
||
}
|
||
},
|
||
"additionalProperties": false
|
||
}
|
||
},
|
||
"additionalProperties": true,
|
||
"description": "执行元信息"
|
||
},
|
||
"cli_execution": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"description": "CLI 会话 ID (WFS-{session}-TASK-{id})"
|
||
},
|
||
"strategy": {
|
||
"type": "string",
|
||
"enum": ["new", "resume", "fork", "merge_fork"],
|
||
"description": "CLI 执行策略"
|
||
},
|
||
"resume_from": {
|
||
"type": "string",
|
||
"description": "父任务 CLI ID (用于 resume/fork)"
|
||
},
|
||
"merge_from": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "合并来源 CLI ID 列表 (用于 merge_fork)"
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"description": "CLI 执行配置"
|
||
},
|
||
|
||
"_comment_EXTENDED_CONTEXT": "EXTENDED CONTEXT 区块 (可选) — 扩展执行上下文",
|
||
"pre_analysis": {
|
||
"type": "array",
|
||
"description": "Pre-execution analysis steps. Agent executes these before implementation.",
|
||
"items": {
|
||
"type": "object",
|
||
"required": ["step", "action"],
|
||
"properties": {
|
||
"step": { "type": "string", "description": "步骤名称" },
|
||
"action": { "type": "string", "description": "执行动作描述" },
|
||
"commands": { "type": "array", "items": { "type": "string" }, "description": "执行命令列表" },
|
||
"command": { "type": "string", "description": "单条执行命令" },
|
||
"output_to": { "type": "string", "description": "输出存储位置" },
|
||
"on_error": { "type": "string", "enum": ["fail", "skip_optional", "continue"], "description": "错误处理策略" }
|
||
},
|
||
"additionalProperties": false
|
||
}
|
||
},
|
||
"artifacts": {
|
||
"type": "array",
|
||
"description": "Brainstorming artifact references for context.",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"type": { "type": "string", "description": "产物类型" },
|
||
"source": { "type": "string", "description": "产物来源" },
|
||
"path": { "type": "string", "description": "产物路径" },
|
||
"feature_id": { "type": "string", "description": "关联功能 ID" },
|
||
"priority": { "type": "string", "description": "优先级" },
|
||
"usage": { "type": "string", "description": "使用说明" }
|
||
},
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"inherited": {
|
||
"type": "object",
|
||
"description": "Context inherited from parent task.",
|
||
"properties": {
|
||
"from": { "type": "string", "description": "父任务 ID" },
|
||
"context": { "type": "array", "items": { "type": "string" }, "description": "继承的上下文条目" }
|
||
},
|
||
"additionalProperties": false
|
||
},
|
||
|
||
"_comment_CONTEXT": "CONTEXT 区块 (可选) — 来源与上下文",
|
||
"source": {
|
||
"type": "object",
|
||
"properties": {
|
||
"tool": {
|
||
"type": "string",
|
||
"description": "产出工具名 (workflow-plan / lite-plan / issue-resolve / review-cycle 等)"
|
||
},
|
||
"session_id": {
|
||
"type": "string",
|
||
"description": "来源 session ID"
|
||
},
|
||
"original_id": {
|
||
"type": "string",
|
||
"description": "转换前原始 ID"
|
||
},
|
||
"issue_id": {
|
||
"type": "string",
|
||
"description": "关联的 Issue ID"
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"description": "任务来源信息"
|
||
},
|
||
"context_package_path": {
|
||
"type": "string",
|
||
"description": "上下文包路径"
|
||
},
|
||
"evidence": {
|
||
"type": "array",
|
||
"description": "支撑证据"
|
||
},
|
||
"inputs": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "消费的产物 (文件/资源)"
|
||
},
|
||
"outputs": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "产出的产物 (文件/资源)"
|
||
},
|
||
"commit": {
|
||
"type": "object",
|
||
"properties": {
|
||
"type": {
|
||
"type": "string",
|
||
"enum": ["feat", "fix", "refactor", "test", "docs", "chore"],
|
||
"description": "提交类型"
|
||
},
|
||
"scope": {
|
||
"type": "string",
|
||
"description": "提交范围"
|
||
},
|
||
"message_template": {
|
||
"type": "string",
|
||
"description": "提交消息模板"
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"description": "提交信息模板"
|
||
},
|
||
|
||
"_comment_RUNTIME": "RUNTIME 区块 (执行时填充) — 运行时状态",
|
||
"status": {
|
||
"type": "string",
|
||
"enum": ["pending", "in_progress", "completed", "failed", "skipped", "blocked"],
|
||
"default": "pending",
|
||
"description": "执行状态 (执行引擎填充)"
|
||
},
|
||
"executed_at": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"description": "执行时间戳 (ISO 8601)"
|
||
},
|
||
"result": {
|
||
"type": "object",
|
||
"properties": {
|
||
"success": {
|
||
"type": "boolean",
|
||
"description": "是否成功"
|
||
},
|
||
"files_modified": {
|
||
"type": "array",
|
||
"items": { "type": "string" },
|
||
"description": "修改的文件列表"
|
||
},
|
||
"summary": {
|
||
"type": "string",
|
||
"description": "执行摘要"
|
||
},
|
||
"error": {
|
||
"type": "string",
|
||
"description": "错误信息 (失败时)"
|
||
},
|
||
"convergence_verified": {
|
||
"type": "array",
|
||
"items": { "type": "boolean" },
|
||
"description": "收敛标准验证结果 (对应 convergence.criteria 每项)"
|
||
},
|
||
"commit_hash": {
|
||
"type": "string",
|
||
"description": "提交哈希"
|
||
}
|
||
},
|
||
"additionalProperties": false,
|
||
"description": "执行结果 (执行引擎填充)"
|
||
}
|
||
},
|
||
|
||
"additionalProperties": true,
|
||
|
||
"_field_usage_by_producer": {
|
||
"workflow-plan": "IDENTITY + CLASSIFICATION + SCOPE + DEPENDENCIES + CONVERGENCE + FILES + IMPLEMENTATION + EXECUTION(pre_analysis + artifacts + inherited + cli_execution + meta) + PLANNING(reference + rationale + risks + code_skeleton) + CONTEXT(context_package_path)",
|
||
"lite-plan": "IDENTITY + CLASSIFICATION + DEPENDENCIES + CONVERGENCE + FILES",
|
||
"lite-plan (v2)": "IDENTITY + CLASSIFICATION + SCOPE + DEPENDENCIES + CONVERGENCE + FILES(+change) + IMPLEMENTATION(+manual_checks +success_metrics) + PLANNING(reference + rationale + risks + code_skeleton)",
|
||
"req-plan": "IDENTITY + CLASSIFICATION + SCOPE + DEPENDENCIES + CONVERGENCE + PLANNING(risks) + CONTEXT(inputs/outputs)",
|
||
"collaborative-plan": "IDENTITY + CLASSIFICATION + SCOPE + DEPENDENCIES + CONVERGENCE + FILES + CONTEXT(source)",
|
||
"issue-resolve": "IDENTITY + CLASSIFICATION + SCOPE + DEPENDENCIES + CONVERGENCE + FILES(with target) + IMPLEMENTATION + CONTEXT(commit/source)",
|
||
"review-cycle": "IDENTITY + CLASSIFICATION + FILES + CONVERGENCE + IMPLEMENTATION + CONTEXT(source/evidence)",
|
||
"tdd-plan": "IDENTITY + CLASSIFICATION + DEPENDENCIES + CONVERGENCE + EXECUTION + IMPLEMENTATION(test focused)",
|
||
"analyze-brainstorm": "IDENTITY + CLASSIFICATION + DEPENDENCIES + CONVERGENCE + CONTEXT(evidence/source)"
|
||
},
|
||
|
||
"_directory_convention": {
|
||
"standard_path": "{session_folder}/.task/",
|
||
"file_naming": "TASK-{id}.json (或保留原有 ID 前缀: IMPL-, L0-, T1-, FIX-)",
|
||
"examples": {
|
||
"workflow-plan": ".workflow/active/WFS-xxx/.task/IMPL-001.json",
|
||
"lite-plan": ".workflow/.lite-plan/{id}/.task/TASK-001.json",
|
||
"req-plan": ".workflow/.req-plan/RPLAN-{id}/.task/TASK-001.json",
|
||
"collab-plan": ".workflow/.planning/CPLAN-{id}/.task/TASK-001.json",
|
||
"review-cycle": ".workflow/active/WFS-{id}/.review/.task/FIX-001.json",
|
||
"issue-resolve": ".workflow/issues/{issue-id}/.task/TASK-001.json"
|
||
}
|
||
}
|
||
} |