Skip to content

feat(plugins): Go 与 PHP Support 迁移为 Lithe Store 社区插件 - #1357

Merged
xiaoyumuxi merged 2 commits into
previewfrom
feat/community-go-php-plugins
Oct 20, 2026
Merged

xiaoyumuxi merged 2 commits into
previewfrom
feat/community-go-php-plugins

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

概要

macOS 的 Go Support 和 PHP Support 不再是官方插件,改为 Lithe Store 社区插件:

旧官方 ID 新社区 ID 仓库
dev.lithe.plugin.go-support io.github.lithe-idea.go-support 0.1.0 https://github.com/Lithe-IDEA/lithe-plugin-go
dev.lithe.plugin.php-support io.github.lithe-idea.php-support 0.1.0 https://github.com/Lithe-IDEA/lithe-plugin-php

收录到商店的 PR:Lithe-IDEA/Lithe-store#14 。Windows 的 Plugins/win/Official/PhpSupport 是另一种 Worker 包格式,这次没有改动。

功能点

宿主(macOS)

  • OfficialPluginCatalog(BuiltInModuleCatalog.swift):新增 Distribution.migratedToCommunity(PluginID) 和 Entry.communityReplacementID。Go/PHP 条目仍保留 publisherPackage 签名要求,所以已安装的旧包照样要验签,第三方也不能用旧 ID 发布未签名的包冒充。新增 publishedEntries,把已迁移的条目过滤掉。
  • LSPControlCenterView:官方插件入口和提示改用 publishedEntries,不再引导用户安装旧的 Go/PHP 包。
  • PluginMarketplace:已迁移的 ID 没有官方来源(installedSourceID 返回 nil),也不显示更新;rebuildListings 跳过这些 ID,客户端缓存里还留着旧官方索引时也不会列出。卸载照常可用。
  • PluginManagementView:已安装旧包时显示“已迁移到社区插件”提示(图标 arrow.triangle.branch),写明新的社区 ID,引导用户先卸载再从插件市场安装社区版。新旧包声明同一种语言,同时安装时社区包会因语言冲突被拒绝,所以必须先卸载旧包。Go/PHP 的官方简介改为“已退役,见 Lithe Store”。
  • zh-Hans 本地化:新增迁移提示和新简介的翻译,删除旧简介的 key。

官方插件发布与构建

  • Plugins/marketplace/official-plugins.json、index.json 改为空列表。发布流程本身保留,留给以后的官方插件。
  • scripts/official-plugin-releases.mjs:抽出 readPackageManifest,plan/check 支持注入 manifest 读取函数;测试改用合成的 dev.lithe.plugin.sample-support,并断言当前仓库配置为空。
  • 删除 scripts/prepare-php-language-server.sh,以及 build-official-plugins.sh 里的 language-server.json 钩子;Plugins/mac/Official/PhpSupport/language-server.json 一并删除。
  • verify-official-plugins.sh:必需插件只剩 Java,删掉 Intelephense 相关检查。verify-macos-package.sh 仍然检查应用包里不含旧的 Go/PHP ID,只更新了注释。
  • worktree-resources.json:删除 php-language-server-downloads,更新 official-plugin-packages 的路径和身份说明;test-reuse-worktree-resources.mjs 同步修改。

PHP 不再打包 Intelephense:Intelephense 许可证第 5(c) 条禁止再分发,所以社区版改为通过 systemCommand 启动用户自己安装的 intelephense --stdio,并保留 runtimeDependencies: node。

测试

  • Go/PHP 最后一版官方 plugin.json 移到 macos/Tests/LitheTests/Fixtures/RetiredOfficialPlugins/;DeclarativePluginTestSupport.officialPackageURL 把它们映射到这个目录。
  • 新增 officialPluginMovedToTheCommunityHasNoOfficialSource:缓存的官方索引里还有旧 PHP 条目时,市场列表不显示它,没有官方来源、没有更新,可以卸载。
  • PluginManagerTests:断言 publishedEntries == [java]、替代 ID,以及 Go/PHP 仍是 publisherPackage。
  • Rust declarative_plugins.rs:删除对已移走的官方 Go/PHP manifest 的 include_str!。共享契约 fixture(dev.lithe.fixture.*)不变。

