Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Feature] 运行配置支持"运行前步骤":启动前先执行用户指定的编译 / 构建命令(对标 IDEA Before launch)

Open
#1,616 0 comments 0 reactions 0 assignees View on GitHub

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
Domain
devtools, tooling

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

area:run enhancement P1 platform:cross-platform review: medium
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)",让用户按顺序配置要先执行的命令:

  1. 配置与存储:project / local 层的运行配置增加有序的运行前步骤列表。每一步至少包括:可执行程序与参数(argv 数组,不默认拼 shell 字符串,需要 shell 时显式选 sh -c / cmd /c)、可选工作目录(项目相对路径)、可选环境变量;继承运行配置自己的环境和工具链解析规则。
  2. Core 负责校验和下发:Rust Core 校验路径(拒绝越出工作区的相对路径等),把用户步骤放进同一个 preLaunchSteps,排在 Core 自动生成的步骤(如 Maven 资源处理)前面或后面,顺序要写进契约。宿主沿用现有"按序执行、失败即止"的编排,不另做一套执行器。
  3. 编辑界面:macOS 和 Windows 的运行配置编辑器各加一个"运行前步骤"区域,支持增、删、排序、编辑,文案走 shared/i18n。
  4. 执行反馈:步骤输出进入同一个运行控制台,并标明当前是第几步;步骤失败就中止启动并显示失败的步骤和退出码;取消运行时连同运行前步骤的进程一起清理。
  5. 安全: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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 1lck/Lithe-IDEA

All issues in 1lck/Lithe-IDEA

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.