-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·366 lines (325 loc) · 11.8 KB
/
setup.sh
File metadata and controls
executable file
·366 lines (325 loc) · 11.8 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
#!/bin/bash
# Prometh Context Framework Setup Script
# Safely installs Claude Code and/or OpenCode commands with multi-platform support
set -e # Exit on any error
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Get repository directory
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Platform directories
CLAUDE_DIR="$HOME/.claude"
OPENCODE_DIR="$HOME/.config/opencode"
# Display banner
echo "🔥 Prometh Context Framework Setup"
echo "=================================="
echo
# Initialize platform flags
INSTALL_CLAUDE=false
INSTALL_OPENCODE=false
# Function to display help
show_help() {
cat << EOF
Usage: ./setup.sh [OPTIONS]
OPTIONS:
--claude Install Claude Code commands only
--opencode Install OpenCode commands only
--all Install for both Claude Code and OpenCode
(no args) Interactive mode - prompts for platform selection
-h, --help Show this help message
EXAMPLES:
./setup.sh # Interactive - choose platform
./setup.sh --claude # Install for Claude Code only
./setup.sh --opencode # Install for OpenCode only
./setup.sh --all # Install for both platforms
EOF
}
# Function to parse command line arguments
parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
--claude)
INSTALL_CLAUDE=true
shift
;;
--opencode)
INSTALL_OPENCODE=true
shift
;;
--all)
INSTALL_CLAUDE=true
INSTALL_OPENCODE=true
shift
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
}
# Function to display interactive platform selection menu
select_platform() {
echo -e "${BLUE}Select Installation Target${NC}"
echo "============================"
echo
echo "1) Claude Code only"
echo "2) OpenCode only"
echo "3) Both platforms"
echo
read -p "Enter choice (1-3): " choice
echo
case $choice in
1)
INSTALL_CLAUDE=true
INSTALL_OPENCODE=false
;;
2)
INSTALL_CLAUDE=false
INSTALL_OPENCODE=true
;;
3)
INSTALL_CLAUDE=true
INSTALL_OPENCODE=true
;;
*)
echo -e "${YELLOW}Invalid choice. Please enter 1, 2, or 3.${NC}"
select_platform
;;
esac
}
# Function to safely copy files
safe_copy() {
local src="$1"
local dest="$2"
local type="$3"
if [ -f "$dest" ]; then
echo -e " ${YELLOW}⚠️ $type already exists:${NC} $(basename "$dest")"
read -p " Overwrite? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
cp "$src" "$dest"
echo -e " ${GREEN}✅ Replaced:${NC} $(basename "$dest")"
else
echo -e " ${BLUE}⏭️ Skipped:${NC} $(basename "$dest")"
fi
else
cp "$src" "$dest"
echo -e " ${GREEN}✅ Installed:${NC} $(basename "$dest")"
fi
}
# Function to install Claude Code skills
install_claude_skills() {
echo
echo -e "${YELLOW}Installing skills...${NC}"
if [ -d "$REPO_DIR/claude/skills" ]; then
for skill_dir in "$REPO_DIR/claude/skills"/*/; do
if [ -d "$skill_dir" ]; then
skill_name=$(basename "$skill_dir")
mkdir -p "$CLAUDE_DIR/skills/$skill_name"
local skill_file="$skill_dir/SKILL.md"
if [ -f "$skill_file" ]; then
local dest="$CLAUDE_DIR/skills/$skill_name/SKILL.md"
if [ -f "$dest" ]; then
echo -e " ${YELLOW}⚠️ Skill already exists:${NC} $skill_name/SKILL.md"
read -p " Overwrite? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
cp "$skill_file" "$dest"
echo -e " ${GREEN}✅ Replaced:${NC} $skill_name/SKILL.md"
else
echo -e " ${BLUE}⏭️ Skipped:${NC} $skill_name/SKILL.md"
fi
else
cp "$skill_file" "$dest"
echo -e " ${GREEN}✅ Installed:${NC} $skill_name/SKILL.md"
fi
fi
fi
done
else
echo -e " ${YELLOW}⚠️ No claude/skills directory found in repository${NC}"
fi
}
# Function to install Claude Code components
install_claude() {
echo
echo -e "${YELLOW}Installing Claude Code components...${NC}"
echo "===================================="
# Create Claude directories
mkdir -p "$CLAUDE_DIR/commands"
mkdir -p "$CLAUDE_DIR/output-styles"
mkdir -p "$CLAUDE_DIR/skills"
echo -e "${YELLOW}Installing commands...${NC}"
if [ -d "$REPO_DIR/claude/commands" ]; then
for cmd_file in "$REPO_DIR/claude/commands"/*.md; do
if [ -f "$cmd_file" ]; then
cmd_name=$(basename "$cmd_file")
safe_copy "$cmd_file" "$CLAUDE_DIR/commands/$cmd_name" "Command"
fi
done
else
echo -e " ${YELLOW}⚠️ No commands directory found in repository${NC}"
fi
echo
echo -e "${YELLOW}Installing output styles...${NC}"
if [ -d "$REPO_DIR/claude/output-styles" ]; then
for style_file in "$REPO_DIR/claude/output-styles"/*.md; do
if [ -f "$style_file" ]; then
style_name=$(basename "$style_file")
safe_copy "$style_file" "$CLAUDE_DIR/output-styles/$style_name" "Output style"
fi
done
else
echo -e " ${YELLOW}⚠️ No output-styles directory found in repository${NC}"
fi
install_claude_skills
}
# Function to install OpenCode skills
install_opencode_skills() {
echo
echo -e "${YELLOW}Installing skills...${NC}"
if [ -d "$REPO_DIR/opencode/skills" ]; then
for skill_dir in "$REPO_DIR/opencode/skills"/*/; do
if [ -d "$skill_dir" ]; then
skill_name=$(basename "$skill_dir")
mkdir -p "$OPENCODE_DIR/skills/$skill_name"
local skill_file="$skill_dir/SKILL.md"
if [ -f "$skill_file" ]; then
local dest="$OPENCODE_DIR/skills/$skill_name/SKILL.md"
if [ -f "$dest" ]; then
echo -e " ${YELLOW}⚠️ Skill already exists:${NC} $skill_name/SKILL.md"
read -p " Overwrite? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
cp "$skill_file" "$dest"
echo -e " ${GREEN}✅ Replaced:${NC} $skill_name/SKILL.md"
else
echo -e " ${BLUE}⏭️ Skipped:${NC} $skill_name/SKILL.md"
fi
else
cp "$skill_file" "$dest"
echo -e " ${GREEN}✅ Installed:${NC} $skill_name/SKILL.md"
fi
fi
fi
done
else
echo -e " ${YELLOW}⚠️ No opencode/skills directory found in repository${NC}"
fi
}
# Function to install OpenCode components
install_opencode() {
echo
echo -e "${YELLOW}Installing OpenCode components...${NC}"
echo "=================================="
# Create OpenCode directories
mkdir -p "$OPENCODE_DIR/commands"
mkdir -p "$OPENCODE_DIR/skills"
echo -e "${YELLOW}Installing commands...${NC}"
if [ -d "$REPO_DIR/opencode/commands" ]; then
for cmd_file in "$REPO_DIR/opencode/commands"/*.md; do
if [ -f "$cmd_file" ]; then
cmd_name=$(basename "$cmd_file")
safe_copy "$cmd_file" "$OPENCODE_DIR/commands/$cmd_name" "Command"
fi
done
else
echo -e " ${YELLOW}⚠️ No opencode/commands directory found in repository${NC}"
fi
install_opencode_skills
}
# Function to verify installations
verify_installations() {
echo
echo -e "${YELLOW}Verification:${NC}"
echo "=============="
if [ "$INSTALL_CLAUDE" = true ]; then
echo -e "${BLUE}Claude Code:${NC}"
echo -e " Commands: ${CLAUDE_DIR}/commands/"
ls -la "$CLAUDE_DIR/commands/" 2>/dev/null | grep -E "\.md$" | awk '{print " ✓ " $9}' || echo " (none found)"
echo -e " Skills: ${CLAUDE_DIR}/skills/"
for skill_dir in "$CLAUDE_DIR/skills"/*/; do
if [ -f "${skill_dir}SKILL.md" ]; then
echo " ✓ $(basename "$skill_dir")/SKILL.md"
fi
done
echo -e " Output Styles: ${CLAUDE_DIR}/output-styles/"
ls -la "$CLAUDE_DIR/output-styles/" 2>/dev/null | grep -E "\.md$" | awk '{print " ✓ " $9}' || echo " (none found)"
fi
if [ "$INSTALL_OPENCODE" = true ]; then
echo
echo -e "${BLUE}OpenCode:${NC}"
echo -e " Commands: ${OPENCODE_DIR}/commands/"
ls -la "$OPENCODE_DIR/commands/" 2>/dev/null | grep -E "\.md$" | awk '{print " ✓ " $9}' || echo " (none found)"
echo -e " Skills: ${OPENCODE_DIR}/skills/"
for skill_dir in "$OPENCODE_DIR/skills"/*/; do
if [ -f "${skill_dir}SKILL.md" ]; then
echo " ✓ $(basename "$skill_dir")/SKILL.md"
fi
done
fi
}
# Function to display completion message
show_completion() {
echo
echo -e "${GREEN}🎉 Setup complete!${NC}"
echo
echo -e "${BLUE}Available Slash Commands (Claude Code & OpenCode):${NC}"
echo " /prometh-init - Initialize framework in any project"
echo " /prometh-build - Execute SPEC with guided implementation"
echo " /prometh-status - Display project documentation dashboard"
echo " /prometh-help - Display comprehensive command reference"
echo
echo -e "${BLUE}Available Skills (Claude Code & OpenCode):${NC}"
echo " prometh-prd - Create or normalize strategic PRDs"
echo " prometh-spec - Create or normalize implementation SPECs"
echo " prometh-doc - Generate technical documentation"
echo " prometh-planner - Create Pixel Planner project plans with Gantt timelines"
echo " (Invoke via /prometh-prd, /prometh-spec, /prometh-doc, /prometh-planner or naturally in conversation)"
echo
echo -e "${BLUE}Getting Started:${NC}"
echo "1. Navigate to your project directory"
echo "2. Run '/prometh-init' to set up Prometh framework"
echo "3. Create strategic PRDs: /prometh-prd or ask 'create a PRD for...'"
echo "4. Generate implementation SPECs: /prometh-spec or ask 'create a SPEC for...'"
echo "5. Execute SPECs with '/prometh-build'"
echo "6. Monitor progress with '/prometh-status'"
echo
echo -e "${GREEN}Ready to ignite high-quality, predictable output! 🔥${NC}"
}
# Main execution
main() {
# Parse arguments or show interactive menu
if [[ $# -gt 0 ]]; then
parse_args "$@"
else
# Interactive mode
select_platform
fi
# Validate that at least one platform was selected
if [ "$INSTALL_CLAUDE" = false ] && [ "$INSTALL_OPENCODE" = false ]; then
echo -e "${YELLOW}No platform selected for installation.${NC}"
exit 1
fi
# Install selected platforms
if [ "$INSTALL_CLAUDE" = true ]; then
install_claude
fi
if [ "$INSTALL_OPENCODE" = true ]; then
install_opencode
fi
# Verify installations
verify_installations
# Show completion message
show_completion
}
# Run main function with all arguments
main "$@"