@dst-justin/relay 2.0.0 → 2.0.2
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 +18 -6
- package/package.json +1 -1
- package/relay +21 -11
package/README.md
CHANGED
|
@@ -20,25 +20,37 @@ A lightweight CLI tool for switching between multiple Claude Code accounts insta
|
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
|
-
###
|
|
23
|
+
### npx (no install required)
|
|
24
|
+
|
|
25
|
+
Run once without installing anything permanently:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx @dst-justin/relay install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This copies the `relay` script to `/usr/local/bin/relay` (or `~/bin/relay` as fallback). After that, use `relay` directly.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### npm (global install — recommended)
|
|
24
36
|
|
|
25
37
|
Requires Node.js 16+. Installs the `relay` command globally:
|
|
26
38
|
|
|
27
39
|
```bash
|
|
28
|
-
npm install -g
|
|
40
|
+
npm install -g @dst-justin/relay
|
|
29
41
|
```
|
|
30
42
|
|
|
31
43
|
To update later:
|
|
32
44
|
|
|
33
45
|
```bash
|
|
34
|
-
npm update -g
|
|
46
|
+
npm update -g @dst-justin/relay
|
|
35
47
|
# or from inside relay:
|
|
36
48
|
relay update
|
|
37
49
|
```
|
|
38
50
|
|
|
39
51
|
---
|
|
40
52
|
|
|
41
|
-
### macOS / Linux / WSL (manual)
|
|
53
|
+
### macOS / Linux / WSL (manual, no Node.js)
|
|
42
54
|
|
|
43
55
|
```bash
|
|
44
56
|
git clone https://github.com/darkstar1227/relay.git
|
|
@@ -47,11 +59,11 @@ cd relay
|
|
|
47
59
|
# Make the script executable
|
|
48
60
|
chmod +x relay
|
|
49
61
|
|
|
50
|
-
# Install (
|
|
62
|
+
# Install (copies script to /usr/local/bin)
|
|
51
63
|
./relay install
|
|
52
64
|
```
|
|
53
65
|
|
|
54
|
-
This
|
|
66
|
+
This copies the script to `/usr/local/bin/relay` (falls back to `~/bin/relay` if permissions are restricted).
|
|
55
67
|
|
|
56
68
|
#### Verify permissions
|
|
57
69
|
|
package/package.json
CHANGED
package/relay
CHANGED
|
@@ -604,15 +604,16 @@ cmd_install() {
|
|
|
604
604
|
|
|
605
605
|
hdr "Install relay"
|
|
606
606
|
|
|
607
|
-
if
|
|
607
|
+
if rm -f "${target}" 2>/dev/null && cp "${script_path}" "${target}" 2>/dev/null && chmod 755 "${target}" 2>/dev/null; then
|
|
608
608
|
ok "Installed at ${target}"
|
|
609
609
|
log "Run ${CY}relay help${R} to verify"
|
|
610
|
-
elif sudo
|
|
610
|
+
elif sudo rm -f "${target}" 2>/dev/null && sudo cp "${script_path}" "${target}" 2>/dev/null && sudo chmod 755 "${target}" 2>/dev/null; then
|
|
611
611
|
ok "Installed at ${target} (via sudo)"
|
|
612
612
|
else
|
|
613
613
|
warn "Cannot write to /usr/local/bin — installing to ~/bin instead"
|
|
614
614
|
mkdir -p "${HOME}/bin"
|
|
615
|
-
|
|
615
|
+
rm -f "${HOME}/bin/relay" 2>/dev/null
|
|
616
|
+
cp "${script_path}" "${HOME}/bin/relay" && chmod 755 "${HOME}/bin/relay"
|
|
616
617
|
ok "Installed at ${HOME}/bin/relay"
|
|
617
618
|
echo ""
|
|
618
619
|
warn "Make sure ~/bin is in your PATH (.zshrc / .bashrc):"
|
|
@@ -671,23 +672,32 @@ cmd_update() {
|
|
|
671
672
|
local current; current=$(_read_version)
|
|
672
673
|
log "Current version: ${B}${current}${R}"
|
|
673
674
|
|
|
674
|
-
# Check latest GitHub
|
|
675
|
+
# Check latest version — GitHub first, npm registry as fallback
|
|
675
676
|
local latest
|
|
676
677
|
latest=$("${PY}" - 2>/dev/null <<'PYEOF'
|
|
677
678
|
import urllib.request, json, sys
|
|
678
|
-
|
|
679
|
-
req = urllib.request.Request(
|
|
680
|
-
'https://api.github.com/repos/darkstar1227/relay/releases/latest',
|
|
681
|
-
headers={'User-Agent': 'relay-update'})
|
|
679
|
+
def fetch(url, headers={}):
|
|
680
|
+
req = urllib.request.Request(url, headers=headers)
|
|
682
681
|
with urllib.request.urlopen(req, timeout=6) as r:
|
|
683
|
-
|
|
684
|
-
|
|
682
|
+
return json.loads(r.read())
|
|
683
|
+
try:
|
|
684
|
+
d = fetch('https://api.github.com/repos/darkstar1227/relay/releases/latest',
|
|
685
|
+
{'User-Agent': 'relay-update'})
|
|
686
|
+
print(d['tag_name'].lstrip('v')); sys.exit(0)
|
|
687
|
+
except Exception:
|
|
688
|
+
pass
|
|
689
|
+
try:
|
|
690
|
+
d = fetch('https://registry.npmjs.org/@dst-justin%2frelay/latest')
|
|
691
|
+
print(d['version'])
|
|
692
|
+
except Exception:
|
|
685
693
|
sys.exit(1)
|
|
686
694
|
PYEOF
|
|
687
695
|
)
|
|
688
696
|
|
|
689
697
|
if [[ -z "${latest}" ]]; then
|
|
690
|
-
warn "Could not
|
|
698
|
+
warn "Could not determine latest version — check your network"
|
|
699
|
+
log "To update manually: ${CY}npm install -g @dst-justin/relay@latest${R}"
|
|
700
|
+
return 1
|
|
691
701
|
elif [[ "${current}" == "${latest}" ]]; then
|
|
692
702
|
ok "Already up to date (${current})"; return 0
|
|
693
703
|
else
|