fix(scripts): sync-plugin-version 支持嵌套字段路径,修 marketplace.json 卡在 1.1.8 的老漂移 - #23
Merged
Merged
Conversation
补上之前简化版未实现的 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 不变
jnMetaCode
added a commit
that referenced
this pull request
May 10, 2026
This was referenced May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
接上 #22(v5.1.0 对齐 PR)。在那个 PR 的 sanity check 里发现的老漂移:
.claude-plugin/marketplace.json的plugins[0].version一直停在1.1.8,而其他 4 个 manifest(package.json + 3 个 plugin.json)已经在1.2.1。原因是中文版用的简化版sync-plugin-version.js只 match 顶层"version":字段,处理不了嵌套路径。实际影响
superpowers-zhplugin 版本是1.1.8,跟 npm 包真实版本不同步git blame显示 marketplace.json 自v1.1.8起这个字段就没动过改动
scripts/sync-plugin-version.jsTARGETS改为对象数组{ path, field },对齐上游.version-bump.json格式.claude-plugin/marketplace.json作为同步目标field='version':保留原顶层 regex(保格式)field='plugins.0.version':新增嵌套 regex("plugins"\s*:\s*\[\s*\{[\s\S]*?"version"\s*:\s*")[^"]+("),锚定到plugins数组首项JSON.stringify,保持原文件格式(缩进、行内/多行数组等).claude-plugin/marketplace.jsonplugins[0].version:1.1.8→1.2.1(追上其他 manifest)package.jsonscripts.version钩子加入git add .claude-plugin/marketplace.jsonTest plan
already at)plugin manifests already at 1.2.1npm pack --dry-run:90 文件 228KB(跟 chore: 跟上游 v5.1.0 对齐 — 补缺失文件、清已废弃流程、修 cursor-plugin dangling #22 merge 后一致)node --check scripts/sync-plugin-version.js语法 OK不在本 PR 内
bump-version.sh替换简化版(改动太大,下次单独评估)version和plugins.0.version两种 case),避免过度工程;未来真有第 3 种再加