Commit 4dfde9e
committed
fix(platform): surface Nix-managed agent CLI install paths
The packaged macOS (and Linux) Desktop app did not discover agent
CLIs installed through nix-darwin `environment.systemPackages` or
per-user `nix profile install`. After launching from Finder and
rescanning, Codex / Claude Code / Gemini resolved cleanly from a
terminal but were reported as not found on `PATH`.
Root cause: in a GUI-launched Electron process the inherited `PATH`
is minimal (launchd does not source the user's shell rc), so
discovery relies on `wellKnownUserToolchainBins` in
`packages/platform/src/toolchain.ts`. The helper's well-known
list covered Homebrew, npm/nvm/fnm/mise/asdf, Deno, Go, pyenv,
Scoop, Volta, Vite+, Kimi, Bun, Cargo and the system Homebrew
locations, but did not include the standard Nix install roots:
- `/run/current-system/sw/bin` (NixOS / nix-darwin system profile)
- `~/.nix-profile/bin` (per-user Nix profile)
Both are documented well-known paths in Nix documentation and are
the canonical locations CLIs installed via `environment.systemPackages`
or `nix profile install` end up in.
Changes:
- `packages/platform/src/toolchain.ts`:
- Add `~/.nix-profile/bin` to the user-level CLI install list
(alongside Deno / Go / pyenv) so single-user Nix installs are
surfaced the same way Homebrew/etc are. Best-effort — a missing
dir contributes nothing; the existing `<dir>/bin` join behaviour
is preserved.
- Add `/run/current-system/sw/bin` to the
`includeSystemBins`-gated block, next to `/opt/homebrew/bin`
and `/usr/local/bin`. Same rationale: a NixOS / nix-darwin
system-installed CLI lives here, and a GUI-launched daemon
needs the explicit probe to find it.
- `packages/platform/tests/index.test.ts`:
- Extend the existing "Deno, Go, pyenv" user-level test to also
assert `~/.nix-profile/bin` is returned.
- Extend both `includeSystemBins` true/false tests to also
assert `/run/current-system/sw/bin` is included / omitted
accordingly. Two assertions in two existing tests, no new
test cases to keep the file dense.
Verified: `pnpm --filter @open-design/platform test` passes 76/76
tests, `pnpm --filter @open-design/platform typecheck` clean.
Fixes #6121
Signed-off-by: xxiaoxiong <2482929840@qq.com>1 parent 6b90486 commit 4dfde9e
2 files changed
Lines changed: 24 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
| 146 | + | |
143 | 147 | | |
144 | 148 | | |
145 | 149 | | |
| |||
167 | 171 | | |
168 | 172 | | |
169 | 173 | | |
170 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
171 | 183 | | |
172 | 184 | | |
173 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
808 | | - | |
809 | | - | |
810 | | - | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
811 | 812 | | |
812 | 813 | | |
813 | 814 | | |
814 | 815 | | |
815 | 816 | | |
816 | 817 | | |
| 818 | + | |
817 | 819 | | |
818 | 820 | | |
819 | 821 | | |
| |||
1112 | 1114 | | |
1113 | 1115 | | |
1114 | 1116 | | |
1115 | | - | |
| 1117 | + | |
1116 | 1118 | | |
1117 | 1119 | | |
1118 | 1120 | | |
1119 | 1121 | | |
1120 | 1122 | | |
| 1123 | + | |
1121 | 1124 | | |
1122 | 1125 | | |
1123 | 1126 | | |
1124 | 1127 | | |
1125 | 1128 | | |
1126 | | - | |
| 1129 | + | |
1127 | 1130 | | |
1128 | 1131 | | |
1129 | 1132 | | |
1130 | 1133 | | |
1131 | 1134 | | |
| 1135 | + | |
1132 | 1136 | | |
1133 | 1137 | | |
1134 | 1138 | | |
| |||
0 commit comments