Skip to content

feat(build-providers): buildProviders 1 按源文件找运行入口(当前文件运行) - #89

Merged
1lck merged 3 commits into
mainfrom
feat/run-entrypoints
Nov 18, 2026
Merged

1lck merged 3 commits into
mainfrom
feat/run-entrypoints

Conversation

@1lck

@1lck 1lck commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

关联 Issue

类型

feat:buildProviders 1 新增入口运行和 lithe/build/runEntrypoints,litheBuild 升到 1;新增宿主命令 build.runEntrypointsPlan / build.decodeRunEntrypoints

改动

插件声明 entrypoints: true 的运行后,宿主可以把一个源文件交给插件,插件回答文件里能启动的入口(例如带 main 方法的类),宿主把入口存成运行配置并运行。宿主和 Core 不按语言判断入口。

  • 契约 / 清单
    • manifest/run.rs:RunDeclaration.entrypoints。入口运行必须 source=provider、execution=application,不能有 fromTargets、fromTasks、参数、扩展或调试。
    • plugin-manifest/validation.rs:声明入口运行要求 requires.buildProviders >= 1。
    • plugin-model/capabilities.rs:buildProviders 支持 [0, 1]。
    • plugin-manifest.schema.json:entrypoints 属性及约束。
  • 新命令(run_entrypoints.rs、commands.rs、command.rs、dispatcher/build.rs)
    • build.runEntrypointsPlan:请求带 file(工作区相对路径,必须在实例根目录内),不接受 project/outputFile;规划 lithe/build/runEntrypoints,解码器 litheRunEntrypoints。
    • build.decodeRunEntrypoints:校验 {format:"litheRunEntrypoints", version:0, entrypoints:[{run,name,entrypoint,project}]},最多 64 项;运行必须是入口运行,名称 1–256 字节无控制字符,入口 1–4096 字节无 NUL,项目在根目录内;按插件顺序去重,答案不合法时整份拒绝。
  • 运行准备(run_preparation.rs):prepareRunPlan 的 target 改为可选。入口运行必须不带目标、带 launchOptions.entrypoint;目标运行仍要求目标和标签匹配。
  • 运行配置(execution/configuration)
    • BuildProviderRunReference.targetID 可为空(入口运行),projectID 仍必填。
    • runConfig.createUserConfiguration 接受 entrypoint,写进 extensions.build-run.entrypoint,入口参与身份判断:同一入口复用,不同入口各一条。
  • 插件函数协议(lsp-client/build_provider.rs):litheBuild 提供 [0, 1];lithe/build/runEntrypoints 属于构建方法。
  • SDK
    • Java:Protocol.BUILD_RUN_ENTRYPOINTS、Backend.onRunEntrypoints、格式 litheRunEntrypoints,按宿主提供的版本协商最新的一个(BUILD_VERSION = 1)。
    • Node:protocol.mjs、backend.mjs、index.d.ts 同步。
    • Rust:诊断操作列表。
    • 发布版本号不变,下一次 SDK 发布带上。
  • 文档:契约 README 新增 “Run entrypoints (buildProviders 1)” 一节;rust-core-api.md 命令表与详细说明;capabilities-and-versions.md、domains/build-providers.md、protocol-changelog.md(buildProviders 1、litheBuild 1);fixture build-provider-run-entrypoints.plugin.json、build-run-entrypoints.json。

旧宿主只声明 buildProviders 0,不会安装声明入口运行的插件版本;旧插件不受影响。

验证

  • cargo test -p lithe-core provider_run_entrypoints_are_found_by_file_and_start_without_a_target(规划、解码拒绝、无目标准备运行)
  • cargo test -p lithe-core entrypoint_runs_are_saved_per_entrypoint_without_a_target(按入口保存、复用、启动选项)
  • cargo test --workspace(含 lsp-engine 协商 litheBuild [0, 1] 的测试更新)
  • cargo clippy --workspace --all-targets -- -D warnings、cargo fmt --check
  • node shared/plugins/scripts/verify-docs.mjs、node shared/plugins/scripts/sdk-e2e.mjs
  • Node SDK npm test、Java SDK mvn test
  • 宿主用本分支构建的 Core 跑通合成插件测试 TestRunOnCurrentFileStartsTheEntrypointAndSavesItsConfiguration;Maven 插件用本分支的 Java SDK 跑通真实 Maven 的入口查找和入口运行检查。

🤖 Generated with Claude Code

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