#!/usr/bin/env bash # deploy.sh – Copilot-Setup auf macOS oder Linux mit bash deployen # Usage: bash scripts/deploy.sh set -euo pipefail REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" echo "=== Copilot Setup Deploy (bash) ===" echo "Source: $REPO_DIR" # ── 1. VS Code User-Verzeichnis ermitteln ───────────────────────────────────── if [[ "$OSTYPE" == "darwin"* ]]; then VSCODE_USER="$HOME/Library/Application Support/Code/User" # VS Code Server (Cursor, Codium, etc.) VSCODE_USER_ALT="$HOME/Library/Application Support/Cursor/User" elif [[ -d "$HOME/.vscode-server/data/User" ]]; then # Remote / VS Code Server VSCODE_USER="$HOME/.vscode-server/data/User" else VSCODE_USER="$HOME/.config/Code/User" fi echo "VS Code User dir: $VSCODE_USER" mkdir -p "$VSCODE_USER" # ── 2. User settings.json ───────────────────────────────────────────────────── if [[ -f "$VSCODE_USER/settings.json" ]]; then echo " ─ settings.json exists – skipping (merge manually if needed)" echo " Reference: $REPO_DIR/user-settings/settings.json" else cp "$REPO_DIR/user-settings/settings.json" "$VSCODE_USER/settings.json" echo " ✓ settings.json deployed" fi # ── 3. Prompt Files ─────────────────────────────────────────────────────────── mkdir -p "$VSCODE_USER/prompts" for f in "$REPO_DIR/prompts/"*.prompt.md; do fname="$(basename "$f")" if [[ -f "$VSCODE_USER/prompts/$fname" ]]; then echo " ─ prompts/$fname already exists, skipping" else cp "$f" "$VSCODE_USER/prompts/$fname" echo " ✓ prompts/$fname deployed" fi done # ── 4. Git-Templates ────────────────────────────────────────────────────────── GIT_TEMPLATE_DIR="$HOME/.git-templates" mkdir -p "$GIT_TEMPLATE_DIR/.github" "$GIT_TEMPLATE_DIR/.vscode" cp "$REPO_DIR/git-templates/.github/copilot-instructions.md" "$GIT_TEMPLATE_DIR/.github/" cp "$REPO_DIR/git-templates/.vscode/settings.json" "$GIT_TEMPLATE_DIR/.vscode/" cp "$REPO_DIR/git-templates/.vscode/extensions.json" "$GIT_TEMPLATE_DIR/.vscode/" git config --global init.templateDir "$GIT_TEMPLATE_DIR" echo " ✓ git-templates deployed → $GIT_TEMPLATE_DIR" echo " ✓ git config init.templateDir set" # ── 5. Bootstrap-Skript ─────────────────────────────────────────────────────── mkdir -p "$HOME/.local/bin" cp "$REPO_DIR/scripts/copilot-bootstrap.fish" "$HOME/.local/bin/copilot-bootstrap.fish" chmod +x "$HOME/.local/bin/copilot-bootstrap.fish" echo " ✓ copilot-bootstrap.fish installed to ~/.local/bin/" echo "" echo "=== Done ===" echo "Next: Activate Settings Sync in VS Code (Cmd+Shift+P → 'Settings Sync: Turn On')"