-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·677 lines (586 loc) · 20 KB
/
install.sh
File metadata and controls
executable file
·677 lines (586 loc) · 20 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
#!/bin/bash
# This script sets up the schedule management reminder system for macOS and Linux
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Script configuration
SCRIPT_NAME="Schedule Management Installer"
PYTHON_VERSION="3.12"
# VENV_NAME="schedule_management_env"
INSTALL_DIR="$HOME/SCHEDULE_MANAGEMENT"
INSTALL_CONFIG_DIR="$HOME/.schedule_management/config"
INSTALL_ACTIVE_CONFIG_ID="0"
INSTALL_ACTIVE_CONFIG_DIR="$INSTALL_CONFIG_DIR/user_config_${INSTALL_ACTIVE_CONFIG_ID}"
INSTALL_ACTIVE_CONFIG_FILE="$INSTALL_CONFIG_DIR/.active_config"
LAUNCH_AGENT_NAME="com.sergiudm.schedule.management.reminder"
LAUNCH_AGENT_PLIST="$HOME/Library/LaunchAgents/${LAUNCH_AGENT_NAME}.plist"
SYSTEMD_SERVICE_NAME="schedule-management.service"
SYSTEMD_SERVICE_PATH="$HOME/.config/systemd/user/${SYSTEMD_SERVICE_NAME}"
# Detect OS
detect_os() {
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "macos"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "linux"
else
echo "unknown"
fi
}
OS_TYPE=$(detect_os)
# Logging functions
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
has_legacy_config_files() {
local legacy_files=(
"ddl.json"
"even_weeks.toml"
"habits.toml"
"habits_template.toml"
"odd_weeks.toml"
"profile.md"
"settings.toml"
"settings_template.toml"
"week_schedule_template.toml"
)
local file_name
for file_name in "${legacy_files[@]}"; do
if [[ -e "$INSTALL_CONFIG_DIR/$file_name" ]]; then
return 0
fi
done
return 1
}
has_versioned_config_dirs() {
compgen -G "$INSTALL_CONFIG_DIR/user_config_*" > /dev/null
}
resolve_install_target_config_dir() {
if [[ -f "$INSTALL_ACTIVE_CONFIG_FILE" ]]; then
local active_id
active_id="$(tr -d '[:space:]' < "$INSTALL_ACTIVE_CONFIG_FILE")"
if [[ "$active_id" =~ ^[0-9]+$ ]] && [[ -d "$INSTALL_CONFIG_DIR/user_config_${active_id}" ]]; then
echo "$INSTALL_CONFIG_DIR/user_config_${active_id}"
return 0
fi
fi
if has_legacy_config_files; then
echo "$INSTALL_CONFIG_DIR"
return 0
fi
echo "$INSTALL_ACTIVE_CONFIG_DIR"
}
scaffold_versioned_config_root() {
log_info "Scaffolding versioned config layout in $INSTALL_CONFIG_DIR"
mkdir -p "$INSTALL_ACTIVE_CONFIG_DIR"
mkdir -p "$INSTALL_CONFIG_DIR/tasks"
printf '%s\n' "$INSTALL_ACTIVE_CONFIG_ID" > "$INSTALL_ACTIVE_CONFIG_FILE"
if [[ -d "$SCRIPT_DIR/config" ]]; then
local source_path
for source_path in "$SCRIPT_DIR"/config/*; do
local base_name
base_name="$(basename "$source_path")"
if [[ "$base_name" == "llm.toml" ]]; then
continue
fi
if [[ -f "$source_path" ]]; then
cp "$source_path" "$INSTALL_ACTIVE_CONFIG_DIR/$base_name"
fi
done
log_success "Initial config files copied to $INSTALL_ACTIVE_CONFIG_DIR"
else
log_warning "config/ directory not found in project. Created empty versioned config layout at $INSTALL_CONFIG_DIR."
fi
log_success "Active config marker created at $INSTALL_ACTIVE_CONFIG_FILE"
}
# Check OS compatibility
check_os() {
if [[ "$OS_TYPE" == "unknown" ]]; then
log_error "Unsupported operating system: $OSTYPE"
log_info "Supported systems: macOS (darwin) and Linux (linux-gnu)"
exit 1
fi
log_success "$OS_TYPE detected"
}
# Get Linux distribution info
get_linux_distro() {
if [[ -f /etc/os-release ]]; then
. /etc/os-release
echo "$ID"
else
echo "unknown"
fi
}
# Install package manager dependencies for Linux
install_linux_dependencies() {
log_info "Installing Linux dependencies..."
DISTRO=$(get_linux_distro)
log_info "Detected Linux distribution: $DISTRO"
case "$DISTRO" in
ubuntu|debian)
sudo apt update
sudo apt install -y curl build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev libncursesw5-dev \
xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
;;
fedora)
sudo dnf install -y curl gcc zlib-devel bzip2 bzip2-devel \
readline-devel sqlite sqlite-devel openssl-devel xz xz-devel \
libffi-devel findutils
;;
arch|manjaro)
sudo pacman -S --needed curl base-devel openssl zlib xz
;;
*)
log_warning "Unknown distribution: $DISTRO. Please install dependencies manually:"
log_info "Required: curl, build tools, Python development headers, OpenSSL"
;;
esac
log_success "Linux dependencies installed"
}
# Check if Homebrew is installed (macOS only)
check_homebrew() {
if [[ "$OS_TYPE" != "macos" ]]; then
return 0
fi
if ! command -v brew &> /dev/null; then
log_warning "Homebrew not found. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [[ ":$PATH:" != *":/opt/homebrew/bin:"* ]]; then
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
else
log_success "Homebrew is already installed"
fi
}
# Install uv package manager
install_uv() {
log_info "Checking uv installation..."
if ! command -v uv &> /dev/null; then
log_info "uv not found. Installing uv..."
if [[ "$OS_TYPE" == "macos" ]]; then
brew install uv
elif [[ "$OS_TYPE" == "linux" ]]; then
# Install uv using the official installer
curl -LsSf https://astral.sh/uv/install.sh | sh
# Add to PATH
export PATH="$HOME/.cargo/bin:$PATH"
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
fi
log_success "uv installed successfully"
else
log_success "uv is already installed"
fi
if ! uv --version &> /dev/null; then
log_error "uv installation verification failed"
exit 1
fi
}
# Install Python (platform-specific)
install_python() {
log_info "Setting up Python $PYTHON_VERSION..."
if [[ "$OS_TYPE" == "macos" ]]; then
# macOS: use pyenv
if ! command -v pyenv &> /dev/null; then
log_info "Installing pyenv..."
brew install pyenv
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
eval "$(pyenv init -)"
fi
if ! pyenv versions --bare | grep -q "^$PYTHON_VERSION$"; then
log_info "Installing Python $PYTHON_VERSION..."
pyenv install "$PYTHON_VERSION"
fi
pyenv local "$PYTHON_VERSION"
elif [[ "$OS_TYPE" == "linux" ]]; then
# Linux: use system Python or pyenv
if command -v "python${PYTHON_VERSION}" &> /dev/null; then
log_success "Python $PYTHON_VERSION found in system"
else
log_info "Installing Python $PYTHON_VERSION using pyenv..."
if ! command -v pyenv &> /dev/null; then
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
fi
if ! pyenv versions --bare | grep -q "^$PYTHON_VERSION$"; then
pyenv install "$PYTHON_VERSION"
fi
pyenv local "$PYTHON_VERSION"
fi
fi
log_success "Python $PYTHON_VERSION is ready"
}
# Setup project directory (preserve src layout!)
setup_project() {
log_info "Setting up project directory..."
if [[ -d "$INSTALL_DIR" ]]; then
log_warning "Installation directory exists at $INSTALL_DIR"
while true; do
read -r -p "Replace existing installation with new files? [y/N]: " replace_existing
case "$replace_existing" in
[yY]|[yY][eE][sS])
log_info "Replacing existing installation directory..."
rm -rf "$INSTALL_DIR"
break
;;
[nN]|[nN][oO]|"")
backup_path="${INSTALL_DIR}.backup.$(date +%Y%m%d_%H%M%S)"
log_info "Backing up existing installation to $backup_path"
mv "$INSTALL_DIR" "$backup_path"
break
;;
*)
log_warning "Invalid input. Please answer with y or n."
;;
esac
done
fi
mkdir -p "$INSTALL_DIR"
if [[ -d "src" ]]; then
cp -r src "$INSTALL_DIR/"
log_success "src/ directory copied (preserving layout)"
else
log_error "src/ directory not found in current working directory!"
exit 1
fi
# Copy build metadata files needed by editable installs.
for file in LICENSE pyproject.toml README.md uv.lock requirements.txt requirements-test.txt; do
if [[ -f "$file" ]]; then
cp "$file" "$INSTALL_DIR/"
log_success "$file copied"
fi
done
# Config directory handling
mkdir -p "$(dirname "$INSTALL_CONFIG_DIR")"
if [[ -d "$INSTALL_CONFIG_DIR" ]]; then
# If config root already exists, preserve it unless it is still empty.
if has_legacy_config_files || has_versioned_config_dirs || [[ -f "$INSTALL_ACTIVE_CONFIG_FILE" ]]; then
log_warning "Config directory $INSTALL_CONFIG_DIR already exists; skipping config copy."
else
scaffold_versioned_config_root
fi
else
mkdir -p "$INSTALL_CONFIG_DIR"
scaffold_versioned_config_root
fi
# Create logs directory
mkdir -p "$INSTALL_DIR/logs"
log_success "Project directory setup complete"
}
# Create virtual environment
create_venv() {
log_info "Creating virtual environment with uv..."
uv venv --python=3.12 --clear "$INSTALL_DIR/.venv"
if [[ -f "$INSTALL_DIR/.venv/bin/activate" ]]; then
source "$INSTALL_DIR/.venv/bin/activate"
log_success "Virtual environment created and activated with uv"
else
log_error "Virtual environment creation failed"
exit 1
fi
}
# Install dependencies and package
install_dependencies() {
log_info "Installing dependencies and package..."
cd "$INSTALL_DIR"
# Upgrade pip
uv pip install --upgrade pip
# Install from requirements if available
if [[ -f "requirements.txt" ]]; then
uv pip install -r requirements.txt
fi
if [[ -f "requirements-test.txt" ]]; then
uv pip install -r requirements-test.txt
fi
# Install editable package (supports src layout)
uv pip install -e .
if ! command -v rmd &> /dev/null; then
log_warning "CLI 'rmd' not in PATH, but should work via venv"
else
log_success "CLI tool 'rmd' is available"
fi
cd - > /dev/null
}
# Validate and complete missing configuration values
configure_configs() {
log_info "Checking configuration files and required values..."
local wizard_script="$INSTALL_DIR/src/schedule_management/install_config_wizard.py"
local template_dir="$SCRIPT_DIR/config"
local target_config_dir
target_config_dir="$(resolve_install_target_config_dir)"
if [[ ! -f "$wizard_script" ]]; then
log_error "Config wizard not found: $wizard_script"
exit 1
fi
if [[ -d "$template_dir" ]]; then
"$INSTALL_DIR/.venv/bin/python" "$wizard_script" \
--config-dir "$target_config_dir" \
--template-dir "$template_dir"
else
log_warning "Template directory not found at $template_dir; using config directory as template source."
"$INSTALL_DIR/.venv/bin/python" "$wizard_script" \
--config-dir "$target_config_dir"
fi
log_info "Validated active config directory: $target_config_dir"
log_success "Configuration checks complete"
}
# Create systemd service (Linux only)
create_systemd_service() {
if [[ "$OS_TYPE" != "linux" ]]; then
return 0
fi
log_info "Creating systemd service..."
mkdir -p "$HOME/.config/systemd/user"
cat > "$SYSTEMD_SERVICE_PATH" << EOF
[Unit]
Description=Schedule Management Reminder
After=graphical-session.target
[Service]
Type=simple
ExecStart=$INSTALL_DIR/.venv/bin/python $INSTALL_DIR/src/schedule_management/reminder_macos.py
Restart=always
RestartSec=10
Environment=DISPLAY=:0
Environment=REMINDER_CONFIG_DIR=$INSTALL_CONFIG_DIR
StandardOutput=$INSTALL_DIR/logs/schedule_management.out
StandardError=$INSTALL_DIR/logs/schedule_management.err
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable "$SYSTEMD_SERVICE_NAME"
log_success "systemd service created and enabled"
}
# Create LaunchAgent plist (macOS only)
create_launch_agent() {
if [[ "$OS_TYPE" != "macos" ]]; then
return 0
fi
log_info "Creating LaunchAgent..."
mkdir -p "$HOME/Library/LaunchAgents"
cat > "$LAUNCH_AGENT_PLIST" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>${LAUNCH_AGENT_NAME}</string>
<key>ProgramArguments</key>
<array>
<string>$INSTALL_DIR/.venv/bin/python</string>
<string>$INSTALL_DIR/src/schedule_management/reminder_macos.py</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>$INSTALL_DIR/logs/schedule_management.out</string>
<key>StandardErrorPath</key>
<string>$INSTALL_DIR/logs/schedule_management.err</string>
<key>WorkingDirectory</key>
<string>$INSTALL_DIR</string>
<key>EnvironmentVariables</key>
<dict>
<key>REMINDER_CONFIG_DIR</key>
<string>$INSTALL_CONFIG_DIR</string>
</dict>
</dict>
</plist>
EOF
log_success "LaunchAgent created at $LAUNCH_AGENT_PLIST"
}
# Request permissions (platform-specific)
request_permissions() {
if [[ "$OS_TYPE" == "macos" ]]; then
log_info "The app will request Accessibility & Notification permissions on first run."
elif [[ "$OS_TYPE" == "linux" ]]; then
log_info "The app will use desktop notifications. Ensure notification daemon is running."
fi
}
# Create convenience scripts (platform-specific)
create_scripts() {
log_info "Creating convenience scripts..."
# Start script (common)
cat > "$INSTALL_DIR/start_reminders.sh" << EOF
#!/bin/bash
export REMINDER_CONFIG_DIR="$INSTALL_CONFIG_DIR"
source "$INSTALL_DIR/.venv/bin/activate"
cd "$INSTALL_DIR/src/schedule_management"
exec python reminder_macos.py
EOF
# Stop script (platform-specific)
if [[ "$OS_TYPE" == "macos" ]]; then
cat > "$INSTALL_DIR/stop_reminders.sh" << EOF
#!/bin/bash
launchctl unload "\$HOME/Library/LaunchAgents/com.sergiudm.schedule.management.reminder.plist" 2>/dev/null || true
pkill -f "python.*reminder_macos.py" 2>/dev/null || true
EOF
elif [[ "$OS_TYPE" == "linux" ]]; then
cat > "$INSTALL_DIR/stop_reminders.sh" << EOF
#!/bin/bash
systemctl --user stop schedule-management.service 2>/dev/null || true
systemctl --user disable schedule-management.service 2>/dev/null || true
pkill -f "python.*reminder_macos.py" 2>/dev/null || true
EOF
fi
# Restart script (platform-specific)
if [[ "$OS_TYPE" == "macos" ]]; then
cat > "$INSTALL_DIR/restart_reminders.sh" << EOF
#!/bin/bash
"$INSTALL_DIR/stop_reminders.sh"
sleep 2
launchctl load "\$HOME/Library/LaunchAgents/com.sergiudm.schedule.management.reminder.plist"
EOF
elif [[ "$OS_TYPE" == "linux" ]]; then
cat > "$INSTALL_DIR/restart_reminders.sh" << EOF
#!/bin/bash
"$INSTALL_DIR/stop_reminders.sh"
sleep 2
systemctl --user start schedule-management.service
EOF
fi
# Visualize script (common)
cat > "$INSTALL_DIR/visualize_schedule.sh" << EOF
#!/bin/bash
export REMINDER_CONFIG_DIR="$INSTALL_CONFIG_DIR"
source "$INSTALL_DIR/.venv/bin/activate"
cd "$INSTALL_DIR/src/schedule_management"
exec python reminder_macos.py --visualize
EOF
# Primary CLI wrapper (common)
cat > "$INSTALL_DIR/rmd" << EOF
#!/bin/bash
export REMINDER_CONFIG_DIR="$INSTALL_CONFIG_DIR"
source "$INSTALL_DIR/.venv/bin/activate"
exec rmd "\$@"
EOF
# Legacy compatibility wrapper
cat > "$INSTALL_DIR/reminder" << EOF
#!/bin/bash
export REMINDER_CONFIG_DIR="$INSTALL_CONFIG_DIR"
source "$INSTALL_DIR/.venv/bin/activate"
exec rmd "\$@"
EOF
chmod +x "$INSTALL_DIR"/*.sh "$INSTALL_DIR/rmd" "$INSTALL_DIR/reminder"
log_success "Convenience scripts created"
}
# Test installation
test_installation() {
log_info "Testing installation..."
source "$INSTALL_DIR/.venv/bin/activate"
export REMINDER_CONFIG_DIR="$INSTALL_CONFIG_DIR"
if python -c "import schedule_management; print('OK')" &>/dev/null; then
log_success "schedule_management import test passed"
else
log_error "Failed to import schedule_management"
exit 1
fi
if rmd --help &>/dev/null; then
log_success "CLI 'rmd' works correctly"
else
log_error "CLI 'rmd' failed"
exit 1
fi
log_success "All tests passed"
}
# Display usage (platform-specific)
display_usage() {
log_info "Installation completed successfully!"
echo
echo "=== Usage ==="
echo "Add to PATH (optional):"
if [[ "$OS_TYPE" == "macos" ]]; then
echo " echo 'export PATH=\"\$PATH:$INSTALL_DIR\"' >> ~/.zshrc"
elif [[ "$OS_TYPE" == "linux" ]]; then
echo " echo 'export PATH=\"\$PATH:$INSTALL_DIR\"' >> ~/.bashrc"
fi
echo
echo "Manual control:"
echo " $INSTALL_DIR/start_reminders.sh"
echo " $INSTALL_DIR/stop_reminders.sh"
echo
if [[ "$OS_TYPE" == "macos" ]]; then
echo "LaunchAgent:"
echo " launchctl load $LAUNCH_AGENT_PLIST # Enable auto-start"
echo " launchctl unload $LAUNCH_AGENT_PLIST # Disable"
elif [[ "$OS_TYPE" == "linux" ]]; then
echo "systemd service:"
echo " systemctl --user start $SYSTEMD_SERVICE_NAME # Start service"
echo " systemctl --user stop $SYSTEMD_SERVICE_NAME # Stop service"
echo " systemctl --user enable $SYSTEMD_SERVICE_NAME # Enable auto-start"
echo " systemctl --user disable $SYSTEMD_SERVICE_NAME # Disable auto-start"
echo " systemctl --user status $SYSTEMD_SERVICE_NAME # Check status"
fi
echo
echo "Logs: $INSTALL_DIR/logs/"
echo
if [[ "$OS_TYPE" == "macos" ]]; then
log_warning "First run will prompt for Accessibility permissions in System Settings."
elif [[ "$OS_TYPE" == "linux" ]]; then
log_info "First run will use desktop notifications. Ensure notification daemon is running."
fi
}
# Cleanup
cleanup() {
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
deactivate 2>/dev/null || true
fi
}
# Main
main() {
echo "=== $SCRIPT_NAME ==="
trap cleanup EXIT
check_os
if [[ "$OS_TYPE" == "linux" ]]; then
install_linux_dependencies
fi
check_homebrew
install_uv
# install_python
setup_project
create_venv
configure_configs
install_dependencies
if [[ "$OS_TYPE" == "macos" ]]; then
create_launch_agent
elif [[ "$OS_TYPE" == "linux" ]]; then
create_systemd_service
fi
request_permissions
create_scripts
test_installation
display_usage
log_success "Installation complete! 🎉"
}
# Parse args (minimal)
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
echo "Usage: $0"
exit 0
;;
*)
log_error "Unknown option: $1"
exit 1
;;
esac
done
main