@@ -384,12 +384,39 @@ async function compoAction(
384384 }
385385 }
386386
387+ // Check for xrd.yaml in the function directory
388+ const xrdFilePath = path . join ( functionDir , "xrd.yaml" )
389+ let finalOutput : string
390+
391+ if ( fs . existsSync ( xrdFilePath ) ) {
392+ // Read and parse the XRD file
393+ try {
394+ const xrdContent = fs . readFileSync ( xrdFilePath , { encoding : "utf8" } )
395+ const xrdManifest = YAML . parse ( xrdContent )
396+
397+ // Generate multi-document YAML with XRD first, then composition
398+ const xrdYaml = YAML . stringify ( xrdManifest )
399+ const compositionYaml = YAML . stringify ( manifest )
400+
401+ // Combine with document separator
402+ finalOutput = `${ xrdYaml } ---\n${ compositionYaml } `
403+
404+ moduleLogger . info ( `Including XRD from ${ xrdFilePath } for ${ functionName } ` )
405+ } catch ( error ) {
406+ moduleLogger . error ( `Error reading or parsing xrd.yaml for ${ functionName } : ${ error } ` )
407+ // Fall back to composition only
408+ finalOutput = YAML . stringify ( manifest )
409+ }
410+ } else {
411+ // No XRD file, use composition only (existing behavior)
412+ finalOutput = YAML . stringify ( manifest )
413+ }
414+
387415 // Generate the output file
388416 const outputPath = path . join ( manifestsDir , `${ functionName } .compo.yaml` )
389- const yamlOutput = YAML . stringify ( manifest )
390417
391418 // Write the output file
392- fs . writeFileSync ( outputPath , yamlOutput )
419+ fs . writeFileSync ( outputPath , finalOutput )
393420
394421 moduleLogger . info ( `Generated manifest for ${ functionName } : ${ outputPath } ` )
395422 }
0 commit comments