feat: copilot-update.sh + git copilot-update alias + post-merge auto-deploy

- scripts/copilot-update.sh: zieht Setup-Repo (SSH+HTTP-Fallback) in ~/.copilot-setup/,
  aktualisiert ~/.git-templates/, VS Code Prompts und repo-lokale Git-Hooks;
  copilot-instructions.md nur bei TODO-Erkennung (mit .bak Backup)
- scripts/copilot-update.fish: Fish-Variante desselben Scripts
- git-templates/hooks/post-merge: opt-in Template-Hook (ruft copilot-update.sh auf)
- scripts/deploy.sh: installiert copilot-update.sh/.fish, setzt 'git copilot-update'
  Alias, installiert post-merge Hook im Setup-Repo selbst (auto-deploy nach git pull)
- scripts/deploy.fish: analog
- scripts/copilot-bootstrap.sh: --with-update-hook Flag + post-commit Hook Installation
This commit is contained in:
Conrad Schulz 2026-06-02 10:36:16 +00:00
parent 4c6fd1331c
commit 0d42b4fb55
7 changed files with 417 additions and 11 deletions

View file

@ -0,0 +1,20 @@
#!/usr/bin/env sh
# post-merge Automatisches Copilot-Update nach git pull (opt-in)
#
# Dieser Hook ruft copilot-update.sh auf wenn es installiert ist.
# So werden Templates und Prompt-Dateien nach jedem 'git pull' automatisch
# auf dem neuesten Stand gehalten.
#
# INSTALLATION (opt-in):
# copilot-bootstrap.sh --with-update-hook
#
# DEINSTALLATION:
# rm .git/hooks/post-merge
UPDATER="$HOME/.local/bin/copilot-update.sh"
if [ -x "$UPDATER" ]; then
echo ""
echo " [post-merge] Copilot-Templates werden aktualisiert..."
"$UPDATER"
fi

View file

