-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
122 lines (106 loc) · 3.34 KB
/
install.sh
File metadata and controls
122 lines (106 loc) · 3.34 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env bash
# CCM — Claude Code Manager installer
# Usage: curl -fsSL https://raw.githubusercontent.com/dr5hn/ccm/main/install.sh | bash
set -euo pipefail
CCM_DIR="$HOME/.ccm"
CCM_BIN="$CCM_DIR/bin"
CCM_URL="https://raw.githubusercontent.com/dr5hn/ccm/main/ccm.sh"
# Colors (disabled if not a terminal)
if [[ -t 1 ]]; then
GREEN='\033[0;32m'
CYAN='\033[0;36m'
DIM='\033[0;90m'
BOLD='\033[1m'
RESET='\033[0m'
else
GREEN='' CYAN='' DIM='' BOLD='' RESET=''
fi
info() { echo -e "${CYAN}>${RESET} $*"; }
success() { echo -e "${GREEN}✓${RESET} $*"; }
dim() { echo -e "${DIM}$*${RESET}"; }
echo ""
echo -e "${GREEN}"
echo ' ██████╗ ██████╗███╗ ███╗'
echo '██╔════╝██╔════╝████╗ ████║'
echo '██║ ██║ ██╔████╔██║'
echo '██║ ██║ ██║╚██╔╝██║'
echo '╚██████╗╚██████╗██║ ╚═╝ ██║'
echo -e ' ╚═════╝ ╚═════╝╚═╝ ╚═╝'"${RESET}"
echo ""
echo -e "${BOLD}The power-user toolkit for Claude Code${RESET}"
echo ""
# Check dependencies
for cmd in bash jq curl; do
if ! command -v "$cmd" >/dev/null 2>&1; then
echo "Error: '$cmd' is required but not found."
if [[ "$cmd" == "jq" ]]; then
echo " Install with: brew install jq (macOS) or sudo apt install jq (Linux)"
fi
exit 1
fi
done
# Check bash version
bash_version=$(bash --version | head -n1 | grep -oE '[0-9]+\.[0-9]+' | head -n1)
if ! awk -v ver="$bash_version" 'BEGIN { exit (ver >= 4.4 ? 0 : 1) }'; then
echo "Error: Bash 4.4+ required (found $bash_version)"
echo " macOS: brew install bash"
exit 1
fi
# Create install directory
info "Installing to ${CCM_BIN}/ccm"
mkdir -p "$CCM_BIN"
# Download
curl -fsSL "$CCM_URL" -o "$CCM_BIN/ccm"
chmod +x "$CCM_BIN/ccm"
success "Downloaded ccm"
# Detect shell and profile
detect_profile() {
local shell_name
shell_name=$(basename "$SHELL")
case "$shell_name" in
zsh)
if [[ -f "$HOME/.zshrc" ]]; then
echo "$HOME/.zshrc"
else
echo "$HOME/.zprofile"
fi
;;
bash)
if [[ -f "$HOME/.bashrc" ]]; then
echo "$HOME/.bashrc"
elif [[ -f "$HOME/.bash_profile" ]]; then
echo "$HOME/.bash_profile"
else
echo "$HOME/.profile"
fi
;;
*)
echo "$HOME/.profile"
;;
esac
}
PROFILE=$(detect_profile)
PATH_LINE='export PATH="$HOME/.ccm/bin:$PATH"'
# Add to PATH if not already there
if [[ ":$PATH:" == *":$CCM_BIN:"* ]]; then
success "Already in PATH"
elif grep -qF '.ccm/bin' "$PROFILE" 2>/dev/null; then
success "PATH entry already in $PROFILE"
else
echo "" >> "$PROFILE"
echo '# CCM — Claude Code Manager' >> "$PROFILE"
echo "$PATH_LINE" >> "$PROFILE"
success "Added to PATH in $(basename "$PROFILE")"
fi
# Verify
export PATH="$CCM_BIN:$PATH"
VERSION=$("$CCM_BIN/ccm" version 2>/dev/null || echo "unknown")
echo ""
success "Installed! ${DIM}${VERSION}${RESET}"
echo ""
dim " Restart your terminal or run:"
dim " source $PROFILE"
echo ""
dim " Then try:"
dim " ccm help"
echo ""