-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
97 lines (79 loc) · 2.2 KB
/
Copy pathinstall.sh
File metadata and controls
97 lines (79 loc) · 2.2 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
#!/bin/bash
# StackGen Installer
# Usage: curl -fsSL https://raw.githubusercontent.com/whyujjwal/stackgen/main/install.sh | bash
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Configuration
REPO="whyujjwal/stackgen"
INSTALL_DIR="$HOME/.local/bin"
BINARY_NAME="scaffold"
echo -e "${GREEN}StackGen Installer${NC}"
echo "=================================="
echo
# Detect OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $ARCH in
x86_64)
ARCH="amd64"
;;
aarch64|arm64)
ARCH="arm64"
;;
*)
echo -e "${RED}Unsupported architecture: $ARCH${NC}"
exit 1
;;
esac
case $OS in
linux)
PLATFORM="linux"
;;
darwin)
PLATFORM="darwin"
;;
*)
echo -e "${RED}Unsupported OS: $OS${NC}"
exit 1
;;
esac
echo "Detected platform: ${PLATFORM}_${ARCH}"
# Get latest release
echo "Fetching latest release..."
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_RELEASE" ]; then
echo -e "${RED}Failed to fetch latest release${NC}"
exit 1
fi
echo "Latest version: ${LATEST_RELEASE}"
# Download URL
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${LATEST_RELEASE}/scaffold_${PLATFORM}_${ARCH}"
# Create install directory if it doesn't exist
mkdir -p "$INSTALL_DIR"
# Download binary
echo "Downloading scaffold..."
if ! curl -L -o "$INSTALL_DIR/$BINARY_NAME" "$DOWNLOAD_URL"; then
echo -e "${RED}Failed to download binary${NC}"
exit 1
fi
# Make executable
chmod +x "$INSTALL_DIR/$BINARY_NAME"
# Check if install dir is in PATH
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo
echo -e "${YELLOW}Warning: $INSTALL_DIR is not in your PATH${NC}"
echo "Add it to your PATH by adding this line to your ~/.bashrc or ~/.zshrc:"
echo
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
echo
fi
echo
echo -e "${GREEN}✓ Project Scaffold Agent installed successfully!${NC}"
echo
echo "Run 'scaffold init' to create your first project"
echo "Run 'scaffold --help' for more information"
echo