Skip to content

feat(run-config): 运行配置的启动前步骤 - #88

Merged
1lck merged 1 commit into
mainfrom
feat/before-launch-steps
Nov 18, 2026
Merged

1lck merged 1 commit into
mainfrom
feat/before-launch-steps

Conversation

@1lck

@1lck 1lck commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

关联 Issue

类型

feat:运行配置新增 beforeLaunch,新增宿主命令 runConfig.beforeLaunch

改动

对应 IntelliJ IDEA 的 “Before launch: Run Another Configuration”。展开、校验和确认指纹都放在 Core,各宿主行为一致,宿主只按顺序启动进程。

  • rust/crates/execution/src/configuration/before_launch.rs(新增)
    • RunConfiguration.beforeLaunch: [{configuration: <id>}]:最多 16 项,非空、≤256 字节、不能引用自己(validate_shape,由 validate_configuration 调用)。
    • 一层写了 beforeLaunch 就整体替换下层的列表;local.yaml 写空列表可以隐藏项目文件里的步骤。
    • runConfig.beforeLaunch {root, configurationId, localDocument?}:展开嵌套步骤(被引用配置自己的步骤先运行),展开后最多 32 步;返回 {status:"ok", steps:[{configurationId,name,summary}], confirmation} 或 {status:"rejected", refusal:{code, configurationId}},原因码 notFound / notAllowed(不是内置进程运行)/ unavailable / cycle / tooLong。
    • 展开时只要用到项目文件写的列表,confirmation 就给出 fingerprint:对用到的列表和这些步骤启动的命令定义求 sha256。宿主按指纹记住用户的确认,列表或命令一改就重新询问;只用到 local.yaml 的列表时为 null。
    • check_edit:保存时用同一套规则检查,成环报 conflict。
  • form.rs:editorForm 在最后加字段 beforeLaunch(类型 beforeLaunch,candidates:[{id,name}] 是除自己以外可用的内置进程运行);saveConfiguration 读写 values.beforeLaunch,错误码 notFound / notAllowed / unavailable / conflict / tooLong。
  • editing.rs / requests.rs:runConfig.updateOptions 接受可选的 beforeLaunch: [ids];本地层写空列表时,若项目层有步骤就写 beforeLaunch: [] 覆盖,否则删除该键。
  • document.rs:RunConfiguration.before_launch(为空时不序列化),provider_runs.rs 跟进。
  • 协议:command.rs 解析 runConfig.beforeLaunch,dispatcher/run_config.rs 分发。
  • 契约:run-configuration-v2.schema.json 增加 beforeLaunch;rust-core-api.md 命令表加一行,并新增 “Steps before launch” 一节。

没有改插件契约、能力版本或插件函数协议,插件无需改动。旧宿主不调用 runConfig.beforeLaunch,会忽略配置里的 beforeLaunch。

验证

  • cargo test -p lithe-core before_launch(core/src/tests/before_launch_steps.rs 3 个测试:嵌套展开与确认指纹、拒绝原因、编辑校验与本地层清空)
  • cargo test -p lithe-core run_configuration(编辑器字段列表加 beforeLaunch)
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt --check
  • 宿主用本分支构建的 Core 跑通 runconfig_before_launch_test.go(真实 Core + 系统 shell)。

🤖 Generated with Claude Code

运行配置新增 beforeLaunch,引用内置进程运行,按顺序在配置启动前运行。
Core 展开嵌套步骤、校验引用并对项目文件列出的步骤给出确认指纹;
编辑器表单新增 beforeLaunch 字段,updateOptions 可修改步骤列表。

Refs 1lck/Lithe-IDEA#1616

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1lck
1lck marked this pull request as ready for review November 18, 2026 02:36
@1lck
1lck merged commit bb4832e into main Nov 18, 2026
1 of 6 checks passed
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