#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" # shellcheck source=lib.sh source "${SCRIPT_DIR}/lib.sh" if [[ "$#" -ne 2 || "$1" != "--i-reviewed-gpl" ]]; then printf 'Verwendung: %s --i-reviewed-gpl EXPLIZITES_PLUGIN_ZIELVERZEICHNIS\n' "$0" >&2 exit 2 fi destination="$2" [[ -d "${destination}" && ! -L "${destination}" ]] || { printf 'Ziel muss ein vorhandenes echtes Verzeichnis sein: %s\n' "${destination}" >&2 exit 1 } mcp_source="${TOOL_ROOT}/dist/mcp-projectcapture-1.6.1.js" hytale_source="${TOOL_ROOT}/dist/hytale_plugin-0.9.1.js" [[ -f "${mcp_source}" && ! -L "${mcp_source}" ]] || { printf 'MCP-Build fehlt; zuerst scripts/build.sh ausführen.\n' >&2 exit 1 } [[ -f "${hytale_source}" && ! -L "${hytale_source}" ]] || { printf 'Hytale-Plugin fehlt; zuerst scripts/stage-hytale-plugin.sh ausführen.\n' >&2 exit 1 } # Bestehende Dateien werden absichtlich nicht überschrieben. Review/Backup ist # Sache des aufrufenden Installationsschritts. for target in "${destination}/mcp.js" "${destination}/hytale_plugin.js"; do [[ ! -e "${target}" ]] || { printf 'Zieldatei existiert bereits; Installation abgebrochen: %s\n' "${target}" >&2 exit 1 } done cp -- "${mcp_source}" "${destination}/mcp.js" cp -- "${hytale_source}" "${destination}/hytale_plugin.js" printf 'Geprüfte Plugins installiert. Codex-Konfiguration wurde nicht verändert.\n'