* 格式化提交消息 * @param {string} message * @returns {string}
(message)
| 707 | * @returns {string} |
| 708 | */ |
| 709 | static formatCommitMessage(message) { |
| 710 | // 移除常见的提交前缀 |
| 711 | const prefixPattern = /^(feat|fix|perf|refactor|docs|style|test|chore|build|ci)(\([^)]*\))?:\s*/i; |
| 712 | let formatted = message.replace(prefixPattern, ''); |
| 713 | |
| 714 | // 确保首字母大写 |
| 715 | if (formatted.length > 0) { |
| 716 | formatted = formatted.charAt(0).toUpperCase() + formatted.slice(1); |
| 717 | } |
| 718 | |
| 719 | return formatted; |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | /** |