Skip to content

feat(build): 构建树排布与编码模型多选选项的默认激活项和取消前缀 - #86

Merged
Mucheen merged 5 commits into
mainfrom
feat/2092-build-tree-options
Nov 18, 2026
Merged

Mucheen merged 5 commits into
mainfrom
feat/2092-build-tree-options

Conversation

@Mucheen

@Mucheen Mucheen commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Refs 1lck/Lithe-IDEA#2092
配套桌面宿主 PR:1lck/Lithe-IDEA#2118
配套 Maven 插件 PR:Lithe-IDEA/lithe-plugin-maven#30

改动

为声明式构建系统(buildSystems)补齐模型提供的多选选项默认激活项、取消前缀编码与 Build 工具窗口树顶勾选节点排布。所有合并、默认激活解析、排除项编码和树节点排布都放在 Core,对所有构建工具一致,不认识任何具体构建系统。

  • 清单与模型字段:
    • buildSystems[].options[](仅 kind: "multiSelect")新增可选字段 excludePrefix:1–4 个可打印非空白字符,不能含该选项的 separator,用于把未勾选的默认激活项编码为 <excludePrefix><value>(如 "-dev");安装审查在声明了该字段时同步包含 excludePrefix。
    • model.map 新增可选 optionDefaults(静态模型选择规则,目标选项须声明 choicesFromModel: true)。
    • 规范模型 litheBuildModel 新增可选 optionDefaults: { <optionID>: [...] } 与 optionExcludePrefixes: { <optionID>: "<prefix>" }。解码时保证 optionDefaults 始终是 optionValues 的子集,过滤掉含 separator 或以取消前缀开头的候选;只输出这两个模型字段、不改 plugin.json 的插件在旧宿主上也会被安全忽略未知模型字段。
  • 选项解析与存储编辑(build.resolveOptions / build.editStoredOption):
    • 两个命令均新增可选输入 selectedChoices、modelDefaults、modelExcludePrefixes。
    • encode_selected_choices 将用户勾选的正向候选集合编码为存储值:未勾选的默认激活项自动写入 <excludePrefix><value>(全部取消时写入 ["-dev"],冷启动尚无模型时也能抑制构建工具自带的默认激活项);无团队覆盖且勾选集合等于默认激活集时返回 null,自动清除本机覆盖。
    • 工作区级 multiSelect 选项合并多实例兄弟值时,新增的正向/反向条目会自动移除相反方向的旧条目。
    • build.resolveOptions 在候选上标出 defaultActive: true,并在存在默认激活项、取消前缀或自定义已选值时返回正向勾选列表 selectedChoices(原有无默认项用例的 JSON 逐字节保持不变)。
  • Build 树排布(build.modelTree):
    • 请求新增可选 options,model 新增可选 optionValues、optionDefaults、optionExcludePrefixes。
    • 为 presentation: "tree" 且 kind: "multiSelect" 的选项在构建系统树顶部生成 kind: "option" 节点(key: "option:<id>",detail 汇总当前已勾选标题)和子级 kind: "optionChoice" 节点(key: "option:<id>:<value>",携带 optionID、optionValue、checked、defaultActive)。
    • 过滤时 option 仅匹配自身 label / tooltip(不把汇总 detail 当作整组命中),使搜索单个候选名时自动展开父选项并定位到命中的 optionChoice。
  • 文档与黄金样例:
    • 更新 shared/plugins/contract/v1/README.md、shared/plugins/contract/v1/plugin-manifest.schema.json、shared/plugins/reference/domains/build-systems.md、shared/plugins/reference/protocol-changelog.md 与 rust/contracts/rust-core-api.md。
    • rust/fixtures/build/model-tree-v1.json 新增默认激活勾选树与筛选场景。
    • 清单与模型均向后兼容,没有新增插件宿主方法、通知或能力版本。

验证

  • cargo fmt --manifest-path rust/Cargo.toml --check 通过。
  • cargo clippy -p lithe-build -p lithe-core --all-targets --all-features -- -D warnings 零警告通过。
  • cargo test -p lithe-core --lib 'tests::build_model_tree'(4/4)、cargo test -p lithe-core --lib 'tests::build_systems'(55/55,含新增 model_option_defaults_and_exclusions_round_trip_through_storage_and_plans 及既有黄金计划对比)、cargo test -p lithe-core --lib 'tests::published_build_plugins'(12/12)全部通过。
  • node shared/plugins/scripts/verify-docs.mjs、node scripts/rust-core/verify-platform-tests.mjs、bash scripts/rust-core/verify-rust-core-comments.sh build core 全部通过。

Mucheen and others added 3 commits November 18, 2026 10:38
…pr86

# Conflicts:
#	shared/plugins/reference/protocol-changelog.md
- 保留兄弟构建根的本机值和空选择标记,恢复默认前检查实例继承。
- 在生成 Run 条目时使用模型取消前缀,并在配置启动时应用逐项覆盖。
- 为实际激活集合绑定模型调用的选项指纹,供构建树和编辑器复用。
- 用合成清单覆盖回归,补齐选项编辑契约、共享样例和协议记录。

Refs 1lck/Lithe-IDEA#2092
@Mucheen
Mucheen merged commit 16176c1 into main Nov 18, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant