@youdie006/swapdex 0.26.0 → 0.27.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 +83 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,28 +23,42 @@ else does.)
|
|
|
23
23
|
## Why
|
|
24
24
|
|
|
25
25
|
If you run Claude Code, Codex, Gemini CLI, or Antigravity under more than one
|
|
26
|
-
account -- a work seat and a
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
account -- a work seat and a personal subscription, a client's org and your own
|
|
27
|
+
-- switching means logging out and back in every time.
|
|
28
|
+
|
|
29
|
+
swapdex gives each account its **own permanent space** -- its own
|
|
30
|
+
`CLAUDE_CONFIG_DIR` slot -- and flips between them without ever copying a token.
|
|
31
|
+
`swapdex use work` points your default account there and a plain `claude`
|
|
32
|
+
follows it; `swapdex run work` launches straight into that account (each terminal
|
|
33
|
+
can be a different one). Because nothing is copied, **a switch can never log an
|
|
34
|
+
account out** -- even if a session is still running when you switch.
|
|
35
|
+
`swapdex onboard` sets this up in a few prompts.
|
|
31
36
|
|
|
32
37
|
It is a **switcher, not a rotator.** It manages accounts you already own for
|
|
33
|
-
distinct purposes
|
|
34
|
-
|
|
38
|
+
distinct purposes, with no feature for cycling them to get around a rate limit
|
|
39
|
+
-- see [What it will not do](#what-it-will-not-do).
|
|
35
40
|
|
|
36
|
-
Safety is the design center:
|
|
37
|
-
|
|
38
|
-
official CLI its own credentials
|
|
41
|
+
Safety is the design center: in the slot model swapdex never writes a credential
|
|
42
|
+
at all -- each account's own login creates and refreshes its token, in its own
|
|
43
|
+
slot -- and it only ever hands the official CLI its own credentials: no wrapper,
|
|
44
|
+
no proxy, no client spoofing.
|
|
39
45
|
|
|
40
46
|
## Concepts
|
|
41
47
|
|
|
42
|
-
- **
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
- **Account** -- one login you own (a work seat, a personal subscription). Its
|
|
49
|
+
redacted identity (email, tier) is shown by `slots`, `status`, and `doctor`;
|
|
50
|
+
never a token.
|
|
51
|
+
- **Slot** -- an account's own permanent `CLAUDE_CONFIG_DIR`, where its login
|
|
52
|
+
lives and refreshes in place. swapdex creates one per account (or adopts a
|
|
53
|
+
`~/.claude-*` dir you already use) and never copies tokens between them.
|
|
54
|
+
- **Default account** -- the one a plain `claude` uses, via a tiny shim on your
|
|
55
|
+
PATH. `swapdex use <name>` repoints it; `swapdex run <name>` ignores it and
|
|
56
|
+
launches a specific account directly.
|
|
57
|
+
|
|
58
|
+
<sub>swapdex still keeps the classic snapshot commands (`add` copies a live login
|
|
59
|
+
into a profile, `use` on that profile swaps it back, guarded against the
|
|
60
|
+
running-session logout) for the shared-slot workflow; `swapdex migrate` moves
|
|
61
|
+
those profiles onto their own slots.</sub>
|
|
48
62
|
|
|
49
63
|
## Install
|
|
50
64
|
|
|
@@ -70,24 +84,28 @@ reference: [docs/COMMANDS.md](docs/COMMANDS.md).
|
|
|
70
84
|
## Use
|
|
71
85
|
|
|
72
86
|
```sh
|
|
73
|
-
#
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
# First run: guided setup -- registers ~/.claude-* dirs you already use,
|
|
88
|
+
# moves old profiles onto slots, offers the shim. A bare `swapdex` runs this
|
|
89
|
+
# automatically the first time there is something to set up.
|
|
90
|
+
swapdex onboard
|
|
91
|
+
|
|
92
|
+
# Launch an account in its own slot (first time = sign in; concurrent-safe,
|
|
93
|
+
# so each terminal can be a different account)
|
|
94
|
+
swapdex run work
|
|
95
|
+
swapdex run personal
|
|
96
|
+
|
|
97
|
+
# Make a plain `claude` follow a default account
|
|
98
|
+
swapdex shim # installs the claude shim once (prints a PATH line)
|
|
99
|
+
swapdex use personal # a plain `claude` now runs as personal
|
|
100
|
+
swapdex use work # switch the default -- no re-login, never logs out
|
|
101
|
+
|
|
102
|
+
# See your accounts and who's active
|
|
103
|
+
swapdex slots
|
|
79
104
|
swapdex status
|
|
80
105
|
|
|
81
|
-
#
|
|
82
|
-
swapdex
|
|
83
|
-
|
|
84
|
-
swapdex use work --tool claude --open --dir ~/proj # switch + launch in one
|
|
85
|
-
swapdex login personal --tool claude # sign in to a NEW account and save it
|
|
86
|
-
swapdex use personal
|
|
87
|
-
swapdex use - # toggle back to the previous profile
|
|
88
|
-
swapdex use w # a unique prefix is enough
|
|
89
|
-
swapdex use work --tool codex
|
|
90
|
-
swapdex use work --dry-run # show what would change, write nothing
|
|
106
|
+
# Register a config dir you already run by hand; move old profiles to slots
|
|
107
|
+
swapdex adopt company ~/.claude-company
|
|
108
|
+
swapdex migrate
|
|
91
109
|
|
|
92
110
|
# Sessions grouped by the account active when they ran (needs sessionwiki)
|
|
93
111
|
swapdex sessions
|
|
@@ -98,13 +116,16 @@ swapdex usage
|
|
|
98
116
|
# Remaining quota per Claude account -- the one opt-in network read
|
|
99
117
|
swapdex quota
|
|
100
118
|
|
|
101
|
-
# Made a bad switch? Put back the login that was live before it
|
|
102
|
-
swapdex restore
|
|
103
|
-
|
|
104
119
|
# Anything off? Every finding comes with its fix
|
|
105
120
|
swapdex doctor
|
|
106
121
|
```
|
|
107
122
|
|
|
123
|
+
The classic snapshot commands still work for the shared-slot workflow: `swapdex
|
|
124
|
+
add <name>` snapshots the current login, `swapdex use <name>` swaps it back
|
|
125
|
+
(backed up first, and refused while a `claude` session is running on that login
|
|
126
|
+
so it can't be logged out), `swapdex restore` undoes the last swap, and `swapdex
|
|
127
|
+
ui` is the full-screen picker. `swapdex migrate` moves these onto their own slots.
|
|
128
|
+
|
|
108
129
|
`status` shows the live account per tool, matched back to a saved profile:
|
|
109
130
|
|
|
110
131
|
```
|
|
@@ -176,7 +197,20 @@ also in `swapdex ui` under the `%` key.
|
|
|
176
197
|
|
|
177
198
|
## How it works
|
|
178
199
|
|
|
179
|
-
|
|
200
|
+
**Slots (the model swapdex uses now).** Each account gets its own
|
|
201
|
+
`CLAUDE_CONFIG_DIR` -- a directory under `~/.local/share/swapdex/slots/`, or a
|
|
202
|
+
`~/.claude-*` dir you adopt. Claude keys its login to that dir (a file on Linux,
|
|
203
|
+
a Keychain item on macOS), so each account's token lives and refreshes *in its
|
|
204
|
+
own slot*. swapdex never copies a token between slots: `swapdex run <name>`
|
|
205
|
+
`exec`s `claude` with that slot's `CLAUDE_CONFIG_DIR`, and `swapdex use <name>`
|
|
206
|
+
writes a one-line pointer that a small `claude` shim on your PATH reads. Shared
|
|
207
|
+
config (`settings.json`, global `CLAUDE.md`) is symlinked into each new slot;
|
|
208
|
+
the token and history stay per-slot. Because no credential is ever moved, a
|
|
209
|
+
token refresh in one account can never revoke another -- **a switch cannot log
|
|
210
|
+
you out**.
|
|
211
|
+
|
|
212
|
+
**Classic snapshots (still supported).** Each CLI also keeps its login in a
|
|
213
|
+
small on-disk file:
|
|
180
214
|
|
|
181
215
|
- Claude Code: `~/.claude/.credentials.json` plus the `oauthAccount` block inside
|
|
182
216
|
`~/.claude.json`
|
|
@@ -184,17 +218,14 @@ Each CLI keeps its login in a small on-disk file:
|
|
|
184
218
|
- Gemini CLI: `~/.gemini/oauth_creds.json` plus `~/.gemini/google_accounts.json`
|
|
185
219
|
- Antigravity: `~/.gemini/antigravity-cli/antigravity-oauth-token`
|
|
186
220
|
|
|
187
|
-
`add` copies the current login into a private store at
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
`
|
|
195
|
-
it runs in**, exactly like `claude` itself resolves it: plain `swapdex`
|
|
196
|
-
manages the default profile; profiles you run side by side via
|
|
197
|
-
`CLAUDE_CONFIG_DIR` aliases are never touched.
|
|
221
|
+
`add` copies the current login into a private store at `~/.local/share/swapdex`;
|
|
222
|
+
`use` on a snapshot profile writes it back atomically, backing up the current
|
|
223
|
+
login first, and only the `oauthAccount` block of `~/.claude.json` is swapped so
|
|
224
|
+
your projects, MCP servers, and settings are untouched. That switch is refused
|
|
225
|
+
while a `claude` session is running on the same login slot, since the session's
|
|
226
|
+
next token refresh would otherwise revoke the saved copy. On macOS the Claude
|
|
227
|
+
token lives in the login Keychain, one item per `CLAUDE_CONFIG_DIR`. `swapdex
|
|
228
|
+
migrate` moves these profiles onto their own slots, retiring the shared slot.
|
|
198
229
|
|
|
199
230
|
## Safety
|
|
200
231
|
|
|
@@ -295,6 +326,11 @@ spoof the official client.
|
|
|
295
326
|
Claude's login inside the macOS Keychain via `/usr/bin/security`, resolves
|
|
296
327
|
the item exactly the way `claude` itself does (one item per
|
|
297
328
|
`CLAUDE_CONFIG_DIR` profile), and `doctor` diagnoses any mismatch.
|
|
329
|
+
- ~~Permanent per-account slots.~~ **Shipped** (0.26): each account gets its own
|
|
330
|
+
`CLAUDE_CONFIG_DIR`, so a switch copies no token and can never log an account
|
|
331
|
+
out -- even with a session running. `run`, `use` (repoint) + the `claude`
|
|
332
|
+
shim, `onboard`, `adopt`, `migrate`, and `sync-mcp` (shares your MCP servers
|
|
333
|
+
across slots, since they live in the per-account `.claude.json`).
|
|
298
334
|
|
|
299
335
|
Being considered, explicitly opt-in and advisory-only:
|
|
300
336
|
|
package/package.json
CHANGED