@cungnguyen/claude-switch
v0.2.0
Published
CLI profile manager for switching between Claude configurations.
Downloads
26
Maintainers
Readme
claude-switch
claude-switch is a CLI-first profile manager for Claude settings. It helps users save multiple Claude profiles, switch the active ~/.claude/settings.json, and run commands with a temporary profile without overwriting global config.
MVP features
initlocal profile storageaddinteractive profile creationlistsaved profilesuse <profile>to rewrite Claude settingscurrentactive profile summaryremove <profile>cleanupdoctorenvironment checksrun <profile> -- <command>temporary env injection
Install
Global CLI (recommended)
From the package folder after build:
npm install
npm run build
npm linkThen use claude-switch from any terminal:
claude-switch paths
claude-switch helpAfter you publish to npm, users run:
npm install -g @cungnguyen/claude-switchLocal development
npm install
npm run build
node dist/cli.js helpOr:
npm run dev -- helpExample workflow
Named profile + key (global-style, no prompts)
Each profile is one named use case (work, personal, client A, …) with its own token (key):
claude-switch init
claude-switch add work --token "YOUR_KEY" --provider claude-proxy --base-url "https://your-api.example.com"
claude-switch add personal --token "OTHER_KEY" --provider anthropic
claude-switch list
claude-switch use cong-tyUpdate only the key for a profile:
claude-switch set-token cong-ty --token "NEW_KEY"Pipe token (scripting):
echo "YOUR_KEY" | claude-switch set-token ca-nhanInteractive (prompts)
npm run dev -- init
npm run dev -- add work
npm run dev -- list
npm run dev -- use work
npm run dev -- run work -- claudeGlobal data directory
By default everything lives under ~/.claude-switch/ (profiles, backups, optional legacy tokens.json).
Override the base directory (portable disk, one folder for all “cases”):
set CLAUDE_SWITCH_HOME=D:\configs\claude-switch
claude-switch pathsOn macOS/Linux:
export CLAUDE_SWITCH_HOME="$HOME/.config/claude-switch"Storage
Metadata lives in:
~/.claude-switch/profiles.json
Tokens use OS credential storage when the optional keytar native module is installed (Windows Credential Manager, macOS Keychain, or libsecret on Linux). keytar is listed as an optionalDependency; if it fails to build or is omitted, tokens fall back to:
~/.claude-switch/tokens.json(plain JSON, not ideal for production)
When both are available, legacy entries in tokens.json are migrated on first use and then removed from the file for that profile.
Service name for OS storage: claude-switch.
Supported Claude config
The first version targets a Claude settings file shaped like:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "...",
"ANTHROPIC_BASE_URL": "https://your-proxy-or-api.example.com"
}
}use <profile> preserves unrelated settings and updates only the relevant env keys.
Publish checklist
- Add masked secret input instead of visible token entry.
- Add richer argument parsing and shell completion.
- Add cross-platform path coverage for macOS/Linux.
- Validate against more Claude config variants.
