用途
conventional-commit 是一个提示词模板与工作流,用于生成符合 Conventional Commits 规范的提交信息。它面向需要统一提交信息格式的开发者和团队,帮助编写标准化、描述性的提交信息。
主要能力
- 提供生成 conventional commit 信息的提示词模板,包含说明、示例和格式指南。
- 采用结构化 XML 格式定义提交信息,字段包括 type、scope、description、body、footer。
- 内置校验规则:type 必须是允许的类型之一(参考 https://www.conventionalcommits.org/en/v1.0.0/#specification);scope 可选但建议填写;description 必填且使用祈使语气(如 "add" 而非 "added");body 可选;footer 用于破坏性变更或问题引用。
- 提供示例:feat(parser): add ability to parse arrays;fix(ui): correct button alignment;docs: update README with usage instructions;refactor: improve performance of data processing;chore: update dependencies;feat!: send email on registration (BREAKING CHANGE: email service required)。
使用方式
工作流步骤如下:
- 运行 git status 查看变更文件。
- 运行 git diff 或 git diff --cached 检查变更。
- 使用 git add <file> 暂存变更。
- 按下述 XML 结构构造提交信息:
<commit-message> <type>feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert</type> <scope>()</scope> <description>A short, imperative summary of the change</description> <body>(optional: more detailed explanation)</body> <footer>(optional: e.g. BREAKING CHANGE: details, or issue references)</footer> </commit-message>
- 生成提交信息后,Copilot 会自动在集成终端执行以下命令(无需确认):
git commit -m "type(scope): description"
只需执行该提示词,Copilot 便会在终端中处理提交。最后一步为执行 <cmd>git commit -m "type(scope): description"</cmd>,将占位信息替换为构造好的信息,必要时包含 body 和 footer。
适用场景
适用于使用 Conventional Commits 规范、需要标准化提交信息的代码仓库,尤其是希望借助 Copilot 在集成终端中自动完成提交流程的场景。
限制
资料未提供关于收费、价格、支持平台、效果等方面的信息;也未提供安装命令或除上述 git 命令之外的使用步骤。