Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).ProviderPath $configPath = (Resolve-Path (Join-Path $repoRoot "include/config.h")).ProviderPath $mqttPath = (Resolve-Path (Join-Path $repoRoot "src/mqtt_client.cpp")).ProviderPath $configText = Get-Content -Raw -Path $configPath if ($configText -notmatch 'HA_MANUFACTURER\[\]\s*=\s*"AcidBurns"\s*;') { throw "include/config.h must define HA_MANUFACTURER as exactly ""AcidBurns""." } $mqttText = Get-Content -Raw -Path $mqttPath if ($mqttText -notmatch 'device\["manufacturer"\]\s*=\s*HA_MANUFACTURER\s*;') { throw "src/mqtt_client.cpp must assign device[""manufacturer""] from HA_MANUFACTURER." } if ($mqttText -match 'device\["manufacturer"\]\s*=\s*"[^"]+"\s*;') { throw "src/mqtt_client.cpp must not hardcode manufacturer string literals." } $roots = @( Join-Path $repoRoot "src" Join-Path $repoRoot "include" ) $literalHits = Get-ChildItem -Path $roots -Recurse -File -Include *.c,*.cc,*.cpp,*.h,*.hpp | Select-String -Pattern '"AcidBurns"' | Where-Object { (Resolve-Path $_.Path).ProviderPath -ne $configPath } if ($literalHits) { $details = $literalHits | ForEach-Object { "$($_.Path):$($_.LineNumber)" } throw "Unexpected hardcoded ""AcidBurns"" literal(s) outside include/config.h:`n$($details -join "`n")" } Write-Host "HA manufacturer drift check passed."