fix: copilot-update Leerzeilen-Fix + Bekannte Fallstricke in copilot-instructions + MAINTAINER.md

This commit is contained in:
Conrad Schulz 2026-06-04 09:20:05 +00:00
parent 30848652c9
commit 114bb5b22b
7 changed files with 103 additions and 3 deletions

View file

@ -41,6 +41,23 @@
- **`git push --force`** Nie force-pushen ohne explizite Anweisung des Users. - **`git push --force`** Nie force-pushen ohne explizite Anweisung des Users.
- **Secrets in Code** Keine Passwörter, API-Keys, Tokens in Dateien. - **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 ## Project

View file

@ -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 (`# ──`) | | `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/` | | 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 |

View file

@ -41,6 +41,23 @@
- **`git push --force`** Nie force-pushen ohne explizite Anweisung des Users. - **`git push --force`** Nie force-pushen ohne explizite Anweisung des Users.
- **Secrets in Code** Keine Passwörter, API-Keys, Tokens in Dateien. - **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 ## Project

View file

@ -42,3 +42,68 @@ Befund:
- rd13_copilot_setup: triviale Leerzeile durch copilot-update → verworfen via `git checkout .github/copilot-instructions.md` - 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 - Beide Repos: working tree clean, alles committed und gepusht
- Offenes Todo „Session-History + Commit" → neue Session-Datei angelegt (dieser Eintrag) - 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)
```

View file

@ -8,7 +8,7 @@
## Aktueller Projektstatus ## 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 **Phase:** Produktion / stabil wird bei Bedarf erweitert
--- ---

View file

@ -148,7 +148,7 @@ if test -f $COPILOT_INSTRUCTIONS; and test -f $TEMPLATE_INSTRUCTIONS
set framework (awk '/^---$/{exit} {print}' $TEMPLATE_INSTRUCTIONS) set framework (awk '/^---$/{exit} {print}' $TEMPLATE_INSTRUCTIONS)
set project (awk '/^---$/{found=1} found{print}' $COPILOT_INSTRUCTIONS) set project (awk '/^---$/{found=1} found{print}' $COPILOT_INSTRUCTIONS)
if test -n "$project" 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" echo " ✓ .github/copilot-instructions.md Framework-Sektion aktualisiert"
else else
cp $TEMPLATE_INSTRUCTIONS $COPILOT_INSTRUCTIONS cp $TEMPLATE_INSTRUCTIONS $COPILOT_INSTRUCTIONS

View file

@ -151,7 +151,7 @@ if [ -f "$COPILOT_INSTRUCTIONS" ] && [ -f "$TEMPLATE_INSTRUCTIONS" ]; then
# Projekt-Sektion aus Ziel-Datei (ab erstem --- inkl.) # Projekt-Sektion aus Ziel-Datei (ab erstem --- inkl.)
project=$(awk '/^---$/{found=1} found{print}' "$COPILOT_INSTRUCTIONS") project=$(awk '/^---$/{found=1} found{print}' "$COPILOT_INSTRUCTIONS")
if [ -n "$project" ]; then 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" echo " ✓ .github/copilot-instructions.md Framework-Sektion aktualisiert"
else else
# Keine Projekt-Sektion vorhanden (noch nicht angepasst) komplett ersetzen # Keine Projekt-Sektion vorhanden (noch nicht angepasst) komplett ersetzen