33 [string ]$StagingRoot ,
44 [string []]$IncludePaths ,
55 [switch ]$Apply ,
6- [switch ]$DryRun
6+ [switch ]$DryRun ,
7+ [switch ]$ConfirmDestructive
78)
89
910Set-StrictMode - Version Latest
@@ -16,6 +17,7 @@ $executionMode = Resolve-DeployExecutionMode -Apply:$Apply.IsPresent -DryRun:$Dr
1617$repoRoot = Get-DeployRepoRoot
1718$paths = Get-WebsiteDeploymentPaths - StagingRoot $StagingRoot
1819Test-StagingRootSafety - StagingRoot $paths.stagingRoot
20+ $environment = Assert-DeployEnvironmentReadiness - Paths $paths
1921
2022$normalizedIncludePaths = Normalize- IncludePaths - IncludePaths $IncludePaths
2123if ($normalizedIncludePaths.Count -eq 0 ) {
@@ -27,6 +29,7 @@ if ($normalizedIncludePaths.Count -eq 0) {
2729 $normalizedIncludePaths = Get-DefaultWebsiteIncludePaths
2830 }
2931}
32+ Assert-NormalizedIncludePaths - IncludePaths $normalizedIncludePaths
3033
3134$copyEntries = New-Object System.Collections.Generic.List[object ]
3235foreach ($entry in $normalizedIncludePaths ) {
@@ -56,8 +59,10 @@ if ($executionMode.isDryRun) {
5659 mode = $executionMode.label
5760 siteRoot = $paths.siteRoot
5861 includePaths = $normalizedIncludePaths
62+ dockerCliFound = $environment.dockerCliFound
63+ destructiveConfirmationRequired = $true
5964 }
60- Write-DeployLog - Level " INFO" - Message " Run with - Apply to refresh staged website content ."
65+ Write-DeployLog - Level " INFO" - Message " Next step: run Update-WebsiteRepoDeployment.ps1 - Apply -ConfirmDestructive after reviewing the dry-run output ."
6166 exit 0
6267}
6368
@@ -73,6 +78,9 @@ Ensure-Directory -Path $paths.stagingRoot
7378Ensure- Directory - Path $paths.metaRoot
7479Ensure- Directory - Path $paths.siteRoot
7580
81+ $existingSiteRoot = Test-Path - LiteralPath $paths.siteRoot
82+ Assert-ExplicitDestructiveConfirmation - IsDryRun:$executionMode.isDryRun - ConfirmDestructive:$ConfirmDestructive.IsPresent - OperationName " Update-WebsiteRepoDeployment site refresh" - TargetCount $ (if ($existingSiteRoot ) { 1 } else { 0 })
83+
7684if (Test-Path - LiteralPath $paths.siteRoot ) {
7785 if (-not (Test-PathWithinRoot - Path $paths.siteRoot - RootPath $paths.stagingRoot )) {
7886 throw " Site root safety check failed: $ ( $paths.siteRoot ) "
@@ -111,4 +119,5 @@ Write-DeployLog -Level "SUCCESS" -Message "Updated website deployment staging co
111119 copiedEntries = $copyEntries.Count
112120 dockerfilePath = $paths.dockerfilePath
113121 reportPath = $paths.updateReportPath
122+ dockerCliFound = $environment.dockerCliFound
114123}
0 commit comments