diff --git a/lib/waldwaechter.sh b/lib/waldwaechter.sh index 4408078..8132c60 100644 --- a/lib/waldwaechter.sh +++ b/lib/waldwaechter.sh @@ -436,11 +436,16 @@ function crew_help() { Crew-Verwaltung: crew_help Diese Hilfe anzeigen crew_status Status aller 17 Waldwächter - crew_tokens Token-Verbrauch ALLER Charaktere + crew_tokens Token-Verbrauch ALLER Charaktere (Input) + crew_memo Kreative Krümel anzeigen (Output) crew_memory Erinnerungen durchsuchen crew_doctor System-Diagnose (Version, Pfade, Dependencies) crew_syntax Syntax Check aller Scripts +Krümel-Tracking: + crumb_memo Kreativen Link festhalten (Mixcloud, Git, etc.) + crew_memo Alle kreativen Krümel anzeigen + Einzelne Waldwächter: 🔺 Das Dreieck (Foundation): @@ -481,6 +486,132 @@ Beispiele: EOF } +# 📝 crumb_memo - Kreative Output-Krümel festhalten +function crumb_memo() { + local link="$1" + local notiz="${2:-}" + + if [[ -z "$link" ]]; then + echo "📝 Crumb Memo - Kreative Output-Krümel" + echo "" + echo "Verwendung: crumb_memo [notiz]" + echo "" + echo "Beispiele:" + echo " crumb_memo \"https://mixcloud.com/digfafunk/new-mix\"" + echo " crumb_memo \"https://github.com/user/repo\" \"Neues Feature\"" + echo " crumb_memo \"https://soundcloud.com/artist/track\"" + echo " crumb_memo \"https://youtube.com/watch?v=xyz\" \"Tutorial\"" + echo "" + echo "Zeige alle Krümel mit: crew_memo" + return + fi + + # Memo-Datei + local memo_file="${CRUMB_LOGS_DIR}/crumb_memo.json" + mkdir -p "${CRUMB_LOGS_DIR}" + + # Initialisiere Datei wenn nicht vorhanden + if [[ ! -f "$memo_file" ]]; then + echo "[]" > "$memo_file" + fi + + # Erkenne Typ aus URL + local typ="link" + if [[ "$link" =~ mixcloud\.com ]]; then + typ="mixcloud" + elif [[ "$link" =~ soundcloud\.com ]]; then + typ="soundcloud" + elif [[ "$link" =~ (youtube\.com|youtu\.be) ]]; then + typ="youtube" + elif [[ "$link" =~ (github\.com|gitlab\.com) ]]; then + typ="git" + fi + + # Zeitstempel + local zeit=$(date '+%Y-%m-%d %H:%M:%S') + + # Erstelle JSON-Eintrag + local entry=$(jq -n \ + --arg zeit "$zeit" \ + --arg link "$link" \ + --arg typ "$typ" \ + --arg notiz "$notiz" \ + '{zeit: $zeit, link: $link, typ: $typ, notiz: $notiz}') + + # Füge zur Datei hinzu (append) + if [[ -s "$memo_file" ]]; then + # Datei hat Inhalt - füge zum Array hinzu + jq ". += [$entry]" "$memo_file" > "${memo_file}.tmp" && mv "${memo_file}.tmp" "$memo_file" + else + # Datei ist leer - erstelle Array + echo "[$entry]" > "$memo_file" + fi + + # Icon je nach Typ + local icon="🔗" + case "$typ" in + mixcloud) icon="🎧" ;; + soundcloud) icon="🔊" ;; + youtube) icon="📹" ;; + git) icon="💾" ;; + esac + + echo "$icon Krümel gespeichert: $typ" + echo " $link" + if [[ -n "$notiz" ]]; then + echo " 📝 $notiz" + fi +} + +# 📜 crew_memo - Zeige alle kreativen Krümel +function crew_memo() { + local memo_file="${CRUMB_LOGS_DIR}/crumb_memo.json" + + echo "📜 Crumb Memo - Deine kreativen Krümel" + echo "" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + + if [[ ! -f "$memo_file" ]] || [[ ! -s "$memo_file" ]]; then + echo " Noch keine Krümel gespeichert." + echo "" + echo " Füge welche hinzu mit:" + echo " crumb_memo \"https://mixcloud.com/digfafunk/...\"" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + return + fi + + # Zähle Einträge pro Typ + local total=$(jq 'length' "$memo_file") + local mixcloud=$(jq '[.[] | select(.typ == "mixcloud")] | length' "$memo_file") + local soundcloud=$(jq '[.[] | select(.typ == "soundcloud")] | length' "$memo_file") + local youtube=$(jq '[.[] | select(.typ == "youtube")] | length' "$memo_file") + local git=$(jq '[.[] | select(.typ == "git")] | length' "$memo_file") + + # Zeige letzte 10 Einträge + echo "" + jq -r '.[-10:] | reverse | .[] | + if .typ == "mixcloud" then " 🎧" + elif .typ == "soundcloud" then " 🔊" + elif .typ == "youtube" then " 📹" + elif .typ == "git" then " 💾" + else " 🔗" + end + " " + .zeit + " - " + .typ + + (if .notiz != "" then "\n 📝 " + .notiz else "" end) + + "\n " + .link' "$memo_file" + + echo "" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + printf " Gesamt: %d Krümel" "$total" + if [[ $mixcloud -gt 0 ]]; then printf " | 🎧 %d" "$mixcloud"; fi + if [[ $soundcloud -gt 0 ]]; then printf " | 🔊 %d" "$soundcloud"; fi + if [[ $youtube -gt 0 ]]; then printf " | 📹 %d" "$youtube"; fi + if [[ $git -gt 0 ]]; then printf " | 💾 %d" "$git"; fi + echo "" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "" + echo "💡 Output-Transparenz: Was habe ich geschaffen? 💚" +} + # Export functions so they're available in subshells # Note: export -f works in bash, but not in zsh # In zsh, functions are automatically available in the current shell @@ -510,6 +641,8 @@ if [[ -n "$BASH_VERSION" ]]; then export -f crew_doctor export -f crew_syntax export -f crew_help + export -f crumb_memo + export -f crew_memo fi # In zsh, functions are available without export -f