From 2fb2bb5cb8d9058fe75b83b0954b686923ee8fd0 Mon Sep 17 00:00:00 2001 From: tegwick Date: Mon, 16 Mar 2026 00:50:23 +0100 Subject: [PATCH] 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 --- install.sh | 56 ++++++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/install.sh b/install.sh index 9a2dcfe..b7ee568 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/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: # ./install.sh # install @@ -9,26 +9,15 @@ set -euo pipefail PLUGIN_NAME="ralph-workplan" REPO_DIR="$(cd "$(dirname "$0")" && pwd)" -PLUGINS_DIR="${HOME}/.claude/plugins" -INSTALL_PATH="${PLUGINS_DIR}/cache/local/${PLUGIN_NAME}" -REGISTRY="${PLUGINS_DIR}/installed_plugins.json" +COMMANDS_DIR="${HOME}/.claude/commands" +SKILL_FILE="${COMMANDS_DIR}/${PLUGIN_NAME}.md" +SCRIPTS_SRC="${REPO_DIR}/plugin/scripts" # ── Uninstall ────────────────────────────────────────────────────────────────── if [[ "${1:-}" == "--uninstall" ]]; then - if [[ -d "$INSTALL_PATH" ]]; then - rm -rf "$INSTALL_PATH" - echo "Removed: $INSTALL_PATH" - 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 + if [[ -f "$SKILL_FILE" ]]; then + rm -f "$SKILL_FILE" + echo "Removed: $SKILL_FILE" fi echo "✅ Uninstalled: $PLUGIN_NAME" echo " Restart Claude Code to apply." @@ -36,31 +25,18 @@ PY fi # ── Install ──────────────────────────────────────────────────────────────────── -mkdir -p "${INSTALL_PATH}/commands" -mkdir -p "${INSTALL_PATH}/scripts" +mkdir -p "$COMMANDS_DIR" -# Skill file goes in commands/ — that's where Claude Code looks -cp "${REPO_DIR}/plugin/ralph-workplan.md" "${INSTALL_PATH}/commands/ralph-workplan.md" -cp "${REPO_DIR}/plugin/scripts/check-done.sh" "${INSTALL_PATH}/scripts/check-done.sh" -cp "${REPO_DIR}/plugin/scripts/setup.sh" "${INSTALL_PATH}/scripts/setup.sh" +# 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 "${INSTALL_PATH}/scripts/check-done.sh" -chmod +x "${INSTALL_PATH}/scripts/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 +chmod +x "${SCRIPTS_SRC}/check-done.sh" +chmod +x "${SCRIPTS_SRC}/setup.sh" echo "✅ Installed: $PLUGIN_NAME" -echo " Path: $INSTALL_PATH" -echo " Skill: /ralph-workplan [--max-iterations N]" +echo " Skill: $SKILL_FILE" +echo " Scripts: ${SCRIPTS_SRC}/" +echo " Invoke: /ralph-workplan [--max-iterations N]" echo "" echo " Restart Claude Code for the skill to appear."