fix(scripts): sync-plugin-version 支持嵌套字段路径 (#23)

补上之前简化版未实现的 plugins.0.version 路径,把
.claude-plugin/marketplace.json 纳入版本同步目标。

修复 marketplace.json 卡在 1.1.8 的老漂移(自 v1.1.8 起没动过):
plugins[0].version 1.1.8 -> 1.2.1(追上其他 4 个 manifest)。

实现:
- TARGETS 改为对象数组 { path, field },对齐上游 .version-bump.json 格式
- field='version' 走顶层 regex(保留原行为)
- field='plugins.0.version' 走嵌套 regex(锚定到 plugins 数组首项)
- 都用 regex 替换而非 JSON.stringify,保持原文件格式(缩进/数组写法等)

测试:
- 升级场景 1.2.1 → 1.3.0:4 个 manifest 全部同步
- 幂等性:版本相同时输出 "already at"
- 边界:marketplace.json 其他字段完全未动(diff 仅 version 一行)
- npm pack:90 文件 228KB 不变
This commit is contained in:
AI不止语
2026-05-10 22:48:09 +08:00
committed by GitHub
parent a9e02b501e
commit 48c4d0d417
3 changed files with 46 additions and 20 deletions

View File

@@ -9,7 +9,7 @@
{
"name": "superpowers-zh",
"description": "AI 编程超能力中文增强版20 个 skills14 翻译 + 6 中国原创),支持 Claude Code / Hermes Agent / Cursor / Claw Code 等 17 款工具",
"version": "1.1.8",
"version": "1.2.1",
"source": "./",
"author": {
"name": "jnMetaCode",