@synth1s/cloak 1.1.2 → 1.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/README.md +32 -30
- package/package.json +1 -1
- package/src/cli.js +0 -7
- package/src/commands/init.js +1 -1
- package/src/commands/launch.js +0 -29
package/README.md
CHANGED
|
@@ -18,8 +18,6 @@ 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
|
-
That's it. No setup required. All commands work immediately.
|
|
22
|
-
|
|
23
21
|
## Quick start
|
|
24
22
|
|
|
25
23
|
```bash
|
|
@@ -29,9 +27,12 @@ cloak create work
|
|
|
29
27
|
# Log out, log in with another account, then:
|
|
30
28
|
cloak create home
|
|
31
29
|
|
|
30
|
+
# Set up shell integration (recommended)
|
|
31
|
+
echo 'eval "$(cloak init)"' >> ~/.bashrc && source ~/.bashrc
|
|
32
|
+
|
|
32
33
|
# Throw on a cloak and go
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
claude -a work
|
|
35
|
+
claude -a home
|
|
35
36
|
```
|
|
36
37
|
|
|
37
38
|
## Commands
|
|
@@ -39,45 +40,45 @@ cloak launch home
|
|
|
39
40
|
| Command | Description |
|
|
40
41
|
|---------|-------------|
|
|
41
42
|
| `cloak create [name]` | Save current session as a new cloak |
|
|
42
|
-
| `cloak
|
|
43
|
+
| `cloak switch <name>` | Set `CLAUDE_CONFIG_DIR` for the current shell |
|
|
43
44
|
| `cloak list` | See all cloaks in your wardrobe |
|
|
44
45
|
| `cloak whoami` | Which cloak are you wearing? |
|
|
45
46
|
| `cloak delete <name>` | Discard a cloak |
|
|
46
47
|
| `cloak rename <old> <new>` | Rename a cloak |
|
|
47
|
-
| `cloak
|
|
48
|
-
| `cloak init` | Output shell integration code (optional) |
|
|
48
|
+
| `cloak init` | Output shell integration code |
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## Shell integration (recommended)
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Add to your `.bashrc` or `.zshrc`:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
|
|
56
|
-
cloak launch work
|
|
57
|
-
|
|
58
|
-
# Terminal B — wearing the home cloak:
|
|
59
|
-
cloak launch home
|
|
55
|
+
eval "$(cloak init)"
|
|
60
56
|
```
|
|
61
57
|
|
|
62
|
-
|
|
58
|
+
This enables:
|
|
59
|
+
|
|
60
|
+
| Command | Description |
|
|
61
|
+
|---------|-------------|
|
|
62
|
+
| `claude -a <name>` | Throw on a cloak and launch Claude |
|
|
63
|
+
| `claude -a <name> [args...]` | Throw on a cloak and launch with arguments |
|
|
64
|
+
| `claude account create [name]` | Save current session as a new cloak |
|
|
65
|
+
| `claude account switch <name>` | Wear a different cloak |
|
|
66
|
+
| `claude account list` | See all cloaks in your wardrobe |
|
|
67
|
+
| `claude account whoami` | Which cloak are you wearing? |
|
|
68
|
+
| `claude account delete <name>` | Discard a cloak |
|
|
69
|
+
| `claude account rename <old> <new>` | Rename a cloak |
|
|
70
|
+
|
|
71
|
+
## Concurrent sessions
|
|
63
72
|
|
|
64
|
-
|
|
73
|
+
Different terminal, different cloak. No conflicts.
|
|
65
74
|
|
|
66
75
|
```bash
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
This enables:
|
|
76
|
+
# Terminal A — wearing the work cloak:
|
|
77
|
+
claude -a work
|
|
71
78
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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` |
|
|
79
|
+
# Terminal B — wearing the home cloak:
|
|
80
|
+
claude -a home
|
|
81
|
+
```
|
|
81
82
|
|
|
82
83
|
## How it works
|
|
83
84
|
|
|
@@ -95,11 +96,12 @@ Each cloak is an isolated directory that acts as a [`CLAUDE_CONFIG_DIR`](https:/
|
|
|
95
96
|
└── ...
|
|
96
97
|
```
|
|
97
98
|
|
|
98
|
-
When you run `
|
|
99
|
+
When you run `claude -a work`, Cloak sets `CLAUDE_CONFIG_DIR=~/.cloak/profiles/work` in your current shell and launches Claude Code. Each terminal gets its own environment, so you can wear different cloaks simultaneously.
|
|
99
100
|
|
|
100
101
|
## Requirements
|
|
101
102
|
|
|
102
103
|
- Node.js >= 18
|
|
104
|
+
- bash or zsh (for shell integration)
|
|
103
105
|
|
|
104
106
|
## Documentation
|
|
105
107
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -12,7 +12,6 @@ import { listAccounts } from './commands/list.js'
|
|
|
12
12
|
import { deleteAccount } from './commands/delete.js'
|
|
13
13
|
import { whoami } from './commands/whoami.js'
|
|
14
14
|
import { renameAccount } from './commands/rename.js'
|
|
15
|
-
import { launchAccount } from './commands/launch.js'
|
|
16
15
|
import { initShell } from './commands/init.js'
|
|
17
16
|
|
|
18
17
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
@@ -59,12 +58,6 @@ program
|
|
|
59
58
|
.description('Rename a cloak')
|
|
60
59
|
.action(renameAccount)
|
|
61
60
|
|
|
62
|
-
program
|
|
63
|
-
.command('launch <name>')
|
|
64
|
-
.description('Wear a cloak and launch Claude')
|
|
65
|
-
.argument('[args...]', 'Arguments to pass to claude')
|
|
66
|
-
.action((name, args) => launchAccount(name, args))
|
|
67
|
-
|
|
68
61
|
program
|
|
69
62
|
.command('init')
|
|
70
63
|
.description('Output shell integration code')
|
package/src/commands/init.js
CHANGED
|
@@ -7,7 +7,7 @@ export function getInitScript() {
|
|
|
7
7
|
' if [ "$1" = "account" ]; then',
|
|
8
8
|
' local subcmd="$2"',
|
|
9
9
|
' shift 2',
|
|
10
|
-
' if [ "$subcmd" = "switch" ] || [ "$subcmd" = "use" ]
|
|
10
|
+
' if [ "$subcmd" = "switch" ] || [ "$subcmd" = "use" ]; then',
|
|
11
11
|
' local output',
|
|
12
12
|
' output=$(command cloak switch --print-env "$@")',
|
|
13
13
|
' local exit_code=$?',
|
package/src/commands/launch.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { spawn as defaultSpawn } from 'child_process'
|
|
2
|
-
import chalk from 'chalk'
|
|
3
|
-
import { profileDir, profileExists } from '../lib/paths.js'
|
|
4
|
-
import { validateAccountName } from '../lib/validate.js'
|
|
5
|
-
|
|
6
|
-
export function launchAccount(name, extraArgs = [], spawner = defaultSpawn) {
|
|
7
|
-
const validation = validateAccountName(name)
|
|
8
|
-
if (!validation.valid) {
|
|
9
|
-
return Promise.reject(new Error(validation.error))
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (!profileExists(name)) {
|
|
13
|
-
return Promise.reject(new Error(`Account "${name}" not found. Run: claude account create ${name}`))
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
process.env.CLAUDE_CONFIG_DIR = profileDir(name)
|
|
17
|
-
console.log(chalk.green(`✔ Now wearing cloak "${name}".`))
|
|
18
|
-
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
const child = spawner('claude', extraArgs, {
|
|
21
|
-
stdio: 'inherit',
|
|
22
|
-
env: process.env,
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
child.on('close', (code) => {
|
|
26
|
-
resolve(code)
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
}
|