changelog-composer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseChangelog Composer
变更日志生成器
Transforms raw git history and PR descriptions into polished, audience-appropriate
changelogs. Parses conventional commits, classifies changes by impact category, filters
internal-only modifications, and produces structured release notes with PR links —
following Keep a Changelog conventions.
将原始git历史和PR描述转换为打磨完善、适配目标受众的变更日志,支持解析conventional commits、按影响类别对变更分类、过滤仅内部改动,并生成带PR链接的结构化发布说明,符合Keep a Changelog规范。
Reference Files
参考文件
| File | Contents | Load When |
|---|---|---|
| Commit type parsing, scope extraction, breaking change indicators | Repository uses conventional commits |
| Change classification logic, audience filtering, severity ordering | Always |
| User-facing vs internal change detection, exclusion patterns | Always |
| Keep a Changelog, GitHub Releases, announcement copy templates | Format selection needed |
| 文件 | 内容 | 加载时机 |
|---|---|---|
| 提交类型解析、范围提取、破坏性变更标识 | 仓库使用conventional commits时 |
| 变更分类逻辑、受众过滤、优先级排序 | 始终加载 |
| 用户可见/内部变更检测、排除规则 | 始终加载 |
| Keep a Changelog、GitHub Releases、公告文案模板 | 需要选择输出格式时 |
Prerequisites
前置要求
- git — access to the repository history
- gh (optional) — GitHub CLI for PR description extraction
- A tagging strategy (semver tags) for identifying release boundaries
- git — 可访问仓库历史
- gh(可选)— 用于提取PR描述的GitHub CLI
- 用于识别版本边界的标签策略(semver标签)
Workflow
工作流程
Phase 1: Gather Raw Changes
阶段1:收集原始变更
Collect all changes between the previous release and the current state:
- Identify boundaries — Find the last release tag: . If no tags exist, use the initial commit or a user-specified starting point.
git describe --tags --abbrev=0 - Extract commits —
git log <last-tag>..HEAD --oneline --no-merges - Extract PR titles — or parse merge commit messages.
gh pr list --state merged --base main --search "merged:>YYYY-MM-DD" - Parse conventional commits — If the repository follows conventional commits
(,
feat:,fix:, etc.), extract type, scope, and description. Seedocs:.references/conventional-commits.md - Collect breaking change indicators — Look for in commit bodies,
BREAKING CHANGE:after type (!), or explicit annotations in PR descriptions.feat!:
收集上一次发布到当前状态之间的所有变更:
- 确定版本边界 — 查找最新的发布标签:。如果不存在标签,使用初始提交或用户指定的起始点。
git describe --tags --abbrev=0 - 提取提交记录 —
git log <last-tag>..HEAD --oneline --no-merges - 提取PR标题 — ,或解析合并提交信息。
gh pr list --state merged --base main --search "merged:>YYYY-MM-DD" - 解析conventional commits — 如果仓库遵循conventional commits规范(、
feat:、fix:等),提取类型、范围和描述,详见docs:。references/conventional-commits.md - 收集破坏性变更标识 — 查找提交正文里的、类型后的
BREAKING CHANGE:(!),或PR描述里的明确标注。feat!:
Phase 2: Classify Changes
阶段2:变更分类
Categorize each change by its impact:
| Category | Conventional Commit Type | Indicators |
|---|---|---|
| Breaking Changes | | API removal, signature change, behavior change |
| Features | | New capability, new endpoint, new command |
| Fixes | | Bug correction, error handling improvement |
| Performance | | Speed improvement, memory reduction |
| Documentation | | README, API docs, guides |
| Internal | | No user-facing impact |
For repositories without conventional commits, classify by reading the commit message
and changed files. Code changes to public API → Feature or Fix. Test-only changes → Internal.
按影响对每个变更归类:
| 分类 | Conventional Commit类型 | 识别特征 |
|---|---|---|
| 破坏性变更 | | API移除、签名变更、行为逻辑变更 |
| 功能新增 | | 新增能力、新增接口、新增命令 |
| 问题修复 | | Bug修正、错误处理优化 |
| 性能优化 | | 速度提升、内存占用降低 |
| 文档更新 | | README、API文档、指南更新 |
| 内部变更 | | 无用户可见影响 |
对于不使用conventional commits的仓库,通过阅读提交信息和改动文件分类:公共API的代码改动归为功能新增或问题修复,仅测试相关改动归为内部变更。
Phase 3: Filter for Audience
阶段3:按受众过滤
-
Exclude internal changes by default:
- CI/CD configuration changes
- Test additions/modifications
- Dependency bumps (unless security-relevant)
- Code refactoring with no behavior change
- Build system changes
-
Include internal changes only when:
- They represent significant architecture shifts users should know about
- They affect development workflow (contributing guide changes)
- The changelog targets developers, not end-users
-
Highlight breaking changes prominently — always at the top, always with migration guidance.
-
默认排除内部变更:
- CI/CD配置改动
- 测试用例新增/修改
- 依赖升级(安全相关除外)
- 无行为变更的代码重构
- 构建系统改动
-
仅在以下场景包含内部变更:
- 涉及用户需要知晓的重大架构调整
- 影响开发工作流(贡献指南变更)
- 变更日志面向开发者而非终端用户
-
突出展示破坏性变更 — 始终放在最前面,附带迁移指引。
Phase 4: Compose Entries
阶段4:编写条目
For each included change, write a human-readable description:
- Lead with the impact — "Users can now..." or "Fixed issue where..."
- Be specific — "Reduced memory usage by 40% for large file processing" not "Performance improvements"
- Include migration guidance for breaking changes — what the user must change
- Link to source — PR number, issue number, or commit hash
为每个保留的变更编写人类可读的描述:
- 以用户影响开头 — 比如"用户现在可以..."或"修复了...的问题"
- 内容具体 — 比如"大文件处理场景内存占用降低40%"而非笼统的"性能优化"
- 为破坏性变更提供迁移指引 — 说明用户需要做的调整
- 关联来源 — PR编号、issue编号或提交哈希
Phase 5: Output
阶段5:输出
Assemble the changelog in the requested format, ordered by severity:
- Breaking Changes (always first)
- Features
- Fixes
- Performance
- Documentation
按严重程度排序,组装为要求格式的变更日志:
- 破坏性变更(始终排在最前)
- 功能新增
- 问题修复
- 性能优化
- 文档更新
Output Format
输出格式
text
undefinedtext
undefined[{version}] - {YYYY-MM-DD}
[{version}] - {YYYY-MM-DD}
Breaking Changes
Breaking Changes
- parameter renamed —
function_nameis nowold_param. Migration: find/replacenew_paramwithold_param=in all call sites. (#{pr})new_param=
- parameter renamed —
function_nameis nowold_param. Migration: find/replacenew_paramwithold_param=in all call sites. (#{pr})new_param=
Features
Features
- {Feature name} — {What it enables and why it matters}. (#{pr})
- {Feature name} — {What it enables and why it matters}. (#{pr})
Fixes
Fixes
- Fixed {symptom} when {condition}. (#{pr})
- Fixed {symptom} when {condition}. (#{pr})
Performance
Performance
- {Operation} is now {X}x faster / uses {X}% less memory. (#{pr})
- {Operation} is now {X}x faster / uses {X}% less memory. (#{pr})
Documentation
Documentation
- Added {guide/reference} for {topic}. (#{pr})
undefined- Added {guide/reference} for {topic}. (#{pr})
undefinedConfiguring Scope
配置范围
| Mode | Input | Output | When to Use |
|---|---|---|---|
| Tag-to-HEAD | Full changelog entry | Preparing a versioned release |
| Date range or commit range | Summary of changes | Sprint review, status update |
| Single PR | One-line changelog entry | PR description template |
| 模式 | 输入 | 输出 | 使用场景 |
|---|---|---|---|
| 标签到HEAD的范围 | 完整变更日志条目 | 准备版本化发布时 |
| 日期范围或提交范围 | 变更汇总 | 冲刺评审、状态同步时 |
| 单个PR | 单行变更日志条目 | PR描述模板填充 |
Calibration Rules
校准规则
- User impact first. Every entry should answer "what does this mean for the user?" not "what did the developer do?"
- Breaking changes are non-negotiable. Never omit or bury breaking changes. They go first, with migration guidance.
- Specific over vague. "Fixed login timeout on slow connections" beats "Fixed bug." "Added CSV export for reports" beats "New feature."
- Link everything. Every entry links to its source PR or issue. Users who want details can follow the link.
- Exclude noise. Internal refactoring, dependency bumps, and CI changes do not belong in user-facing changelogs unless they have user-visible impact.
- 用户影响优先 每个条目都应该回答"这对用户意味着什么",而非"开发者做了什么"。
- 破坏性变更不可省略 永远不要遗漏或隐藏破坏性变更,必须放在最前并附带迁移指引。
- 具体优于笼统 "修复了慢网络下的登录超时问题"远好于"修复了Bug","新增报表CSV导出能力"远好于"新增功能"。
- 所有条目关联来源 每个条目都要关联对应的源PR或issue,需要详情的用户可以点击链接查看。
- 排除无效噪音 内部重构、依赖升级、CI改动如果没有用户可见影响,不应出现在面向用户的变更日志中。
Error Handling
错误处理
| Problem | Resolution |
|---|---|
| No tags exist in repository | Ask for a starting commit or date. Default to the initial commit if the repository is small. |
| Repository doesn't use conventional commits | Classify by reading commit messages and changed files. Note reduced classification accuracy. |
| PR descriptions are empty or low-quality | Fall back to commit messages. Flag entries that may need manual review. |
| Ambiguous change classification | Default to "Features" for additions, "Fixes" for modifications. Mark uncertain entries for review. |
| Too many changes for a single release | Group by component/module. Consider whether the release should be split. |
| Merge commits obscure individual changes | Use |
| 问题 | 解决方案 |
|---|---|
| 仓库中不存在标签 | 询问用户起始提交或日期,小仓库默认使用初始提交。 |
| 仓库不使用conventional commits | 通过阅读提交信息和改动文件分类,标注分类准确度可能降低。 |
| PR描述为空或质量过低 | 回退到使用提交信息,标记可能需要人工审核的条目。 |
| 变更分类不明确 | 新增内容默认归为"功能新增",改动内容默认归为"问题修复",标记不确定的条目待审核。 |
| 单版本变更过多 | 按组件/模块分组,考虑是否需要拆分发布。 |
| 合并提交掩盖了单个变更 | 使用 |
When NOT to Compose
不适用场景
Push back if:
- The user wants to auto-publish release notes without review — changelogs require human judgment
- The repository has no meaningful commit history (single "initial commit" with everything)
- The request is for marketing copy, not technical release notes — different skill
- The changes are not yet merged — changelog is for shipped changes, not in-progress work
出现以下情况时拒绝生成:
- 用户想要不经审核自动发布发布说明 — 变更日志需要人工判断
- 仓库无有效提交历史(只有一个包含所有内容的"初始提交")
- 请求是为了生成营销文案而非技术发布说明 — 属于其他技能范畴
- 变更还未合并 — 变更日志针对已发布的改动,而非进行中的工作