feat: sync .config dotfiles, transition Node to mise, integrate 1Password CLI/SSH Agent, and add optional AI CLI tools

This commit is contained in:
2026-06-22 17:13:42 +02:00
parent 0379a21780
commit 6b09ba52b6
33 changed files with 837 additions and 1425 deletions
+172
View File
@@ -0,0 +1,172 @@
function tiffy
# --- KONFIGURATION ---
set -l SOURCE_NAME "sources/github/Baerspektivo/projectTiffy"
set -l SESSION_STORE "$HOME/.config/fish/tiffy_session"
# Hilfsfunktion zum Auflisten der verfuegbaren Repos
if test "$argv[1]" = "--list-sources"
echo "Suche verfuegbare Jules-Quellen..."
curl -s "https://jules.googleapis.com/v1alpha/sources" -H "X-Goog-Api-Key: $JULES_API_KEY" | jq .
return
end
# Befehl zum Abholen der letzten Session (tiffy fetch oder tiffy gib)
if test "$argv[1]" = "fetch"; or test "$argv[1]" = "gib"
if test -f "$SESSION_STORE"
read -l S_ID TARGET_FILE < "$SESSION_STORE"
echo "Pruefe letzte Session $S_ID fuer Datei $TARGET_FILE..."
set -l ACT (curl -s "https://jules.googleapis.com/v1alpha/sessions/$S_ID/activities" -H "X-Goog-Api-Key: $JULES_API_KEY")
set -l RES (echo $ACT | jq -r '.activities[]? | (.progressUpdated?.description // .agentMessaged?.agentMessage // empty)' | grep "```" | tail -n 1)
if test -n "$RES"
set -l DETECTED_LANG (echo "$RES" | string match -r '```(\w+)' | head -n 2 | tail -n 1)
set -l EXT "ts"
switch "$DETECTED_LANG"
case "go"; set EXT "go"
case "typescript" "ts"; set EXT "ts"
case "javascript" "js"; set EXT "js"
case "python" "py"; set EXT "py"
case "html"; set EXT "html"
case "json"; set EXT "json"
end
set -l FINAL_TARGET (string replace -r '\.[^.]+$' ".$EXT" "$TARGET_FILE")
echo "$RES" | sed -n '/^```/,/^```/ p' | sed '1d;$d' > "$FINAL_TARGET"
if test ! -s "$FINAL_TARGET"; echo "$RES" > "$FINAL_TARGET"; end
echo "Code erfolgreich nachgeholt und gespeichert: $FINAL_TARGET"
else
echo "Noch kein Code in Session $S_ID gefunden."
end
return
else
echo "Keine gespeicherte Session gefunden."
return 1
end
end
# Befehl um eine Folgefrage mit optionalen neuen Dateien zu senden
if test "$argv[1]" = "ask"
if test -f "$SESSION_STORE"
read -l S_ID TARGET_FILE < "$SESSION_STORE"
set -l ASSET_FILES
set -l MSG_PARTS
# Argumente ab dem zweiten (nach "ask") auf Dateien pruefen
for arg in $argv[2..-1]
if test -f "$arg"
set -a ASSET_FILES "$arg"
else
set -a MSG_PARTS "$arg"
end
end
set -l USER_MSG (string join " " $MSG_PARTS)
set -l ADD_CONTEXT ""
for f in $ASSET_FILES
echo "Lese zusaetzliche Datei: $f"
set ADD_CONTEXT "$ADD_CONTEXT\n\n--- FILE: $f ---\n"(cat "$f")
end
set -l FOLLOW_UP (string join "\n" "$USER_MSG" "$ADD_CONTEXT")
if test -z (string trim "$FOLLOW_UP")
echo "Fehler: Keine Nachricht oder Datei angegeben."
return 1
end
echo "Sende Nachricht und Kontext an bestehende Session $S_ID..."
set -l ESCAPED_FOLLOW_UP (printf "%s" "$FOLLOW_UP" | python3 -c 'import json, sys; print(json.dumps(sys.stdin.read()), end="")')
curl -s "https://jules.googleapis.com/v1alpha/sessions/$S_ID:sendMessage" \
-X POST -H "Content-Type: application/json" -H "X-Goog-Api-Key: $JULES_API_KEY" \
-d "{ \"prompt\": $ESCAPED_FOLLOW_UP }" > /dev/null
# Polling
set -l RESULT ""
echo "Warte auf Antwort..."
for i in (seq 1 36)
sleep 5
set -l ACT_RES (curl -s "https://jules.googleapis.com/v1alpha/sessions/$S_ID/activities" -H "X-Goog-Api-Key: $JULES_API_KEY")
set RESULT (echo $ACT_RES | jq -r '.activities[]? | (.progressUpdated?.description // .agentMessaged?.agentMessage // empty)' | grep "```" | tail -n 1)
if test -n "$RESULT"; break; end
echo -n "."
end
if test -n "$RESULT"
echo -e "\nAntwort erhalten. Speichere..."
set -l FINAL_TARGET (string replace -r '\.[^.]+$' ".ts" "$TARGET_FILE")
echo "$RESULT" | sed -n '/^```/,/^```/ p' | sed '1d;$d' > "$FINAL_TARGET"
echo "Code aktualisiert: $FINAL_TARGET"
else
echo -e "\nKeine schnelle Antwort. Nutze 'tiffy fetch' spaeter."
end
return
else
echo "Keine aktive Session zum Fortfuehren gefunden."
return 1
end
end
# Resume-Modus fuer manuelle ID-Eingabe
if test (count $argv) -eq 1; and string match -r '^\d+$' "$argv[1]" > /dev/null
set -l S_ID "$argv[1]"
set -l ACT (curl -s "[https://jules.googleapis.com/v1alpha/sessions/$S_ID/activities](https://jules.googleapis.com/v1alpha/sessions/$S_ID/activities)" -H "X-Goog-Api-Key: $JULES_API_KEY")
set -l RES (echo $ACT | jq -r '.activities[]? | (.progressUpdated?.description // .agentMessaged?.agentMessage // empty)' | grep "```" | tail -n 1)
echo "$RES"
return
end
# Normaler Session-Start (mehrere Dateien moeglich)
set -l FILES
set -l MSG_PARTS
for arg in $argv
if test -f "$arg"; set -a FILES "$arg"; else; set -a MSG_PARTS "$arg"; end
end
if test (count $FILES) -eq 0; echo "Fehler: Datei nicht gefunden!"; return 1; end
set -l USER_MESSAGE (string join " " $MSG_PARTS)
set -l CONTEXT ""
for f in $FILES
echo "Lese Datei: $f"
set CONTEXT "$CONTEXT\n\n--- FILE: $f ---\n"(cat "$f")
end
set -l ESCAPED_PROMPT (printf "%s" "$USER_MESSAGE\n$CONTEXT" | python3 -c 'import json, sys; print(json.dumps(sys.stdin.read()), end="")')
echo "Session-Start fuer $SOURCE_NAME..."
set -l PAYLOAD "{ \"prompt\": $ESCAPED_PROMPT, \"sourceContext\": { \"source\": \"$SOURCE_NAME\", \"githubRepoContext\": { \"startingBranch\": \"main\" } } }"
set -l SESSION_RESPONSE (curl -s "https://jules.googleapis.com/v1alpha/sessions" \
-X POST -H "Content-Type: application/json" -H "X-Goog-Api-Key: $JULES_API_KEY" -d "$PAYLOAD")
set -l SESSION_ID (echo $SESSION_RESPONSE | jq -r '.id // empty')
if test -z "$SESSION_ID"; echo "API Fehler."; echo $SESSION_RESPONSE | jq .; return 1; end
# Speichert die erste Datei als Referenz fuer den Zielnamen
echo "$SESSION_ID $FILES[1]" > "$SESSION_STORE"
echo "Jules arbeitet... (Session: $SESSION_ID)"
set -l RESULT ""
for i in (seq 1 36)
sleep 5
set -l ACT_RES (curl -s "https://jules.googleapis.com/v1alpha/sessions/$SESSION_ID/activities" -H "X-Goog-Api-Key: $JULES_API_KEY")
set RESULT (echo $ACT_RES | jq -r '.activities[]? | (.progressUpdated?.description // .agentMessaged?.agentMessage // empty)' | grep "```" | tail -n 1)
if test -n "$RESULT"; break; end
echo -n "."
end
if test -z "$RESULT"; echo -e "\nNutze 'tiffy fetch' zum Abrufen."; return 0; end
set -l DETECTED_LANG (echo "$RESULT" | string match -r '```(\w+)' | head -n 2 | tail -n 1)
set -l EXT "ts"
switch "$DETECTED_LANG"
case "go"; set EXT "go"
case "typescript" "ts"; set EXT "ts"
case "javascript" "js"; set EXT "js"
case "python" "py"; set EXT "py"
end
set -l TARGET_FILE (string replace -r '\.[^.]+$' ".$EXT" "$FILES[1]")
echo "$RESULT" | sed -n '/^```/,/^```/ p' | sed '1d;$d' > "$TARGET_FILE"
echo -e "\nCode lokal gespeichert: $TARGET_FILE"
end