Skip to content

fix(auth): clearer import-brave error + add to README/skill docs#91

Open
jprichardson wants to merge 1 commit into
stablyai:mainfrom
jprichardson:fix/import-brave-applescript-error
Open

fix(auth): clearer import-brave error + add to README/skill docs#91
jprichardson wants to merge 1 commit into
stablyai:mainfrom
jprichardson:fix/import-brave-applescript-error

Conversation

@jprichardson
Copy link
Copy Markdown
Contributor

Summary

  • import-brave silently failed on first run because extractFromBrave() wrapped its body in try { ... } catch { return null }, hiding the specific "Allow JavaScript from Apple Events is turned off" failure behind a generic "ensure you're logged in" message.
  • That toggle ships OFF in Brave (and every Chromium browser), so the very first agent-slack auth import-brave consistently looks like an auth problem instead of a one-time browser setting.
  • Adds import-brave to 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 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, 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 fallback throw new Error message both reference the View → Developer → Allow JavaScript from Apple Events requirement.
  • README.md: list import-brave in the command tree and manual-imports block; add a NOTE block explaining the AppleScript-JS prereq applies to both import-brave and import-chrome.
  • skills/agent-slack/SKILL.md: add a Brave fallback section and update the intro to Brave/Chrome/Firefox (Brave is already in the auto-fallback chain).
  • skills/agent-slack/references/commands.md: add import-brave to the auth command list with the AppleScript prereq inline.

Notes

src/auth/chrome.ts has the same bug pattern (identical try { ... } catch { return null } wrapping + identical execute t javascript AppleScript path). Out of scope for this PR — happy to send a follow-up.

Test plan

  • bun run typecheck clean
  • bun run test — 198/198 pass
  • bun run format:check clean
  • agent-slack auth import-brave happy path: still imports tokens (2 workspaces in my case)
  • Manually reproduced AppleScript-disabled failure (View → Developer → Allow JavaScript from Apple Events OFF) and confirmed osascript() reports the exact marker string that the new detection relies on
  • CI

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant