Repository navigation
feat(execution): 构建检测和运行项发现跳过被 Git 忽略的目录 - #33
Merged
Merged
Conversation
build.detect 和自动运行项发现共用的启发式扫描(最多 6 层)现在会按 Git 的忽略规则剪掉目录:.claude/worktrees 下的代理工作树、生成目录和本地副本 不再被当成候选根目录,构建窗口不会把每个模块列两遍。 - 规则来自工作区内途经的 .gitignore,以及根目录在工作区内的仓库的 info/exclude;gitfile 按 gitdir: 解析,链接工作树经 commondir 读主仓库 共享的 info/exclude;嵌套仓库另起一套规则;深层文件先匹配先决定, 支持 ! 重新包含。 - 不读工作区根以上的目录、core.excludesFile 和索引;读不到的忽略文件不加 规则(只会多看到目录),远程连接中断仍然让扫描失败。 - 指纹扫描和 Node 清单发现(不限深度的完整扫描)不变,仍遍历被忽略的目录。 - 契约 README、构建系统参考页、rust-core-api.md 写明检测深度和忽略规则; 协议更新记录加一行。
18 of 24 tasks
xiaoyumuxi
marked this pull request as ready for review
November 14, 2026 05:15
This was referenced Nov 14, 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.
关联
.claude/worktrees/*下的代理工作树、生成目录等被 Git 忽略的目录也被当成了构建根目录。scripts/desktop/build-desktop-core.sh的PINNED_CORE_REVISION升到合并提交(不叠在 #1896 上)。这个 PR 做什么
1. 启发式扫描按 Git 忽略规则剪枝
lithe_execution::workspace_scan的启发式模式(max_depth有值)被build.detect和自动运行项发现共用,深度上限是 6 层。现在它在下降之前剪掉被 Git 忽略的目录,被忽略的子树一个文件都不读。.gitignore,以及根目录在工作区内的仓库的info/exclude!重新包含上层忽略的目录.git是文件时按第一行gitdir:解析(相对路径按 gitfile 所在目录);gitdir 里有commondir时读主仓库共享的info/exclude,所以链接工作树也能读到.claude/worktrees/这种只写在info/exclude里的规则.git的子目录另起一套规则,外层仓库的规则到此为止core.excludesFile、索引。所以被忽略目录下已跟踪的清单文件不会被发现(模块文档写明了这个近似)fs::is_transport_failure)仍让扫描失败,和读目录失败一致ignorecrate 的GitignoreBuilder(锁文件里已有=0.4.33,没有新增第三方包);第一行的 UTF-8 BOM 去掉;Git 解析不了的行跳过,其余规则照常生效2. 完整扫描不变
指纹扫描和 Node 清单发现(
configuration/inputs.rs,max_depth: None)照旧遍历被忽略的目录:它们决定配置是否过期,多读一个被忽略的输入只会多一次重新生成;跳过反而可能把过期误报成新鲜。3. 文档
detection一行、构建系统参考页中英两张表:写明检测最多向下 6 层,跳过已知缓存、构建输出和被 Git 忽略的目录,以及规则来源和不读的部分。rust/contracts/rust-core-api.md的扫描策略段落补上同样的说明,并写明指纹扫描和 Node 清单发现保留被忽略的目录。pluginAPIVersion0 内的补充)。没有新增宿主方法、能力版本或协议,不涉及 API 总表。4. 测试
workspace_scan::tests::heuristic_discovery_skips_what_git_ignores_and_full_scans_keep_it.gitignore(带 BOM)、info/exclude(含一行无法解析的模式)、下层!重新包含和新增规则;同一棵树的完整扫描保留全部 9 个目录workspace_scan::tests::a_linked_worktree_uses_the_shared_exclude_and_a_nested_repository_its_own_rulescommondir读到主仓库的info/exclude;嵌套仓库不受外层规则影响,只用自己的.gitignoreworkspace_scan::tests::an_ignore_file_that_cannot_be_read_hides_nothing.gitignore不隐藏任何目录tests::build_systems::detection_skips_directories_git_ignoresbuild.detect:.gitignore忽略的scratch/和info/exclude忽略的.claude/worktrees/copy/都不是实例,只剩cargo:.和cargo:toolstests::remote_sessions::shared_run_scan_reads_the_host_tree_and_stops_when_the_link_drops(修改).gitignore忽略的generated/不出现在扫描结果里验证
cargo test -p lithe-core(在rust/)cargo test -p lithe-execution -p lithe-buildcargo clippy -p lithe-execution -p lithe-build -p lithe-core --tests -- -D warningscargo fmt --all -- --checkscripts/rust-core/verify-rust-core-comments.shnode shared/plugins/scripts/verify-docs.mjs没有改插件后端协议,没有跑
sdk-e2e.mjs。只在 macOS 上运行;Windows 上的路径前缀匹配靠ignorecrate 处理,没有实机验证。