@ -8,7 +8,7 @@
## Aktueller Projektstatus ## Aktueller Projektstatus
**Letzte Aktualisierung:** 2026-05-31 Session-History initial angelegt **Letzte Aktualisierung:** 2026-06-02 copilot-update.sh + git copilot-update Alias
**Phase:** Produktion / stabil wird bei Bedarf erweitert **Phase:** Produktion / stabil wird bei Bedarf erweitert
--- ---
@ -29,6 +29,7 @@ Quality Gate aus.
| Datum | Aufgabe | Ergebnis | Entscheidungen | | Datum | Aufgabe | Ergebnis | Entscheidungen |
|---|---|---|---| |---|---|---|---|
| 2026-06-02 | copilot-update.sh + git alias + post-merge Hook | `scripts/copilot-update.sh`, `scripts/copilot-update.fish`, `git-templates/hooks/post-merge` | SSH+HTTP-Fallback; opt-in Update-Hook; copilot-instructions.md nur bei TODO überschreiben |
| 2026-05-31 | Bug fix: mkdir -p .git/hooks + eigenes Repo bootstrapped | `e1f912f` | | | 2026-05-31 | Bug fix: mkdir -p .git/hooks + eigenes Repo bootstrapped | `e1f912f` | |
| 2026-05-31 | history/prompts/ committed statt gitignored | `95d0360` | Vollständige History bleibt im Repo | | 2026-05-31 | history/prompts/ committed statt gitignored | `95d0360` | Vollständige History bleibt im Repo |
| 2026-05-30 | Initiale Erweiterungen: data/, history/, hooks, 3-Zielgruppen-Docs | `045e2e7` | Nur data/ gitignored | | 2026-05-30 | Initiale Erweiterungen: data/, history/, hooks, 3-Zielgruppen-Docs | `045e2e7` | Nur data/ gitignored |
@ -39,7 +40,7 @@ Quality Gate aus.
## Offene Aufgaben & bekannte Probleme ## Offene Aufgaben & bekannte Probleme
- [ ] `.github/copilot-instructions.md` TODO-Felder ausfüllen (Stack, Architecture, NFRs dieses Repos) - [ ] `.github/copilot-instructions.md` TODO-Felder ausfüllen (Stack, Architecture, NFRs dieses Repos)
- [ ] Bei Änderungen an `git-templates/` immer `deploy.sh` neu ausführen damit die Templates in `~/.git-templates/` aktuell sind - [ ] Bei Änderungen an `git-templates/` immer `deploy.sh` neu ausführen (oder `git copilot-update` in einem anderen Repo zum Testen)
--- ---
@ -47,6 +48,10 @@ Quality Gate aus.
| Entscheidung | Begründung | Wo dokumentiert | | Entscheidung | Begründung | Wo dokumentiert |
|---|---|---| |---|---|---|
| `copilot-update.sh` mit SSH+HTTP-Fallback | Funktioniert ohne SSH-Key-Setup auf neuen Maschinen | `scripts/copilot-update.sh` |
| `copilot-instructions.md` nur bei TODO überschreiben | User-Content bleibt erhalten; Backup `.bak` wird erstellt | `scripts/copilot-update.sh` |
| post-merge Hook in bootstrapped Repos: opt-in | Kein Overhead bei jedem `git pull` in anderen Repos | `scripts/copilot-bootstrap.sh --with-update-hook` |
| Setup-Repo selbst: post-merge Hook auto-installed | `deploy.sh` nach jedem `git pull` auf Setup-Repo | `scripts/deploy.sh` Block 7 |
| `history/prompts/` committed | Lückenlose Projekt-History im Repo | `docs/MAINTAINER.md` | | `history/prompts/` committed | Lückenlose Projekt-History im Repo | `docs/MAINTAINER.md` |
| `data/` gitignored | Persistente Daten: Größe + Sicherheit | `docs/ADMIN.md` | | `data/` gitignored | Persistente Daten: Größe + Sicherheit | `docs/ADMIN.md` |
| POSIX sh für Bootstrap | Läuft überall ohne Abhängigkeiten | `docs/MAINTAINER.md` | | POSIX sh für Bootstrap | Läuft überall ohne Abhängigkeiten | `docs/MAINTAINER.md` |
@ -62,6 +67,9 @@ Quality Gate aus.
- **Dieser Kontext:** `/history/summary/PROJECT_CONTEXT.md` (committed) - **Dieser Kontext:** `/history/summary/PROJECT_CONTEXT.md` (committed)
- **Deploy:** `bash scripts/deploy.sh` oder `fish scripts/deploy.fish` - **Deploy:** `bash scripts/deploy.sh` oder `fish scripts/deploy.fish`
- **Bootstrap einzelnes Repo:** `sh ~/.local/bin/copilot-bootstrap.sh [/pfad/zum/repo]` - **Bootstrap einzelnes Repo:** `sh ~/.local/bin/copilot-bootstrap.sh [/pfad/zum/repo]`
- **Bootstrap mit Auto-Update-Hook:** `sh ~/.local/bin/copilot-bootstrap.sh --with-update-hook [/pfad]`
- **Templates updaten (global + repo-lokal):** `git copilot-update` (in jedem Repo)
- **Setup-Repo Cache:** `~/.copilot-setup/` (überschreibbar mit `COPILOT_SETUP_DIR=...`)
- **Git-Templates:** `~/.git-templates/` (nach Deploy) - **Git-Templates:** `~/.git-templates/` (nach Deploy)
- **Prompts:** `~/.vscode-server/data/User/prompts/` (nach Deploy) - **Prompts:** `~/.vscode-server/data/User/prompts/` (nach Deploy)

View file

