claude-user 0.2.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/LICENSE +21 -0
- package/README.md +188 -0
- package/bin/claude-user.js +79 -0
- package/bin/postinstall.js +17 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 divyo-argha
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<br />
|
|
3
|
+
|
|
4
|
+
<pre style="line-height: 1.25; font-weight: bold; background: none; border: none; padding: 0; display: inline-block; text-align: left; font-family: monospace;">
|
|
5
|
+
<span style="color: #D97757;">░█▀▀░█░░░█▀█░█░█░█▀▄░█▀▀</span><span style="color: #94A3B8;">░░░░░█░█░█▀▀░█▀▀░█▀▄</span>
|
|
6
|
+
<span style="color: #D97757;">░█░░░█░░░█▀█░█░█░█░█░█▀▀</span><span style="color: #94A3B8;">░▄▄▄░█░█░▀▀█░█▀▀░█▀▄</span>
|
|
7
|
+
<span style="color: #D97757;">░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀░░▀▀▀</span><span style="color: #94A3B8;">░░░░░▀▀▀░▀▀▀░▀▀▀░▀░▀</span>
|
|
8
|
+
</pre>
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<strong>One command to switch Claude Code accounts.</strong><br />
|
|
12
|
+
Stop logging out. Stop re-authenticating. Stop mixing up work and personal chats.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p>
|
|
16
|
+
<a href="https://github.com/divyo-argha/claude-user/releases"><img src="https://img.shields.io/github/v/release/divyo-argha/claude-user?style=flat&color=D97757&label=latest" alt="Latest Release" /></a>
|
|
17
|
+
<a href="https://www.npmjs.com/package/claude-user"><img src="https://img.shields.io/npm/v/claude-user?style=flat&color=CB3837&logo=npm&logoColor=white&label=npm" alt="npm" /></a>
|
|
18
|
+
<a href="https://www.npmjs.com/package/claude-user"><img src="https://img.shields.io/npm/dt/claude-user?style=flat&color=CB3837&logo=npm&logoColor=white&label=npm%20downloads" alt="npm downloads" /></a>
|
|
19
|
+
<a href="Cargo.toml"><img src="https://img.shields.io/badge/Rust-1.85+-000000?style=flat&logo=rust&logoColor=white" alt="Rust" /></a>
|
|
20
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-22c55e?style=flat" alt="MIT" /></a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p>
|
|
24
|
+
<a href="#🚀-quick-onboarding">Quick Onboarding</a> •
|
|
25
|
+
<a href="#📦-installation">Installation</a> •
|
|
26
|
+
<a href="#📋-command-options">Command Options</a> •
|
|
27
|
+
<a href="#🖥️-interactive-tui">Interactive TUI</a> •
|
|
28
|
+
<a href="#🛡️-security--isolation">Security</a> •
|
|
29
|
+
<a href="#🔧-troubleshooting">Troubleshooting</a>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<br />
|
|
33
|
+
|
|
34
|
+
<img src="https://img.shields.io/badge/Linux-supported-FCC624?style=flat&logo=linux&logoColor=black" alt="Linux" />
|
|
35
|
+
<img src="https://img.shields.io/badge/macOS-supported-000000?style=flat&logo=apple&logoColor=white" alt="macOS" />
|
|
36
|
+
<img src="https://img.shields.io/badge/Windows-build%20from%20source-lightgrey?style=flat&logo=windows&logoColor=white" alt="Windows" />
|
|
37
|
+
|
|
38
|
+
<br /><br />
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🎯 The Problem
|
|
44
|
+
|
|
45
|
+
[Claude Code](https://claude.com/claude-code) keeps exactly one login in `~/.claude`. When you have a work account, a personal account, and client accounts, you are forced to constantly log out, log in, and do OAuth round-trips.
|
|
46
|
+
|
|
47
|
+
**`claude-user` (aliased as `cuser`) is the fix.** Register each account once as a profile. Switch with one command. `claude` launches already logged in — no re-auth, no shared history, no manual file shuffling.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 📋 Prerequisites
|
|
52
|
+
|
|
53
|
+
Before getting started, make sure you have installed the official **Claude Code** CLI:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g @anthropic-ai/claude-code
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
> [!NOTE]
|
|
60
|
+
> `claude-user` is a helper to switch account environments; it does not replace or install the `claude` command itself.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🚀 Quick Onboarding
|
|
65
|
+
|
|
66
|
+
Get up and running with multiple profiles in under a minute:
|
|
67
|
+
|
|
68
|
+
### 1. Import your current logged-in account
|
|
69
|
+
If you already have a logged-in session, import it as your first profile (e.g., named `work`):
|
|
70
|
+
```bash
|
|
71
|
+
cuser import work
|
|
72
|
+
```
|
|
73
|
+
*This moves your existing `~/.claude` session files into a profile named `work`. You won't need to log in again.*
|
|
74
|
+
|
|
75
|
+
### 2. Add your second account
|
|
76
|
+
Create a brand new profile (e.g., named `personal`) and log in:
|
|
77
|
+
```bash
|
|
78
|
+
cuser personal
|
|
79
|
+
```
|
|
80
|
+
*Since the `personal` profile does not exist yet, `cuser` creates it and launches the Claude onboarding login flow. Complete the OAuth login once.*
|
|
81
|
+
|
|
82
|
+
### 3. Switch instantly
|
|
83
|
+
Now switch between your accounts anytime by passing the profile name:
|
|
84
|
+
```bash
|
|
85
|
+
cuser work
|
|
86
|
+
cuser personal
|
|
87
|
+
```
|
|
88
|
+
*Every time you run a profile command, it swaps the symlinks. Your bare `claude` command will also automatically use the last activated profile!*
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 📦 Installation
|
|
93
|
+
|
|
94
|
+
Choose one of the methods below to install the `claude-user` and `cuser` commands:
|
|
95
|
+
|
|
96
|
+
### Method A: npm (Recommended)
|
|
97
|
+
```bash
|
|
98
|
+
npm install -g claude-user
|
|
99
|
+
```
|
|
100
|
+
*Pulls in the correct prebuilt binary for your platform automatically.*
|
|
101
|
+
|
|
102
|
+
### Method B: Shell Script (Linux / macOS)
|
|
103
|
+
```bash
|
|
104
|
+
curl -fsSL https://raw.githubusercontent.com/divyo-argha/claude-user/main/install.sh | sh
|
|
105
|
+
```
|
|
106
|
+
*Downloads the latest release into `~/.local/bin`.*
|
|
107
|
+
|
|
108
|
+
### Method C: Cargo / Build from Source
|
|
109
|
+
```bash
|
|
110
|
+
git clone https://github.com/divyo-argha/claude-user.git
|
|
111
|
+
cd claude-user
|
|
112
|
+
cargo install --path .
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 📋 Command Options
|
|
118
|
+
|
|
119
|
+
You can invoke `claude-user` using the full command or the short alias `cuser` (which works identically).
|
|
120
|
+
|
|
121
|
+
### Primary Actions
|
|
122
|
+
| Command | Short / Alias | Description | Example |
|
|
123
|
+
| :--- | :--- | :--- | :--- |
|
|
124
|
+
| `cuser` | | Open the interactive console profile picker | `cuser` |
|
|
125
|
+
| `cuser <profile>` | | Launch Claude with this profile (creates it if new) | `cuser work` |
|
|
126
|
+
| `cuser <profile> [args...]` | | Launch profile, forwarding all remaining arguments to Claude | `cuser personal --continue` |
|
|
127
|
+
|
|
128
|
+
### Profile & Config Management
|
|
129
|
+
| Command | Alias / Alternates | Description | Example |
|
|
130
|
+
| :--- | :--- | :--- | :--- |
|
|
131
|
+
| `cuser import [name]` | `cuser migrate [name]` | Import current `~/.claude` credentials as a profile | `cuser import work` |
|
|
132
|
+
| `cuser list` | `cuser -l` | List all profiles with linked email/org information | `cuser list` |
|
|
133
|
+
| `cuser rename <old> <new>` | | Rename an existing profile | `cuser rename main work` |
|
|
134
|
+
| `cuser remove <profile>` | `cuser rm`, `cuser delete` | Delete profile directory and stored credentials (asks confirmation) | `cuser remove personal` |
|
|
135
|
+
| `cuser sync` | | Sync files from `shared/` directory into all profiles | `cuser sync` |
|
|
136
|
+
|
|
137
|
+
### System Commands
|
|
138
|
+
| Command | Short / Alias | Description |
|
|
139
|
+
| :--- | :--- | :--- |
|
|
140
|
+
| `cuser --update` | `cuser update` | Check and update to the latest release version |
|
|
141
|
+
| `cuser --version` | `cuser -v` | Show installed version |
|
|
142
|
+
| `cuser --help` | `cuser -h` | Show help message |
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 🖥️ Interactive TUI
|
|
147
|
+
|
|
148
|
+
If you run `cuser` with no arguments, it opens the interactive Terminal User Interface:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
┌ cuser — Claude account switcher ───────────────────────┐
|
|
152
|
+
│ ↑/↓ move · Enter select · d delete · r rename · q quit │
|
|
153
|
+
├────────────────────────────────────────────────────────┤
|
|
154
|
+
│ Profiles │
|
|
155
|
+
│ > work (you@company.com • Acme Corp) │
|
|
156
|
+
│ personal (you@gmail.com) │
|
|
157
|
+
│ + Import ~/.claude │
|
|
158
|
+
│ + New profile │
|
|
159
|
+
├────────────────────────────────────────────────────────┤
|
|
160
|
+
│ Select a profile and press Enter. │
|
|
161
|
+
└────────────────────────────────────────────────────────┘
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Keyboard Navigation
|
|
165
|
+
* <kbd>↑</kbd> or <kbd>k</kbd> / <kbd>↓</kbd> or <kbd>j</kbd>: Navigate through profiles
|
|
166
|
+
* <kbd>Enter ↵</kbd>: Select and launch the profile
|
|
167
|
+
* <kbd>r</kbd>: Rename the highlighted profile
|
|
168
|
+
* <kbd>d</kbd>: Delete the highlighted profile (will ask for `y`/`n` confirmation)
|
|
169
|
+
* <kbd>q</kbd> or <kbd>Esc</kbd>: Exit the picker
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 🛡️ Security & Isolation
|
|
174
|
+
|
|
175
|
+
* **Strict Directory Permissions:** Profiles are created under `~/.claude-profiles/` with `0700` (read/write/execute by owner only) permissions. Sensitive credentials (`.credentials.json` and `.claude.json`) are hardened to `0600` permissions.
|
|
176
|
+
* **Safe Syncing:** The `cuser sync` command always ignores credential and onboarding files (`.credentials.json`, `.claude.json`), preventing accidental overwrite of auth tokens.
|
|
177
|
+
* **Local Operation:** `claude-user` runs entirely offline and locally. The only network call it makes is checking for software updates when you explicitly run `cuser --update`.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 🔧 Troubleshooting
|
|
182
|
+
|
|
183
|
+
| Issue / Error | Solution |
|
|
184
|
+
| :--- | :--- |
|
|
185
|
+
| `~/.claude exists and isn't managed by cuser` | Your `~/.claude` is a real folder, not a symlink. Import it using `cuser import default` or move it out of the way with `mv ~/.claude ~/.claude.bak`. |
|
|
186
|
+
| `failed to launch claude (is it installed and on PATH?)` | You must install the official Claude Code package first (`npm install -g @anthropic-ai/claude-code`). `cuser` is a profile manager, not a Claude replacement. |
|
|
187
|
+
| `cuser: command not found` | If installed globally via npm, ensure your global npm bin directory is added to your shell's `PATH`. |
|
|
188
|
+
| Picker draws garbled / doesn't respond | The TUI requires an interactive terminal (TTY) with raw mode support. It will not work inside pipes, non-interactive shells, or some minimal IDE terminals. |
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { spawnSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
'linux-x64': 'claude-user-linux-x64',
|
|
9
|
+
'linux-arm64': 'claude-user-linux-arm64',
|
|
10
|
+
'darwin-x64': 'claude-user-darwin-x64',
|
|
11
|
+
'darwin-arm64': 'claude-user-darwin-arm64',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function resolveBinary() {
|
|
15
|
+
const key = `${process.platform}-${process.arch}`;
|
|
16
|
+
const pkgName = PLATFORMS[key];
|
|
17
|
+
|
|
18
|
+
if (!pkgName) {
|
|
19
|
+
const isWindows = process.platform === 'win32';
|
|
20
|
+
const instructions = isWindows
|
|
21
|
+
? `1. Install Rust by downloading and running: https://rustup.rs/\n` +
|
|
22
|
+
`2. Build and install the tool via PowerShell/Command Prompt:\n` +
|
|
23
|
+
` git clone https://github.com/divyo-argha/claude-user.git\n` +
|
|
24
|
+
` cd claude-user\n` +
|
|
25
|
+
` cargo install --path .`
|
|
26
|
+
: `1. Install Rust:\n` +
|
|
27
|
+
` curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n` +
|
|
28
|
+
`2. Build and install the tool:\n` +
|
|
29
|
+
` git clone https://github.com/divyo-argha/claude-user.git\n` +
|
|
30
|
+
` cd claude-user\n` +
|
|
31
|
+
` cargo install --path .`;
|
|
32
|
+
|
|
33
|
+
throw new Error(
|
|
34
|
+
`claude-user does not ship a prebuilt binary for ${process.platform}/${process.arch}.\n\n` +
|
|
35
|
+
`To build and install from source, follow these steps:\n\n${instructions}`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let pkgJsonPath;
|
|
40
|
+
try {
|
|
41
|
+
pkgJsonPath = require.resolve(`${pkgName}/package.json`);
|
|
42
|
+
} catch {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Could not find the "${pkgName}" package.\n` +
|
|
45
|
+
`It should have been installed automatically as an optional dependency of claude-user.\n` +
|
|
46
|
+
`Try reinstalling: npm install claude-user --force`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return path.join(path.dirname(pkgJsonPath), 'bin', 'cuser');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function main() {
|
|
54
|
+
const binPath = resolveBinary();
|
|
55
|
+
const result = spawnSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
56
|
+
|
|
57
|
+
if (result.error) {
|
|
58
|
+
if (result.error.code === 'ENOENT') {
|
|
59
|
+
console.error(`claude-user: could not execute "${binPath}"`);
|
|
60
|
+
} else {
|
|
61
|
+
console.error(result.error.message);
|
|
62
|
+
}
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (result.signal) {
|
|
67
|
+
process.kill(process.pid, result.signal);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
process.exit(result.status === null ? 1 : result.status);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
main();
|
|
76
|
+
} catch (err) {
|
|
77
|
+
console.error(err.message);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const orange = '\x1b[38;5;208m';
|
|
5
|
+
const slate = '\x1b[38;5;244m';
|
|
6
|
+
const green = '\x1b[1;32m';
|
|
7
|
+
const bold = '\x1b[1m';
|
|
8
|
+
const reset = '\x1b[0m';
|
|
9
|
+
|
|
10
|
+
console.log('');
|
|
11
|
+
console.log(`${orange}░█▀▀░█░░░█▀█░█░█░█▀▄░█▀▀${slate}░░░░░█░█░█▀▀░█▀▀░█▀▄${reset}`);
|
|
12
|
+
console.log(`${orange}░█░░░█░░░█▀█░█░█░█░█░█▀▀${slate}░▄▄▄░█░█░▀▀█░█▀▀░█▀▄${reset}`);
|
|
13
|
+
console.log(`${orange}░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀░░▀▀▀${slate}░░░░░▀▀▀░▀▀▀░▀▀▀░▀░▀${reset}\n`);
|
|
14
|
+
|
|
15
|
+
const pkg = require('../package.json');
|
|
16
|
+
console.log(`${green}✓ Installed claude-user v${pkg.version} successfully!${reset}`);
|
|
17
|
+
console.log(`Run ${bold}cuser${reset} to get started switching profiles.\n`);
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-user",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Switch between multiple Claude Code accounts with an interactive picker — isolated config, credentials, and settings per profile.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"cli",
|
|
9
|
+
"accounts",
|
|
10
|
+
"profiles",
|
|
11
|
+
"multi-account",
|
|
12
|
+
"anthropic"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/divyo-argha/claude-user#readme",
|
|
15
|
+
"bugs": "https://github.com/divyo-argha/claude-user/issues",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/divyo-argha/claude-user.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "divyo-argha",
|
|
22
|
+
"bin": {
|
|
23
|
+
"claude-user": "bin/claude-user.js",
|
|
24
|
+
"cuser": "bin/claude-user.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=14"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"postinstall": "node bin/postinstall.js"
|
|
34
|
+
},
|
|
35
|
+
"os": [
|
|
36
|
+
"linux",
|
|
37
|
+
"darwin"
|
|
38
|
+
],
|
|
39
|
+
"optionalDependencies": {
|
|
40
|
+
"claude-user-linux-x64": "0.2.0",
|
|
41
|
+
"claude-user-linux-arm64": "0.2.0",
|
|
42
|
+
"claude-user-darwin-x64": "0.2.0",
|
|
43
|
+
"claude-user-darwin-arm64": "0.2.0"
|
|
44
|
+
}
|
|
45
|
+
}
|