Skip to content

Commit 57add95

Browse files
arhxamclaude
andcommitted
fix(shell): add ~/.local/bin to the Windows CLI resolver so native-installed providers are found
On Windows the process can start with a stale `PATH` that predates the installer writing to the User `Path`, so the resolver merges a fixed list of known CLI install directories into `PATH`. That list (in the shared `resolveKnownWindowsCliDirs` and its desktop twin `knownWindowsCliDirs`) included Bun and Scoop but not `%USERPROFILE%\.local\bin` — the directory the Claude native installer uses on Windows. So `claude.exe` at `%USERPROFILE%\.local\bin\claude.exe` was never discovered even though it was installed. Add `%USERPROFILE%\.local\bin` to both mirrored lists (kept in sync across the server-side resolver and the desktop shell environment). Updated both existing byte-for-byte tests. Closes #4846 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 parent e259dd2 commit 57add95

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎apps/desktop/src/shell/DesktopShellEnvironment.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ describe("DesktopShellEnvironment", () => {
230230
"C:\\Users\\testuser\\AppData\\Local\\Programs\\nodejs",
231231
"C:\\Users\\testuser\\AppData\\Local\\Volta\\bin",
232232
"C:\\Users\\testuser\\AppData\\Local\\pnpm",
233+
"C:\\Users\\testuser\\.local\\bin",
233234
"C:\\Users\\testuser\\.bun\\bin",
234235
"C:\\Users\\testuser\\scoop\\shims",
235236
"C:\\Custom\\Bin",

‎apps/desktop/src/shell/DesktopShellEnvironment.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const knownWindowsCliDirs = (env: NodeJS.ProcessEnv): ReadonlyArray<string> => [
158158
...trimNonEmpty(env.USERPROFILE).pipe(
159159
Option.match({
160160
onNone: () => [],
161-
onSome: (value) => [`${value}\\.bun\\bin`, `${value}\\scoop\\shims`],
161+
onSome: (value) => [`${value}\\.local\\bin`, `${value}\\.bun\\bin`, `${value}\\scoop\\shims`],
162162
}),
163163
),
164164
];

‎packages/shared/src/shell.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ describe("resolveKnownWindowsCliDirs", () => {
336336
"C:\\Users\\testuser\\AppData\\Local\\Programs\\nodejs",
337337
"C:\\Users\\testuser\\AppData\\Local\\Volta\\bin",
338338
"C:\\Users\\testuser\\AppData\\Local\\pnpm",
339+
"C:\\Users\\testuser\\.local\\bin",
339340
"C:\\Users\\testuser\\.bun\\bin",
340341
"C:\\Users\\testuser\\scoop\\shims",
341342
]);
@@ -476,6 +477,7 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
476477
"C:\\Users\\testuser\\AppData\\Local\\Programs\\nodejs",
477478
"C:\\Users\\testuser\\AppData\\Local\\Volta\\bin",
478479
"C:\\Users\\testuser\\AppData\\Local\\pnpm",
480+
"C:\\Users\\testuser\\.local\\bin",
479481
"C:\\Users\\testuser\\.bun\\bin",
480482
"C:\\Users\\testuser\\scoop\\shims",
481483
"C:\\Shell\\Bin",
@@ -524,6 +526,7 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
524526
"C:\\Users\\testuser\\AppData\\Local\\Programs\\nodejs",
525527
"C:\\Users\\testuser\\AppData\\Local\\Volta\\bin",
526528
"C:\\Users\\testuser\\AppData\\Local\\pnpm",
529+
"C:\\Users\\testuser\\.local\\bin",
527530
"C:\\Users\\testuser\\.bun\\bin",
528531
"C:\\Users\\testuser\\scoop\\shims",
529532
"C:\\Shell\\Bin",
@@ -564,6 +567,7 @@ effectIt.layer(NodeServices.layer)("resolveWindowsEnvironment", (it) => {
564567
).toEqual({
565568
PATH: [
566569
"C:\\Users\\testuser\\AppData\\Roaming\\npm",
570+
"C:\\Users\\testuser\\.local\\bin",
567571
"C:\\Users\\testuser\\.bun\\bin",
568572
"C:\\Users\\testuser\\scoop\\shims",
569573
"C:\\Windows\\System32",

‎packages/shared/src/shell.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,9 @@ export function resolveKnownWindowsCliDirs(env: NodeJS.ProcessEnv): ReadonlyArra
617617
...(appData ? [`${appData}\\npm`] : []),
618618
...(localAppData ? [`${localAppData}\\Programs\\nodejs`, `${localAppData}\\Volta\\bin`] : []),
619619
...(localAppData ? [`${localAppData}\\pnpm`] : []),
620-
...(userProfile ? [`${userProfile}\\.bun\\bin`, `${userProfile}\\scoop\\shims`] : []),
620+
...(userProfile
621+
? [`${userProfile}\\.local\\bin`, `${userProfile}\\.bun\\bin`, `${userProfile}\\scoop\\shims`]
622+
: []),
621623
];
622624
}
623625

0 commit comments

Comments
 (0)