@synth1s/cloak 1.0.0 → 1.1.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 +37 -29
- package/package.json +1 -1
- package/src/cli.js +3 -0
- package/src/commands/init.js +2 -0
- package/src/lib/tip.js +14 -0
package/README.md
CHANGED
|
@@ -18,45 +18,34 @@ Cloak gives each account its own isolated directory using Claude Code's official
|
|
|
18
18
|
npm install -g @synth1s/cloak
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
eval "$(cloak init)"
|
|
25
|
-
```
|
|
21
|
+
That's it. No setup required. All commands work immediately.
|
|
26
22
|
|
|
27
23
|
## Quick start
|
|
28
24
|
|
|
29
25
|
```bash
|
|
30
|
-
#
|
|
31
|
-
|
|
26
|
+
# Save your current Claude session
|
|
27
|
+
cloak create work
|
|
32
28
|
|
|
33
29
|
# Log out, log in with another account, then:
|
|
34
|
-
|
|
30
|
+
cloak create home
|
|
35
31
|
|
|
36
32
|
# Throw on a cloak and go
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
cloak launch work
|
|
34
|
+
cloak launch home
|
|
39
35
|
```
|
|
40
36
|
|
|
41
37
|
## Commands
|
|
42
38
|
|
|
43
|
-
### Wardrobe management
|
|
44
|
-
|
|
45
|
-
| Command | Alias | Description |
|
|
46
|
-
|---------|-------|-------------|
|
|
47
|
-
| `claude account create [name]` | | Save current session as a new cloak |
|
|
48
|
-
| `claude account switch <name>` | `use` | Wear a different cloak |
|
|
49
|
-
| `claude account list` | `ls` | See all cloaks in your wardrobe |
|
|
50
|
-
| `claude account delete <name>` | `rm` | Discard a cloak |
|
|
51
|
-
| `claude account whoami` | | Which cloak are you wearing? |
|
|
52
|
-
| `claude account rename <old> <new>` | | Rename a cloak |
|
|
53
|
-
|
|
54
|
-
### Shortcut
|
|
55
|
-
|
|
56
39
|
| Command | Description |
|
|
57
40
|
|---------|-------------|
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
41
|
+
| `cloak create [name]` | Save current session as a new cloak |
|
|
42
|
+
| `cloak launch <name> [args...]` | Throw on a cloak and launch Claude |
|
|
43
|
+
| `cloak list` | See all cloaks in your wardrobe |
|
|
44
|
+
| `cloak whoami` | Which cloak are you wearing? |
|
|
45
|
+
| `cloak delete <name>` | Discard a cloak |
|
|
46
|
+
| `cloak rename <old> <new>` | Rename a cloak |
|
|
47
|
+
| `cloak switch <name>` | Set `CLAUDE_CONFIG_DIR` without launching |
|
|
48
|
+
| `cloak init` | Output shell integration code (optional) |
|
|
60
49
|
|
|
61
50
|
## Concurrent sessions
|
|
62
51
|
|
|
@@ -64,12 +53,32 @@ Different terminal, different cloak. No conflicts.
|
|
|
64
53
|
|
|
65
54
|
```bash
|
|
66
55
|
# Terminal A — wearing the work cloak:
|
|
67
|
-
|
|
56
|
+
cloak launch work
|
|
68
57
|
|
|
69
58
|
# Terminal B — wearing the home cloak:
|
|
70
|
-
|
|
59
|
+
cloak launch home
|
|
71
60
|
```
|
|
72
61
|
|
|
62
|
+
## Shell integration (optional)
|
|
63
|
+
|
|
64
|
+
Want `claude -a work` and `claude account` syntax? Add to your `.bashrc` or `.zshrc`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
eval "$(cloak init)"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This enables:
|
|
71
|
+
|
|
72
|
+
| Command | Routes to |
|
|
73
|
+
|---------|-----------|
|
|
74
|
+
| `claude -a <name>` | `cloak launch <name>` |
|
|
75
|
+
| `claude account create [name]` | `cloak create` |
|
|
76
|
+
| `claude account list` | `cloak list` |
|
|
77
|
+
| `claude account whoami` | `cloak whoami` |
|
|
78
|
+
| `claude account switch <name>` | `cloak switch` (sets env in current shell) |
|
|
79
|
+
| `claude account delete <name>` | `cloak delete` |
|
|
80
|
+
| `claude account rename <old> <new>` | `cloak rename` |
|
|
81
|
+
|
|
73
82
|
## How it works
|
|
74
83
|
|
|
75
84
|
Each cloak is an isolated directory that acts as a [`CLAUDE_CONFIG_DIR`](https://code.claude.com/docs/en/env-vars):
|
|
@@ -86,12 +95,11 @@ Each cloak is an isolated directory that acts as a [`CLAUDE_CONFIG_DIR`](https:/
|
|
|
86
95
|
└── ...
|
|
87
96
|
```
|
|
88
97
|
|
|
89
|
-
When you run `
|
|
98
|
+
When you run `cloak launch work`, Cloak sets `CLAUDE_CONFIG_DIR=~/.cloak/profiles/work` and spawns Claude Code. Each terminal gets its own environment, so you can wear different cloaks simultaneously.
|
|
90
99
|
|
|
91
100
|
## Requirements
|
|
92
101
|
|
|
93
102
|
- Node.js >= 18
|
|
94
|
-
- bash or zsh (for shell integration)
|
|
95
103
|
|
|
96
104
|
## Documentation
|
|
97
105
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ import { readFileSync } from 'fs'
|
|
|
5
5
|
import { fileURLToPath } from 'url'
|
|
6
6
|
import { dirname, join } from 'path'
|
|
7
7
|
|
|
8
|
+
import { showTipIfNeeded } from './lib/tip.js'
|
|
8
9
|
import { createAccount } from './commands/create.js'
|
|
9
10
|
import { switchAccount } from './commands/switch.js'
|
|
10
11
|
import { listAccounts } from './commands/list.js'
|
|
@@ -17,6 +18,8 @@ import { initShell } from './commands/init.js'
|
|
|
17
18
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
18
19
|
const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'))
|
|
19
20
|
|
|
21
|
+
showTipIfNeeded()
|
|
22
|
+
|
|
20
23
|
program
|
|
21
24
|
.name('cloak')
|
|
22
25
|
.description('Cloak your Claude. Switch identities in seconds.')
|
package/src/commands/init.js
CHANGED
package/src/lib/tip.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
|
|
3
|
+
export function showTipIfNeeded() {
|
|
4
|
+
if (process.env.CLOAK_SHELL_INTEGRATION === '1') return
|
|
5
|
+
if (process.env.CLOAK_TIP_SHOWN === '1') return
|
|
6
|
+
if (!process.stdout.isTTY) return
|
|
7
|
+
|
|
8
|
+
process.stderr.write(
|
|
9
|
+
chalk.dim('\n💡 Tip: Run this once to enable "claude -a" and "claude account":\n') +
|
|
10
|
+
chalk.dim(' echo \'eval "$(cloak init)"\' >> ~/.bashrc && source ~/.bashrc\n\n')
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
process.env.CLOAK_TIP_SHOWN = '1'
|
|
14
|
+
}
|