@ -4,11 +4,21 @@
# POSIX-kompatibel: läuft auf bash, dash, sh kein fish nötig. # POSIX-kompatibel: läuft auf bash, dash, sh kein fish nötig.
# #
# Usage: # Usage:
# copilot-bootstrap.sh # aktuelles Verzeichnis # copilot-bootstrap.sh # aktuelles Verzeichnis
# copilot-bootstrap.sh /path/to/repo # anderes Verzeichnis # copilot-bootstrap.sh /path/to/repo # anderes Verzeichnis
# copilot-bootstrap.sh --with-update-hook # + post-merge Hook (auto-update nach git pull)
TEMPLATE_DIR="$HOME/.git-templates" TEMPLATE_DIR="$HOME/.git-templates"
TARGET="${1:-.}" WITH_UPDATE_HOOK=0
TARGET="."
for arg in "$@"; do
case "$arg" in
--with-update-hook) WITH_UPDATE_HOOK=1 ;;
-*) ;;
*) TARGET="$arg" ;;
esac
done
if [ ! -d "$TARGET/.git" ]; then if [ ! -d "$TARGET/.git" ]; then
echo "Error: $TARGET is not a git repository" >&2 echo "Error: $TARGET is not a git repository" >&2
@ -85,15 +95,33 @@ else
done done
fi fi
# ── pre-commit Hook Agent Quality Gate ───────────────────────────────────── # ── Git-Hooks Quality Gate + History ───────────────────────────────────────
mkdir -p "$TARGET/.git/hooks"
if [ ! -f "$TARGET/.git/hooks/pre-commit" ]; then if [ ! -f "$TARGET/.git/hooks/pre-commit" ]; then
mkdir -p "$TARGET/.git/hooks"
cp "$TEMPLATE_DIR/hooks/pre-commit" "$TARGET/.git/hooks/pre-commit" cp "$TEMPLATE_DIR/hooks/pre-commit" "$TARGET/.git/hooks/pre-commit"
chmod +x "$TARGET/.git/hooks/pre-commit" chmod +x "$TARGET/.git/hooks/pre-commit"
echo " ✓ .git/hooks/pre-commit installed (Quality Gate: Tests + Docs)" echo " ✓ .git/hooks/pre-commit installed (Quality Gate: Tests + Docs)"
else else
echo " ─ .git/hooks/pre-commit already exists, skipping" echo " ─ .git/hooks/pre-commit already exists, skipping"
fi fi
if [ ! -f "$TARGET/.git/hooks/post-commit" ] && [ -f "$TEMPLATE_DIR/hooks/post-commit" ]; then
cp "$TEMPLATE_DIR/hooks/post-commit" "$TARGET/.git/hooks/post-commit"
chmod +x "$TARGET/.git/hooks/post-commit"
echo " ✓ .git/hooks/post-commit installed (Auto-History-Log)"
fi
# ── post-merge Hook opt-in: automatisches copilot-update nach git pull ──────
if [ "$WITH_UPDATE_HOOK" -eq 1 ]; then
if [ -f "$TEMPLATE_DIR/hooks/post-merge" ]; then
if [ ! -f "$TARGET/.git/hooks/post-merge" ]; then
cp "$TEMPLATE_DIR/hooks/post-merge" "$TARGET/.git/hooks/post-merge"
chmod +x "$TARGET/.git/hooks/post-merge"
echo " ✓ .git/hooks/post-merge installed (Copilot-Update nach git pull)"
else
echo " ─ .git/hooks/post-merge already exists, skipping"
fi
fi
fi
# ── .gitignore data/ ausschließen ───────────────────────────────────────── # ── .gitignore data/ ausschließen ─────────────────────────────────────────
GITIGNORE="$TARGET/.gitignore" GITIGNORE="$TARGET/.gitignore"
@ -123,3 +151,4 @@ echo " - history/summary/PROJECT_CONTEXT.md"
echo " - docs/USER.md, docs/ADMIN.md, docs/MAINTAINER.md" echo " - docs/USER.md, docs/ADMIN.md, docs/MAINTAINER.md"
echo " 2. git add .github .vscode docs history .gitignore" echo " 2. git add .github .vscode docs history .gitignore"
echo " git commit -m 'chore: add copilot workspace config'" echo " git commit -m 'chore: add copilot workspace config'"
echo " 3. Templates aktuell halten: git copilot-update"

151
scripts/copilot-update.fish Normal file
View file

