-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·149 lines (133 loc) · 5.22 KB
/
install.sh
File metadata and controls
executable file
·149 lines (133 loc) · 5.22 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env sh
set -e
# ── Color helpers ──────────────────────────────────────────
if [ -t 1 ]; then
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
BOLD='\033[1m'
RESET='\033[0m'
else
GREEN=''
RED=''
YELLOW=''
BOLD=''
RESET=''
fi
# ── Utility functions ──────────────────────────────────────
info() { printf '%s[info]%s %s\n' "$BOLD" "$RESET" "$1"; }
ok() { printf '%s[ok]%s %s\n' "$GREEN" "$RESET" "$1"; }
warn() { printf '%s[warn]%s %s\n' "$YELLOW" "$RESET" "$1"; }
fail() { printf '%s[fail]%s %s\n' "$RED" "$RESET" "$1"; exit 1; }
# ── OS detection ───────────────────────────────────────────
detect_os() {
case "$(uname -s)" in
Darwin) OS="macos" ;;
Linux)
if [ -f /etc/os-release ]; then
# shellcheck disable=SC1091
. /etc/os-release
case "$ID" in
ubuntu|debian) OS="ubuntu" ;;
*) OS="linux-other" ;;
esac
else
OS="linux-other"
fi
;;
*) fail "Unsupported OS: $(uname -s). AutoSkillit supports macOS and Ubuntu." ;;
esac
info "Detected OS: $OS"
}
# ── Python 3.11+ ──────────────────────────────────────────
ensure_python() {
if command -v python3 >/dev/null 2>&1; then
py_version=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
py_major=$(echo "$py_version" | cut -d. -f1)
py_minor=$(echo "$py_version" | cut -d. -f2)
if [ "$py_major" -ge 3 ] && [ "$py_minor" -ge 11 ]; then
ok "Python $py_version"
return
fi
warn "Python $py_version found but 3.11+ is required"
else
warn "Python 3 not found"
fi
info "Installing Python 3.12..."
case "$OS" in
macos)
if ! command -v brew >/dev/null 2>&1; then
fail "Homebrew is required to install Python on macOS. Install it from https://brew.sh"
fi
brew install python@3.12
;;
ubuntu)
sudo apt-get update -qq
sudo apt-get install -y python3.12 python3.12-venv
;;
*)
fail "Please install Python 3.11+ manually and re-run this script."
;;
esac
# Re-verify
if command -v python3 >/dev/null 2>&1; then
py_version=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
ok "Python $py_version installed"
else
fail "Python installation failed. Please install Python 3.11+ manually."
fi
}
# ── uv ─────────────────────────────────────────────────────
ensure_uv() {
if command -v uv >/dev/null 2>&1; then
ok "uv $(uv --version 2>/dev/null | head -1)"
return
fi
info "Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
# Source the env file if it exists
if [ -f "$HOME/.local/bin/env" ]; then
# shellcheck disable=SC1091
. "$HOME/.local/bin/env"
fi
export PATH="$HOME/.local/bin:$PATH"
if command -v uv >/dev/null 2>&1; then
ok "uv installed"
else
fail "uv installation failed. See https://docs.astral.sh/uv/getting-started/installation/"
fi
}
# ── Claude Code ────────────────────────────────────────────
ensure_claude() {
if command -v claude >/dev/null 2>&1; then
ok "Claude Code found"
return
fi
fail "Claude Code is not installed. Install it first:
https://docs.anthropic.com/en/docs/claude-code/overview
Then re-run this script."
}
# ── AutoSkillit ────────────────────────────────────────────
install_autoskillit() {
info "Installing AutoSkillit from stable branch..."
uv tool install "git+https://github.com/TalonT-Org/AutoSkillit.git@stable" 2>/dev/null \
|| uv tool install --force "git+https://github.com/TalonT-Org/AutoSkillit.git@stable" 2>/dev/null \
|| fail "Failed to install AutoSkillit. Check your network connection."
autoskillit install
ok "AutoSkillit installed and registered with Claude Code"
}
# ── Main ───────────────────────────────────────────────────
main() {
printf '\n%sAutoSkillit Installer%s\n\n' "$BOLD" "$RESET"
detect_os
ensure_python
ensure_uv
ensure_claude
install_autoskillit
printf '\n%s✓ All done!%s\n\n' "$GREEN" "$RESET"
printf 'Next steps:\n'
printf ' cd your-project\n'
printf ' autoskillit init\n'
printf ' autoskillit cook implementation\n\n'
}
main