feat(runtime): enhance PATH at startup for all downstream spawn sites#193
Merged
Conversation
Adds aionui_runtime::shell_env::enhance_process_path(), invoked from aionui-app's fn main() before the tokio runtime is constructed. It merges three layers into the current process PATH: 1. Bundled bun directory (highest priority). 2. Platform extra bins: ~/.bun/bin, ~/.cargo/bin, ~/go/bin, ~/.deno/bin, ~/.local/bin, ~/.volta/bin. Windows adds %APPDATA%\npm, %LOCALAPPDATA%\pnpm, %LOCALAPPDATA%\fnm_multishells, Git cmd/bin, ProgramFiles\nodejs, %SCOOP%\shims. 3. Current PATH (inherited from the launching process). 4. Login-shell PATH (Unix only, 3s timeout) — fixes launchd / Finder / Windows-shortcut / systemd-service starts where the inherited PATH is nearly empty. Uses std::env::split_paths / join_paths and PathBuf dedup to be cross-platform correct. All 23 existing Command::new / which::which sites across 6 crates automatically inherit the enriched PATH — no per-site migration. aionui-app switches from #[tokio::main] to a manual tokio::runtime::Builder::new_multi_thread().enable_all() so we can run the unsafe env::set_var call while single-threaded, as required by Rust 2024. A structured info log "startup: PATH ready path_segments=N path_len=M" fires after tracing subscriber init, so the enhancement is observable without logging the full PATH content. Design: docs/superpowers/specs/2026-05-08-startup-path-enhance-design.md Plan: docs/superpowers/plans/2026-05-08-startup-path-enhance.md
d245deb to
60c6521
Compare
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/.bun/bin`, `/.cargo/bin`, `~/.local/bin`, Windows `%APPDATA%\npm`, Git, Scoop, …) → 当前 PATH → login-shell $PATH (Unix, 3s 超时)。之后所有下游 `which::which(...)` / `Command::new(...)` 自动受益。23 个现有 `Command::new` / `which::which` 调用点未改动——它们通过 `env::var("PATH")` 继承自动受益。
Test plan
Design & Plan
Follow-up
后续 PR (per Plan §Non-Goals / Follow-up):
🤖 Generated with Claude Code