Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/tui/clipboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func validSessionID(id string) bool {
// for a later `bodek --session <id>`. The ✓ Copied flash is the only ack.
func (m *Model) copySessionID() tea.Cmd {
if !validSessionID(m.sessionID) {
return m.transientNoteCmd("no active session yet")
return m.transientNoteCmd("no session yet — the id exists once a session is created; send a prompt first")
}
return m.copyText(m.sessionID)
}
Expand Down
8 changes: 8 additions & 0 deletions internal/tui/copy_session_id_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tui

import (
"strings"
"testing"

"github.com/BackendStack21/bodek/internal/workspace"
Expand Down Expand Up @@ -47,6 +48,13 @@ func TestCopySessionIDWithoutSession(t *testing.T) {
if m.copyFlashing() {
t.Error("nothing was copied — the flash must stay off")
}
// The note must warn and teach: the id only exists once a session is
// created (first prompt), so the operator knows to send a prompt first.
if n := len(m.notices); n == 0 {
t.Fatal("no-session copy must record a visible note")
} else if got := m.notices[n-1]; !strings.Contains(got, "no session") || !strings.Contains(got, "prompt") {
t.Errorf("note = %q, want a warning naming the session and a prompt hint", got)
}
}

// A hostile id must never reach the clipboard — the payload is a
Expand Down
Loading