fix: copilot-update self-update + copilot-instructions Framework-Sektion immer aktualisieren

- copilot-update.sh: Self-Update (Schritt 1b) via cmp -s + exec
- copilot-update.fish: dasselbe in fish
- copilot-instructions.md Update: Framework-Sektion (vor ---) aus Template,
  Projekt-Sektion (ab ---) bleibt unveraendert
- docs/ADMIN.md: git copilot-update Abschnitt dokumentiert
This commit is contained in:
Conrad Schulz 2026-06-03 09:21:53 +00:00
parent b093ad6c73
commit fa007dbcbc
5 changed files with 97 additions and 27 deletions

View file

@ -104,6 +104,32 @@ git add .copilot-no-tests && git commit -m "chore: disable test check (no test f
---
## Templates in bestehenden Repos aktualisieren (`git copilot-update`)
Nach Änderungen am Setup-Repo können alle Repos mit dem neuesten Stand versorgt werden:
```bash
cd /path/to/any-repo
git copilot-update
```
**Was `git copilot-update` tut:**
| Schritt | Was | Besonderheit |
|---|---|---|
| 0 | Setup-Repo Cache aktualisieren (`~/.copilot-setup/`) | SSH, HTTP-Fallback |
| 1b | **Script selbst aktualisieren** (`~/.local/bin/copilot-update.sh`) | startet neue Version via `exec` |
| 2 | `~/.git-templates/` aktualisieren | Hooks, Docs, History-Template |
| 3 | VS Code Prompt-Dateien aktualisieren | `~/.vscode-server/.../prompts/` |
| 4a | `.git/hooks/pre-commit` aktualisieren | nur wenn Repo vorhanden |
| 4b | `.github/copilot-instructions.md` Framework-Sektion aktualisieren | Projekt-Teil (ab `---`) bleibt unberührt |
> **Wichtig:** Die `.github/copilot-instructions.md` besteht aus zwei Teilen:
> - **Framework-Sektion** (vor `---`): Session-Protokoll, Verbotene Aktionen → wird bei jedem Update überschrieben
> - **Projekt-Sektion** (ab `---`): Stack, Architecture, Conventions → bleibt immer erhalten
---
## Bestehende Repos ausstatten
```bash

View file

@ -105,6 +105,21 @@ Neue Session-Datei für heute angelegt: `2026-06-03_pre-commit-check6-session-pf
---
## Nachtrag: copilot-update.sh Self-Update + Framework-Sektion immer aktualisieren
**Ursache der Probleme in rd13_tile_server:**
1. `~/.local/bin/copilot-update.sh` updated sich nie selbst → war veraltet (post-commit, alte TODO-Logik)
2. `copilot-instructions.md` wurde nur bei TODO-Platzhaltern überschrieben → angepasste Repos bekamen nie Framework-Updates
**Fixes:**
- `copilot-update.sh` + `copilot-update.fish`: Self-Update-Schritt hinzugefügt (Schritt 1b)
- Vergleicht sich mit Cache-Version via `cmp -s`
- Wenn unterschiedlich: kopiert neue Version + startet sich neu mit `exec`
- `copilot-instructions.md`-Update-Logik neu: Framework-Sektion (alles vor `---`) immer aus Template, Projekt-Sektion (ab `---`) bleibt repo-spezifisch
- Einmalig manuell deployed: `cp scripts/copilot-update.sh ~/.local/bin/copilot-update.sh`
---
## Nachtrag: post-commit Git-Block entfernt + Agent-History automatisiert
**Commits:** `2d318f3`, `d9508f7`

View file

@ -8,7 +8,7 @@
## Aktueller Projektstatus
**Letzte Aktualisierung:** 2026-06-03 Agent führt History automatisch vor jedem Commit aus (kein /history-Aufruf nötig)
**Letzte Aktualisierung:** 2026-06-03 copilot-update.sh Self-Update + Framework-Sektion immer aktualisieren
**Phase:** Produktion / stabil wird bei Bedarf erweitert
---

View file

@ -1,10 +1,11 @@
#!/usr/bin/env fish
# copilot-update.fish
# Zieht die neueste Version des Copilot-Setup-Repos und aktualisiert:
# - Dieses Script selbst (~/.local/bin/copilot-update.fish)
# - Globale Git-Templates (~/.git-templates/)
# - VS Code Prompt-Dateien
# - Git-Hooks im aktuellen Repo (pre-commit)
# - .github/copilot-instructions.md (nur wenn noch TODO-Platzhalter enthalten)
# - .github/copilot-instructions.md (Framework-Sektion immer, Projekt-Teil bleibt)
#
# Usage:
# fish ~/.local/bin/copilot-update.fish
@ -52,7 +53,16 @@ end
set SOURCE $CACHE_DIR
# ── 2. Globale Git-Templates aktualisieren ────────────────────────────────────
# ── 1b. Self-update ──────────────────────────────────────────────────────
set SELF $HOME/.local/bin/copilot-update.fish
if test -f $SOURCE/scripts/copilot-update.fish
if not diff -q $SOURCE/scripts/copilot-update.fish $SELF >/dev/null 2>&1
cp $SOURCE/scripts/copilot-update.fish $SELF
chmod +x $SELF
echo " ✓ copilot-update.fish selbst aktualisiert starte neue Version..."
exec fish $SELF $argv
end
end ────────────────────────────────────
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 \
@ -128,18 +138,19 @@ if test $HOOKS_UPDATED -eq 0
echo " ─ Keine Hook-Templates gefunden"
end
# ── 4b. copilot-instructions.md: nur wenn TODO-Platzhalter vorhanden ─────────
# ── 4b. copilot-instructions.md: Framework-Sektion immer aktualisieren ─────────
set COPILOT_INSTRUCTIONS $REPO_ROOT/.github/copilot-instructions.md
set TEMPLATE_INSTRUCTIONS $SOURCE/git-templates/.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)"
if test -f $COPILOT_INSTRUCTIONS; and test -f $TEMPLATE_INSTRUCTIONS
set framework (awk '/^---$/{exit} {print}' $TEMPLATE_INSTRUCTIONS)
set project (awk '/^---$/{found=1} found{print}' $COPILOT_INSTRUCTIONS)
if test -n "$project"
printf '%s\n%s\n' (string join \n $framework) (string join \n $project) > $COPILOT_INSTRUCTIONS
echo " ✓ .github/copilot-instructions.md Framework-Sektion aktualisiert"
else
echo " ─ .github/copilot-instructions.md übersprungen (keine TODOs angepasst)"
cp $TEMPLATE_INSTRUCTIONS $COPILOT_INSTRUCTIONS
echo " ✓ .github/copilot-instructions.md aktualisiert (noch nicht angepasst)"
end
else
echo " ─ .github/copilot-instructions.md nicht vorhanden, übersprungen"

