diff --git a/CLAUDE.md b/CLAUDE.md index 24d5f39..c549f33 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -327,9 +327,63 @@ import { useAppStore } from '@/stores/useAppStore' 每次完成数据更新后,必须按以下步骤操作: -1. **询问提交**:数据更新完成后,询问用户是否提交推送,不得自动提交 -2. **构建检查**:用户确认提交前,运行 `npm run build`,确保无类型错误和编译错误(无需每次修改后立即检查,在提交推送前统一检查即可) -3. **提交推送**:构建通过后执行 `git add` + `git commit` + `git push` +1. **更新 changelog**:在提交前,必须先更新 `src/data/changelog.json`,添加本次变更记录 +2. **询问提交**:数据更新完成后,询问用户是否提交推送,不得自动提交 +3. **构建检查**:用户确认提交前,运行 `npm run build`,确保无类型错误和编译错误(无需每次修改后立即检查,在提交推送前统一检查即可) +4. **提交推送**:构建通过后执行 `git add` + `git commit` + `git push` + +--- + +### 更新 changelog 规范 + +**文件:** `src/data/changelog.json` + +每次提交代码前,必须在 `changelogEntries` 数组开头添加一条新记录: + +```json +{ + "id": "YYYY-MM-DD-brief-description", + "date": "YYYY-MM-DD", + "type": "feat|fix|style|refactor|docs|perf|test|chore", + "title": "简短描述本次变更内容", + "scope": "整合|范围|进度|成本|质量|资源|沟通|风险|采购|相关方|练习|矩阵等" +} +``` + +**字段说明:** +- `id`:唯一标识符,格式为 `日期-简短描述`,使用小写字母和连字符 +- `date`:提交日期,格式 `YYYY-MM-DD` +- `type`:变更类型,与 Git 提交规范的 type 保持一致 +- `title`:变更标题,简洁描述本次变更的内容 +- `scope`:关联范围,与 Git 提交规范的 scope 保持一致 + +**注意事项:** +- 新记录添加在数组开头(最新记录在最前) +- `title` 中如需使用引号,使用「」而非 "",避免 JSON 解析错误 +- 每次提交只添加一条记录,对应本次 commit +- `type` 和 `scope` 应与 Git 提交信息保持一致 + +**示例:** +```json +{ + "changelogEntries": [ + { + "id": "2026-03-08-changelog-modal", + "date": "2026-03-08", + "type": "feat", + "title": "新增更新时间轴浏览页面与顶部快捷入口", + "scope": "整合" + }, + { + "id": "2026-03-08-practice-fix-offset", + "date": "2026-03-08", + "type": "fix", + "title": "修正底部固定区域偏移方式", + "scope": "练习" + } + ] +} +``` --- diff --git a/src/data/changelog.json b/src/data/changelog.json index 5cc714c..dd777c5 100644 --- a/src/data/changelog.json +++ b/src/data/changelog.json @@ -1,5 +1,12 @@ { "changelogEntries": [ + { + "id": "2026-03-08-update-changelog-rule", + "date": "2026-03-08", + "type": "docs", + "title": "在 CLAUDE.md 中添加提交前更新 changelog 的规范", + "scope": "整合" + }, { "id": "2026-03-08-changelog-modal", "date": "2026-03-08",