@synth1s/cloak 1.0.0 → 1.1.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 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
- Add to your `.bashrc` or `.zshrc`:
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
- # Cloak your Claude with your work identity
31
- claude account create work
26
+ # Save your current Claude session
27
+ cloak create work
32
28
 
33
29
  # Log out, log in with another account, then:
34
- claude account create home
30
+ cloak create home
35
31
 
36
32
  # Throw on a cloak and go
37
- claude -a work
38
- claude -a home
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
- | `claude -a <name>` | Throw on a cloak and launch Claude |
59
- | `claude -a <name> [args...]` | Throw on a cloak and launch with arguments |
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
- claude -a work
56
+ cloak launch work
68
57
 
69
58
  # Terminal B — wearing the home cloak:
70
- claude -a home
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 `claude -a work`, Cloak sets `CLAUDE_CONFIG_DIR=~/.cloak/profiles/work` and launches Claude Code. That's it. Each terminal gets its own environment, so you can wear different cloaks simultaneously.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synth1s/cloak",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Cloak your Claude. Switch identities in seconds.",
5
5
  "type": "module",
6
6
  "bin": {
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.')
@@ -1,6 +1,8 @@
1
1
  export function getInitScript() {
2
2
  /* eslint-disable no-template-curly-in-string */
3
3
  const lines = [
4
+ 'export CLOAK_SHELL_INTEGRATION=1',
5
+ '',
4
6
  'claude() {',
5
7
  ' if [ "$1" = "account" ]; then',
6
8
  ' local subcmd="$2"',
@@ -16,7 +18,15 @@ export function getInitScript() {
16
18
  ' command cloak "$subcmd" "$@"',
17
19
  ' fi',
18
20
  ' elif [ "$1" = "-a" ] && [ -n "$2" ]; then',
19
- ' command cloak launch "${@:2}"',
21
+ ' local name="$2"',
22
+ ' shift 2',
23
+ ' local output',
24
+ ' output=$(command cloak switch --print-env "$name")',
25
+ ' local exit_code=$?',
26
+ ' if [ $exit_code -eq 0 ]; then',
27
+ ' eval "$output"',
28
+ ' command claude "$@"',
29
+ ' fi',
20
30
  ' else',
21
31
  ' command claude "$@"',
22
32
  ' fi',
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
+ }