5 Commits
Author SHA1 Message Date
mysqtoandClaude Opus 5 8624699049 Release v0.1.4
Bump the crate version (which is what `ccswitch --version` reports) and
close out the changelog entry for the credential-store fixes.

The [Unreleased] compare link had pointed at v0.1.0 since that release,
and 0.1.1 through 0.1.3 had no link refs at all; give every release one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 21:26:04 +08:00
mysqtoandClaude Opus 4.8 a5a94bb962 Default to PerAccountOrg token scope; drop the daemon-stop
A Claude Code OAuth token is bound server-side to the org it was minted
under (opaque token; the server re-derives the org at session start and
rewrites ~/.claude.json). The PerAccount scope wrongly treated the token
as shared across a login's orgs, so sync_current propagated one org's
token into the sibling profile and every "switch" only relabelled the
config while real sessions ran under the token's minting org. Default to
PerAccountOrg so each (account, org) keeps its own token and sync_current
re-snapshots only the outgoing profile.

Also remove the v0.1.1/v0.1.2 daemon-stop: it addressed a misdiagnosis
(no persistent daemon holds auth), and the worker-kill needlessly ended
background sessions.

Profiles saved before this release share one token and must be
re-provisioned (claude /login into the org, then save --force).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 11:12:18 +08:00
mysqtoandClaude Opus 4.8 cbc50ec2f6 Stop daemon session workers on switch, not just the supervisor
v0.1.1 stopped only the daemon supervisor (--keep-workers). But a kept
worker holds in memory the account it was started under, so
`claude --resume` reattached to the old worker and the switch appeared
to have no effect — the resumed session kept the previous org. Drop
--keep-workers so `claude daemon stop --any` also stops the workers, and
every subsequent session (resumed or fresh) picks up the switched
account. Trade-off: switching ends detached background sessions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 23:30:23 +08:00
mysqtoandClaude Opus 4.8 a790decf39 Stop the Claude Code daemon on switch so auth takes effect
Recent Claude Code releases keep a background daemon that caches each
account's auth in memory, so a profile switch didn't take effect until
the daemon exited. Every switch now stops the daemon supervisor first
via `claude daemon stop --any --keep-workers`, letting the next session
re-read the restored credentials while detached background sessions keep
running. Best-effort: an older Claude Code, a missing binary, or no
running daemon never blocks the switch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 18:40:13 +08:00
mysqtoandClaude Opus 4.8 d01079e91d Rewrite ccswitch as a cross-shell Rust CLI
Replaces the fish-only plugin with one portable binary — completions for
bash/zsh/fish/PowerShell via `ccswitch completions <shell>`. Same UX
(save/add/use/list/current/rm/isolate/seed/search + bare-name switch-and-launch).

- Fixes the auth-loss bug: the OAuth token is per-account (org lives only in
  ~/.claude.json), so switching between same-login/different-org profiles left
  the sibling holding a rotated, dead refresh token. A switch now propagates the
  refreshed credential to every profile sharing the account.
- Adds `save --force` / `add --force` to overwrite a profile without rm first.
- macOS Keychain via `security` (shim); file-based creds on Linux/Windows.
- Ports-and-adapters; 100% line / 98.86% region coverage; clippy + fmt clean.
- Homebrew formula (auto-installs completions) + cask + release workflow.
- Old fish plugin preserved under legacy-fish/ (also at lei-wego/ccswitch-fish).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 17:17:01 +08:00