package server import ( "context" "os" "git.a-wan.net/alan/pipelines/examples" "git.a-wan.net/alan/pipelines/internal/harness" "git.a-wan.net/alan/pipelines/internal/pipeline" ) func starterDefaults() (string, string) { model, backend := os.Getenv("PIPELINES_DEFAULT_MODEL"), os.Getenv("PIPELINES_DEFAULT_HARNESS") if c, err := harness.Load(); err == nil && c.Default != "" { model = c.Profiles[c.Default].PipelineModel backend = c.Default } return model, backend } // SeedExamples adds the bundled example pipelines to a brand-new database, bound // to the server's configured default model and harness exactly as the template // picker binds them. It is a no-op for an existing or already-seeded database // (see pipeline.Store.SeedExamples) and returns the number created. func SeedExamples(ctx context.Context, store *pipeline.Store) (int, error) { model, backend := starterDefaults() items := examples.Catalog() for i := range items { items[i].Source = pipeline.WithDefaults(items[i].Source, model, backend) } return store.SeedExamples(ctx, items) }