-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
60 lines (50 loc) · 1.55 KB
/
Copy pathinstall.sh
File metadata and controls
60 lines (50 loc) · 1.55 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
#!/usr/bin/env bash
set -euo pipefail
REPO="https://github.com/askspecter/specter-cli"
INSTALL_DIR="${HOME}/.specter-cli"
BIN_DIR="${HOME}/.local/bin"
echo ""
echo " ╔══════════════════════════════════════╗"
echo " ║ SPECTER CLI — Install Script ║"
echo " ╚══════════════════════════════════════╝"
echo ""
# Check Node.js
if ! command -v node &>/dev/null; then
echo " ✗ Node.js not found. Install from https://nodejs.org (v18+)"
exit 1
fi
NODE_MAJOR=$(node --version | sed 's/v//' | cut -d. -f1)
if [ "$NODE_MAJOR" -lt 18 ]; then
echo " ✗ Node.js v18+ required (found v${NODE_MAJOR})"
exit 1
fi
echo " ✓ Node.js $(node --version)"
# Clone or update
if [ -d "$INSTALL_DIR/.git" ]; then
echo " Updating existing install..."
git -C "$INSTALL_DIR" pull --ff-only origin main
else
echo " Cloning $REPO..."
git clone --depth 1 "$REPO" "$INSTALL_DIR"
fi
# Build
cd "$INSTALL_DIR"
echo " Installing dependencies..."
npm install --silent
echo " Building..."
npm run build
# Link binary
mkdir -p "$BIN_DIR"
ln -sf "$INSTALL_DIR/dist/index.js" "$BIN_DIR/specter"
chmod +x "$INSTALL_DIR/dist/index.js"
echo ""
echo " ✓ SPECTER CLI installed to $BIN_DIR/specter"
echo ""
# PATH hint
if [[ ":$PATH:" != *":$BIN_DIR:"* ]]; then
echo " Add this to your ~/.bashrc or ~/.zshrc:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
fi
echo " Try: specter --help"
echo ""