Files
CrossRelay/scripts/build-gateway.ps1
T
kate522 f8acf31ebc CrossRelay stage 0+1: Go gateway with Anthropic<->Chat Completions relay, Tauri shell, bilingual management UI
- Go gateway (stdlib only): /v1/messages non-stream + SSE, /v1/messages/count_tokens,
  management API /api/* (providers CRUD, apply/restore, settings, backups, logs)
- Protocol conversion: Anthropic Messages <-> Chat Completions with a streaming
  state machine keyed by content block index (text, tool_use, parallel calls)
- ~/.claude/settings.json guarded read/write: timestamped backups, managed env
  keys only, one-click restore
- Tauri 2 shell: spawns the gateway sidecar, parses the random port from stdout,
  stdin pipe watchdog prevents orphans, kills the child on exit
- React frontend: Dashboard/Providers/Settings, zh-CN + en-US, TanStack Query
- Tests: Go table-driven + httptest integration (all green), vitest + RTL
2026-10-18 17:19:13 +08:00

26 lines
758 B
PowerShell

# Builds the CrossRelay gateway binary into bin/.
# Usage: powershell -File scripts/build-gateway.ps1 [-GOOS windows|darwin|linux] [-GOARCH amd64|arm64]
param(
[string]$GOOS = "windows",
[string]$GOARCH = "amd64"
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$binDir = Join-Path $repoRoot "bin"
New-Item -ItemType Directory -Force -Path $binDir | Out-Null
$exe = if ($GOOS -eq "windows") { "gateway.exe" } else { "gateway" }
$out = Join-Path $binDir "$GOOS-$GOARCH-$exe"
$env:GOOS = $GOOS
$env:GOARCH = $GOARCH
go build -o $out ./cmd/gateway
# Keep a stable name for the current platform so the Tauri app finds it.
$stable = Join-Path $binDir $exe
Copy-Item $out $stable -Force
Write-Host "built $out (also $stable)"