@ghackk/multi-claude 1.0.16 → 1.0.18
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/claude-menu.ps1 +9 -1
- package/package.json +1 -1
- package/unix/claude-menu.sh +37 -1
package/claude-menu.ps1
CHANGED
|
@@ -95,6 +95,14 @@ Ensure-ClaudeInstalled
|
|
|
95
95
|
if (!(Test-Path $ACCOUNTS_DIR)) { New-Item -ItemType Directory -Path $ACCOUNTS_DIR | Out-Null }
|
|
96
96
|
if (!(Test-Path $BACKUP_DIR)) { New-Item -ItemType Directory -Path $BACKUP_DIR | Out-Null }
|
|
97
97
|
|
|
98
|
+
# ─── ENSURE ACCOUNTS DIR IS ON PATH ──────────────────────────────────────────
|
|
99
|
+
|
|
100
|
+
$userPath = [Environment]::GetEnvironmentVariable("PATH", "User")
|
|
101
|
+
if ($userPath -notlike "*claude-accounts*") {
|
|
102
|
+
[Environment]::SetEnvironmentVariable("PATH", "$ACCOUNTS_DIR;$userPath", "User")
|
|
103
|
+
$env:PATH = "$ACCOUNTS_DIR;$env:PATH"
|
|
104
|
+
}
|
|
105
|
+
|
|
98
106
|
# ─── DISPLAY ─────────────────────────────────────────────────────────────────
|
|
99
107
|
|
|
100
108
|
function Show-Header {
|
|
@@ -544,7 +552,7 @@ function Delete-Account {
|
|
|
544
552
|
Write-Host ""
|
|
545
553
|
$confirm = Read-Host " Type YES to confirm deleting all selected"
|
|
546
554
|
|
|
547
|
-
if ($confirm.Trim() -
|
|
555
|
+
if ($confirm.Trim() -ine "YES" -and $confirm.Trim() -ine "Y") {
|
|
548
556
|
Write-Host " Cancelled." -ForegroundColor Gray
|
|
549
557
|
pause; return
|
|
550
558
|
}
|
package/package.json
CHANGED
package/unix/claude-menu.sh
CHANGED
|
@@ -10,6 +10,37 @@ SHARED_PLUGINS_DIR="$SHARED_DIR/plugins"
|
|
|
10
10
|
SHARED_MARKETPLACES_DIR="$SHARED_PLUGINS_DIR/marketplaces"
|
|
11
11
|
PAIR_SERVER="https://pair.ghackk.com"
|
|
12
12
|
|
|
13
|
+
# ─── LAUNCHER SYMLINK HELPERS ─────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
ensure_local_bin_on_path() {
|
|
16
|
+
local bin_dir="$HOME/.local/bin"
|
|
17
|
+
mkdir -p "$bin_dir"
|
|
18
|
+
# Already on PATH in this session?
|
|
19
|
+
case ":$PATH:" in
|
|
20
|
+
*":$bin_dir:"*) return ;;
|
|
21
|
+
esac
|
|
22
|
+
export PATH="$bin_dir:$PATH"
|
|
23
|
+
# Persist to shell rc if not already there
|
|
24
|
+
for rc in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.profile"; do
|
|
25
|
+
[ -f "$rc" ] || continue
|
|
26
|
+
if ! grep -q '\.local/bin' "$rc" 2>/dev/null; then
|
|
27
|
+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$rc"
|
|
28
|
+
fi
|
|
29
|
+
done
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
register_launcher() {
|
|
33
|
+
local name="$1" # e.g. "claude-zf"
|
|
34
|
+
ensure_local_bin_on_path
|
|
35
|
+
ln -sf "$ACCOUNTS_DIR/$name.sh" "$HOME/.local/bin/$name"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
unregister_launcher() {
|
|
39
|
+
local name="$1"
|
|
40
|
+
local link="$HOME/.local/bin/$name"
|
|
41
|
+
[ -L "$link" ] && rm -f "$link"
|
|
42
|
+
}
|
|
43
|
+
|
|
13
44
|
# ─── ENSURE CLAUDE CLI INSTALLED ──────────────────────────────────────────
|
|
14
45
|
|
|
15
46
|
ensure_claude_installed() {
|
|
@@ -433,6 +464,7 @@ export CLAUDE_CONFIG_DIR="\$HOME/.claude-$name"
|
|
|
433
464
|
claude "\$@"
|
|
434
465
|
ENDSH
|
|
435
466
|
chmod +x "$shFile"
|
|
467
|
+
register_launcher "claude-$name"
|
|
436
468
|
|
|
437
469
|
# Auto-apply shared settings
|
|
438
470
|
if command -v jq &>/dev/null; then
|
|
@@ -507,6 +539,8 @@ rename_account() {
|
|
|
507
539
|
# Rename launcher
|
|
508
540
|
mv "$ACCOUNTS_DIR/$selected.sh" "$newSh"
|
|
509
541
|
sed -i "s/$selected/$newName/g" "$newSh" 2>/dev/null || sed -i '' "s/$selected/$newName/g" "$newSh"
|
|
542
|
+
unregister_launcher "$selected"
|
|
543
|
+
register_launcher "$newName"
|
|
510
544
|
|
|
511
545
|
# Rename config dir
|
|
512
546
|
local oldConfig="$HOME/.$selected"
|
|
@@ -540,13 +574,14 @@ delete_account() {
|
|
|
540
574
|
echo -e " \033[33mAccount selected for deletion: $selected\033[0m"
|
|
541
575
|
read -p " Type YES to confirm: " confirm
|
|
542
576
|
|
|
543
|
-
if [ "$confirm" != "
|
|
577
|
+
if [[ "${confirm,,}" != "yes" && "${confirm,,}" != "y" ]]; then
|
|
544
578
|
echo -e " \033[90mCancelled.\033[0m"
|
|
545
579
|
read -p " Press Enter..." _
|
|
546
580
|
return
|
|
547
581
|
fi
|
|
548
582
|
|
|
549
583
|
rm -f "$ACCOUNTS_DIR/$selected.sh"
|
|
584
|
+
unregister_launcher "$selected"
|
|
550
585
|
local configDir="$HOME/.$selected"
|
|
551
586
|
if [ -d "$configDir" ]; then
|
|
552
587
|
rm -rf "$configDir"
|
|
@@ -796,6 +831,7 @@ sys.stdout.write(data.decode('utf-8').strip())
|
|
|
796
831
|
printf '#!/bin/bash\nexport CLAUDE_CONFIG_DIR="$HOME/.%s"\nclaude "$@"\n' "$name" > "$ACCOUNTS_DIR/$name.sh"
|
|
797
832
|
chmod +x "$ACCOUNTS_DIR/$name.sh"
|
|
798
833
|
fi
|
|
834
|
+
register_launcher "$name"
|
|
799
835
|
echo -e " \033[32mLauncher created\033[0m"
|
|
800
836
|
|
|
801
837
|
echo ""
|