Files
ARCADIA-Studio/harness/experiments/scenario-workspace-gates-2c9cd2b-20260913/original/enumerate-inputs.ps1
T

28 lines
1.8 KiB
PowerShell

#Requires -Version 7.0
$ErrorActionPreference='Stop'
if(Test-Path -LiteralPath (Join-Path $PSScriptRoot 'enumeration.json')){throw 'Preserve existing enumeration; use a new gate for retries.'}
Set-StrictMode -Version Latest
$workspace='C:\Users\User\Documents\Git\ARCADIA-Studio\.local\scenario-workspace-ytr83r-20260913'
$pin='2c9cd2b3e661ef85f11590c7128dcb2f502d0c26'
Push-Location -LiteralPath $workspace
try {
$head=git rev-parse HEAD
if($LASTEXITCODE -ne 0 -or $head -cne $pin){throw 'Wrong frozen pin'}
$status=@(git status --porcelain)
if($LASTEXITCODE -ne 0 -or $status.Count){throw 'Frozen worktree is not clean'}
$scopes=@('crates','docs','examples','build','harness/fixtures','harness/experiments/textual-authoring-20260911')
$roots=@('Cargo.toml','Cargo.lock','rust-toolchain.toml')
$tracked=@(git ls-files -- @roots @scopes)
if($LASTEXITCODE -ne 0){throw 'Git enumeration failed'}
$tracked=@($tracked | ForEach-Object { $_.Replace('\','/') } | Sort-Object -Unique)
$present=@(rg --files @scopes)
if($LASTEXITCODE -ne 0){throw 'Independent rg enumeration failed'}
$present=@(($present+$roots) | ForEach-Object { $_.Replace('\','/') } | Sort-Object -Unique)
if(@(Compare-Object $tracked $present).Count){throw 'Git and actual file memberships differ'}
$gitTree=git rev-parse 'HEAD^{tree}'
if($LASTEXITCODE -ne 0){throw 'Tree identity unavailable'}
$record=[ordered]@{base=$head;tree=$gitTree;workspace=$workspace;capturedUtc=[DateTime]::UtcNow.ToString('o');scopes=$scopes;rootInputs=$roots;gitCount=$tracked.Count;rgCount=$present.Count;gitPaths=$tracked;rgPaths=$present}
$record|ConvertTo-Json -Depth 6|Set-Content -LiteralPath (Join-Path $PSScriptRoot 'enumeration.json') -Encoding utf8
Write-Output ('Verified Git/rg membership '+$tracked.Count+' at '+$head)
} finally {Pop-Location}