Files
Art-gallery/infra/scripts/harmonize-images.ps1
T
Danila KhodjaefandCursor f247b418d8 Add dev-prod harmonize tool for bidirectional catalog and image sync.
Schema migrates dev to prod only; catalog rows merge by updated_at and images by mtime with union merge and conflict reporting.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 11:02:17 +03:00

28 lines
805 B
PowerShell

# Map SMB share for harmonize image step (optional wrapper).
param(
[switch]$SkipConfirm
)
$ErrorActionPreference = "Stop"
. (Join-Path $PSScriptRoot "lib\Deploy-CliResult.ps1")
$smbRoot = "\\192.168.10.122\Gallery"
if ($env:SMB_USER -and $env:SMB_PASSWORD) {
Write-Host "Mapping $smbRoot ..."
net use $smbRoot /user:$env:SMB_USER $env:SMB_PASSWORD 2>&1 | Out-Host
} elseif (-not (Test-Path $smbRoot)) {
Write-Warning "Cannot access $smbRoot (not authenticated)."
Write-Warning "Map the share first or set `$env:SMB_USER and `$env:SMB_PASSWORD."
}
$npmArgs = @('run', 'harmonize:images')
if ($args.Count -gt 0) {
$npmArgs += '--'
$npmArgs += $args
}
$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
Set-Location $RepoRoot
& npm @npmArgs
exit $LASTEXITCODE