Repository navigation
feat(github): 一个仓库发布多个插件时按标签前缀读取更新日志 - #227
Merged
Merged
Conversation
市场索引条目新增输出字段 releaseTagPrefix,从下载地址的标签派生(索引 schema 不变,旧宿主不受影响)。listReleases 接受 tagPrefix:读 100 条、只保留该前缀的发布、最多 20 条;每条发布新增 version,宿主用它判断已安装版本。
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 2 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
This was referenced Nov 29, 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.
背景
一个仓库发布多个插件时(例如
Lithe-IDEA/lithe-ai-plugins里的 Codex 和 Claude Code),现在的更新日志有三个问题:repository读取整个仓库的 Release,两个插件会互相看到对方的发布。listReleases只读第一页 20 条,兄弟插件的发布会把自己的挤出去。v后和插件版本比较,codex-v0.0.1这类带前缀的标签永远对不上。设计
标签约定:每个插件的 Release 标签是
<前缀>MAJOR.MINOR.PATCH。主版本号取版本前面所有连续数字,前缀不能以.结尾,所以每个标签最多只有一种拆法;前缀不同的插件不会认领彼此的发布。新增公开函数lithe_github::split_release_tag。索引 schema 不变:索引的条目、版本、下载项都是
deny_unknown_fields,加字段会让旧宿主拒绝整个条目。所以前缀不写进索引,而是由 Core 从下载地址里的标签派生:plugins.marketplace.validateIndex的输出条目新增releaseTagPrefix:每个下载地址的标签都拆成同一个前缀加上列出它的版本号时为该前缀,混用约定或标签带%编码时为null。listReleases接受tagPrefix:github.requestPlan带前缀时读 100 条(GitHub 单页上限),否则仍是 20 条。github.normalizeResponse也接受同一个tagPrefix,只保留拆出来正好是这个前缀的发布,按发布时间新到旧,最多 20 条。空字符串前缀只保留裸MAJOR.MINOR.PATCH标签;不传前缀时保留全部发布,行为和以前一样。.结尾、含空白或控制字符的前缀永远匹配不上,返回invalid_request(details 为tagPrefix)。version:标签结尾的MAJOR.MINOR.PATCH,拆不出来时为null。宿主直接拿它和已安装版本比较,不再自己去前缀。改动
rust/crates/github:split_release_tag、tagPrefix校验、请求页大小、归一化过滤和截断、GitHubRelease.version。rust/crates/plugin-marketplace:派生releaseTagPrefix,新增依赖lithe-github(Cargo.lock随之更新一行)。releaseTagPrefix只在约定一致时派生(elixir-v2.0.0、v2.0.1、latest、v%32.0.0都得到null)。rust/contracts/github.md、shared/plugins/contract/v1/README.md、shared/plugins/reference/domains/marketplace.md(中英两节“一个仓库发布多个插件”),以及index-cases.json里每个合法条目的releaseTagPrefix期望值。shared/plugins/reference/protocol-changelog.md:在“待合入”登记本 PR(市场索引schemaVersion0 内的补充)。没有新增插件宿主方法、通知、错误码、能力版本或 SDK 版本。
后续
releaseTagPrefix传给listReleases,用version判断已安装,更新日志缓存按“仓库 + 前缀”区分;本 PR 合入后把固定版本换到main。验证
cargo test --workspacecargo clippy --workspace --all-targets -- -D warningscargo fmt --checkscripts/rust-core/verify-rust-core-comments.sh github plugin-marketplacenode shared/plugins/scripts/verify-docs.mjsgit diff --checknode scripts/rust-core/affected-crates.mjs因为改了Cargo.toml判定 Linux 跑整个 workspace,已在本机(macOS)跑完整个 workspace 的测试和 clippy。