Initialize standalone sessions from native local authoring context
This commit is contained in:
@@ -58,6 +58,13 @@ func sessionInitWithDependencies(ctx context.Context, args []string, out io.Writ
|
||||
if strings.TrimSpace(audioDir) != "" && strings.TrimSpace(audioS3Prefix) != "" {
|
||||
return fmt.Errorf("session init: --audio-dir and --audio-s3-prefix are mutually exclusive")
|
||||
}
|
||||
if strings.TrimSpace(audioDir) != "" {
|
||||
var err error
|
||||
audioDir, err = filepath.Abs(audioDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("session init: resolve --audio-dir: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
base, err := loadPipelineCampaignConfigWithDependencies(pipelinePath, campaignPath, campaignFilePath, config.PipelineLoadOptions{Overlay: overlay.pointer()}, secretsDir.pointer(), deps)
|
||||
if err != nil {
|
||||
@@ -83,7 +90,13 @@ func sessionInitWithDependencies(ctx context.Context, args []string, out io.Writ
|
||||
if label == "" {
|
||||
label = "remote session.yml"
|
||||
}
|
||||
sessionCfg, err := config.LoadSessionBytesWithOptions(label, data, config.SessionLoadOptions{
|
||||
// Generated defaults and CLI resources originate at the invocation. A
|
||||
// configured template supplies its own existing local authoring context.
|
||||
authoringPath := "session.yml"
|
||||
if input.TemplateFile != "" {
|
||||
authoringPath = resolveSessionInitTemplatePath(input.CampaignPath, input.TemplateFile)
|
||||
}
|
||||
sessionCfg, err := config.LoadSessionAuthoringBytes(authoringPath, data, config.SessionLoadOptions{
|
||||
SessionID: sessionID,
|
||||
PreviousSessionID: previousSessionID,
|
||||
})
|
||||
@@ -97,6 +110,10 @@ func sessionInitWithDependencies(ctx context.Context, args []string, out io.Writ
|
||||
if err := config.Validate(cfg); err != nil {
|
||||
return fmt.Errorf("session init: %w", err)
|
||||
}
|
||||
data, err = config.RenderSessionDocument(cfg, sessionID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("session init: render effective session: %w", err)
|
||||
}
|
||||
|
||||
if !remote {
|
||||
if err := writeLocalFile(output, data, force); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user