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
69 changes: 0 additions & 69 deletions pkg/leantui/autocomplete_test.go

This file was deleted.

8 changes: 5 additions & 3 deletions pkg/leantui/banner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import (
"github.com/charmbracelet/x/ansi"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/docker/docker-agent/pkg/leantui/ui"
)

func TestCommitWelcomePadsBanner(t *testing.T) {
t.Parallel()
m := &model{transcript: newTranscript()}
m := &model{screen: ui.NewScreen("", "", "")}
m.commitWelcome()

require.Len(t, m.transcript.blocks, 1)
lines := m.transcript.blocks[0].lines(80)
require.Equal(t, 1, m.screen.Transcript.BlockCount())
lines := m.screen.Transcript.BlockLines(0, 80)
require.GreaterOrEqual(t, len(lines), bannerTopPadding+len(bannerLines))

for i := range bannerTopPadding {
Expand Down
57 changes: 10 additions & 47 deletions pkg/leantui/commands.go
Original file line number Diff line number Diff line change
@@ -1,53 +1,16 @@
package leantui

import (
"sort"
"strings"
)

// commandKind distinguishes built-in lean-TUI commands (handled locally) from
// agent-provided commands and skills (resolved and sent to the agent).
type commandKind int

const (
cmdBuiltin commandKind = iota
cmdAgent
)

type command struct {
name string
desc string
kind commandKind
}
import "github.com/docker/docker-agent/pkg/leantui/ui"

// builtinCommands are the slash commands the lean TUI handles itself.
func builtinCommands() []command {
return []command{
{name: "new", desc: "Start a new session", kind: cmdBuiltin},
{name: "compact", desc: "Summarize and compact the conversation", kind: cmdBuiltin},
{name: "effort", desc: "Set the model's reasoning effort (usage: /effort <level>)", kind: cmdBuiltin},
{name: "clear", desc: "Clear the screen", kind: cmdBuiltin},
{name: "help", desc: "Show keyboard shortcuts and commands", kind: cmdBuiltin},
{name: "exit", desc: "Exit", kind: cmdBuiltin},
{name: "quit", desc: "Exit", kind: cmdBuiltin},
}
}

// filterCommands returns the commands whose name has the given prefix, built-in
// commands first, then agent commands, each group alphabetically sorted.
func filterCommands(all []command, prefix string) []command {
prefix = strings.ToLower(prefix)
var out []command
for _, c := range all {
if strings.HasPrefix(strings.ToLower(c.name), prefix) {
out = append(out, c)
}
func builtinCommands() []ui.Command {
return []ui.Command{
{Name: "new", Desc: "Start a new session", Kind: ui.CmdBuiltin},
{Name: "compact", Desc: "Summarize and compact the conversation", Kind: ui.CmdBuiltin},
{Name: "effort", Desc: "Set the model's reasoning effort (usage: /effort <level>)", Kind: ui.CmdBuiltin},
{Name: "clear", Desc: "Clear the screen", Kind: ui.CmdBuiltin},
{Name: "help", Desc: "Show keyboard shortcuts and commands", Kind: ui.CmdBuiltin},
{Name: "exit", Desc: "Exit", Kind: ui.CmdBuiltin},
{Name: "quit", Desc: "Exit", Kind: ui.CmdBuiltin},
}
sort.SliceStable(out, func(i, j int) bool {
if out[i].kind != out[j].kind {
return out[i].kind < out[j].kind
}
return out[i].name < out[j].name
})
return out
}
134 changes: 0 additions & 134 deletions pkg/leantui/editor_test.go

This file was deleted.

Loading
Loading