-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·102 lines (88 loc) · 2.89 KB
/
install.sh
File metadata and controls
executable file
·102 lines (88 loc) · 2.89 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
#!/usr/bin/env bash
# dotforge installer — one-liner: curl -fsSL https://raw.githubusercontent.com/luiseiman/dotforge/main/install.sh | bash
set -euo pipefail
VERSION="2.9.0"
REPO="https://github.com/luiseiman/dotforge.git"
DEFAULT_DIR="$HOME/.dotforge"
# ── Platform detection ──
detect_platform() {
case "$(uname -s)" in
Linux*)
if grep -qi microsoft /proc/version 2>/dev/null; then
echo "wsl"
else
echo "linux"
fi ;;
Darwin*) echo "macos" ;;
MINGW*|MSYS*|CYGWIN*) echo "gitbash" ;;
*) echo "unsupported" ;;
esac
}
PLATFORM=$(detect_platform)
if [[ "$PLATFORM" == "unsupported" ]]; then
echo "✗ Unsupported platform. dotforge requires bash (macOS/Linux/WSL)."
exit 1
fi
if [[ "$PLATFORM" == "gitbash" ]]; then
echo "⚠ Git Bash detected. dotforge works but WSL is recommended on Windows."
echo " Ensure jq and python3 are in PATH for full hook support."
echo ""
fi
echo "═══ dotforge installer v${VERSION} ═══"
echo "Platform: ${PLATFORM}"
echo ""
# ── Determine install directory ──
DOTFORGE_DIR="${DOTFORGE_DIR:-$DEFAULT_DIR}"
# ── Install or update ──
if [[ -d "$DOTFORGE_DIR/.git" ]]; then
echo "Updating existing installation at $DOTFORGE_DIR..."
git -C "$DOTFORGE_DIR" pull --ff-only 2>&1 || {
echo "⚠ git pull failed. Run manually: cd $DOTFORGE_DIR && git pull"
exit 1
}
else
echo "Installing dotforge to $DOTFORGE_DIR..."
git clone "$REPO" "$DOTFORGE_DIR" 2>&1 || {
echo "✗ git clone failed. Check network and try again."
exit 1
}
fi
# ── Run global sync ──
echo ""
echo "Running global sync..."
bash "$DOTFORGE_DIR/global/sync.sh" 2>&1
# ── Add DOTFORGE_DIR to shell profile ──
EXPORT_LINE="export DOTFORGE_DIR=\"$DOTFORGE_DIR\""
PROFILE=""
for rc in "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile"; do
if [[ -f "$rc" ]]; then
PROFILE="$rc"
break
fi
done
if [[ -n "$PROFILE" ]]; then
if ! grep -q "DOTFORGE_DIR" "$PROFILE" 2>/dev/null; then
echo "" >> "$PROFILE"
echo "# dotforge" >> "$PROFILE"
echo "$EXPORT_LINE" >> "$PROFILE"
echo "✓ Added DOTFORGE_DIR to $PROFILE"
else
echo "✓ DOTFORGE_DIR already in $PROFILE"
fi
else
echo "⚠ No shell profile found. Add manually: $EXPORT_LINE"
fi
# ── Summary ──
INSTALLED_VERSION=$(cat "$DOTFORGE_DIR/VERSION" 2>/dev/null | tr -d '[:space:]')
SKILL_COUNT=$(ls -d "$HOME/.claude/skills"/*/ 2>/dev/null | wc -l | tr -d ' ')
AGENT_COUNT=$(ls "$HOME/.claude/agents"/*.md 2>/dev/null | wc -l | tr -d ' ')
CMD_COUNT=$(ls "$HOME/.claude/commands"/*.md 2>/dev/null | wc -l | tr -d ' ')
echo ""
echo "═══ dotforge installed ═══"
echo " Version: ${INSTALLED_VERSION}"
echo " Skills: ${SKILL_COUNT}"
echo " Agents: ${AGENT_COUNT}"
echo " Commands: ${CMD_COUNT}"
echo " Location: ${DOTFORGE_DIR}"
echo ""
echo "Next step: open a project and run /forge init"