-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_linux.sh
More file actions
executable file
·73 lines (65 loc) · 2.01 KB
/
install_linux.sh
File metadata and controls
executable file
·73 lines (65 loc) · 2.01 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
#!/usr/bin/env bash
#
# Install or uninstall the git-workflow skill for Claude Code (Linux).
# Creates a symlink so the skill stays in sync with the repo.
#
# Usage:
# ./scripts/install_linux.sh # Install
# ./scripts/install_linux.sh --uninstall # Uninstall
set -euo pipefail
SKILL_DIR="$HOME/.claude/skills/git-workflow"
SKILL_FILE="$SKILL_DIR/SKILL.md"
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
SOURCE="$REPO_ROOT/SKILL.md"
info() { printf " \033[34mℹ\033[0m %s\n" "$1"; }
pass() { printf " \033[32m✓\033[0m %s\n" "$1"; }
fail() { printf " \033[31m✗\033[0m %s\n" "$1"; }
uninstall() {
if [[ -L "$SKILL_FILE" ]]; then
rm "$SKILL_FILE"
pass "Removed symlink: $SKILL_FILE"
# Remove directory if empty
rmdir "$SKILL_DIR" 2>/dev/null && info "Removed empty directory: $SKILL_DIR" || true
elif [[ -f "$SKILL_FILE" ]]; then
fail "$SKILL_FILE exists but is not a symlink — remove it manually to avoid data loss"
exit 1
else
info "Nothing to uninstall — $SKILL_FILE does not exist"
fi
exit 0
}
install() {
# Verify source exists
if [[ ! -f "$SOURCE" ]]; then
fail "SKILL.md not found at $SOURCE"
exit 1
fi
# Check if already installed
if [[ -L "$SKILL_FILE" ]]; then
current_target="$(readlink -f "$SKILL_FILE")"
if [[ "$current_target" == "$SOURCE" ]]; then
pass "Already installed (symlink points to $SOURCE)"
exit 0
else
info "Existing symlink points to $current_target — replacing"
rm "$SKILL_FILE"
fi
elif [[ -f "$SKILL_FILE" ]]; then
fail "$SKILL_FILE exists but is not a symlink — remove it manually before installing"
exit 1
fi
# Create directory and symlink
mkdir -p "$SKILL_DIR"
ln -s "$SOURCE" "$SKILL_FILE"
pass "Installed: $SKILL_FILE → $SOURCE"
info "The skill will stay in sync with this repo. Restart Claude Code to activate."
}
# --- Main ---
case "${1:-}" in
--uninstall) uninstall ;;
"") install ;;
*)
echo "Usage: $0 [--uninstall]"
exit 1
;;
esac