-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·94 lines (81 loc) · 2.72 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·94 lines (81 loc) · 2.72 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
#!/usr/bin/env bash
# FORGE CLI Installer — one command to rule them all.
# Usage: curl -fsSL https://raw.githubusercontent.com/victorpothin/forge/main/install.sh | bash
set -e
# --- Colors ---
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m'
echo ""
echo "╔══════════════════════════════════════╗"
echo "║ FORGE CLI Installer ║"
echo "║ Focused, Ordered, Restricted, ║"
echo "║ Guided Execution ║"
echo "╚══════════════════════════════════════╝"
echo ""
# --- Check Go ---
if ! command -v go &> /dev/null; then
echo -e "${RED}✗ Go is not installed.${NC}"
echo ""
echo " Install Go first: https://go.dev/doc/install"
echo ""
exit 1
fi
echo -e " ${GREEN}✓${NC} Go found: $(go version | awk '{print $3}')"
# --- Install binary ---
echo -e "\n${CYAN}⟳ Installing forge...${NC}"
go install github.com/victorpothin/forge@latest
echo -e " ${GREEN}✓${NC} forge installed to $(go env GOPATH)/bin/forge"
# --- PATH setup ---
BIN_DIR="$(go env GOPATH)/bin"
FORGE_BIN="$BIN_DIR/forge"
if ! command -v forge &> /dev/null; then
echo -e "\n${CYAN}⟳ Adding $BIN_DIR to PATH...${NC}"
# Detect shell config
SHELL_RC=""
if [[ -n "$ZSH_VERSION" ]]; then
SHELL_RC="$HOME/.zshrc"
elif [[ -n "$BASH_VERSION" ]]; then
SHELL_RC="$HOME/.bashrc"
fi
if [[ -z "$SHELL_RC" ]]; then
echo -e " ${RED}✗ Could not detect shell. Add this to your shell config:${NC}"
echo ""
echo " export PATH=\$PATH:$BIN_DIR"
echo ""
exit 1
fi
# Add to shell rc if not already there
if ! grep -q "$BIN_DIR" "$SHELL_RC" 2>/dev/null; then
echo "" >> "$SHELL_RC"
echo "# FORGE CLI" >> "$SHELL_RC"
echo "export PATH=\$PATH:$BIN_DIR" >> "$SHELL_RC"
echo -e " ${GREEN}✓${NC} Added to $SHELL_RC"
else
echo -e " ${GREEN}✓${NC} Already in $SHELL_RC"
fi
# Export for current session
export PATH="$PATH:$BIN_DIR"
fi
# --- Verify ---
echo ""
if command -v forge &> /dev/null; then
echo -e " ${GREEN}✓${NC} forge is ready: $(forge --version)"
else
echo -e " ${YELLOW}⚠${NC} Restart your terminal or run:"
echo ""
echo " export PATH=\$PATH:$BIN_DIR"
echo ""
exit 0
fi
echo ""
echo -e "${BOLD}Next steps:${NC}"
echo ""
echo " forge init --ai qwen -y # init a project"
echo " forge doctor # check health"
echo " forge --help # all commands"
echo ""
echo -e "${GREEN}Forge is ready. The fire is lit. 🔥${NC}"
echo ""