commitlint.config.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { defineConfig } from 'cz-git'
  2. export default defineConfig({
  3. prompt: {
  4. messages: {
  5. type: '选择你要提交的类型 :',
  6. scope: '选择一个提交范围(可选):',
  7. customScope: '请输入自定义的提交范围 :',
  8. subject: '填写简短精炼的变更描述 :\n',
  9. body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
  10. breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
  11. footerPrefixesSelect: '选择关联issue前缀(可选):',
  12. customFooterPrefix: '输入自定义issue前缀 :',
  13. footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',
  14. confirmCommit: '是否提交或修改commit ?'
  15. },
  16. types: [
  17. { value: 'feat', name: 'feat: ✨ 新增功能 | A new feature', emoji: ':sparkles:' },
  18. { value: 'fix', name: 'fix: 🐛 修复缺陷 | A bug fix', emoji: ':bug:' },
  19. {
  20. value: 'docs',
  21. name: 'docs: 📝 文档更新 | Documentation only changes',
  22. emoji: ':memo:'
  23. },
  24. {
  25. value: 'style',
  26. name: 'style: 💄 代码格式 | Changes that do not affect the meaning of the code',
  27. emoji: ':lipstick:'
  28. },
  29. {
  30. value: 'refactor',
  31. name: 'refactor: ♻️ 代码重构 | A code change that neither fixes a bug nor adds a feature',
  32. emoji: ':recycle:'
  33. },
  34. {
  35. value: 'perf',
  36. name: 'perf: ⚡️ 性能提升 | A code change that improves performance',
  37. emoji: ':zap:'
  38. },
  39. {
  40. value: 'test',
  41. name: 'test: ✅ 测试相关 | Adding missing tests or correcting existing tests',
  42. emoji: ':white_check_mark:'
  43. },
  44. {
  45. value: 'build',
  46. name: 'build: 📦️ 构建相关 | Changes that affect the build system or external dependencies',
  47. emoji: ':package:'
  48. },
  49. {
  50. value: 'ci',
  51. name: 'ci: 🎡 持续集成 | Changes to our CI configuration files and scripts',
  52. emoji: ':ferris_wheel:'
  53. },
  54. { value: 'revert', name: 'revert: ⏪️ 回退代码 | Revert to a commit', emoji: ':rewind:' },
  55. {
  56. value: 'chore',
  57. name: 'chore: 🔨 其他修改 | Other changes that do not modify src or test files',
  58. emoji: ':hammer:'
  59. }
  60. ],
  61. useEmoji: true,
  62. emojiAlign: 'center',
  63. useAI: false,
  64. aiNumber: 3,
  65. aiModel: 'gpt-5.6-luna',
  66. aiQuestionCB: ({ maxSubjectLength, diff }) =>
  67. `用完整句子为以下 Git diff 代码写一个有见解并简洁的 Git 中文提交消息,不加任何前缀,并且内容不能超过 ${maxSubjectLength} 个字符: \`\`\`diff\n${diff}\n\`\`\``,
  68. themeColorCode: '',
  69. scopes: [],
  70. allowCustomScopes: true,
  71. allowEmptyScopes: true,
  72. customScopesAlign: 'bottom',
  73. customScopesAlias: 'custom | 以上都不是?我要自定义',
  74. emptyScopesAlias: 'empty | 跳过',
  75. upperCaseSubject: null,
  76. markBreakingChangeMode: true,
  77. allowBreakingChanges: ['feat', 'fix'],
  78. breaklineNumber: 100,
  79. breaklineChar: '|',
  80. skipQuestions: [],
  81. issuePrefixes: [
  82. // 如果使用 gitee 作为开发管理
  83. { value: 'link', name: 'link: 链接 ISSUES 进行中' },
  84. { value: 'closed', name: 'closed: 标记 ISSUES 已完成' }
  85. ],
  86. customIssuePrefixAlign: 'top',
  87. emptyIssuePrefixAlias: 'skip | 跳过',
  88. customIssuePrefixAlias: 'custom | 自定义前缀',
  89. allowCustomIssuePrefix: true,
  90. allowEmptyIssuePrefix: true,
  91. confirmColorize: true,
  92. scopeOverrides: undefined,
  93. defaultBody: '',
  94. defaultIssues: '',
  95. defaultScope: '',
  96. defaultSubject: ''
  97. }
  98. })