Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·123 lines (107 loc) · 3.84 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·123 lines (107 loc) · 3.84 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
#!/bin/bash
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Get script directory (where RPI Workflow is located)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Target directories
CLAUDE_DIR="$HOME/.claude"
COMMANDS_DIR="$CLAUDE_DIR/commands/rpi"
TEMPLATES_DIR="$CLAUDE_DIR/rpi"
echo ""
echo "Note: Plugin installation is now recommended."
echo " See README.md for plugin installation instructions."
echo " This script is maintained for backward compatibility."
echo ""
echo -e "${BLUE}╔════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ RPI Workflow Installer ║${NC}"
echo -e "${BLUE}╚════════════════════════════════════════╝${NC}"
echo ""
# Check if source files exist
if [ ! -d "$SCRIPT_DIR/commands" ] || [ ! -d "$SCRIPT_DIR/templates" ]; then
echo -e "${RED}Error: commands/ or templates/ directory not found.${NC}"
echo "Please run this script from the RPIWorkflow directory."
exit 1
fi
# Function to backup existing files
backup_if_exists() {
local target="$1"
if [ -e "$target" ]; then
local backup="${target}.backup.$(date +%Y%m%d_%H%M%S)"
echo -e "${YELLOW} Backing up existing: $target${NC}"
mv "$target" "$backup"
echo -e "${YELLOW} → Saved to: $backup${NC}"
fi
}
# Create directories
echo -e "${GREEN}[1/4]${NC} Creating directories..."
mkdir -p "$COMMANDS_DIR"
mkdir -p "$TEMPLATES_DIR"
echo " ✓ $COMMANDS_DIR"
echo " ✓ $TEMPLATES_DIR"
echo ""
# Install commands
echo -e "${GREEN}[2/4]${NC} Installing commands..."
for file in "$SCRIPT_DIR/commands"/*.md; do
filename=$(basename "$file")
target="$COMMANDS_DIR/$filename"
backup_if_exists "$target"
cp "$file" "$target"
echo " ✓ /rpi:${filename%.md}"
done
echo ""
# Install templates
echo -e "${GREEN}[3/4]${NC} Installing templates..."
for file in "$SCRIPT_DIR/templates"/*.md; do
filename=$(basename "$file")
target="$TEMPLATES_DIR/$filename"
backup_if_exists "$target"
cp "$file" "$target"
echo " ✓ $filename"
done
echo ""
# Verify installation
echo -e "${GREEN}[4/4]${NC} Verifying installation..."
errors=0
for cmd in research plan implement verify rule; do
if [ -f "$COMMANDS_DIR/${cmd}.md" ]; then
echo " ✓ /rpi:$cmd"
else
echo -e " ${RED}✗ /rpi:$cmd missing${NC}"
((errors++))
fi
done
for tpl in rpi-main-template research-template plan-template verify-template rule-template; do
if [ -f "$TEMPLATES_DIR/${tpl}.md" ]; then
echo " ✓ $tpl.md"
else
echo -e " ${RED}✗ $tpl.md missing${NC}"
((errors++))
fi
done
echo ""
# Summary
if [ $errors -eq 0 ]; then
echo -e "${GREEN}╔════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ Installation Complete! ║${NC}"
echo -e "${GREEN}╚════════════════════════════════════════╝${NC}"
echo ""
echo "Available commands:"
echo " /rpi:research - Start research phase"
echo " /rpi:plan - Create implementation plan"
echo " /rpi:implement - Execute the plan"
echo " /rpi:verify - Validate implementation"
echo " /rpi:rule - Manage project-specific rules"
echo ""
echo "Rules are stored per-project at: <project>/.claude/rules/"
echo ""
echo "Restart Claude Code or start a new session to use."
else
echo -e "${RED}Installation completed with $errors error(s).${NC}"
echo "Please check the missing files and try again."
exit 1
fi