fix: improve onboarding for macOS — bun PATH detection + provider auto-activation#240
Open
lairulan wants to merge 2 commits intoop7418:mainfrom
Open
fix: improve onboarding for macOS — bun PATH detection + provider auto-activation#240lairulan wants to merge 2 commits intoop7418:mainfrom
lairulan wants to merge 2 commits intoop7418:mainfrom
Conversation
- electron/main.ts: add ~/.bun/bin to getExpandedShellPath() so Claude CLI installed via bun is detectable in the Electron GUI context (macOS GUI apps do not inherit shell PATH from .zshrc/.bash_profile) - src/lib/platform.ts: add ~/.bun/bin to getExtraPathDirs() and ~/.bun/bin/claude to getClaudeCandidatePaths() for consistent PATH expansion on both renderer and main process sides - src/lib/db.ts (createProvider): set is_active=1 when inserting a new provider and deactivate all existing providers first, so the newly created provider is immediately usable without a manual toggle - src/lib/claude-client.ts: add provider-activation hint to the "exited with code 1" error message, helping users diagnose the silent failure caused by an inactive provider
|
@lairulan is attempting to deploy a commit to the op7418's projects Team on Vercel. A member of the Team first needs to authorize it. |
Replace the blanket "deactivate all then activate new" logic in createProvider() with a more conservative approach: - If no active provider exists (e.g. first-time onboarding), the new provider is inserted with is_active = 1 so it works immediately - If an active provider already exists, the new provider is inserted with is_active = 0, leaving the existing selection untouched This avoids silently deactivating a provider the user is already using when they add a second/backup provider via Settings.
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.
Problem
Three related issues that silently break the initial setup experience on macOS, especially for users who install Claude CLI via
bun:1. Claude CLI not detected when installed via
bun(macOS)macOS GUI apps (Electron) do not inherit the user's shell
PATHfrom.zshrc/.bash_profile. The PATH expansion helpers (getExpandedShellPathinelectron/main.tsandgetExtraPathDirs/getClaudeCandidatePathsinsrc/lib/platform.ts) did not include~/.bun/bin, so users who installclaudeviabun install -g @anthropic-ai/claude-codewould always get "Claude CLI not found", even though it was correctly installed.2. New API provider created with
is_active = 0createProvider()insrc/lib/db.tshard-codedis_active = 0for every INSERT. Users who complete the setup wizard and add their first provider end up with a silently inactive provider — all subsequent calls fail with a cryptic error despite a successful-looking configuration flow. Additionally, there was no logic to deactivate existing providers before inserting the new one, which could leave multiple active providers in an inconsistent state.3. Unhelpful error message for "exited with code 1"
The error message shown when Claude CLI exits with code 1 listed several possible causes but omitted the inactive-provider scenario introduced by bug #2, making it hard for users to self-diagnose.
Changes
electron/main.ts~/.bun/bintogetExpandedShellPath()src/lib/platform.ts~/.bun/bintogetExtraPathDirs(); add~/.bun/bin/claudetogetClaudeCandidatePaths()src/lib/db.tscreateProvider(): deactivate all existing providers before INSERT; setis_active = 1for the new providersrc/lib/claude-client.tsTesting
claudeinstalled viabun install -g