From code-pilot
Generates and appends versioned entries to CHANGELOG.md from Git commits and staged changes, auto-classifying into Added/Changed/Fixed/etc. per Keep a Changelog. Uses <version> or today's date.
How this command is triggered — by the user, by Claude, or both
Slash command
/code-pilot:changelog <version>cc/This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# 管理项目变更日志 此命令用于向项目的 CHANGELOG.md 文件添加新条目,自动管理版本章节和变更分类。 ## 用法 ### 参数说明 - `<version>` (可选): 版本号,如 `1.2.0`、`v2.0.0-beta.1` - 未指定时自动使用格式:`YYYY-MM-DD` (如 2025-09-01), 调用 `get-current-datetime` 子智能体获取当前时间 - 支持语义化版本:主版本.次版本.修订版本 - 支持预发布版本:`alpha`、`beta`、`rc` 等 - **重要**:如果版本已存在,将添加新的变更条目到该版本;如果不存在,创建新版本章节 ### 重要约束 - **数据源要求**:基于Git记录(包括提交历史和暂存区),绝不依赖会话上下文 - 支持已提交的变更(git log) - 支持暂存区的变更(git diff --cached) - 暂存区变更会智能过滤中间状态 - **版本范围限制**:当未指定版本号时(使用日期格式),变更日志只记录**当天的实际代码操作** - 不包含:昨天及之前git提交记录、之前的版本变更 - 原则:今天的日志只反映今天的工作 - **智能去重**:多次执行changelog时,会过滤中间状态的变更 - 如果某个功能先添加后删除,则不记...
此命令用于向项目的 CHANGELOG.md 文件添加新条目,自动管理版本章节和变更分类。
/changelog # 自动使用今日日期作为版本
/changelog <version> # 使用指定版本号
<version> (可选): 版本号,如 1.2.0、v2.0.0-beta.1
YYYY-MM-DD (如 2025-09-01), 调用 get-current-datetime 子智能体获取当前时间alpha、beta、rc 等此命令将执行以下操作:
Git 数据收集:首先从 Git 获取所有必要的变更信息
文件检查:检查 CHANGELOG.md 文件是否存在
版本管理:
智能合并:
格式化:根据 Keep a Changelog 约定格式化条目
自动分类:根据变更内容自动归类到相应类型
CHANGELOG 严格遵循 Keep a Changelog 格式规范。
根据 Keep a Changelog 规范,支持以下变更类型:
# 第一次:添加新功能到暂存区
git add feature.js
/changelog
# 记录:Added - 新增 feature.js 功能模块
# 第二次:删除该功能
git rm --cached feature.js
/changelog
# 智能过滤:不记录任何变更(因为功能被添加后又删除)
# 第三次:修改已有文件
git add config.js
/changelog
# 记录:Changed - 更新配置文件设置
# 使用今日日期创建或更新版本
/changelog
# 首次执行: 创建 ## [2025-09-01] 并添加所有变更
# 再次执行: 合并新变更到 ## [2025-09-01]
# 指定版本号
/changelog 1.2.0
# 首次: 创建 ## [1.2.0] - 2025-09-01
# 更新: 合并新变更到现有 [1.2.0] 版本
# 假设 [2025-09-02] 已存在以下内容:
## [2025-09-02]
### Added
- 新增 changelog 命令
# 执行 /changelog 后,如有新变更:
## [2025-09-02]
### Added
- 新增 changelog 命令
- 添加版本合并更新功能 # <- 新增的条目
### Fixed
- 修复版本重复创建问题 # <- 新增的类型和条目
# Changelog
## [1.2.0] - 2025-09-01
### Added
- 新的用户认证功能
- API 速率限制功能
### Changed
- 更新了数据库连接池配置
- 优化了查询性能
### Fixed
- 修复了内存泄漏问题
- 解决了并发访问冲突
## [1.1.0] - 2025-08-15
### Added
- 初始版本发布
---
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).
该命令的执行流程:
# 版本参数处理
if [ -n "$ARGUMENTS" ]; then
VERSION="$ARGUMENTS"
else
VERSION=$(date +%Y-%m-%d)
fi
# 从 Git 获取变更数据(关键步骤)
# 根据具体需求确定时间范围
# 例如:获取最近的提交或自上个版本以来的提交
RECENT_COMMITS=$(git log --oneline -10) # 最近10个提交
CODE_CHANGES=$(git diff HEAD~1..HEAD --name-status)
STAGED_CHANGES=$(git diff --cached --name-status) # 暂存区变更
UNSTAGED=$(git status --porcelain)
# 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).
## [Unreleased]
[Unreleased] 后创建新版本章节新变更识别(基于 Git 数据):
git log --format="%H %s" 获取相关提交git diff --cached 获取暂存区变更智能合并:
分类整理:
合并结果:
## [版本号] - YYYY-MM-DD### 类型名称- 变更描述git log 获取相关提交记录(根据版本策略确定范围)git diff --cached 分析暂存区变更内容git status 检查工作区状态检测阶段:
合并策略:
结果验证:
文件权限不足
❌ 错误:无法写入 CHANGELOG.md
💡 解决:检查文件权限或使用 sudo
版本号格式错误
❌ 错误:版本号格式无效
💡 提示:使用语义化版本(如 1.2.0)或日期格式(YYYY-MM-DD)
文件编码问题
❌ 错误:文件编码不兼容
💡 解决:确保文件使用 UTF-8 编码
[Unreleased] 章节用于开发中的变更npx claudepluginhub ysicing/code-pilot/changelogAnalyzes git history since last release, detects undocumented changes, drafts entries for CHANGELOG.md [Unreleased] section, and updates on confirmation.
/write-changelogGenerates detailed changelog entry from git commits and merged PRs since last release tag. Classifies changes, adds user-facing descriptions with PR links and credits, prepends to CHANGELOG.md.
/add-changelogGenerates and maintains project CHANGELOG.md in Keep a Changelog format using conventional commits, git history, and npm tools like conventional-changelog-cli.
/generate-changelogGenerates changelog from git history using conventional commits, grouping by type and version. Updates or prepends to CHANGELOG.md in Keep a Changelog format. Supports --from and --to flags.
/devkit.generate-changelogGenerates and updates project CHANGELOG.md from Git history in Keep a Changelog format with Conventional Commits and auto-version detection from build files. Supports init, update, release, preview, validate actions.
/changelogGenerates changelogs from git commit history with automatic categorization, semantic versioning detection, and multiple output formats.