feat: Multi-Machine Development Tracking Workflow
Implementiert Session Context Workflow für Cross-Machine Tracking: - WORKLOG.md Template für Projekt-Zustandsdokumentation - Session-Start Hook erweitert: zeigt WORKLOG.md Kontext, Commits, Issues - /session-end Skill: strukturiertes Session-Ende mit Auto-Dokumentation - /session-start Skill: manueller Session-Start mit Planung - /new-project Skill: Projekt-Initialisierung mit Tracking Inspiriert von Boris Cherny's Claude Code Tipps: - Learnings dokumentieren für Fehler/Erkenntnisse - Verification Loops in Skills - Separate Checkouts für parallele Sessions Tea CLI (Gitea) separat installiert in ~/.local/bin Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,22 +1,72 @@
|
||||
#!/bin/bash
|
||||
# Claude Code Session-Start Hook
|
||||
# Prüft auf Updates im Settings-Repo
|
||||
# 1. Prüft auf Updates im Settings-Repo
|
||||
# 2. Zeigt Projekt-Kontext wenn WORKLOG.md vorhanden
|
||||
|
||||
REPO_DIR="$HOME/dotfiles/claude_settings"
|
||||
ORIGINAL_DIR="$(pwd)"
|
||||
|
||||
cd "$REPO_DIR" 2>/dev/null || exit 0
|
||||
# === TEIL 1: Settings-Repo Synchronisierung ===
|
||||
cd "$REPO_DIR" 2>/dev/null || true
|
||||
if [ -d "$REPO_DIR/.git" ]; then
|
||||
git fetch origin --quiet 2>/dev/null || true
|
||||
LOCAL=$(git rev-parse HEAD 2>/dev/null)
|
||||
REMOTE=$(git rev-parse origin/main 2>/dev/null)
|
||||
|
||||
# Fetch ohne Output
|
||||
git fetch origin --quiet 2>/dev/null || exit 0
|
||||
|
||||
# Prüfe ob Updates vorhanden
|
||||
LOCAL=$(git rev-parse HEAD 2>/dev/null)
|
||||
REMOTE=$(git rev-parse origin/main 2>/dev/null)
|
||||
|
||||
if [ "$LOCAL" != "$REMOTE" ]; then
|
||||
if [ "$LOCAL" != "$REMOTE" ]; then
|
||||
BEHIND=$(git rev-list HEAD..origin/main --count 2>/dev/null)
|
||||
echo "⚠ Claude Settings: $BEHIND neue Commits verfügbar!"
|
||||
echo " → cd ~/dotfiles/claude_settings && git pull"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
# === TEIL 2: Projekt-Kontext anzeigen ===
|
||||
cd "$ORIGINAL_DIR" 2>/dev/null || exit 0
|
||||
|
||||
if [[ -f "WORKLOG.md" ]]; then
|
||||
echo "=== PROJECT CONTEXT ==="
|
||||
|
||||
# Current State anzeigen
|
||||
if grep -q "## Current State" WORKLOG.md; then
|
||||
sed -n '/## Current State/,/## Next Steps/p' WORKLOG.md | head -10 | tail -n +2 | head -6
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Next Steps anzeigen
|
||||
if grep -q "## Next Steps" WORKLOG.md; then
|
||||
echo "## Next Steps"
|
||||
sed -n '/## Next Steps/,/## Key Decisions/p' WORKLOG.md | grep -E "^- \[" | head -5
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Learnings anzeigen (falls vorhanden)
|
||||
if grep -q "^\*\*[0-9]" WORKLOG.md; then
|
||||
LEARNINGS=$(sed -n '/## Learnings/,/## Session History/p' WORKLOG.md | grep -E "^\*\*[0-9]" | tail -3)
|
||||
if [ -n "$LEARNINGS" ]; then
|
||||
echo "## Recent Learnings"
|
||||
echo "$LEARNINGS"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Letzte Commits
|
||||
if [ -d ".git" ]; then
|
||||
echo "=== RECENT COMMITS ==="
|
||||
git log --oneline -5 2>/dev/null || echo "(keine Commits)"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Gitea Issues (wenn tea konfiguriert)
|
||||
if command -v tea &>/dev/null; then
|
||||
# Prüfe ob tea login konfiguriert ist
|
||||
if tea login list 2>/dev/null | grep -q "gitea"; then
|
||||
echo "=== OPEN ISSUES ==="
|
||||
tea issues --state open --limit 5 2>/dev/null || echo "(Gitea nicht erreichbar oder kein Gitea-Repo)"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
173
skills/new-project.md
Normal file
173
skills/new-project.md
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
name: new-project
|
||||
description: Use when initializing a new project - creates WORKLOG.md, copilot-instructions.md, git repo, and optionally a Gitea issue
|
||||
---
|
||||
|
||||
# Skill: New Project
|
||||
|
||||
Initialisiert ein neues Projekt mit allen nötigen Dokumentationsstrukturen.
|
||||
|
||||
## Wann verwenden
|
||||
|
||||
- Neues Projekt starten
|
||||
- Bestehendes Verzeichnis zum tracked Project machen
|
||||
- Nach "This looks like a new workspace..." Prompt
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Projekt-Informationen sammeln
|
||||
|
||||
Frage den Benutzer:
|
||||
|
||||
**"Wie soll das Projekt heißen?"**
|
||||
- Wird für WORKLOG.md und ggf. Gitea Issue verwendet
|
||||
|
||||
**"Kurze Beschreibung des Projekts?"**
|
||||
- 1-2 Sätze für Dokumentation
|
||||
|
||||
**"Gitea Issue erstellen?"**
|
||||
- Ja: Erstellt Tracking-Issue auf Gitea
|
||||
- Nein: Nur lokale Dokumentation
|
||||
|
||||
### 2. Git initialisieren (falls nötig)
|
||||
|
||||
```bash
|
||||
if [[ ! -d ".git" ]]; then
|
||||
git init
|
||||
echo "Git Repository initialisiert"
|
||||
fi
|
||||
```
|
||||
|
||||
### 3. WORKLOG.md erstellen
|
||||
|
||||
Kopiere Template und ersetze Platzhalter:
|
||||
|
||||
```bash
|
||||
# Template-Pfad
|
||||
TEMPLATE="$HOME/dotfiles/claude_settings/templates/WORKLOG.md"
|
||||
|
||||
# Variablen
|
||||
PROJEKT="[Projektname]"
|
||||
DATUM=$(date +%Y-%m-%d)
|
||||
HOST=$(hostname)
|
||||
BRANCH=$(git branch --show-current 2>/dev/null || echo "main")
|
||||
```
|
||||
|
||||
Erstelle WORKLOG.md mit:
|
||||
- Projektname eingesetzt
|
||||
- Aktuelles Datum
|
||||
- Hostname
|
||||
- Branch
|
||||
- Initial Status: "Projekt angelegt"
|
||||
|
||||
### 4. copilot-instructions.md erstellen
|
||||
|
||||
Basis-Struktur:
|
||||
```markdown
|
||||
# [Projektname] - Copilot Instructions
|
||||
|
||||
## Architecture Overview
|
||||
[Beschreibung aus Schritt 1]
|
||||
|
||||
## File Structure
|
||||
```
|
||||
[Verzeichnisstruktur - wird später gefüllt]
|
||||
```
|
||||
|
||||
## Patterns & Conventions
|
||||
[Wird während der Entwicklung gefüllt]
|
||||
|
||||
## Development Workflow
|
||||
[Wird während der Entwicklung gefüllt]
|
||||
|
||||
## Pitfalls to Avoid
|
||||
[Wird während der Entwicklung gefüllt]
|
||||
```
|
||||
|
||||
### 5. Gitea Issue erstellen (optional)
|
||||
|
||||
Wenn Benutzer "Ja" gewählt hat:
|
||||
|
||||
```bash
|
||||
# Issue erstellen mit tea CLI
|
||||
tea issues create \
|
||||
--title "[Projektname]: Initial Setup" \
|
||||
--body "Projekt angelegt am $(date +%Y-%m-%d)
|
||||
|
||||
## Beschreibung
|
||||
[Beschreibung aus Schritt 1]
|
||||
|
||||
## Erste Schritte
|
||||
- [ ] Grundstruktur anlegen
|
||||
- [ ] Abhängigkeiten definieren
|
||||
- [ ] Erste Implementation
|
||||
|
||||
---
|
||||
Erstellt via Claude Code /new-project"
|
||||
```
|
||||
|
||||
Issue-Nummer in WORKLOG.md eintragen.
|
||||
|
||||
### 6. Initial Commit
|
||||
|
||||
```bash
|
||||
git add WORKLOG.md copilot-instructions.md
|
||||
git commit -m "Initial project setup: [Projektname]
|
||||
|
||||
- WORKLOG.md für Session-Tracking
|
||||
- copilot-instructions.md für Entwicklungs-Guidelines
|
||||
|
||||
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
|
||||
```
|
||||
|
||||
### 7. .gitignore prüfen
|
||||
|
||||
Falls keine .gitignore existiert, frage:
|
||||
"Soll ich eine .gitignore erstellen? Welche Art Projekt ist das?"
|
||||
- Node.js / JavaScript
|
||||
- Python
|
||||
- Go
|
||||
- Allgemein
|
||||
|
||||
## Checkliste
|
||||
|
||||
- [ ] Projektname erhalten
|
||||
- [ ] Beschreibung erhalten
|
||||
- [ ] Git initialisiert
|
||||
- [ ] WORKLOG.md erstellt
|
||||
- [ ] copilot-instructions.md erstellt
|
||||
- [ ] Gitea Issue erstellt (falls gewünscht)
|
||||
- [ ] Initial Commit gemacht
|
||||
- [ ] .gitignore geprüft
|
||||
|
||||
## Beispiel-Output
|
||||
|
||||
```
|
||||
=== NEUES PROJEKT: smart-home-mqtt ===
|
||||
|
||||
✅ Git Repository initialisiert
|
||||
✅ WORKLOG.md erstellt
|
||||
✅ copilot-instructions.md erstellt
|
||||
✅ Gitea Issue #42 erstellt: smart-home-mqtt: Initial Setup
|
||||
✅ Initial Commit: a3f2b1c
|
||||
|
||||
Projekt ist bereit! Nächste Schritte:
|
||||
1. Abhängigkeiten installieren
|
||||
2. Grundstruktur aufbauen
|
||||
3. Mit /session-end die Session dokumentieren
|
||||
|
||||
Viel Erfolg!
|
||||
```
|
||||
|
||||
## Hinweise
|
||||
|
||||
- Template-Pfad: `~/dotfiles/claude_settings/templates/WORKLOG.md`
|
||||
- Tea CLI muss konfiguriert sein für Issue-Erstellung
|
||||
- Bei Gitea-Fehlern: Projekt trotzdem lokal anlegen
|
||||
- Hostname: `hostname`
|
||||
- Datum: `date +%Y-%m-%d`
|
||||
|
||||
## Verknüpfung mit anderen Skills
|
||||
|
||||
- Nach `/new-project`: Direkt mit Arbeit beginnen oder `/session-start`
|
||||
- Am Ende: `/session-end` für vollständige Dokumentation
|
||||
131
skills/session-end.md
Normal file
131
skills/session-end.md
Normal file
@@ -0,0 +1,131 @@
|
||||
---
|
||||
name: session-end
|
||||
description: Use when ending a work session - documents progress, updates WORKLOG.md, commits changes, and optionally comments on Gitea issues
|
||||
---
|
||||
|
||||
# Skill: Session End
|
||||
|
||||
Strukturiertes Beenden einer Arbeitssession mit automatischer Dokumentation.
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Analyse der Session
|
||||
|
||||
Sammle aus der bisherigen Konversation:
|
||||
- Was wurde gemacht? (Features, Bugfixes, Refactoring)
|
||||
- Welche Commits wurden erstellt?
|
||||
- Welche Entscheidungen wurden getroffen?
|
||||
- Welche Fehler/Erkenntnisse gab es?
|
||||
|
||||
```bash
|
||||
# Commits dieser Session ermitteln
|
||||
git log --oneline --since="today" 2>/dev/null || git log --oneline -10
|
||||
```
|
||||
|
||||
### 2. Benutzer-Input sammeln
|
||||
|
||||
Frage den Benutzer:
|
||||
|
||||
**"Was sind die nächsten Schritte für dieses Projekt?"**
|
||||
- Akzeptiere kurze Stichpunkte
|
||||
- Formatiere als Checkbox-Liste
|
||||
|
||||
**"Gab es wichtige Entscheidungen heute?"**
|
||||
- Architektur-Entscheidungen
|
||||
- Technologie-Wahlen
|
||||
- Trade-offs
|
||||
|
||||
**"Learnings für zukünftige Sessions?"**
|
||||
- Fehler die vermieden werden sollten
|
||||
- Nicht-offensichtliches Verhalten
|
||||
- Gotchas
|
||||
|
||||
### 3. WORKLOG.md aktualisieren
|
||||
|
||||
Aktualisiere die Datei mit:
|
||||
|
||||
#### Current State
|
||||
```markdown
|
||||
**Zuletzt:** [HEUTE] auf `[HOSTNAME]`
|
||||
**Branch:** [aktueller Branch]
|
||||
**Issue:** [falls verknüpft]
|
||||
**Status:** [kurze Statusbeschreibung]
|
||||
```
|
||||
|
||||
#### Next Steps
|
||||
- Ersetze mit den neuen Schritten vom Benutzer
|
||||
|
||||
#### Key Decisions (falls neue)
|
||||
- Füge neue Entscheidungen hinzu mit Datum
|
||||
|
||||
#### Learnings (falls neue)
|
||||
- Füge neue Learnings hinzu mit Datum
|
||||
|
||||
#### Session History
|
||||
Füge neuen Eintrag am ANFANG der History hinzu:
|
||||
```markdown
|
||||
### [DATUM] | [HOSTNAME] | Commits: `hash1`, `hash2`
|
||||
- Punkt 1 was gemacht wurde
|
||||
- Punkt 2 was gemacht wurde
|
||||
```
|
||||
|
||||
### 4. Commit und Push
|
||||
|
||||
```bash
|
||||
# Stage WORKLOG.md
|
||||
git add WORKLOG.md
|
||||
|
||||
# Commit mit standardisierter Message
|
||||
git commit -m "worklog: session $(date +%Y-%m-%d)"
|
||||
|
||||
# Push (optional, frage nach)
|
||||
git push origin [branch]
|
||||
```
|
||||
|
||||
### 5. Gitea Issue kommentieren (optional)
|
||||
|
||||
Wenn ein Issue in WORKLOG.md verknüpft ist:
|
||||
|
||||
```bash
|
||||
# Issue-Nummer extrahieren
|
||||
ISSUE=$(grep -oP '(?<=#)\d+' WORKLOG.md | head -1)
|
||||
|
||||
# Kommentar erstellen
|
||||
tea comment $ISSUE "Progress update:
|
||||
- [Was gemacht wurde]
|
||||
- Next: [Nächste Schritte]"
|
||||
```
|
||||
|
||||
## Checkliste
|
||||
|
||||
- [ ] Commits der Session identifiziert
|
||||
- [ ] Nächste Schritte vom Benutzer erhalten
|
||||
- [ ] Key Decisions dokumentiert (falls vorhanden)
|
||||
- [ ] Learnings dokumentiert (falls vorhanden)
|
||||
- [ ] WORKLOG.md aktualisiert
|
||||
- [ ] WORKLOG.md committet
|
||||
- [ ] Gitea Issue kommentiert (falls verknüpft)
|
||||
|
||||
## Beispiel-Output
|
||||
|
||||
```
|
||||
Session beendet für: smart-home-mqtt
|
||||
|
||||
Dokumentiert:
|
||||
- 3 Commits: a3f2b1c, e7d4a9f, f8g9h0i
|
||||
- Nächste Schritte: 3 Items
|
||||
- 1 neue Entscheidung: QoS Level 1
|
||||
- 1 neues Learning: API-Prefix
|
||||
|
||||
WORKLOG.md aktualisiert und committet.
|
||||
Issue #12 kommentiert.
|
||||
|
||||
Bis zur nächsten Session!
|
||||
```
|
||||
|
||||
## Hinweise
|
||||
|
||||
- Hostname ermitteln: `hostname`
|
||||
- Aktuelles Datum: `date +%Y-%m-%d`
|
||||
- Branch ermitteln: `git branch --show-current`
|
||||
- Tea CLI muss konfiguriert sein für Issue-Kommentare
|
||||
126
skills/session-start.md
Normal file
126
skills/session-start.md
Normal file
@@ -0,0 +1,126 @@
|
||||
---
|
||||
name: session-start
|
||||
description: Use when explicitly starting a work session - shows project context, Gitea issues, and helps decide what to work on
|
||||
---
|
||||
|
||||
# Skill: Session Start
|
||||
|
||||
Expliziter Session-Start mit Kontext-Laden und Arbeitsplanung.
|
||||
|
||||
## Wann verwenden
|
||||
|
||||
- Beim manuellen Start einer Arbeitssession
|
||||
- Wenn der automatische Hook nicht ausreicht
|
||||
- Um bewusst in den "Arbeitsmodus" zu wechseln
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Projekt-Kontext laden
|
||||
|
||||
```bash
|
||||
# WORKLOG.md lesen falls vorhanden
|
||||
if [[ -f "WORKLOG.md" ]]; then
|
||||
cat WORKLOG.md
|
||||
fi
|
||||
|
||||
# copilot-instructions.md lesen falls vorhanden
|
||||
if [[ -f "copilot-instructions.md" ]]; then
|
||||
cat copilot-instructions.md
|
||||
fi
|
||||
```
|
||||
|
||||
### 2. Git-Status anzeigen
|
||||
|
||||
```bash
|
||||
# Aktueller Branch
|
||||
git branch --show-current
|
||||
|
||||
# Uncommitted changes
|
||||
git status --short
|
||||
|
||||
# Letzte Commits
|
||||
git log --oneline -5
|
||||
|
||||
# Stashes (falls vorhanden)
|
||||
git stash list
|
||||
```
|
||||
|
||||
### 3. Gitea Issues laden
|
||||
|
||||
```bash
|
||||
# Offene Issues für dieses Repo
|
||||
tea issues --state open --limit 10
|
||||
|
||||
# Mir zugewiesene Issues
|
||||
tea issues --state open --assignee @me --limit 5
|
||||
```
|
||||
|
||||
### 4. Kontext-Zusammenfassung präsentieren
|
||||
|
||||
Zeige dem Benutzer:
|
||||
|
||||
```
|
||||
=== SESSION START: [Projektname] ===
|
||||
|
||||
📍 Letzte Session: [Datum] auf [Hostname]
|
||||
🔀 Branch: [branch]
|
||||
📋 Status: [aus WORKLOG.md]
|
||||
|
||||
📝 Nächste Schritte (aus WORKLOG):
|
||||
- [ ] Schritt 1
|
||||
- [ ] Schritt 2
|
||||
|
||||
💡 Learnings zu beachten:
|
||||
- [Learning 1]
|
||||
- [Learning 2]
|
||||
|
||||
🎫 Offene Issues:
|
||||
#12 - MQTT Integration (in progress)
|
||||
#15 - Dashboard hinzufügen
|
||||
|
||||
❓ Woran möchtest du heute arbeiten?
|
||||
```
|
||||
|
||||
### 5. Arbeitsauswahl
|
||||
|
||||
Frage den Benutzer:
|
||||
- "Woran möchtest du arbeiten?"
|
||||
- Optionen: Next Steps aus WORKLOG, Issues, oder etwas Neues
|
||||
|
||||
### 6. WORKLOG.md aktualisieren
|
||||
|
||||
Aktualisiere Current State:
|
||||
```markdown
|
||||
**Zuletzt:** [HEUTE] auf `[HOSTNAME]`
|
||||
**Status:** Gestartet - [gewählte Aufgabe]
|
||||
```
|
||||
|
||||
Commit ist NICHT nötig bei Session-Start (nur bei Session-End).
|
||||
|
||||
## Checkliste
|
||||
|
||||
- [ ] WORKLOG.md gelesen und verstanden
|
||||
- [ ] Git-Status geprüft
|
||||
- [ ] Gitea Issues geladen (falls verfügbar)
|
||||
- [ ] Kontext-Zusammenfassung präsentiert
|
||||
- [ ] Benutzer hat Arbeitsrichtung gewählt
|
||||
- [ ] Current State in WORKLOG.md aktualisiert
|
||||
|
||||
## Hinweise für Claude
|
||||
|
||||
- **Plan Mode aktivieren** nach Session-Start für strukturierte Arbeit
|
||||
- Learnings aus WORKLOG.md beachten und anwenden
|
||||
- Bei Unklarheiten auf vorherige Session History verweisen
|
||||
- Hostname: `hostname`
|
||||
- Datum: `date +%Y-%m-%d`
|
||||
|
||||
## Integration mit Hooks
|
||||
|
||||
Der automatische Hook (`session-start.sh`) zeigt bereits Basis-Kontext.
|
||||
Dieser Skill geht tiefer und ermöglicht interaktive Planung.
|
||||
|
||||
Workflow-Kombination:
|
||||
1. Claude starten → Hook zeigt Kontext automatisch
|
||||
2. `/session-start` → Detaillierte Planung wenn gewünscht
|
||||
3. Arbeiten...
|
||||
4. `/session-end` → Alles dokumentieren
|
||||
25
templates/WORKLOG.md
Normal file
25
templates/WORKLOG.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Worklog: [PROJEKTNAME]
|
||||
|
||||
## Current State
|
||||
**Zuletzt:** [DATUM] auf `[HOSTNAME]`
|
||||
**Branch:** [BRANCH]
|
||||
**Issue:** [#XX - Beschreibung](https://gitea.egonetix.de/[USER]/[REPO]/issues/XX)
|
||||
**Status:** [Status-Beschreibung]
|
||||
|
||||
## Next Steps
|
||||
- [ ] Nächster Schritt 1
|
||||
- [ ] Nächster Schritt 2
|
||||
- [ ] Nächster Schritt 3
|
||||
|
||||
## Key Decisions
|
||||
<!-- Wichtige Architektur- und Design-Entscheidungen -->
|
||||
- **[DATUM]:** [Entscheidung und Begründung]
|
||||
|
||||
## Learnings (für Claude)
|
||||
<!-- Fehler und Erkenntnisse damit Claude sich verbessert -->
|
||||
<!-- Format: **[DATUM]:** [Learning] -->
|
||||
|
||||
## Session History
|
||||
### [DATUM] | [HOSTNAME] | Commits: `[HASH]`
|
||||
- Initial Setup
|
||||
- [Was wurde gemacht]
|
||||
Reference in New Issue
Block a user