@ -0,0 +1,151 @@
#!/usr/bin/env fish
# copilot-update.fish
# Zieht die neueste Version des Copilot-Setup-Repos und aktualisiert:
# - Globale Git-Templates (~/.git-templates/)
# - VS Code Prompt-Dateien
# - Git-Hooks im aktuellen Repo (pre-commit, post-commit)
# - .github/copilot-instructions.md (nur wenn noch TODO-Platzhalter enthalten)
#
# Usage:
# fish ~/.local/bin/copilot-update.fish
# git copilot-update (via Alias, ruft copilot-update.sh auf)
set SETUP_REPO_SSH "ssh://git@192.168.178.6:2222/cschulz/rd13_copilot_setup.git"
set SETUP_REPO_HTTP "http://192.168.178.6:8083/cschulz/rd13_copilot_setup.git"
if set -q COPILOT_SETUP_DIR
set CACHE_DIR $COPILOT_SETUP_DIR
else
set CACHE_DIR $HOME/.copilot-setup
end
echo "=== Copilot Update ==="
# ── 1. Setup-Repo Cache aktuell halten ───────────────────────────────────────
if test -d $CACHE_DIR/.git
echo " → Pulling latest from setup repo..."
if git -C $CACHE_DIR pull --ff-only --quiet 2>/dev/null
echo " ✓ Cache aktualisiert: $CACHE_DIR"
else
echo " ✗ git pull fehlgeschlagen versuche neu zu klonen..."
rm -rf $CACHE_DIR
end
end
if not test -d $CACHE_DIR/.git
echo " → Klone Setup-Repo (SSH)..."
if git clone --quiet $SETUP_REPO_SSH $CACHE_DIR 2>/dev/null
echo " ✓ Geklont via SSH"
else
echo " ✗ SSH fehlgeschlagen versuche HTTP-Fallback..."
if git clone --quiet $SETUP_REPO_HTTP $CACHE_DIR 2>/dev/null
echo " ✓ Geklont via HTTP"
else
echo ""
echo " ✗ FEHLER: Setup-Repo nicht erreichbar."
echo " SSH: $SETUP_REPO_SSH"
echo " HTTP: $SETUP_REPO_HTTP"
exit 1
end
end
end
set SOURCE $CACHE_DIR
# ── 2. Globale Git-Templates aktualisieren ────────────────────────────────────
set GIT_TEMPLATE_DIR $HOME/.git-templates
mkdir -p $GIT_TEMPLATE_DIR/.github $GIT_TEMPLATE_DIR/.vscode \
$GIT_TEMPLATE_DIR/hooks $GIT_TEMPLATE_DIR/docs \
$GIT_TEMPLATE_DIR/history/summary
cp $SOURCE/git-templates/.github/copilot-instructions.md $GIT_TEMPLATE_DIR/.github/
cp $SOURCE/git-templates/.vscode/settings.json $GIT_TEMPLATE_DIR/.vscode/
cp $SOURCE/git-templates/.vscode/extensions.json $GIT_TEMPLATE_DIR/.vscode/
cp $SOURCE/git-templates/hooks/pre-commit $GIT_TEMPLATE_DIR/hooks/
cp $SOURCE/git-templates/hooks/post-commit $GIT_TEMPLATE_DIR/hooks/
chmod +x $GIT_TEMPLATE_DIR/hooks/pre-commit $GIT_TEMPLATE_DIR/hooks/post-commit
if test -f $SOURCE/git-templates/hooks/post-merge
cp $SOURCE/git-templates/hooks/post-merge $GIT_TEMPLATE_DIR/hooks/
chmod +x $GIT_TEMPLATE_DIR/hooks/post-merge
end
cp $SOURCE/git-templates/docs/USER.md $GIT_TEMPLATE_DIR/docs/
cp $SOURCE/git-templates/docs/ADMIN.md $GIT_TEMPLATE_DIR/docs/
cp $SOURCE/git-templates/docs/MAINTAINER.md $GIT_TEMPLATE_DIR/docs/
cp $SOURCE/git-templates/history/summary/PROJECT_CONTEXT.md $GIT_TEMPLATE_DIR/history/summary/
echo " ✓ ~/.git-templates/ aktualisiert"
# ── 3. VS Code Prompt-Dateien aktualisieren ───────────────────────────────────
if test -d $HOME/.vscode-server/data/User
set VSCODE_USER $HOME/.vscode-server/data/User
else if test -d "$HOME/Library/Application Support/Code/User"
set VSCODE_USER "$HOME/Library/Application Support/Code/User"
else
set VSCODE_USER $HOME/.config/Code/User
end
if test -d $VSCODE_USER
mkdir -p $VSCODE_USER/prompts
set PROMPTS_UPDATED 0
for f in $SOURCE/prompts/*.prompt.md
set fname (basename $f)
cp $f $VSCODE_USER/prompts/$fname
set PROMPTS_UPDATED (math $PROMPTS_UPDATED + 1)
end
echo "$PROMPTS_UPDATED Prompt-Dateien aktualisiert → $VSCODE_USER/prompts/"
else
echo " ─ VS Code User-Verzeichnis nicht gefunden, Prompts übersprungen"
end
# ── 4. Repo-lokale Updates (nur wenn in einem Git-Repo) ──────────────────────
set REPO_ROOT (git rev-parse --show-toplevel 2>/dev/null)
if test -z "$REPO_ROOT"
echo ""
echo " ─ Kein Git-Repo erkannt repo-lokale Updates übersprungen"
echo ""
echo "=== Done ==="
exit 0
end
echo ""
echo " Git-Repo erkannt: $REPO_ROOT"
# ── 4a. Git-Hooks aktualisieren ───────────────────────────────────────────────
set HOOKS_DIR $REPO_ROOT/.git/hooks
mkdir -p $HOOKS_DIR
set HOOKS_UPDATED 0
for hook in pre-commit post-commit
if test -f $SOURCE/git-templates/hooks/$hook
cp $SOURCE/git-templates/hooks/$hook $HOOKS_DIR/$hook
chmod +x $HOOKS_DIR/$hook
set HOOKS_UPDATED (math $HOOKS_UPDATED + 1)
echo " ✓ .git/hooks/$hook aktualisiert"
end
end
if test $HOOKS_UPDATED -eq 0
echo " ─ Keine Hook-Templates gefunden"
end
# ── 4b. copilot-instructions.md: nur wenn TODO-Platzhalter vorhanden ─────────
set COPILOT_INSTRUCTIONS $REPO_ROOT/.github/copilot-instructions.md
if test -f $COPILOT_INSTRUCTIONS
if grep -q "TODO" $COPILOT_INSTRUCTIONS 2>/dev/null
set BACKUP $COPILOT_INSTRUCTIONS.bak
cp $COPILOT_INSTRUCTIONS $BACKUP
cp $SOURCE/git-templates/.github/copilot-instructions.md $COPILOT_INSTRUCTIONS
echo " ✓ .github/copilot-instructions.md aktualisiert"
echo " (Backup: .github/copilot-instructions.md.bak)"
else
echo " ─ .github/copilot-instructions.md übersprungen (keine TODOs angepasst)"
end
else
echo " ─ .github/copilot-instructions.md nicht vorhanden, übersprungen"
end
echo ""
echo "=== Done ==="
echo "Tipp: 'git copilot-update' jederzeit ausführen um Templates aktuell zu halten."

146
scripts/copilot-update.sh Normal file
View file

@ -0,0 +1,146 @@
#!/usr/bin/env sh
# copilot-update.sh
# Zieht die neueste Version des Copilot-Setup-Repos und aktualisiert:
# - Globale Git-Templates (~/.git-templates/)
# - VS Code Prompt-Dateien
# - Git-Hooks im aktuellen Repo (pre-commit, post-commit)
# - .github/copilot-instructions.md (nur wenn noch TODO-Platzhalter enthalten)
#
# Usage:
# copilot-update.sh # aktuelles Verzeichnis (Git-Repo optional)
# git copilot-update # via Git-Alias
SETUP_REPO_SSH="ssh://git@192.168.178.6:2222/cschulz/rd13_copilot_setup.git"
SETUP_REPO_HTTP="http://192.168.178.6:8083/cschulz/rd13_copilot_setup.git"
CACHE_DIR="${COPILOT_SETUP_DIR:-$HOME/.copilot-setup}"
echo "=== Copilot Update ==="
# ── 1. Setup-Repo Cache aktuell halten ───────────────────────────────────────
if [ -d "$CACHE_DIR/.git" ]; then
echo " → Pulling latest from setup repo..."
if git -C "$CACHE_DIR" pull --ff-only --quiet 2>/dev/null; then
echo " ✓ Cache aktualisiert: $CACHE_DIR"
else
echo " ✗ git pull fehlgeschlagen versuche neu zu klonen..."
rm -rf "$CACHE_DIR"
fi
fi
if [ ! -d "$CACHE_DIR/.git" ]; then
echo " → Klone Setup-Repo (SSH)..."
if git clone --quiet "$SETUP_REPO_SSH" "$CACHE_DIR" 2>/dev/null; then
echo " ✓ Geklont via SSH"
else
echo " ✗ SSH fehlgeschlagen versuche HTTP-Fallback..."
if git clone --quiet "$SETUP_REPO_HTTP" "$CACHE_DIR" 2>/dev/null; then
echo " ✓ Geklont via HTTP"
else
echo ""
echo " ✗ FEHLER: Setup-Repo nicht erreichbar."
echo " SSH: $SETUP_REPO_SSH"
echo " HTTP: $SETUP_REPO_HTTP"
exit 1
fi
fi
fi
SOURCE="$CACHE_DIR"
# ── 2. Globale Git-Templates aktualisieren ────────────────────────────────────
GIT_TEMPLATE_DIR="$HOME/.git-templates"
mkdir -p "$GIT_TEMPLATE_DIR/.github" "$GIT_TEMPLATE_DIR/.vscode" \
"$GIT_TEMPLATE_DIR/hooks" "$GIT_TEMPLATE_DIR/docs" \
"$GIT_TEMPLATE_DIR/history/summary"
cp "$SOURCE/git-templates/.github/copilot-instructions.md" "$GIT_TEMPLATE_DIR/.github/"
cp "$SOURCE/git-templates/.vscode/settings.json" "$GIT_TEMPLATE_DIR/.vscode/"
cp "$SOURCE/git-templates/.vscode/extensions.json" "$GIT_TEMPLATE_DIR/.vscode/"
cp "$SOURCE/git-templates/hooks/pre-commit" "$GIT_TEMPLATE_DIR/hooks/"
cp "$SOURCE/git-templates/hooks/post-commit" "$GIT_TEMPLATE_DIR/hooks/"
chmod +x "$GIT_TEMPLATE_DIR/hooks/pre-commit" "$GIT_TEMPLATE_DIR/hooks/post-commit"
if [ -f "$SOURCE/git-templates/hooks/post-merge" ]; then
cp "$SOURCE/git-templates/hooks/post-merge" "$GIT_TEMPLATE_DIR/hooks/"
chmod +x "$GIT_TEMPLATE_DIR/hooks/post-merge"
fi
cp "$SOURCE/git-templates/docs/USER.md" "$GIT_TEMPLATE_DIR/docs/"
cp "$SOURCE/git-templates/docs/ADMIN.md" "$GIT_TEMPLATE_DIR/docs/"
cp "$SOURCE/git-templates/docs/MAINTAINER.md" "$GIT_TEMPLATE_DIR/docs/"
cp "$SOURCE/git-templates/history/summary/PROJECT_CONTEXT.md" "$GIT_TEMPLATE_DIR/history/summary/"
echo " ✓ ~/.git-templates/ aktualisiert"
# ── 3. VS Code Prompt-Dateien aktualisieren ───────────────────────────────────
if [ -d "$HOME/.vscode-server/data/User" ]; then
VSCODE_USER="$HOME/.vscode-server/data/User"
elif [ -d "$HOME/Library/Application Support/Code/User" ]; then
VSCODE_USER="$HOME/Library/Application Support/Code/User"
else
VSCODE_USER="$HOME/.config/Code/User"
fi
if [ -d "$VSCODE_USER" ]; then
mkdir -p "$VSCODE_USER/prompts"
PROMPTS_UPDATED=0
for f in "$SOURCE/prompts/"*.prompt.md; do
fname="$(basename "$f")"
cp "$f" "$VSCODE_USER/prompts/$fname"
PROMPTS_UPDATED=$((PROMPTS_UPDATED + 1))
done
echo "$PROMPTS_UPDATED Prompt-Dateien aktualisiert → $VSCODE_USER/prompts/"
else
echo " ─ VS Code User-Verzeichnis nicht gefunden, Prompts übersprungen"
fi
# ── 4. Repo-lokale Updates (nur wenn in einem Git-Repo) ──────────────────────
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
if [ -z "$REPO_ROOT" ]; then
echo ""
echo " ─ Kein Git-Repo erkannt repo-lokale Updates übersprungen"
echo ""
echo "=== Done ==="
exit 0
fi
echo ""
echo " Git-Repo erkannt: $REPO_ROOT"
# ── 4a. Git-Hooks aktualisieren ───────────────────────────────────────────────
HOOKS_DIR="$REPO_ROOT/.git/hooks"
mkdir -p "$HOOKS_DIR"
HOOKS_UPDATED=0
for hook in pre-commit post-commit; do
if [ -f "$SOURCE/git-templates/hooks/$hook" ]; then
cp "$SOURCE/git-templates/hooks/$hook" "$HOOKS_DIR/$hook"
chmod +x "$HOOKS_DIR/$hook"
HOOKS_UPDATED=$((HOOKS_UPDATED + 1))
echo " ✓ .git/hooks/$hook aktualisiert"
fi
done
if [ "$HOOKS_UPDATED" -eq 0 ]; then
echo " ─ Keine Hook-Templates gefunden"
fi
# ── 4b. copilot-instructions.md: nur wenn TODO-Platzhalter vorhanden ─────────
COPILOT_INSTRUCTIONS="$REPO_ROOT/.github/copilot-instructions.md"
if [ -f "$COPILOT_INSTRUCTIONS" ]; then
if grep -q "TODO" "$COPILOT_INSTRUCTIONS" 2>/dev/null; then
BACKUP="${COPILOT_INSTRUCTIONS}.bak"
cp "$COPILOT_INSTRUCTIONS" "$BACKUP"
cp "$SOURCE/git-templates/.github/copilot-instructions.md" "$COPILOT_INSTRUCTIONS"
echo " ✓ .github/copilot-instructions.md aktualisiert"
echo " (Backup: .github/copilot-instructions.md.bak)"
else
echo " ─ .github/copilot-instructions.md übersprungen (keine TODOs angepasst)"
fi
else
echo " ─ .github/copilot-instructions.md nicht vorhanden, übersprungen"
fi
echo ""
echo "=== Done ==="
echo "Tipp: 'git copilot-update' jederzeit ausführen um Templates aktuell zu halten."

View file

@ -62,7 +62,7 @@ git config --global init.templateDir $GIT_TEMPLATE_DIR
echo " ✓ git-templates deployed → $GIT_TEMPLATE_DIR" echo " ✓ git-templates deployed → $GIT_TEMPLATE_DIR"
echo " ✓ git config init.templateDir set" echo " ✓ git config init.templateDir set"
# ── 5. Bootstrap-Skripte ────────────────────────────────────────────────────── # ── 5. Bootstrap- & Update-Skripte ───────────────────────────────────────────
mkdir -p $HOME/.local/bin mkdir -p $HOME/.local/bin
cp $REPO_DIR/scripts/copilot-bootstrap.sh $HOME/.local/bin/copilot-bootstrap.sh cp $REPO_DIR/scripts/copilot-bootstrap.sh $HOME/.local/bin/copilot-bootstrap.sh
chmod +x $HOME/.local/bin/copilot-bootstrap.sh chmod +x $HOME/.local/bin/copilot-bootstrap.sh
@ -70,12 +70,36 @@ echo " ✓ copilot-bootstrap.sh installed to ~/.local/bin/"
cp $REPO_DIR/scripts/copilot-bootstrap.fish $HOME/.local/bin/copilot-bootstrap.fish cp $REPO_DIR/scripts/copilot-bootstrap.fish $HOME/.local/bin/copilot-bootstrap.fish
chmod +x $HOME/.local/bin/copilot-bootstrap.fish chmod +x $HOME/.local/bin/copilot-bootstrap.fish
echo " ✓ copilot-bootstrap.fish installed to ~/.local/bin/" echo " ✓ copilot-bootstrap.fish installed to ~/.local/bin/"
cp $REPO_DIR/scripts/copilot-update.sh $HOME/.local/bin/copilot-update.sh
chmod +x $HOME/.local/bin/copilot-update.sh
echo " ✓ copilot-update.sh installed to ~/.local/bin/"
if test -f $REPO_DIR/scripts/copilot-update.fish
cp $REPO_DIR/scripts/copilot-update.fish $HOME/.local/bin/copilot-update.fish
chmod +x $HOME/.local/bin/copilot-update.fish
echo " ✓ copilot-update.fish installed to ~/.local/bin/"
end
# ── 6. Git-Alias: git init → auto-bootstrap ─────────────────────────────────── # ── 6. Git-Aliase: init → auto-bootstrap | copilot-update → updater ──────────
# Verwendet git --exec-path um Rekursion zu vermeiden (kein Alias-Loop). # Verwendet git --exec-path um Rekursion zu vermeiden (kein Alias-Loop).
git config --global alias.init '!f() { dir=.; for a in "$@"; do case "$a" in -*) ;; *) dir="$a" ;; esac; done; "$(git --exec-path)/git-init" "$@" && "$HOME/.local/bin/copilot-bootstrap.sh" "$dir"; }; f' git config --global alias.init '!f() { dir=.; for a in "$@"; do case "$a" in -*) ;; *) dir="$a" ;; esac; done; "$(git --exec-path)/git-init" "$@" && "$HOME/.local/bin/copilot-bootstrap.sh" "$dir"; }; f'
echo " ✓ git alias 'init' gesetzt (führt copilot-bootstrap.sh automatisch aus)" echo " ✓ git alias 'init' gesetzt (führt copilot-bootstrap.sh automatisch aus)"
git config --global alias.copilot-update '!~/.local/bin/copilot-update.sh'
echo " ✓ git alias 'copilot-update' gesetzt (aktualisiert Templates & Prompts)"
# ── 7. post-merge Hook für dieses Setup-Repo ─────────────────────────────────
set SELF_HOOKS_DIR $REPO_DIR/.git/hooks
if test -d $SELF_HOOKS_DIR
echo '#!/usr/bin/env sh
# post-merge Auto-Deploy nach git pull auf dem Setup-Repo
echo ""
echo " [post-merge] Setup-Repo aktualisiert deploye Templates neu..."
SCRIPT_DIR="$(cd "$(dirname "$0")/../../scripts" && pwd)"
bash "$SCRIPT_DIR/deploy.sh"' > $SELF_HOOKS_DIR/post-merge
chmod +x $SELF_HOOKS_DIR/post-merge
echo " ✓ post-merge Hook im Setup-Repo installiert (auto-deploy nach git pull)"
end
echo "" echo ""
echo "=== Done ===" echo "=== Done ==="
echo "Next: Activate Settings Sync in VS Code (Ctrl+Shift+P → 'Settings Sync: Turn On')" echo "Next: Activate Settings Sync in VS Code (Ctrl+Shift+P → 'Settings Sync: Turn On')"
echo " Templates aktuell halten: git copilot-update (in jedem Repo)"

View file

@ -62,7 +62,7 @@ git config --global init.templateDir "$GIT_TEMPLATE_DIR"
echo " ✓ git-templates deployed → $GIT_TEMPLATE_DIR" echo " ✓ git-templates deployed → $GIT_TEMPLATE_DIR"
echo " ✓ git config init.templateDir set" echo " ✓ git config init.templateDir set"
# ── 5. Bootstrap-Skripte ───────────────────────────────────────────────────── # ── 5. Bootstrap- & Update-Skripte ───────────────────────────────────────────
mkdir -p "$HOME/.local/bin" mkdir -p "$HOME/.local/bin"
cp "$REPO_DIR/scripts/copilot-bootstrap.sh" "$HOME/.local/bin/copilot-bootstrap.sh" cp "$REPO_DIR/scripts/copilot-bootstrap.sh" "$HOME/.local/bin/copilot-bootstrap.sh"
chmod +x "$HOME/.local/bin/copilot-bootstrap.sh" chmod +x "$HOME/.local/bin/copilot-bootstrap.sh"
@ -72,12 +72,40 @@ if [[ -f "$REPO_DIR/scripts/copilot-bootstrap.fish" ]]; then
chmod +x "$HOME/.local/bin/copilot-bootstrap.fish" chmod +x "$HOME/.local/bin/copilot-bootstrap.fish"
echo " ✓ copilot-bootstrap.fish installed to ~/.local/bin/" echo " ✓ copilot-bootstrap.fish installed to ~/.local/bin/"
fi fi
cp "$REPO_DIR/scripts/copilot-update.sh" "$HOME/.local/bin/copilot-update.sh"
chmod +x "$HOME/.local/bin/copilot-update.sh"
echo " ✓ copilot-update.sh installed to ~/.local/bin/"
if [[ -f "$REPO_DIR/scripts/copilot-update.fish" ]]; then
cp "$REPO_DIR/scripts/copilot-update.fish" "$HOME/.local/bin/copilot-update.fish"
chmod +x "$HOME/.local/bin/copilot-update.fish"
echo " ✓ copilot-update.fish installed to ~/.local/bin/"
fi
# ── 6. Git-Alias: git init → auto-bootstrap ────────────────────────────────── # ── 6. Git-Aliase: init → auto-bootstrap | copilot-update → updater ──────────
# Verwendet git --exec-path um Rekursion zu vermeiden (kein Alias-Loop). # Verwendet git --exec-path um Rekursion zu vermeiden (kein Alias-Loop).
git config --global alias.init '!f() { dir=.; for a in "$@"; do case "$a" in -*) ;; *) dir="$a" ;; esac; done; "$(git --exec-path)/git-init" "$@" && "$HOME/.local/bin/copilot-bootstrap.sh" "$dir"; }; f' git config --global alias.init '!f() { dir=.; for a in "$@"; do case "$a" in -*) ;; *) dir="$a" ;; esac; done; "$(git --exec-path)/git-init" "$@" && "$HOME/.local/bin/copilot-bootstrap.sh" "$dir"; }; f'
echo " ✓ git alias 'init' gesetzt (führt copilot-bootstrap.sh automatisch aus)" echo " ✓ git alias 'init' gesetzt (führt copilot-bootstrap.sh automatisch aus)"
git config --global alias.copilot-update '!~/.local/bin/copilot-update.sh'
echo " ✓ git alias 'copilot-update' gesetzt (aktualisiert Templates & Prompts)"
# ── 7. post-merge Hook für dieses Setup-Repo ─────────────────────────────────
# Nach jedem 'git pull' auf dem Setup-Repo selbst wird deploy.sh automatisch
# ausgeführt, sodass Templates immer auf dem neuesten Stand sind.
SELF_HOOKS_DIR="$REPO_DIR/.git/hooks"
if [[ -d "$SELF_HOOKS_DIR" ]]; then
cat > "$SELF_HOOKS_DIR/post-merge" << 'HOOK'
#!/usr/bin/env sh
# post-merge Auto-Deploy nach git pull auf dem Setup-Repo
echo ""
echo " [post-merge] Setup-Repo aktualisiert deploye Templates neu..."
SCRIPT_DIR="$(cd "$(dirname "$0")/../../scripts" && pwd)"
bash "$SCRIPT_DIR/deploy.sh"
HOOK
chmod +x "$SELF_HOOKS_DIR/post-merge"
echo " ✓ post-merge Hook im Setup-Repo installiert (auto-deploy nach git pull)"
fi
echo "" echo ""
echo "=== Done ===" echo "=== Done ==="
echo "Next: Activate Settings Sync in VS Code (Cmd+Shift+P → 'Settings Sync: Turn On')" echo "Next: Activate Settings Sync in VS Code (Cmd+Shift+P → 'Settings Sync: Turn On')"
echo " Templates aktuell halten: git copilot-update (in jedem Repo)"