diff --git a/justfile b/justfile index 7045b3c..21f89ee 100644 --- a/justfile +++ b/justfile @@ -26,28 +26,28 @@ deploy-win: deploy-server deploy-stub-win deploy-nvim-win deploy-rules-win # ========================================================= # Stop the background server gracefully and verify port release -stop port="3000": +stop port: @Write-Host "Shutting down MCP server gracefully on port {{port}}..." -ForegroundColor Cyan -& { $token = Get-Content "$env:USERPROFILE\.gemini\mcp_memory\admin.token" -ErrorAction SilentlyContinue; if ($token) { $hdr = @{ Authorization = "Bearer $($token.Trim())" }; $res = Invoke-RestMethod -Uri "http://127.0.0.1:{{port}}/shutdown" -Method Post -Headers $hdr -ErrorAction SilentlyContinue } else { $res = Invoke-RestMethod -Uri "http://127.0.0.1:{{port}}/shutdown" -Method Post -ErrorAction SilentlyContinue }; if ($res) { Write-Host "✅ Shutdown acknowledged with version details:" -ForegroundColor Green; $res | ConvertTo-Json -Depth 5 }; $procs = @(Get-Process mcp-memory-server -ErrorAction SilentlyContinue); if ($procs.Count -gt 0) { foreach ($p in $procs) { $exited = $p.WaitForExit(10000); if (-not $exited) { Write-Host "⚠️ Process $($p.Id) did not exit within 10s. Force killing..." -ForegroundColor Yellow; $p | Stop-Process -Force -ErrorAction SilentlyContinue } } }; $conns = Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue; if ($conns) { $conns | Select-Object -ExpandProperty OwningProcess | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue } } } @Write-Host "✅ Shutdown complete. Port {{port}} and process are free." -ForegroundColor Green # Start the server in the background and verify /health -start port="3000": +start port: @if (Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue) { Write-Host '⚠️ Server is already running on port {{port}}. Skipping start.' -ForegroundColor Yellow; exit 0 }; Write-Host 'Starting MCP server in background on port {{port}}...' -ForegroundColor Cyan; $env:MCP_PORT='{{port}}'; $env:MCP_UDP_PORT1=$([int]{{port}} + 1); $env:MCP_UDP_PORT2=$([int]{{port}} + 2); .\start_server.ps1 -Port {{port}}; Write-Host 'Waiting up to 40 seconds for /health endpoint...' -ForegroundColor Cyan; for ($i = 1; $i -le 40; $i++) { try { $h = Invoke-RestMethod -Uri 'http://127.0.0.1:{{port}}/health' -ErrorAction Stop; Write-Host "✅ Server is UP! Running Version: $($h.version.app_version) [$($h.version.target_os)/$($h.version.target_arch)]" -ForegroundColor Green; exit 0 } catch { Start-Sleep -Seconds 1 } }; Write-Error '❌ Server failed to start on port {{port}} within 40 seconds.'; exit 1 # Verify deployment health and UI payload response -verify port="3000": +verify port: .\verify_deployment.ps1 -Port {{port}} # Display active running server version and deployed binary CLI version -version port="3000": +version port: @Write-Host "--- Running Server API Version ---" -ForegroundColor Cyan -& { try { $h = Invoke-RestMethod -Uri "http://127.0.0.1:{{port}}/health" -ErrorAction Stop; Write-Host "HTTP /health: $($h.version.app_version) [$($h.version.target_os)/$($h.version.target_arch)]" -ForegroundColor Green } catch { Write-Host "HTTP /health: Server not reachable on port {{port}}" -ForegroundColor Yellow } } @Write-Host "--- Deployed Binary CLI Version ---" -ForegroundColor Cyan -mcp-memory-server --version # Gracefully stop, start, and verify the background server -restart port="3000": (stop port) (start port) (verify port) +restart port: (stop port) (start port) (verify port) # Run server directly in foreground for debugging run-server: @@ -144,26 +144,26 @@ deploy-rules-wsl: # Run fast parallel unit tests via cargo-nextest (and type-check UI) test: check-ui @Write-Host "Running fast parallel tests via cargo-nextest..." -ForegroundColor Cyan - cargo nextest run --workspace + $env:MCP_ALLOW_TMP_FALLBACK='1'; cargo nextest run --workspace # Run dashboard UI endpoint and integrity unit tests test-ui: @Write-Host "Running dashboard UI endpoint and integrity unit tests..." -ForegroundColor Cyan - cargo test -p mcp-memory-server --lib api::setup::tests::test_dashboard_endpoint_and_html_integrity -- --nocapture + $env:MCP_ALLOW_TMP_FALLBACK='1'; cargo test -p mcp-memory-server --lib api::setup::tests::test_dashboard_endpoint_and_html_integrity -- --nocapture # Run standard sequential cargo unit tests test-cargo: @Write-Host "Running standard unit tests across workspace..." -ForegroundColor Cyan - cargo test --workspace + $env:MCP_ALLOW_TMP_FALLBACK='1'; cargo test --workspace # Run configuration parity tests for eagerTools test-config: - cargo test --release -p mcp-memory-server --test parity_test + $env:MCP_ALLOW_TMP_FALLBACK='1'; cargo test --release -p mcp-memory-server --test parity_test # Run workspace unit tests and generate code coverage report test-coverage: @Write-Host "Running tests with code coverage..." -ForegroundColor Cyan - cargo llvm-cov --workspace --ignore-filename-regex "stub" -- --test-threads=1 + $env:MCP_ALLOW_TMP_FALLBACK='1'; cargo llvm-cov --workspace --ignore-filename-regex "stub" -- --test-threads=1 # Auto-generate and verify unit tests using local Ollama model improve-tests file="server/src/ollama.rs": @@ -174,7 +174,7 @@ improve-tests file="server/src/ollama.rs": # ========================================================= # Complete lifecycle: stop, build, deploy, start, and verify Windows server -all-server-win port="3000": (stop port) build-server deploy-server (start port) (verify port) +all-server-win port: (stop port) build-server deploy-server (start port) (verify port) # Complete lifecycle: build and deploy Windows stub all-stub-win: build-stub-win deploy-stub-win @@ -189,7 +189,7 @@ all-stub-wsl: build-stub deploy-stub all-nvim-wsl: build-nvim deploy-nvim # Complete lifecycle: stop, build, deploy, start, and verify WSL server -all-server-wsl port="3000": (stop port) build-server deploy-server (start port) (verify port) +all-server-wsl port: (stop port) build-server deploy-server (start port) (verify port) # Install git hooks (post-commit reconciliation and pre-push gatekeeper) install-git-hooks: