-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_verify.sh
More file actions
executable file
·209 lines (181 loc) · 6.13 KB
/
install_verify.sh
File metadata and controls
executable file
·209 lines (181 loc) · 6.13 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash
# promptctl Installation Verification Script
# Verifies all dependencies and system requirements
set -e
echo "============================================================"
echo "🔍 promptctl Installation Verification"
echo "============================================================"
echo ""
PASS="✅"
FAIL="❌"
WARN="⚠️"
total_checks=0
passed_checks=0
check() {
total_checks=$((total_checks + 1))
if [ $1 -eq 0 ]; then
echo "$PASS $2"
passed_checks=$((passed_checks + 1))
return 0
else
echo "$FAIL $2"
[ -n "$3" ] && echo " → Fix: $3"
return 1
fi
}
echo "📋 System Requirements"
echo "-----------------------------------------------------------"
# Check Python version
python_version=$(python --version 2>&1 | awk '{print $2}')
python_major=$(echo $python_version | cut -d. -f1)
python_minor=$(echo $python_version | cut -d. -f2)
if [ "$python_major" -ge 3 ] && [ "$python_minor" -ge 10 ]; then
check 0 "Python ${python_version} (≥3.10 required)"
else
check 1 "Python ${python_version} (need ≥3.10)" "brew install python@3.10"
fi
# Check virtual environment
if [ -n "$VIRTUAL_ENV" ]; then
check 0 "Virtual environment active: $(basename $VIRTUAL_ENV)"
else
check 1 "Virtual environment NOT active" "source venv/bin/activate"
fi
# Check working directory
if [ -f "promptctl.py" ]; then
check 0 "In promptctl directory: $(pwd)"
else
check 1 "Not in promptctl directory" "cd ~/dev/promptctl"
fi
echo ""
echo "📦 Python Dependencies"
echo "-----------------------------------------------------------"
# Check GitPython
if python -c "import git" 2>/dev/null; then
version=$(python -c "import git; print(git.__version__)" 2>/dev/null)
check 0 "GitPython ${version} installed"
else
check 1 "GitPython NOT installed" "pip install GitPython"
fi
# Check requests
if python -c "import requests" 2>/dev/null; then
version=$(python -c "import requests; print(requests.__version__)" 2>/dev/null)
check 0 "requests ${version} installed"
else
check 1 "requests NOT installed" "pip install requests"
fi
# Check all imports work
if python -c "from core.daemon import PromptDaemon, LLMCommitGenerator; from core.git_manager import GitManager" 2>/dev/null; then
check 0 "All core modules import successfully"
else
check 1 "Core module imports failed" "Check Python path and dependencies"
fi
echo ""
echo "🤖 LLM Components (Optional)"
echo "-----------------------------------------------------------"
# Check Ollama installation
if command -v ollama &> /dev/null; then
ollama_version=$(ollama --version 2>&1 | head -1)
check 0 "Ollama installed: $ollama_version"
else
check 1 "Ollama NOT installed (optional)" "brew install ollama"
fi
# Check Ollama service
if pgrep -x "ollama" > /dev/null 2>&1; then
check 0 "Ollama service running"
else
check 1 "Ollama service NOT running" "brew services start ollama"
fi
# Check Phi-3.5 model
if command -v ollama &> /dev/null; then
if ollama list 2>/dev/null | grep -q "phi3.5"; then
model_size=$(ollama list 2>/dev/null | grep "phi3.5" | awk '{print $3}')
check 0 "Phi-3.5 model available ($model_size)"
else
check 1 "Phi-3.5 model NOT available" "ollama pull phi3.5"
fi
fi
echo ""
echo "💾 Storage & Repository"
echo "-----------------------------------------------------------"
# Check disk space
if [ "$(uname)" = "Darwin" ]; then
free_space=$(df -h . | awk 'NR==2 {print $4}')
free_space_gb=$(df -g . | awk 'NR==2 {print $4}')
else
free_space=$(df -h . | awk 'NR==2 {print $4}')
free_space_gb=$(echo $free_space | sed 's/G//')
fi
if [ "${free_space_gb}" -ge 5 ] 2>/dev/null; then
check 0 "Disk space available: ${free_space}"
else
check 1 "Low disk space: ${free_space} (need 5GB+)" "Free up disk space"
fi
# Check promptctl repo
if [ -d "$HOME/.promptctl/.git" ]; then
check 0 "promptctl repository initialized at ~/.promptctl"
else
check 0 "promptctl repository not yet initialized (will auto-create)"
fi
# Check code files exist
core_files=("promptctl.py" "core/daemon.py" "core/git_manager.py" "core/tag_manager.py")
missing_files=0
for file in "${core_files[@]}"; do
if [ ! -f "$file" ]; then
missing_files=$((missing_files + 1))
fi
done
if [ $missing_files -eq 0 ]; then
check 0 "All core files present (${#core_files[@]} files)"
else
check 1 "$missing_files core files missing" "Check installation directory"
fi
echo ""
echo "🧪 Basic Functionality Test"
echo "-----------------------------------------------------------"
# Test CLI help
if python promptctl.py --help > /dev/null 2>&1; then
check 0 "CLI runs successfully"
else
check 1 "CLI fails to run" "Check Python and dependencies"
fi
# Test LLM integration
if python -c "from core.daemon import LLMCommitGenerator; gen = LLMCommitGenerator(enabled=False); print('OK')" 2>/dev/null | grep -q "OK"; then
check 0 "LLMCommitGenerator class accessible"
else
check 1 "LLMCommitGenerator not accessible" "Check core/daemon.py"
fi
echo ""
echo "============================================================"
echo "📊 Verification Summary"
echo "============================================================"
echo ""
echo "Checks passed: $passed_checks / $total_checks"
if [ $passed_checks -eq $total_checks ]; then
echo ""
echo "🎉 ALL CHECKS PASSED! Installation is complete."
echo ""
echo "🚀 Ready to use promptctl:"
echo " cd ~/dev/promptctl"
echo " source venv/bin/activate"
echo " python promptctl.py --help"
echo ""
echo " # Without LLM (default)"
echo " python promptctl.py daemon"
echo ""
echo " # With LLM (smart commits)"
echo " python promptctl.py daemon --use-llm"
echo ""
exit 0
else
failed=$((total_checks - passed_checks))
echo ""
echo "⚠️ $failed checks failed. Review errors above."
echo ""
echo "Common fixes:"
echo " 1. Activate venv: source venv/bin/activate"
echo " 2. Install deps: pip install -r requirements.txt"
echo " 3. Start Ollama: brew services start ollama"
echo " 4. Pull model: ollama pull phi3.5"
echo ""
exit 1
fi