- user-settings/settings.json: new codeGeneration.instruction forces agents to read PROJECT_CONTEXT.md on session start and write history log on session end - git-templates/.github/copilot-instructions.md: prominent MANDATORY section at top of file (highest priority, cannot be ignored) - .github/copilot-instructions.md: same protocol for this repo itself
63 lines
1.7 KiB
Bash
63 lines
1.7 KiB
Bash
#!/usr/bin/env sh
|
||
# post-commit – Automatischer History-Log
|
||
#
|
||
# Läuft nach jedem erfolgreichen Commit.
|
||
# Schreibt einen faktischen Eintrag in history/prompts/ mit:
|
||
# - Commit-Hash, Branch, Datum, Message
|
||
# - Liste der geänderten Dateien
|
||
#
|
||
# Die Datei wird NICHT automatisch committed (kein Rekursionsrisiko).
|
||
# Sie wird beim nächsten regulären Commit mit erfasst (history/ ist tracked).
|
||
|
||
HASH=$(git rev-parse --short HEAD 2>/dev/null)
|
||
FULL_HASH=$(git rev-parse HEAD 2>/dev/null)
|
||
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||
DATE=$(date '+%Y-%m-%d')
|
||
DATETIME=$(date '+%Y-%m-%d %H:%M:%S')
|
||
MSG=$(git log -1 --format='%s' 2>/dev/null)
|
||
AUTHOR=$(git log -1 --format='%an <%ae>' 2>/dev/null)
|
||
|
||
# Nur ausführen wenn history/prompts/ existiert
|
||
if [ ! -d "history/prompts" ]; then
|
||
exit 0
|
||
fi
|
||
|
||
# Dateiname: Datum + Branch (bereinigt) + Hash
|
||
BRANCH_CLEAN=$(printf '%s' "$BRANCH" | tr '/' '-' | tr ' ' '-')
|
||
OUTFILE="history/prompts/${DATE}_${BRANCH_CLEAN}_${HASH}.md"
|
||
|
||
# Geänderte Dateien dieses Commits
|
||
CHANGED_FILES=$(git diff-tree --no-commit-id -r --name-status "$FULL_HASH" 2>/dev/null \
|
||
| awk '{printf "| %-1s | %s |\n", $1, $2}')
|
||
|
||
cat > "$OUTFILE" << EOF
|
||
# Auto-Log: $MSG
|
||
|
||
| Feld | Wert |
|
||
|---|---|
|
||
| Datum | $DATETIME |
|
||
| Branch | \`$BRANCH\` |
|
||
| Commit | \`$FULL_HASH\` |
|
||
| Autor | $AUTHOR |
|
||
|
||
## Commit Message
|
||
|
||
\`\`\`
|
||
$MSG
|
||
\`\`\`
|
||
|
||
## Geänderte Dateien
|
||
|
||
| Status | Datei |
|
||
|---|---|
|
||
$CHANGED_FILES
|
||
|
||
---
|
||
*Automatisch generiert durch post-commit hook – kein KI-Inhalt.*
|
||
*Für KI-generierte Zusammenfassung: Copilot Chat → \`/history\`*
|
||
EOF
|
||
|
||
# Staging-Info ausgeben (nicht automatisch stagen – vermeidet Komplikationen)
|
||
echo ""
|
||
echo " ✓ history: $(basename "$OUTFILE") geschrieben"
|
||
echo " → wird beim nächsten Commit automatisch erfasst"
|