feat(v0.5.3): shared workspace-entry helper; resume + last delegate; fresh_remote prompt

This commit is contained in:
2026-05-08 13:59:53 -04:00
parent 08fb5bb1c3
commit f5746df314
8 changed files with 447 additions and 25 deletions
+24
View File
@@ -6,7 +6,9 @@ import (
"runtime"
"strings"
"testing"
"time"
"github.com/warrenronsiek/ctask/internal/session"
"github.com/warrenronsiek/ctask/internal/shell"
)
@@ -128,3 +130,25 @@ func TestPreflightSuccessReturnsTmuxPath(t *testing.T) {
t.Error("expected non-empty tmuxPath on success")
}
}
func TestConfirmFreshRemoteAdoptionRefusesOnNonTTY(t *testing.T) {
wsDir := t.TempDir()
// Write a fresh remote lease so the prompt has data to display.
other := "remote-host-xyz"
l := &session.Lease{
SessionID: "x", Hostname: other,
StartedAt: time.Now().UTC(), LastHeartbeatAt: time.Now().UTC(),
}
if err := session.WriteLease(session.LeasePath(wsDir), l); err != nil {
t.Fatalf("WriteLease: %v", err)
}
withTTYCheck(t, func() bool { return false })
err := confirmFreshRemoteAdoption(wsDir)
if err == nil {
t.Fatal("expected refusal on non-TTY")
}
if !strings.Contains(err.Error(), other) {
t.Errorf("error should name the remote host: %v", err)
}
}