Add unified scripts system with find-skills and run

Consolidates skill discovery and adds generic runner for cross-platform compatibility.

Changes:
- Created scripts/find-skills: Unified tool (show all + filter by pattern)
  - Shows descriptions by default
  - Searches personal first, then core (shadowing)
  - Logs searches for gap analysis
  - Bash 3.2 compatible

- Created scripts/run: Generic runner for any skill script
  - Searches personal superpowers first, then core
  - Enables running arbitrary skill scripts without CLAUDE_PLUGIN_ROOT env var
  - Example: scripts/run skills/collaboration/remembering-conversations/tool/search-conversations

- Fixed bash 3.2 compatibility in list-skills, skills-search
  - Replaced associative arrays with newline-delimited lists
  - Works on macOS default bash (3.2) and Linux bash 4+

- Updated all documentation to reference scripts/find-skills
- Removed redundant wrapper scripts

This solves the CLAUDE_PLUGIN_ROOT environment variable issue - scripts
can now be called from anywhere without needing the env var set.
This commit is contained in:
Jesse Vincent
2025-10-10 20:37:04 -07:00
parent c023e803ac
commit 16b764689a
8 changed files with 234 additions and 28 deletions

View File

@@ -19,8 +19,8 @@ fi
PERSONAL_SUPERPOWERS_DIR="${PERSONAL_SUPERPOWERS_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/superpowers}"
PERSONAL_SKILLS_DIR="${PERSONAL_SUPERPOWERS_DIR}/skills"
# Collect all skill paths with deduplication
declare -A seen_skills
# Collect all skill paths with deduplication (bash 3.2 compatible)
seen_skills_list=""
all_skills=()
# Personal skills first (take precedence)
@@ -29,7 +29,7 @@ if [[ -d "$PERSONAL_SKILLS_DIR" ]]; then
skill_path="${file#$PERSONAL_SKILLS_DIR/}"
skill_path="${skill_path%/SKILL.md}"
if [[ -n "$skill_path" ]]; then
seen_skills["$skill_path"]=1
seen_skills_list="${seen_skills_list}${skill_path}"$'\n'
all_skills+=("$skill_path")
fi
done < <(find "$PERSONAL_SKILLS_DIR" -name "SKILL.md" -type f 2>/dev/null || true)
@@ -39,7 +39,9 @@ fi
while IFS= read -r file; do
skill_path="${file#$CORE_SKILLS_DIR/}"
skill_path="${skill_path%/SKILL.md}"
if [[ -n "$skill_path" ]] && [[ -z "${seen_skills[$skill_path]:-}" ]]; then
if [[ -n "$skill_path" ]]; then
# Skip if already seen in personal skills
echo "$seen_skills_list" | grep -q "^${skill_path}$" && continue
all_skills+=("$skill_path")
fi
done < <(find "$CORE_SKILLS_DIR" -name "SKILL.md" -type f 2>/dev/null || true)