Payload/scripts/lift-harness-to-kaden.ps1

#Requires -Version 5.1
<#
.SYNOPSIS
  Lift matured harness package from this repo into a local Kaden clone.

.DESCRIPTION
  Thin wrapper over merge-harness-to-kaden.ps1 (scripts/harness/ layout).
  Does NOT commit. Review `git status` in TemplateRoot before committing.

  Prefer reviewing merge-harness-to-kaden.ps1 before running - it is the
  authoritative copy plan.

.EXAMPLE
  .\scripts\lift-harness-to-kaden.ps1 -TemplateRoot $env:USERPROFILE\Repos_local\kaden
#>

[CmdletBinding(SupportsShouldProcess = $true)]
param(
    [Parameter(Mandatory = $true)]
    [string]$TemplateRoot,

    [string]$SourceRoot = ''
)

$ErrorActionPreference = 'Stop'

if ([string]::IsNullOrWhiteSpace($SourceRoot)) {
    $SourceRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
}
$TemplateRoot = (Resolve-Path $TemplateRoot).Path

$merge = Join-Path $PSScriptRoot 'merge-harness-to-kaden.ps1'
if (-not (Test-Path -LiteralPath $merge)) {
    throw "Required merge script missing: $merge"
}

Write-Output "Source: $SourceRoot"
Write-Output "Kaden: $TemplateRoot"
Write-Output 'Delegating to merge-harness-to-kaden.ps1 (scripts/harness/ layout)...'
& $merge -TemplateRoot $TemplateRoot -SourceRoot $SourceRoot
exit $LASTEXITCODE