param( [Parameter(Position=0)][ValidateSet('doctor','sync','snapshot','quick','td','full','status','fetch','logs','cancel','container-up','container-down','container-recreate')][string]$Command='status', [Parameter(ValueFromRemainingArguments=$true)][string[]]$Args ) $ErrorActionPreference='Stop' $root = Split-Path -Parent $PSScriptRoot $invoke = Join-Path $root 'windows\invoke-remote.ps1' if (-not (Test-Path -LiteralPath $invoke)) { throw "missing remote implementation: $invoke" } switch ($Command) { 'doctor' { & (Join-Path $root 'windows\remote-doctor.ps1') @Args } 'status' { & (Join-Path $root 'windows\remote-status.ps1') @Args } 'sync' { # Source authority is Git exact-commit. The SSH remote is canonical; # the HTTP endpoint is a one-shot fallback when the SSH daemon is down. & git push lan HEAD:codex/6400-front-rear-p0fix-local @Args if ($LASTEXITCODE -ne 0) { $http = 'http://36.134.23.28:3000/haitaowang1001/CPLD_temperature_control_board.git' $env:GIT_TERMINAL_PROMPT = '0' & git push $http HEAD:refs/heads/codex/6400-front-rear-p0fix-local @Args } } 'fetch' { & (Join-Path $root 'windows\sync-from-remote.ps1') @Args } default { & $invoke @Args } } exit $LASTEXITCODE