-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·75 lines (63 loc) · 2.21 KB
/
install.sh
File metadata and controls
executable file
·75 lines (63 loc) · 2.21 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
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILLS_DIR="$HOME/.claude/skills"
command -v realpath >/dev/null 2>&1 || { echo "Error: realpath not found. Install coreutils."; exit 1; }
resolve_path() { realpath "$1"; }
echo "Installing Adversarial Dev Workflow skills..."
# Create skills directory if needed
if [ ! -d "$SKILLS_DIR" ]; then
mkdir -p "$SKILLS_DIR"
echo "Created $SKILLS_DIR"
fi
# Remove legacy /adw skill if present (replaced by adw-plan and adw-changes)
LEGACY_TARGET="$SKILLS_DIR/adw"
if [ -L "$LEGACY_TARGET" ]; then
rm "$LEGACY_TARGET"
echo "Removed legacy skill: $LEGACY_TARGET"
elif [ -e "$LEGACY_TARGET" ]; then
echo "Warning: $LEGACY_TARGET exists and is not a symlink. Remove it manually if needed."
fi
# Install each skill
install_skill() {
local NAME="$1"
local SOURCE="$SCRIPT_DIR/skills/$NAME"
local TARGET="$SKILLS_DIR/$NAME"
if [ ! -d "$SOURCE" ]; then
echo "Error: Skill source not found at $SOURCE"
return 1
fi
if [ -L "$TARGET" ]; then
EXISTING="$(resolve_path "$(readlink "$TARGET")")"
SOURCE_RESOLVED="$(resolve_path "$SOURCE")"
if [ "$EXISTING" = "$SOURCE_RESOLVED" ]; then
echo "Already installed: $NAME"
return
else
echo "Warning: $TARGET exists but points to $EXISTING"
echo "Remove it manually to reinstall: rm \"$TARGET\""
return 1
fi
elif [ -e "$TARGET" ]; then
echo "Warning: $TARGET exists and is not a symlink."
echo "Remove it manually to install: rm -rf \"$TARGET\""
return 1
fi
ln -s "$SOURCE" "$TARGET"
echo "Installed: $TARGET -> $SOURCE"
if [ ! -f "$TARGET/SKILL.md" ]; then
echo "Warning: Symlink created but SKILL.md not found in $TARGET"
echo "The skill may not work. Verify the repository is complete."
fi
}
FAILED=0
install_skill "adw-plan" || FAILED=$((FAILED + 1))
install_skill "adw-changes" || FAILED=$((FAILED + 1))
echo ""
if [ "$FAILED" -gt 0 ]; then
echo "Warning: $FAILED skill(s) failed to install. See errors above."
exit 1
fi
echo "Done! You can now use the following skills in Claude Code:"
echo " /adw-plan — Challenge a plan adversarially"
echo " /adw-changes — Challenge code changes adversarially"