cli/tools/install/dev.sh
Snider 4a98d9baf2 feat(cli): wire release command and add installer scripts
- Wire up `core build release` subcommand (was orphaned)
- Wire up `core monitor` command (missing import in full variant)
- Add installer scripts for Unix (.sh) and Windows (.bat)
  - setup: Interactive with variant selection
  - ci: Minimal for CI/CD environments
  - dev: Full development variant
  - go/php/agent: Targeted development variants
- All scripts include security hardening:
  - Secure temp directories (mktemp -d)
  - Architecture validation
  - Version validation after GitHub API call
  - Proper cleanup on exit
  - PowerShell PATH updates on Windows (avoids setx truncation)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 06:22:07 +00:00

46 lines
1.4 KiB
Bash

#!/bin/bash
# Core CLI installer - Multi-repo development variant (full)
# Usage: curl -fsSL https://core.io.in/dev.sh | bash
set -eo pipefail
VERSION="${VERSION:-${1:-latest}}"
REPO="host-uk/core"
BINARY="core"
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$ARCH" in
x86_64|amd64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
if [ "$VERSION" = "latest" ]; then
VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$VERSION" ]; then
echo "Failed to fetch latest version from GitHub API" >&2
exit 1
fi
fi
echo "Installing ${BINARY} ${VERSION} (full) for ${OS}/${ARCH}..."
ARCHIVE="${BINARY}-${OS}-${ARCH}.tar.gz"
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
if ! curl -fsSL "https://github.com/${REPO}/releases/download/${VERSION}/${ARCHIVE}" -o "$TMPDIR/$ARCHIVE"; then
echo "Failed to download ${ARCHIVE}" >&2
exit 1
fi
tar -xzf "$TMPDIR/$ARCHIVE" -C "$TMPDIR"
[ -w /usr/local/bin ] && mv "$TMPDIR/${BINARY}" /usr/local/bin/ || sudo mv "$TMPDIR/${BINARY}" /usr/local/bin/
${BINARY} --version
echo ""
echo "Full development variant installed. Available commands:"
echo " core dev - Multi-repo workflows"
echo " core build - Cross-platform builds"
echo " core release - Build and publish releases"