- implements blueprint 028 - rewrite 290 cross-skill markdown links across 59 files to unchecked backtick-wrapped /skill-name prose (R-023), so skill content resolves under any install depth — symlinked, flat-copied, or whole-tree - add skills/productivity/conjure-a-skill/scripts/skill-ref-check — validates every /skill-name mention resolves to a real skill folder, the replacement coverage link-check lost on these references - add scripts/link-skills.sh, mirroring mattpocock/skills, symlinking every skill into ~/.claude/skills and ~/.agents/skills - docs(readme): point Install at link-skills.sh and npx skills@latest add for non-Claude-Code harnesses
53 lines
1.5 KiB
Bash
Executable File
53 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Links every skill in this repo into the local skill directories used by
|
|
# each agent harness:
|
|
# - ~/.claude/skills: Claude Code
|
|
# - ~/.agents/skills: Codex and other Agent Skills-compatible harnesses
|
|
# Each entry is a symlink into this repo, so a `git pull` (or `jj git
|
|
# fetch`) is all that's needed to keep installed skills up to date.
|
|
# Mirrors mattpocock/skills' scripts/link-skills.sh.
|
|
|
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
DESTS=("$HOME/.claude/skills" "$HOME/.agents/skills")
|
|
|
|
names=()
|
|
srcs=()
|
|
while IFS= read -r -d '' skill_md; do
|
|
src="$(dirname "$skill_md")"
|
|
names+=("$(basename "$src")")
|
|
srcs+=("$src")
|
|
done < <(find "$REPO/skills" -name SKILL.md -print0)
|
|
|
|
for DEST in "${DESTS[@]}"; do
|
|
# If $DEST 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"
|
|
|
|
for i in "${!names[@]}"; do
|
|
name="${names[$i]}"
|
|
src="${srcs[$i]}"
|
|
target="$DEST/$name"
|
|
|
|
if [ -e "$target" ] && [ ! -L "$target" ]; then
|
|
rm -rf "$target"
|
|
fi
|
|
|
|
ln -sfn "$src" "$target"
|
|
echo "linked $name -> $src ($DEST)"
|
|
done
|
|
done
|