@dst-justin/relay 2.0.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 ADDED
@@ -0,0 +1,176 @@
1
+ # relay
2
+
3
+ A lightweight CLI tool for switching between multiple Claude Code accounts instantly.
4
+
5
+ ## Platform Support
6
+
7
+ | Platform | Credential Storage |
8
+ |----------|--------------------|
9
+ | macOS | Keychain (`Claude Code-credentials`) |
10
+ | Linux / WSL | `~/.claude/.credentials.json` |
11
+ | Windows | `%USERPROFILE%\.claude\.credentials.json` |
12
+
13
+ ## Requirements
14
+
15
+ - [`claude`](https://docs.anthropic.com/en/docs/claude-code) CLI installed
16
+ - macOS / Linux / WSL: `python3` available
17
+ - Windows: PowerShell 5.1+ (built into Windows 10/11)
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ### npm (all platforms — recommended)
24
+
25
+ Requires Node.js 16+. Installs the `relay` command globally:
26
+
27
+ ```bash
28
+ npm install -g claude-relay
29
+ ```
30
+
31
+ To update later:
32
+
33
+ ```bash
34
+ npm update -g claude-relay
35
+ # or from inside relay:
36
+ relay update
37
+ ```
38
+
39
+ ---
40
+
41
+ ### macOS / Linux / WSL (manual)
42
+
43
+ ```bash
44
+ git clone https://github.com/darkstar1227/relay.git
45
+ cd relay
46
+
47
+ # Make the script executable
48
+ chmod +x relay
49
+
50
+ # Install (creates a symlink in /usr/local/bin)
51
+ ./relay install
52
+ ```
53
+
54
+ This creates a symlink at `/usr/local/bin/relay` (falls back to `~/bin/relay` if permissions are restricted).
55
+
56
+ #### Verify permissions
57
+
58
+ ```bash
59
+ ls -l $(which relay)
60
+ # expected: -rwxr-xr-x ... or lrwxr-xr-x ...
61
+
62
+ ls -la ~/.claude-relay/
63
+ # expected: drwx------ ~/.claude-relay/
64
+ # expected: drwx------ ~/.claude-relay/credentials/
65
+ ```
66
+
67
+ If any permissions are wrong:
68
+
69
+ ```bash
70
+ chmod 700 ~/.claude-relay ~/.claude-relay/credentials
71
+ chmod 600 ~/.claude-relay/credentials/*.json
72
+ ```
73
+
74
+ ---
75
+
76
+ ### Windows (CMD / PowerShell, manual)
77
+
78
+ If you prefer not to use npm, clone the repo and add it to PATH manually.
79
+
80
+ ```powershell
81
+ git clone https://github.com/darkstar1227/relay.git
82
+ cd relay
83
+ ```
84
+
85
+ **Add to PATH permanently:**
86
+
87
+ ```powershell
88
+ $dir = (Get-Location).Path
89
+ [Environment]::SetEnvironmentVariable(
90
+ "PATH",
91
+ "$([Environment]::GetEnvironmentVariable('PATH','User'));$dir",
92
+ "User"
93
+ )
94
+ ```
95
+
96
+ Restart your terminal after running this.
97
+
98
+ **Allow the script to execute (first time only):**
99
+
100
+ ```powershell
101
+ Unblock-File .\relay.ps1
102
+ ```
103
+
104
+ **Verify:**
105
+
106
+ ```powershell
107
+ relay help
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Quick Start
113
+
114
+ ```bash
115
+ # Add your first account (opens browser — must run outside Claude Code)
116
+ relay add personal
117
+
118
+ # Add a second account
119
+ relay add work
120
+
121
+ # Switch accounts
122
+ relay 2 # by index
123
+ relay work # by name
124
+ ```
125
+
126
+ ## Usage Inside Claude Code
127
+
128
+ Prefix commands with `!` to run them inline:
129
+
130
+ | Command | Description |
131
+ |---------|-------------|
132
+ | `!relay` | Account menu with 5-hour usage |
133
+ | `!relay 2` | Switch to account #2 |
134
+ | `!relay work` | Switch to account named "work" |
135
+ | `!relay status` | Detailed usage for current account |
136
+
137
+ ## Account Management
138
+
139
+ | Command | Description |
140
+ |---------|-------------|
141
+ | `relay add <name>` | Add account via browser login |
142
+ | `relay add-force <name>` | Force re-login for existing account |
143
+ | `relay save <name>` | Save current login state as a named account |
144
+ | `relay rename <old> <new>` | Rename an account |
145
+ | `relay list` | Full list with weekly usage |
146
+ | `relay list --no-usage` | List without querying the API |
147
+ | `relay remove <name>` | Delete an account |
148
+ | `relay sessions` | Show all Claude Code sessions |
149
+ | `relay version` | Show current version |
150
+ | `relay update` | Check GitHub releases and update to the latest version |
151
+ | `relay uninstall` | Remove relay and all account data (macOS/Linux only) |
152
+
153
+ ## How It Works
154
+
155
+ relay stores a snapshot of each account's OAuth credentials in `~/.claude-relay/credentials/`. Switching writes the target account's credentials back into the store that Claude Code reads from.
156
+
157
+ Sessions live in `~/.claude/projects/` and are shared across all accounts — after switching, use `claude -c` to resume the last session or `claude --resume <id>` to pick a specific one.
158
+
159
+ > **Note:** `relay add` must be run in a regular Terminal, not inside Claude Code, because the browser login flow is not available inside an active session.
160
+
161
+ ## Files
162
+
163
+ ```
164
+ ~/.claude-relay/
165
+ ├── credentials/ # Per-account credential snapshots (chmod 700 on Unix)
166
+ ├── meta/ # Per-account email cache
167
+ └── current # Name of the active account
168
+ ```
169
+
170
+ ### Windows-specific files
171
+
172
+ | File | Purpose |
173
+ |------|---------|
174
+ | `relay.ps1` | Full PowerShell implementation |
175
+ | `relay.cmd` | Thin CMD wrapper — delegates to `relay.ps1` |
176
+
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@dst-justin/relay",
3
+ "version": "2.0.0",
4
+ "description": "Multi-account switcher for Claude Code — instant credential swap across macOS, Linux, and Windows",
5
+ "bin": {
6
+ "relay": "./relay.js"
7
+ },
8
+ "files": [
9
+ "relay",
10
+ "relay.js",
11
+ "relay.ps1",
12
+ "relay.cmd",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "postinstall": "node -e \"if(process.platform!=='win32'){try{require('fs').chmodSync(require('path').join(__dirname,'relay'),'755')}catch(_){}}\""
17
+ },
18
+ "engines": {
19
+ "node": ">=16"
20
+ },
21
+ "os": [
22
+ "darwin",
23
+ "linux",
24
+ "win32"
25
+ ],
26
+ "keywords": [
27
+ "claude",
28
+ "claude-code",
29
+ "anthropic",
30
+ "multi-account",
31
+ "credential"
32
+ ],
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/darkstar1227/relay.git"
37
+ },
38
+ "homepage": "https://github.com/darkstar1227/relay#readme",
39
+ "bugs": {
40
+ "url": "https://github.com/darkstar1227/relay/issues"
41
+ }
42
+ }