@hepheastus-devkit/claude-switch 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +331 -0
- package/dist/cli.js.map +1 -0
- package/dist/profileManager.d.ts +33 -0
- package/dist/profileManager.js +997 -0
- package/dist/profileManager.js.map +1 -0
- package/dist/registry.d.ts +57 -0
- package/dist/registry.js +118 -0
- package/dist/registry.js.map +1 -0
- package/dist/secureStore.d.ts +9 -0
- package/dist/secureStore.js +118 -0
- package/dist/secureStore.js.map +1 -0
- package/dist/utils.d.ts +66 -0
- package/dist/utils.js +239 -0
- package/dist/utils.js.map +1 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# claude-switch
|
|
2
|
+
|
|
3
|
+
Terminal-first multi-account switcher for Claude Code — supports **API key** and **OAuth** accounts, codex-auth style. Works great on Windows, macOS, and Linux.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Dual auth mode** — API key accounts (`sk-ant-...`) and OAuth accounts (`claude auth login`)
|
|
8
|
+
- **⚡ Shell Hook Integration** — Automatic environment switching without manual `eval` or sourcing.
|
|
9
|
+
- **🌐 Per-Profile Proxy & API Endpoint** — Configure independent HTTP/HTTPS proxies (`HTTPS_PROXY`) and API gateways (`ANTHROPIC_BASE_URL`) per profile. Residual variables are cleaned automatically when switching.
|
|
10
|
+
- **🛡️ Machine-Bound Security** — API keys are stored encrypted using AES-256-GCM with a key derived from your machine's hardware fingerprint (e.g. `MachineGuid` on Windows).
|
|
11
|
+
- **codex-auth style UX** — switch by number, name fragment, email, alias, or `-` for previous
|
|
12
|
+
- **Registry** — local `registry.json` tracks email, plan type (Free/Pro/Max/API), and last-used times
|
|
13
|
+
- **Interactive picker** — arrow-key selection with plan badges and account type labels
|
|
14
|
+
- **Guided login** — `claude-switch login` walks you through adding any account type
|
|
15
|
+
- **Full isolation** — `claude-switch run <name>` launches Claude with a separate `CLAUDE_CONFIG_DIR`
|
|
16
|
+
- **Aliases** — short names for profiles (`w` → `work`)
|
|
17
|
+
- **Safe Export/Import** — Export configurations for backups or team sharing. Includes a `--safe` mode to exclude keys/credentials.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/Hephaestus-DevKit/claude-switch
|
|
23
|
+
cd claude-switch
|
|
24
|
+
npm install
|
|
25
|
+
npm run build
|
|
26
|
+
npm install -g .
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
### 1. Enable Shell Hook (Recommended)
|
|
32
|
+
|
|
33
|
+
Run the following command to print hook functions for your shell:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
claude-switch init
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Add the wrapper function to your shell profile (`~/.bashrc`, `~/.zshrc`, or `$PROFILE` for PowerShell). This allows you to use the shorthand command `csw` which automatically refreshes your terminal environment variables upon switching profiles.
|
|
40
|
+
|
|
41
|
+
### 2. Add an API key account
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Paste key directly
|
|
45
|
+
claude-switch add work --api-key sk-ant-api03-...
|
|
46
|
+
|
|
47
|
+
# Configure custom proxy and API base URL
|
|
48
|
+
claude-switch add work --api-key sk-ant-... --proxy http://127.0.0.1:7890 --api-url https://api.company-gateway.com
|
|
49
|
+
|
|
50
|
+
# Or read from current env
|
|
51
|
+
export ANTHROPIC_API_KEY=sk-ant-api03-...
|
|
52
|
+
claude-switch add work --api-key-env
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. Add an OAuth account (claude.ai subscription)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Guided flow (recommended)
|
|
59
|
+
claude-switch login
|
|
60
|
+
|
|
61
|
+
# Or manually: log in first, then capture
|
|
62
|
+
claude auth login
|
|
63
|
+
claude-switch add personal --email me@gmail.com --plan pro
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 4. List accounts
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
claude-switch list
|
|
70
|
+
# Or shorthand
|
|
71
|
+
csw ls
|
|
72
|
+
# → 01. work [Pro] [API] work@company.com last used: 2 hours ago
|
|
73
|
+
# 02. personal [Free] [OAuth] me@gmail.com added: 2025-01-15
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 5. Switch accounts
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
csw 1 # by row number
|
|
80
|
+
csw work # by name fragment
|
|
81
|
+
csw work@ # by email fragment
|
|
82
|
+
csw - # back to previous
|
|
83
|
+
csw # interactive picker (arrow keys)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## All Commands
|
|
89
|
+
|
|
90
|
+
| Command | Alias | Description |
|
|
91
|
+
|---------|-------|-------------|
|
|
92
|
+
| `claude-switch` | `csw` | Interactive account picker |
|
|
93
|
+
| `list` | `ls` | List all accounts |
|
|
94
|
+
| `add [options] <name>` | | Save current auth as profile |
|
|
95
|
+
| `switch [query]` | `use` | Switch account (number/name/email/alias/-) |
|
|
96
|
+
| `login` | | Guided add flow (OAuth or API key) |
|
|
97
|
+
| `whoami` | | Show current account details |
|
|
98
|
+
| `env` | | Print shell-sourceable API key export |
|
|
99
|
+
| `run <name>` | | Launch Claude with isolated config |
|
|
100
|
+
| `remove <name>` | `rm` | Remove a profile |
|
|
101
|
+
| `current` | | Print active profile name |
|
|
102
|
+
| `status` | | Show auth state and active dir |
|
|
103
|
+
| `alias set <name> <short>` | | Create a short alias |
|
|
104
|
+
| `alias list` | | List all aliases |
|
|
105
|
+
| `alias clear <alias>` | | Remove an alias |
|
|
106
|
+
| `export [options] <dir>` | | Export all profiles for backup |
|
|
107
|
+
| `import <dir>` | | Import profiles from backup |
|
|
108
|
+
| `clean` | | Clean temporary files & Claude session history |
|
|
109
|
+
| `init` | | Print shell hook integration wrapper |
|
|
110
|
+
| `doctor` | | Troubleshoot setup |
|
|
111
|
+
|
|
112
|
+
### `add` Options
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
--api-key <key> Store Anthropic API key for this profile
|
|
116
|
+
--api-key-env Read key from ANTHROPIC_API_KEY env var
|
|
117
|
+
--email <email> Set display email
|
|
118
|
+
--plan <plan> free | pro | max | api (default: unknown)
|
|
119
|
+
--note <note> Short note
|
|
120
|
+
--api-url <url> Set a custom API base URL for this profile
|
|
121
|
+
--proxy <url> Set a proxy URL (HTTP/HTTPS) for this profile
|
|
122
|
+
--full Snapshot entire Claude config dir
|
|
123
|
+
-f, --force Overwrite without confirmation
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `export` Options
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
--safe Exclude sensitive keys and credentials from export (perfect for sharing templates)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Storage Layout
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
~/.claude-switch/
|
|
138
|
+
registry.json ← account registry (name, email, plan, type, proxy, apiUrl)
|
|
139
|
+
aliases.json ← short aliases
|
|
140
|
+
current-profile.txt ← active profile name
|
|
141
|
+
previous-profile.txt ← previous profile (for - switching)
|
|
142
|
+
current-apikey.env ← current API key env export line (Bash/Zsh sourcing)
|
|
143
|
+
current-apikey.ps1 ← current API key env script (PowerShell dot-sourcing)
|
|
144
|
+
profiles/
|
|
145
|
+
work/
|
|
146
|
+
profile.json ← metadata
|
|
147
|
+
apikey.json ← encrypted API key (AES-256-GCM)
|
|
148
|
+
.credentials.json ← OAuth credentials (if OAuth account)
|
|
149
|
+
personal/
|
|
150
|
+
profile.json
|
|
151
|
+
.credentials.json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Security Design
|
|
155
|
+
|
|
156
|
+
API keys stored in `apikey.json` are encrypted using `aes-256-gcm`. The encryption key is derived using `pbkdf2` from hardware properties of the host machine (e.g. `MachineGuid` registry key on Windows, platform UUID on macOS, and `/etc/machine-id` on Linux) along with your user profile name.
|
|
157
|
+
|
|
158
|
+
This ensures that even if your `.claude-switch` directory is copied or synchronized via cloud drives, it cannot be decrypted on other computers.
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const commander_1 = require("commander");
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
// Global error handlers — must come before any async work
|
|
43
|
+
process.on('unhandledRejection', (err) => {
|
|
44
|
+
console.error(chalk_1.default.red('✗ Unhandled error: ' + (err?.message || String(err))));
|
|
45
|
+
process.exit(1);
|
|
46
|
+
});
|
|
47
|
+
process.on('uncaughtException', (err) => {
|
|
48
|
+
console.error(chalk_1.default.red('✗ Fatal error: ' + (err?.message || String(err))));
|
|
49
|
+
process.exit(1);
|
|
50
|
+
});
|
|
51
|
+
const profileManager_1 = require("./profileManager");
|
|
52
|
+
const utils_1 = require("./utils");
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
54
|
+
const { version: PKG_VERSION } = require('../package.json');
|
|
55
|
+
const program = new commander_1.Command();
|
|
56
|
+
program
|
|
57
|
+
.name('claude-switch')
|
|
58
|
+
.alias('csw')
|
|
59
|
+
.description('Switch between multiple Claude Code accounts (API key & OAuth). codex-auth style.')
|
|
60
|
+
.version(PKG_VERSION);
|
|
61
|
+
// Single preAction hook — runs before every command
|
|
62
|
+
program.hook('preAction', async () => {
|
|
63
|
+
await (0, utils_1.ensureClaudeDir)();
|
|
64
|
+
});
|
|
65
|
+
// Bare `claude-switch` → interactive picker
|
|
66
|
+
program.action(async () => {
|
|
67
|
+
await (0, profileManager_1.interactiveSwitch)();
|
|
68
|
+
});
|
|
69
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
70
|
+
// Core commands
|
|
71
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
72
|
+
program
|
|
73
|
+
.command('status')
|
|
74
|
+
.description('Show current active profile, auth type, and credential info')
|
|
75
|
+
.action(async () => {
|
|
76
|
+
await (0, profileManager_1.status)();
|
|
77
|
+
});
|
|
78
|
+
program
|
|
79
|
+
.command('whoami')
|
|
80
|
+
.description('Show details of the currently active account (name, email, plan, type)')
|
|
81
|
+
.action(async () => {
|
|
82
|
+
await (0, profileManager_1.whoami)();
|
|
83
|
+
});
|
|
84
|
+
program
|
|
85
|
+
.command('list')
|
|
86
|
+
.alias('ls')
|
|
87
|
+
.description('List all saved accounts with plan badges and last-used times')
|
|
88
|
+
.action(async () => {
|
|
89
|
+
await (0, profileManager_1.listProfiles)();
|
|
90
|
+
});
|
|
91
|
+
program
|
|
92
|
+
.command('add <name>')
|
|
93
|
+
.description('Save the current auth state as a named account profile')
|
|
94
|
+
.option('-f, --force', 'Overwrite existing profile without confirmation')
|
|
95
|
+
.option('--full', 'Snapshot entire Claude config dir for full per-session isolation')
|
|
96
|
+
.option('--api-key <key>', 'Store this Anthropic API key for the profile')
|
|
97
|
+
.option('--api-key-env', 'Read API key from ANTHROPIC_API_KEY env var')
|
|
98
|
+
.option('--email <email>', 'Set account email (for display in list)')
|
|
99
|
+
.option('--plan <plan>', 'Set plan label: free | pro | max | api', 'unknown')
|
|
100
|
+
.option('--note <note>', 'Attach a short note to the profile')
|
|
101
|
+
.option('--api-url <url>', 'Set a custom Anthropic API base URL for this profile')
|
|
102
|
+
.option('--proxy <url>', 'Set a proxy URL (HTTP/HTTPS) for this profile')
|
|
103
|
+
.action(async (name, options) => {
|
|
104
|
+
await (0, profileManager_1.addProfile)(name, {
|
|
105
|
+
force: options.force,
|
|
106
|
+
full: options.full,
|
|
107
|
+
apiKey: options.apiKey,
|
|
108
|
+
apiKeyEnv: options.apiKeyEnv,
|
|
109
|
+
email: options.email,
|
|
110
|
+
plan: options.plan,
|
|
111
|
+
note: options.note,
|
|
112
|
+
apiUrl: options.apiUrl,
|
|
113
|
+
proxy: options.proxy,
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
program
|
|
117
|
+
.command('switch [query]')
|
|
118
|
+
.alias('use')
|
|
119
|
+
.description('Switch account — supports: number, name fragment, email fragment, alias, or "-" for previous')
|
|
120
|
+
.action(async (query) => {
|
|
121
|
+
if (!query) {
|
|
122
|
+
await (0, profileManager_1.interactiveSwitch)();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const switched = await (0, profileManager_1.switchByQuery)(query);
|
|
126
|
+
if (!switched) {
|
|
127
|
+
const names = await (0, profileManager_1.getAllProfileNames)();
|
|
128
|
+
if (names.length > 0) {
|
|
129
|
+
(0, utils_1.logInfo)(`Could not uniquely resolve "${query}". Opening interactive picker...`);
|
|
130
|
+
await (0, profileManager_1.interactiveSwitch)();
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
console.log(chalk_1.default.yellow('No profiles saved. Run "claude-switch login" to add your first account.'));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
program
|
|
138
|
+
.command('run <name>')
|
|
139
|
+
.description('Launch Claude with this account\'s API key or full-isolation config dir')
|
|
140
|
+
.action(async (name) => {
|
|
141
|
+
await (0, profileManager_1.runProfile)(name);
|
|
142
|
+
});
|
|
143
|
+
program
|
|
144
|
+
.command('remove <name>')
|
|
145
|
+
.alias('rm')
|
|
146
|
+
.description('Remove a saved profile')
|
|
147
|
+
.action(async (name) => {
|
|
148
|
+
await (0, profileManager_1.removeProfile)(name);
|
|
149
|
+
});
|
|
150
|
+
program
|
|
151
|
+
.command('current')
|
|
152
|
+
.description('Print the currently tracked profile name')
|
|
153
|
+
.action(async () => {
|
|
154
|
+
const current = await (0, profileManager_1.getCurrentProfile)();
|
|
155
|
+
if (current) {
|
|
156
|
+
console.log(chalk_1.default.green(`Current: ${current}`));
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
console.log(chalk_1.default.yellow('No profile tracked (using default ~/.claude)'));
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
163
|
+
// env — output shell-sourceable variable for the current profile's API key
|
|
164
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
165
|
+
program
|
|
166
|
+
.command('env')
|
|
167
|
+
.description('Print shell-sourceable env vars for current profile\'s API key')
|
|
168
|
+
.option('--powershell', 'Output PowerShell syntax ($env:VAR="val")')
|
|
169
|
+
.option('--bash', 'Output bash/zsh syntax (export VAR="val")')
|
|
170
|
+
.action(async (options) => {
|
|
171
|
+
const shell = options.powershell ? 'powershell' : options.bash ? 'bash' : undefined;
|
|
172
|
+
await (0, profileManager_1.printEnv)(shell);
|
|
173
|
+
});
|
|
174
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
175
|
+
// login — guided add flow (OAuth or API key)
|
|
176
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
177
|
+
program
|
|
178
|
+
.command('login')
|
|
179
|
+
.description('Guided helper: log in and automatically capture the account')
|
|
180
|
+
.action(async () => {
|
|
181
|
+
await (0, profileManager_1.loginAndCapture)();
|
|
182
|
+
});
|
|
183
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
184
|
+
// Alias management
|
|
185
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
186
|
+
const aliasCmd = program.command('alias').description('Manage short aliases for profiles');
|
|
187
|
+
aliasCmd
|
|
188
|
+
.command('set <name> <alias>')
|
|
189
|
+
.description('Set an alias (e.g. alias set work w)')
|
|
190
|
+
.action(async (name, alias) => {
|
|
191
|
+
await (0, profileManager_1.setAlias)(name, alias);
|
|
192
|
+
});
|
|
193
|
+
aliasCmd
|
|
194
|
+
.command('clear <alias>')
|
|
195
|
+
.description('Remove an alias')
|
|
196
|
+
.action(async (alias) => {
|
|
197
|
+
await (0, profileManager_1.clearAlias)(alias);
|
|
198
|
+
});
|
|
199
|
+
aliasCmd
|
|
200
|
+
.command('list')
|
|
201
|
+
.alias('ls')
|
|
202
|
+
.description('List all aliases')
|
|
203
|
+
.action(async () => {
|
|
204
|
+
await (0, profileManager_1.listAliases)();
|
|
205
|
+
});
|
|
206
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
207
|
+
// menu / doctor / export / import
|
|
208
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
209
|
+
program
|
|
210
|
+
.command('menu')
|
|
211
|
+
.description('Open interactive account picker')
|
|
212
|
+
.action(async () => {
|
|
213
|
+
await (0, profileManager_1.interactiveSwitch)();
|
|
214
|
+
});
|
|
215
|
+
program
|
|
216
|
+
.command('export <output-dir>')
|
|
217
|
+
.description('Export all profiles (and aliases/registry) for backup or migration')
|
|
218
|
+
.option('--safe', 'Exclude sensitive keys and credentials from export')
|
|
219
|
+
.action(async (outputDir, options) => {
|
|
220
|
+
await (0, profileManager_1.exportProfiles)(outputDir, options.safe);
|
|
221
|
+
});
|
|
222
|
+
program
|
|
223
|
+
.command('import <input-dir>')
|
|
224
|
+
.description('Import profiles from a previously exported directory')
|
|
225
|
+
.option('-f, --force', 'Overwrite existing profiles with same name')
|
|
226
|
+
.action(async (inputDir, options) => {
|
|
227
|
+
await (0, profileManager_1.importProfiles)(inputDir, options.force);
|
|
228
|
+
});
|
|
229
|
+
program
|
|
230
|
+
.command('clean')
|
|
231
|
+
.description('Clean temporary backups and files (optional Claude Code database cleanup)')
|
|
232
|
+
.action(async () => {
|
|
233
|
+
await (0, profileManager_1.cleanProfiles)();
|
|
234
|
+
});
|
|
235
|
+
program
|
|
236
|
+
.command('init')
|
|
237
|
+
.description('Print shell wrapper function/hook for automatic environment switching')
|
|
238
|
+
.action(() => {
|
|
239
|
+
console.log(chalk_1.default.cyan('\n=== Shell Hook Integration ===\n'));
|
|
240
|
+
console.log('To enable automatic environment switching without needing manual eval,');
|
|
241
|
+
console.log('add the following wrapper function to your shell profile.\n');
|
|
242
|
+
console.log(chalk_1.default.yellow('For Bash / Zsh (add to ~/.bashrc or ~/.zshrc):'));
|
|
243
|
+
console.log(chalk_1.default.gray(`--------------------------------------------------
|
|
244
|
+
csw() {
|
|
245
|
+
claude-switch "$@"
|
|
246
|
+
local exit_code=$?
|
|
247
|
+
if [ -f "$HOME/.claude-switch/current-apikey.env" ]; then
|
|
248
|
+
source "$HOME/.claude-switch/current-apikey.env"
|
|
249
|
+
fi
|
|
250
|
+
return $exit_code
|
|
251
|
+
}
|
|
252
|
+
--------------------------------------------------`));
|
|
253
|
+
console.log(chalk_1.default.yellow('\nFor PowerShell (add to $PROFILE or Microsoft.PowerShell_profile.ps1):'));
|
|
254
|
+
console.log(chalk_1.default.gray(`--------------------------------------------------
|
|
255
|
+
function csw {
|
|
256
|
+
& claude-switch @args
|
|
257
|
+
$exit_code = $LASTEXITCODE
|
|
258
|
+
$env_file = "$HOME/.claude-switch/current-apikey.ps1"
|
|
259
|
+
if (Test-Path $env_file) {
|
|
260
|
+
. "$env_file"
|
|
261
|
+
}
|
|
262
|
+
return $exit_code
|
|
263
|
+
}
|
|
264
|
+
--------------------------------------------------`));
|
|
265
|
+
console.log('');
|
|
266
|
+
});
|
|
267
|
+
program
|
|
268
|
+
.command('doctor')
|
|
269
|
+
.description('Check Claude Code setup and give troubleshooting advice')
|
|
270
|
+
.action(async () => {
|
|
271
|
+
const { getActiveClaudeDir, SWITCH_DIR, APIKEY_ENV_FILE } = await Promise.resolve().then(() => __importStar(require('./utils')));
|
|
272
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
273
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs-extra')));
|
|
274
|
+
console.log(chalk_1.default.cyan('\n=== claude-switch doctor ===\n'));
|
|
275
|
+
const claudeDir = getActiveClaudeDir();
|
|
276
|
+
console.log(`Claude config dir: ${chalk_1.default.bold(claudeDir)}`);
|
|
277
|
+
const credFile = path.join(claudeDir, '.credentials.json');
|
|
278
|
+
const hasCred = await fs.pathExists(credFile);
|
|
279
|
+
console.log(`OAuth creds file: ${hasCred ? chalk_1.default.green('✓ found') : chalk_1.default.yellow('✗ not found')}`);
|
|
280
|
+
const hasKey = !!process.env.ANTHROPIC_API_KEY;
|
|
281
|
+
console.log(`ANTHROPIC_API_KEY in env: ${hasKey ? chalk_1.default.green('✓ set') : chalk_1.default.yellow('✗ not set')}`);
|
|
282
|
+
const hasEnvFile = await fs.pathExists(APIKEY_ENV_FILE);
|
|
283
|
+
console.log(`API key env file: ${hasEnvFile ? chalk_1.default.green('✓ ' + APIKEY_ENV_FILE) : chalk_1.default.gray('✗ none')}`);
|
|
284
|
+
console.log(`\nProfile storage: ${chalk_1.default.bold(SWITCH_DIR)}`);
|
|
285
|
+
console.log('\n' + chalk_1.default.bold('Typical flows:'));
|
|
286
|
+
console.log(' # Add an API key account:');
|
|
287
|
+
console.log(chalk_1.default.gray(' claude-switch add work --api-key sk-ant-...'));
|
|
288
|
+
console.log(' # Add an OAuth account:');
|
|
289
|
+
console.log(chalk_1.default.gray(' claude-switch login (follow prompts)'));
|
|
290
|
+
console.log(' # Switch accounts:');
|
|
291
|
+
console.log(chalk_1.default.gray(' claude-switch 1 # by row'));
|
|
292
|
+
console.log(chalk_1.default.gray(' claude-switch work # by name'));
|
|
293
|
+
console.log(chalk_1.default.gray(' claude-switch - # previous'));
|
|
294
|
+
console.log(' # Apply API key in current shell:');
|
|
295
|
+
console.log(chalk_1.default.gray(' eval $(claude-switch env) # bash/zsh'));
|
|
296
|
+
console.log(chalk_1.default.gray(' claude-switch env | Invoke-Expression # PowerShell'));
|
|
297
|
+
console.log('');
|
|
298
|
+
});
|
|
299
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
300
|
+
// Direct profile query at top level: `claude-switch work` / `claude-switch 2`
|
|
301
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
302
|
+
program.on('command:*', async () => {
|
|
303
|
+
try {
|
|
304
|
+
const args = program.args || [];
|
|
305
|
+
if (args.length < 1)
|
|
306
|
+
return;
|
|
307
|
+
const first = args[0];
|
|
308
|
+
// Skip if it's a known command
|
|
309
|
+
const known = program.commands.flatMap(cmd => [cmd.name(), ...cmd.aliases()]);
|
|
310
|
+
if (known.includes(first))
|
|
311
|
+
return;
|
|
312
|
+
const resolved = await (0, profileManager_1.resolveProfileQuery)(first);
|
|
313
|
+
if (resolved) {
|
|
314
|
+
// For API key profiles, switch (apply env) rather than run
|
|
315
|
+
await (0, profileManager_1.switchProfile)(resolved);
|
|
316
|
+
process.exit(0);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
const switched = await (0, profileManager_1.switchByQuery)(first);
|
|
320
|
+
if (!switched)
|
|
321
|
+
await (0, profileManager_1.interactiveSwitch)();
|
|
322
|
+
process.exit(0);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (err) {
|
|
326
|
+
(0, utils_1.logError)(err?.message || String(err));
|
|
327
|
+
process.exit(1);
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
program.parse(process.argv);
|
|
331
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAE1B,0DAA0D;AAC1D,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAQ,EAAE,EAAE;IAC5C,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,qBAAqB,GAAG,CAAC,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,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C/B,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC9E,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO;QAElC,MAAM,QAAQ,GAAG,MAAM,IAAA,oCAAmB,EAAC,KAAK,CAAC,CAAC;QAElD,IAAI,QAAQ,EAAE,CAAC;YACb,2DAA2D;YAC3D,MAAM,IAAA,8BAAa,EAAC,QAAQ,CAAC,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAa,EAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,CAAC,QAAQ;gBAAE,MAAM,IAAA,kCAAiB,GAAE,CAAC;YACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAA,gBAAQ,EAAC,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ProfileMetadata } from './utils';
|
|
2
|
+
export declare function status(): Promise<void>;
|
|
3
|
+
export declare function whoami(): Promise<void>;
|
|
4
|
+
export declare function listProfiles(): Promise<void>;
|
|
5
|
+
export declare function addProfile(name: string, options?: {
|
|
6
|
+
force?: boolean;
|
|
7
|
+
full?: boolean;
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
apiKeyEnv?: boolean;
|
|
10
|
+
email?: string;
|
|
11
|
+
plan?: string;
|
|
12
|
+
note?: string;
|
|
13
|
+
apiUrl?: string;
|
|
14
|
+
proxy?: string;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
export declare function switchProfile(name: string): Promise<void>;
|
|
17
|
+
export declare function printEnv(shell?: string): Promise<void>;
|
|
18
|
+
export declare function loginAndCapture(): Promise<void>;
|
|
19
|
+
export declare function runProfile(name: string, extraArgs?: string[]): Promise<void>;
|
|
20
|
+
export declare function switchByQuery(query: string): Promise<boolean>;
|
|
21
|
+
export declare function interactiveSwitch(): Promise<void>;
|
|
22
|
+
export declare function removeProfile(name: string): Promise<void>;
|
|
23
|
+
export declare function getCurrentProfile(): Promise<string | null>;
|
|
24
|
+
export declare function getPreviousProfile(): Promise<string | null>;
|
|
25
|
+
export declare function getAllProfileNames(): Promise<string[]>;
|
|
26
|
+
export declare function getProfileMetadata(name: string): Promise<ProfileMetadata | null>;
|
|
27
|
+
export declare function setAlias(nameOrQuery: string, alias: string): Promise<void>;
|
|
28
|
+
export declare function clearAlias(alias: string): Promise<void>;
|
|
29
|
+
export declare function listAliases(): Promise<void>;
|
|
30
|
+
export declare function resolveProfileQuery(query: string): Promise<string | null>;
|
|
31
|
+
export declare function exportProfiles(outputDir: string, safe?: boolean): Promise<void>;
|
|
32
|
+
export declare function importProfiles(inputDir: string, force?: boolean): Promise<void>;
|
|
33
|
+
export declare function cleanProfiles(): Promise<void>;
|