diff --git a/playbook/shopfloor-setup/common/GE-Enforce.ps1 b/playbook/shopfloor-setup/common/GE-Enforce.ps1 index 225c2f0..7564003 100644 --- a/playbook/shopfloor-setup/common/GE-Enforce.ps1 +++ b/playbook/shopfloor-setup/common/GE-Enforce.ps1 @@ -152,6 +152,41 @@ try { } # --- Process manifests in order: common, per-type, per-type+subtype --- + # ---- Manifest dir resolution with alias support --------------- + # The 2026-05-03 rename reorg replaced legacy dir names (standard-machine, + # cmm, keyence, ...) with gea-shopfloor-* equivalents on the share. Fleet + # PCs may still write old names to pc-type.txt during transition. Try + # the constructed dir first; if it has no manifest.json, walk the alias + # set and pick the first that does. See project-shopfloor-rename-reorg + # memory note for the full rename plan. + $pcTypeAliasGroups = @( + @('standard', 'gea-shopfloor-collections', 'gea-shopfloor-nocollections', 'gea-shopfloor-common'), + @('standard-machine', 'gea-shopfloor-collections', 'gea-shopfloor-nocollections'), + @('standard-timeclock', 'gea-shopfloor-common'), + @('cmm', 'gea-shopfloor-cmm'), + @('keyence', 'gea-shopfloor-keyence'), + @('lab', 'gea-shopfloor-common'), + @('waxandtrace', 'gea-shopfloor-waxtrace'), + @('genspect', 'gea-shopfloor-genspect'), + @('display', 'gea-shopfloor-display'), + @('heattreat', 'gea-shopfloor-heattreat') + ) + function Resolve-ManifestDir { + param([string]$DirName) + $primary = Join-Path $driveLetter $DirName + if (Test-Path (Join-Path $primary 'manifest.json')) { return $primary } + foreach ($g in $pcTypeAliasGroups) { + if ($g -contains $DirName.ToLower()) { + foreach ($alias in $g) { + if ($alias -ieq $DirName) { continue } + $candidate = Join-Path $driveLetter $alias + if (Test-Path (Join-Path $candidate 'manifest.json')) { return $candidate } + } + } + } + return $null + } + $targets = @() $commonRoot = Join-Path $driveLetter 'common' @@ -164,21 +199,21 @@ try { $typeDir = $pcType.ToLower() if ($typeDir) { - $typeRoot = Join-Path $driveLetter $typeDir - $typeManifest = Join-Path $typeRoot 'manifest.json' - if (Test-Path $typeManifest) { - $targets += [pscustomobject]@{ Label = $pcType; Manifest = $typeManifest; Root = $typeRoot } + $resolvedRoot = Resolve-ManifestDir -DirName $typeDir + if ($resolvedRoot) { + $typeManifest = Join-Path $resolvedRoot 'manifest.json' + $targets += [pscustomobject]@{ Label = $pcType; Manifest = $typeManifest; Root = $resolvedRoot } } else { - Write-EnforceLog "$typeDir\manifest.json not on share - no type-specific apps for $pcType" + Write-EnforceLog "$typeDir\manifest.json (or aliases) not on share - no type-specific apps for $pcType" } } if ($pcSubType) { $stDir = ($pcType + '-' + $pcSubType).ToLower() - $stRoot = Join-Path $driveLetter $stDir - $stManifest = Join-Path $stRoot 'manifest.json' - if (Test-Path $stManifest) { - $targets += [pscustomobject]@{ Label = "$pcType-$pcSubType"; Manifest = $stManifest; Root = $stRoot } + $resolvedRoot = Resolve-ManifestDir -DirName $stDir + if ($resolvedRoot) { + $stManifest = Join-Path $resolvedRoot 'manifest.json' + $targets += [pscustomobject]@{ Label = "$pcType-$pcSubType"; Manifest = $stManifest; Root = $resolvedRoot } } }