Host-Setup: Automatische Git-Init und Template-Kopie
- Hook erkennt jetzt auch fehlendes Git-Repository - Meldet beide Anforderungen (Git + Template) zusammen - CLAUDE.md erweitert um vollständigen Setup-Workflow - Initial Commit nach Setup wird automatisch vorgeschlagen Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
46
CLAUDE.md
46
CLAUDE.md
@@ -231,6 +231,38 @@ This upfront investment minimizes questions in future sessions and enables faste
|
||||
|
||||
## Host Troubleshooting
|
||||
|
||||
### Automatische Host-Setup (Hook-gesteuert)
|
||||
|
||||
Der Session-Start Hook erkennt automatisch Host-Verzeichnisse unter `~/Nextcloud/hosts/`.
|
||||
|
||||
**Wenn du `<HOST_SETUP_REQUIRED>` in der Hook-Ausgabe siehst:**
|
||||
|
||||
1. **Frage den User:**
|
||||
> "Ich habe erkannt, dass für diesen Host noch Setup erforderlich ist. Soll ich das automatisch durchführen?"
|
||||
> - Git-Repository initialisieren (falls fehlend)
|
||||
> - Template für Dokumentation kopieren (falls fehlend)
|
||||
|
||||
2. **Bei Zustimmung - führe alle fehlenden Schritte aus:**
|
||||
|
||||
```bash
|
||||
# Git initialisieren (falls nicht vorhanden)
|
||||
git init
|
||||
|
||||
# Template kopieren (falls nicht vorhanden)
|
||||
cp ~/Nextcloud/hosts/_templates/copilot-instructions-template.md ./copilot-instructions.md
|
||||
```
|
||||
|
||||
3. **Dann interaktiv ausfüllen:**
|
||||
- Frage nach den wichtigsten Infos (IP, Typ, Funktion, Zugang)
|
||||
- Ersetze die Platzhalter im Template
|
||||
- Lösche den Template-Hinweis-Block am Anfang
|
||||
|
||||
4. **Initial Commit erstellen:**
|
||||
```bash
|
||||
git add copilot-instructions.md
|
||||
git commit -m "Initial: Host-Dokumentation angelegt"
|
||||
```
|
||||
|
||||
### Automatische Erkennung
|
||||
|
||||
Wenn du in einem Verzeichnis unter `~/Nextcloud/hosts/` arbeitest:
|
||||
@@ -254,12 +286,16 @@ Wenn du in einem Verzeichnis unter `~/Nextcloud/hosts/` arbeitest:
|
||||
└── copilot-instructions-template.md # Master-Template
|
||||
```
|
||||
|
||||
### Neuen Host dokumentieren
|
||||
### Workflow: Neuen Host anlegen
|
||||
|
||||
1. Erstelle Verzeichnis: `mkdir -p ~/Nextcloud/hosts/[kunde]/[hostname]`
|
||||
2. Kopiere Template: `cp ~/Nextcloud/hosts/_templates/copilot-instructions-template.md ./copilot-instructions.md`
|
||||
3. Fülle während der Arbeit die relevanten Felder aus
|
||||
4. Committe die Dokumentation
|
||||
Der User legt nur den Ordner an:
|
||||
```bash
|
||||
mkdir -p ~/Nextcloud/hosts/[kunde]/[hostname]
|
||||
cd ~/Nextcloud/hosts/[kunde]/[hostname]
|
||||
claude # Startet Claude Code
|
||||
```
|
||||
|
||||
Claude erkennt automatisch das fehlende Template und bietet Setup an.
|
||||
|
||||
### Skills-Referenz
|
||||
|
||||
|
||||
@@ -21,9 +21,66 @@ if [ -d "$REPO_DIR/.git" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# === TEIL 2: Projekt-Kontext anzeigen ===
|
||||
# === TEIL 2: Host-Verzeichnis Erkennung ===
|
||||
cd "$ORIGINAL_DIR" 2>/dev/null || exit 0
|
||||
|
||||
HOSTS_BASE="$HOME/Nextcloud/hosts"
|
||||
TEMPLATE_PATH="$HOSTS_BASE/_templates/copilot-instructions-template.md"
|
||||
|
||||
# Prüfe ob wir in einem Host-Verzeichnis sind (~/Nextcloud/hosts/[kunde]/[hostname]/)
|
||||
if [[ "$ORIGINAL_DIR" == "$HOSTS_BASE"/* ]]; then
|
||||
# Extrahiere relativen Pfad
|
||||
REL_PATH="${ORIGINAL_DIR#$HOSTS_BASE/}"
|
||||
|
||||
# Prüfe ob es ein Host-Verzeichnis ist (mindestens 2 Ebenen tief, nicht _templates)
|
||||
if [[ "$REL_PATH" == *"/"* ]] && [[ "$REL_PATH" != "_templates"* ]]; then
|
||||
KUNDE=$(echo "$REL_PATH" | cut -d'/' -f1)
|
||||
HOSTNAME=$(echo "$REL_PATH" | cut -d'/' -f2)
|
||||
|
||||
if [[ -n "$KUNDE" ]] && [[ -n "$HOSTNAME" ]]; then
|
||||
echo "=== HOST-VERZEICHNIS ERKANNT ==="
|
||||
echo "Kunde: $KUNDE"
|
||||
echo "Host: $HOSTNAME"
|
||||
echo ""
|
||||
|
||||
# Sammle Setup-Anforderungen
|
||||
NEEDS_SETUP=false
|
||||
NEEDS_GIT=false
|
||||
NEEDS_TEMPLATE=false
|
||||
|
||||
if [[ ! -d ".git" ]]; then
|
||||
NEEDS_GIT=true
|
||||
NEEDS_SETUP=true
|
||||
fi
|
||||
|
||||
if [[ ! -f "copilot-instructions.md" ]]; then
|
||||
NEEDS_TEMPLATE=true
|
||||
NEEDS_SETUP=true
|
||||
fi
|
||||
|
||||
if [[ "$NEEDS_SETUP" == "true" ]]; then
|
||||
echo "<HOST_SETUP_REQUIRED>"
|
||||
if [[ "$NEEDS_GIT" == "true" ]]; then
|
||||
echo "- Kein Git-Repository vorhanden → git init erforderlich"
|
||||
fi
|
||||
if [[ "$NEEDS_TEMPLATE" == "true" ]]; then
|
||||
echo "- Keine copilot-instructions.md → Template kopieren"
|
||||
echo " Template: $TEMPLATE_PATH"
|
||||
fi
|
||||
echo ""
|
||||
echo "Frage den User ob das Setup automatisch durchgeführt werden soll."
|
||||
echo "</HOST_SETUP_REQUIRED>"
|
||||
echo ""
|
||||
else
|
||||
echo "copilot-instructions.md vorhanden - lies sie für Kontext."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# === TEIL 3: Projekt-Kontext anzeigen ===
|
||||
|
||||
if [[ -f "WORKLOG.md" ]]; then
|
||||
echo "=== PROJECT CONTEXT ==="
|
||||
|
||||
|
||||
Reference in New Issue
Block a user