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
+84
View File
@@ -79,3 +79,87 @@ func TestCommandLaunchesOnceWithShortSkillReference(t *testing.T) {
t.Fatal("prompt must reference context, not preload instructions")
}
}
func TestPromptStartsWithIntentRatherThanInvestigation(t *testing.T) {
for _, test := range []struct {
name, request, want string
createOnly bool
baseVersion int
}{
{"new", "", "What should this pipeline do?", true, 0},
{"edit", "", "What would you like to change in this pipeline?", false, 1},
{"whitespace", " \n\t", "What would you like to change in this pipeline?", false, 2},
{"request", "Notify on success or error", "briefly acknowledge the request", false, 1},
} {
t.Run(test.name, func(t *testing.T) {
d := draft.Draft{Path: "/private/drafts/workflow.md", Name: "Research a topic", CreateOnly: test.createOnly, BaseVersion: test.baseVersion}
cli := "'/custom/bin/pipelines' --url 'ws://server:8081/connect'"
prompt := Prompt(d, test.request, cli)
if !strings.Contains(prompt, test.want) || !strings.Contains(prompt, "CLI: "+cli) || !strings.Contains(prompt, d.Path+".json") {
t.Fatal("missing launch guidance", prompt)
}
if strings.TrimSpace(test.request) == "" {
if !strings.Contains(prompt, "before reading files or running commands") || strings.Contains(prompt, "Request:") {
t.Fatal("unspecified task invites investigation", prompt)
}
} else if !strings.Contains(prompt, "Request: "+test.request) || strings.Contains(prompt, "What would you like") {
t.Fatal("supplied intent ignored", prompt)
}
})
}
}
func TestSkillUpgradeAddsSelfContainedNotificationReference(t *testing.T) {
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
dir, err := InstallSkill()
if err != nil {
t.Fatal(err)
}
marker := filepath.Join(dir, ".pipelines-managed.json")
data, err := os.ReadFile(marker)
if err != nil {
t.Fatal(err)
}
var hashes map[string]string
if err = json.Unmarshal(data, &hashes); err != nil {
t.Fatal(err)
}
// A real old installation has only the original two managed files.
delete(hashes, "references/notifications.md")
data, _ = json.Marshal(hashes)
if err = os.WriteFile(marker, data, 0600); err != nil {
t.Fatal(err)
}
if err = os.Remove(filepath.Join(dir, "references/notifications.md")); err != nil {
t.Fatal(err)
}
if _, err = InstallSkill(); err != nil {
t.Fatal("old skill cannot upgrade", err)
}
data, err = os.ReadFile(filepath.Join(dir, "references/notifications.md"))
if err != nil {
t.Fatal(err)
}
for _, want := range []string{"on=failure", "on=success,failure", "destination=system", "cancellation", "output.markdown"} {
if !strings.Contains(string(data), want) {
t.Fatal("missing local recipe", want)
}
}
data, err = os.ReadFile(marker)
if err != nil {
t.Fatal(err)
}
if err = json.Unmarshal(data, &hashes); err != nil || hashes["references/notifications.md"] == "" {
t.Fatal("new reference not managed", err)
}
if err = os.WriteFile(filepath.Join(dir, "references/notifications.md"), []byte("user notes"), 0600); err != nil {
t.Fatal(err)
}
if _, err = InstallSkill(); err == nil {
t.Fatal("modified notification guide overwritten")
}
data, _ = os.ReadFile(filepath.Join(dir, "references/notifications.md"))
if string(data) != "user notes" {
t.Fatal("user notes lost")
}
}