[Feature] 运行配置支持"运行前步骤":启动前先执行用户指定的编译 / 构建命令(对标 IDEA Before launch)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust, typescript
Research direction
Start by reading shared/contracts/rust-core-api.md for the preLaunchSteps contract, then compare rust/lithe-core/src/execution/configuration.rs and the implementation notes at .agents/notes/implemented/feature/2026-09-17-standalone-java-compile-then-run.md. The work spans configuration storage, Core validation, both platform editors, execution feedback, and trust confirmation. Done means custom steps run before Run and Debug on macOS and Windows, stop startup on failure, and report the outcome in the console.
Written by the indexing model from the issue text.
Description
Problem to solve / 要解决的问题
有些项目只有在运行前先执行一条特定的编译 / 构建命令才能启动,Lithe 目前没法给运行配置加上这一步。
社区用户反馈的典型场景:
- 老框架项目(非 Spring Boot,页面用 XML 描述),自动识别不到启动类;有的模块不走统一的 Maven 生命周期,要先用别的构建工具或 shell 脚本单独编译某些文件 / 模块,应用才能起来。
- 在 IntelliJ IDEA 里,这类项目靠运行配置的 Before launch 列表处理("Build"、"Build Project"、"Run External tool"、"Run Maven Goal"、执行另一个运行配置等),工具栏的锤子按钮(Build Project / Build Module)也可以单独编译。不配这一步,IDEA 也跑不起来。有用户说为了跑这样一个项目折腾了一整天。
Lithe 现状:
- 启动计划已有
preLaunchSteps(shared/contracts/rust-core-api.md):宿主按顺序执行,任一步非零退出就中止运行并回传诊断。但这些步骤只由 Core 自动生成(独立 Java 文件的javac、Maven 直启前的resources:resources),用户不能自己加。 - 运行配置有 generated / project / local 三层,macOS、Windows 都有编辑器,但没有"运行前步骤"这一栏。
- 目前只能每次手动在终端里先编译再点运行,或者把编译和启动写成一条 shell 命令,这样就丢了 JDK 解析、调试、服务管理等运行配置的上下文。
影响:这类老项目在 Lithe 里没法一键运行 / 调试,迁移过来的用户会直接卡住。
Proposed solution / 建议方案
在运行配置里加 "运行前步骤(Before launch)",让用户按顺序配置要先执行的命令:
- 配置与存储:project / local 层的运行配置增加有序的运行前步骤列表。每一步至少包括:可执行程序与参数(argv 数组,不默认拼 shell 字符串,需要 shell 时显式选
sh -c/cmd /c)、可选工作目录(项目相对路径)、可选环境变量;继承运行配置自己的环境和工具链解析规则。 - Core 负责校验和下发:Rust Core 校验路径(拒绝越出工作区的相对路径等),把用户步骤放进同一个
preLaunchSteps,排在 Core 自动生成的步骤(如 Maven 资源处理)前面或后面,顺序要写进契约。宿主沿用现有"按序执行、失败即止"的编排,不另做一套执行器。 - 编辑界面:macOS 和 Windows 的运行配置编辑器各加一个"运行前步骤"区域,支持增、删、排序、编辑,文案走
shared/i18n。 - 执行反馈:步骤输出进入同一个运行控制台,并标明当前是第几步;步骤失败就中止启动并显示失败的步骤和退出码;取消运行时连同运行前步骤的进程一起清理。
- 安全:project 层的配置来自仓库,可能是别人提交的,第一次执行其中的运行前命令前要像 IDEA 打开不受信任项目那样提示确认;local 层是用户自己写的,不用提示。
可以分阶段交付:先做"自定义命令"步骤(覆盖上面的场景);之后再考虑"执行某个构建任务(Build Provider 任务 / Maven Goal)""先运行另一个运行配置""只编译当前模块"等 IDEA 里的其他步骤类型。
验收:
- 给一个运行配置加一条运行前命令(例如执行项目里的编译脚本)后,点运行会先执行它;成功后才启动主进程,失败时不启动,并在控制台显示原因。
- Run 和 Debug 都会执行运行前步骤。
- macOS、Windows 行为一致。
Target platform / 目标平台
Cross-platform / 跨平台
Area / 模块
Run / 运行
Priority / 优先级
P1 / 尽快处理:使用体验大幅下降,但通常仍可继续使用
Alternatives considered / 已考虑的替代方案
- 手动在终端里先编译再点运行:每次都要记得做,忘了就会跑旧代码或启动失败。
- 把编译和启动写成一条 shell 自定义命令:丢了 Lithe 对 JDK、classpath、调试和服务进程的管理,也不能跨平台。
- IntelliJ IDEA:运行配置的 Before launch 列表(Build、Build Project、Run External tool、Run Maven Goal、Run Another Configuration 等),这条建议就是参照它。
- VS Code:
launch.json的preLaunchTask引用tasks.json里的任务。
Additional context / 补充信息
- 相关:#1180(构建插件注入的运行任务)解决的是"识别出运行入口";这条要解决的是"运行前先执行用户指定的构建步骤",两者互补,不重复。
- 相关:#1133(运行前构建不同步资源文件)是 Core 自动生成的运行前步骤;用户步骤应该复用同一条
preLaunchSteps链路。 - 现有实现参考:
shared/contracts/rust-core-api.md(preLaunchSteps契约)、rust/lithe-core/src/execution/configuration.rs(生成preLaunchSteps)、.agents/notes/implemented/feature/2026-09-17-standalone-java-compile-then-run.md(宿主执行运行前步骤的编排)。 - 来源:社区群里的讨论,一位用户的老框架项目需要运行前单独编译才能启动,另一位用户也遇到过同样的问题。
Checklist / 提交前检查
- I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 151
- Avg merge
- 11h 57m
- Merged PRs (30d)
- 363
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from 1lck/Lithe-IDEA
-
area:editor bug P0 platform:macos review: low
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
1lck/Lithe-IDEA#1118 · 2 comments ·
Maintainers usually reply within 1 day
-
area:other bug P1 platform:windows review: no-score
Difficulty 4/5 3-5 days Newbie friendliness 52/100
1lck/Lithe-IDEA#1604 · 1 comment ·
Maintainers usually reply within 1 day
-
area:editor enhancement issue-form:feature P0 platform:windows review: low
Difficulty 5/5 Over a week Newbie friendliness 25/100
1lck/Lithe-IDEA#1603 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] macOS 重启恢复设置窗口后持续空白Possibly taken @lin-coco claimed this 1 day ago. Openarea:settings bug claimed P1 platform:macos review: medium
1lck/Lithe-IDEA#1599 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug] Windows: Git 2.48.1 被判定为低于 2.31,提示 "Git 2.31 or newer is required",仓库无法读取Possibly taken @AACS111 claimed this 2 days ago. Openarea:git bug claimed issue-form:bug P1 platform:windows review: low
Difficulty 4/5 3-5 days Newbie friendliness 52/100
1lck/Lithe-IDEA#1566 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
excaliburjs/Excalibur#3895 ·
Maintainers usually reply within 3 days
-
infer_audio_type only recognises one MPEG Layer III frame header, so most MP3 files are rejectedPossibly taken @Steve-20-ai claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Earn report crashes with "RangeError: Invalid time value" when a report row has an unparsable timestampPossibly taken @Gurkaran18 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
joinmarket-webui/jam#1588 ·
Maintainers usually reply within 3 days
-
BeOS .json missingOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mihaip/infinite-mac#475 ·