-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·97 lines (85 loc) · 3.1 KB
/
install.sh
File metadata and controls
executable file
·97 lines (85 loc) · 3.1 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
#!/bin/bash
set -e
REPO="brontoguana/snoot"
echo "Installing Snoot..."
echo
# Show current version if installed
if command -v snoot &>/dev/null; then
CURRENT_VERSION=$(snoot --version 2>/dev/null || echo "unknown")
echo "Current version: $CURRENT_VERSION"
else
echo "No existing installation found"
fi
# Detect platform
ARCH=$(uname -m)
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
if [ "$OS" = "darwin" ] && ([ "$ARCH" = "arm64" ] || [ "$ARCH" = "x86_64" ]); then
BINARY="snoot-macos-arm64"
elif [ "$OS" = "linux" ] && [ "$ARCH" = "x86_64" ]; then
BINARY="snoot-linux-x64"
else
echo "This installer supports Linux x86_64 and macOS ARM64."
echo ""
echo "For Windows, use PowerShell:"
echo " irm https://raw.githubusercontent.com/brontoguana/snoot/main/install.ps1 | iex"
echo ""
echo "For other platforms, build from source:"
echo " git clone https://github.com/$REPO.git"
echo " cd snoot && bun install && ./build.sh"
exit 1
fi
# Get latest release version tag from GitHub redirect
LATEST_TAG=$(curl -fsSI "https://github.com/$REPO/releases/latest" 2>/dev/null | grep -i '^location:' | grep -o 'v[0-9][^[:space:]]*' | tr -d '\r')
if [ -z "$LATEST_TAG" ]; then
echo "Could not determine latest version"
LATEST_TAG="latest"
fi
echo "Installing: Snoot $LATEST_TAG"
echo
# Download release to temp file first (can't overwrite a running binary on Linux)
echo "Downloading $LATEST_TAG..."
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_TAG/$BINARY"
TMPFILE=$(mktemp /tmp/snoot-update.XXXXXX)
trap "rm -f '$TMPFILE'" EXIT
curl -fsSL -o "$TMPFILE" "$DOWNLOAD_URL"
chmod +x "$TMPFILE"
# Atomic swap — works even if the old binary is running
mkdir -p "$HOME/.local/bin"
mv -f "$TMPFILE" "$HOME/.local/bin/snoot"
echo "✓ Installed to ~/.local/bin/snoot"
# Check for supported AI CLIs
FOUND_CLI=0
for cli in claude gemini codex; do
if command -v "$cli" &>/dev/null; then
echo "✓ $cli CLI found"
FOUND_CLI=1
fi
done
if [ "$FOUND_CLI" = "0" ]; then
echo "⚠ No AI CLI found (claude, gemini, or codex)"
echo " Install one: npm install -g @anthropic-ai/claude-code"
echo " Or configure an OpenAI-compatible endpoint after install."
fi
# Ensure ~/.local/bin is in PATH for this session and future shells
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
echo
echo "⚠ ~/.local/bin is not in your PATH. Add this to your shell profile:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
fi
# Ensure claude is discoverable: add ~/.local/bin to shell profile if not present
for profile in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.profile"; do
if [ -f "$profile" ] && ! grep -q 'export PATH=.*\.local/bin' "$profile" 2>/dev/null; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$profile"
echo "✓ Added ~/.local/bin to PATH in $(basename "$profile")"
break
fi
done
# Confirm installed version
echo
INSTALLED=$("$HOME/.local/bin/snoot" --version 2>/dev/null || echo "unknown")
echo "Installed: $INSTALLED"
echo
echo "Next steps:"
echo " snoot setup session <session-id> # one-time setup"
echo " cd /your/project && snoot MyChannel # start a channel"
echo