ralph-workplan/install.sh

43 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
# install.sh — install the ralph-workplan skill into Claude Code's user commands
#
# Usage:
# ./install.sh # install
# ./install.sh --uninstall # remove
set -euo pipefail
PLUGIN_NAME="ralph-workplan"
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
COMMANDS_DIR="${HOME}/.claude/commands"
SKILL_FILE="${COMMANDS_DIR}/${PLUGIN_NAME}.md"
SCRIPTS_SRC="${REPO_DIR}/plugin/scripts"
# ── Uninstall ──────────────────────────────────────────────────────────────────
if [[ "${1:-}" == "--uninstall" ]]; then
if [[ -f "$SKILL_FILE" ]]; then
rm -f "$SKILL_FILE"
echo "Removed: $SKILL_FILE"
fi
echo "✅ Uninstalled: $PLUGIN_NAME"
echo " Restart Claude Code to apply."
exit 0
fi
# ── Install ────────────────────────────────────────────────────────────────────
mkdir -p "$COMMANDS_DIR"
# Write skill file with absolute script paths (avoids CLAUDE_PLUGIN_ROOT dependency)
sed "s|\${CLAUDE_PLUGIN_ROOT}/scripts|${SCRIPTS_SRC}|g" \
"${REPO_DIR}/plugin/ralph-workplan.md" > "$SKILL_FILE"
chmod +x "${SCRIPTS_SRC}/check-done.sh"
chmod +x "${SCRIPTS_SRC}/setup.sh"
echo "✅ Installed: $PLUGIN_NAME"
echo " Skill: $SKILL_FILE"
echo " Scripts: ${SCRIPTS_SRC}/"
echo " Invoke: /ralph-workplan <workplan-file> [--max-iterations N]"
echo ""
echo " Restart Claude Code for the skill to appear."