-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·85 lines (71 loc) · 1.63 KB
/
build.sh
File metadata and controls
executable file
·85 lines (71 loc) · 1.63 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
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BUILD_DIR="$REPO_ROOT/build"
PLUGIN_NAME="idd-skills"
GIT_HASH="$(git -C "$REPO_ROOT" rev-parse --short HEAD)"
ZIP_NAME="${PLUGIN_NAME}-${GIT_HASH}.zip"
# Directories always included
INCLUDE=(
skills
docs
.claude-plugin
)
# Top-level files always included
FILES=(
LICENSE
README.md
)
# Parse flags
INCLUDE_TECHNICAL=false
while [[ $# -gt 0 ]]; do
case "$1" in
--with-technical)
INCLUDE_TECHNICAL=true
shift
;;
-h|--help)
cat <<EOF
Usage: $(basename "$0") [OPTIONS]
Build the idd-skills plugin zip.
Options:
--with-technical Include technical-skills/ in the archive
-h, --help Show this help message
Output: build/${PLUGIN_NAME}-<git-hash>.zip
EOF
exit 0
;;
*)
echo "Unknown option: $1" >&2
exit 1
;;
esac
done
if $INCLUDE_TECHNICAL; then
INCLUDE+=(technical-skills)
fi
# Stage into a temp dir so the zip has an idd-skills/ prefix
STAGING="$(mktemp -d)"
trap 'rm -rf "$STAGING"' EXIT
DEST="$STAGING/$PLUGIN_NAME"
mkdir -p "$DEST"
for dir in "${INCLUDE[@]}"; do
src="$REPO_ROOT/$dir"
if [[ -d "$src" ]]; then
rsync -a --exclude '.DS_Store' "$src/" "$DEST/$dir/"
else
echo "Warning: skipping missing directory $dir" >&2
fi
done
for file in "${FILES[@]}"; do
src="$REPO_ROOT/$file"
if [[ -f "$src" ]]; then
cp "$src" "$DEST/$file"
else
echo "Warning: skipping missing file $file" >&2
fi
done
mkdir -p "$BUILD_DIR"
rm -f "$BUILD_DIR/$ZIP_NAME"
(cd "$STAGING" && zip -qr "$BUILD_DIR/$ZIP_NAME" "$PLUGIN_NAME")
echo "$BUILD_DIR/$ZIP_NAME"