openmatrix 0.1.25 → 0.1.26
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.
|
@@ -259,47 +259,47 @@ class SmartQuestionAnalyzer {
|
|
|
259
259
|
* 检测复杂度
|
|
260
260
|
*/
|
|
261
261
|
detectComplexity(desc, taskType, scope) {
|
|
262
|
-
//
|
|
263
|
-
const simpleKeywords = /(fix|bug
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const complexKeywords = /(系统|架构|模块|集成|完整|从零|重构|优化整体)/i;
|
|
262
|
+
// 简单任务关键词
|
|
263
|
+
const simpleKeywords = /(fix|bug|修复|改|调整|样式|变量名|文案|按钮|颜色|字体)/i;
|
|
264
|
+
// 复杂任务关键词 - 需要更精确
|
|
265
|
+
const complexKeywords = /(系统|架构|集成|完整|从零|优化整体|多模块|全栈)/i;
|
|
267
266
|
const multiScope = scope.areas.length >= 3;
|
|
268
|
-
// Bug
|
|
267
|
+
// Bug 修复
|
|
269
268
|
if (taskType.type === 'bugfix') {
|
|
270
|
-
if (simpleKeywords.test(desc) ||
|
|
269
|
+
if (simpleKeywords.test(desc) || desc.length < 50) {
|
|
271
270
|
return { level: 'simple', label: '简单', estimatedCommits: '预计 1 个 commit' };
|
|
272
271
|
}
|
|
273
272
|
return { level: 'medium', label: '中等', estimatedCommits: '预计 1-2 个 commit' };
|
|
274
273
|
}
|
|
275
|
-
//
|
|
274
|
+
// 文档、配置
|
|
276
275
|
if (taskType.type === 'docs' || taskType.type === 'config') {
|
|
277
276
|
return { level: 'simple', label: '简单', estimatedCommits: '预计 1 个 commit' };
|
|
278
277
|
}
|
|
279
|
-
//
|
|
278
|
+
// 测试
|
|
280
279
|
if (taskType.type === 'test') {
|
|
281
280
|
if (multiScope) {
|
|
282
281
|
return { level: 'medium', label: '中等', estimatedCommits: '预计 2-3 个 commit' };
|
|
283
282
|
}
|
|
284
283
|
return { level: 'simple', label: '简单', estimatedCommits: '预计 1 个 commit' };
|
|
285
284
|
}
|
|
286
|
-
//
|
|
285
|
+
// 复杂关键词检测
|
|
287
286
|
if (complexKeywords.test(desc) || multiScope) {
|
|
288
287
|
return { level: 'complex', label: '复杂', estimatedCommits: '预计 3+ 个 commit' };
|
|
289
288
|
}
|
|
290
|
-
// 新功能
|
|
289
|
+
// 新功能 - 默认 medium
|
|
291
290
|
if (taskType.type === 'feature') {
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
// 只有非常简单的单文件修改才判断为 simple
|
|
292
|
+
if (desc.length < 20 && scope.areas.length === 1 && /(按钮|链接|文案|颜色)/.test(desc)) {
|
|
293
|
+
return { level: 'simple', label: '简单', estimatedCommits: '预计 1 个 commit' };
|
|
294
294
|
}
|
|
295
295
|
if (desc.length > 100 || scope.areas.length >= 2) {
|
|
296
296
|
return { level: 'medium', label: '中等', estimatedCommits: '预计 2-3 个 commit' };
|
|
297
297
|
}
|
|
298
298
|
return { level: 'medium', label: '中等', estimatedCommits: '预计 2-3 个 commit' };
|
|
299
299
|
}
|
|
300
|
-
// 重构
|
|
300
|
+
// 重构 - 默认 medium
|
|
301
301
|
if (taskType.type === 'refactor') {
|
|
302
|
-
if (multiScope) {
|
|
302
|
+
if (multiScope || /(整体|全部|系统)/.test(desc)) {
|
|
303
303
|
return { level: 'complex', label: '复杂', estimatedCommits: '预计 3+ 个 commit' };
|
|
304
304
|
}
|
|
305
305
|
return { level: 'medium', label: '中等', estimatedCommits: '预计 2-3 个 commit' };
|
|
@@ -312,6 +312,10 @@ class SmartQuestionAnalyzer {
|
|
|
312
312
|
*/
|
|
313
313
|
generateSuggestions(taskType, complexity, desc) {
|
|
314
314
|
const suggestions = [];
|
|
315
|
+
// 复杂任务优先建议头脑风暴
|
|
316
|
+
if (complexity.level === 'complex') {
|
|
317
|
+
suggestions.push('建议先头脑风暴,明确需求');
|
|
318
|
+
}
|
|
315
319
|
// 根据任务类型建议
|
|
316
320
|
switch (taskType.type) {
|
|
317
321
|
case 'bugfix':
|
|
@@ -320,7 +324,6 @@ class SmartQuestionAnalyzer {
|
|
|
320
324
|
break;
|
|
321
325
|
case 'feature':
|
|
322
326
|
if (complexity.level === 'complex') {
|
|
323
|
-
suggestions.push('建议先头脑风暴,明确需求');
|
|
324
327
|
suggestions.push('使用 strict 模式保证质量');
|
|
325
328
|
}
|
|
326
329
|
else {
|
|
@@ -343,7 +346,13 @@ class SmartQuestionAnalyzer {
|
|
|
343
346
|
suggestions.push('使用 fast 模式');
|
|
344
347
|
break;
|
|
345
348
|
default:
|
|
346
|
-
|
|
349
|
+
if (complexity.level !== 'complex') {
|
|
350
|
+
suggestions.push('根据实际情况选择模式');
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// 确保至少有一个建议
|
|
354
|
+
if (suggestions.length === 0) {
|
|
355
|
+
suggestions.push('建议先确认任务需求');
|
|
347
356
|
}
|
|
348
357
|
return suggestions;
|
|
349
358
|
}
|