private/Invoke-PSUModuleTemplate.ps1

function Invoke-PSUModuleTemplate {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [string]
        $TemplateName,

        [Parameter(Mandatory)]
        [string]
        $DestinationPath,

        [Parameter(Mandatory)]
        [System.Collections.IDictionary]
        $TemplateParameters
    )

    if (-not (Get-Module -Name Plaster -ListAvailable)) {
        throw "Plaster module is required but not installed. Install it with: Install-Module -Name Plaster"
    }

    $TemplatePath = Join-Path (Split-Path -Parent $PSScriptRoot) 'Templates' $TemplateName
    if (-not (Test-Path (Join-Path $TemplatePath 'plasterManifest.xml'))) {
        throw "Plaster manifest not found at: $TemplatePath"
    }

    $plasterParams = @{
        TemplatePath    = $TemplatePath
        DestinationPath = $DestinationPath
    }

    foreach ($parameterName in $TemplateParameters.Keys) {
        $plasterParams[$parameterName] = $TemplateParameters[$parameterName]
    }

    Invoke-Plaster @plasterParams
}