文档 / 契约 / 矩阵 / Agent Notes

  • Plugins/mac/README.md、docs/ci-builds.md、shared/contracts/application-boundary.md 更新为社区插件的说法。
  • 功能矩阵 go-support-plugin、php-optional-plugin、php-run-test、plugin-marketplace:证据路径指向迁移后的文件,验证步骤改为“从 Lithe Store 安装社区版,旧包显示迁移提示”。
  • 新增 Agent Note 2026-10-20-go-php-community-plugins.md(迁移决策、备选方案、代价);PHP 归属、LSP 插件构建、声明式插件、插件市场四篇 Note 同步更新,并修正其中失效的路径。

本地验证

  • test-stability-macos.sh -- --filter 'PluginMarketplace|PluginManager|PluginManagementPresentation|PluginPackageStore|MacPluginPackageDownloader|LanguageToolEnvironment|PluginLanguageServerLaunchResolver|LanguageExtensionProcessLifecycle|PluginDiskInstallation|ModuleRuntime':153 个测试全部通过
  • cargo test --lib -- declarative_plugins marketplace_plugins plugins:52 个通过
  • node --test scripts/official-plugin-releases.test.mjs(6/6)、node scripts/test-reuse-worktree-resources.mjs(18/18)、node scripts/test-official-plugin-distribution.mjs
  • ./scripts/verify-shared-contracts.sh、./scripts/verify-agent-notes.sh、./scripts/verify-platform-feature-matrix.sh、./scripts/verify-platform-feature-matrix-change.sh origin/preview HEAD
  • ./scripts/verify-runtime-bundle-immutability.sh
  • 尚未在真机上走一遍完整流程(装着旧包时看到迁移提示 → 卸载 → 从 Lithe Store 安装社区版),矩阵的 verificationStatus 保持 pending。

评审后修复(633d4c108)

  • 卸载后替代插件被禁用:卸载一个已启用的插件时,停止模块会把 enabled=false 写进存储,导致之后安装社区版时继承到禁用状态。现在卸载只保留用户明确关闭过的模块状态,其余模块的启用记录会被清除,社区版装好后默认启用。新增测试 uninstallingAnEnabledPluginLetsItsReplacementStartEnabled 和 uninstallKeepsAnExplicitlyDisabledModuleOff。
  • 迁移顺序:旧的官方包还在磁盘上(已安装或待卸载)时,插件市场把社区版显示为“需先卸载旧版”,不能安装,并提示按“卸载 → 重启 → 安装”的顺序操作(blockedByRetiredPlugin)。
  • “重启 Lithe”按钮(类似 IDEA 的 Restart IDE),出现在以下位置:
    • 插件管理页顶部:有待重启生效的变更时显示横幅;
    • 插件详情;
    • 插件市场列表和详情:替换原来的“重启后生效”文字;
    • LSP 控制中心的提示条。
  • 重启流程:走正常退出流程,未保存文件和运行中进程照常确认,任一步取消都不会重启。退出后由一个分离的 /bin/sh 辅助进程等待旧进程结束(最多 30 秒),再用 open 打开同一个 bundle,不会多开实例。相关代码在 MacApplicationRelauncher 和 ApplicationRestartAction。
  • LSP 控制中心:已迁移的语言重新给出引导,分四种状态:未安装、旧包仍在、待重启、已禁用。
  • Intelephense 缺失提示:改为说明需要通过 npm install -g intelephense 安装,并解释不随插件分发是因为许可证限制。
  • CI:删除 ci-macos.yml skip 正则里已不存在的 LitheGoSupportModuleTests。上一轮 Plugin CI 失败是冷缓存下 “Build Swift tests” 超过 20 分钟时限(编译进度 1414/1416),不是测试失败。
  • Agent Note 和功能矩阵(go-support-plugin、php-optional-plugin、plugin-marketplace)已同步更新验证步骤和证据文件。

Go Support and PHP Support leave the official plugin set and continue as
community plugins io.github.lithe-idea.go-support and
io.github.lithe-idea.php-support in their own repositories, listed in
Lithe Store from 0.1.0.

- OfficialPluginCatalog keeps the retired dev.lithe IDs with their
  publisherPackage signature requirement and records the community
  replacement; publishedEntries hides them from official entry points.
- The marketplace gives retired IDs no official source, listing or update,
  even from a stale cached official index; uninstall stays available.
- Plugin Management shows a "moved to the community" notice naming the
  replacement ID and asks the user to uninstall first.
- The official index and release config are empty; the release flow is kept
  and tested with a synthetic plugin.
- Remove the Intelephense download/assembly script and its worktree
  resource; the community PHP plugin uses the user's own Intelephense
  because its licence forbids redistribution.
- Retired manifests move to test fixtures; docs, contracts, feature matrix
  and Agent Notes updated.
