mirror of
https://github.com/mattpocock/skills.git
synced 2026-06-25 08:24:06 +00:00
Enhance link-skills.sh to check for symlink conflicts and provide user guidance
This commit is contained in:
parent
d0592f4cfb
commit
b7bf8cc3c1
1 changed files with 15 additions and 0 deletions
|
|
@ -6,6 +6,21 @@ set -euo pipefail
|
|||
|
||||
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
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"
|
||||
|
||||
find "$REPO/skills" -name SKILL.md -not -path '*/node_modules/*' -print0 |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue