Complete Promptkit batch execution cutover
This commit is contained in:
@@ -59,6 +59,9 @@ func mergeFile(cfg *Config, path string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("read config %q: %w", path, err)
|
||||
}
|
||||
if err := rejectRetiredExecutionConfig(data); err != nil {
|
||||
return fmt.Errorf("parse config %q: %w", path, err)
|
||||
}
|
||||
if err := yaml.Unmarshal(data, cfg); err != nil {
|
||||
return fmt.Errorf("parse config %q: %w", path, err)
|
||||
}
|
||||
@@ -70,3 +73,20 @@ func mergeFile(cfg *Config, path string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func rejectRetiredExecutionConfig(data []byte) error {
|
||||
var document yaml.Node
|
||||
if err := yaml.Unmarshal(data, &document); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(document.Content) == 0 || document.Content[0].Kind != yaml.MappingNode {
|
||||
return nil
|
||||
}
|
||||
root := document.Content[0]
|
||||
for i := 0; i+1 < len(root.Content); i += 2 {
|
||||
if root.Content[i].Value == "scriptorium" {
|
||||
return fmt.Errorf("scriptorium configuration is no longer supported; migrate to promptkit configuration")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user