用途:这是 docs-builder 变更日志功能的开发规范,供在改动 changelog 命令前查阅,确保各命令内部一致、schema 稳定、测试与文档同步。
主要能力与约束:
- 架构映射:列出 ChangelogCommand.cs、ProfileFilterResolver.cs、ChangelogBundlingService.cs、ChangelogRemoveService.cs、ChangelogConfigurationLoader.cs、BundleConfiguration.cs、ChangelogConfigurationYaml.cs 等关键文件及职责。
- 命令同步:changelog add 与 gh-release 创建逻辑、校验规则需一致;bundle 与 remove 过滤需对等;gh-release 等价于 add 加 bundle;render 与 {changelog} 指令共享渲染逻辑。
- 调用模式:bundle 与 remove 分 profile 模式与选项模式,二者互斥;profile 模式下过滤、连接、输出类选项一律禁止,报错须点名具体违规选项。
- 配置扩展:新增 bundle.* 或 profile 字段需同步改 BundleConfiguration.cs、ChangelogConfigurationYaml.cs、ChangelogConfigurationLoader.cs 与 config/changelog.example.yml;数组字段用 YamlLenientList。
- 优先级:选项模式下 --repo 高于 bundle.repo,--owner 高于 bundle.owner 高于 "elastic";profile 模式在 ProfileFilterResolver 中解析。
- 产品元数据:未显式设置 output_products 时,products 始终取自匹配的 changelog 文件自身字段,不得从 release tag 或仓库名推断;gh-release 与 add 例外。
- 测试:运行 dotnet test tests/Elastic.Changelog.Tests/,按改动范围选择对应测试类,新过滤或 profile 字段须新增专用测试类,覆盖正常、dry-run、错误与配置回退。
- 文档:同步更新 docs/cli/release/ 下相关页面、docs/contribute/changelog.md、docs/syntax/changelog.md 与 config/changelog.example.yml。
限制:资料未提供安装方式、收费、平台与效果信息;具体命令参数细节以官方文档为准。