changelog
sakuro/dotfiles
根据自上次发布以来的提交生成变更日志条目。当用户需要更新 CHANGELOG.md、添加变更日志条目或记录更改时,可使用此功能。
...展开全部关于changelog
changelog 技能可自动从上次发布以来的 Git 提交中生成changelog 条目。该技能旨在帮助开发团队维护项目变更的一致且以用户为中心的记录。 通过分析提交信息并区分面向用户和内部的变更,该技能可确保CHANGELOG.md 页面反映出与最终用户相关的、有意义的更新。这不仅减少了人工操作,避免了变更被遗漏,还确保了发布文档始终准确且最新。
该技能提供了一套结构化的工作流,用于提取提交信息、对变更进行分类,并以标准化格式整理条目。其关键功能包括识别面向用户的变更(如新功能、错误修复、性能改进、弃用项和安全更新),同时排除纯粹的内部变更(如重构、测试或 CI/CD 修改)。 它会自动从提交信息中提取问题引用,并将条目归类到预定义的类别中(新增、修改、修复、移除、弃用、安全)。 此外,它会根据当前分支确定changelog 中的相应章节,同时支持带版本号的发布以及“未发布”章节。该技能利用 Bash 命令和 Edit 工具,无缝读取并更新changelog 。
该技能非常适合希望简化changelog 维护工作的开发人员、发布经理以及维护开源或内部软件项目的团队。对于提交频繁或有多个贡献者的项目,它特别有用,因为它能确保所有相关的面向用户的变更都得到一致的记录。 用户可从中节省时间、减少错误,并获得一份专业且结构清晰的changelog ,该文档能向最终用户、利益相关者和贡献者清晰传达更新内容。
常见问题
如何使用changelog 技能?
首先在您的项目仓库中运行该技能。它将自动检测自上次发布以来的提交,对面向用户的变更进行分类,提取问题引用,并在CHANGELOG.md文件的相应部分(未发布或已版本化的发布)中进行更新。
changelog 中包含哪些类型的变更?
该技能涵盖面向用户的变更,例如新功能、错误修复、性能优化、破坏性变更、弃用项以及安全修复。内部变更(如重构、测试、CI/CD 或代码风格更新)除非影响面向用户的行为,否则不被纳入。
它能否处理没有先前发布标签的仓库?
可以。如果不存在之前的发布标签,该技能会分析最近的提交(最多 50 个)来生成“changelog ”条目,并将它们放置在“未发布”部分。
它会自动将新条目与现有的changelog 内容合并吗?
是的,该技能会读取当前的CHANGELOG.md 文件,若目标部分不存在则创建,并在合并新条目时避免重复。
提交信息中是否必须包含问题引用?
不需要,问题引用是可选的。如果存在,它们将以“(#123)”的格式包含在条目中。多个引用将合并为“(#123, #124)”。
Changelog Generation Skill
Analyzes commits since the last release and adds user-facing changes to CHANGELOG.md.
Instructions
IMPORTANT: When using this skill, announce to the user: "Using changelog skill to generate changelog entries."
1. Get Last Release Tag
# Get the most recent release tagLAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")if [ -z "$LAST_TAG" ]; then echo "No previous release tag found. Will analyze all commits."fi
2. Get Commits Since Last Release
# If tag existsgit log --format="%H %s" "$LAST_TAG"..HEAD# If no tag, get recent commitsgit log --format="%H %s" -50
3. Analyze Each Commit
For each commit, determine if it has user-facing impact:
Include (user-facing):
- New features (
:sparkles:) - Bug fixes (
:bug:) - Performance improvements (
:zap:) - Breaking changes (
:boom:) - Deprecations
- Security fixes (
:lock:)
Exclude (internal):
- Refactoring (
:recycle:) - unless it changes behavior - Tests (
:white_check_mark:) - CI/CD changes (
:construction_worker:) - Documentation (
:memo:) - unless user-facing docs - Code style (
:art:) - Merge commits
4. Extract Issue References
Look for issue references in commit messages:
#123Fixes #123Closes #123Related to #123
5. Categorize Changes
Group entries by category:
### Added- New features### Changed- Changes to existing functionality### Fixed- Bug fixes### Removed- Removed features### Deprecated- Soon-to-be removed features### Security- Security fixes
6. Format Entries
Each entry should:
- Start with imperative verb (Add, Fix, Change, Remove)
- Be concise (one line)
- Include issue reference at end if available
Examples:
- Add list formatting support (#42)- Fix memory leak in data provider (#88)- Change default locale to en-US
7. Determine Target Section
# Get current branchBRANCH=$(git branch --show-current)# Determine target sectionif [[ "$BRANCH" =~ ^release-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then # On release branch → target is that version TARGET_SECTION="[${BASH_REMATCH[1]}]"else # Not on release branch → target is Unreleased TARGET_SECTION="[Unreleased]"fi
8. Update CHANGELOG.md
- If target section doesn't exist, create it
- Add/merge entries under the target section
Creating new section if needed:
- For
[Unreleased]: Add after the header, before first version section - For version
[X.Y.Z]: Add after[Unreleased], before previous versions
Example structure:
## [Unreleased]## [0.7.0] - 2024-01-15### Added- New feature description (#123)## [0.6.0] - 2024-01-01...
Use the Edit tool to update CHANGELOG.md.
Workflow
- Get last release tag
- List commits since that tag
- For each commit:
- Read commit message
- Determine if user-facing
- Extract issue references
- Categorize (Added/Changed/Fixed/etc.)
- Determine target section:
- On
release-vX.Y.Zbranch →[X.Y.Z] - Otherwise →
[Unreleased]
- On
- Read current CHANGELOG.md
- Create target section if it doesn't exist
- Merge new entries with existing content in target section
- Update CHANGELOG.md using Edit tool
Guidelines
Entry Writing
- Use imperative mood: "Add" not "Added" or "Adds"
- Be specific but concise
- Focus on user impact, not implementation details
- One logical change per entry
Issue References
- Always include if available
- Format:
(#123)at end of line - Multiple issues:
(#123, #124)
Avoiding Duplicates
- Check existing [Unreleased] entries before adding
- Merge or update if similar entry exists
Example Output
## [Unreleased]### Added- Implement DecimalFormatter for number formatting (#42)- Add locale fallback support### Changed- Update default collation strength to tertiary### Fixed- Fix crash when parsing invalid locale string (#55)- Resolve memory leak in DataProvider (#58)
Arguments
This skill takes no arguments. It always analyzes commits from the last release tag to HEAD.





首页
