Repository navigation
feat(desktop): 插件缺少的命令可在能力卡片上一键安装(API-23 commandInstallers) - #1971
Merged
Merged
Conversation
插件用 commandInstallers 声明用哪个已注入的工具安装 systemCommand 启动缺的命令。 宿主经 Core 校验并展开安装计划;插件详情“功能”页的能力卡片检测命令是否存在,缺失时显示 “未找到”和安装按钮,没有卡片的后端命令显示在横幅里。用户在对话框里选择 Lithe 管理的目录 或工具默认位置,看清要运行的命令、环境和是否联网后确认;安装输出实时显示,可取消,超时停止, 确认命令落地后记录目录,之后的启动在那里找到命令。命令缺失导致的调试、构建、版本控制启动 失败改为本地化提示。卡片上“本机已安装:xxx”改为“使用本机程序:xxx”,不再与“未找到”矛盾。
点能力卡片的安装按钮、对话框的安装按钮各记一次 app.action.performed, 安装计划或安装失败在同一 op 下记 operation_failed(取消不记); 缺失检测失败记 background.operation_failed。
xiaoyumuxi
marked this pull request as ready for review
November 15, 2026 08:50
xiaoyumuxi
added a commit
to Lithe-IDEA/lithe-plugin-go
that referenced
this pull request
Nov 15, 2026
* feat: 缺少 gopls、dlv 时可以在插件详情里安装 清单声明 commandInstallers(API-23):gopls 和 dlv 用注入的 go 工具运行 go install <包>@latest 安装,可以装进 Lithe 管理的目录(设置 GOBIN),也可以 装进 Go 的默认位置(go env GOBIN,为空时 GOPATH 第一项加 bin)。 requires 加 commandInstallers 0,requiresTools 为 go,权限加 commands.install。 README 改写依赖的程序一节,功能矩阵更新 gopls、dlv 缺失时的验证步骤, 宿主端到端测试的固定提交升到 1lck/Lithe-IDEA#1971 的 a9bddd922。 * docs: 预发布说明和 0.1.0 发布说明补上 commandInstallers 的宿主依赖
This was referenced Nov 15, 2026
Closed
Merged
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.
关联 Issue / Linked issue
dlv、gopls时,插件管理里只显示原始英文错误,没有安装入口)。commandInstallers契约与展开,已合入 Core main,提交 c550c2b)dlv/gopls的安装方式:feat: 缺少 gopls、dlv 时可以在插件详情里安装(commandInstallers) Lithe-IDEA/lithe-plugin-go#8(Draft,依赖本 PR)。PR 类型 / Type
改动说明 / What changes
背景 / Why
很多插件不打包自己要运行的程序,而是用本机已有的命令(例如语言服务器、调试适配器)。命令不在时,插件详情里只显示 “plugin package path is not usable: none of the plan's commands is available”,用户不知道缺什么、怎么装。
现在插件可以在清单里用
commandInstallers声明“用哪个已注入的工具、什么参数安装哪些命令”(API-23,Core 校验与展开在 Lithe-IDEA/Lithe-core-rust#53)。宿主在能力卡片上显示缺失的命令和安装按钮,用户选择安装位置、看清要运行的命令后确认安装。宿主里没有针对具体插件或工具的代码。改动 / Changes
Core 固定版本
scripts/desktop/build-desktop-core.sh:PINNED_CORE_REVISION从6477e9a(docs: add shared AI development skill #52)升到c550c2b(fix(git): keep git status fresh when git metadata changes externally #53),说明里补上 fix(git): keep git status fresh when git metadata changes externally #53。Core 封装(
desktop/internal/core/command_installers.go)plugins.commandInstallers.requirements、plugins.commandInstallers.plan、plugins.commandInstallers.defaultDirectory三个请求,以及managed/toolDefault两个目标常量。commandInstallers: 0;插件操作名commandInstaller/install(plugin_operation.go)。记录与查找(
desktop/internal/pluginhost/commands.go、launch.go、pluginhost.go,pluginbackend、pluginservice)CommandStore:受管目录<插件根目录>/.state/<插件 ID>/commands/<安装器 ID>;记录文件.state/<插件 ID>/commands.json,读取上限 64 KiB,先写临时文件再改名。systemCommand启动(语言服务器、构建、版本控制、调试适配器、后端)先在记录的目录里找命令,再按原方式找。.state/<插件 ID>,受管目录和记录一起删除;toolDefault只记录目录,不删工具装进默认位置的文件。pluginpkg.CheckIdentity改为导出,供记录核对插件身份。缺失检测与安装执行(
desktop/internal/workbench/command_installers.go)xcrun --find),其他用插件运行器的查找;只有“找不到命令”算缺失。buildprocess直接启动工具,不经过 shell;输出逐行送到对话框(每行有上限);到超时停止,取消即停止。toolDefault目标运行插件声明的目录探测(每个 10 秒上限、输出有上限),探测不到时该选项不可选。launchFailureText)。app.action.performed;打开对话框或安装失败在同一 op 下记app.notification.operation_failed,取消不记;缺失检测失败记app.background.operation_failed;安装尝试另由插件操作记录(commandInstaller/install)。界面(
desktop/internal/settingswindow/command_install.go、controller.go、window.go、window_view.go、installed_view.go)小改动
messages.json的词条说明同步更新。i18n:
shared/i18n/新增安装相关的中英词条并重新生成。文档与矩阵
plugin-command-installers(两端 implemented / pending)。.agents/notes/implemented/architecture/2026-11-15-plugin-command-installers.md(决策、备选方案、运行时写入位置)。docs/development/macos-plugin-api-plan.md的 API-23 行补上commandInstallers:0。不在本 PR 范围内 / Out of scope
dlv、gopls)在各自插件仓库另开 PR。pending。类型专属:feat
多平台对齐
.exe、PATH 类变量用分号,由同一条查找路径处理。Windows 真机验证待做(矩阵pending)。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/plugin-command-installers.json:两端 implemented / pending,证据、owner、验证动作如实填写./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(validated 192)和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD(通过).artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节的自查命令,结果为空dev.lithe.test.command-installers(安装工具是复制出来的测试二进制,不联网)和dev.lithe.test.commandsshared/i18n/,没有插件构建步骤进资源登记或文档UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=<目录> scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' -run TestVisualCommandInstall ./internal/settingswindow -count=1,提交 98155ca,场景为能力卡片与安装对话框,深色中文、浅色英文,窗口 900×700统一日志系统 / Structured logging
app.action.performed(plugin.commandInstaller.offer、plugin.commandInstaller.install)、app.notification.operation_failed、app.background.operation_failed,以及 Core 的插件操作记录;没有NSLog、stderr、print或手写事件 ID界面文案 / i18n
shared/i18n/node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,均通过逻辑归属 / Logic placement
${installDirectory}替换和默认目录解析都在 Rust Core(fix(git): keep git status fresh when git metadata changes externally #53,带契约 fixture);宿主只做命令查找、进程启动、记录文件 I/O 和界面性能与内存 / Performance and memory
设置 / Settings
toolDefault的目录由工具自己的探测命令给出插件契约 / Plugin contract
PINNED_CORE_REVISION已升到c550c2bf10b4d82d2315e737bf83a007daafaa56(Core main 上的 fix(git): keep git status fresh when git metadata changes externally #53),桌面端测试经scripts/desktop/desktop-go.sh读到的就是这份契约commandInstallers(清单字段,requires.commandInstallers: 0,权限commands.install)systemCommand启动缺的命令plugins.commandInstallers.requirementssystemCommand启动的命令和能安装它的安装器,用于缺失检测plugins.commandInstallers.planplugins.commandInstallers.defaultDirectorytoolDefault的探测输出取出工具默认安装目录发行包与资源 / Bundle and resources
.state(平台存储目录),不写 app bundle 或安装目录;生命周期和所有权写在 Agent Note;已运行./scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过无用代码与重构 / Dead code and refactoring
验证 / Verification
scripts/desktop/desktop-go.sh test -short ./internal/workbench ./internal/settingswindow ./internal/pluginhost ./internal/pluginbackend ./internal/pluginservice ./internal/pluginpkg ./internal/core -count=1scripts/desktop/desktop-go.sh test -race命令安装相关测试(internal/workbench、internal/settingswindow、internal/pluginhost、internal/core)TestVisualCommandInstall(-tags 'vivahead lithevisual')gofmt -l、desktop-go.sh vetnode scripts/i18n/generate-i18n.mjs --check、node scripts/i18n/verify-app-language-localization.mjsverify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/preview HEAD./scripts/agent-notes/verify-agent-notes.sh./scripts/desktop/verify/verify-runtime-bundle-immutability.shdevelop-lithe第三节插件归属自查命令未能执行的检查和原因:
pending。提交前确认 / Final checks
preview创建(已 rebase 到 release(sync): 将 main 的历史发布资料同步回 preview #1965 之后);目标分支preview