-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch-mac.sh
More file actions
executable file
·107 lines (92 loc) · 3.52 KB
/
launch-mac.sh
File metadata and controls
executable file
·107 lines (92 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# --- Load common Node.js version managers and package managers ---
# nvm
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# fnm
command -v fnm &>/dev/null && eval "$(fnm env)"
# volta
[ -d "$HOME/.volta" ] && export VOLTA_HOME="$HOME/.volta" && export PATH="$VOLTA_HOME/bin:$PATH"
# asdf
[ -f "$HOME/.asdf/asdf.sh" ] && . "$HOME/.asdf/asdf.sh"
# Homebrew (Apple Silicon)
[ -f /opt/homebrew/bin/brew ] && eval "$(/opt/homebrew/bin/brew shellenv)"
# Homebrew (Intel Mac)
[ -f /usr/local/bin/brew ] && eval "$(/usr/local/bin/brew shellenv)"
# Common global paths
[ -d "$HOME/.npm-global/bin" ] && export PATH="$HOME/.npm-global/bin:$PATH"
[ -d "$HOME/.yarn/bin" ] && export PATH="$HOME/.yarn/bin:$PATH"
[ -d "$HOME/.pnpm" ] && export PATH="$HOME/.pnpm:$PATH"
[ -d /usr/local/bin ] && export PATH="/usr/local/bin:$PATH"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPOS_DIR="$SCRIPT_DIR/.repos"
echo ""
echo "Presto Player Support Assistant"
echo "================================"
echo ""
mkdir -p "$REPOS_DIR"
# --- Clone or update repositories ---
clone_or_update() {
local repo=$1
local dir=$2
if [ -d "$REPOS_DIR/$dir" ]; then
echo " Updating $dir..."
cd "$REPOS_DIR/$dir" && git pull --ff-only 2>/dev/null || echo " Could not update $dir (offline?)"
else
echo " Cloning $repo..."
gh repo clone "$repo" "$REPOS_DIR/$dir" -- --depth 1 2>/dev/null || echo " Could not clone $repo (check access)"
fi
}
# Update support repo itself
cd "$SCRIPT_DIR" && git pull --ff-only 2>/dev/null || echo " Could not update support repo (offline?)"
# Clone/update all repos in parallel
clone_or_update "prestomade/presto-player" "presto-player" &
clone_or_update "prestomade/presto-player-pro" "presto-player-pro" &
# Wiki
if [ -d "$REPOS_DIR/presto-player-support.wiki" ]; then
echo " Updating wiki..."
cd "$REPOS_DIR/presto-player-support.wiki" && git pull --ff-only 2>/dev/null || echo " Could not update wiki (offline?)"
else
echo " Cloning wiki..."
git clone --depth 1 "https://github.com/prestomade/presto-player-support.wiki.git" "$REPOS_DIR/presto-player-support.wiki" 2>/dev/null || echo " Wiki not available (using local wiki/ folder)"
fi &
wait
echo "Done."
echo ""
# --- Resolve claude binary ---
CLAUDE_BIN="$(command -v claude 2>/dev/null)"
if [ -z "$CLAUDE_BIN" ]; then
SEARCH_PATHS=(
"$NVM_DIR"/versions/node/*/bin
"$HOME"/.volta/bin
"$HOME"/.local/share/fnm/node-versions/*/installation/bin
"$HOME"/.asdf/shims
"$HOME"/.npm-global/bin
/usr/local/bin
/opt/homebrew/bin
)
for search_dir in "${SEARCH_PATHS[@]}"; do
if [ -x "$search_dir/claude" ]; then
CLAUDE_BIN="$search_dir/claude"
break
fi
done
fi
if [ -z "$CLAUDE_BIN" ]; then
echo ""
echo "ERROR: 'claude' command not found."
echo ""
echo "Install it by running:"
echo " npm install -g @anthropic-ai/claude-code"
echo ""
echo "If you already installed it, make sure 'node' and 'npm' are in your PATH."
echo "Then re-run this script."
exit 1
fi
# --- Launch Claude Code ---
cd "$SCRIPT_DIR"
EXTRA_DIRS=""
[ -d "$REPOS_DIR/presto-player" ] && EXTRA_DIRS="$EXTRA_DIRS --add-dir $REPOS_DIR/presto-player"
[ -d "$REPOS_DIR/presto-player-pro" ] && EXTRA_DIRS="$EXTRA_DIRS --add-dir $REPOS_DIR/presto-player-pro"
[ -d "$REPOS_DIR/presto-player-support.wiki" ] && EXTRA_DIRS="$EXTRA_DIRS --add-dir $REPOS_DIR/presto-player-support.wiki"
eval "$CLAUDE_BIN" $EXTRA_DIRS