caflip 0.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 +128 -0
- package/bin/caflip +33 -0
- package/dist/cli.js +3420 -0
- package/install.sh +47 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# caflip (Coding Agent Flipper)
|
|
2
|
+
|
|
3
|
+
A fast account switcher for coding agents like Claude Code and Codex.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
caflip is built for one job: if you have multiple Claude or Codex accounts, switch between them quickly.
|
|
8
|
+
|
|
9
|
+
Today, caflip focuses on Claude Code accounts. Your skills, settings, themes, `CLAUDE.md`, MCP servers, keybindings, and all other configuration stay exactly the same while switching accounts.
|
|
10
|
+
|
|
11
|
+
Use case: you have personal/work Claude or Codex accounts and want to switch quickly without re-login flows every time.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Platform Support
|
|
15
|
+
|
|
16
|
+
| Platform | Credential Storage |
|
|
17
|
+
|---|---|
|
|
18
|
+
| macOS | System Keychain |
|
|
19
|
+
| Linux | `secret-tool` keyring (preferred), file-based fallback (owner-only access) |
|
|
20
|
+
| WSL | Same as Linux |
|
|
21
|
+
| Windows | Not yet supported |
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
### Binary (recommended)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
curl -fsSL https://raw.githubusercontent.com/LucienLee/caflip/main/install.sh | bash
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Via npm (Node.js)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -g caflip
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Via Bun
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
bun install -g caflip
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Local Development
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bun run dev -- help
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Add your first Claude account (must already be logged in)
|
|
53
|
+
caflip claude add --alias personal
|
|
54
|
+
|
|
55
|
+
# Add another Claude account
|
|
56
|
+
caflip claude add --alias work
|
|
57
|
+
|
|
58
|
+
# Pick provider interactively, then pick account
|
|
59
|
+
caflip
|
|
60
|
+
|
|
61
|
+
# Switch Claude by alias
|
|
62
|
+
caflip claude work
|
|
63
|
+
caflip claude personal
|
|
64
|
+
|
|
65
|
+
# Rotate Claude accounts
|
|
66
|
+
caflip claude next
|
|
67
|
+
|
|
68
|
+
# Use Codex provider explicitly
|
|
69
|
+
caflip codex add --alias codex-work
|
|
70
|
+
caflip codex list
|
|
71
|
+
caflip codex next
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
After switching, restart the target CLI (Claude Code or Codex) to pick up new authentication.
|
|
75
|
+
|
|
76
|
+
## Commands
|
|
77
|
+
|
|
78
|
+
| Command | Description |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `caflip` | Interactive provider picker (Claude/Codex) |
|
|
81
|
+
| `caflip claude [command]` | Run command for Claude provider |
|
|
82
|
+
| `caflip codex [command]` | Run command for Codex provider |
|
|
83
|
+
| `caflip [provider]` | Interactive account picker for that provider |
|
|
84
|
+
| `caflip [provider] <alias>` | Switch by alias for that provider |
|
|
85
|
+
| `caflip [provider] list` | List managed accounts |
|
|
86
|
+
| `caflip [provider] add [--alias name]` | Add current account |
|
|
87
|
+
| `caflip [provider] remove [email]` | Remove an account |
|
|
88
|
+
| `caflip [provider] next` | Rotate to next account |
|
|
89
|
+
| `caflip [provider] status` | Show current account |
|
|
90
|
+
| `caflip [provider] alias <name> [email]` | Set alias for current or target account |
|
|
91
|
+
| `caflip help` | Show help |
|
|
92
|
+
|
|
93
|
+
### Alias Usage
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Set alias for current active account
|
|
97
|
+
caflip claude alias work
|
|
98
|
+
|
|
99
|
+
# Set alias for a specific managed account
|
|
100
|
+
caflip claude alias work hi.lucienlee@gmail.com
|
|
101
|
+
|
|
102
|
+
# Codex alias
|
|
103
|
+
caflip codex alias work me@company.com
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`remove` target accepts email only. Omit it to choose from the interactive picker.
|
|
107
|
+
|
|
108
|
+
## Shell Prompt Integration
|
|
109
|
+
|
|
110
|
+
Show the current account in your prompt:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# .zshrc
|
|
114
|
+
PROMPT='$(caflip claude status) > '
|
|
115
|
+
PROMPT='$(caflip codex status) > '
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Account data lives in:
|
|
119
|
+
- `~/.caflip-backup/claude/`
|
|
120
|
+
- `~/.caflip-backup/codex/`
|
|
121
|
+
|
|
122
|
+
## Credits
|
|
123
|
+
|
|
124
|
+
Inspired by [cc-account-switcher](https://github.com/ming86/cc-account-switcher).
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|
package/bin/caflip
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# Resolve symlinks so global shims (e.g. ~/.bun/bin/caflip) work correctly.
|
|
5
|
+
SCRIPT="$0"
|
|
6
|
+
while [ -h "$SCRIPT" ]; do
|
|
7
|
+
LINK_DIR="$(CDPATH= cd -- "$(dirname -- "$SCRIPT")" && pwd)"
|
|
8
|
+
LINK_TARGET="$(readlink "$SCRIPT")"
|
|
9
|
+
case "$LINK_TARGET" in
|
|
10
|
+
/*) SCRIPT="$LINK_TARGET" ;;
|
|
11
|
+
*) SCRIPT="$LINK_DIR/$LINK_TARGET" ;;
|
|
12
|
+
esac
|
|
13
|
+
done
|
|
14
|
+
|
|
15
|
+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$SCRIPT")" && pwd)"
|
|
16
|
+
SRC_CLI="$SCRIPT_DIR/../src/index.ts"
|
|
17
|
+
CLI="$SCRIPT_DIR/../dist/cli.js"
|
|
18
|
+
|
|
19
|
+
# Local development mode: if source exists, run latest TS directly with Bun.
|
|
20
|
+
if [ -f "$SRC_CLI" ] && command -v bun >/dev/null 2>&1; then
|
|
21
|
+
exec bun "$SRC_CLI" "$@"
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
if [ -f "$CLI" ] && command -v node >/dev/null 2>&1; then
|
|
25
|
+
exec node "$CLI" "$@"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [ -f "$CLI" ] && command -v bun >/dev/null 2>&1; then
|
|
29
|
+
exec bun "$CLI" "$@"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
echo "caflip requires Node.js or Bun in PATH." >&2
|
|
33
|
+
exit 1
|