From 77864f4d1096d2e98d9e78ba070a45e0bf27e861 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 19 Nov 2025 12:39:26 +0000 Subject: [PATCH 1/4] Initial plan From 704e9ee525ae898b2540d97f110001f317265585 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 19 Nov 2025 12:48:45 +0000 Subject: [PATCH 2/4] Add wasm-opt = false to wasm Cargo.toml for build environment Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com> --- wasm/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index ba9d67a..e4a2940 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["cdylib", "rlib"] docfind_core = { path = "../core", features = ["wasm"] } wasm-bindgen = "0.2" serde-wasm-bindgen = "0.6" + +[package.metadata.wasm-pack.profile.release] +wasm-opt = false From 38803494c63156976fa1d404fd74d68c0639d446 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 19 Nov 2025 12:56:56 +0000 Subject: [PATCH 3/4] Add version check to install scripts to skip if latest version already installed Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com> --- static/install.ps1 | 35 +++++++++++++++++++++++++++++++++++ static/install.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/static/install.ps1 b/static/install.ps1 index c7838d4..5e3321f 100644 --- a/static/install.ps1 +++ b/static/install.ps1 @@ -38,6 +38,25 @@ function Get-Architecture { } } +# Get the current installed version +function Get-CurrentVersion { + try { + # Check if docfind is in PATH and can be executed + $currentVersionOutput = & $BinaryName --version 2>&1 + if ($LASTEXITCODE -eq 0 -and $currentVersionOutput) { + # Extract version from "docfind X.Y.Z" output + $versionMatch = $currentVersionOutput -match "^$BinaryName\s+(.+)$" + if ($versionMatch -and $Matches[1]) { + return $Matches[1].Trim() + } + } + } + catch { + # Binary not found or not executable + } + return $null +} + # Get the latest release version function Get-LatestVersion { Write-Info "Fetching latest release..." @@ -218,6 +237,22 @@ function Main { Write-Info "Detected platform: $target" $version = Get-LatestVersion + + # Check if already installed with the same version + $currentVersion = Get-CurrentVersion + if ($currentVersion) { + Write-Info "Current version: $currentVersion" + # Strip 'v' prefix from version if present for comparison + $latestVersionNum = $version -replace '^v', '' + if ($currentVersion -eq $latestVersionNum -or $currentVersion -eq $version) { + Write-Info "$BinaryName $currentVersion is already installed (latest version)" + Write-Host "" + Write-Host "If you want to reinstall, please uninstall first:" -ForegroundColor Cyan + Write-Host " Remove-Item (Get-Command $BinaryName).Path" -ForegroundColor Green + exit 0 + } + } + Install-Binary -Version $version -Target $target $pathUpdated = $false diff --git a/static/install.sh b/static/install.sh index b4eb972..fd47946 100644 --- a/static/install.sh +++ b/static/install.sh @@ -62,6 +62,17 @@ detect_platform() { info "Detected platform: $TARGET" } +# Get the current installed version +get_current_version() { + if command -v "$BINARY_NAME" >/dev/null 2>&1; then + # Extract version from "docfind X.Y.Z" output + CURRENT_VERSION=$("$BINARY_NAME" --version 2>/dev/null | sed -E 's/^[^ ]+ //') + if [ -n "$CURRENT_VERSION" ]; then + echo "$CURRENT_VERSION" + fi + fi +} + # Get the latest release version get_latest_version() { info "Fetching latest release..." @@ -184,6 +195,22 @@ main() { detect_platform get_latest_version + + # Check if already installed with the same version + CURRENT_VERSION=$(get_current_version) + if [ -n "$CURRENT_VERSION" ]; then + info "Current version: $CURRENT_VERSION" + # Strip 'v' prefix from VERSION if present for comparison + LATEST_VERSION_NUM=$(echo "$VERSION" | sed 's/^v//') + if [ "$CURRENT_VERSION" = "$LATEST_VERSION_NUM" ] || [ "$CURRENT_VERSION" = "$VERSION" ]; then + info "$BINARY_NAME $CURRENT_VERSION is already installed (latest version)" + echo "" + echo "If you want to reinstall, please uninstall first:" + echo " ${GREEN}rm \$(which $BINARY_NAME)${NC}" + exit 0 + fi + fi + install_binary post_install } From dca763735f6f5aceca5b46de550a74a28ea4104d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 19 Nov 2025 13:05:08 +0000 Subject: [PATCH 4/4] Revert wasm-opt = false change from wasm/Cargo.toml Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com> --- wasm/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index e4a2940..ba9d67a 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -10,6 +10,3 @@ crate-type = ["cdylib", "rlib"] docfind_core = { path = "../core", features = ["wasm"] } wasm-bindgen = "0.2" serde-wasm-bindgen = "0.6" - -[package.metadata.wasm-pack.profile.release] -wasm-opt = false