Skip to content

feat(core)!: 删除 Java/Maven/JDT 特判与契约专属死命令,run/start 临时文件支持 base64 - #23

Merged
xiaoyumuxi merged 3 commits into
mainfrom
refactor/core-remove-java-special-cases
Nov 13, 2026
Merged

xiaoyumuxi merged 3 commits into
mainfrom
refactor/core-remove-java-special-cases

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

关联

这个 PR 做什么

把 Core 里所有按 Java、Maven、JDT 名字写死的代码、资源、依赖和契约删掉:

  • JDK 参数文件规划;
  • 内置的 LSP 语言目录;
  • tree-sitter-java;
  • IDE API 的 Maven 工具;
  • 只在契约里出现过、Core 没有实现的 Java/Maven/Spring/MyBatis 命令名。

宿主以后按原样启动插件给出的命令行。必须由插件决定编码的文件,比如 Windows 上按系统 ANSI 代码页读取的 JDK 参数文件,通过 run/start 的 temporaryFiles 以字节形式交给宿主。

破坏性变更

  1. 删除已实现的命令 execution.planLaunchCommand。Viva 桌面端 desktop/internal/core/launch_plan.go 和 pluginservice/runs.go 目前还在调用,需要配套桌面端 PR 一起删除,见 refactor(desktop): 删除 Core 的 Java 启动规划,run/start 临时文件支持 base64 字节 1lck/Lithe-IDEA#1859。
  2. 删除 C ABI 函数 lithe_core_lsp_provider_catalog_json,同时删除 include/lithe_core.h 中的声明。桌面端没有调用。
  3. 删除 23 个只出现在契约、fixture 和测试里的命令名。Core 的 protocol/command.rs 本来就没有这些命令,所以不会改变任何运行行为:
    • java.codeVision、java.jdtCacheRetention、java.jdtWorkspaceFingerprint、java.navigationMarkers、java.prepareLaunch、java.resolveNavigation、java.runMarkers、java.sourceDefinition、java.structure、java.workspacePolicy
    • lsp.jdtWorkspaceKey、lsp.updateMavenConfiguration
    • maven.dependencies、maven.dependencyPlan、maven.diagnostics、maven.launchPlan、maven.scan、maven.testResults
    • mybatis.index、spring.index、runConfig.selectJava、build.languageImport、agent.attachments.retentionPlan
  4. 删除 3 份 schema:maven-launch-context-v1、maven-portable-configuration-v1、run-configuration-v1。
  5. IDE API 删除 lithe_maven_inspect、lithe_maven_configure、lithe_maven_execute、lithe_maven_reload,构建相关操作统一走 lithe_build_*。
  6. 项目生成器模板 ${field.<id>.major} 改为取版本号的第一个数字分量:1.8.0_412 得到 1,不再特判成 8。工具自己的版本编号应由工具定义的 version.pattern 在进入模板前换算。现有官方插件只在 minimumVersion: 17 的 JDK 字段上使用它,不受影响。
  7. 旧版工具链 pin(toolchain-local-v1)的条目改成不透明的字符串记录,不再点名 home、executable、javaHome。旧文档仍然能通过校验;新增一条限制:每个条目最多 16 个属性。
  8. 插件清单 schema 里的 hostIntegration 去掉只含 jdt 和 maven 的枚举,明确为保留字段:任何 ID 都会以 plugin.integration.unsupported 拒绝。Core 的拒绝行为、错误码和现有拒绝 fixture 都不变。

删除清单

位置 内容
rust/lithe-core/src/execution/launch_plan.rs 451 行,JDK 9+ 长命令行的 @argfile 规划,即 execution.planLaunchCommand
rust/lithe-core/src/protocol/command.rs、runtime/dispatcher.rs、execution/mod.rs 上面这个命令的变体、命令名映射和分发分支
rust/lithe-core/src/lsp/languages/catalog.rs 392 行,内置的语言服务器目录
rust/lithe-core/resources/lsp/language-providers.json 内置目录的数据文件
rust/lithe-core/src/runtime/ffi.rs、include/lithe_core.h lithe_core_lsp_provider_catalog_json
rust/lithe-core/Cargo.toml、rust/Cargo.lock tree-sitter、tree-sitter-java
rust/lithe-core/src/lsp/tests.rs 内置目录和 JDT 专属的测试(删除 252 行)
rust/lithe-ide-host/src/catalog.rs 4 个 lithe_maven_* 工具定义;IDE API fixture calls.json、host-tool-exposure.json 同步更新
rust/contracts/ 上面 3 份 schema;rust-core-api.md、application-boundary.md、ide-api/v1.md 中 Java/Maven/JDT 专属的章节
rust/fixtures/lsp/ 13 个 java-*、jdt-*、maven-profile-events、project-preparation fixture
rust/fixtures/maven/、java/、spring/、mybatis/ 整个目录,共 12 个 fixture
rust/fixtures/execution/ 6 个 Maven、Gradle、Java 运行发现 fixture
rust/fixtures/run-configuration/ 15 个只对 Java 或 Maven 有意义的 fixture。hybrid-spring-vue.json 用中立的 hybrid-service-web.json 替换;build-provider.json、editor-save.json 去掉 Java 内容
rust/fixtures/projects/lithe-spring-boot-git-graph/ Spring Boot 示例工程,15 个文件
rust/fixtures/editor/basic-file-highlighting-v1.json 依赖 tree-sitter-java 的高亮 fixture
rust/fixtures/modules/built-in-v1.json 去掉 execution.maven 条目。整个文件的去留见 #1858
rust/fixtures/build-project-options/ 示例构建系统从 maven 改成 make
shared/plugins/ 契约 README、清单 schema、toolchains README、backend.md、build-systems.md、languages.md、manifest.md、api-catalog.md、构建工具集成指南:去掉 Java/Maven/JDT 专属说明,示例改用中立的工具

新增

  • run/start 的 temporaryFiles 每项可以写成以下两种形式之一:

    • {name, contents}:UTF-8 文本,和原来一样;
    • {name, base64}:标准 base64 编码的字节,宿主按原样写入,不转码。

    contents 和 base64 同时给出或都不给,都会被拒绝。原有限制不变:最多 4 个文件,每个不超过 4 MiB,名字不超过 64 字节;参数里写 ${temporaryFile:<name>} 引用文件。

  • 实现在 build/run_start.rs,测试在 src/tests/plugin_run_debug.rs。契约 README、backend.md 和 API 总表已同步更新。

  • 契约 fixture shared/plugins/contract/v1/fixtures/run/run-start.json 增加三条拒绝用例:contents 和 base64 同时给出、两者都不给、base64 不是标准编码。plugin_run_debug.rs 的 fixture 回放测试改为传入临时目录,让这些用例走到逐项校验,而不是停在“缺少临时目录”。桌面端回放同一份 fixture,也会覆盖这三条用例。

  • 已在插件协议更新记录的“宿主方法(按 API 编号)”索引和 2026-11-13 时间线中登记:API-23,pluginAPIVersion 0 内的补充。

保留

  • 以下命令有生产调用方或计划中的调用方,全部保留:git.commitState、git.rollbackPlan、github.pullRequestCheckoutPlan、runConfig.projectToolchain、keymap.evaluateContext。
  • lithe-core/src/community 和社区相关的 fixture 不在本 PR 处理。
  • hostIntegration 的解析和拒绝路径保持不变。不可达的实现由 #1857 清理。

