Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -103,6 +103,7 @@ release: clean build-all
# s3://BUCKET/PREFIX/VERSION/eds-<os>-<arch>[.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
Expand All @@ -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 && \
Expand Down Expand Up @@ -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=...)"
Expand Down
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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-<os>-<arch> for your platform, e.g. eds-darwin-arm64, eds-linux-amd64
# pick eds-<os>-<arch> 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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
133 changes: 133 additions & 0 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 12 additions & 3 deletions skills/eds/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading