Skip to content

feat(cli): add launch policy and opt-in shell registration rules - #129

Merged
xiaoyumuxi merged 1 commit into
mainfrom
feat/cli-single-file-mode
Nov 20, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
feat/cli-single-file-mode

Conversation

@xiaoyumuxi

@xiaoyumuxi xiaoyumuxi commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Refs 1lck/Lithe-IDEA#2166

直接传入文件时,Lithe 需要进入独立文本编辑模式,并且在注册 CLI 时保留用户已有的 shell/PATH 配置。本 PR 把启动与注册的共享规则放到 Core,原生文件系统、注册表和窗口操作由桌面适配器执行。

改动

  • 新增 application.cli.planLaunch:解析一个有界路径参数、--、帮助和版本选项,以及托管启动器使用的 --cli 脱离终端标记。
  • 新增 application.cli.openTarget:根据适配器观察到的文件/目录类型选择项目或单文件模式,并返回插件策略和单文件命令白名单。单文件允许按需终端,不允许项目、Git、运行、调试或插件服务。
  • 新增 application.cli.editRegistration:对 zsh/bash/sh/fish 的托管配置块和 Windows 用户 PATH 执行 inspect/install/remove;保留无关内容,拒绝畸形标记,并识别完整的 Lithe 启动器所有权。
  • 在 lithe-platform 中集中 Unix/batch 启动器转义和 Windows 路径等价规则,两个平台以数据参数测试。
  • 接入命令分发,更新应用 API 契约和 rust/fixtures/application/cli-v1.json;不修改插件协议或 SDK。

验证

命令 结果
cargo test --manifest-path rust/Cargo.toml -p lithe-core-rules -p lithe-platform 通过;覆盖启动计划、模式和命令策略、两平台注册规则、转义及共享 fixture
cargo clippy --manifest-path rust/Cargo.toml -p lithe-core-rules -p lithe-platform --all-targets --target x86_64-pc-windows-msvc -- -D warnings 通过;Windows 目标编译检查
cargo fmt --manifest-path rust/Cargo.toml --all -- --check 通过
注释规范检查(core-rules、platform) 通过
node scripts/rust-core/verify-platform-tests.mjs 通过,52 个 crate
宿主 TestCLISharedFixture 及受影响 CLI/单文件/终端回归、竞态测试 链接本提交,在 macOS 通过
git diff --check 通过

按用户要求仅在本地测试改动范围。受契约、fixture 和 Cargo.lock 影响,CI 的 affected-crates 会选择更大范围;本地没有运行完整 workspace。Windows 规则测试和交叉编译不代表 HKCU/PATH、环境广播、cmd/PowerShell 或 ConPTY 的原生验收;本机没有可用的 Windows 来宾。

配套宿主与合入状态

宿主配套 Draft PR:1lck/Lithe-IDEA#2225 。本 PR 已合入为 6c84d32d4b82e358b41f5a7edf78f2a0ca7a3695,宿主的 PINNED_CORE_REVISION 更新已单独提交为 1lck/Lithe-IDEA#2226 。合入提交与本地已测试的 ea502256b6537ff6aec7dff35892452cc5e8e7af 的 tree 都是 9ce26046821f9a1d65dfbaef529504dc62abac78,源码内容相同。

本 PR 最初以 Draft 创建,GitHub 当前记录已合入;宿主 #2225 也已被账号合入;Core pin 更新 #2226 以 Draft 提交。原生平台验收和公开 UI 截图证据的限制仍见宿主说明。

既有债务

自查发现 Core 原有的 rust/crates/core/src/tests/published_build_plugins.rs 包含真实 Maven/Gradle 插件 fixture,已由现存 Issue 1lck/Lithe-IDEA#2174 跟踪。本次新增 CLI 规则和测试不依赖具体插件,也没有在本 PR 顺手改动该测试。

@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 20, 2026 06:56
@xiaoyumuxi
xiaoyumuxi merged commit 6c84d32 into main Nov 20, 2026
6 of 7 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