验证

  • cargo fmt --all --check:通过。

  • scripts/rust-core/verify-rust-core-comments.sh:通过。剩下的 2 个 warning 来自本 PR 没有改动的文件:lithe-git-host/src/configuration.rs 的 forward_slash_path,以及 plugins/capabilities.rs 的私有文档链接。

  • node shared/plugins/scripts/verify-docs.mjs:通过。

  • node --test shared/plugins/scripts/*.test.mjs:2 passed / 0 failed。

  • cargo test --workspace:全部通过,其中 lithe-core 单元测试 1743 passed / 0 failed。

  • node shared/plugins/scripts/sdk-e2e.mjs:Java 2、Node 3、Rust 2,全部通过。

  • 下面的命令名在全仓库搜索 0 命中:23 个契约专属命令名、execution.planLaunchCommand、lithe_core_lsp_provider_catalog_json、language-providers.json、tree-sitter。

  • 在 Lithe-IDEA 组织 16 个插件仓库的默认分支(2026-11-13 拉取)中检查过:

    • 没有插件声明 hostIntegration;
    • 没有插件调用 IDE API 的 Maven 工具;
    • 没有插件向 Core 发送上面删除的命令。

    lithe-plugin-java 里出现的 java.*、spring.index、mybatis.index、runConfig.selectJava、execution.planLaunchCommand,是它从 Core 移植后自己注册的同名插件函数,放在 crates/java-domain,不依赖 Core 的实现。

后续

Core 对 Java 等语言零依赖、零特判,语言和工具专属知识全部由插件注入。

- 删除 execution.planLaunchCommand(JDK @argfile 规划)及 execution/launch_plan.rs
- 删除 LSP 内置语言目录:lsp/languages/catalog.rs、resources/lsp/language-providers.json、
  FFI lithe_core_lsp_provider_catalog_json 与头文件声明
- 删除 tree-sitter、tree-sitter-java 依赖
- 删除 lithe-ide-host 目录里的 Java/Maven 工具
- 删除只存在于契约、fixture、测试中的 23 个命令名(java.*、lsp.jdt*、maven.*、
  mybatis.index、spring.index、runConfig.selectJava、build.languageImport、
  agent.attachments.retentionPlan)及其 fixture
- 删除 maven-launch-context-v1、maven-portable-configuration-v1、run-configuration-v1 schema
- run/start 的 temporaryFiles 增加 {name, base64} 字节文件,宿主原样写入
- 模板 ${field.<id>.major} 取第一个数字分量,不再特判 1.x
- 旧版工具链 pin 的条目改为不透明字符串记录,不再点名 javaHome
- 契约文档和测试 fixture 去掉 Java/Maven/JDT 专属内容

Refs 1lck/Lithe-IDEA#1856, 1lck/Lithe-IDEA#1857, 1lck/Lithe-IDEA#1858, 1lck/Lithe-IDEA#1853
run-start.json 增加三条拒绝用例:同时给出 contents 和 base64、两者都不给、
base64 不是标准编码。Core 的 fixture 回放测试改为传入临时目录,
让这些用例走到逐项校验,而不是停在缺少临时目录。
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 13, 2026 16:02
@xiaoyumuxi
xiaoyumuxi merged commit 78c065d into main Nov 13, 2026
5 checks passed
xiaoyumuxi added a commit that referenced this pull request Nov 13, 2026
* feat(core)!: 删除 Java/Maven/JDT 特判与契约专属死命令,run/start 临时文件支持 base64

Core 对 Java 等语言零依赖、零特判,语言和工具专属知识全部由插件注入。

- 删除 execution.planLaunchCommand(JDK @argfile 规划)及 execution/launch_plan.rs
- 删除 LSP 内置语言目录:lsp/languages/catalog.rs、resources/lsp/language-providers.json、
  FFI lithe_core_lsp_provider_catalog_json 与头文件声明
- 删除 tree-sitter、tree-sitter-java 依赖
- 删除 lithe-ide-host 目录里的 Java/Maven 工具
- 删除只存在于契约、fixture、测试中的 23 个命令名(java.*、lsp.jdt*、maven.*、
  mybatis.index、spring.index、runConfig.selectJava、build.languageImport、
  agent.attachments.retentionPlan)及其 fixture
- 删除 maven-launch-context-v1、maven-portable-configuration-v1、run-configuration-v1 schema
- run/start 的 temporaryFiles 增加 {name, base64} 字节文件,宿主原样写入
- 模板 ${field.<id>.major} 取第一个数字分量,不再特判 1.x
- 旧版工具链 pin 的条目改为不透明字符串记录,不再点名 javaHome
- 契约文档和测试 fixture 去掉 Java/Maven/JDT 专属内容

Refs 1lck/Lithe-IDEA#1856, 1lck/Lithe-IDEA#1857, 1lck/Lithe-IDEA#1858, 1lck/Lithe-IDEA#1853

* docs(plugins): 协议更新记录补上 #23

* test(run): 契约 fixture 覆盖 temporaryFiles base64 的拒绝用例

run-start.json 增加三条拒绝用例:同时给出 contents 和 base64、两者都不给、
base64 不是标准编码。Core 的 fixture 回放测试改为传入临时目录,
让这些用例走到逐项校验,而不是停在缺少临时目录。

* docs(contracts): Core 作为应用契约唯一真源,补回命令表与 AI 配置章节

- rust-core-api.md 补回 #19 误删的命令总表(375 条,每个 CoreCommand::parse 接受的命令一行)
  和 AI configuration 章节;Build systems 表补上 build.resolveStoredOptions、build.editStoredOption。
- protocol::command 新增测试:命令表与解析器逐条比对,增删改命令必须同一次提交更新表格。
- 删除 rust/fixtures/i18n(归 Lithe-IDEA i18n 生成器所有,迁到 shared/i18n/fixtures)
  和无人读取的 rust/fixtures/phpunit-project。

Refs 1lck/Lithe-IDEA#1853

* refactor(ai): AI 命令拆成独立 crate lithe-ai

- rust/lithe-core/src/ai 整体移到 rust/lithe-ai:提交信息生成、PR 描述、内联编辑、
  AI CLI 配置解析。新 crate 只依赖 serde、serde_json、toml、url,不做文件、网络和凭据访问。
- lithe-ai 提供 COMMANDS / execute / execute_json 和 AiError,形状与 lithe-core-rules 一致;
  lithe-core 的 9 个 ai.* 分发分支改为调用 lithe_ai::execute,AiError 一一映射到 CoreError。
- git.commitMessageContext 仍在 lithe-core(要跑 git),改用 lithe_ai 的敏感路径与预算规则。
- lithe_core::ai 改为 re-export lithe_ai,原有路径不变。命令名、C ABI、JSON 和错误码不变。
- 注释规范检查覆盖 lithe-ai;新增测试确认每个 lithe-ai 命令都经 Core 路由到 lithe-ai。
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