init: common-skills v1
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
# Sync skills from common-skills repo into the current project's .kiro/skills/
|
||||
#
|
||||
# Usage:
|
||||
# bash scripts/sync.sh # sync all skills
|
||||
# bash scripts/sync.sh codereview python # sync specific skills
|
||||
#
|
||||
# Set COMMON_SKILLS_DIR to override the source path (default: ~/common-skills)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
COMMON_SKILLS_DIR="${COMMON_SKILLS_DIR:-$HOME/common-skills}"
|
||||
TARGET_DIR=".kiro/skills"
|
||||
SKILLS_SRC="$COMMON_SKILLS_DIR/skills"
|
||||
|
||||
if [[ ! -d "$SKILLS_SRC" ]]; then
|
||||
echo "❌ common-skills not found at $COMMON_SKILLS_DIR"
|
||||
echo " Clone it first: git clone <repo> ~/common-skills"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Pull latest
|
||||
git -C "$COMMON_SKILLS_DIR" pull --ff-only 2>/dev/null || true
|
||||
|
||||
mkdir -p "$TARGET_DIR"
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
skills=("$@")
|
||||
else
|
||||
skills=($(ls "$SKILLS_SRC"))
|
||||
fi
|
||||
|
||||
for skill in "${skills[@]}"; do
|
||||
src="$SKILLS_SRC/$skill"
|
||||
dst="$TARGET_DIR/$skill"
|
||||
if [[ ! -d "$src" ]]; then
|
||||
echo "⚠️ Skill not found: $skill"
|
||||
continue
|
||||
fi
|
||||
rm -rf "$dst"
|
||||
cp -r "$src" "$dst"
|
||||
echo "✅ Synced: $skill"
|
||||
done
|
||||
|
||||
echo "Done. Skills available in $TARGET_DIR/"
|
||||
Reference in New Issue
Block a user