#!/usr/bin/env bash # install.sh — Knowledge Curator plugin installer # # ./install.sh local # Copy components straight into ~/.claude/ (skills, agents, commands). # Quick path, no marketplace. Restart Claude Code afterwards. # # ./install.sh marketplace /path/to/your/marketplace-repo # Copy the plugin into an existing marketplace repo and add/replace its # entry in /.claude-plugin/marketplace.json (needs jq). Prints the # git + /plugin commands to finish. Does NOT push for you. # set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PLUGIN_DIR="$HERE/knowledge-curator" ENTRY_FILE="$HERE/marketplace-entry.json" MODE="${1:-}" die() { echo "ERROR: $*" >&2; exit 1; } [ -d "$PLUGIN_DIR" ] || die "plugin dir not found: $PLUGIN_DIR" case "$MODE" in local) DEST="${CLAUDE_HOME:-$HOME/.claude}" echo ">> Local install into $DEST" mkdir -p "$DEST/skills" "$DEST/agents" "$DEST/commands" cp -r "$PLUGIN_DIR/skills/." "$DEST/skills/" cp -r "$PLUGIN_DIR/agents/." "$DEST/agents/" cp -r "$PLUGIN_DIR/commands/." "$DEST/commands/" echo ">> Done. Installed:" echo " skill: knowledge-curator" echo " agents: kg-graph-auditor, kg-entity-deduplicator, kg-relation-miner, kg-taxonomy-architect" echo " commands: /kg-curate, /kg-apply" echo ">> Restart Claude Code (or /reload-plugins) so agents & commands load." echo ">> Verify your MCP tool names in agents/*.md if your server isn't named 'memory'." ;; marketplace) REPO="${2:-}" [ -n "$REPO" ] || die "usage: ./install.sh marketplace /path/to/marketplace-repo" [ -d "$REPO" ] || die "marketplace repo not found: $REPO" command -v jq >/dev/null 2>&1 || die "jq is required for marketplace mode (install jq or edit marketplace.json by hand)" echo ">> Copying plugin into $REPO/knowledge-curator" rm -rf "$REPO/knowledge-curator" cp -r "$PLUGIN_DIR" "$REPO/knowledge-curator" MP="$REPO/.claude-plugin/marketplace.json" mkdir -p "$REPO/.claude-plugin" ENTRY="$(cat "$ENTRY_FILE")" if [ -f "$MP" ]; then echo ">> Updating existing marketplace.json" tmp="$(mktemp)" jq --argjson e "$ENTRY" \ '.plugins = ((.plugins // []) | map(select(.name != $e.name)) + [$e])' \ "$MP" > "$tmp" && mv "$tmp" "$MP" else echo ">> Creating new marketplace.json" jq -n --argjson e "$ENTRY" \ '{name:"luki-net", owner:{name:"l.kirchner", url:"https://gitea.luki-net.org/l.kirchner"}, plugins:[$e]}' \ > "$MP" fi echo ">> Done. Next steps:" echo " cd $REPO && git add -A && git commit -m 'add knowledge-curator plugin' && git push" echo " # then in Claude Code:" echo " /plugin marketplace add https://gitea.luki-net.org/l.kirchner/claude-marketplace" echo " /plugin install knowledge-curator@luki-net" ;; *) sed -n '2,16p' "$0" exit 1 ;; esac