-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocforge.sh
More file actions
executable file
·697 lines (615 loc) · 21.8 KB
/
docforge.sh
File metadata and controls
executable file
·697 lines (615 loc) · 21.8 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
#!/bin/bash
# docforge.sh - CLI for DocForge API
# Usage: ./docforge.sh [options]
set -euo pipefail
# Colors and Formatting
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
GRAY='\033[0;90m'
WHITE='\033[1;37m'
BOLD='\033[1m'
NC='\033[0m' # No Color
# Configuration
API_PORT=5257
CLIENT_PORT=5173
API_DIR="./DocumentGenerator.API"
CLIENT_DIR="./DocumentGenerator.Client"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Global variables
SKIP_DEPENDENCY_CHECK=${SKIP_DEPENDENCY_CHECK:-0}
AUTO_FIX_DEPENDENCIES=${AUTO_FIX_DEPENDENCIES:-0}
DEPENDENCY_STATUS=0
# Helper Functions
# Check if a port is listening (returns 0 if yes, 1 if no)
is_port_listening() {
local port=$1
# Try lsof first (most common)
if command -v lsof >/dev/null 2>&1; then
lsof -Pi :$port -sTCP:LISTEN -t >/dev/null 2>&1 && return 0
fi
# Try ss (modern Linux)
if command -v ss >/dev/null 2>&1; then
ss -tlnp 2>/dev/null | grep -q ":$port " && return 0
fi
# Try netstat (fallback)
if command -v netstat >/dev/null 2>&1; then
netstat -tlnp 2>/dev/null | grep -q ":$port " && return 0
fi
return 1
}
check_port() {
local port=$1
if is_port_listening $port; then
echo -e "${GREEN}UP${NC}"
else
echo -e "${RED}DOWN${NC}"
fi
}
test_quick_dependency() {
local cmd="$1"
# Extract the command name (first word) from the full command string
local cmd_name=$(echo "$cmd" | cut -d' ' -f1)
if command -v "$cmd_name" >/dev/null 2>&1; then
if eval "$cmd" >/dev/null 2>&1; then
return 0
fi
fi
return 1
}
show_dependency_status() {
if [[ "$DEPENDENCY_STATUS" -eq 0 ]]; then
echo -e "🔍 Dependencies: ${GREEN}OK${NC}"
else
echo -e "🔍 Dependencies: ${RED}ISSUES${NC}"
fi
}
proactive_dependency_check() {
if [[ "$SKIP_DEPENDENCY_CHECK" -eq 1 ]]; then
return 0
fi
echo -e "${CYAN}🔍 Checking dependencies...${NC}"
local issues=()
# Quick dependency checks
if ! test_quick_dependency "dotnet --version"; then
issues+=(".NET 8 SDK not found")
fi
if ! test_quick_dependency "node --version"; then
issues+=("Node.js not found")
fi
if ! test_quick_dependency "npm --version"; then
issues+=("npm not found")
fi
if [[ ${#issues[@]} -gt 0 ]]; then
echo
echo -e "${YELLOW}⚠️ Found dependency issues:${NC}"
for issue in "${issues[@]}"; do
echo -e " • ${RED}$issue${NC}"
done
if [[ "$AUTO_FIX_DEPENDENCIES" -eq 1 ]]; then
echo
echo -e "${CYAN}🔧 Attempting to fix dependencies automatically...${NC}"
local dependency_checker="$SCRIPT_DIR/scripts/check-dependencies.sh"
if [[ -f "$dependency_checker" ]]; then
if "$dependency_checker" --auto-install --quiet; then
echo -e "${GREEN}✅ Dependencies fixed!${NC}"
DEPENDENCY_STATUS=0
return 0
else
echo -e "${YELLOW}⚠️ Some dependencies could not be fixed automatically${NC}"
fi
else
echo -e "${RED}❌ Dependency checker not found${NC}"
fi
fi
echo
echo -e "${CYAN}🔧 Options:${NC}"
echo " 1) Run automatic fix (./docforge.sh --autofix)"
echo " 2) Run full dependency check"
echo " 3) Continue anyway (may fail)"
echo
while true; do
read -p "Select option (1-3, or skip with --skip-dependency-check): " choice
case "$choice" in
1|2|3) break ;;
*) echo "Please enter 1, 2, or 3" ;;
esac
done
case "$choice" in
1)
local dependency_checker="$SCRIPT_DIR/scripts/check-dependencies.sh"
if [[ -f "$dependency_checker" ]]; then
if "$dependency_checker" --auto-install; then
echo -e "${GREEN}✅ Dependencies installed successfully!${NC}"
DEPENDENCY_STATUS=0
return 0
else
echo -e "${RED}❌ Some dependencies failed to install${NC}"
DEPENDENCY_STATUS=1
return 1
fi
else
echo -e "${RED}❌ Dependency checker not found${NC}"
DEPENDENCY_STATUS=1
return 1
fi
;;
2)
local dependency_checker="$SCRIPT_DIR/scripts/check-dependencies.sh"
if [[ -f "$dependency_checker" ]]; then
"$dependency_checker"
local exit_code=$?
DEPENDENCY_STATUS=$((exit_code == 0 ? 0 : 1))
return $exit_code
else
echo -e "${RED}❌ Dependency checker not found${NC}"
DEPENDENCY_STATUS=1
return 1
fi
;;
3)
echo -e "${YELLOW}⚠️ Continuing with potential issues...${NC}"
DEPENDENCY_STATUS=1
return 0
;;
esac
else
echo -e "${GREEN}✅ All dependencies appear to be installed${NC}"
DEPENDENCY_STATUS=0
return 0
fi
}
print_header() {
clear
echo -e "${CYAN}${BOLD}"
echo " DOCFORGE"
echo -e "${NC}"
echo "==============================================="
show_dependency_status
# Backend status with link when up
if is_port_listening $API_PORT; then
echo -e " Backend (API): ${GREEN}UP${NC} → http://localhost:$API_PORT/swagger"
else
echo -e " Backend (API): ${RED}DOWN${NC}"
fi
# Frontend status with link when up
if is_port_listening $CLIENT_PORT; then
echo -e " Frontend (Client): ${GREEN}UP${NC} → http://localhost:$CLIENT_PORT"
else
echo -e " Frontend (Client): ${RED}DOWN${NC}"
fi
echo "==============================================="
echo ""
}
wait_for_enter() {
echo ""
read -p "Press Enter to continue..."
}
# Actions
do_setup() {
echo -e "${CYAN}🔧 Setup Options:${NC}"
echo ""
echo -e "1) 🐳 Docker Setup (Easiest)" "${GREEN}"
echo -e "2) 🔧 Native Setup (Full development)" "${YELLOW}"
echo -e "3) 🔍 Check Dependencies Only" "${CYAN}"
echo -e "4) 📦 Install Dependencies Automatically" "${NC}"
echo ""
while true; do
read -p "Select setup option (1-4): " choice
case "$choice" in
1|2|3|4) break ;;
*) echo "Please enter 1, 2, 3, or 4" ;;
esac
done
case "$choice" in
1)
local setup_wizard="$SCRIPT_DIR/scripts/setup-wizard.sh"
if [[ -f "$setup_wizard" ]]; then
"$setup_wizard" --force-native
else
echo -e "${RED}❌ Setup wizard not found${NC}"
echo -e "${YELLOW} Falling back to native setup...${NC}"
do_native_setup
fi
;;
2)
do_native_setup
;;
3)
local dependency_checker="$SCRIPT_DIR/scripts/check-dependencies.sh"
if [[ -f "$dependency_checker" ]]; then
"$dependency_checker"
else
echo -e "${RED}❌ Dependency checker not found${NC}"
fi
;;
4)
local dependency_checker="$SCRIPT_DIR/scripts/check-dependencies.sh"
if [[ -f "$dependency_checker" ]]; then
if "$dependency_checker" --auto-install; then
echo -e "${GREEN}✅ Dependencies installed successfully!${NC}"
else
echo -e "${RED}❌ Some dependencies failed to install${NC}"
fi
else
echo -e "${RED}❌ Dependency checker not found${NC}"
fi
;;
esac
wait_for_enter
}
do_native_setup() {
echo -e "${YELLOW}🔧 Setting up native development environment...${NC}"
# Check and install dependencies
local dependency_checker="$SCRIPT_DIR/scripts/check-dependencies.sh"
if [[ -f "$dependency_checker" ]]; then
echo -e "${CYAN}📦 Checking and installing dependencies...${NC}"
if "$dependency_checker" --auto-install; then
echo -e "${GREEN}✅ Dependencies installed successfully!${NC}"
# Restore .NET packages
echo -e "${CYAN}📦 Restoring .NET packages...${NC}"
if dotnet restore; then
echo -e "${GREEN}✅ .NET packages restored${NC}"
else
echo -e "${YELLOW}⚠️ .NET package restore had issues${NC}"
fi
# Install npm dependencies
echo -e "${CYAN}📦 Installing frontend dependencies...${NC}"
if [[ -f "$CLIENT_DIR/package.json" ]]; then
if (cd "$CLIENT_DIR" && npm install); then
echo -e "${GREEN}✅ Frontend dependencies installed${NC}"
else
echo -e "${YELLOW}⚠️ Frontend dependency installation had issues${NC}"
fi
else
echo -e "${YELLOW}⚠️ Frontend package.json not found${NC}"
fi
echo
echo -e "${GREEN}🎉 Native setup completed!${NC}"
echo -e "${CYAN}You can now start the backend and frontend services.${NC}"
else
echo -e "${RED}❌ Dependency installation failed${NC}"
echo -e "${YELLOW}Please check the error messages above and try again.${NC}"
fi
else
echo -e "${RED}❌ Dependency checker not found${NC}"
echo -e "${YELLOW}Please run the setup wizard instead: ./scripts/setup-wizard.sh${NC}"
fi
}
do_start_backend() {
# Pre-flight checks
if [[ ! -d "$API_DIR" ]]; then
echo -e "${RED}❌ API directory not found: $API_DIR${NC}"
echo -e "${YELLOW} Make sure you're running this from the project root.${NC}"
wait_for_enter
return
fi
if ! test_quick_dependency "dotnet --version"; then
echo -e "${RED}❌ .NET SDK not found. Please run setup first.${NC}"
echo -e "${YELLOW} Option 1) Setup Dependencies${NC}"
wait_for_enter
return
fi
echo -e "${YELLOW}🚀 Starting Backend...${NC}"
if dotnet run --project "$API_DIR" > api.log 2>&1 & then
API_PID=$!
echo -e "${GREEN}✓ Backend process started (PID: $API_PID)${NC}"
# Wait for API to be ready (with timeout)
echo -e "${CYAN}⏳ Waiting for API to be ready...${NC}"
for i in {1..30}; do # Increased timeout to 30 seconds
if is_port_listening $API_PORT; then
echo -e "${GREEN}✅ API is up and running on port $API_PORT!${NC}"
echo -e "${CYAN} API URL: http://localhost:$API_PORT${NC}"
echo -e "${CYAN} Swagger UI: http://localhost:$API_PORT/swagger${NC}"
wait_for_enter
return
fi
# Show progress
if [[ $((i % 5)) -eq 0 ]]; then
echo -e "${CYAN} Still waiting... ($i/30 seconds)${NC}"
fi
sleep 1
done
echo -e "${YELLOW}⚠️ WARNING: API may not have started within expected time.${NC}"
echo -e "${YELLOW} Check api.log for errors and consider:${NC}"
echo -e " • Running 'dotnet restore' first${NC}"
echo -e " • Checking for missing dependencies${NC}"
echo -e " • Looking for build errors${NC}"
else
echo -e "${RED}❌ Failed to start backend process${NC}"
echo -e "${YELLOW} • Make sure .NET 8 SDK is installed${NC}"
echo -e "${YELLOW} • Check that the API project exists and can build${NC}"
fi
wait_for_enter
}
do_start_frontend() {
# Pre-flight checks
if [[ ! -d "$CLIENT_DIR" ]]; then
echo -e "${RED}❌ Client directory not found: $CLIENT_DIR${NC}"
echo -e "${YELLOW} Make sure you're running this from the project root.${NC}"
wait_for_enter
return
fi
if [[ ! -f "$CLIENT_DIR/package.json" ]]; then
echo -e "${RED}❌ package.json not found in client directory${NC}"
echo -e "${YELLOW} Make sure the frontend project is properly set up.${NC}"
wait_for_enter
return
fi
if ! test_quick_dependency "node --version"; then
echo -e "${RED}❌ Node.js not found. Please run setup first.${NC}"
echo -e "${YELLOW} Option 1) Setup Dependencies${NC}"
wait_for_enter
return
fi
if ! test_quick_dependency "npm --version"; then
echo -e "${RED}❌ npm not found. Please run setup first.${NC}"
echo -e "${YELLOW} Option 1) Setup Dependencies${NC}"
wait_for_enter
return
fi
# Check if node_modules exists
if [[ ! -d "$CLIENT_DIR/node_modules" ]]; then
echo -e "${YELLOW}⚠️ node_modules not found. Running npm install first...${NC}"
if (cd "$CLIENT_DIR" && npm install); then
echo -e "${GREEN}✅ Dependencies installed${NC}"
else
echo -e "${RED}❌ Failed to install dependencies${NC}"
wait_for_enter
return
fi
fi
echo -e "${YELLOW}🚀 Starting Frontend...${NC}"
# Run npm from here with full path (avoid subshell so $! works)
npm --prefix "$CLIENT_DIR" run dev > client.log 2>&1 &
CLIENT_PID=$!
if [[ -n "$CLIENT_PID" ]]; then
echo -e "${GREEN}✓ Frontend process started (PID: $CLIENT_PID)${NC}"
# Wait for Vite to be ready (with timeout)
echo -e "${CYAN}⏳ Waiting for Vite to be ready...${NC}"
for i in {1..30}; do # Increased timeout to 30 seconds
if is_port_listening $CLIENT_PORT; then
echo -e "${GREEN}✅ Frontend is up and running on port $CLIENT_PORT!${NC}"
echo -e "${CYAN} Frontend URL: http://localhost:$CLIENT_PORT${NC}"
wait_for_enter
return
fi
# Show progress
if [[ $((i % 5)) -eq 0 ]]; then
echo -e "${CYAN} Still waiting... ($i/30 seconds)${NC}"
fi
sleep 1
done
echo -e "${YELLOW}⚠️ WARNING: Frontend may not have started within expected time.${NC}"
echo -e "${YELLOW} Check client.log for errors and consider:${NC}"
echo -e " • Running 'npm install' first${NC}"
echo -e " • Checking for missing Node.js dependencies${NC}"
echo -e " • Looking for build errors${NC}"
else
echo -e "${RED}❌ Failed to start frontend process${NC}"
echo -e "${YELLOW} • Make sure Node.js and npm are installed${NC}"
echo -e "${YELLOW} • Check that package.json exists and is valid${NC}"
echo -e "${YELLOW} • Try running 'npm install' in the client directory${NC}"
fi
wait_for_enter
}
do_stop_all() {
echo -e "${YELLOW}Stopping all services...${NC}"
# Kill by port is safer than PID tracking in a simple script
kill_port $API_PORT
kill_port $CLIENT_PORT
echo -e "${GREEN}Stopped.${NC}"
sleep 1
}
# Helper function to kill processes on a port with fallbacks
kill_port() {
local port=$1
# Try fuser first (Linux)
if command -v fuser >/dev/null 2>&1; then
fuser -k $port/tcp >/dev/null 2>&1 || true
# Try lsof + kill (macOS and Linux)
elif command -v lsof >/dev/null 2>&1; then
local pids=$(lsof -ti :$port 2>/dev/null)
if [[ -n "$pids" ]]; then
echo "$pids" | xargs -r kill -9 2>/dev/null || true
fi
# Try ss + kill (modern Linux without lsof)
elif command -v ss >/dev/null 2>&1; then
local pids=$(ss -tlnp 2>/dev/null | grep ":$port " | grep -oP 'pid=\K[0-9]+' | sort -u)
if [[ -n "$pids" ]]; then
echo "$pids" | xargs -r kill -9 2>/dev/null || true
fi
fi
}
do_view_logs() {
LOG_FILE=$1
NAME=$2
if [ ! -f "$LOG_FILE" ]; then
echo -e "${RED}Log file $LOG_FILE not found.${NC}"
wait_for_enter
return
fi
echo -e "${YELLOW}Viewing $NAME logs (Press Ctrl+C to return to menu)...${NC}"
echo ""
# Trap SIGINT to return to menu instead of exiting
trap 'echo ""; echo -e "${CYAN}Returning to menu...${NC}"; trap - INT; return 0' INT
# Use || true to prevent set -e from exiting on Ctrl+C
tail -f "$LOG_FILE" || true
# Restore default trap
trap - INT
}
do_open_browser() {
if ! is_port_listening $CLIENT_PORT; then
echo -e "${RED}Frontend is not running! Please start it first.${NC}"
wait_for_enter
return
fi
URL="http://localhost:$CLIENT_PORT"
echo -e "${GREEN}Opening $URL...${NC}"
if grep -qi microsoft /proc/version 2>/dev/null || grep -qi wsl /proc/version 2>/dev/null; then
# WSL - use Windows browser
cmd.exe /c start "$URL" 2>/dev/null || explorer.exe "$URL" 2>/dev/null || \
echo -e "${YELLOW}Could not open browser. Please open $URL manually.${NC}"
elif command -v open >/dev/null 2>&1; then
# macOS
open "$URL"
elif command -v xdg-open >/dev/null 2>&1; then
# Linux with desktop
xdg-open "$URL"
else
echo -e "${RED}Could not detect browser opener. Please open $URL manually.${NC}"
fi
wait_for_enter
}
do_test() {
echo -e "${YELLOW}Running Tests...${NC}"
dotnet test
wait_for_enter
}
do_clear_data() {
echo -e "${RED}${BOLD}⚠ WARNING: This will delete all data (Database & Generated Files)!${NC}"
read -p "Are you sure? (y/N): " confirm
if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then
echo "Cancelled."
wait_for_enter
return
fi
do_stop_all
echo "Deleting database..."
rm -f "$API_DIR/documentgenerator.db"
echo "Deleting generated documents..."
# Ensure directory exists before trying to empty it to avoid errors
if [ -d "$API_DIR/GeneratedDocuments" ]; then
rm -rf "$API_DIR/GeneratedDocuments"/*
fi
echo -e "${GREEN}Data cleared!${NC}"
wait_for_enter
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--skip-dependency-check)
export SKIP_DEPENDENCY_CHECK=1
shift
;;
--autofix)
export AUTO_FIX_DEPENDENCIES=1
shift
;;
-h|--help)
echo "Usage: $0 [options]"
echo "Options:"
echo " --skip-dependency-check Skip dependency checks"
echo " --autofix Auto-fix dependency issues"
echo " -h, --help Show this help"
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
exit 1
;;
esac
done
# Run proactive dependency check on startup
proactive_dependency_check
# Main Loop
while true; do
print_header
# Show Docker recommendation if dependencies have issues
if [[ "$DEPENDENCY_STATUS" -ne 0 ]]; then
echo -e "${YELLOW}[TIP] Having dependency issues? Try Docker setup (option 5) instead!${NC}"
echo ""
fi
echo -e "${BOLD}Services:${NC}"
echo " 1) 🚀 Start Backend"
echo " 2) 🌐 Start Frontend"
echo " 3) ⚡ Start Both Services"
echo " 4) 🛑 Stop All Services"
echo ""
echo -e "${BOLD}Setup & Dependencies:${NC}"
echo -e " 5) ${GREEN}🐳 Docker Quick Start${NC}"
echo " 6) 🔧 Native Setup"
echo " 7) 🔍 Check Dependencies"
echo ""
echo -e "${BOLD}Tools:${NC}"
echo " 8) 📄 View Backend Logs"
echo " 9) 📑 View Frontend Logs"
echo " 0) 🌍 Open App in Browser"
echo " t) 🧪 Run Tests"
echo " r) 🔄 Refresh Status"
echo " c) 🗑️ Clear All Data"
echo " q) 👋 Quit"
echo ""
read -p "Select an option: " option
case $option in
1)
do_start_backend
;;
2)
do_start_frontend
;;
3)
do_start_backend
do_start_frontend
;;
4)
do_stop_all
;;
5)
# Launch Docker quick start
docker_script="$SCRIPT_DIR/scripts/docker-quick-start.sh"
if [[ -f "$docker_script" ]]; then
chmod +x "$docker_script"
"$docker_script"
else
echo -e "${RED}[ERROR] Docker quick start script not found at: $docker_script${NC}"
echo -e "${YELLOW}You can run it manually: ./scripts/docker-quick-start.sh${NC}"
wait_for_enter
fi
;;
6)
do_setup
# Re-check dependencies after setup
proactive_dependency_check
;;
7)
dependency_checker="$SCRIPT_DIR/scripts/check-dependencies.sh"
if [[ -f "$dependency_checker" ]]; then
"$dependency_checker"
exit_code=$?
DEPENDENCY_STATUS=$((exit_code == 0 ? 0 : 1))
else
echo -e "${RED}❌ Dependency checker not found${NC}"
fi
wait_for_enter
;;
8)
do_view_logs "api.log" "Backend"
;;
9)
do_view_logs "client.log" "Frontend"
;;
0)
do_open_browser
;;
t|T)
do_test
;;
r|R)
# Just loop to refresh
;;
c|C)
do_clear_data
;;
q|Q)
echo -e "${GREEN}👋 Goodbye!${NC}"
exit 0
;;
*)
echo -e "${RED}❌ Invalid option. Please select 0-9, t, r, c, or q.${NC}"
sleep 1
;;
esac
done