119 lines
4.2 KiB
Bash
Executable File
119 lines
4.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# install.sh — Install Lyrebird Claude agents and skills into ~/.claude
|
|
#
|
|
# Usage:
|
|
# bash claude/install.sh # safe install — exits if any files already exist
|
|
# bash claude/install.sh --force # overwrite existing files
|
|
#
|
|
# What it does:
|
|
# 1. Creates ~/.claude/agents/ and ~/.claude/skills/ if absent
|
|
# 2. Copies every agent .md and skill directory
|
|
# 3. Prints a summary
|
|
#
|
|
# Without --force the script exits (without modifying anything) if any
|
|
# destination file already exists, and prints instructions to use --force.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
AGENTS_SRC="$SCRIPT_DIR/agents"
|
|
SKILLS_SRC="$SCRIPT_DIR/skills"
|
|
AGENTS_DST="$HOME/.claude/agents"
|
|
SKILLS_DST="$HOME/.claude/skills"
|
|
|
|
# ── Flags ─────────────────────────────────────────────────────────────────────
|
|
|
|
FORCE=0
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--force|-f) FORCE=1 ;;
|
|
*) echo "Unknown argument: $arg"; echo "Usage: $0 [--force]"; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
# ── Preflight — claude CLI ────────────────────────────────────────────────────
|
|
|
|
if ! command -v claude &>/dev/null; then
|
|
echo "Warning: 'claude' CLI not found in PATH. Agents and skills will be installed"
|
|
echo " but will only be active when you run Claude Code from this machine."
|
|
echo ""
|
|
fi
|
|
|
|
# ── Preflight — collision check (skip when --force) ───────────────────────────
|
|
|
|
if [[ $FORCE -eq 0 ]]; then
|
|
collisions=()
|
|
|
|
for src_file in "$AGENTS_SRC"/*.md; do
|
|
dst="$AGENTS_DST/$(basename "$src_file")"
|
|
[[ -e "$dst" ]] && collisions+=("$dst")
|
|
done
|
|
|
|
for src_dir in "$SKILLS_SRC"/*/; do
|
|
dst="$SKILLS_DST/$(basename "$src_dir")/skill.md"
|
|
[[ -e "$dst" ]] && collisions+=("$dst")
|
|
done
|
|
|
|
if [[ ${#collisions[@]} -gt 0 ]]; then
|
|
echo "Existing files found — aborting to avoid overwriting:"
|
|
echo ""
|
|
for f in "${collisions[@]}"; do
|
|
echo " $f"
|
|
done
|
|
echo ""
|
|
echo "To overwrite existing files, re-run with --force:"
|
|
echo ""
|
|
echo " bash claude/install.sh --force"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# ── Create destination directories ───────────────────────────────────────────
|
|
|
|
mkdir -p "$AGENTS_DST"
|
|
mkdir -p "$SKILLS_DST"
|
|
|
|
# ── Install agents ────────────────────────────────────────────────────────────
|
|
|
|
installed_agents=()
|
|
for src_file in "$AGENTS_SRC"/*.md; do
|
|
filename="$(basename "$src_file")"
|
|
dst_file="$AGENTS_DST/$filename"
|
|
cp "$src_file" "$dst_file"
|
|
installed_agents+=("$filename")
|
|
done
|
|
|
|
# ── Install skills ────────────────────────────────────────────────────────────
|
|
|
|
installed_skills=()
|
|
for src_dir in "$SKILLS_SRC"/*/; do
|
|
skill_name="$(basename "$src_dir")"
|
|
dst_dir="$SKILLS_DST/$skill_name"
|
|
mkdir -p "$dst_dir"
|
|
cp "$src_dir/skill.md" "$dst_dir/skill.md"
|
|
installed_skills+=("$skill_name")
|
|
done
|
|
|
|
# ── Summary ───────────────────────────────────────────────────────────────────
|
|
|
|
echo ""
|
|
echo "Lyrebird Claude agents and skills installed."
|
|
echo ""
|
|
echo "Agents → $AGENTS_DST"
|
|
for name in "${installed_agents[@]}"; do
|
|
echo " ✓ $name"
|
|
done
|
|
|
|
echo ""
|
|
echo "Skills → $SKILLS_DST"
|
|
for name in "${installed_skills[@]}"; do
|
|
echo " ✓ /$name"
|
|
done
|
|
|
|
echo ""
|
|
echo "Open any Lyrebird project in Claude Code and the agents will be available"
|
|
echo "automatically. Invoke skills with /lyrebird_review, /lyrebird_review_cycle,"
|
|
echo "or /pr_review."
|
|
echo ""
|