05ae530442
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
75 lines
2.6 KiB
Go
75 lines
2.6 KiB
Go
package harness
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/charmbracelet/bubbles/textinput"
|
|
"github.com/charmbracelet/lipgloss"
|
|
"github.com/charmbracelet/x/ansi"
|
|
"github.com/muesli/termenv"
|
|
)
|
|
|
|
// Opt-in, developer-only actual render artifacts for independent UI review.
|
|
// No server, subprocess or credential access; skipped unless explicitly requested.
|
|
func TestHarnessPickerRenderArtifacts(t *testing.T) {
|
|
dir := os.Getenv("PIPELINES_HARNESS_RENDER_DIR")
|
|
if dir == "" {
|
|
t.Skip("set PIPELINES_HARNESS_RENDER_DIR to export actual picker renders")
|
|
}
|
|
if err := os.MkdirAll(dir, 0700); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
profile, dark := lipgloss.ColorProfile(), lipgloss.HasDarkBackground()
|
|
lipgloss.SetColorProfile(termenv.TrueColor)
|
|
defer func() {
|
|
lipgloss.SetColorProfile(profile)
|
|
lipgloss.SetHasDarkBackground(dark)
|
|
}()
|
|
|
|
models := []string{
|
|
"opencode-go/deepseek-v4.1-flash",
|
|
"anthropic/claude-sonnet-4-5-20250929",
|
|
"openai/gpt-5.1-codex",
|
|
"google/gemini-3-pro-preview",
|
|
"local/llama-3.3-70b-instruct",
|
|
}
|
|
long := strings.Repeat("provider/", 4) + strings.Repeat("x", 60)
|
|
cases := []struct {
|
|
name string
|
|
p picker
|
|
plain bool
|
|
width int
|
|
}{
|
|
{"wide-focused", picker{step: "Step 1 of 2", title: "Choose the interactive OpenCode model", purpose: "Used for authoring and debugging sessions.", options: models, current: models[1], index: 1}, false, 100},
|
|
{"narrow-long-model", picker{step: "Step 2 of 2", title: "Choose the default model for new OpenCode pipelines", options: []string{long, "short/model"}, current: "short/model"}, false, 36},
|
|
{"empty-catalog", picker{title: "Choose the interactive Pi model", options: nil}, false, 80},
|
|
{"filter-no-match", picker{title: "Choose the interactive Pi model", options: models}, false, 80},
|
|
{"plain-nocolor", picker{step: "Step 1 of 2", title: "Choose the interactive Pi model", options: models, current: models[0]}, true, 80},
|
|
}
|
|
for _, tc := range cases {
|
|
tc.p.width, tc.p.height, tc.p.plain = tc.width, 24, tc.plain
|
|
tc.p.query = textinput.New()
|
|
if tc.name == "filter-no-match" {
|
|
tc.p.query.SetValue("zzzz")
|
|
}
|
|
for _, theme := range []string{"dark", "light"} {
|
|
lipgloss.SetHasDarkBackground(theme == "dark")
|
|
view := tc.p.View()
|
|
if tc.plain && strings.Contains(view, "\x1b[") {
|
|
t.Fatalf("%s/%s plain render emitted ANSI", tc.name, theme)
|
|
}
|
|
for _, line := range strings.Split(view, "\n") {
|
|
if ansi.StringWidth(line) > tc.width {
|
|
t.Fatalf("%s/%s line overflows %d: %q", tc.name, theme, tc.width, line)
|
|
}
|
|
}
|
|
if err := os.WriteFile(filepath.Join(dir, tc.name+"-"+theme+".ansi"), []byte(view), 0600); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
}
|