prod2u-remote.ps1 1.2 KB

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