|
#!/usr/bin/env bash |
|
# |
|
# Make Issue Skill Installer for Claude Code |
|
# Created by Robin van Baalen (https://robinvanbaalen.nl) |
|
# |
|
|
|
set -e |
|
|
|
# Colors |
|
RED='\033[0;31m' |
|
GREEN='\033[0;32m' |
|
YELLOW='\033[1;33m' |
|
BLUE='\033[0;34m' |
|
MAGENTA='\033[0;35m' |
|
CYAN='\033[0;36m' |
|
BOLD='\033[1m' |
|
DIM='\033[2m' |
|
NC='\033[0m' # No Color |
|
|
|
# Config |
|
SKILL_NAME="make-issue" |
|
INSTALL_DIR="$HOME/.claude/skills/$SKILL_NAME" |
|
INSTALL_PATH="$INSTALL_DIR/SKILL.md" |
|
GIST_RAW_URL="https://gist.githubusercontent.com/rvanbaalen/b46cc4f04149f04191bb555aadc7901c/raw/SKILL.md" |
|
|
|
# ASCII Art |
|
print_header() { |
|
echo -e "${CYAN}" |
|
echo " ┌─────────────────────────────────────────┐" |
|
echo " │ │" |
|
echo -e " │ ${BOLD}Make Issue${NC}${CYAN} Skill for Claude Code │" |
|
echo " │ │" |
|
echo " └─────────────────────────────────────────┘" |
|
echo -e "${NC}" |
|
} |
|
|
|
print_footer() { |
|
echo -e "${DIM}─────────────────────────────────────────────${NC}" |
|
echo -e "${DIM}Created by Robin van Baalen • robinvanbaalen.nl${NC}" |
|
echo "" |
|
} |
|
|
|
# Status indicators |
|
info() { |
|
echo -e "${BLUE}ℹ${NC} $1" |
|
} |
|
|
|
success() { |
|
echo -e "${GREEN}✓${NC} $1" |
|
} |
|
|
|
warn() { |
|
echo -e "${YELLOW}⚠${NC} $1" |
|
} |
|
|
|
error() { |
|
echo -e "${RED}✗${NC} $1" |
|
} |
|
|
|
step() { |
|
echo -e "${MAGENTA}▸${NC} $1" |
|
} |
|
|
|
# Check dependencies |
|
check_dependencies() { |
|
local missing=() |
|
|
|
if ! command -v curl &> /dev/null; then |
|
missing+=("curl") |
|
fi |
|
|
|
if ! command -v gh &> /dev/null; then |
|
missing+=("gh (GitHub CLI)") |
|
fi |
|
|
|
if [ ${#missing[@]} -gt 0 ]; then |
|
error "Missing dependencies: ${missing[*]}" |
|
echo "" |
|
info "Please install the missing dependencies and try again." |
|
exit 1 |
|
fi |
|
} |
|
|
|
# Install function |
|
install() { |
|
print_header |
|
|
|
echo -e "${BOLD}Installing...${NC}" |
|
echo "" |
|
|
|
# Check dependencies |
|
step "Checking dependencies..." |
|
check_dependencies |
|
success "Dependencies found" |
|
|
|
# Create directory |
|
step "Creating skill directory..." |
|
if [ ! -d "$INSTALL_DIR" ]; then |
|
mkdir -p "$INSTALL_DIR" |
|
success "Created $INSTALL_DIR" |
|
else |
|
success "Directory exists" |
|
fi |
|
|
|
# Check for existing installation |
|
if [ -f "$INSTALL_PATH" ]; then |
|
warn "Existing installation found" |
|
echo -e " ${DIM}Backing up to ${INSTALL_PATH}.bak${NC}" |
|
cp "$INSTALL_PATH" "${INSTALL_PATH}.bak" |
|
fi |
|
|
|
# Download skill file |
|
step "Downloading skill..." |
|
if curl -fsSL "$GIST_RAW_URL" -o "$INSTALL_PATH" 2>/dev/null; then |
|
success "Downloaded successfully" |
|
else |
|
# Fallback: try to copy from local if running from gist directory |
|
if [ -f "SKILL.md" ]; then |
|
cp "SKILL.md" "$INSTALL_PATH" |
|
success "Installed from local file" |
|
else |
|
error "Failed to download skill" |
|
exit 1 |
|
fi |
|
fi |
|
|
|
echo "" |
|
echo -e "${GREEN}${BOLD}Installation complete!${NC}" |
|
echo "" |
|
echo -e " ${DIM}Installed to:${NC} $INSTALL_PATH" |
|
echo "" |
|
echo -e " ${BOLD}Usage:${NC}" |
|
echo -e " ${CYAN}/make-issue${NC} ${DIM}<brief description>${NC}" |
|
echo "" |
|
echo -e " ${BOLD}Example:${NC}" |
|
echo -e " ${CYAN}/make-issue${NC} login button broken on Safari" |
|
echo "" |
|
|
|
print_footer |
|
} |
|
|
|
# Uninstall function |
|
uninstall() { |
|
print_header |
|
|
|
echo -e "${BOLD}Uninstalling...${NC}" |
|
echo "" |
|
|
|
if [ -d "$INSTALL_DIR" ]; then |
|
step "Removing skill directory..." |
|
rm -rf "$INSTALL_DIR" |
|
success "Removed $INSTALL_DIR" |
|
|
|
echo "" |
|
echo -e "${GREEN}${BOLD}Uninstall complete!${NC}" |
|
else |
|
warn "Skill not found at $INSTALL_DIR" |
|
echo "" |
|
info "Nothing to uninstall" |
|
fi |
|
|
|
echo "" |
|
print_footer |
|
} |
|
|
|
# Show help |
|
show_help() { |
|
print_header |
|
|
|
echo -e "${BOLD}Usage:${NC}" |
|
echo " ./install.sh Install the skill" |
|
echo " ./install.sh --uninstall Uninstall the skill" |
|
echo " ./install.sh --help Show this help" |
|
echo "" |
|
echo -e "${BOLD}Or via curl:${NC}" |
|
echo " curl -fsSL <url>/install.sh | bash" |
|
echo " curl -fsSL <url>/install.sh | bash -s -- --uninstall" |
|
echo "" |
|
|
|
print_footer |
|
} |
|
|
|
# Main |
|
case "${1:-}" in |
|
--uninstall|-u) |
|
uninstall |
|
;; |
|
--help|-h) |
|
show_help |
|
;; |
|
*) |
|
install |
|
;; |
|
esac |