fix(install): switch from plugins/ to commands/ layout
Installs the skill directly to ~/.claude/commands/ralph-workplan.md with absolute script paths baked in via sed substitution. Drops the installed_plugins.json registry approach which is no longer needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
56
install.sh
56
install.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# install.sh — install the ralph-workplan skill into Claude Code's plugin system
|
# install.sh — install the ralph-workplan skill into Claude Code's user commands
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# ./install.sh # install
|
# ./install.sh # install
|
||||||
@@ -9,26 +9,15 @@ set -euo pipefail
|
|||||||
|
|
||||||
PLUGIN_NAME="ralph-workplan"
|
PLUGIN_NAME="ralph-workplan"
|
||||||
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
|
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
PLUGINS_DIR="${HOME}/.claude/plugins"
|
COMMANDS_DIR="${HOME}/.claude/commands"
|
||||||
INSTALL_PATH="${PLUGINS_DIR}/cache/local/${PLUGIN_NAME}"
|
SKILL_FILE="${COMMANDS_DIR}/${PLUGIN_NAME}.md"
|
||||||
REGISTRY="${PLUGINS_DIR}/installed_plugins.json"
|
SCRIPTS_SRC="${REPO_DIR}/plugin/scripts"
|
||||||
|
|
||||||
# ── Uninstall ──────────────────────────────────────────────────────────────────
|
# ── Uninstall ──────────────────────────────────────────────────────────────────
|
||||||
if [[ "${1:-}" == "--uninstall" ]]; then
|
if [[ "${1:-}" == "--uninstall" ]]; then
|
||||||
if [[ -d "$INSTALL_PATH" ]]; then
|
if [[ -f "$SKILL_FILE" ]]; then
|
||||||
rm -rf "$INSTALL_PATH"
|
rm -f "$SKILL_FILE"
|
||||||
echo "Removed: $INSTALL_PATH"
|
echo "Removed: $SKILL_FILE"
|
||||||
fi
|
|
||||||
# Remove from installed_plugins.json
|
|
||||||
if [[ -f "$REGISTRY" ]]; then
|
|
||||||
python3 - "$REGISTRY" "$PLUGIN_NAME" <<'PY'
|
|
||||||
import json, sys
|
|
||||||
path, name = sys.argv[1], sys.argv[2]
|
|
||||||
d = json.load(open(path))
|
|
||||||
d.setdefault("plugins", {}).pop(name, None)
|
|
||||||
json.dump(d, open(path, "w"), indent=2)
|
|
||||||
print(f"Removed '{name}' from {path}")
|
|
||||||
PY
|
|
||||||
fi
|
fi
|
||||||
echo "✅ Uninstalled: $PLUGIN_NAME"
|
echo "✅ Uninstalled: $PLUGIN_NAME"
|
||||||
echo " Restart Claude Code to apply."
|
echo " Restart Claude Code to apply."
|
||||||
@@ -36,31 +25,18 @@ PY
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Install ────────────────────────────────────────────────────────────────────
|
# ── Install ────────────────────────────────────────────────────────────────────
|
||||||
mkdir -p "${INSTALL_PATH}/commands"
|
mkdir -p "$COMMANDS_DIR"
|
||||||
mkdir -p "${INSTALL_PATH}/scripts"
|
|
||||||
|
|
||||||
# Skill file goes in commands/ — that's where Claude Code looks
|
# Write skill file with absolute script paths (avoids CLAUDE_PLUGIN_ROOT dependency)
|
||||||
cp "${REPO_DIR}/plugin/ralph-workplan.md" "${INSTALL_PATH}/commands/ralph-workplan.md"
|
sed "s|\${CLAUDE_PLUGIN_ROOT}/scripts|${SCRIPTS_SRC}|g" \
|
||||||
cp "${REPO_DIR}/plugin/scripts/check-done.sh" "${INSTALL_PATH}/scripts/check-done.sh"
|
"${REPO_DIR}/plugin/ralph-workplan.md" > "$SKILL_FILE"
|
||||||
cp "${REPO_DIR}/plugin/scripts/setup.sh" "${INSTALL_PATH}/scripts/setup.sh"
|
|
||||||
|
|
||||||
chmod +x "${INSTALL_PATH}/scripts/check-done.sh"
|
chmod +x "${SCRIPTS_SRC}/check-done.sh"
|
||||||
chmod +x "${INSTALL_PATH}/scripts/setup.sh"
|
chmod +x "${SCRIPTS_SRC}/setup.sh"
|
||||||
|
|
||||||
# Register in installed_plugins.json so Claude Code discovers the plugin
|
|
||||||
python3 - "$REGISTRY" "$PLUGIN_NAME" "$INSTALL_PATH" <<'PY'
|
|
||||||
import json, sys
|
|
||||||
path, name, install_path = sys.argv[1], sys.argv[2], sys.argv[3]
|
|
||||||
try:
|
|
||||||
d = json.load(open(path))
|
|
||||||
except (FileNotFoundError, json.JSONDecodeError):
|
|
||||||
d = {"version": 2, "plugins": {}}
|
|
||||||
d.setdefault("plugins", {})[name] = [{"scope": "user", "installPath": install_path}]
|
|
||||||
json.dump(d, open(path, "w"), indent=2)
|
|
||||||
PY
|
|
||||||
|
|
||||||
echo "✅ Installed: $PLUGIN_NAME"
|
echo "✅ Installed: $PLUGIN_NAME"
|
||||||
echo " Path: $INSTALL_PATH"
|
echo " Skill: $SKILL_FILE"
|
||||||
echo " Skill: /ralph-workplan <workplan-file> [--max-iterations N]"
|
echo " Scripts: ${SCRIPTS_SRC}/"
|
||||||
|
echo " Invoke: /ralph-workplan <workplan-file> [--max-iterations N]"
|
||||||
echo ""
|
echo ""
|
||||||
echo " Restart Claude Code for the skill to appear."
|
echo " Restart Claude Code for the skill to appear."
|
||||||
|
|||||||
Reference in New Issue
Block a user