Improve workflow UI, retain stage diffs, and add portable pipeline transfers

Make OpenCode authoring responsive and expand the managed skill references. Add conflict-aware import/export, real-provider reference workflows, and tracked V2 generation for reliable budget accounting.
This commit is contained in:
2026-10-10 20:55:42 +01:00
parent a66d540125
commit c42a19f7d3
81 changed files with 5593 additions and 539 deletions
+63 -11
View File
@@ -43,8 +43,8 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
}
}
m.renderTemplate()
if !strings.Contains(m.templatesView(30), "Submit template") {
t.Fatal("missing visible submit button")
if !strings.Contains(m.templatesView(30), "Create pipeline") {
t.Fatal("missing visible create button")
}
stale, err := draft.Create("unrelated", "unrelated draft source", url, true, 0)
if err != nil {
@@ -53,8 +53,8 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
m.pendingDraft = &editedMsg{name: stale.Name, source: "unrelated draft source", path: stale.Path, createOnly: true}
updated, cmd := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'s'}})
m = updated.(Model)
if cmd != nil || !m.confirmOpen || m.editorOpen || m.pendingDraft.name != "" || m.pendingDraft.path != "" || !m.pendingDraft.createOnly {
t.Fatal("Submit button did not open naming flow without launching an editor", m.pendingDraft)
if !m.confirmOpen || m.editorOpen || m.pendingDraft.name != m.templates[m.templateIndex].Name || m.draftNameInput.Value() != m.pendingDraft.name || m.pendingDraft.path != "" || !m.pendingDraft.createOnly {
t.Fatal("Create button did not open prefilled confirmation without an editor", m.pendingDraft)
}
expected := pipeline.WithDefaultModel(m.templates[m.templateIndex].Source, m.defaultModel)
if m.pendingDraft.source != expected {
@@ -68,13 +68,17 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
}
updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyEnter})
m = updated.(Model)
updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyCtrlA})
m = updated.(Model)
updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyCtrlK})
m = updated.(Model)
updated, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("Simple summary")})
m = updated.(Model)
updated, cmd = m.Update(tea.KeyMsg{Type: tea.KeyEnter})
m = updated.(Model)
items, _ := store.List(ctx)
if cmd != nil || len(items) != 0 || !m.confirmOpen || m.pendingDraft.path == "" {
t.Fatal("naming published before confirmation or failed to retain draft")
if cmd == nil || len(items) != 0 || !m.confirmOpen || m.pendingDraft.path == "" {
t.Fatal("single create confirmation did not send or failed to retain draft")
}
retained, err := draft.Load(m.pendingDraft.path)
if err != nil || retained.Name != "Simple summary" || retained.Server != url || !retained.CreateOnly || retained.BaseVersion != 0 {
@@ -84,11 +88,6 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
if err != nil || text != expected {
t.Fatal("template draft source lost", err)
}
updated, cmd = m.Update(tea.KeyMsg{Type: tea.KeyEnter})
m = updated.(Model)
if cmd == nil {
t.Fatal("publication confirmation did not send")
}
if _, ok := cmd().(sentMsg); !ok {
t.Fatal("publication send failed")
}
@@ -109,4 +108,57 @@ func TestTemplateSubmitNamesRetainsAndExplicitlyPublishesSelectedTemplate(t *tes
if _, err := draft.Load(retained.Path); err != nil {
t.Fatal("publication deleted retained draft", err)
}
// Unchanged defaults also work in one confirmation; duplicate names must never update.
for attempt := 0; attempt < 2; attempt++ {
m.templateOpen, m.keys.templates = true, true
updated, _ = m.updateTemplates(tea.KeyMsg{Type: tea.KeyEnter})
m = updated.(Model)
defaultName := m.templates[m.templateIndex].Name
if m.draftNameInput.Value() != defaultName {
t.Fatal("template name not prefilled")
}
updated, send := m.updateConfirm(tea.KeyMsg{Type: tea.KeyEnter})
m = updated.(Model)
if send == nil {
t.Fatal("default name needed extra confirmation")
}
send()
updated, _ = m.Update(m.read()())
m = updated.(Model)
if attempt == 0 && m.confirmOpen {
t.Fatal("default-name creation failed", m.submitNotice)
}
if attempt == 1 && (!m.confirmOpen || !strings.Contains(m.submitNotice, "already exists")) {
t.Fatal("duplicate name did not stay editable", m.submitNotice)
}
}
items, _ = store.List(ctx)
if len(items) != 2 {
t.Fatal("duplicate creation changed pipelines", items)
}
for _, item := range items {
if item.Version != 1 {
t.Fatal("template silently updated existing pipeline")
}
}
}
func TestPublicationWordingDistinguishesCreateAndUpdate(t *testing.T) {
m := New(context.Background(), "")
m.width = 120
for _, test := range []struct {
createOnly bool
base int
want string
}{{true, 0, "Create pipeline"}, {false, 3, "Update pipeline"}} {
m.pendingDraft = &editedMsg{name: "Workflow", createOnly: test.createOnly, baseVersion: test.base}
view := m.confirmView(24)
if !strings.Contains(view, test.want) || strings.Contains(view, "Submit edited pipeline") || strings.Contains(view, "s submit") {
t.Fatal("wrong publication wording", view)
}
m.confirmOpen = true
if !strings.Contains(m.footerContent(), strings.ToLower(test.want)) {
t.Fatal("wrong publication footer")
}
}
}