feat: ejecutar tests desde el dashboard TUI

Se añade opción "Run Tests" al menú del servidor en el dashboard TUI.
Ejecuta `go test -tags goolm -count=1 ./...` y muestra los resultados
en una pantalla dedicada (ScreenTestOutput) con scroll y opción de re-ejecutar.

Cambios:
- pkg/tui: nuevo MsgTestsDone, ScreenTestOutput, IntentRunTests, updateTestOutput
- pkg/tui/view.go: viewTestOutput con scroll y controles (↑↓ r 0)
- shell/tui/adapter.go: runTests() ejecuta go test con el env del manager
- shell/process/manager.go: buildEnv → BuildEnv (exportado) para que el adapter
  pueda construir el env completo con las variables de .env

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 02:21:17 +00:00
parent 828eb175fe
commit b6fe4f9135
6 changed files with 114 additions and 5 deletions
+36
View File
@@ -18,6 +18,8 @@ func View(model Model) string {
return viewLogs(model)
case ScreenServer:
return viewServer(model)
case ScreenTestOutput:
return viewTestOutput(model)
default:
return ""
}
@@ -236,6 +238,40 @@ func viewServer(m Model) string {
return b.String()
}
func viewTestOutput(m Model) string {
var b strings.Builder
b.WriteString("\n Test Results\n")
b.WriteString(" " + strings.Repeat("─", 60) + "\n")
if m.StatusMsg != "" {
b.WriteString(" " + m.StatusMsg + "\n\n")
}
if len(m.LogLines) == 0 {
b.WriteString(" Running tests...\n")
} else {
visible := visibleLogLines(m)
end := m.LogScroll + visible
if end > len(m.LogLines) {
end = len(m.LogLines)
}
start := m.LogScroll
if start >= len(m.LogLines) {
start = max(0, len(m.LogLines)-1)
}
for _, line := range m.LogLines[start:end] {
if len(line) > m.WindowWidth-4 && m.WindowWidth > 10 {
line = line[:m.WindowWidth-7] + "..."
}
b.WriteString(" " + line + "\n")
}
}
b.WriteString("\n ↑↓ scroll r re-ejecutar 0 volver\n")
return b.String()
}
func countStatuses(agents []AgentView) (running, stopped, disabled int) {
for _, a := range agents {
switch {