Skip to content

Add opt-in Claude multi-account support through claude-swap - #481

Draft
Finesssee wants to merge 2 commits into
mainfrom
work/issue-477-deepseek-01a09470
Draft

Add opt-in Claude multi-account support through claude-swap#481
Finesssee wants to merge 2 commits into
mainfrom
work/issue-477-deepseek-01a09470

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

Add an opt-in claude-swap adapter under Claude provider settings, with an executable path, external account usage cards, and explicit account switching. Source-issued slot IDs preserve separate accounts sharing one email. The CLI expands Claude accounts for usage --all-accounts when the adapter is enabled and configured.

The adapter invokes fixed cswap argument arrays without a shell, requires schema version 1, and projects display fields without importing credentials. Switching invalidates cached Claude usage and requests a refresh. Failed executable-path saves remain retryable.

Related issue

Refs #477.

Affected areas

  • Settings UI
  • Config file / settings persistence
  • CLI
  • Provider-specific behavior

Validation

  • Frontend suite: 60 files, 347 tests passed before the final path-save regression test.
  • Focused ClaudeSwapAccountsSection suite after the fix: 5 tests passed.
  • Production frontend build, TypeScript, and locale parity: passed (848 keys).
  • Rust formatting and whitespace checks: passed after formatting corrections.
  • Local native Rust tests/clippy and a fresh desktop build remain blocked by the missing MSVC linker/toolchain binaries. Hosted Windows checks are pending.

UI / tray proof

Draft: fresh native desktop build and CUA/manual visual proof are still outstanding. The frontend build and jsdom checks do not establish native desktop behavior. Live cswap credential switching was not exercised.

Notes for reviewers

Implementation was developed through OpenCode using deepseek-v4.1-flash and reviewed locally. This adds external account cards in settings and CLI enumeration; it does not add simultaneous per-account tray cards. Activation delegates the credential transaction to cswap. Review Windows executable compatibility and subprocess lifecycle behavior before marking ready.

Add a credential-free adapter over cswap --list --json and
cswap --switch-to <slot> --json, with schemaVersion 1 validation,
source-issued slot identities (claude-swap:<slot>), opt-in setting and
executable path, display-only projection, and explicit activation.

- rust/src/providers/claude/claude_swap.rs: bounded, no-shell subprocess
  runner; strict parsers; sanitized display-only mapping that never echoes
  raw stdout or unknown external strings to UI/logs.
- CLI: wire usage --all-accounts for Claude through the adapter.
- Tauri: settings snapshot/update, list/switch commands.
- UI: ClaudeSwapAccountsSection with opt-in toggle, path field, status and
  explicit Switch action.
- Tests: adapter parsing/limits/secret-safety, CLI payloads, frontend
  section behavior.

Refs #477.
@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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