-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathinstall.sh
More file actions
191 lines (168 loc) · 5.16 KB
/
Copy pathinstall.sh
File metadata and controls
191 lines (168 loc) · 5.16 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
#!/bin/bash
# GudaCC Skills Installer
# https://github.com/GuDaStudio/skills
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Available skills
AVAILABLE_SKILLS=("collaborating-with-codex" "collaborating-with-gemini")
# Script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
usage() {
echo -e "${BLUE}GudaCC Skills Installer${NC}"
echo ""
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -u, --user Install to user-level (~/.claude/skills/)"
echo " -p, --project Install to project-level (./.claude/skills/)"
echo " -t, --target <path> Install to custom target path"
echo " -a, --all Install all available skills"
echo " -s, --skill <name> Install specific skill (can be used multiple times)"
echo " -l, --list List available skills"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0 --user --all # Install all skills to user-level"
echo " $0 --project --all # Install all skills to current project"
echo " $0 --user -s collaborating-with-codex"
echo " $0 --target /custom/path --all"
echo ""
echo "Available skills:"
for skill in "${AVAILABLE_SKILLS[@]}"; do
echo " - $skill"
done
}
list_skills() {
echo -e "${BLUE}Available Skills:${NC}"
echo ""
for skill in "${AVAILABLE_SKILLS[@]}"; do
if [ -d "$SCRIPT_DIR/$skill" ]; then
echo -e " ${GREEN}✓${NC} $skill"
else
echo -e " ${RED}✗${NC} $skill (not found in source)"
fi
done
}
install_skill() {
local skill=$1
local target_dir=$2
local source_dir="$SCRIPT_DIR/$skill"
local dest_dir="$target_dir/$skill"
if [ ! -d "$source_dir" ]; then
echo -e "${RED}Error: Skill '$skill' not found in source directory${NC}"
return 1
fi
echo -e "${BLUE}Installing${NC} $skill -> $dest_dir"
# Create target directory
mkdir -p "$target_dir"
# Remove existing installation
if [ -d "$dest_dir" ]; then
echo -e "${YELLOW} Removing existing installation...${NC}"
rm -rf "$dest_dir"
fi
# Copy skill directory
cp -r "$source_dir" "$dest_dir"
# Remove .git file if it's a submodule reference
if [ -f "$dest_dir/.git" ]; then
rm "$dest_dir/.git"
fi
echo -e "${GREEN} ✓ Installed${NC}"
}
# Parse arguments
TARGET_PATH=""
INSTALL_ALL=false
SELECTED_SKILLS=()
SCOPE=""
while [[ $# -gt 0 ]]; do
case $1 in
-u|--user)
SCOPE="user"
TARGET_PATH="$HOME/.claude/skills"
shift
;;
-p|--project)
SCOPE="project"
TARGET_PATH="./.claude/skills"
shift
;;
-t|--target)
TARGET_PATH="$2"
shift 2
;;
-a|--all)
INSTALL_ALL=true
shift
;;
-s|--skill)
SELECTED_SKILLS+=("$2")
shift 2
;;
-l|--list)
list_skills
exit 0
;;
-h|--help)
usage
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
usage
exit 1
;;
esac
done
# Validate arguments
if [ -z "$TARGET_PATH" ]; then
echo -e "${RED}Error: Please specify installation target (-u, -p, or -t)${NC}"
echo ""
usage
exit 1
fi
if [ "$INSTALL_ALL" = false ] && [ ${#SELECTED_SKILLS[@]} -eq 0 ]; then
echo -e "${RED}Error: Please specify skills to install (-a or -s)${NC}"
echo ""
usage
exit 1
fi
# Determine skills to install
if [ "$INSTALL_ALL" = true ]; then
SKILLS_TO_INSTALL=("${AVAILABLE_SKILLS[@]}")
else
SKILLS_TO_INSTALL=("${SELECTED_SKILLS[@]}")
fi
# Validate selected skills
for skill in "${SKILLS_TO_INSTALL[@]}"; do
valid=false
for available in "${AVAILABLE_SKILLS[@]}"; do
if [ "$skill" = "$available" ]; then
valid=true
break
fi
done
if [ "$valid" = false ]; then
echo -e "${RED}Error: Unknown skill '$skill'${NC}"
echo "Available skills: ${AVAILABLE_SKILLS[*]}"
exit 1
fi
done
# Install
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}GudaCC Skills Installer${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e "Target: ${GREEN}$TARGET_PATH${NC}"
echo -e "Skills: ${GREEN}${SKILLS_TO_INSTALL[*]}${NC}"
echo ""
for skill in "${SKILLS_TO_INSTALL[@]}"; do
install_skill "$skill" "$TARGET_PATH"
done
echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}Installation complete!${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"