Remove workspace-root configuration and use client run directories

This commit is contained in:
2026-10-09 00:32:00 +01:00
parent 4697bb4465
commit c5a5521015
17 changed files with 97 additions and 116 deletions
+16
View File
@@ -6,6 +6,7 @@ import (
"git.a-wan.net/alan/pipelines/internal/protocol"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/x/ansi"
"os"
"strings"
"testing"
)
@@ -45,6 +46,21 @@ func TestCLIPickerAndMultilinePrompt(t *testing.T) {
}
}
func TestDashboardRunUsesInvocationDirectory(t *testing.T) {
ctx := context.Background()
m := New(ctx, "")
m.detail = &protocol.PipelineDetail{PipelineSummary: protocol.PipelineSummary{ID: 1, Name: "test", Version: 1}}
updated, _ := m.beginRun()
m = updated.(Model)
cwd, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
if m.runWorkspace != cwd {
t.Fatal("dashboard did not use invocation directory", m.runWorkspace, cwd)
}
}
func TestCLISuppliedArgumentsStillRequireConfirmation(t *testing.T) {
m := NewRun(context.Background(), "", RunOptions{Pipeline: "test", Prompt: "task", Workspace: "/repos/a"})
m.detail = &protocol.PipelineDetail{PipelineSummary: protocol.PipelineSummary{ID: 1, Name: "test", Version: 1}}
+17
View File
@@ -2,6 +2,7 @@ package tui
import (
"fmt"
"os"
"strings"
"time"
@@ -32,6 +33,14 @@ func (m Model) runRequest(request protocol.Message) (tea.Model, tea.Cmd) {
m.runError = ""
}
if request.Type == protocol.RunPipeline {
if request.Workspace == "" {
cwd, err := os.Getwd()
if err != nil {
m.appendLine("cannot determine current directory: " + err.Error())
return m, nil
}
request.Workspace = cwd
}
m.runStartRequest = request.ID
m.keys.runs = true
m.runError = ""
@@ -44,6 +53,14 @@ func (m Model) beginRun() (tea.Model, tea.Cmd) {
m.appendLine("open an exact pipeline version first")
return m, nil
}
if m.runWorkspace == "" {
cwd, err := os.Getwd()
if err != nil {
m.appendLine("cannot determine current directory: " + err.Error())
return m, nil
}
m.runWorkspace = cwd
}
m.runForm = 1
m.runInput = newInput()
m.runPrompt = textarea.New()