openmatrix 0.1.85 → 0.1.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -76,4 +76,12 @@ export declare class TaskPlanner {
|
|
|
76
76
|
private generateTaskId;
|
|
77
77
|
private determinePriority;
|
|
78
78
|
private estimateComplexity;
|
|
79
|
+
/**
|
|
80
|
+
* 分类目标类型
|
|
81
|
+
* - development: 需要编写代码的功能实现 → 拆分为实现+测试对
|
|
82
|
+
* - testing: 已明确是测试任务 → 单个测试任务
|
|
83
|
+
* - documentation: 文档编写 → 单个文档任务
|
|
84
|
+
* - other: 其他类型(配置、优化、部署等) → 单个任务
|
|
85
|
+
*/
|
|
86
|
+
private classifyGoal;
|
|
79
87
|
}
|
|
@@ -73,7 +73,7 @@ ${globalContext}
|
|
|
73
73
|
]
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
// 1.
|
|
76
|
+
// 1. 为每个目标创建任务(根据目标类型决定拆分策略)
|
|
77
77
|
const devTaskIds = [];
|
|
78
78
|
for (let i = 0; i < parsedTask.goals.length; i++) {
|
|
79
79
|
const goal = parsedTask.goals[i];
|
|
@@ -82,43 +82,102 @@ ${globalContext}
|
|
|
82
82
|
continue;
|
|
83
83
|
}
|
|
84
84
|
seenTitles.add(goal);
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
85
|
+
const goalType = this.classifyGoal(goal);
|
|
86
|
+
const deps = designTaskId ? [designTaskId] : [];
|
|
87
|
+
if (goalType === 'development') {
|
|
88
|
+
// 开发类目标: 拆分为实现 + 测试 对
|
|
89
|
+
const devTaskId = this.generateTaskId();
|
|
90
|
+
devTaskIds.push(devTaskId);
|
|
91
|
+
const acceptanceCriteria = this.generateAcceptanceCriteria(goal, userContext);
|
|
92
|
+
breakdowns.push({
|
|
93
|
+
taskId: devTaskId,
|
|
94
|
+
title: `实现: ${goal}`,
|
|
95
|
+
description: this.buildTaskDescription(goal, globalContext),
|
|
96
|
+
priority: this.determinePriority(i),
|
|
97
|
+
dependencies: deps,
|
|
98
|
+
estimatedComplexity: this.estimateComplexity(goal),
|
|
99
|
+
assignedAgent: 'coder',
|
|
100
|
+
phase: 'develop',
|
|
101
|
+
acceptanceCriteria,
|
|
102
|
+
testTaskId: undefined
|
|
103
|
+
});
|
|
104
|
+
// 配对的测试任务
|
|
105
|
+
const testTaskId = this.generateTaskId();
|
|
106
|
+
breakdowns.push({
|
|
107
|
+
taskId: testTaskId,
|
|
108
|
+
title: `测试: ${goal}`,
|
|
109
|
+
description: this.buildTestDescription(goal, devTaskId, coverageTarget, globalContext),
|
|
110
|
+
priority: this.determinePriority(i),
|
|
111
|
+
dependencies: [devTaskId],
|
|
112
|
+
estimatedComplexity: 'medium',
|
|
113
|
+
assignedAgent: 'tester',
|
|
114
|
+
phase: 'verify',
|
|
115
|
+
acceptanceCriteria: [
|
|
116
|
+
`单元测试覆盖率 >= ${coverageTarget}%`,
|
|
117
|
+
'边界情况已测试',
|
|
118
|
+
'异常处理已验证',
|
|
119
|
+
'所有测试通过'
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
breakdowns[breakdowns.length - 2].testTaskId = testTaskId;
|
|
123
|
+
}
|
|
124
|
+
else if (goalType === 'testing') {
|
|
125
|
+
// 测试类目标: 直接创建单个测试任务
|
|
126
|
+
const taskId = this.generateTaskId();
|
|
127
|
+
breakdowns.push({
|
|
128
|
+
taskId,
|
|
129
|
+
title: goal,
|
|
130
|
+
description: `## 测试目标\n${goal}\n\n${globalContext}\n\n## 测试要求\n- 单元测试覆盖率 >= ${coverageTarget}%\n- 测试正常流程\n- 测试边界情况\n- 测试异常处理\n\n## 输出\n- 测试文件\n- 测试报告\n- 覆盖率报告`,
|
|
131
|
+
priority: this.determinePriority(i),
|
|
132
|
+
dependencies: deps,
|
|
133
|
+
estimatedComplexity: 'medium',
|
|
134
|
+
assignedAgent: 'tester',
|
|
135
|
+
phase: 'verify',
|
|
136
|
+
acceptanceCriteria: [
|
|
137
|
+
`测试覆盖率 >= ${coverageTarget}%`,
|
|
138
|
+
'边界情况已测试',
|
|
139
|
+
'所有测试通过',
|
|
140
|
+
'测试报告已生成'
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else if (goalType === 'documentation') {
|
|
145
|
+
// 文档类目标: 直接创建单个文档任务
|
|
146
|
+
const taskId = this.generateTaskId();
|
|
147
|
+
breakdowns.push({
|
|
148
|
+
taskId,
|
|
149
|
+
title: goal,
|
|
150
|
+
description: `## 文档目标\n${goal}\n\n${globalContext}\n\n## 输出要求\n- 文档内容完整\n- 格式清晰\n- 示例代码可运行`,
|
|
151
|
+
priority: this.determinePriority(i),
|
|
152
|
+
dependencies: deps,
|
|
153
|
+
estimatedComplexity: 'low',
|
|
154
|
+
assignedAgent: 'executor',
|
|
155
|
+
phase: 'accept',
|
|
156
|
+
acceptanceCriteria: [
|
|
157
|
+
'文档内容完整',
|
|
158
|
+
'格式规范',
|
|
159
|
+
'示例可运行'
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
// 其他类型(配置、优化等): 单个任务
|
|
165
|
+
const taskId = this.generateTaskId();
|
|
166
|
+
breakdowns.push({
|
|
167
|
+
taskId,
|
|
168
|
+
title: goal,
|
|
169
|
+
description: `## 目标\n${goal}\n\n${globalContext}\n\n## 输出要求\n- 完成目标\n- 验证结果正确`,
|
|
170
|
+
priority: this.determinePriority(i),
|
|
171
|
+
dependencies: deps,
|
|
172
|
+
estimatedComplexity: this.estimateComplexity(goal),
|
|
173
|
+
assignedAgent: 'coder',
|
|
174
|
+
phase: 'develop',
|
|
175
|
+
acceptanceCriteria: [
|
|
176
|
+
`目标 "${goal}" 已完成`,
|
|
177
|
+
'结果已验证'
|
|
178
|
+
]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
122
181
|
}
|
|
123
182
|
// 2. 系统集成任务 (将所有模块组装到入口文件)
|
|
124
183
|
let integrationTaskId;
|
|
@@ -524,5 +583,48 @@ ${typeConfig.runCommand}
|
|
|
524
583
|
return 'low';
|
|
525
584
|
return 'medium';
|
|
526
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* 分类目标类型
|
|
588
|
+
* - development: 需要编写代码的功能实现 → 拆分为实现+测试对
|
|
589
|
+
* - testing: 已明确是测试任务 → 单个测试任务
|
|
590
|
+
* - documentation: 文档编写 → 单个文档任务
|
|
591
|
+
* - other: 其他类型(配置、优化、部署等) → 单个任务
|
|
592
|
+
*/
|
|
593
|
+
classifyGoal(goal) {
|
|
594
|
+
const g = goal.toLowerCase();
|
|
595
|
+
// 测试类关键词
|
|
596
|
+
const testKeywords = [
|
|
597
|
+
'测试', 'test', 'testing', 'tdd', 'e2e', 'e2e测试',
|
|
598
|
+
'单元测试', '集成测试', '端到端', '覆盖率', 'coverage',
|
|
599
|
+
'vitest', 'jest', 'mocha', 'playwright', 'cypress',
|
|
600
|
+
];
|
|
601
|
+
if (testKeywords.some(kw => g.includes(kw))) {
|
|
602
|
+
return 'testing';
|
|
603
|
+
}
|
|
604
|
+
// 文档类关键词
|
|
605
|
+
const docKeywords = [
|
|
606
|
+
'文档', 'document', 'documentation', 'readme', '说明',
|
|
607
|
+
'指南', 'guide', 'tutorial', 'api文档',
|
|
608
|
+
];
|
|
609
|
+
if (docKeywords.some(kw => g.includes(kw))) {
|
|
610
|
+
return 'documentation';
|
|
611
|
+
}
|
|
612
|
+
// 非开发类关键词(配置、部署等)
|
|
613
|
+
const nonDevKeywords = [
|
|
614
|
+
'配置', 'config', 'deploy', '部署', 'ci/cd', '发布',
|
|
615
|
+
'release', '优化', '监控', 'monitor', '日志',
|
|
616
|
+
];
|
|
617
|
+
// 如果只包含非开发关键词而不包含开发关键词,归为 other
|
|
618
|
+
const devKeywords = [
|
|
619
|
+
'实现', '开发', '编写', '创建', '构建', '添加', '修复',
|
|
620
|
+
'implement', 'develop', 'build', 'create', 'add', 'fix',
|
|
621
|
+
'功能', 'feature', '模块', '组件', 'component', '系统',
|
|
622
|
+
];
|
|
623
|
+
if (nonDevKeywords.some(kw => g.includes(kw)) && !devKeywords.some(kw => g.includes(kw))) {
|
|
624
|
+
return 'other';
|
|
625
|
+
}
|
|
626
|
+
// 默认为开发类
|
|
627
|
+
return 'development';
|
|
628
|
+
}
|
|
527
629
|
}
|
|
528
630
|
exports.TaskPlanner = TaskPlanner;
|