View file

@ -1,10 +1,11 @@
#!/usr/bin/env sh
# copilot-update.sh
# Zieht die neueste Version des Copilot-Setup-Repos und aktualisiert:
# - Dieses Script selbst (~/.local/bin/copilot-update.sh)
# - 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)
# - Git-Hooks im aktuellen Repo (pre-commit)
# - .github/copilot-instructions.md (Framework-Sektion immer, Projekt-Teil bleibt)
#
# Usage:
# copilot-update.sh # aktuelles Verzeichnis (Git-Repo optional)
@ -47,7 +48,16 @@ fi
SOURCE="$CACHE_DIR"
# ── 2. Globale Git-Templates aktualisieren ────────────────────────────────────
# ── 1b. Self-update: dieses Script selbst aktualisieren ─────────────────────
SELF="$HOME/.local/bin/copilot-update.sh"
if [ -f "$SOURCE/scripts/copilot-update.sh" ]; then
if ! cmp -s "$SOURCE/scripts/copilot-update.sh" "$SELF" 2>/dev/null; then
cp "$SOURCE/scripts/copilot-update.sh" "$SELF"
chmod +x "$SELF"
echo " ✓ copilot-update.sh selbst aktualisiert starte neue Version..."
exec "$SELF" "$@"
fi
fi ────────────────────────────────────
GIT_TEMPLATE_DIR="$HOME/.git-templates"
mkdir -p "$GIT_TEMPLATE_DIR/.github" "$GIT_TEMPLATE_DIR/.vscode" \
"$GIT_TEMPLATE_DIR/hooks" "$GIT_TEMPLATE_DIR/docs" \
@ -57,8 +67,7 @@ cp "$SOURCE/git-templates/.github/copilot-instructions.md" "$GIT_TEMPLATE_DIR/.g
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"
chmod +x "$GIT_TEMPLATE_DIR/hooks/pre-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"
@ -111,7 +120,7 @@ HOOKS_DIR="$REPO_ROOT/.git/hooks"
mkdir -p "$HOOKS_DIR"
HOOKS_UPDATED=0
for hook in pre-commit post-commit; do
for hook in pre-commit; do
if [ -f "$SOURCE/git-templates/hooks/$hook" ]; then
cp "$SOURCE/git-templates/hooks/$hook" "$HOOKS_DIR/$hook"
chmod +x "$HOOKS_DIR/$hook"
@ -124,18 +133,27 @@ if [ "$HOOKS_UPDATED" -eq 0 ]; then
echo " ─ Keine Hook-Templates gefunden"
fi
# ── 4b. copilot-instructions.md: nur wenn TODO-Platzhalter vorhanden ─────────
# ── 4b. copilot-instructions.md: Framework-Sektion immer aktualisieren ─────────
# Die Datei besteht aus zwei Teilen:
# 1) Framework-Sektion (bis zum ersten ---): Session-Protokoll, Verbotene Aktionen
# 2) Projekt-Sektion (ab ---): Stack, Architecture, Conventions (repo-spezifisch)
# Der Framework-Teil wird immer aus dem Template aktualisiert.
# Der Projekt-Teil bleibt unverändert.
COPILOT_INSTRUCTIONS="$REPO_ROOT/.github/copilot-instructions.md"
TEMPLATE_INSTRUCTIONS="$SOURCE/git-templates/.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)"
if [ -f "$COPILOT_INSTRUCTIONS" ] && [ -f "$TEMPLATE_INSTRUCTIONS" ]; then
# Framework-Sektion aus Template (alles vor erstem ---)
framework=$(awk '/^---$/{exit} {print}' "$TEMPLATE_INSTRUCTIONS")
# Projekt-Sektion aus Ziel-Datei (ab erstem --- inkl.)
project=$(awk '/^---$/{found=1} found{print}' "$COPILOT_INSTRUCTIONS")
if [ -n "$project" ]; then
printf '%s\n%s\n' "$framework" "$project" > "$COPILOT_INSTRUCTIONS"
echo " ✓ .github/copilot-instructions.md Framework-Sektion aktualisiert"
else
echo " ─ .github/copilot-instructions.md übersprungen (keine TODOs angepasst)"
# Keine Projekt-Sektion vorhanden (noch nicht angepasst) komplett ersetzen
cp "$TEMPLATE_INSTRUCTIONS" "$COPILOT_INSTRUCTIONS"
echo " ✓ .github/copilot-instructions.md aktualisiert (noch nicht angepasst)"
fi
else
echo " ─ .github/copilot-instructions.md nicht vorhanden, übersprungen"