Skip to content

Fix macOS keychain credentials (#3) and ship missing rename.cjs (#2) - #6

Open
mozlet wants to merge 2 commits into
Leuconoe:mainfrom
mozlet:fix/macos-keychain-and-rename-packaging
Open

Fix macOS keychain credentials (#3) and ship missing rename.cjs (#2)#6
mozlet wants to merge 2 commits into
Leuconoe:mainfrom
mozlet:fix/macos-keychain-and-rename-packaging

Conversation

@mozlet

@mozlet mozlet commented Jul 10, 2026

Copy link
Copy Markdown

Summary

Bundles two fixes that make the switcher work out of the box on macOS:

1. macOS login-keychain credential bridge (fixes #3)

On macOS, Claude Code stores OAuth credentials in the login keychain (generic
password, service Claude Code-credentials), not ~/.claude/.credentials.json.
lib/store/io.cjs now routes credential read/write through the security CLI,
but only on darwin, when the credentials file is absent, and a keychain
item exists — so Linux/WSL/Windows and file-based macOS installs are unaffected.
A pre-switch keychain backup is written so a bad write is recoverable.

This is the approach from @shackstack's #5, applied verbatim.

2. Ship lib/actions/rename.cjs (fixes #2)

cc-switch.cjs requires lib/actions/rename.cjs (added with the account-alias
feature), but the file is missing from the package.json files whitelist and
from install.cjs, so npm/npx installs crash with MODULE_NOT_FOUND. Added to
both. Overlaps with #4.

Testing (macOS, Darwin, Node 18+)

  • cc-sync-oauth / cc-switch read the active account from the keychain (no more ENOENT)
  • account list renders
  • security add-generic-password -U write roundtrip verified
  • npm pack now includes lib/actions/rename.cjs

Notes

🤖 Generated with Claude Code

EugeneHam and others added 2 commits July 9, 2026 23:50
On macOS, Claude Code stores OAuth credentials in the login keychain
(service "Claude Code-credentials"), not ~/.claude/.credentials.json.
Route credential reads/writes through the `security` CLI when running on
darwin, the credentials file is absent, and a keychain item exists.
Other platforms and file-based installs are unaffected.

Applies PR Leuconoe#5 by @shackstack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…euconoe#2)

cc-switch.cjs requires lib/actions/rename.cjs, but it was missing from
the package.json "files" whitelist and from install.cjs, so npm/npx
installs crashed with MODULE_NOT_FOUND. Add it to both. Bump to 0.4.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dc32338f-8326-4214-8322-390d403f8e08

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@Leuconoe

Leuconoe commented Aug 8, 2026

Copy link
Copy Markdown
Owner

@mozlet I'm sorry. For some unknown reason, I didn't receive the PR notification. Since there have been changes, please resolve the conflicts and resubmit the PR. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants