* 分类单个提交 * @param {Object} commit * @param {Object} structure
(commit, structure)
| 613 | * @param {Object} structure |
| 614 | */ |
| 615 | static categorizeCommit(commit, structure) { |
| 616 | if (!commit || !commit.message) return; |
| 617 | |
| 618 | const msg = commit.message.toLowerCase(); |
| 619 | const originalMsg = commit.message; |
| 620 | structure.stats.totalCommits++; |
| 621 | |
| 622 | // 核心/本体更新模式 |
| 623 | const corePatterns = [ |
| 624 | /^feat\(core\)/i, |
| 625 | /^fix\(core\)/i, |
| 626 | /本体/, |
| 627 | /核心框架/, |
| 628 | /主程序/, |
| 629 | /\bcore\b/i, |
| 630 | /\bframework\b/i |
| 631 | ]; |
| 632 | |
| 633 | // 插件模式(改进的识别算法) |
| 634 | const pluginPatterns = [ |
| 635 | /^feat\(([^)]+)\):/i, |
| 636 | /^fix\(([^)]+)\):/i, |
| 637 | /^perf\(([^)]+)\):/i, |
| 638 | /^refactor\(([^)]+)\):/i, |
| 639 | /插件[::]/, |
| 640 | /\[([^\]]+)\]/, |
| 641 | // 常见插件名称模式 |
| 642 | /\b(sure|eatgif?|eat|gpt|gemini|acron|aban|dbdj|music|help|debug|sudo|re|ping|shift|bf|npm|tpm)\b[::]/i, |
| 643 | /\b(sure|eatgif?|eat|gpt|gemini|acron|aban|dbdj|music|help|debug|sudo|re|ping|shift|bf|npm|tpm)\s+[使使用修复优化新增]/i |
| 644 | ]; |
| 645 | |
| 646 | // 检查是否为核心更新 |
| 647 | if (corePatterns.some(pattern => pattern.test(msg))) { |
| 648 | structure.core.push(this.formatCommitMessage(originalMsg)); |
| 649 | structure.stats.coreCommits++; |
| 650 | return; |
| 651 | } |
| 652 | |
| 653 | // 检查是否为插件更新 |
| 654 | for (const pattern of pluginPatterns) { |
| 655 | const match = originalMsg.match(pattern); |
| 656 | if (match) { |
| 657 | let pluginName = match[1] || match[0]; // 获取匹配的插件名 |
| 658 | |
| 659 | // 清理插件名称 |
| 660 | pluginName = pluginName |
| 661 | .replace(/^(feat|fix|perf|refactor)\(|\):|[::].*$/gi, '') |
| 662 | .replace(/\s+(使用|修复|优化|新增).*$/i, '') |
| 663 | .trim() |
| 664 | .toLowerCase(); |
| 665 | |
| 666 | // 检查是否为通用插件更新 |
| 667 | if (pluginName === 'plugins' || pluginName === '插件系统' || pluginName === 'plugin') { |
| 668 | structure.plugins.general.push(this.formatCommitMessage(originalMsg)); |
| 669 | } else if (pluginName) { |
| 670 | // 特定插件更新 |
| 671 | if (!structure.plugins.specific[pluginName]) { |
| 672 | structure.plugins.specific[pluginName] = []; |
no test coverage detected