Skip to main content
Glama

genchangelog

Generate CHANGELOG.md files from commit history by specifying version numbers and commit ranges to document project changes.

Instructions

【生成 Changelog】根据 commit 历史生成 CHANGELOG.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
versionNo版本号(如:v1.2.0)
fromNo起始 commit/tag
toNo结束 commit/tag(默认 HEAD)

Implementation Reference

  • The core handler function for the 'genchangelog' tool. It takes arguments like version, from, to, constructs a detailed markdown prompt instructing how to generate a CHANGELOG.md file based on git commit history, following Keep a Changelog format and semantic versioning.
    export async function genchangelog(args: any) { try { const version = args?.version || ""; const from = args?.from || ""; const to = args?.to || "HEAD"; const message = `请生成项目的 CHANGELOG(变更日志): 📝 **版本信息**: ${version || "请提供版本号(如:v1.2.0)"} 📋 **Commit 范围**: 从 ${from || "上一个 tag"} 到 ${to} --- ## Changelog 生成步骤 ### 第一步:获取 Commit 历史 执行以下命令: \`\`\`bash # 查看 commit 历史 git log ${from}..${to} --oneline --no-merges # 查看详细信息 git log ${from}..${to} --pretty=format:"%h - %s (%an)" --no-merges # 查看所有 tags git tag -l # 查看贡献者 git shortlog ${from}..${to} -sn \`\`\` ### 第二步:分类 Commits 按类型分组: - **✨ Features (feat)**:新功能 - **🐛 Bug Fixes (fix)**:Bug 修复 - **📝 Documentation (docs)**:文档变更 - **💄 Styles (style)**:代码格式 - **♻️ Refactoring (refactor)**:重构 - **⚡ Performance (perf)**:性能优化 - **✅ Tests (test)**:测试相关 - **🔧 Chores (chore)**:构建/工具变更 - **💥 BREAKING CHANGES**:破坏性变更 ### 第三步:生成 Changelog **格式标准**:[Keep a Changelog](https://keepachangelog.com/) \`\`\`markdown # Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [版本号] - YYYY-MM-DD ### Added(新增) - 新功能 1 (#PR号) - 新功能 2 by @contributor ### Changed(变更) - 修改的功能 1 - 修改的功能 2 ### Deprecated(废弃) - 即将移除的功能 ### Removed(移除) - 已移除的功能 ### Fixed(修复) - Bug 修复 1 (#issue号) - Bug 修复 2 ### Security(安全) - 安全漏洞修复 ## [上一个版本] - YYYY-MM-DD ... \`\`\` --- ## Changelog 模板 \`\`\`markdown # Changelog ## [${version || "1.2.0"}] - ${new Date().toISOString().split('T')[0]} ### ✨ Added - 新增用户认证功能 (#123) [@contributor1] - 新增数据导出功能 (#125) - 新增邮件通知系统 ### 🔄 Changed - 优化数据库查询性能 (#130) - 更新 UI 设计风格 - 升级依赖包到最新版本 ### 🗑️ Deprecated - \`oldAPI()\` 方法即将在 v2.0 中移除,请使用 \`newAPI()\` ### ❌ Removed - 移除了废弃的 \`legacyFeature\` - 删除了未使用的配置项 ### 🐛 Fixed - 修复登录页面样式错误 (#128) - 修复数据分页显示问题 (#132) - 修复内存泄漏问题 (#135) ### 🔒 Security - 修复 SQL 注入漏洞 (CVE-2024-XXXX) - 更新依赖以修复安全漏洞 ### 💥 BREAKING CHANGES - API 端点从 \`/api/v1/users\` 改为 \`/api/v2/users\` - 配置文件格式从 JSON 改为 YAML - 最低 Node.js 版本要求提升到 18.x ### 📚 Documentation - 更新 README 文档 - 添加 API 使用指南 - 完善贡献指南 ### 🏗️ Infrastructure - 升级 CI/CD 流程 - 添加 Docker 支持 - 配置自动化测试 ### 👥 Contributors 感谢以下贡献者: - @contributor1 - 3 commits - @contributor2 - 2 commits - @contributor3 - 1 commit **Full Changelog**: https://github.com/owner/repo/compare/v1.1.0...v${version || "1.2.0"} \`\`\` --- ## Changelog 最佳实践 ### 内容要求 1. **明确说明变更** - 用户能理解的语言(避免技术术语) - 说明影响范围 - 提供迁移指南(破坏性变更) 2. **链接相关 Issue/PR** - 使用 (#123) 格式 - 方便追溯详细信息 3. **归功贡献者** - 使用 @username 格式 - 体现团队协作 ### 版本规范 **语义化版本 (Semantic Versioning)**: - **Major (X.0.0)**:破坏性变更 - **Minor (x.X.0)**:新功能(向后兼容) - **Patch (x.x.X)**:Bug 修复 ### 发布流程 1. 更新 CHANGELOG.md 2. 更新 package.json 版本号 3. 创建 Git tag:\`git tag -a v1.2.0 -m "Release v1.2.0"\` 4. 推送 tag:\`git push origin v1.2.0\` 5. 发布 GitHub Release --- ## 自动化工具 **推荐工具**: - **standard-version**:自动生成 changelog - **conventional-changelog**:基于 commit 生成 - **semantic-release**:自动发布版本 **使用示例**: \`\`\`bash # 安装 npm install -D standard-version # 生成 changelog npx standard-version # 首次发布 npx standard-version --first-release \`\`\` --- 现在请根据 commit 历史生成详细的 CHANGELOG.md 文件。`; return { content: [ { type: "text", text: message, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `❌ 生成 Changelog 失败: ${errorMessage}`, }, ], isError: true, }; } }
  • The input schema definition for the genchangelog tool, specifying optional parameters: version, from, and to commit/tag.
    name: "genchangelog", description: "【生成 Changelog】根据 commit 历史生成 CHANGELOG.md", inputSchema: { type: "object", properties: { version: { type: "string", description: "版本号(如:v1.2.0)", }, from: { type: "string", description: "起始 commit/tag", }, to: { type: "string", description: "结束 commit/tag(默认 HEAD)", }, }, required: [], }, }, {
  • src/index.ts:492-494 (registration)
    Registration in the main switch statement that dispatches tool calls to the genchangelog handler.
    case "genchangelog": return await genchangelog(args);
  • src/index.ts:13-13 (registration)
    Import of the genchangelog function from tools/index.js for use in the MCP server.
    codeReview, gentest, genpr, checkDeps, gendoc, genchangelog, refactor, perf,
  • Re-export of genchangelog from its implementation file in tools index.
    export { genchangelog } from "./genchangelog.js";

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mybolide/mcp-probe-kit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server