-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·655 lines (571 loc) · 21.6 KB
/
setup.sh
File metadata and controls
executable file
·655 lines (571 loc) · 21.6 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
#!/bin/sh
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m'
INSTALL_DIR="$HOME/.local/bin/ms"
MAGIC_DIR="$HOME/.local/share/magicscripts"
TEMP_DIR="$HOME/.cache/magicscripts-$$"
# Configurable branch/URL for development testing
# Usage: MS_INSTALL_BRANCH=develop sh setup.sh
BRANCH="${MS_INSTALL_BRANCH:-main}"
RAW_URL="https://raw.githubusercontent.com/magic-scripts/ms/${BRANCH}"
# URLs
REPO_URL="https://github.com/magic-scripts/ms"
REGISTRY_URL="$RAW_URL/registry/ms.msreg"
# Version parameters
REQUESTED_VERSION=""
check_command() {
command -v "$1" >/dev/null 2>&1
}
cleanup() {
rm -rf "$TEMP_DIR" 2>/dev/null || true
}
trap cleanup EXIT INT TERM
verify_url() {
local url="$1"
if check_command curl; then
curl -fsSI "$url" > /dev/null 2>/dev/null
elif check_command wget; then
wget -q --spider "$url" 2>/dev/null
else
return 1
fi
}
download_file() {
local url="$1"
local output="$2"
# URL security validation
case "$url" in
https://*) ;; # HTTPS OK
*) echo "${RED}Error: Only HTTPS URLs are allowed${NC}"; return 1 ;;
esac
local domain=$(echo "$url" | sed 's|https://||' | cut -d'/' -f1 | cut -d':' -f1)
case "$domain" in
localhost|127.0.0.1|0.0.0.0|::1) echo "${RED}Error: Internal URLs are not allowed${NC}"; return 1 ;;
esac
case "$domain" in
10.*|172.1[6-9].*|172.2[0-9].*|172.3[01].*|192.168.*) echo "${RED}Error: Private network URLs are not allowed${NC}"; return 1 ;;
esac
# Create directory if it doesn't exist
mkdir -p "$(dirname "$output")"
if check_command curl; then
# Use output redirection to avoid curl write issues
curl -fsSL "$url" > "$output"
elif check_command wget; then
wget -q "$url" -O "$output"
else
echo "${RED}Error: curl or wget is required${NC}"
exit 1
fi
}
# Semantic version comparison (returns 0 if v1 > v2, 1 if v1 < v2, 2 if v1 == v2)
compare_versions() {
local v1="$1"
local v2="$2"
# Handle dev versions
if [ "$v1" = "dev" ] && [ "$v2" != "dev" ]; then
return 1 # dev is lower than release versions
elif [ "$v1" != "dev" ] && [ "$v2" = "dev" ]; then
return 0 # release is higher than dev
elif [ "$v1" = "dev" ] && [ "$v2" = "dev" ]; then
return 2 # equal
fi
# Parse semantic versions
local v1_major=$(echo "$v1" | cut -d'.' -f1)
local v1_minor=$(echo "$v1" | cut -d'.' -f2)
local v1_patch=$(echo "$v1" | cut -d'.' -f3)
local v2_major=$(echo "$v2" | cut -d'.' -f1)
local v2_minor=$(echo "$v2" | cut -d'.' -f2)
local v2_patch=$(echo "$v2" | cut -d'.' -f3)
# Compare major
if [ "$v1_major" -gt "$v2_major" ]; then return 0; fi
if [ "$v1_major" -lt "$v2_major" ]; then return 1; fi
# Compare minor
if [ "$v1_minor" -gt "$v2_minor" ]; then return 0; fi
if [ "$v1_minor" -lt "$v2_minor" ]; then return 1; fi
# Compare patch
if [ "$v1_patch" -gt "$v2_patch" ]; then return 0; fi
if [ "$v1_patch" -lt "$v2_patch" ]; then return 1; fi
return 2 # equal
}
# Find best version from registry
find_best_ms_version() {
local temp_registry="$TEMP_DIR/ms.msreg"
local best_version=""
local best_url=""
local best_checksum=""
local best_install_script=""
local best_uninstall_script=""
local dev_version=""
local dev_url=""
local dev_checksum=""
local dev_install_script=""
local dev_uninstall_script=""
# Download registry
if ! download_file "$REGISTRY_URL" "$temp_registry"; then
echo "${RED}Error: Cannot download registry from $REGISTRY_URL${NC}"
exit 1
fi
# Parse registry for ms command - 3-tier system (msreg -> mspack -> msver)
# Format: name|mspack_url|description|category
while IFS='|' read -r name package_url desc category; do
[ "$name" = "ms" ] || continue
# Download package file (could be .mspack or legacy .msver)
local temp_package="$TEMP_DIR/ms_package_$$.txt"
if ! download_file "$package_url" "$temp_package"; then
echo "${RED}Error: Cannot download package file from $package_url${NC}"
exit 1
fi
# Detect 3-tier: check for msver_url| line in downloaded file
local actual_msver_url=""
actual_msver_url=$(grep "^msver_url|" "$temp_package" 2>/dev/null | head -1 | cut -d'|' -f2)
local temp_msver="$TEMP_DIR/ms_msver_$$.txt"
if [ -n "$actual_msver_url" ]; then
# 3-tier: download actual .msver from mspack's msver_url pointer
if ! download_file "$actual_msver_url" "$temp_msver"; then
echo "${RED}Error: Cannot download ms.msver from $actual_msver_url${NC}"
exit 1
fi
else
# Legacy 2-tier: package_url pointed directly to .msver
cp "$temp_package" "$temp_msver"
fi
rm -f "$temp_package"
# Parse version information from .msver file
while IFS='|' read -r entry_type version url checksum install_script uninstall_script update_script man_url install_cs uninstall_cs update_cs; do
[ "$entry_type" = "version" ] || continue
# If specific version requested, match exactly
if [ -n "$REQUESTED_VERSION" ]; then
if [ "$version" = "$REQUESTED_VERSION" ]; then
echo "$version|$url|$checksum|$install_script|$uninstall_script|$update_script|$man_url|$install_cs|$uninstall_cs|$update_cs"
rm -f "$temp_msver"
return 0
fi
continue
fi
# Store dev version separately
if [ "$version" = "dev" ]; then
dev_version="$version"
dev_url="$url"
dev_checksum="$checksum"
dev_install_script="$install_script"
dev_uninstall_script="$uninstall_script"
dev_update_script="$update_script"
dev_man_url="$man_url"
dev_install_cs="$install_cs"
dev_uninstall_cs="$uninstall_cs"
dev_update_cs="$update_cs"
# Skip dev versions unless explicitly allowed
fi
# Find highest version (skip dev in version comparison)
if [ "$version" != "dev" ]; then
if [ -z "$best_version" ]; then
best_version="$version"
best_url="$url"
best_checksum="$checksum"
best_install_script="$install_script"
best_uninstall_script="$uninstall_script"
best_update_script="$update_script"
best_man_url="$man_url"
best_install_cs="$install_cs"
best_uninstall_cs="$uninstall_cs"
best_update_cs="$update_cs"
else
if compare_versions "$version" "$best_version"; then
best_version="$version"
best_url="$url"
best_checksum="$checksum"
best_install_script="$install_script"
best_uninstall_script="$uninstall_script"
best_update_script="$update_script"
best_man_url="$man_url"
best_install_cs="$install_cs"
best_uninstall_cs="$uninstall_cs"
best_update_cs="$update_cs"
fi
fi
else
# Dev version - can be used if requested or as fallback
if [ -z "$best_version" ]; then
best_version="$version"
best_url="$url"
best_checksum="$checksum"
best_install_script="$install_script"
best_uninstall_script="$uninstall_script"
best_update_script="$update_script"
best_man_url="$man_url"
best_install_cs="$install_cs"
best_uninstall_cs="$uninstall_cs"
best_update_cs="$update_cs"
fi
fi
done < "$temp_msver"
rm -f "$temp_msver"
break # We found ms command, no need to continue
done < "$temp_registry"
# If no suitable version found but dev version exists, use dev
if [ -z "$best_version" ] && [ -n "$dev_version" ]; then
echo "$dev_version|$dev_url|$dev_checksum|$dev_install_script|$dev_uninstall_script|$dev_update_script|$dev_man_url|$dev_install_cs|$dev_uninstall_cs|$dev_update_cs"
return 0
fi
if [ -z "$best_version" ]; then
if [ -n "$REQUESTED_VERSION" ]; then
echo "${RED}Error: Version $REQUESTED_VERSION not found${NC}"
else
echo "${RED}Error: No suitable version found${NC}"
fi
exit 1
fi
echo "$best_version|$best_url|$best_checksum|$best_install_script|$best_uninstall_script|$best_update_script|$best_man_url|$best_install_cs|$best_uninstall_cs|$best_update_cs"
}
update_shell_config() {
local shell_config="$1"
local path_line='export PATH="$HOME/.local/bin/ms:$PATH"'
local manpath_line='export MANPATH="$HOME/.local/share/man:$MANPATH"'
# Check if already exists with proper installer comment
if grep -q "# Magic Scripts - added by installer" "$shell_config" 2>/dev/null && \
grep -q "export PATH.*\.local/bin/ms" "$shell_config" 2>/dev/null; then
echo "${GREEN}PATH configuration already exists in $shell_config${NC}"
# Check if MANPATH needs to be added
if ! grep -q "export MANPATH.*\.local/share/man" "$shell_config" 2>/dev/null; then
echo "$manpath_line" >> "$shell_config"
echo "${GREEN}Added MANPATH configuration to $shell_config${NC}"
return 0
fi
return 1
fi
# If PATH exists but without proper installer comment, remove it first
if grep -q "export PATH.*\.local/bin/ms" "$shell_config" 2>/dev/null; then
echo "${YELLOW}Found existing PATH configuration without installer comment, updating...${NC}"
# Remove existing line
grep -v "export PATH.*\.local/bin/ms" "$shell_config" > "$shell_config.tmp"
mv "$shell_config.tmp" "$shell_config"
fi
# Add configuration
echo "" >> "$shell_config"
echo "# Magic Scripts - added by installer" >> "$shell_config"
echo "$path_line" >> "$shell_config"
echo "$manpath_line" >> "$shell_config"
echo "${GREEN}Added PATH and MANPATH configuration to $shell_config${NC}"
return 0
}
show_help() {
echo "Magic Scripts Installer"
echo ""
echo "Usage:"
echo " install.sh [OPTIONS]"
echo ""
echo "Options:"
echo " -v, --version VERSION Install specific version (e.g., 0.0.1, 0.0.2, dev)"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " install.sh # Install latest stable version"
echo " install.sh -v 0.0.1 # Install specific version"
echo " install.sh -v dev # Install dev version"
echo ""
}
# Parse command line arguments
while [ $# -gt 0 ]; do
case "$1" in
-v|--version)
if [ -z "$2" ]; then
echo "${RED}Error: -v requires a version argument${NC}"
echo "Usage: setup.sh -v <version>"
exit 1
fi
REQUESTED_VERSION="$2"
shift 2
;;
-h|--help)
show_help
exit 0
;;
*)
echo "${RED}Unknown option: $1${NC}"
show_help
exit 1
;;
esac
done
echo "========================================="
echo " Magic Scripts Setup v0.0.1 "
echo " Developer Automation Tools "
echo "========================================="
echo ""
# Verify registry is accessible
echo "Verifying registry access..."
if ! verify_url "$REGISTRY_URL"; then
echo "${RED}Error: Cannot access Magic Scripts registry${NC}"
echo ""
echo "Please check:"
echo " 1. Repository exists at: $REPO_URL"
echo " 2. Registry file is available at: $REGISTRY_URL"
echo " 3. Repository is public or you have access"
echo ""
exit 1
fi
echo "${GREEN}✓ Registry accessible${NC}"
# Find best version to install
echo ""
echo "Determining version to install..."
if [ -n "$REQUESTED_VERSION" ]; then
echo "Requested version: $REQUESTED_VERSION"
else
echo "Finding latest stable version..."
fi
version_info=$(find_best_ms_version)
MS_VERSION=$(echo "$version_info" | cut -d'|' -f1)
MS_URL=$(echo "$version_info" | cut -d'|' -f2)
MS_CHECKSUM=$(echo "$version_info" | cut -d'|' -f3)
MS_INSTALL_SCRIPT=$(echo "$version_info" | cut -d'|' -f4)
MS_UNINSTALL_SCRIPT=$(echo "$version_info" | cut -d'|' -f5)
MS_UPDATE_SCRIPT=$(echo "$version_info" | cut -d'|' -f6)
MS_MAN_URL=$(echo "$version_info" | cut -d'|' -f7)
MS_INSTALL_CHECKSUM=$(echo "$version_info" | cut -d'|' -f8)
MS_UNINSTALL_CHECKSUM=$(echo "$version_info" | cut -d'|' -f9)
MS_UPDATE_CHECKSUM=$(echo "$version_info" | cut -d'|' -f10)
echo "${GREEN}Selected version: $MS_VERSION${NC}"
echo ""
# Check for existing installation
if [ -f "$HOME/.local/bin/ms/ms" ]; then
echo "${YELLOW}Existing Magic Scripts installation detected.${NC}"
echo "This will update the existing installation."
echo ""
fi
echo "Creating installation directories..."
mkdir -p "$INSTALL_DIR"
mkdir -p "$MAGIC_DIR"
mkdir -p "$TEMP_DIR"
# Direct installation for ms bootstrap (setup script)
echo "Installing Magic Scripts core system..."
mkdir -p "$MAGIC_DIR/core"
mkdir -p "$MAGIC_DIR/scripts"
# Download core files (version-independent)
printf " Downloading config.sh... "
if download_file "$RAW_URL/core/config.sh" "$MAGIC_DIR/core/config.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
echo ""
echo "${RED}Error: Failed to download core configuration file${NC}"
exit 1
fi
printf " Downloading registry.sh... "
if download_file "$RAW_URL/core/registry.sh" "$MAGIC_DIR/core/registry.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
printf " Downloading metadata.sh... "
if download_file "$RAW_URL/core/metadata.sh" "$MAGIC_DIR/core/metadata.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
printf " Downloading version.sh... "
if download_file "$RAW_URL/core/version.sh" "$MAGIC_DIR/core/version.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
printf " Downloading pack.sh... "
if download_file "$RAW_URL/core/pack.sh" "$MAGIC_DIR/core/pack.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
printf " Downloading utils.sh... "
if download_file "$RAW_URL/core/utils.sh" "$MAGIC_DIR/core/utils.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
# Download lib modules
mkdir -p "$MAGIC_DIR/lib"
printf " Downloading lib/install.sh... "
if download_file "$RAW_URL/lib/install.sh" "$MAGIC_DIR/lib/install.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
printf " Downloading lib/uninstall.sh... "
if download_file "$RAW_URL/lib/uninstall.sh" "$MAGIC_DIR/lib/uninstall.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
printf " Downloading lib/update.sh... "
if download_file "$RAW_URL/lib/update.sh" "$MAGIC_DIR/lib/update.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
printf " Downloading lib/query.sh... "
if download_file "$RAW_URL/lib/query.sh" "$MAGIC_DIR/lib/query.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
printf " Downloading lib/maintenance.sh... "
if download_file "$RAW_URL/lib/maintenance.sh" "$MAGIC_DIR/lib/maintenance.sh"; then
printf "${GREEN}done${NC}\n"
else
printf "${RED}failed${NC}\n"
exit 1
fi
# Registry system will be initialized automatically by ms.sh
# No need to download registry files during installation
if [ "$MS_VERSION" = "dev" ]; then
printf " Downloading ms.sh ($MS_VERSION)... "
else
printf " Downloading ms.sh (v$MS_VERSION)... "
fi
if download_file "$MS_URL" "$MAGIC_DIR/scripts/ms.sh"; then
chmod 755 "$MAGIC_DIR/scripts/ms.sh"
printf "${GREEN}done${NC}\n"
# Verify checksum if not dev version
if [ "$MS_VERSION" != "dev" ] && [ "$MS_CHECKSUM" != "dev" ]; then
echo " Verifying checksum..."
actual_checksum=$(shasum -a 256 "$MAGIC_DIR/scripts/ms.sh" 2>/dev/null | cut -d' ' -f1 | cut -c1-8 || echo "unknown")
if [ "$actual_checksum" != "$MS_CHECKSUM" ]; then
echo "${RED} Error: Checksum mismatch (expected: $MS_CHECKSUM, got: $actual_checksum)${NC}"
echo "${RED} Installation aborted. The downloaded file may be corrupted or tampered.${NC}"
rm -f "$MAGIC_DIR/scripts/ms.sh"
exit 1
else
echo "${GREEN} ✓ Checksum verified${NC}"
fi
fi
else
printf "${RED}failed${NC}\n"
echo ""
echo "${RED}Error: Failed to download ms.sh from $MS_URL${NC}"
exit 1
fi
echo ""
echo "Installing Magic Scripts commands..."
printf " Installing ms... "
cat > "$INSTALL_DIR/ms" << EOF
#!/bin/sh
MAGIC_SCRIPT_DIR="$MAGIC_DIR"
exec "\$MAGIC_SCRIPT_DIR/scripts/ms.sh" "\$@"
EOF
chmod 755 "$INSTALL_DIR/ms"
# Create metadata directory and file for ms command
mkdir -p "$MAGIC_DIR/installed"
cat > "$MAGIC_DIR/installed/ms.msmeta" << EOF
command=ms
version=$MS_VERSION
registry_name=ms
registry_url=$REGISTRY_URL
checksum=$MS_CHECKSUM
install_script=$MS_INSTALL_SCRIPT
uninstall_script=$MS_UNINSTALL_SCRIPT
update_script=$MS_UPDATE_SCRIPT
installed_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u)
script_path=$MAGIC_DIR/scripts/ms.sh
install_script_checksum=$MS_INSTALL_CHECKSUM
uninstall_script_checksum=$MS_UNINSTALL_CHECKSUM
update_script_checksum=$MS_UPDATE_CHECKSUM
EOF
printf "${GREEN}done${NC}\n"
# Install man page if provided
if [ -n "$MS_MAN_URL" ] && [ "$MS_MAN_URL" != "" ]; then
local man_dir="$HOME/.local/share/man/man1"
local man_file="$man_dir/ms.1"
mkdir -p "$man_dir"
printf "Installing man page... "
if command -v curl >/dev/null 2>&1; then
if curl -fsSL "$MS_MAN_URL" -o "$man_file" 2>/dev/null; then
printf "${GREEN}done${NC}\n"
else
printf "${YELLOW}failed${NC}\n"
fi
elif command -v wget >/dev/null 2>&1; then
if wget -q "$MS_MAN_URL" -O "$man_file" 2>/dev/null; then
printf "${GREEN}done${NC}\n"
else
printf "${YELLOW}failed${NC}\n"
fi
else
printf "${YELLOW}skipped (curl/wget required)${NC}\n"
fi
fi
echo ""
echo "Initializing registries..."
printf " Updating ms registry... "
if "$INSTALL_DIR/ms" upgrade >/dev/null 2>&1; then
printf "${GREEN}done${NC}\n"
else
printf "${YELLOW}failed${NC}\n"
echo " ${YELLOW}Warning: Registry initialization failed. You can run 'ms upgrade' later.${NC}"
fi
echo ""
# Update shell configuration
PATH_UPDATED=false
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then
echo "${YELLOW}Updating shell configuration...${NC}"
# Try to detect and update shell configuration files
for config_file in "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.profile"; do
if [ -f "$config_file" ] || [ "$config_file" = "$HOME/.profile" ]; then
if update_shell_config "$config_file"; then
PATH_UPDATED=true
SHELL_CONFIG="$config_file"
break
fi
fi
done
if [ "$PATH_UPDATED" = false ]; then
# Create .profile if no config file was found
if update_shell_config "$HOME/.profile"; then
PATH_UPDATED=true
SHELL_CONFIG="$HOME/.profile"
fi
fi
else
echo "${GREEN}$INSTALL_DIR is already in PATH${NC}"
fi
echo ""
echo "========================================="
if [ "$MS_VERSION" = "dev" ]; then
echo "${GREEN}✅ Magic Scripts $MS_VERSION installed!${NC}"
else
echo "${GREEN}✅ Magic Scripts v$MS_VERSION installed!${NC}"
fi
echo "========================================="
echo ""
echo "Installed core command:"
echo " ${BLUE}ms${NC} Magic Scripts main interface"
echo ""
echo "${YELLOW}Next steps:${NC}"
echo " ${CYAN}ms config list -r${NC} # See available configuration keys"
echo " ${CYAN}ms search${NC} # Browse available commands"
echo " ${CYAN}ms install -r ms${NC} # Install all commands from ms registry"
echo " ${CYAN}ms help${NC} # Show detailed help"
echo ""
if [ "$PATH_UPDATED" = true ]; then
echo "${YELLOW}IMPORTANT: To use commands immediately, run:${NC}"
echo " ${CYAN}source $SHELL_CONFIG${NC}"
echo ""
echo "Or restart your terminal."
else
echo "${GREEN}All commands are ready to use!${NC}"
fi
echo ""
echo "Installation directory: ${CYAN}$INSTALL_DIR${NC}"
echo "Data directory: ${CYAN}$MAGIC_DIR${NC}"
echo "Repository: ${CYAN}$REPO_URL${NC}"