-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-ralph.sh
More file actions
91 lines (82 loc) · 3.08 KB
/
install-ralph.sh
File metadata and controls
91 lines (82 loc) · 3.08 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
#!/bin/bash
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${BLUE}=== Ralph Claude Code Setup ===${NC}"
echo ""
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_DIR="${HOME}/.local/bin"
# Check for jq (optional, for auto-completion detection)
echo -e "${BLUE}Checking optional dependencies...${NC}"
if ! command -v jq &> /dev/null; then
echo -e "${YELLOW}Note: jq is not installed (optional)${NC}"
echo -e "${YELLOW}jq enables auto-completion detection in AFK mode${NC}"
echo ""
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Install with: brew install jq"
elif command -v apt &> /dev/null; then
echo "Install with: sudo apt install jq"
elif command -v dnf &> /dev/null; then
echo "Install with: sudo dnf install jq"
else
echo "Install jq from: https://jqlang.github.io/jq/download/"
fi
echo ""
else
echo -e "${GREEN}jq found (auto-completion detection enabled)${NC}"
fi
# Create install directory if it doesn't exist
mkdir -p "$INSTALL_DIR"
# Copy ralph.sh to install directory
echo -e "${BLUE}Installing ralph script...${NC}"
cp "$SCRIPT_DIR/ralph.sh" "$INSTALL_DIR/ralph"
chmod +x "$INSTALL_DIR/ralph"
# Check if INSTALL_DIR is in PATH
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo -e "${YELLOW}Adding $INSTALL_DIR to PATH...${NC}"
# Detect shell and add to appropriate config
SHELL_NAME=$(basename "$SHELL")
case $SHELL_NAME in
bash)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
echo -e "${GREEN}Added to ~/.bashrc${NC}"
;;
zsh)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
echo -e "${GREEN}Added to ~/.zshrc${NC}"
;;
fish)
mkdir -p ~/.config/fish
echo 'set -gx PATH $HOME/.local/bin $PATH' >> ~/.config/fish/config.fish
echo -e "${GREEN}Added to ~/.config/fish/config.fish${NC}"
;;
*)
echo -e "${YELLOW}Please add this to your shell config manually:${NC}"
echo 'export PATH="$HOME/.local/bin:$PATH"'
;;
esac
fi
echo ""
echo -e "${GREEN}=== Installation Complete ===${NC}"
echo ""
echo "Usage examples:"
echo " ralph # HITL mode, single iteration"
echo " ralph -m afk 5 # AFK mode, 5 autonomous iterations"
echo " ralph -m afk -s 5 # AFK mode with Docker sandbox (requires setup)"
echo " ralph -h # Show help"
echo ""
echo -e "${BLUE}AFK Mode Features:${NC}"
echo " - Autonomous task execution"
echo " - Auto-stops when all PRD tasks complete (requires jq)"
echo " - Signed commits after each iteration"
echo ""
echo -e "${BLUE}Docker Sandbox Setup (optional, for isolated execution):${NC}"
echo " cd /your/project"
echo " docker sandbox run claude . # Create sandbox"
echo " /login # Authenticate inside sandbox"
echo " # Exit, then use: ralph -m afk -s 5"
echo ""
echo -e "${YELLOW}Note: Restart your terminal or run 'source ~/.bashrc' (or ~/.zshrc) to use the 'ralph' command${NC}"