5.9 KiB
copilot-update.sh + Auto-Deploy via Git Hooks – 2026-06-02
Aufgabe / Ziel
Einen automatisierten Weg schaffen, um die AI Prompting Rules aus dem Setup-Repo
http://192.168.178.6:8083/cschulz/rd13_copilot_setup in neue und bestehende Repos
zu übernehmen und aktuell zu halten — über Git Hooks und Scripts.
Verlauf
Prompt 1
Ich möchte jetzt noch einen weg für neue repos um das einführen und vorallem das updaten neuerungen der ai promting rules aus dem repo noch einfacher und schneller zu machen. Was können wir noch mit git templates und scripten machen um das eventuell über git hooks zu automatisieren. gehen wir davon aus das das rebo immer hier zur verfügung steht http://192.168.178.6:8083/cschulz/rd13_copilot_setup
Antwort 1
Analyse des bestehenden Systems (deploy.sh, copilot-bootstrap.sh, pre-commit, post-commit Hooks). Drei Klärungsfragen gestellt:
- AutoUpdate-Trigger: manuell via
git copilot-update✓ - Update-Scope: Git-Hooks immer + copilot-instructions.md nur bei TODO ✓
- URL: SSH mit HTTP-Fallback ✓
Plan ausgearbeitet:
copilot-update.sh: cached Setup-Repo in~/.copilot-setup/, aktualisiert Templates + Prompts + repo-lokale Hooksgit copilot-updateAliaspost-mergeHook für Setup-Repo selbst (auto-deploy nach git pull)--with-update-hookFlag für copilot-bootstrap.sh (opt-in)
Prompt 2
Start implementation
Antwort 2
Implementierung aller geplanten Dateien:
Neu erstellt:
scripts/copilot-update.sh– POSIX sh, SSH+HTTP-Fallback, Clone/Pull in~/.copilot-setup/, globale Templates, VS Code Prompts, repo-lokale Hooks, copilot-instructions.md nur bei TODO-Erkennung (Backup .bak)scripts/copilot-update.fish– Fish-Variantegit-templates/hooks/post-merge– opt-in Hook: ruft copilot-update.sh auf
Geändert:
scripts/deploy.sh– copilot-update.sh/.fish installieren,git copilot-updateAlias setzen, post-merge Hook im Setup-Repo selbst installierenscripts/deploy.fish– analogscripts/copilot-bootstrap.sh–--with-update-hookFlag, post-commit Hook Installation ergänzt
Test erfolgreich:
=== Copilot Update ===
→ Klone Setup-Repo (SSH)...
✓ Geklont via SSH
✓ ~/.git-templates/ aktualisiert
✓ 10 Prompt-Dateien aktualisiert
Git-Repo erkannt: /tmp/test-repo
✓ .git/hooks/pre-commit aktualisiert
✓ .git/hooks/post-commit aktualisiert
─ .github/copilot-instructions.md nicht vorhanden, übersprungen
=== Done ===
Commit: feat: copilot-update.sh + git copilot-update alias + post-merge auto-deploy
Prompt 3
warum klappt das Project_Context updaten aber nicht das history promts schreiben?
Antwort 3
Root Cause identifiziert:
- VS Code Copilot System-Instruction: "Do NOT create markdown files unless
requested" — blockiert automatisches Anlegen neuer .md Dateien.
PROJECT_CONTEXT.mdklappt weil die Datei bereits existiert (replace ≠ create). - Namensformat-Inkonsistenz: copilot-instructions.md sagte
YYYY-MM-DD_kurztitel.md, post-commit Hook erwartet zwingend_session.mdSuffix.
Fix: Beide copilot-instructions.md (repo + git-template) korrigiert:
_session.mdSuffix als Pflichtformat dokumentiert- "auch ohne explizite Aufforderung" entfernt → History nur via
/history - Hinweis auf System-Instruction-Konflikt ergänzt
Commit: fix: copilot-instructions.md Session-END Protokoll korrigiert
Prompt 4
ok aber warum ist dann jetzt aktuell immer noch keine .md von heute in History?
Antwort 4
Weiterer Bug gefunden: .git/hooks/ des Setup-Repos selbst enthielt nur
pre-commit und post-merge — kein post-commit Hook.
deploy.sh installierte zwar den post-merge Hook, vergaß aber post-commit.
Für andere Repos macht das copilot-bootstrap.sh, aber das Setup-Repo selbst
fiel durchs Raster.
Fix:
- post-commit Hook sofort manuell installiert:
cp git-templates/hooks/post-commit .git/hooks/ scripts/deploy.shunddeploy.fishgepatcht: Block 7 installiert jetzt sowohl post-merge als auch post-commit im Setup-Repo- Verifikation: nächster Commit löste post-commit aus:
✓ history: 2026-06-02_master_55fee83.md geschrieben (nur Git-Metadaten)
Commit: fix: post-commit Hook im Setup-Repo selbst installieren via deploy.sh
Prompt 5
also dann noch ein test.
Antwort 5
Session-Datei wird jetzt explizit auf Anfrage erstellt (dies hier).
Test des vollständigen Flows: Session-Datei _session.md anlegen → committen →
post-commit Hook hängt Git-Block an.
Ergebnis
| Datei | Status | Beschreibung |
|---|---|---|
scripts/copilot-update.sh |
✓ neu | Haupt-Updater (POSIX sh) |
scripts/copilot-update.fish |
✓ neu | Fish-Variante |
git-templates/hooks/post-merge |
✓ neu | Opt-in Template-Hook |
scripts/deploy.sh |
✓ geändert | Update-Script + Aliase + beide Hooks |
scripts/deploy.fish |
✓ geändert | analog |
scripts/copilot-bootstrap.sh |
✓ geändert | --with-update-hook + post-commit |
.github/copilot-instructions.md |
✓ geändert | _session.md Suffix-Pflicht + /history Hinweis |
git-templates/.github/copilot-instructions.md |
✓ geändert | analog |
Entscheidungen
| Entscheidung | Begründung |
|---|---|
git copilot-update manuell (kein Auto-Hook) |
Kein Overhead bei jedem git pull in anderen Repos |
| SSH+HTTP-Fallback | Funktioniert ohne SSH-Key auf neuen Maschinen |
| copilot-instructions.md nur bei TODO überschreiben | User-Content bleibt erhalten; .bak Backup |
--with-update-hook als opt-in Flag |
Nutzer entscheiden selbst ob auto-update nach pull |
| post-commit Hook auch im Setup-Repo | Setup-Repo soll selbst History schreiben |
History-Datei nur via /history (explizit) |
VS Code System-Instruction blockiert sonst Create |
Offene Punkte
~/.copilot-setup/wird beim erstengit copilot-updateangelegt — SSH-Key muss für den Gitea-Server konfiguriert sein (oder HTTP-Fallback greift)COPILOT_SETUP_DIRENV-Variable dokumentieren (in README oder ADMIN.md)