feat(desktop): copyable sign-in command with config dir on expired usage accounts
Summary
The Usage tab's expired-account card said "Sign-in expired — run /login in Claude Code" but never told you which login to fix. For secondary profiles that means remembering the right CLAUDE_CONFIG_DIR yourself.
The card now renders the exact re-auth command for that profile as a click-to-copy chip, built by the same switchSignInCommand the card's "Switch sign-in…" dialog already uses (hoisted from AddAccountDialog into UsageView/utils/switchSignInCommand so both surfaces share one source of truth):
- Default Claude login →
claude auth login - Profile-dir login →
CLAUDE_CONFIG_DIR="/Users/x/.claude-work" claude auth login - Codex →
codex login(withCODEX_HOME="..."for non-default homes)
The dir is the quoted absolute path on purpose: Claude Code keys its Keychain item on the literal CLAUDE_CONFIG_DIR string and agent launches inject the absolute path, so a ~ spelling could re-auth a different identity; quoting keeps dirs with spaces pasteable. Copy uses the existing useCopyToClipboard hook with a 2s check-icon confirmation and a toast (carrying the full command) if the clipboard write fails; the chip's tooltip shows the full command. Other error states keep the host-provided statusDetail.
Verification
Unit tests for switchSignInCommand (default/profile Claude, space-containing dir, default/override Codex). Verified live over CDP against a dev desktop with a staged expired profile: the card renders the command chip and a trusted click lands the exact string on the macOS clipboard and flips the icon to the green check.
Summary by CodeRabbit
-
New Features
- Expired accounts now show a ready-to-run sign-in command.
- Added one-click copying with success feedback and an error notification if copying fails.
- Sign-in commands support Claude and Codex, including custom configuration locations.
-
Bug Fixes
- Replaced the generic token-expired message with actionable re-authentication guidance.
-
Tests
- Added coverage for default and custom configurations, including paths containing spaces.