-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
134 lines (115 loc) · 3.26 KB
/
setup.sh
File metadata and controls
134 lines (115 loc) · 3.26 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
#!/bin/bash
# First-time setup script for Code Summarizer
# Run this after cloning the repository
echo "========================================="
echo " Code Summarizer - First Time Setup"
echo "========================================="
echo ""
ERRORS=0
# 1. Check Node.js
echo "Checking prerequisites..."
echo ""
if command -v node &> /dev/null; then
NODE_VERSION=$(node --version)
echo "[OK] Node.js $NODE_VERSION"
else
echo "[MISSING] Node.js is not installed."
echo " Install from: https://nodejs.org/"
ERRORS=$((ERRORS + 1))
fi
# 2. Check Rust
if command -v rustc &> /dev/null; then
RUST_VERSION=$(rustc --version | awk '{print $2}')
echo "[OK] Rust $RUST_VERSION"
else
echo "[MISSING] Rust is not installed."
echo " Install from: https://rustup.rs/"
ERRORS=$((ERRORS + 1))
fi
# 3. Check Cargo
if command -v cargo &> /dev/null; then
echo "[OK] Cargo available"
else
echo "[MISSING] Cargo is not installed (comes with Rust)."
echo " Install from: https://rustup.rs/"
ERRORS=$((ERRORS + 1))
fi
# 4. Check Ollama
if command -v ollama &> /dev/null; then
echo "[OK] Ollama installed"
else
echo "[MISSING] Ollama is not installed."
echo " Install from: https://ollama.ai/"
ERRORS=$((ERRORS + 1))
fi
# 5. Check if Ollama is running
if curl -s http://127.0.0.1:11434/api/tags > /dev/null 2>&1; then
echo "[OK] Ollama is running"
# Check for models
MODEL_COUNT=$(curl -s http://127.0.0.1:11434/api/tags | grep -o '"name"' | wc -l)
if [ "$MODEL_COUNT" -gt 0 ]; then
echo "[OK] $MODEL_COUNT model(s) available"
else
echo "[WARNING] No models found. Pull one with: ollama pull llama2"
fi
else
echo "[WARNING] Ollama is not running. Start it with: ollama serve"
fi
echo ""
# Stop if prerequisites are missing
if [ $ERRORS -gt 0 ]; then
echo "========================================="
echo " $ERRORS prerequisite(s) missing."
echo " Please install them and re-run setup."
echo "========================================="
exit 1
fi
# 6. Install npm dependencies
echo "Installing npm dependencies..."
npm install
if [ $? -ne 0 ]; then
echo "[FAILED] npm install failed. Check the errors above."
exit 1
fi
echo "[OK] Dependencies installed"
echo ""
# 7. Generate icons
echo "Generating application icons..."
npm run generate-icons 2>/dev/null
if [ $? -eq 0 ]; then
echo "[OK] Icons generated"
else
echo "[WARNING] Icon generation failed (non-critical). You can retry with: npm run generate-icons"
fi
echo ""
# 8. Run tests
echo "Running tests to verify setup..."
echo ""
echo "--- TypeScript tests ---"
npx vitest run 2>&1
TS_RESULT=$?
echo ""
echo "--- Rust tests ---"
cd src-tauri && cargo test 2>&1
RUST_RESULT=$?
cd ..
echo ""
if [ $TS_RESULT -eq 0 ] && [ $RUST_RESULT -eq 0 ]; then
echo "[OK] All tests passed"
else
echo "[WARNING] Some tests failed. Check the output above."
fi
echo ""
echo "========================================="
echo " Setup complete!"
echo "========================================="
echo ""
echo "To start the app in development mode:"
echo " npm run tauri:dev"
echo ""
echo "To build for production:"
echo " npm run tauri:build"
echo ""
echo "Make sure Ollama is running before starting the app:"
echo " ollama serve"
echo ""