Repository navigation
feat(build): Build 工具窗口的树由 Core 按父子项目嵌套排布 (build.modelTree) - #76
Merged
Merged
Conversation
新增 build.modelTree:项目按 parentID 嵌套,每个项目依次列出按 category (没有时按 group)分好文件夹的任务、项目依赖、目标(带目标级任务)和子项目; 只作用于整个工作区的任务、依赖和测试在根项目旁边只出现一次;只有一个根项目时 它的内容直接作为实例内容。过滤保留匹配的整个节点和通往它的路径。规则只看声明的 作用域、分组、分类和模型,不认任何构建工具。 - 节点 key 稳定且唯一,宿主按 key 记住展开状态 - 循环、自身或缺失的父项目变为根;重复项目 ID 只保留第一个 - 模型上限 2,000 项目 / 10,000 目标与任务,树最多 50,000 节点并标记 truncated - 契约 README、Core API 文档、构建系统参考页与协议更新记录同步
28 of 34 tasks
xiaoyumuxi
marked this pull request as ready for review
November 16, 2026 15:23
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.
Refs 1lck/Lithe-IDEA#1866
改动
新增只读命令
build.modelTree。桌面端的 Build 工具窗口参照 IntelliJ IDEA 的 Maven 工具窗口,改为按父子项目嵌套;排布规则放在 Core,对所有构建工具一致,宿主只负责展开状态、绘制和交互。规则只看插件声明的作用域、分组、分类和模型,不认任何构建工具。{ model: { projects, targets, tasks }, query?, groupHeadings?: { <group>: heading } }。model是build.decodeModel的结果,其他模型字段忽略。tree: { project?, nodes, truncated? }。节点是{ kind, key, label?, detail?, tooltip?, group?, projectID?, targetID?, taskID?, matched?, children? },kind取project/folder/task/targets/target/dependencies/tests。parentID嵌套。父项目缺失、指向自己、处在循环里或嵌套超过 64 层时,该项目变为根;重复的项目 ID 只保留第一个。模型没写parentID时,沿用build.decodeModel已有的按路径包含关系补父项目。category由外到内分组;没有category时按group放进一个文件夹,标题用宿主传来的groupHeadings。dependencies.scopes含project时才有。targetTags匹配的 target 作用域任务。project作用域的声明任务出现在每个项目里。下面这些在nodes里只出现一次,放在根项目旁边:只有workspace作用域的任务、requiresUserArguments的任务、工作区依赖、test.discovery的 Discovered Tests。project是这个项目(不带子节点),nodes是它的内容加上实例自己的节点,宿主用构建系统那一行代表它。query去掉首尾空白后不区分大小写,匹配label/detail/tooltip,最长 256 字节,不能含控制字符。matched: true,通往它的路径也保留,宿主据此展开路径、保持命中节点的展开状态。dependencies节点去掉;tests节点始终保留,因为测试是之后才加载的。key:不透明,在实例内唯一,重新加载和过滤后保持不变,宿主按它记住展开状态。invalid_request;未知字段,以及为空、超过 120 字节或含控制字符的 group 标题,也返回invalid_request。树最多 50,000 个节点,超出就截断并标truncated: true。rust/crates/build/src/tree.rs是排布实现。为复用模型上限,model.rs的MAX_ITEMS改为pub(crate)。命令接入commands.rs、protocol/command.rs和runtime/dispatcher/build.rs。rust/contracts/rust-core-api.md:命令表、请求响应表,加一段说明。shared/plugins/contract/v1/README.md与shared/plugins/reference/domains/build-systems.md:说明category、group、scopes、parentID决定任务和项目在 Build 窗口里出现的位置。buildSystems0 内的补充。验证
黄金样例
rust/fixtures/build/model-tree-v1.json有 8 个场景:另有一组 rejected 请求。
crates/core/src/tests/build_model_tree.rs新增 4 个测试:逐个比对黄金样例并检查 key 唯一,根项目命中时保留全部节点,拒绝格式错误的请求,模型上限与超大树截断。cargo test -p lithe-build -p lithe-core全部通过。cargo fmt --check、cargo clippy -p lithe-build -p lithe-core --all-targets -- -D warnings都干净。node shared/plugins/scripts/verify-docs.mjs通过。桌面端接入此分支后(feat(desktop): Build 窗口参照 IDEA 按父子项目嵌套,树由 Core build.modelTree 排布 1lck/Lithe-IDEA#2061,固定到本分支 f87d59c),
./internal/...全量测试和 Build 窗口无头截图都通过。