feat(update-skills): dual install target — ~/.claude/skills + ~/.agents/skills (agent-neutral); pi settings hack removed (v0.2.1)

This commit is contained in:
2026-08-12 21:43:00 +03:00
parent e431e9e142
commit 348f6f3108
7 changed files with 155 additions and 94 deletions

View File

@@ -1,14 +1,20 @@
#!/usr/bin/env bash
# Install skills/<name>/ into ~/.claude/skills/<name>/ (or $CLAUDE_SKILLS_DIR)
# Install skills/<name>/ into BOTH agent skill dirs:
# ~/.claude/skills/<name>/ (Claude Code — native, not configurable)
# ~/.agents/skills/<name>/ (pi — native default scan path, agent-neutral namespace)
# $CLAUDE_SKILLS_DIR overrides ONLY the claude target (for testing/CI).
#
# Usage: install.sh [--prune] [name...]
# no args = install all skills/* into target
# no args = install all skills/* into both targets
# --prune = after install, remove target/<name>/ dirs that are NOT in skills/*
# (prune always scans full target, ignores name filter — global cleanup)
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SRC="$ROOT/skills"
TARGET="${CLAUDE_SKILLS_DIR:-$HOME/.claude/skills}"
# Dual install targets — the "canon" is the git repo (skills/); both dirs are installs.
TARGETS=("${CLAUDE_SKILLS_DIR:-$HOME/.claude/skills}" "$HOME/.agents/skills")
prune=0
positional=()
@@ -33,31 +39,37 @@ else
names=("${positional[@]}")
fi
mkdir -p "$TARGET"
for target in "${TARGETS[@]}"; do
mkdir -p "$target"
done
for name in "${names[@]}"; do
src_dir="$SRC/$name"
dst_dir="$TARGET/$name"
if [ ! -d "$src_dir" ]; then
echo "skip: $name (not found in skills/)" >&2
continue
fi
if [ ! -f "$src_dir/SKILL.md" ]; then
echo "skip: $name (missing SKILL.md)" >&2
continue
fi
rm -rf "$dst_dir"
cp -R "$src_dir" "$dst_dir"
echo "installed: $name$dst_dir"
for target in "${TARGETS[@]}"; do
for name in "${names[@]}"; do
src_dir="$SRC/$name"
dst_dir="$target/$name"
if [ ! -d "$src_dir" ]; then
echo "skip: $name (not found in skills/)" >&2
continue
fi
if [ ! -f "$src_dir/SKILL.md" ]; then
echo "skip: $name (missing SKILL.md)" >&2
continue
fi
rm -rf "$dst_dir"
cp -R "$src_dir" "$dst_dir"
echo "installed: $name$dst_dir"
done
done
if [ "$prune" -eq 1 ]; then
for d in "$TARGET"/*/; do
[ -d "$d" ] || continue
name="$(basename "$d")"
if [ ! -d "$SRC/$name" ]; then
echo "pruning: $name (not in skills/) → $d"
rm -rf "$d"
fi
for target in "${TARGETS[@]}"; do
for d in "$target"/*/; do
[ -d "$d" ] || continue
name="$(basename "$d")"
if [ ! -d "$SRC/$name" ]; then
echo "pruning: $name (not in skills/) → $d"
rm -rf "$d"
fi
done
done
fi