diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 763645b..a95641e 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -41,6 +41,23 @@ - **`git push --force`** – Nie force-pushen ohne explizite Anweisung des Users. - **Secrets in Code** – Keine Passwörter, API-Keys, Tokens in Dateien. +## ⚠ Bekannte Fallstricke (nicht vergessen!) + +- **Scripts mit Self-Update (`copilot-update.sh/.fish`) immer erst committen+pushen, DANN manuell deployen.** + Reihenfolge zwingend: + 1. Änderung im Repo vornehmen + 2. `git add … && git commit && git push` + 3. `cp scripts/copilot-update.sh ~/.local/bin/copilot-update.sh` + 4. Testen + Falsche Reihenfolge (erst deployen, dann committen) → Self-Update überschreibt den manuell deployten Fix + mit der alten Version aus dem Remote-Cache. Der Fix geht verloren. + +- **`fi ───` oder `end ───` in POSIX-sh/fish:** Box-Drawing-Zeichen nie direkt ans `fi`/`end` anhängen. + Kommentar-Trennlinie immer auf eigener Zeile: `# ── Abschnitt ──` + +- **`printf '%s\n%s\n'` frisst trailing newlines** aus `$(awk ...)` Substitution. + Wenn eine Leerzeile zwischen zwei Blöcken erhalten bleiben soll: `printf '%s\n\n%s\n'` verwenden. + --- ## Project diff --git a/docs/MAINTAINER.md b/docs/MAINTAINER.md index fd9df4d..09d579c 100644 --- a/docs/MAINTAINER.md +++ b/docs/MAINTAINER.md @@ -135,3 +135,4 @@ Dateien unter `git-templates/` bearbeiten → `deploy.sh` ausführen → neue Re |---|---|---| | `Syntax error: word unexpected` in `copilot-update.sh` Zeile ~60 | Box-Drawing-Zeichen (`────`) direkt ans `fi` angehängt statt auf eigener Zeile | `fi` allein auf Zeile, Kommentar-Linie separat (`# ──`) | | Self-Update überschreibt manuell deployten Fix | Self-Update holt Version aus Remote-Cache, der noch kaputten Stand hat | Erst committen + pushen, dann manuell deployen: `cp scripts/copilot-update.sh ~/.local/bin/` | +| Leerzeile vor `---` in `copilot-instructions.md` wird entfernt | `$(awk ...)` strippt trailing newlines; `printf '%s\n%s\n'` setzt Blöcke direkt zusammen | `printf '%s\n\n%s\n'` verwenden | diff --git a/git-templates/.github/copilot-instructions.md b/git-templates/.github/copilot-instructions.md index 763645b..a95641e 100644 --- a/git-templates/.github/copilot-instructions.md +++ b/git-templates/.github/copilot-instructions.md @@ -41,6 +41,23 @@ - **`git push --force`** – Nie force-pushen ohne explizite Anweisung des Users. - **Secrets in Code** – Keine Passwörter, API-Keys, Tokens in Dateien. +## ⚠ Bekannte Fallstricke (nicht vergessen!) + +- **Scripts mit Self-Update (`copilot-update.sh/.fish`) immer erst committen+pushen, DANN manuell deployen.** + Reihenfolge zwingend: + 1. Änderung im Repo vornehmen + 2. `git add … && git commit && git push` + 3. `cp scripts/copilot-update.sh ~/.local/bin/copilot-update.sh` + 4. Testen + Falsche Reihenfolge (erst deployen, dann committen) → Self-Update überschreibt den manuell deployten Fix + mit der alten Version aus dem Remote-Cache. Der Fix geht verloren. + +- **`fi ───` oder `end ───` in POSIX-sh/fish:** Box-Drawing-Zeichen nie direkt ans `fi`/`end` anhängen. + Kommentar-Trennlinie immer auf eigener Zeile: `# ── Abschnitt ──` + +- **`printf '%s\n%s\n'` frisst trailing newlines** aus `$(awk ...)` Substitution. + Wenn eine Leerzeile zwischen zwei Blöcken erhalten bleiben soll: `printf '%s\n\n%s\n'` verwenden. + --- ## Project diff --git a/history/prompts/2026-06-04_tile-server-check-session-history_session.md b/history/prompts/2026-06-04_tile-server-check-session-history_session.md index 1174876..57357e8 100644 --- a/history/prompts/2026-06-04_tile-server-check-session-history_session.md +++ b/history/prompts/2026-06-04_tile-server-check-session-history_session.md @@ -42,3 +42,68 @@ Befund: - rd13_copilot_setup: triviale Leerzeile durch copilot-update → verworfen via `git checkout .github/copilot-instructions.md` - Beide Repos: working tree clean, alles committed und gepusht - Offenes Todo „Session-History + Commit" → neue Session-Datei angelegt (dieser Eintrag) + +### Prompt 2 +„ja" + +### Antwort 2 +Leerzeilen-Fix in `copilot-update.sh` und `copilot-update.fish`: + +Ursache: `$(awk ...)` in der Shell strippt trailing newlines aus der Framework-Sektion. +`printf '%s\n%s\n'` fügte dann `---` direkt ohne Leerzeile davor ein. + +Fix: `printf '%s\n\n%s\n'` — eine explizite Leerzeile zwischen Framework-Sektion und `---`. + +```diff +# scripts/copilot-update.sh Zeile 154: +- printf '%s\n%s\n' "$framework" "$project" > "$COPILOT_INSTRUCTIONS" ++ printf '%s\n\n%s\n' "$framework" "$project" > "$COPILOT_INSTRUCTIONS" + +# scripts/copilot-update.fish Zeile 151: +- printf '%s\n%s\n' (string join \n $framework) ... ++ printf '%s\n\n%s\n' (string join \n $framework) ... +``` + +### Prompt 3 +„Wieder das gleiche Problem: Self-Update zieht die alte Version aus dem Cache (Fix noch nicht committed+pushed). Erst committen, dann testen – schreib dir das am besten als instruction in dieses repo damit du das nicht immer wieder vergisst." + +### Antwort 3 +Abschnitt `## ⚠ Bekannte Fallstricke` in beide `copilot-instructions.md` ergänzt +(`.github/` + `git-templates/.github/`) mit drei Regeln: +1. Self-Update-Scripts: erst committen+pushen, dann manuell deployen +2. `fi ───` / `end ───`: Box-Drawing-Zeichen nie direkt anhängen +3. `printf '%s\n%s\n'` frisst trailing newlines → `printf '%s\n\n%s\n'` verwenden + +### Prompt 2 +„ja" + +### Antwort 2 +Leerzeilen-Fix in `copilot-update.sh` und `copilot-update.fish`: + +Ursache: `$(awk ...)` in der Shell strippt trailing newlines aus der Framework-Sektion. +`printf '%s\n%s\n'` fügte dann `---` direkt ohne Leerzeile davor ein. + +Fix: `printf '%s\n\n%s\n'` — eine explizite Leerzeile zwischen Framework-Sektion und `---`. + +``` +# scripts/copilot-update.sh Zeile 154: +- printf '%s\n%s\n' "$framework" "$project" > "$COPILOT_INSTRUCTIONS" ++ printf '%s\n\n%s\n' "$framework" "$project" > "$COPILOT_INSTRUCTIONS" + +# scripts/copilot-update.fish Zeile 151: +- printf '%s\n%s\n' (string join \n $framework) ... ++ printf '%s\n\n%s\n' (string join \n $framework) ... +``` + +Syntax-Check: +``` +sh -n scripts/copilot-update.sh → sh: OK +fish -n scripts/copilot-update.fish → fish: OK +``` + +Dann committed+pushed, manuell deployed, getestet: +``` +cp scripts/copilot-update.sh ~/.local/bin/copilot-update.sh +git copilot-update +git diff .github/copilot-instructions.md | wc -l → 0 (keine Änderung) +``` diff --git a/history/summary/PROJECT_CONTEXT.md b/history/summary/PROJECT_CONTEXT.md index 8c0e609..2a87069 100644 --- a/history/summary/PROJECT_CONTEXT.md +++ b/history/summary/PROJECT_CONTEXT.md @@ -8,7 +8,7 @@ ## Aktueller Projektstatus -**Letzte Aktualisierung:** 2026-06-04 – rd13_tile_server geprüft OK; copilot-update Schritt 4c aktiv +**Letzte Aktualisierung:** 2026-06-04 – Bekannte Fallstricke in copilot-instructions.md + Leerzeilen-Fix copilot-update **Phase:** Produktion / stabil – wird bei Bedarf erweitert --- diff --git a/scripts/copilot-update.fish b/scripts/copilot-update.fish index 30e3484..db63a31 100644 --- a/scripts/copilot-update.fish +++ b/scripts/copilot-update.fish @@ -148,7 +148,7 @@ 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 + printf '%s\n\n%s\n' (string join \n $framework) (string join \n $project) > $COPILOT_INSTRUCTIONS echo " ✓ .github/copilot-instructions.md Framework-Sektion aktualisiert" else cp $TEMPLATE_INSTRUCTIONS $COPILOT_INSTRUCTIONS diff --git a/scripts/copilot-update.sh b/scripts/copilot-update.sh index d856ce0..35ce039 100644 --- a/scripts/copilot-update.sh +++ b/scripts/copilot-update.sh @@ -151,7 +151,7 @@ if [ -f "$COPILOT_INSTRUCTIONS" ] && [ -f "$TEMPLATE_INSTRUCTIONS" ]; then # 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" + printf '%s\n\n%s\n' "$framework" "$project" > "$COPILOT_INSTRUCTIONS" echo " ✓ .github/copilot-instructions.md Framework-Sektion aktualisiert" else # Keine Projekt-Sektion vorhanden (noch nicht angepasst) – komplett ersetzen