Payload/scripts/kaden/harness/pull-ai-base.ps1
|
#Requires -Version 5.1 <# .SYNOPSIS Pull synced AI base from the Kaden template into this repository. .EXAMPLE .\scripts\kaden\harness\pull-ai-base.ps1 -TemplateRoot %USERPROFILE%\<your-local-repo-root>\kaden .\scripts\kaden\harness\setup-kaden-ai-overlays.ps1 -TemplateRoot %USERPROFILE%\<your-local-repo-root>\kaden .\scripts\kaden\harness\setup-harness-hooks.ps1 #> [CmdletBinding(SupportsShouldProcess = $true)] param( [Parameter(Mandatory = $true)] [string]$TemplateRoot, [string]$TargetRoot = '' ) $ErrorActionPreference = 'Stop' if ([string]::IsNullOrWhiteSpace($TargetRoot)) { $scriptDir = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path } $TargetRoot = (Resolve-Path (Join-Path $scriptDir '..')).Path } $pathsToCopy = @( @{ Source = '.github\agents'; Dest = '.github\agents' }, @{ Source = '.github\skills'; Dest = '.github\skills' }, @{ Source = '.github\agents\knowledge'; Dest = '.github\agents\knowledge' }, @{ Source = '.github\prompts'; Dest = '.github\prompts' }, @{ Source = '.github\evals'; Dest = '.github\evals' }, @{ Source = '.github\copilot-instructions.md'; Dest = '.github\copilot-instructions.md' }, @{ Source = '.github\instructions'; Dest = '.github\instructions' }, @{ Source = '.github\templates'; Dest = '.github\templates' }, @{ Source = '.cursor\rules'; Dest = '.cursor\rules\00-from-template' }, @{ Source = '.cursor\hooks'; Dest = '.cursor\hooks' }, @{ Source = 'scripts\maintainer\sync-cursor-ai.ps1'; Dest = 'scripts\sync-cursor-ai.ps1' }, @{ Source = 'scripts\kaden\harness\setup-kaden-ai-overlays.ps1'; Dest = 'scripts\setup-kaden-ai-overlays.ps1' }, @{ Source = 'docs\kaden'; Dest = 'docs\kaden' } ) foreach ($item in $pathsToCopy) { $src = Join-Path $TemplateRoot $item.Source $dst = Join-Path $TargetRoot $item.Dest if (-not (Test-Path $src)) { Write-Warning "Skip missing template path: $src" continue } if ($PSCmdlet.ShouldProcess($dst, "Copy from $src")) { $parent = Split-Path $dst -Parent if (-not (Test-Path $parent)) { New-Item -ItemType Directory -Path $parent -Force | Out-Null } if (Test-Path $src -PathType Container) { if (Test-Path $dst) { Remove-Item $dst -Recurse -Force } Copy-Item -Path $src -Destination $dst -Recurse -Force } else { Copy-Item -Path $src -Destination $dst -Force } } } $syncScript = Join-Path $TargetRoot 'scripts\sync-cursor-ai.ps1' if (Test-Path $syncScript) { & $syncScript -RepoRoot $TargetRoot } else { Write-Warning "sync-cursor-ai.ps1 not found at $syncScript - run sync manually." } Write-Output "AI base pull complete. Next: .\scripts\kaden\harness\setup-kaden-ai-overlays.ps1 -TemplateRoot <path-to-kaden>; then .\scripts\kaden\harness\setup-harness-hooks.ps1" |