Skip to content

feat(core): #1662 车道 E 工作区下沉(WS-05/13/18) - #1758

Merged
1lck merged 4 commits into
previewfrom
feat/issue-1662-e-workspace
Nov 5, 2026
Merged

1lck merged 4 commits into
previewfrom
feat/issue-1662-e-workspace

Conversation

@1lck

@1lck 1lck commented Nov 5, 2026

Copy link
Copy Markdown
Owner

引用 #1662(车道 E:工作区、文件、搜索、快捷键),Draft。

本 PR 完成的条目

  • WS-05 文件树自然排序:新增 workspace.orderEntries(project/file_name_order.rs),共享 fixture shared/fixtures/workspace/entry-order-v1.json。macOS 删除 listDirectories 兜底扫描和 Swift 比较器,插入文件时由 Core 排序;Windows 文件树/面包屑/可见行排序改走 Core(v0.1.12 不再排在 v0.1.4 前,不再受 locale 影响)。
  • WS-13 Local History 文本 diff:新增 diff.compareTexts(rust/lithe-core/src/diff/),fixture shared/fixtures/diff/compare-texts-v1.json;git/mod.rs 里私有的行配对改为复用该模块;macOS 删除 collection difference+bigram DP,Windows 删除 patience+LIS,换行规范化统一。
  • WS-18 最近项目:新增 workspace.recentProjects.reduce(project/recent_projects.rs,容量与固定策略作为参数),fixture recent-projects-v1.json;两端保留集合一致,workspace-open-switch 功能矩阵已更新。

新 API

workspace.orderEntries、workspace.recentProjects.reduce、diff.compareTexts(已登记 rust-core-api.md)。rust/Cargo.lock 因 diff 模块依赖变化。

本 PR 不包含(留给后续)

  • WS-03:Core 侧改动已撤出。Windows quick-open 需要对非原生根(remote/wsl)保留本地列表打分,必须改成异步 rankNames 才能删干净,macOS 旧打分同理,不硬塞半成品。
  • WS-04、06、07、08、11、16、17、10、14:本轮未做。WS-16 的半成品(未接线的 terminal 模块)已丢弃。

与 #1658 重叠的文件(后合并者需 rebase)

RustWorkspaceOperations.swift、RemoteWorkspaceRouting.swift、FileNodePathLookup.swift、WorkspaceFeatureContracts.swift、WorkspaceFeatureModel.swift、ProjectTreeLoaderTests.swift、git/mod.rs、protocol/command.rs、runtime/dispatcher.rs、rust-core-api.md。与 #1716 无重叠。

验证

  • cargo test -p lithe-core --lib:1865 passed。
  • Windows tsc --noEmit 干净;bun test 相关目录 290 pass / 18 skip(依赖原生 Core)/ 0 fail。
  • verify-rust-core-comments、verify-shared-contracts、verify-core、verify-service-boundaries、verify-windows-boundaries、verify-platform-feature-matrix、i18n 两项均通过。
  • macOS test-macos.sh --filter(LitheCoreLogicTests、RecentProjectsStore、ProjectTree、LocalHistory、SearchEverywhere):310 个中 7 个失败,均为窗口焦点/并发时序类(LazyProjectTreeInventory 单独重跑 26/26 通过;SearchEverywhere 的 popup 焦点与尺寸测试未被本 PR 触及,未单独复核)。
  • 未执行:完整 test-macos.sh;Windows cargo check --bin lithe-windows 在 macOS 宿主因 os::windows 无法编译(与本改动无关);verify-rust-core.sh。

🤖 Generated with Claude Code

1lck and others added 4 commits November 5, 2026 01:46
同时在命令注册表、dispatcher 和 rust-core-api 契约里登记本 PR 新增的全部命令
(workspace.orderEntries、workspace.recentProjects.reduce、diff.compareTexts)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1lck
1lck force-pushed the feat/issue-1662-e-workspace branch from 7857162 to 0f1d5cc Compare November 5, 2026 09:51
@1lck

