Skip to content

v2.3.0

Latest

Choose a tag to compare

@github-actions github-actions released this 30 Nov 14:21

No more switching to an account whose sign-in has ended

A Claude sign-in only lasts for a limited time. After that, Claude Code cannot renew it, and the only way back is to sign in again. CCSwitcher used to switch to such an account anyway: it reported that the switch had worked, then Claude Code failed to renew the sign-in and signed itself out.

Now CCSwitcher checks before it switches. If the account's sign-in has ended, or Anthropic has already refused to renew it, the switch is stopped and the account's card asks you to re-authenticate (↻). Auto-switch skips such accounts too. An account whose sign-in only needs a routine renewal still switches as before; Claude Code renews it by itself.

CCSwitcher also no longer asks Anthropic again and again to renew a sign-in that has already been refused.

Tip: if Claude Code sessions that are already open keep using the previous account after a switch, look for a file named ~/.claude/.credentials.json. Claude Code can leave it behind after a failed sign-in, and while it exists, open sessions do not notice a switch. Removing or renaming the file fixes this (#57).

Safer account switches

  • If the current account's sign-in cannot be saved first, the switch stops before changing anything, so its newest sign-in is never lost.
  • If writing to the keychain fails partway through a switch, the switch is undone.
  • Quitting CCSwitcher, including the restart after an update, waits for a switch that is in progress, and cancels a browser login that has not finished.
  • Removing the account you are using now switches Claude Code to the next account. Before, Claude Code stayed signed in to the removed account. If that switch fails, the account is kept, together with its stored sign-in.
  • A refresh that runs during a switch, or while an account is being removed, no longer files one account's sign-in or usage numbers under another account.
  • A claude command that hangs is stopped after 30 seconds, and warnings printed by the Claude CLI no longer break reading which account is signed in.

Small changes

  • Each account card always shows when its numbers were read ("Updated … ago"), with digits that do not jump around. Before, the line disappeared right after a refresh.
  • Classic style: the refresh arrow at the bottom spins while a refresh runs, and the time of the last refresh now has a clock icon.

Thanks

Included from v2.2.0

A More Apps tab in Settings

Settings has a new More Apps tab that lists the other apps by the same author. Click Get and CCSwitcher downloads the app, checks that it is signed by the same developer, puts it in your Applications folder and opens it. Each row also has a button that leads to the app's source on GitHub or to its App Store page.

More Apps by Author in the menu bar icon's right-click menu and the link on the About tab now open this tab instead of the website.

To show the list, the tab fetches one small file from GitHub (or its jsDelivr mirror) when you open it. What CCSwitcher reports about itself has not changed: only launch counts.


不会再切换到登录已经到期的账号

Claude 的一次登录只在一段时间内有效。过了这个时间,Claude Code 就没法再续期,只能重新登录。以前 CCSwitcher 照样会切换到这样的账号:界面上显示切换成功,接着 Claude Code 续期失败,自己退出了登录。

现在 CCSwitcher 会在切换之前先检查。如果这个账号的登录已经到期,或者 Anthropic 已经拒绝过给它续期,切换会被拦下来,这个账号的卡片会提示你重新认证(↻)。自动切换也会跳过这样的账号。登录只是需要例行续期的账号,照常可以切换,Claude Code 会自己续期。

对于已经被拒绝续期的登录,CCSwitcher 也不会再一遍遍地向 Anthropic 请求续期。

小提示: 如果切换以后,已经开着的 Claude Code 会话还在用之前的账号,请看看有没有 ~/.claude/.credentials.json 这个文件。Claude Code 登录失败后可能会留下这个文件;只要它在,已经开着的会话就察觉不到账号切换了。把这个文件删掉或改个名字就好了(#57)。

切换账号更安全

  • 如果当前账号的登录信息没能先保存下来,切换会在改动任何东西之前停下,这个账号最新的登录信息不会丢。
  • 切换过程中写入钥匙串失败时,会撤销这次切换。
  • 退出 CCSwitcher 时(包括更新后自动重启),会等正在进行的切换完成,并取消还没完成的浏览器登录。
  • 删除正在使用的账号时,现在会把 Claude Code 切换到下一个账号。以前 Claude Code 会一直登录着已经删掉的那个账号。如果这次切换失败,账号和它保存的登录信息都会保留,不会被删掉。
  • 切换账号或删除账号的同时正好在刷新时,不会再把一个账号的登录信息或用量数字记到另一个账号名下。
  • claude 命令卡住时,30 秒后会被停掉;Claude 命令行输出的警告,也不会再导致读不出当前登录的是哪个账号。

小改动

  • 每张账号卡片上都会一直显示数字是多久之前读取的(「Updated … ago」),数字宽度固定,不会跳动。以前刷新完这一行会消失。
  • 经典样式:刷新时底部的刷新箭头会转圈,上次刷新时间前面的图标换成了时钟。

致谢

  • @ANGELBERRIOS23 —— 让切换账号更安全(#46)。
  • @nakamuraos —— 仔细排查,找到了切换账号会让 Claude Code 退出登录的原因(#57)。

包含 v2.2.0 的更新

「设置」里新增「更多应用」标签页

「设置」里新增了「更多应用」标签页,列出同一位作者做的其他应用。点「获取」,CCSwitcher 会下载这个应用、确认它由同一位开发者签名、把它放进「应用程序」文件夹并打开。每一行还有一个按钮,可以打开这个应用在 GitHub 上的源码或它的 App Store 页面。

菜单栏图标右键菜单里的「作者的更多应用」和「关于」标签页里的链接,现在都会打开这个标签页,不再跳转到网站。

为了显示这份列表,打开这个标签页时会从 GitHub(或它的 jsDelivr 镜像)取一个很小的文件。CCSwitcher 上报的内容没有变化:仍然只有启动次数。


Full Changelog: v2.2.0...v2.3.0