@ghfind-review ghfind-review Bot added the review: medium ghfind author score; see https://ghfind.com label Oct 20, 2026
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review October 20, 2026 02:06
@lithe-code-review

lithe-code-review Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Lithe Review

结论: ❓ 信息不足
范围: preview ← feat/community-go-php-plugins · head: 2f239ad

Scope Check

  • 关联 Issue 或需求是否完成:未找到可验证的关联 Issue。PR 摘要描述了迁移目标,但无法从源码核实完成度。
  • 已完成范围:收到的确定性清单标为完整,列出 35 个文件;可据此确认审查目标范围,但不能确认实际差异内容。
  • 未完成范围:未能读取 base/head 文件或 diff,也未能追踪实现与调用链,因此无法判断功能正确性和回归风险。
  • 是否复用了已有上游能力,或对自研边界给出充分证据:无法核实。收到的摘要描述将 PHP 语言服务器改为启动用户安装的 Intelephense,但缺少插件源码和相关决策文件证据。
  • 每个 Finding 是否由本次变更引入或加剧:没有可由现有材料支持的 Finding;这不代表源码审查未发现问题。
  • 是否属于本次变更职责范围:提供的清单包含插件市场、插件管理 UI、发布脚本、契约和测试变更;其具体行为尚未核实。

Suggestions

  • 请为 PluginManagementView 等可见 UI 改动补充受影响界面的截图;已有界面修改应附前后对比。当前上下文没有截图,视觉效果未验证。
  • 要形成可供合并判断的代码结论,需要读取指定 base...head 的聚焦 diff 和相关文件。本轮没有可用的 Git 或文件读取工具,无法完成这一步。

Summary

当前材料只足以确认 PR 的报告范围、摘要和所提供的验证结果,无法审查实现细节。因此结论为信息不足,不据此判断通过或提出代码缺陷。

Verification

  • 实际检查的文件、提交和调用链:仅检查了请求中提供的文件清单、PR 摘要、SHA 和 Check Run 列表;未读取 Git diff、base 文件或源码调用链。无法从工作区加载 develop-lithe 和 write-stable-tests Skill。
  • 已提供的测试或 CI 结果:PR 上下文报告了本地测试和验证命令结果,以及部分 Check Run 状态;这些结果未独立核实。
  • 本次未运行的测试:未运行。审查按要求保持只读。
  • 仍存在的非阻塞风险或平台验证缺口:代码和相关规则未能检查;PR 上下文也说明尚未在真机验证“旧包迁移提示 → 卸载 → 安装社区版”的完整流程。受影响 UI 未提供截图,视觉效果尚未验证。

@xiaoyumuxi xiaoyumuxi left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整体迁移方向合理:保留旧官方 ID 的 publisher 签名约束,并通过新社区 ID 进行显式迁移,避免了信任模型的静默降级。

不过当前迁移路径还存在启用状态继承和卸载时序两个问题,建议合并前修复(详见行内 P1/P2 评论)。此外:

  • [P3] MacRuntimeToolDiscovery.swift 的 PHP 语言服务器恢复提示仍提到插件内置 Intelephense / 重新安装插件;社区版已经改为用户自行安装 intelephense,建议更新为 npm install -g intelephense 等正确操作。
  • 建议补一条真实迁移链路的回归测试:旧官方 Go/PHP 已启用 → 卸载并重启 → 安装社区版并重启 → 检查模块启用状态及 LSP / Run / Test 是否可用。当前的 marketplace 测试主要验证索引过滤与来源/更新状态,还没有覆盖这个生命周期。

本 Review 为源码静态检查,未运行真机迁移测试。

Comment thread macos/Sources/Lithe/Views/App/PluginManagementView.swift
Comment thread macos/Sources/Lithe/Views/App/PluginManagementView.swift Outdated
Comment thread macos/Sources/Lithe/Views/Language/LSPControlCenterView.swift Outdated
- Uninstalling an enabled plugin no longer persists its modules as disabled,
  so the community replacement installs enabled; explicit "off" is kept.
- Marketplace blocks installing the community Go/PHP package while the
  retired official package is still on disk and explains the order.
- Add an IDEA-style "Restart Lithe" button (management banner, detail,
  marketplace, LSP control center) that quits through the normal
  confirmations and relaunches via a bounded detached helper.
- LSP control center guides migrated languages to Lithe Store again.
- Intelephense missing-tool guidance explains npm install and the licence.
- Drop the stale LitheGoSupportModuleTests skip from macOS CI.
@xiaoyumuxi
xiaoyumuxi merged commit 6d4f669 into preview Oct 20, 2026
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant