docs: update architecture and design docs with proxy reconnect and deployment strategies
This commit is contained in:
1 parent
a9a861abe1
commit
1da413568e
18 files changed
+2010
-722
No files matched your search
@@ -0,0 +1,100 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
Write-Host "Building mcp-memory (server and stub) for Windows..." -ForegroundColor Cyan
|
||||
& rustup run stable cargo build --release --workspace --exclude mcp-memory-linux-nvim
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Windows build failed!"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Write-Host "Building mcp-memory (server and stub) for Linux (WSL)..." -ForegroundColor Cyan
|
||||
& rustup run stable cargo zigbuild --release --workspace --exclude mcp-memory-win-nvim --target x86_64-unknown-linux-musl
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Linux build failed!"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Write-Host "`nBuild successful! Gracefully shutting down running servers..." -ForegroundColor Green
|
||||
$serverExe = "C:\Users\reazul.ashraf\.local\bin\mcp-memory-server.exe"
|
||||
if (Test-Path $serverExe) {
|
||||
& $serverExe --exit 2>$null
|
||||
}
|
||||
try {
|
||||
Invoke-RestMethod -Uri "http://127.0.0.1:3000/shutdown" -Method Post -ErrorAction SilentlyContinue | Out-Null
|
||||
} catch {}
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
function Get-ExeVersion {
|
||||
param([string]$Path, [string]$EnvName)
|
||||
if ($EnvName -eq 'WSL') {
|
||||
$checkCmd = "if [ -x ""$Path"" ]; then $Path --version; else echo 'Not Found'; fi"
|
||||
$output = wsl.exe -d Ubuntu -e bash -c $checkCmd
|
||||
} else {
|
||||
if (Test-Path $Path) {
|
||||
$output = & $Path --version 2>&1
|
||||
} else {
|
||||
$output = 'Not Found'
|
||||
}
|
||||
}
|
||||
if ([string]::IsNullOrWhiteSpace($output)) { return "No Output / Errored" }
|
||||
return $output.Trim()
|
||||
}
|
||||
|
||||
function Deploy-If-Needed {
|
||||
param([string]$Source, [string]$Dest, [string]$EnvName)
|
||||
|
||||
$sourceVerPath = $Source
|
||||
if ($EnvName -eq 'WSL') {
|
||||
$sourceVerPath = wsl.exe -d Ubuntu -e wslpath -u $Source
|
||||
}
|
||||
|
||||
$sourceVer = Get-ExeVersion -Path $sourceVerPath -EnvName $EnvName
|
||||
$destVer = Get-ExeVersion -Path $Dest -EnvName $EnvName
|
||||
|
||||
if ($sourceVer -eq $destVer -and $sourceVer -ne "Not Found") {
|
||||
Write-Host " Skip: $($Dest) is already up-to-date ($sourceVer)" -ForegroundColor DarkGray
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host " Update: $($Dest) ($destVer -> $sourceVer)" -ForegroundColor Yellow
|
||||
|
||||
if ($EnvName -eq 'WSL') {
|
||||
# Translate source path to WSL path
|
||||
$wslSource = wsl.exe -d Ubuntu -e wslpath -u $Source
|
||||
wsl.exe -d Ubuntu -e bash -c "mv $Dest ${Dest}.`date +%s`.old 2>/dev/null || true; cp $wslSource $Dest && chmod +x $Dest"
|
||||
} else {
|
||||
if (Test-Path $Dest) {
|
||||
$rand = Get-Random
|
||||
Move-Item -Path $Dest -Destination "${Dest}.${rand}.old" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Copy-Item -Path $Source -Destination $Dest -Force
|
||||
}
|
||||
|
||||
$newDestVer = Get-ExeVersion -Path $Dest -EnvName $EnvName
|
||||
if ($newDestVer -eq $sourceVer) {
|
||||
Write-Host " Success: $($Dest) verified as $newDestVer" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Error " Failed: $($Dest) version mismatch after copy! Expected $sourceVer, got $newDestVer"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`nDeploying and verifying binaries..." -ForegroundColor Cyan
|
||||
$winBase = "C:\Users\reazul.ashraf\.local\bin"
|
||||
$wslBase = "/home/riz/.local/bin"
|
||||
$winTarget = "target\release"
|
||||
$wslTarget = "target\x86_64-unknown-linux-musl\release"
|
||||
|
||||
Deploy-If-Needed -Source "$winTarget\mcp-memory-server.exe" -Dest "$winBase\mcp-memory-server.exe" -EnvName "Win"
|
||||
Deploy-If-Needed -Source "$winTarget\mcp-memory-stub.exe" -Dest "$winBase\mcp-memory-stub.exe" -EnvName "Win"
|
||||
Deploy-If-Needed -Source "$winTarget\mcp-memory-win-nvim.exe" -Dest "$winBase\mcp-memory-win-nvim.exe" -EnvName "Win"
|
||||
|
||||
# Note: Source is local windows path, but Deploy-If-Needed translates it to wslpath
|
||||
Deploy-If-Needed -Source "$wslTarget\mcp-memory-server" -Dest "$wslBase/mcp-memory-server" -EnvName "WSL"
|
||||
Deploy-If-Needed -Source "$wslTarget\mcp-memory-stub" -Dest "$wslBase/mcp-memory-stub" -EnvName "WSL"
|
||||
Deploy-If-Needed -Source "$wslTarget\mcp-memory-linux-nvim" -Dest "$wslBase/mcp-memory-linux-nvim" -EnvName "WSL"
|
||||
|
||||
Write-Host "`nCopying instructions.md..." -ForegroundColor Cyan
|
||||
Copy-Item instructions.md "C:\Users\reazul.ashraf\.gemini\antigravity-cli\mcp\memory\instructions.md" -Force
|
||||
wsl.exe -d Ubuntu -e bash -c "mkdir -p /home/riz/.gemini/antigravity-cli/mcp/memory && cp $(wsl.exe -d Ubuntu -e wslpath -u instructions.md) /home/riz/.gemini/antigravity-cli/mcp/memory/instructions.md"
|
||||
|
||||
Write-Host "`nBuild and deployment complete!" -ForegroundColor Green
|
||||
Reference in new issue
Block a user