mirror of
https://github.com/mattpocock/skills.git
synced 2026-04-30 22:13:54 +07:00
Enhance link-skills.sh to check for symlink conflicts and provide user guidance
This commit is contained in:
@@ -6,6 +6,21 @@ set -euo pipefail
|
|||||||
|
|
||||||
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
DEST="$HOME/.claude/skills"
|
DEST="$HOME/.claude/skills"
|
||||||
|
|
||||||
|
# If ~/.claude/skills is a symlink that resolves into this repo, we'd end up
|
||||||
|
# writing the per-skill symlinks back into the repo's own skills/ tree. Detect
|
||||||
|
# and bail out instead of polluting the working copy.
|
||||||
|
if [ -L "$DEST" ]; then
|
||||||
|
resolved="$(readlink -f "$DEST")"
|
||||||
|
case "$resolved" in
|
||||||
|
"$REPO"|"$REPO"/*)
|
||||||
|
echo "error: $DEST is a symlink into this repo ($resolved)." >&2
|
||||||
|
echo "Remove it (rm \"$DEST\") and re-run; the script will recreate it as a real dir." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "$DEST"
|
mkdir -p "$DEST"
|
||||||
|
|
||||||
find "$REPO/skills" -name SKILL.md -not -path '*/node_modules/*' -print0 |
|
find "$REPO/skills" -name SKILL.md -not -path '*/node_modules/*' -print0 |
|
||||||
|
|||||||
Reference in New Issue
Block a user