1lck commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

本地验证(代替 GitHub macOS / Windows CI)

本 PR 与 #1760、#1755、#1753、#1759、#1756、#1758、#1757 一起,在本地集成分支 integration/issue-1662-round1 上按合并顺序集成后,按 ci-macos.yml / ci-windows.yml 的步骤在维护者的 Mac 和 Windows 机器上完整验证,未使用 GitHub 的 macOS / Windows runner。

macOS(本机,macOS 26.6 arm64)

Windows(lithe-dev,Windows Server)

  • 通过:依赖安装、verify-windows-boundaries.ps1、共享编辑器测试、PHP 插件构建与隔离验证、ci-windows.yml 中各组 bun 测试、dist 验证、Rust 测试(shared、shared-hosts、MCP stdio、agent-host、git-host、ide-host、project、terminal、windows)。
  • 发现并已修复的回归(均为测试替身未跟上新的 Core 契约,生产代码无回归):bun run typecheck 3 个 TS 错误与 3 个 agent 测试文件(feat(core): #1662 车道 F Agent/AI 下沉(AGT-03/04/07~09/11~13/18) #1757)、git-workspace-status-panel.test.tsx(feat(core): #1662 车道 A Git 流程下沉(GIT-24/25/28/29) #1753)。
  • lithe-windows memory::platform::tests::current_process_private_working_set_is_available 失败,干净 preview 基线同样失败,属于该 Windows Server 环境的既有问题。
  • 跳过:real-jdt(机器无 JDK 21/25 与 Maven)、需要 GPU 或交互桌面的 GUI 验证、GitHub 专属的缓存/上传/gate 步骤。

合并前每个 PR 已 rebase 到最新 preview,并重新执行编译、i18n、verify-core、verify-shared-contracts 等快速检查。

@1lck
1lck marked this pull request as ready for review November 5, 2026 09:52
@1lck
1lck merged commit ff76111 into preview Nov 5, 2026
7 of 12 checks passed
1lck added a commit that referenced this pull request Nov 6, 2026
* 新增 lithe-core-rules 同步规则桥和 wasm 构建接入 (#1662)

- 新增纯 Rust crate rust/lithe-core-rules:只依赖 serde,不碰 I/O 和时钟,能编译到 wasm32;lithe-core 依赖它,并通过现有 JSON 分发暴露 keymap.modifierGestureStep,envelope 与错误码和其他 Core 命令一致
- wasm ABI 不用 wasm-bindgen:导出 alloc/dealloc/execute/result_len,输入输出为 Core envelope JSON;release 约 141 KB
- Windows 新增 src/core/core-rules.ts:启动时异步 instantiate(WebView2 不允许同步编译大模块),之后 executeCoreRuleSync 同步调用;加载失败显示本地化错误,不回退 TS 算法
- 新增 scripts/windows/prepare/prepare-core-rules-wasm.mjs,接入 dev/build、ci-windows 前端 job 和两个 Windows 发布工作流;产物不提交
- 注释检查、rustfmt、日志检查和 Rust 单测纳入新 crate
- 工作树资源清单登记不可复用的 core-rules-wasm,补测试和 docs/ci-builds.md
- 新增 coreRules.* 中英词条

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* WS-17 双击 Shift 手势改走 Core,删除两端算法 (#1662)

- macOS DoubleShiftGestureRecognizer 和 Windows double-shift-recognizer.ts 只保留薄适配层,状态机和阈值由 keymap.modifierGestureStep 提供;macOS 经 FFI 同步调用,Windows 经 wasm 同步调用
- 共享 fixture modifier-gesture-v1.json 由 Rust 测试、macOS 测试(真实 FFI)和 Windows bun 测试(真实 wasm)逐步驱动
- 删除功能矩阵、契约文档和代码注释里的 WS-17 例外说明,契约补充 keymap.modifierGestureStep
- 新增 Agent Note 2026-11-05-core-rules-wasm-sync-bridge.md,并在 develop-lithe Skill 加一行指引

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(windows): 同步 src-tauri Cargo.lock 中 lithe-core 的 similar 依赖

lithe-core 新增 similar(diff.compareTexts,#1758)时只更新了 rust/Cargo.lock,
windows/tauri/src-tauri/Cargo.lock 缺少 similar 与 bstr 条目,导致
`cargo build --locked` 在 preview 上报 cannot update the lock file。
补上这两个条目,版本与 rust/Cargo.lock 一致,不升级其他依赖。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* LSP-16 编辑器分组成员状态改走 Core,删除两端旧规则 (#1662)

- 新增 Core 命令 editor.workbenchState.reduce(rust/lithe-core-rules,同时经 lithe-core JSON 分发):规范“组成员状态”取两端并集(有序去重成员、选中项、MRU、固定、预览),动作含 normalize、open、close、activate、move、reorder、固定、预览、mergeGroup,返回新状态和 removedGroupIds
- 两端在选中项离开分组时的既有行为不同,用 selectionFallback(adjacent / first)保留:Windows 选相邻标签,macOS 回到第一个标签
- Windows:pane-tree.ts 的 normalizeGroup、成员打开/关闭/移动/固定/预览等算法删除,经 workbench-state.ts 适配层在 zustand set() 里同步调用 wasm,每个动作一次 Core 调用;布局树只按 removedGroupIds 修剪;会话恢复不再自己去重
- macOS:EditorTabOrderFeatureModel 的 reconcileGroups、drop、insert、move 的归属与选中规则改为经 RustEditorWorkbenchState 调用 Core,EditorGroupLayout 只保留树结构和比例;MRU、固定、预览传空值
- 共享 fixture shared/fixtures/editor/workbench-state-v1.json(56 例)由 Rust、macOS(真实 FFI)和 Windows(真实 wasm)测试驱动;补 pane-tree、pane.store(含 Core 调用次数、拖动比例不调用 Core)、会话测试,三个 buffer 测试加载真实 wasm
- 契约、功能矩阵 workbench-panes 和同步桥 Note 已更新

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* WS-04 隐藏路径规则统一进 lithe-core-rules (#1662)

- 新增 workspace.classifyVisibility(按一批路径一次判断)和 workspace.visibilityDefaults,默认列表、glob 匹配、目录/文件区别只在 rust/lithe-core-rules/src/visibility.rs 一份;lithe-core 的 files.rs 复用同一份,删除第二份
- macOS:LitheCoreContracts 只定义 FileVisibilityEngine 协议,App 内 RustFileVisibilityEngine 经 FFI 实现;删除 Swift 默认列表和匹配算法;插件目录列表按目录批量分类
- Windows:文件树按目录批量调用 wasm 并按“目录 + 规则版本”缓存;删除 ignore 判断和 default-settings.ts 的默认列表(新装默认为空,已保存值不变)
- 共享 fixture visibility-v1.json 同时驱动 Rust、macOS(真实 FFI)和 Windows(真实 wasm)测试
- 更新功能矩阵、契约文档和同步桥 Note

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(core-rules): #1662 宿主语言检查覆盖新 crate,修正类型和测试隔离

- 宿主语言检查的扫描范围和 workflow 触发路径加入 rust/lithe-core-rules/src。
- 基线按代码搬迁记录:files.rs 的 toolTables 19 和 1 个 words 随隐藏目录表移到
  lithe-core-rules 的 visibility.rs;FileVisibilityRules.swift 的 1 个 words 已删除,总数减 1。
- file-tree-visibility:workspaceRootFor 允许返回 undefined;默认值测试补上类型参数。
- core-rules 增加 resetCoreRulesForTests()。pane.store 的 Core 调用计数测试先重置再加载,
  避免同一 Bun 进程里更早的测试文件已经加载了不计数的实例。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant