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
8 changes: 7 additions & 1 deletion .github/workflows/rust-port-alpha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,13 @@ jobs:
printf '**Experimental alpha of the GoDaddy CLI Rust port.** Built from `%s` on %s.\n\n' "$SHORT_SHA" "$BUILT_ON"
printf 'Installs as `gddy` so you can try it alongside the legacy `godaddy` CLI. It tracks the tip of the `rust-port` branch and is overwritten on every push — expect breakage.\n\n'
printf 'Install / update (public repo — no auth needed):\n\n'
printf 'macOS / Linux (and Git Bash / MSYS2 / Cygwin on Windows):\n\n'
printf '```\n'
printf 'curl -fsSL https://github.com/%s/releases/download/alpha/install.sh | bash\n' "$REPO"
printf '```\n\n'
printf 'Windows (PowerShell):\n\n'
printf '```\n'
printf 'irm https://github.com/%s/releases/download/alpha/install.ps1 | iex\n' "$REPO"
printf '```\n'
} > alpha-notes.md

Expand All @@ -193,4 +198,5 @@ jobs:
dist/gddy-aarch64-apple-darwin.tar.gz \
dist/gddy-x86_64-pc-windows-msvc.zip \
dist/gddy-checksums-sha256.txt \
install.sh
install.sh \
install.ps1
Comment thread
jpage-godaddy marked this conversation as resolved.
Resolved
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ docs/
.DS_Store
.vscode/settings.json
**/.claude/settings.local.json

# Claude Code local runtime state (per-machine, not for commit)
**/.claude/scheduled_tasks.lock
**/.claude/scheduled_tasks.json
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,25 @@ gddy --help

The CLI is being rewritten in Rust on the `rust-port` branch with expanded functionality. An experimental **`gddy`** binary is available that can be installed **alongside** the current `godaddy` CLI, so you can try it without disturbing your existing setup.

To install it, run the following:
To install it, run the following.

**macOS / Linux (and Git Bash / MSYS2 / Cygwin on Windows):**

```bash
curl -fsSL https://github.com/godaddy/cli/releases/download/alpha/install.sh | bash
gddy --version
```

The installer supports macOS and Linux. On Windows, download the `gddy-x86_64-pc-windows-msvc.zip` asset from the [`alpha` release](https://github.com/godaddy/cli/releases/tag/alpha) and put `gddy.exe` on your `PATH`.
**Windows (PowerShell):**

```powershell
irm https://github.com/godaddy/cli/releases/download/alpha/install.ps1 | iex
gddy --version
```

Both installers download, checksum-verify, and install the binary for your
platform (`gddy.exe` on Windows). If you'd rather install by hand, download the
`gddy-x86_64-pc-windows-msvc.zip` asset from the [`alpha` release](https://github.com/godaddy/cli/releases/tag/alpha) and put `gddy.exe` on your `PATH`.

## Output Contract

Expand Down
154 changes: 154 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<#
.SYNOPSIS
gddy installer (Rust-port alpha) for Windows / PowerShell.

.DESCRIPTION
Downloads, verifies, and installs the GoDaddy CLI Rust-port ALPHA binary
(gddy.exe) from the rolling `alpha` GitHub prerelease.

`gddy` installs alongside the legacy `godaddy` CLI so you can run both. It is
an experimental build that tracks the tip of `rust-port`; expect breakage.

macOS/Linux (and Git Bash/MSYS2/Cygwin) users should use install.sh instead.

.PARAMETER Prefix
Install directory. Defaults to "$env:LOCALAPPDATA\Programs\gddy".

.EXAMPLE
irm https://github.com/godaddy/cli/releases/download/alpha/install.ps1 | iex

.EXAMPLE
.\install.ps1 -Prefix "C:\tools\gddy"
#>
[CmdletBinding()]
param(
[string]$Prefix
)
Comment thread
jpage-godaddy marked this conversation as resolved.
Resolved

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

$Repo = 'godaddy/cli'
$Tag = 'alpha'

function Write-Info { param([string]$Message) Write-Host "==> $Message" -ForegroundColor Blue }
function Write-Warn { param([string]$Message) Write-Host "WARN: $Message" -ForegroundColor Yellow }
# Use `throw`, not `exit`: the documented invocation is `irm ... | iex`, which
# runs this script in the caller's session — `exit` would close their terminal.
function Die { param([string]$Message) Write-Host "ERROR: $Message" -ForegroundColor Red; throw $Message }

# Resolve the default install dir here (not in the param default) so a missing
# LOCALAPPDATA can fall back / error cleanly instead of throwing in Join-Path
# before Die is available.
if (-not $Prefix) {
$base = if ($env:LOCALAPPDATA) { $env:LOCALAPPDATA }
elseif ($env:USERPROFILE) { $env:USERPROFILE }
else { Die "Cannot determine a default install directory (LOCALAPPDATA and USERPROFILE are both unset). Re-run with -Prefix <dir>." }
$Prefix = Join-Path $base 'Programs\gddy'
}

# Force TLS 1.2 for older PowerShell / .NET defaults.
try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocol]::Tls12 } catch { }

# ── 1. Detect platform ───────────────────────────────────────────────────────

$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLower()
switch ($arch) {
'x64' { $platform = 'x86_64-pc-windows-msvc' }
default {
Die ("Unsupported architecture '$arch'. Only x86_64-pc-windows-msvc is published today. " +
"Download the matching asset manually from https://github.com/$Repo/releases/tag/$Tag")
}
}

$bin = 'gddy.exe'
$archive = "gddy-$platform.zip"
$checksums = 'gddy-checksums-sha256.txt'
$baseUrl = "https://github.com/$Repo/releases/download/$Tag"

Write-Info "Detected platform: $platform"
Write-Info "Installing gddy alpha ($Tag)"

# ── 2. Download + verify ─────────────────────────────────────────────────────

$work = Join-Path ([System.IO.Path]::GetTempPath()) ("gddy-" + [System.Guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $work -Force | Out-Null
try {
$archivePath = Join-Path $work $archive
$checksumsPath = Join-Path $work $checksums

Write-Info "Downloading $archive and checksums..."
try {
Invoke-WebRequest -Uri "$baseUrl/$archive" -OutFile $archivePath -UseBasicParsing
} catch {
Die "Failed to download $archive. Has the $Tag release been published yet?"
}
try {
Invoke-WebRequest -Uri "$baseUrl/$checksums" -OutFile $checksumsPath -UseBasicParsing
} catch {
Die "Failed to download $checksums."
}
Comment thread
jpage-godaddy marked this conversation as resolved.
Resolved

Write-Info "Verifying checksum..."
# Each line is "<sha256> <filename>"; match the filename exactly.
$expected = $null
foreach ($line in Get-Content $checksumsPath) {
$parts = $line -split '\s+', 2
if ($parts.Count -eq 2 -and $parts[1].Trim() -eq $archive) {
$expected = $parts[0].Trim().ToLower()
break
}
}
if (-not $expected) { Die "Checksum for $archive not found in $checksums." }

$actual = (Get-FileHash -Algorithm SHA256 -LiteralPath $archivePath).Hash.ToLower()
if ($expected -ne $actual) {
Die "Checksum mismatch!`n Expected: $expected`n Got: $actual"
}
Write-Info "Checksum verified."

# ── 3. Extract + install ─────────────────────────────────────────────────

$extractDir = Join-Path $work 'extract'
New-Item -ItemType Directory -Path $extractDir -Force | Out-Null
Expand-Archive -LiteralPath $archivePath -DestinationPath $extractDir -Force

$extractedBin = Join-Path $extractDir $bin
if (-not (Test-Path -LiteralPath $extractedBin)) {
Die "Unexpected archive layout — expected a '$bin' binary at the archive root."
}

New-Item -ItemType Directory -Path $Prefix -Force | Out-Null
$destBin = Join-Path $Prefix $bin
Copy-Item -LiteralPath $extractedBin -Destination $destBin -Force
Write-Info "Binary installed to $destBin"

# ── 4. PATH ──────────────────────────────────────────────────────────────

$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
$onPath = ($userPath -split ';' | Where-Object { $_.TrimEnd('\') -ieq $Prefix.TrimEnd('\') }).Count -gt 0
if (-not $onPath) {
$newPath = if ([string]::IsNullOrEmpty($userPath)) { $Prefix } else { "$userPath;$Prefix" }
[Environment]::SetEnvironmentVariable('Path', $newPath, 'User')
$env:Path = "$env:Path;$Prefix" # current session
Write-Info "Added $Prefix to your user PATH (restart your shell for new shells to see it)."
}
} finally {
Remove-Item -Recurse -Force -LiteralPath $work -ErrorAction SilentlyContinue
}

# ── 5. Success ────────────────────────────────────────────────────────────────

Write-Host ""
Write-Info "gddy alpha ($Tag) installed successfully!"
Write-Host ""
Write-Host " Binary: $(Join-Path $Prefix $bin)"
Write-Host " Verify: gddy --version"
Write-Host ""
Write-Host " Note: this is an experimental Rust-port alpha that installs alongside"
Write-Host " the current 'godaddy' CLI."
Write-Host ""
Write-Host "Share this one-liner with your team:"
Write-Host ""
Write-Host " irm https://github.com/$Repo/releases/download/$Tag/install.ps1 | iex"
Write-Host ""
84 changes: 72 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set -euo pipefail
REPO="godaddy/cli"
TAG="alpha"
PREFIX="/usr/local/bin"
PREFIX_EXPLICIT=0 # set when the user passes --prefix; gates the Windows default

# ── 1. Arg parsing ──────────────────────────────────────────────────────────

Expand All @@ -29,7 +30,9 @@ Usage:
bash install.sh [OPTIONS]

Options:
--prefix DIR Binary install directory (default: /usr/local/bin)
--prefix DIR Binary install directory
(default: /usr/local/bin on macOS/Linux;
%LOCALAPPDATA%\Programs\gddy on Windows)
--help Show this help message

Examples:
Expand All @@ -38,9 +41,16 @@ Examples:

Prerequisites:
- curl
- tar
- tar (macOS/Linux archives)
- unzip or powershell.exe (Windows .zip, e.g. under Git Bash/MSYS)
- sha256sum (coreutils) or shasum
- install (coreutils)

Windows:
This script also runs under Git Bash / MSYS2 / Cygwin: it fetches the
x86_64-pc-windows-msvc .zip and installs gddy.exe. On Windows the default
prefix is %LOCALAPPDATA%\Programs\gddy (user-writable, no sudo) unless you
pass --prefix. For a native PowerShell install instead, use install.ps1.
Comment thread
jpage-godaddy marked this conversation as resolved.
Resolved
EOF
exit 0
}
Expand All @@ -49,7 +59,7 @@ while [ $# -gt 0 ]; do
case "$1" in
--prefix)
if [ $# -lt 2 ]; then echo "Error: --prefix requires a directory argument." >&2; exit 1; fi
PREFIX="$2"; shift 2 ;;
PREFIX="$2"; PREFIX_EXPLICIT=1; shift 2 ;;
--help|-h) usage ;;
*) echo "Unknown option: $1" >&2; exit 1 ;;
esac
Expand All @@ -62,8 +72,9 @@ warn() { printf "\033[1;33mWARN:\033[0m %s\n" "$1"; }
error() { printf "\033[1;31mERROR:\033[0m %s\n" "$1" >&2; exit 1; }

command -v curl >/dev/null 2>&1 || error "curl is required but not found."
command -v tar >/dev/null 2>&1 || error "tar is required but not found."
command -v install >/dev/null 2>&1 || error "install (coreutils) is required but not found."
# The extraction tool (tar vs unzip/powershell) is OS-specific and checked after
# platform detection below.

# Detect SHA-256 tool.
if command -v sha256sum >/dev/null 2>&1; then
Expand All @@ -82,7 +93,10 @@ ARCH="$(uname -m)"
case "$OS" in
darwin) ;;
linux) ;;
*) error "Unsupported OS: $OS. gddy supports darwin and linux." ;;
# Git Bash, MSYS2, and Cygwin report e.g. "mingw64_nt-10.0-26200"; normalize
# them all to "windows" and install the native gddy.exe from the .zip asset.
mingw*|msys*|cygwin*|windows*) OS="windows" ;;
*) error "Unsupported OS: $OS. gddy supports darwin, linux, and windows (Git Bash/MSYS2/Cygwin)." ;;
esac

case "$ARCH" in
Expand All @@ -98,14 +112,38 @@ case "${OS}-${ARCH}" in
darwin-aarch64) PLATFORM="aarch64-apple-darwin" ;;
linux-x86_64) PLATFORM="x86_64-unknown-linux-gnu" ;;
linux-aarch64) PLATFORM="aarch64-unknown-linux-gnu" ;;
windows-x86_64) PLATFORM="x86_64-pc-windows-msvc" ;;
*) error "Unsupported platform: ${OS}-${ARCH}" ;;
esac

# Windows ships a .zip with gddy.exe; the unix targets ship a .tar.gz with gddy.
if [ "$OS" = "windows" ]; then
BIN="gddy.exe"
ARCHIVE_EXT="zip"
# /usr/local/bin is a poor default on Windows shells: there's usually no sudo
# and it often isn't user-writable (Git for Windows lives under Program Files).
# Default to a user-writable dir matching install.ps1 unless --prefix was given.
if [ "$PREFIX_EXPLICIT" = "0" ]; then
if [ -n "${LOCALAPPDATA:-}" ]; then
lad="$(cygpath -u "$LOCALAPPDATA" 2>/dev/null || printf '%s' "$LOCALAPPDATA")"
PREFIX="${lad}/Programs/gddy"
elif [ -n "${HOME:-}" ]; then
PREFIX="${HOME}/bin"
else
error "Cannot determine a default install directory (LOCALAPPDATA and HOME are unset). Re-run with --prefix <dir>."
fi
fi
Comment thread
jpage-godaddy marked this conversation as resolved.
Resolved
else
BIN="gddy"
ARCHIVE_EXT="tar.gz"
fi
Comment thread
jpage-godaddy marked this conversation as resolved.
Resolved

info "Detected platform: ${PLATFORM}"
info "Installing gddy alpha (${TAG})"

# ── 4. Download + verify ───────────────────────────────────────────────────

ARCHIVE="gddy-${PLATFORM}.tar.gz"
ARCHIVE="gddy-${PLATFORM}.${ARCHIVE_EXT}"
CHECKSUMS="gddy-checksums-sha256.txt"
BASE_URL="https://github.com/${REPO}/releases/download/${TAG}"
# GNU mktemp accepts a bare `-d`; BSD/macOS mktemp needs a template, so fall
Expand Down Expand Up @@ -139,10 +177,32 @@ info "Checksum verified."

EXTRACT_DIR="${TMPDIR}/extract"
mkdir -p "$EXTRACT_DIR"
tar -xzf "${TMPDIR}/${ARCHIVE}" -C "$EXTRACT_DIR"
if [ "$OS" = "windows" ]; then
# Prefer unzip; fall back to PowerShell's Expand-Archive (always present on
# Windows). cygpath converts the MSYS/Cygwin paths to the Windows form that
# powershell.exe expects.
if command -v unzip >/dev/null 2>&1; then
unzip -q "${TMPDIR}/${ARCHIVE}" -d "$EXTRACT_DIR"
elif command -v powershell.exe >/dev/null 2>&1; then
win_src="$(cygpath -w "${TMPDIR}/${ARCHIVE}" 2>/dev/null || printf '%s' "${TMPDIR}/${ARCHIVE}")"
win_dst="$(cygpath -w "${EXTRACT_DIR}" 2>/dev/null || printf '%s' "${EXTRACT_DIR}")"
# Escape ' as '' so a path containing an apostrophe (legal in Windows
# usernames/paths) can't terminate the PowerShell single-quoted literal.
ps_src="${win_src//\'/\'\'}"
ps_dst="${win_dst//\'/\'\'}"
powershell.exe -NoProfile -NonInteractive -Command \
"Expand-Archive -LiteralPath '${ps_src}' -DestinationPath '${ps_dst}' -Force" \
|| error "Failed to extract ${ARCHIVE} with PowerShell Expand-Archive."
Comment thread
jpage-godaddy marked this conversation as resolved.
Resolved
else
error "Need 'unzip' or 'powershell.exe' to extract ${ARCHIVE} on Windows, but neither was found."
fi
else
command -v tar >/dev/null 2>&1 || error "tar is required to extract ${ARCHIVE} but was not found."
tar -xzf "${TMPDIR}/${ARCHIVE}" -C "$EXTRACT_DIR"
fi
Comment thread
jpage-godaddy marked this conversation as resolved.
Resolved

if [ ! -f "${EXTRACT_DIR}/gddy" ]; then
error "Unexpected archive layout — expected a 'gddy' binary at the archive root."
if [ ! -f "${EXTRACT_DIR}/${BIN}" ]; then
error "Unexpected archive layout — expected a '${BIN}' binary at the archive root."
fi

# Determine if we need sudo for the prefix directory.
Expand Down Expand Up @@ -170,15 +230,15 @@ if [ -n "$SUDO" ]; then
$SUDO mkdir -p "$PREFIX"
fi

$SUDO install -m 755 "${EXTRACT_DIR}/gddy" "${PREFIX}/gddy"
info "Binary installed to ${PREFIX}/gddy"
$SUDO install -m 755 "${EXTRACT_DIR}/${BIN}" "${PREFIX}/${BIN}"
info "Binary installed to ${PREFIX}/${BIN}"

# ── 6. Success ──────────────────────────────────────────────────────────────

echo ""
info "gddy alpha (${TAG}) installed successfully!"
echo ""
echo " Binary: ${PREFIX}/gddy"
echo " Binary: ${PREFIX}/${BIN}"
echo " Verify: gddy --version"
echo ""
echo " Note: this is an experimental Rust-port alpha that installs alongside"
Expand Down
Loading
Loading