@synth1s/cloak 2.2.0 → 2.3.1
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 +81 -65
- package/package.json +7 -3
- package/src/cli.js +8 -5
package/README.md
CHANGED
|
@@ -4,17 +4,25 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@synth1s/cloak)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Stop logging out. Start switching.**
|
|
8
8
|
|
|
9
9
|
Every developer wears a different cloak. One for work, one for personal projects, one for that freelance gig. **Cloak** lets you dress your Claude Code in the right identity — and switch between them without breaking a sweat.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Sessions, tokens, MCP servers, and settings fully preserved. Concurrent sessions across terminals. [181+ developers asked for this.](https://github.com/anthropics/claude-code/issues/18435)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Before / After
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**Before Cloak:**
|
|
16
|
+
```
|
|
17
|
+
claude → /logout → /login (lose session) → work on project
|
|
18
|
+
claude → /logout → /login (lose session) → personal use
|
|
19
|
+
```
|
|
16
20
|
|
|
17
|
-
Cloak
|
|
21
|
+
**After Cloak:**
|
|
22
|
+
```
|
|
23
|
+
claude -a work # instant. sessions preserved.
|
|
24
|
+
claude -a home # in another terminal. at the same time.
|
|
25
|
+
```
|
|
18
26
|
|
|
19
27
|
## Install
|
|
20
28
|
|
|
@@ -22,21 +30,24 @@ Cloak gives each account its own isolated directory using Claude Code's official
|
|
|
22
30
|
npm install -g @synth1s/cloak
|
|
23
31
|
```
|
|
24
32
|
|
|
25
|
-
##
|
|
33
|
+
## 3 steps to get started
|
|
26
34
|
|
|
27
35
|
```bash
|
|
28
|
-
# Save your current Claude session
|
|
36
|
+
# 1. Save your current Claude session
|
|
29
37
|
cloak create work
|
|
30
38
|
|
|
31
|
-
# Log out, log in with another account, then:
|
|
39
|
+
# 2. Log out, log in with another account in Claude, then:
|
|
32
40
|
cloak create home
|
|
33
41
|
|
|
34
|
-
# Set up shell integration
|
|
35
|
-
|
|
42
|
+
# 3. Set up shell integration
|
|
43
|
+
cloak switch work # follows the guided setup on first run
|
|
44
|
+
```
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
That's it. From now on:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
claude -a work # switch and launch
|
|
50
|
+
claude -a home # in another terminal, at the same time
|
|
40
51
|
```
|
|
41
52
|
|
|
42
53
|
## Commands
|
|
@@ -44,109 +55,114 @@ claude -a home
|
|
|
44
55
|
| Command | Description |
|
|
45
56
|
|---------|-------------|
|
|
46
57
|
| `cloak create [name]` | Save current session as a new cloak |
|
|
47
|
-
| `cloak switch <name>` |
|
|
58
|
+
| `cloak switch <name>` | Wear a different cloak |
|
|
48
59
|
| `cloak list` | See all cloaks in your wardrobe |
|
|
49
60
|
| `cloak whoami` | Which cloak are you wearing? |
|
|
50
61
|
| `cloak delete <name>` | Discard a cloak |
|
|
51
62
|
| `cloak rename <old> <new>` | Rename a cloak |
|
|
52
|
-
| `cloak init` | Output shell integration code |
|
|
53
|
-
|
|
54
|
-
## Shell integration (recommended)
|
|
55
|
-
|
|
56
|
-
Add to your `.bashrc` or `.zshrc`:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
eval "$(cloak init)"
|
|
60
|
-
```
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
With shell integration (`eval "$(cloak init)"`):
|
|
63
65
|
|
|
64
66
|
| Command | Description |
|
|
65
67
|
|---------|-------------|
|
|
66
|
-
| `claude -a <name>` |
|
|
67
|
-
| `claude
|
|
68
|
-
| `claude account create [name]` | Save current session as a new cloak |
|
|
69
|
-
| `claude account switch <name>` | Wear a different cloak |
|
|
70
|
-
| `claude account list` | See all cloaks in your wardrobe |
|
|
71
|
-
| `claude account whoami` | Which cloak are you wearing? |
|
|
72
|
-
| `claude account delete <name>` | Discard a cloak |
|
|
73
|
-
| `claude account rename <old> <new>` | Rename a cloak |
|
|
68
|
+
| `claude -a <name>` | Switch and launch Claude |
|
|
69
|
+
| `claude account <cmd>` | All cloak commands via claude |
|
|
74
70
|
|
|
75
71
|
## Concurrent sessions
|
|
76
72
|
|
|
77
|
-
Different terminal, different
|
|
73
|
+
Different terminal, different identity. No conflicts.
|
|
78
74
|
|
|
79
75
|
```bash
|
|
80
|
-
# Terminal A
|
|
76
|
+
# Terminal A:
|
|
81
77
|
claude -a work
|
|
82
78
|
|
|
83
|
-
# Terminal B
|
|
79
|
+
# Terminal B (at the same time):
|
|
84
80
|
claude -a home
|
|
85
81
|
```
|
|
86
82
|
|
|
83
|
+
Each account is a completely isolated directory. No file overlap, no token conflicts.
|
|
84
|
+
|
|
85
|
+
## Context bar
|
|
86
|
+
|
|
87
|
+
Every command shows which identity is active:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
cloak > list . work <filipe@company.com> ────────────────────────────
|
|
91
|
+
|
|
92
|
+
Your Cloaks
|
|
93
|
+
|
|
94
|
+
> work (active) — filipe@company.com
|
|
95
|
+
home — filipe@personal.com
|
|
96
|
+
```
|
|
97
|
+
|
|
87
98
|
## How it works
|
|
88
99
|
|
|
89
|
-
|
|
100
|
+
Cloak uses Claude Code's official [`CLAUDE_CONFIG_DIR`](https://code.claude.com/docs/en/env-vars) environment variable. Each account gets its own directory:
|
|
90
101
|
|
|
91
102
|
```
|
|
92
103
|
~/.cloak/
|
|
93
104
|
└── profiles/
|
|
94
|
-
├── work/ #
|
|
105
|
+
├── work/ # complete, isolated config
|
|
95
106
|
│ ├── .claude.json
|
|
96
107
|
│ ├── settings.json
|
|
97
108
|
│ └── ...
|
|
98
|
-
└── home/
|
|
109
|
+
└── home/
|
|
99
110
|
├── .claude.json
|
|
100
111
|
└── ...
|
|
101
112
|
```
|
|
102
113
|
|
|
103
|
-
|
|
114
|
+
Switching changes which directory Claude Code reads from. Nothing is copied, moved, or overwritten.
|
|
104
115
|
|
|
105
116
|
## FAQ
|
|
106
117
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
No. Each account is a completely isolated directory. Switching only changes which directory Claude Code reads from — it doesn't copy, move, or overwrite any files. Your settings, MCP servers, and preferences for each account stay exactly where they are.
|
|
110
|
-
|
|
111
|
-
### Can I lose data when running multiple accounts simultaneously?
|
|
118
|
+
<details>
|
|
119
|
+
<summary><strong>Will switching overwrite my settings?</strong></summary>
|
|
112
120
|
|
|
113
|
-
No
|
|
121
|
+
No. Each account is a completely isolated directory. Switching only changes which directory Claude Code reads from. Your settings, MCP servers, and preferences for each account stay exactly where they are.
|
|
122
|
+
</details>
|
|
114
123
|
|
|
115
|
-
|
|
124
|
+
<details>
|
|
125
|
+
<summary><strong>Are token renewals preserved?</strong></summary>
|
|
116
126
|
|
|
117
|
-
Yes. When Claude Code renews your OAuth token during a session, it writes
|
|
127
|
+
Yes. When Claude Code renews your OAuth token during a session, it writes to the active account's directory. When you switch away and back, the renewed token is still there.
|
|
128
|
+
</details>
|
|
118
129
|
|
|
119
|
-
|
|
130
|
+
<details>
|
|
131
|
+
<summary><strong>Can I lose data with multiple accounts running?</strong></summary>
|
|
120
132
|
|
|
121
|
-
No
|
|
133
|
+
No, as long as each terminal uses a different account. Each has its own directory — no file overlap.
|
|
134
|
+
</details>
|
|
122
135
|
|
|
123
|
-
|
|
136
|
+
<details>
|
|
137
|
+
<summary><strong>Is my auth token safe?</strong></summary>
|
|
124
138
|
|
|
125
|
-
|
|
139
|
+
Cloak never transmits, logs, or modifies your tokens. It only copies files during `cloak create` and changes an environment variable during `cloak switch`. All data stays local. Credential files are created with restrictive permissions (0o600).
|
|
140
|
+
</details>
|
|
126
141
|
|
|
127
|
-
|
|
142
|
+
<details>
|
|
143
|
+
<summary><strong>What if I uninstall Cloak?</strong></summary>
|
|
128
144
|
|
|
129
|
-
Your account directories remain in `~/.cloak/`. Claude Code
|
|
145
|
+
Your account directories remain in `~/.cloak/`. Claude Code works normally with its default config. To clean up: `rm -rf ~/.cloak`
|
|
146
|
+
</details>
|
|
130
147
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
claude
|
|
134
|
-
```
|
|
148
|
+
<details>
|
|
149
|
+
<summary><strong>Does it work with IDE extensions?</strong></summary>
|
|
135
150
|
|
|
136
|
-
|
|
151
|
+
IDE extensions may not respect `CLAUDE_CONFIG_DIR` ([known limitation](https://github.com/anthropics/claude-code/issues/4739)). Cloak is designed for terminal-based Claude Code.
|
|
152
|
+
</details>
|
|
137
153
|
|
|
138
|
-
|
|
154
|
+
## Requirements
|
|
139
155
|
|
|
140
|
-
|
|
156
|
+
- Node.js >= 18
|
|
157
|
+
- bash or zsh (for shell integration)
|
|
141
158
|
|
|
142
|
-
|
|
159
|
+
## Contributing
|
|
143
160
|
|
|
144
|
-
|
|
161
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
145
162
|
|
|
146
|
-
##
|
|
163
|
+
## Security
|
|
147
164
|
|
|
148
|
-
|
|
149
|
-
- bash or zsh (for shell integration)
|
|
165
|
+
See [SECURITY.md](SECURITY.md).
|
|
150
166
|
|
|
151
167
|
## Documentation
|
|
152
168
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synth1s/cloak",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Cloak your Claude. Switch identities in seconds.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,12 +18,16 @@
|
|
|
18
18
|
"cli",
|
|
19
19
|
"switch",
|
|
20
20
|
"multi-account",
|
|
21
|
-
"cloak"
|
|
21
|
+
"cloak",
|
|
22
|
+
"switch-account",
|
|
23
|
+
"identity",
|
|
24
|
+
"multi-user",
|
|
25
|
+
"config"
|
|
22
26
|
],
|
|
23
27
|
"author": "synth1s",
|
|
24
28
|
"license": "MIT",
|
|
25
29
|
"dependencies": {
|
|
26
|
-
"commander": "^
|
|
30
|
+
"commander": "^14.0.3",
|
|
27
31
|
"chalk": "^5.3.0",
|
|
28
32
|
"inquirer": "^10.1.0"
|
|
29
33
|
},
|
package/src/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { program
|
|
3
|
+
import { program } from 'commander'
|
|
4
4
|
import { readFileSync } from 'fs'
|
|
5
5
|
import { fileURLToPath } from 'url'
|
|
6
6
|
import { dirname, join } from 'path'
|
|
@@ -20,6 +20,10 @@ const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'))
|
|
|
20
20
|
|
|
21
21
|
showTipIfNeeded()
|
|
22
22
|
|
|
23
|
+
// Extract --print-env before commander parses (internal flag, not user-facing)
|
|
24
|
+
const _printEnv = process.argv.includes('--print-env')
|
|
25
|
+
const argv = process.argv.filter(a => a !== '--print-env')
|
|
26
|
+
|
|
23
27
|
program
|
|
24
28
|
.name('cloak')
|
|
25
29
|
.description('Cloak your Claude. Switch identities in seconds.')
|
|
@@ -52,9 +56,8 @@ program
|
|
|
52
56
|
.alias('use')
|
|
53
57
|
.description('Wear a different cloak')
|
|
54
58
|
.action((name) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return switchAccount(name, { printEnv })
|
|
59
|
+
if (!_printEnv) renderContextBar('switch')
|
|
60
|
+
return switchAccount(name, { printEnv: _printEnv })
|
|
58
61
|
})
|
|
59
62
|
|
|
60
63
|
program
|
|
@@ -102,4 +105,4 @@ program
|
|
|
102
105
|
.description('Output shell integration code')
|
|
103
106
|
.action(initShell)
|
|
104
107
|
|
|
105
|
-
program.parse()
|
|
108
|
+
program.parse(argv)
|