fix(auth): clearer import-brave error + add to README/skill docs#91
Open
jprichardson wants to merge 1 commit into
Open
fix(auth): clearer import-brave error + add to README/skill docs#91jprichardson wants to merge 1 commit into
jprichardson wants to merge 1 commit into
Conversation
extractFromBrave() wrapped its body in `try { ... } catch { return null }`,
which swallowed the specific "Allow JavaScript from Apple Events is turned
off" failure behind a generic "ensure you're logged in" message. That toggle
is OFF by default in Brave, so first-run import-brave consistently looked
like an auth problem instead of a one-time browser setting.
- Detect the AppleScript-disabled error in osascript() and throw a typed
BraveAppleScriptDisabledError with an actionable message (menu path +
re-run hint). Other failure modes keep the existing null-return behavior.
- import-brave's command description and fallback error now both reference
the View -> Developer -> Allow JavaScript from Apple Events requirement.
- README: list import-brave in the command tree and manual-imports block,
plus a NOTE explaining the Chromium AppleScript-JS prereq for
import-brave / import-chrome.
- Skill docs: add import-brave to SKILL.md (fallback section) and
references/commands.md (auth command list). SKILL.md's fallback intro
updated to "Brave/Chrome/Firefox" since Brave is in the auto-detection
chain (context-client-resolver.ts).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
import-bravesilently failed on first run becauseextractFromBrave()wrapped its body intry { ... } catch { return null }, hiding the specific "Allow JavaScript from Apple Events is turned off" failure behind a generic "ensure you're logged in" message.agent-slack auth import-braveconsistently looks like an auth problem instead of a one-time browser setting.import-braveto README + skill docs, where it was previously undocumented despite being wired into the auto-detection fallback chain (src/cli/context-client-resolver.ts:138).What changed
src/auth/brave.ts: detect the AppleScript-disabled error inosascript()and throw a typedBraveAppleScriptDisabledErrorwith an actionable message (menu path + re-run hint). Other failure modes keep the existing null-return behavior, so the generic "ensure you're logged in" message still applies when no Slack tab is open or cookie decryption fails.src/cli/auth-command.ts:import-brave's description and fallbackthrow new Errormessage both reference theView → Developer → Allow JavaScript from Apple Eventsrequirement.README.md: listimport-bravein the command tree and manual-imports block; add a NOTE block explaining the AppleScript-JS prereq applies to bothimport-braveandimport-chrome.skills/agent-slack/SKILL.md: add a Brave fallback section and update the intro toBrave/Chrome/Firefox(Brave is already in the auto-fallback chain).skills/agent-slack/references/commands.md: addimport-braveto the auth command list with the AppleScript prereq inline.Notes
src/auth/chrome.tshas the same bug pattern (identicaltry { ... } catch { return null }wrapping + identicalexecute t javascriptAppleScript path). Out of scope for this PR — happy to send a follow-up.Test plan
bun run typecheckcleanbun run test— 198/198 passbun run format:checkcleanagent-slack auth import-bravehappy path: still imports tokens (2 workspaces in my case)View → Developer → Allow JavaScript from Apple EventsOFF) and confirmedosascript()reports the exact marker string that the new detection relies on🤖 Generated with Claude Code