From ba49322448ee2d6e0b1c169bd3104f53a30c51ac Mon Sep 17 00:00:00 2001 From: vmsharoshkin Date: Thu, 1 Oct 2026 08:48:02 +0300 Subject: [PATCH] add Windows support --- Makefile | 10 +++- README.md | 21 +++++-- scripts/install.ps1 | 133 ++++++++++++++++++++++++++++++++++++++++++++ scripts/install.sh | 3 + skills/eds/SKILL.md | 15 ++++- 5 files changed, 172 insertions(+), 10 deletions(-) create mode 100644 scripts/install.ps1 diff --git a/Makefile b/Makefile index a0081e8..298c7cd 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,8 @@ PKG := github.com/cloud-ru/evolution-devservices-cli BUILD_DIR := bin DIST_DIR := dist -# Target platforms: Linux + macOS (developers locally + CI runners). -DEFAULT_OSES := darwin linux +# Target platforms: Linux + macOS + Windows (developers locally + CI runners). +DEFAULT_OSES := darwin linux windows DEFAULT_ARCHS := amd64 arm64 OSES ?= $(DEFAULT_OSES) @@ -103,6 +103,7 @@ release: clean build-all # s3://BUCKET/PREFIX/VERSION/eds--[.exe] # s3://BUCKET/PREFIX/latest # contains VERSION # s3://BUCKET/PREFIX/install.sh # copy of scripts/install.sh +# s3://BUCKET/PREFIX/install.ps1 # copy of scripts/install.ps1 # # Usage: # make upload BUCKET=my-bucket PREFIX=evolution-devservices-cli VERSION=v0.2.0 @@ -128,6 +129,9 @@ upload: build-all @aws $(S3_OPTS) s3 cp scripts/install.sh s3://$(BUCKET)/$(PREFIX)/install.sh \ --acl public-read >/dev/null && \ echo " ✔ s3://$(BUCKET)/$(PREFIX)/install.sh" + @aws $(S3_OPTS) s3 cp scripts/install.ps1 s3://$(BUCKET)/$(PREFIX)/install.ps1 \ + --acl public-read >/dev/null && \ + echo " ✔ s3://$(BUCKET)/$(PREFIX)/install.ps1" @printf "%s\n" "$(VERSION)" > $(DIST_DIR)/.latest && \ aws $(S3_OPTS) s3 cp $(DIST_DIR)/.latest s3://$(BUCKET)/$(PREFIX)/latest \ --acl public-read --content-type "text/plain" >/dev/null && \ @@ -166,7 +170,7 @@ clean: help: @echo "Targets:" @echo " build build for the current platform into ./bin/" - @echo " build-all cross-compile darwin/linux × amd64/arm64 into ./dist/" + @echo " build-all cross-compile darwin/linux/windows × amd64/arm64 into ./dist/" @echo " build-one helper for build-all (GOOS=... GOARCH=...)" @echo " release build-all + sha256 checksums" @echo " upload build-all + publish to S3 (BUCKET=... VERSION=...)" diff --git a/README.md b/README.md index 0db7d0c..626f3be 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,21 @@ for secrets. ### From a GitHub Release (recommended) +**macOS / Linux:** + ```bash curl -fsSL https://raw.githubusercontent.com/cloud-ru/evolution-devservices-cli/main/scripts/install.sh | bash export PATH="$HOME/.local/bin:$PATH" eds version ``` +**Windows (PowerShell):** + +```powershell +iwr -useb https://raw.githubusercontent.com/cloud-ru/evolution-devservices-cli/main/scripts/install.ps1 | iex +eds version +``` + The installer detects the platform, downloads the matching static binary from the latest [GitHub Release](https://github.com/cloud-ru/evolution-devservices-cli/releases), places it in `~/.local/bin/eds`, and verifies the install. @@ -42,7 +51,7 @@ You can also grab a binary directly from the [releases page](https://github.com/cloud-ru/evolution-devservices-cli/releases/latest): ```bash -# pick eds-- for your platform, e.g. eds-darwin-arm64, eds-linux-amd64 +# pick eds-- for your platform, e.g. eds-darwin-arm64, eds-linux-amd64, eds-windows-amd64.exe curl -fsSL -o eds \ https://github.com/cloud-ru/evolution-devservices-cli/releases/latest/download/eds-darwin-arm64 chmod +x eds && sudo mv eds /usr/local/bin/eds @@ -56,11 +65,11 @@ cd evolution-devservices-cli go install github.com/cloud-ru/evolution-devservices-cli/cmd/eds@latest # or make build # ./bin/eds -make build-all # cross-compile darwin/linux × amd64/arm64 into ./dist/ +make build-all # cross-compile darwin/linux/windows × amd64/arm64 into ./dist/ ``` -> Target platforms: **Linux + macOS** (developers locally + CI). -> Override the matrix if you ever need to: `make build-all OSES="linux darwin" ARCHS="amd64 arm64"`. +> Target platforms: **Linux + macOS + Windows** (developers locally + CI). +> Override the matrix if you ever need to: `make build-all OSES="linux darwin windows" ARCHS="amd64 arm64"`. ## Configuration @@ -278,6 +287,10 @@ make upload BUCKET=my-bucket PREFIX=evolution-devservices-cli VERSION=v0.2.0 curl -fsSL https://storage.cloud.ru/my-bucket/evolution-devservices-cli/install.sh | \ EDS_CLI_BASE_URL=https://storage.cloud.ru/my-bucket/evolution-devservices-cli bash + +# Or on Windows: +$env:EDS_CLI_BASE_URL = "https://storage.cloud.ru/my-bucket/evolution-devservices-cli" +iwr -useb https://storage.cloud.ru/my-bucket/evolution-devservices-cli/install.ps1 | iex ``` ## Development diff --git a/scripts/install.ps1 b/scripts/install.ps1 new file mode 100644 index 0000000..8345c07 --- /dev/null +++ b/scripts/install.ps1 @@ -0,0 +1,133 @@ +# Self-installer for the Evolution DevServices CLI (eds) on Windows. +# +# Usage: +# iwr -useb https://raw.githubusercontent.com/cloud-ru/evolution-devservices-cli/main/scripts/install.ps1 | iex +# $env:EDS_CLI_VERSION = "v0.2.0"; iwr -useb .../install.ps1 | iex +# +# The script: +# 1. Detects OS / architecture. +# 2. Downloads the matching static binary from a GitHub Release (default) +# or a custom mirror if EDS_CLI_BASE_URL is set. +# 3. Installs it into %LOCALAPPDATA%\Programs\eds (or EDS_CLI_DIR). +# 4. Adds the directory to the user PATH if missing. +# 5. Verifies the install with `eds version`. +# +# Environment variables (overridable): +# EDS_CLI_VERSION - tag/version to download (default: latest) +# EDS_CLI_REPO - GitHub "org/repo" to fetch releases from +# (default: cloud-ru/evolution-devservices-cli) +# EDS_CLI_BASE_URL - base URL of a custom artifact mirror +# EDS_CLI_DIR - install directory (default: $env:LOCALAPPDATA\Programs\eds) +# EDS_CLI_BIN - binary name (default: eds) +# EDS_CLI_QUIET - if set to 1, suppress progress output + +param( + [string]$Version = $env:EDS_CLI_VERSION, + [string]$Repo = $env:EDS_CLI_REPO, + [string]$BaseUrl = $env:EDS_CLI_BASE_URL, + [string]$Dir = $env:EDS_CLI_DIR, + [string]$Bin = $env:EDS_CLI_BIN, + [switch]$Quiet = ($env:EDS_CLI_QUIET -eq "1") +) + +if (-not $Version) { $Version = "latest" } +if (-not $Repo) { $Repo = "cloud-ru/evolution-devservices-cli" } +if (-not $Dir) { $Dir = Join-Path $env:LOCALAPPDATA "Programs\eds" } +if (-not $Bin) { $Bin = "eds" } + +function Write-Log($msg) { + if (-not $Quiet) { Write-Host "[eds-cli installer] $msg" } +} + +# -- detect platform ---------------------------------------------------------- + +$archInfo = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture +switch ($archInfo) { + X64 { $ARCH = "amd64" } + Arm64 { $ARCH = "arm64" } + default { + Write-Error "Unsupported architecture: $archInfo" + exit 1 + } +} + +$OS = "windows" +$EXT = ".exe" +$ASSET = "eds-${OS}-${ARCH}${EXT}" + +# -- resolve download URL ----------------------------------------------------- + +if ($BaseUrl) { + $BaseUrl = $BaseUrl.TrimEnd('/') + if ($Version -eq "latest") { + try { + $Version = (Invoke-WebRequest -Uri "${BaseUrl}/latest" -UseBasicParsing -ErrorAction Stop).Content.Trim() + } catch { + Write-Error "Could not resolve 'latest' version from ${BaseUrl}/latest" + exit 1 + } + } + $URL = "${BaseUrl}/${Version}/${ASSET}" +} else { + if ($Version -eq "latest") { + $URL = "https://github.com/${Repo}/releases/latest/download/${ASSET}" + } else { + $URL = "https://github.com/${Repo}/releases/download/${Version}/${ASSET}" + } +} + +Write-Log "Downloading $URL" + +# -- install ------------------------------------------------------------------ + +if (-not (Test-Path $Dir)) { + New-Item -ItemType Directory -Path $Dir -Force | Out-Null +} + +$Dest = Join-Path $Dir "${Bin}${EXT}" +$Tmp = Join-Path $env:TEMP ([System.IO.Path]::GetRandomFileName()) + +try { + Invoke-WebRequest -Uri $URL -OutFile $Tmp -UseBasicParsing -ErrorAction Stop +} catch { + Write-Error "Download failed: $_" + Remove-Item -Path $Tmp -ErrorAction SilentlyContinue + exit 1 +} + +Move-Item -Path $Tmp -Destination $Dest -Force + +# -- PATH --------------------------------------------------------------------- + +$userPath = [Environment]::GetEnvironmentVariable("Path", "User") +$pathParts = $userPath -split ";" | Where-Object { $_ -ne "" } +$inPath = $false +foreach ($part in $pathParts) { + if ((Resolve-Path $part -ErrorAction SilentlyContinue).Path -eq (Resolve-Path $Dir -ErrorAction SilentlyContinue).Path) { + $inPath = $true + break + } +} +if (-not $inPath) { + $newPath = ($pathParts + $Dir) -join ";" + [Environment]::SetEnvironmentVariable("Path", $newPath, "User") + Write-Log "Added to user PATH: $Dir" + # Also update the current session so `eds` is available immediately + $env:Path = "$Dir;$env:Path" +} + +# -- verify ------------------------------------------------------------------- + +Write-Log "Installed to $Dest" +try { + $ver = & $Dest version 2>$null + if ($LASTEXITCODE -ne 0 -or -not $ver) { + throw "version check failed" + } + Write-Log "Verified: $ver" +} catch { + Write-Error "Installed binary failed to report version" + exit 1 +} + +Write-Output $Dest diff --git a/scripts/install.sh b/scripts/install.sh index e4ed9df..2164c2a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash # Self-installer for the Evolution DevServices CLI (eds). # +# For Windows, use install.ps1 instead: +# iwr -useb https://raw.githubusercontent.com/cloud-ru/evolution-devservices-cli/main/scripts/install.ps1 | iex +# # Usage: # curl -fsSL https://raw.githubusercontent.com/cloud-ru/evolution-devservices-cli/main/scripts/install.sh | bash # EDS_CLI_VERSION=v0.2.0 bash install.sh diff --git a/skills/eds/SKILL.md b/skills/eds/SKILL.md index 14386e2..f14b2c9 100644 --- a/skills/eds/SKILL.md +++ b/skills/eds/SKILL.md @@ -109,16 +109,25 @@ The skill's runtime should arrange for these before the first call. ## Installation inside the agent's sandbox +**macOS / Linux:** + ```bash curl -fsSL https://raw.githubusercontent.com/cloud-ru/evolution-devservices-cli/main/scripts/install.sh | bash export PATH="$HOME/.local/bin:$PATH" eds version # smoke-test ``` -The installer detects the platform (darwin/linux × amd64/arm64), -downloads the matching binary into `~/.local/bin/eds`, and verifies it. +**Windows (PowerShell):** + +```powershell +iwr -useb https://raw.githubusercontent.com/cloud-ru/evolution-devservices-cli/main/scripts/install.ps1 | iex +eds version # smoke-test +``` + +The installer detects the platform (darwin/linux/windows × amd64/arm64), +downloads the matching binary, and verifies it. -Supported platforms: **Linux + macOS** (developers locally + CI). +Supported platforms: **Linux + macOS + Windows** (developers locally + CI). ## Recipes