diff --git a/Cargo.lock b/Cargo.lock index c5c9016..ced576d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1365,6 +1365,7 @@ dependencies = [ "tracing-appender", "tracing-subscriber", "uuid", + "winres", ] [[package]] @@ -2787,6 +2788,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "tower" version = "0.5.3" @@ -3437,6 +3447,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml", +] + [[package]] name = "wit-bindgen" version = "0.57.1" diff --git a/deploy.ps1 b/deploy.ps1 index af98c4d..0da240e 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -1,4 +1,32 @@ -Get-Process mcp-memory-* -ErrorAction SilentlyContinue | Stop-Process -Force -Start-Sleep -Seconds 2 -foreach ($b in @('mcp-memory-server.exe', 'mcp-memory-stub.exe', 'mcp-memory-win-nvim.exe')) { $s = 'target\release\' + $b; $d = 'C:\Users\reazul.ashraf\.local\bin\' + $b; if (Test-Path $d) { Remove-Item ($d + '.bak') -Force -ErrorAction SilentlyContinue; Rename-Item $d ($b + '.bak') -Force -ErrorAction SilentlyContinue }; Copy-Item $s $d -Force } -& 'C:\Users\reazul.ashraf\.local\bin\mcp-memory-server.exe' --daemon +try { + Write-Host "Gracefully shutting down server..." + Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:3000/shutdown" -ErrorAction SilentlyContinue + Start-Sleep -Seconds 2 +} catch { + Write-Host "Server might already be down or unreachable." +} + +$binaries = @('mcp-memory-server.exe', 'mcp-memory-stub.exe', 'mcp-memory-win-nvim.exe') +$timestamp = (Get-Date -UFormat "%s") -replace "\.","" + +foreach ($b in $binaries) { + $s = "target\release\$b" + $d = "C:\Users\reazul.ashraf\.local\bin\$b" + + if (Test-Path $d) { + $backupName = "$b.$timestamp.bak" + Write-Host "Renaming $b to $backupName to avoid file locks..." + Rename-Item $d $backupName -Force -ErrorAction SilentlyContinue + } + + if (Test-Path $s) { + Write-Host "Deploying new $b..." + Copy-Item $s $d -Force + } else { + Write-Host "Warning: $s not found, skipping." + } +} + +Write-Host "Starting new mcp-memory-server daemon..." +Start-Process -FilePath "C:\Users\reazul.ashraf\.local\bin\mcp-memory-server.exe" -WindowStyle Hidden +Write-Host "Deployment complete." diff --git a/linux-nvim/build.rs b/linux-nvim/build.rs index 2a2c799..dc9a51c 100644 --- a/linux-nvim/build.rs +++ b/linux-nvim/build.rs @@ -9,15 +9,14 @@ fn main() { .unwrap_or_else(|| "unknown".to_string()); let git_date = Command::new("git") - .args(["log", "-1", "--format=%cd", "--date=format:%Y.%m.%d"]) + .args(["log", "-1", "--format=%cd", "--date=format:%y.%m.%d.%H%M%S"]) .output() .ok() .and_then(|out| String::from_utf8(out.stdout).ok()) .unwrap_or_else(|| "unknown".to_string()); let version = format!( - "{} ({} {})", - env!("CARGO_PKG_VERSION"), + "{} ({})", git_date.trim(), git_hash.trim() ); diff --git a/server/Cargo.toml b/server/Cargo.toml index 3454509..7181ba3 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -31,6 +31,7 @@ rmcp = { version = "3.4.0", features = ["server"] } [build-dependencies] chrono = "0.4.45" +winres = "0.1.12" [dev-dependencies] tempfile = "3.27.0" diff --git a/server/app.ico b/server/app.ico new file mode 100644 index 0000000..c3ba6da Binary files /dev/null and b/server/app.ico differ diff --git a/server/build.rs b/server/build.rs index 2a2c799..af36bd4 100644 --- a/server/build.rs +++ b/server/build.rs @@ -9,17 +9,22 @@ fn main() { .unwrap_or_else(|| "unknown".to_string()); let git_date = Command::new("git") - .args(["log", "-1", "--format=%cd", "--date=format:%Y.%m.%d"]) + .args(["log", "-1", "--format=%cd", "--date=format:%y.%m.%d.%H%M%S"]) .output() .ok() .and_then(|out| String::from_utf8(out.stdout).ok()) .unwrap_or_else(|| "unknown".to_string()); let version = format!( - "{} ({} {})", - env!("CARGO_PKG_VERSION"), + "{} ({})", git_date.trim(), git_hash.trim() ); println!("cargo:rustc-env=APP_VERSION={}", version); + + if std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default() == "windows" { + let mut res = winres::WindowsResource::new(); + res.set_icon("app.ico"); + res.compile().unwrap(); + } } diff --git a/server/src/dashboard.html b/server/src/dashboard.html index eceb38a..2dc8deb 100644 --- a/server/src/dashboard.html +++ b/server/src/dashboard.html @@ -462,7 +462,10 @@