refactor: consolidate nvim crates, extract server library, and update workspace dependencies

This commit is contained in:
Riz Ashraf committed 2026-10-04 01:42:59 +01:00
1 parent a083719cf1
commit 533adfd41b
53 files changed
+5967 -1230

No files matched your search

+20 -15
View File
@@ -19,7 +19,7 @@ shutdown-server:
@Write-Host "Shutting down MCP server gracefully..." -ForegroundColor Cyan
-$token = Get-Content "$env:USERPROFILE\.gemini\mcp_memory\admin.token" -ErrorAction SilentlyContinue; if ($token) { Invoke-RestMethod -Uri "http://127.0.0.1:3000/shutdown" -Method Post -Headers @{ Authorization = "Bearer $token" } -ErrorAction SilentlyContinue } else { Invoke-RestMethod -Uri "http://127.0.0.1:3000/shutdown" -Method Post -ErrorAction SilentlyContinue }
Start-Sleep -Seconds 1
-if (Get-Process mcp-memory-server, mcp-memory-stub, mcp-memory-win-nvim -ErrorAction SilentlyContinue) { Stop-Process -Name mcp-memory-server, mcp-memory-stub, mcp-memory-win-nvim -Force -ErrorAction SilentlyContinue }
-if (Get-Process mcp-memory-server, mcp-memory-stub, mcp-memory-nvim -ErrorAction SilentlyContinue) { Stop-Process -Name mcp-memory-server, mcp-memory-stub, mcp-memory-nvim -Force -ErrorAction SilentlyContinue }
Start-Sleep -Seconds 2
# Build Windows-native binaries
@@ -36,9 +36,11 @@ deploy-win: deploy-server deploy-stub-win deploy-nvim-win deploy-rules-win
stop port="3000":
@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) { Invoke-RestMethod -Uri "http://127.0.0.1:{{port}}/shutdown" -Method Post -Headers @{ Authorization = "Bearer $token" } -ErrorAction SilentlyContinue } else { Invoke-RestMethod -Uri "http://127.0.0.1:{{port}}/shutdown" -Method Post -ErrorAction SilentlyContinue }
Start-Sleep -Seconds 1
-Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
$stopped = $false; for ($i = 1; $i -le 10; $i++) { if (-not (Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue)) { $stopped = $true; Write-Host '✅ Server on port {{port}} shut down gracefully.' -ForegroundColor Green; break }; Start-Sleep -Seconds 1 }
if (-not $stopped -and (Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue)) { Write-Host '⚠️ Server did not exit gracefully within 10s. Force killing process...' -ForegroundColor Yellow; Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }; Start-Sleep -Seconds 2 }
for ($i = 1; $i -le 5; $i++) { if (-not (Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue)) { break }; Start-Sleep -Seconds 1 }
Start-Sleep -Seconds 2
Write-Host '✅ Shutdown complete. Port {{port}} is free.' -ForegroundColor Green
# Start the server in the background (nohup equivalent)
start port="3000":
@@ -81,8 +83,8 @@ deploy-stub-win:
deploy-nvim-win:
@Write-Host "Deploying Windows Nvim..." -ForegroundColor Cyan
-Stop-Process -Name mcp-memory-win-nvim -Force -ErrorAction SilentlyContinue
Copy-Item -Force target\release\mcp-memory-win-nvim.exe "C:\Users\reazul.ashraf\.local\bin\"
-Stop-Process -Name mcp-memory-nvim -Force -ErrorAction SilentlyContinue
Copy-Item -Force target\release\mcp-memory-nvim.exe "C:\Users\reazul.ashraf\.local\bin\"
deploy-rules-win:
@Write-Host "Deploying global Agent rules (Windows)..." -ForegroundColor Cyan
@@ -105,26 +107,26 @@ deploy-stub:
build-nvim:
@Write-Host "Building WSL Nvim natively..." -ForegroundColor Cyan
wsl.exe -d Ubuntu -e bash -c 'export PATH="/home/riz/.cargo/bin:$PATH" && cd /mnt/c/Users/reazul.ashraf/workspace/rust/mcp-memory && cargo build --release -p mcp-memory-linux-nvim'
wsl.exe -d Ubuntu -e bash -c 'export PATH="/home/riz/.cargo/bin:$PATH" && cd /mnt/c/Users/reazul.ashraf/workspace/rust/mcp-memory && cargo build --release -p mcp-memory-nvim'
deploy-nvim:
@Write-Host "Deploying WSL Nvim natively..." -ForegroundColor Cyan
wsl.exe -d Ubuntu -e bash -c 'export PATH="/home/riz/.cargo/bin:$PATH" && cd /mnt/c/Users/reazul.ashraf/workspace/rust/mcp-memory && cp target/release/mcp-memory-linux-nvim /home/riz/.local/bin/'
wsl.exe -d Ubuntu -e bash -c 'export PATH="/home/riz/.cargo/bin:$PATH" && cd /mnt/c/Users/reazul.ashraf/workspace/rust/mcp-memory && cp target/release/mcp-memory-nvim /home/riz/.local/bin/'
deploy-rules-wsl:
@Write-Host "Deploying global Agent rules (WSL)..." -ForegroundColor Cyan
wsl.exe -d Ubuntu -e bash -c 'mkdir -p /home/riz/.gemini/config/rules && cp -r /mnt/c/Users/reazul.ashraf/workspace/rust/mcp-memory/agent-rules/* /home/riz/.gemini/config/rules/'
# Run standard unit tests across the workspace
# Fast parallel test execution using cargo-nextest (default test command)
test:
@Write-Host "Running unit tests across workspace..." -ForegroundColor Cyan
cargo test --workspace
# Fast parallel test execution using cargo-nextest
test-fast:
@Write-Host "Running fast parallel tests via cargo-nextest..." -ForegroundColor Cyan
cargo nextest run --workspace
# Standard sequential cargo test execution
test-cargo:
@Write-Host "Running standard unit tests across workspace..." -ForegroundColor Cyan
cargo test --workspace
# Run configuration tests to ensure eagerTools parity
test-config:
cargo test --release -p mcp-memory-server --test parity_test
@@ -132,7 +134,10 @@ test-config:
# Run tests and generate code coverage report with matching rustup LLVM toolchain
test-coverage:
@Write-Host "Running tests with code coverage..." -ForegroundColor Cyan
$tc = (rustup toolchain list | Select-String "stable").ToString().Split(' ')[0]; $env:LLVM_COV = "$env:USERPROFILE\.rustup\toolchains\$tc\lib\rustlib\x86_64-pc-windows-msvc\bin\llvm-cov.exe"; $env:LLVM_PROFDATA = "$env:USERPROFILE\.rustup\toolchains\$tc\lib\rustlib\x86_64-pc-windows-msvc\bin\llvm-profdata.exe"; cargo llvm-cov --workspace
cargo llvm-cov --workspace --ignore-filename-regex "stub" -- --test-threads=1
# Start the server directly
startup-server:
@@ -152,7 +157,7 @@ all-server-wsl port="3000": (stop port) build-server deploy-server (start port)
build-nvim-win:
@Write-Host 'Building Windows Nvim...' -ForegroundColor Cyan
cargo build --release -p mcp-memory-win-nvim
cargo build --release -p mcp-memory-nvim
# Auto-generate & verify unit tests using local NAS Ollama ($0 tokens)
improve-tests file="server/src/ollama.rs":