chore: import upstream snapshot with attribution
.NET Tests / test-codebase (push) Has been cancelled
Translation Validation / validate-translations (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:01:52 +08:00
commit 643e9f9fcb
1003 changed files with 247032 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Regenerates IntegrityTree.json and validates it against the current folder contents.
.PARAMETER Path
The directory whose IntegrityTree.json should be refreshed and validated.
.PARAMETER FailOnUnexpectedFiles
Fail validation if files exist in the directory tree but are not present in
IntegrityTree.json.
#>
[CmdletBinding()]
param(
[Parameter(Mandatory, Position = 0)]
[string] $Path,
[switch] $FailOnUnexpectedFiles
)
$ErrorActionPreference = 'Stop'
if (-not (Test-Path $Path -PathType Container)) {
throw "The directory '$Path' does not exist."
}
$Path = (Resolve-Path $Path).Path
$GenerateScriptPath = Join-Path $PSScriptRoot 'generate-integrity-tree.ps1'
$VerifyScriptPath = Join-Path $PSScriptRoot 'verify-integrity-tree.ps1'
if (-not (Test-Path $GenerateScriptPath -PathType Leaf)) {
throw "Integrity tree generator not found at '$GenerateScriptPath'."
}
if (-not (Test-Path $VerifyScriptPath -PathType Leaf)) {
throw "Integrity tree validator not found at '$VerifyScriptPath'."
}
Write-Host "Refreshing integrity tree in $Path..."
& $GenerateScriptPath -Path $Path -MinOutput
$ValidationParameters = @{ Path = $Path }
if ($FailOnUnexpectedFiles) {
$ValidationParameters.FailOnUnexpectedFiles = $true
}
& $VerifyScriptPath @ValidationParameters