-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·69 lines (58 loc) · 1.98 KB
/
install.sh
File metadata and controls
executable file
·69 lines (58 loc) · 1.98 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
#!/usr/bin/env bash
# TokenGolf installer
# Usage: curl -fsSL https://raw.githubusercontent.com/josheche/tokengolf/main/install.sh | bash
set -euo pipefail
BOLD='\033[1m'
DIM='\033[2m'
GREEN='\033[32m'
YELLOW='\033[33m'
RED='\033[31m'
CYAN='\033[36m'
RESET='\033[0m'
info() { printf "${BOLD}${CYAN}▶${RESET} %s\n" "$1"; }
ok() { printf "${BOLD}${GREEN}✓${RESET} %s\n" "$1"; }
warn() { printf "${BOLD}${YELLOW}!${RESET} %s\n" "$1"; }
err() { printf "${BOLD}${RED}✗${RESET} %s\n" "$1" >&2; }
echo ""
printf "${YELLOW}██${RESET} ${BOLD}TokenGolf Installer${RESET}\n"
printf "${YELLOW}██${RESET} ${DIM}Every token matters${RESET}\n"
echo ""
# Check Node.js
if ! command -v node &>/dev/null; then
err "Node.js is required but not installed."
echo ""
echo " Install Node.js (v18+) from:"
echo " https://nodejs.org"
echo " brew install node"
echo " curl -fsSL https://fnm.vercel.app/install | bash"
echo ""
exit 1
fi
NODE_VERSION=$(node -v | sed 's/v//' | cut -d. -f1)
if [ "$NODE_VERSION" -lt 18 ]; then
err "Node.js v18+ required (found v$(node -v | sed 's/v//'))"
exit 1
fi
ok "Node.js $(node -v) detected"
# Check npm
if ! command -v npm &>/dev/null; then
err "npm is required but not installed."
exit 1
fi
# Install tokengolf globally
info "Installing tokengolf via npm..."
npm install -g tokengolf
ok "tokengolf installed ($(tokengolf --version 2>/dev/null || echo 'unknown version'))"
# Patch Claude Code hooks (only if Claude Code is installed)
if [ -d "$HOME/.claude" ]; then
info "Installing Claude Code hooks..."
tokengolf install
else
warn "Claude Code not detected — skipping hook setup."
printf " Run ${CYAN}tokengolf install${RESET} after installing Claude Code.\n"
fi
echo ""
printf "${YELLOW}██${RESET} ${BOLD}${GREEN}Ready to play!${RESET}\n"
printf "${YELLOW}██${RESET} ${DIM}Open Claude Code and /exit to see your first scorecard.${RESET}\n"
printf "${YELLOW}██${RESET} ${DIM}Or run: tokengolf start${RESET}\n"
echo ""