Fix macOS keychain credentials (#3) and ship missing rename.cjs (#2) - #6
Fix macOS keychain credentials (#3) and ship missing rename.cjs (#2)#6mozlet wants to merge 2 commits into
Conversation
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>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
@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. |
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.cjsnow routes credential read/write through thesecurityCLI,but only on
darwin, when the credentials file is absent, and a keychainitem 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.cjsrequireslib/actions/rename.cjs(added with the account-aliasfeature), but the file is missing from the package.json
fileswhitelist andfrom
install.cjs, so npm/npx installs crash withMODULE_NOT_FOUND. Added toboth. Overlaps with #4.
Testing (macOS, Darwin, Node 18+)
cc-sync-oauth/cc-switchread the active account from the keychain (no moreENOENT)security add-generic-password -Uwrite roundtrip verifiednpm packnow includeslib/actions/rename.cjsNotes
🤖 Generated with Claude Code