Payload/scripts/kaden/invoke-operator-model-apply.ps1
|
<# .SYNOPSIS Apply the operator model file through the public harness entry. .DESCRIPTION Standalone path for the same apply step Initialize-KadenRepo and Update-KadenRepo run after a managed apply. Reads .kaden.model.json in the child repository and writes those model choices into Kaden-managed agent frontmatter. Does not modify the operator file and does not update Kaden. When an update transaction is incomplete, frontmatter stays as it is and the outcome is not recorded on that transaction. .PARAMETER Path Child repository root. .PARAMETER ShowHelp Show this help and exit. Aliases: -Help, -h. .EXAMPLE pwsh -File scripts/kaden/harness-invoke.ps1 invoke-operator-model-apply.ps1 -Path . .EXAMPLE pwsh -File scripts/kaden/harness-invoke.ps1 invoke-operator-model-apply.ps1 -Help #> #Requires -Version 5.1 [CmdletBinding()] param( [Parameter(Mandatory = $false)] [string]$Path = '', [Alias('h', 'help')] [switch]$ShowHelp ) Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' if ($ShowHelp -or [string]::IsNullOrWhiteSpace($Path)) { Get-Help $PSCommandPath -Full exit 0 } $repoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot (Join-Path '..' '..'))) $localManifest = Join-Path $repoRoot (Join-Path 'tools' (Join-Path 'Kaden' 'Kaden.psd1')) if (Test-Path -LiteralPath $localManifest) { Import-Module $localManifest -Force } else { Import-Module Kaden -Force } $result = Invoke-KadenOperatorModelApply -Path $Path -Confirm:$false $result | ConvertTo-Json -Depth 6 if ($null -ne $result -and [string]$result.Status -eq 'failed') { exit 1 } exit 0 |