mirror of
https://github.com/db9979/sshtermy.git
synced 2026-12-06 20:54:09 +01:00
* Ziel-Modus im Einsatz + Befehle als Blöcke (UX 1–10) - ? gibt der KI im Ziel-Modus eine Anweisung, ⇧S überspringt mit Grund - Befehl wartet auf Eingabe ([Y/n], Pager, --More--, Press any key): Knöpfe im Panel, der Agent hält an (agent/inputwait.go) - Ziel wartet auf dich in verdecktem Tab: Einblendung, im Hintergrund Desktop-Meldung; Tab zeigt Zustand und Schrittzahl - f startet ein Folgeziel mit den Schritten davor (agent/notes.go) - Dateien, die ein Schritt ändert, werden vorher per SFTP gesichert, u holt sie zurück (agent/changes.go, ui/goalux.go) - Zielverlauf je Verbindung, nur lokal (store/goalruns.go) - Verbindungsabbruch: Ziel hält an, ⏎ setzt nach dem Neuverbinden fort - Selbst getippte Befehle gehen als Schritt mit Ausgabe an die KI - Alt+Bild↑/↓ springt von Befehl zu Befehl, Alt+O listet die Befehle des Tabs (Ausgabe kopieren, an KI, lesen) (ui/cmdblocks.go) - README, README.de, Webseite, Kurzreferenz (PDF) nachgezogen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhGZZ2TUnwsDFTQe1N * Test Sicherung/Zurückholen nur mit Unix-Shell Unter Windows ist die lokale Shell PowerShell mit C:\-Pfaden; die Sicherung erkennt bewusst nur Unix-Befehle mit Unix-Pfaden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhGZZ2TUnwsDFTQe1N --------- Co-authored-by: Claude <noreply@anthropic.com>
46 lines
1.6 KiB
Go
46 lines
1.6 KiB
Go
package agent
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestAnswerLines(t *testing.T) {
|
|
def := "Antwort des Menschen: %s\n"
|
|
if got := answerLine("Port 8080", def); got != "Antwort des Menschen: Port 8080\n" {
|
|
t.Errorf("normale Antwort: %q", got)
|
|
}
|
|
if got := answerLine(Instruction("nimm apt"), def); !strings.HasPrefix(got, "Anweisung des Menschen") || !strings.Contains(got, "nimm apt") {
|
|
t.Errorf("Anweisung: %q", got)
|
|
}
|
|
if got := answerLine(Notice("Verbindung war weg"), def); !strings.HasPrefix(got, "Hinweis von sshTermy: ") {
|
|
t.Errorf("Hinweis: %q", got)
|
|
}
|
|
p := PriorGoal("Nginx installieren", "läuft auf Port 80", 7)
|
|
if !IsPriorGoal(p) {
|
|
t.Fatal("PriorGoal nicht erkennbar")
|
|
}
|
|
if got := answerLine(p, def); !strings.Contains(got, "Schritte 1 bis 7") || !strings.Contains(got, "Nginx installieren") || !strings.Contains(got, "läuft auf Port 80") {
|
|
t.Errorf("früheres Ziel: %q", got)
|
|
}
|
|
if got := answerLine(Instruction("password=geheim123"), def); strings.Contains(got, "geheim123") {
|
|
t.Error("Anweisung wird nicht geschwärzt")
|
|
}
|
|
}
|
|
|
|
func TestManualAndNoteStatus(t *testing.T) {
|
|
var b strings.Builder
|
|
one := 1
|
|
writeHist(&b, []DoneStep{
|
|
{Command: "uptime", Manual: true, Output: "up 3 days"},
|
|
{Command: "false", Manual: true, Exit: &one},
|
|
{Command: "systemctl restart nginx", Skipped: true, Note: "läuft schon"},
|
|
})
|
|
s := b.String()
|
|
for _, want := range []string{"1. uptime (vom Menschen selbst ausgeführt)", "up 3 days", "2. false (vom Menschen selbst ausgeführt, Exit 1)", "übersprungen, Grund: läuft schon"} {
|
|
if !strings.Contains(s, want) {
|
|
t.Errorf("fehlt %q in\n%s", want, s)
|
|
}
|
|
}
|
|
}
|