diff --git a/justfile b/justfile index 21f89ee..b0bd51b 100644 --- a/justfile +++ b/justfile @@ -5,21 +5,21 @@ default: @just --list # Build and deploy everything across Windows and WSL -all: build-all deploy-all +all port: build-all (deploy-all port) # Build all binaries across Windows and WSL build-all: build-win build-wsl @Write-Host "Build complete across both OS boundaries." -ForegroundColor Green # Deploy all binaries and agent rules across Windows and WSL -deploy-all: deploy-win deploy-wsl +deploy-all port: (deploy-win port) deploy-wsl @Write-Host "Deployment complete across both OS boundaries." -ForegroundColor Green # Build Windows-native binaries build-win: build-ui build-server build-stub-win build-nvim-win # Deploy Windows-native binaries and rules -deploy-win: deploy-server deploy-stub-win deploy-nvim-win deploy-rules-win +deploy-win port: (deploy-server port) deploy-stub-win deploy-nvim-win deploy-rules-win # ========================================================= # 1. LIFECYCLE (Start / Stop / Restart / Verify / Version) @@ -100,9 +100,9 @@ build-nvim: # ========================================================= # Stage updated server binary, perform graceful shutdown, and auto-restart (skips if binary is unchanged) -deploy-server: +deploy-server port: @Write-Host "Deploying Windows Server (Staged Hot-Swap)..." -ForegroundColor Cyan - -& { $src = "target\release\mcp-memory-server.exe"; $targets = @("$env:USERPROFILE\.local\bin\mcp-memory-server.exe", "$env:USERPROFILE\.cargo\bin\mcp-memory-server.exe", "$env:USERPROFILE\.gemini\antigravity-cli\mcp\mcp-memory\mcp-memory.exe", "$env:USERPROFILE\scoop\apps\rustup\current\.cargo\bin\mcp-memory-server.exe"); $srcHash = if (Test-Path $src) { (Get-FileHash $src -Algorithm SHA256).Hash } else { $null }; $updated = $false; foreach ($target in $targets) { $parent = Split-Path $target; if (Test-Path $parent) { if ((Test-Path $target) -and $srcHash -and ((Get-FileHash $target -Algorithm SHA256).Hash -eq $srcHash)) { Write-Host "Skipping copy to $target (identical checksum)." -ForegroundColor Yellow } else { if (Test-Path $target) { $bak = "$target.old.$([guid]::NewGuid().ToString().Substring(0,8))"; Move-Item -Force $target $bak -ErrorAction SilentlyContinue }; Copy-Item -Force $src $target; Get-ChildItem "$parent\mcp-memory-server.exe.old.*" -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue; Write-Host "Copied updated binary to $target" -ForegroundColor Green; $updated = $true } } }; if ($updated -or -not (Get-NetTCPConnection -LocalPort 3000 -State Listen -ErrorAction SilentlyContinue)) { just stop; just start } else { Write-Host "Server binary unchanged and server is running. Skipping restart." -ForegroundColor Green } } + -& { $src = "target\release\mcp-memory-server.exe"; $targets = @("$env:USERPROFILE\.local\bin\mcp-memory-server.exe", "$env:USERPROFILE\.cargo\bin\mcp-memory-server.exe", "$env:USERPROFILE\.gemini\antigravity-cli\mcp\mcp-memory\mcp-memory.exe", "$env:USERPROFILE\scoop\apps\rustup\current\.cargo\bin\mcp-memory-server.exe"); $srcHash = if (Test-Path $src) { (Get-FileHash $src -Algorithm SHA256).Hash } else { $null }; $updated = $false; foreach ($target in $targets) { $parent = Split-Path $target; if (Test-Path $parent) { if ((Test-Path $target) -and $srcHash -and ((Get-FileHash $target -Algorithm SHA256).Hash -eq $srcHash)) { Write-Host "Skipping copy to $target (identical checksum)." -ForegroundColor Yellow } else { if (Test-Path $target) { $bak = "$target.old.$([guid]::NewGuid().ToString().Substring(0,8))"; Move-Item -Force $target $bak -ErrorAction SilentlyContinue }; Copy-Item -Force $src $target; Get-ChildItem "$parent\mcp-memory-server.exe.old.*" -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue; Write-Host "Copied updated binary to $target" -ForegroundColor Green; $updated = $true } } }; if ($updated -or -not (Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue)) { just stop {{port}}; just start {{port}} } else { Write-Host "Server binary unchanged and server is running. Skipping restart." -ForegroundColor Green } } # Deploy Windows-native stub binary (skips if identical checksum) deploy-stub-win: