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
123 changes: 61 additions & 62 deletions install/install.ps1
Original file line number Diff line number Diff line change
@@ -1,101 +1,100 @@
$ErrorActionPreference = "Stop"


$Repo = "HiveSofts/hive-cli"
$Binary = "hive.exe"

# Colors
$Green = [System.ConsoleColor]::Green
$Yellow = [System.ConsoleColor]::Yellow
$Cyan = [System.ConsoleColor]::Cyan
$Red = [System.ConsoleColor]::Red
$Blue = [System.ConsoleColor]::Blue

Write-Host ""
Write-Host "🐝 Hive CLI Installer"
Write-Host "━━━━━━━━━━━━━━━━━━━━"
Write-Host " 🐝 Hive CLI Installer" -ForegroundColor $Cyan -NoNewline
Write-Host ""
Write-Host " ━━━━━━━━━━━━━━━━━━━━" -ForegroundColor $Blue
Write-Host ""

Write-Host " ⏳ Detecting latest version..." -ForegroundColor $Yellow

$Release = Invoke-RestMethod `
"https://api.github.com/repos/$Repo/releases/latest"


$Version = $Release.tag_name

try {
$Release = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/latest" -ErrorAction Stop
$Version = $Release.tag_name
} catch {
Write-Host " ❌ Failed to detect latest Hive version" -ForegroundColor $Red
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor $Red
exit 1
}

Write-Host "Version: $Version"
Write-Host "Version: $Version" -ForegroundColor $Green
Write-Host ""


$Asset = "hive-windows.exe"
$DownloadUrl = "https://github.com/$Repo/releases/download/$Version/$Asset"

Write-Host " ⬇️ Downloading Hive..." -ForegroundColor $Yellow

$DownloadUrl = `
"https://github.com/$Repo/releases/download/$Version/$Asset"



$temp = Join-Path `
$env:TEMP `
$Binary



Write-Host "⬇️ Downloading Hive..."

Invoke-WebRequest `
-Uri $DownloadUrl `
-OutFile $temp
$temp = Join-Path $env:TEMP $Binary

try {
Invoke-WebRequest -Uri $DownloadUrl -OutFile $temp -ErrorAction Stop
} catch {
Write-Host " ❌ Download failed" -ForegroundColor $Red
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor $Red
exit 1
}

if (!(Test-Path $temp) -or (Get-Item $temp).Length -eq 0) {
Write-Host " ❌ Download failed — file is empty" -ForegroundColor $Red
exit 1
}

$InstallDir = "$env:USERPROFILE\.hive\bin"


if (!(Test-Path $InstallDir)) {
New-Item `
-ItemType Directory `
-Path $InstallDir | Out-Null
Write-Host " 📁 Creating $InstallDir..." -ForegroundColor $Yellow
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
}

$Target = Join-Path $InstallDir $Binary

Write-Host " 📦 Installing Hive..." -ForegroundColor $Yellow

$Target = Join-Path `
$InstallDir `
$Binary



Move-Item `
-Force `
$temp `
$Target


Move-Item -Force $temp $Target

Write-Host ""
Write-Host "⚙️ Updating PATH..."



$currentPath = [Environment]::GetEnvironmentVariable(
"Path",
"User"
)
Write-Host " ⚙️ Updating PATH..." -ForegroundColor $Yellow

$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")

if ($currentPath -notlike "*$InstallDir*") {
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$InstallDir", "User")

[Environment]::SetEnvironmentVariable(
"Path",
"$currentPath;$InstallDir",
"User"
)

# Update current session PATH
$env:Path += ";$InstallDir"
} else {
Write-Host " ℹ️ PATH already contains $InstallDir" -ForegroundColor $Blue
}



Write-Host ""
Write-Host "✅ Hive installed successfully"
Write-Host " ✅ Hive installed successfully!" -ForegroundColor $Green -NoNewline
Write-Host ""

Write-Host "Restart terminal then run:"
# Test installation
Write-Host ""
if (Get-Command hive -ErrorAction SilentlyContinue) {
Write-Host " Version:" -ForegroundColor $Cyan
hive --version 2>$null
} else {
Write-Host " ⚠️ Hive not found in current session PATH" -ForegroundColor $Yellow
Write-Host ""
Write-Host " To use Hive in this terminal, run:" -ForegroundColor $Yellow
Write-Host " `$env:Path += `";$InstallDir`"" -ForegroundColor $Cyan
}

Write-Host " hive --help"
Write-Host ""
Write-Host " 🚀 Get started:" -ForegroundColor $Cyan -NoNewline
Write-Host ""
Write-Host " hive --help" -ForegroundColor $Cyan
Write-Host ""
83 changes: 44 additions & 39 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,102 +4,107 @@ set -e

REPO="HiveSofts/hive-cli"
BINARY="hive"

INSTALL_DIR="/usr/local/bin"

# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
BOLD='\033[1m'
RESET='\033[0m'

echo ""
echo -e "${CYAN}${BOLD} 🐝 Hive CLI Installer${RESET}"
echo -e "${BLUE} ━━━━━━━━━━━━━━━━━━━━${RESET}"
echo ""

# Detect latest version
echo -e "${YELLOW} ⏳ Detecting latest version...${RESET}"
VERSION=$(curl -s https://api.github.com/repos/$REPO/releases/latest \
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/')
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/')

if [ -z "$VERSION" ]; then
echo "❌ Failed to detect latest Hive version"
echo -e "${RED} ❌ Failed to detect latest Hive version${RESET}"
exit 1
fi


echo -e "${GREEN} ✅ Version: ${BOLD}${VERSION}${RESET}"
echo ""
echo "🐝 Hive CLI Installer"
echo "━━━━━━━━━━━━━━━━━━━━"
echo "Version: $VERSION"
echo ""


# Detect OS
OS="$(uname -s)"
ARCH="$(uname -m)"


case "$OS" in
Linux)
PLATFORM="linux"
;;

Darwin)
PLATFORM="macos"
;;

*)
echo "❌ Unsupported operating system"
echo -e "${RED} ❌ Unsupported operating system: $OS${RESET}"
exit 1
;;
esac


case "$ARCH" in
x86_64)
x86_64|amd64)
ARCH="x86_64"
;;

aarch64|arm64)
ARCH="aarch64"
;;

*)
echo "❌ Unsupported architecture: $ARCH"
echo -e "${RED} ❌ Unsupported architecture: $ARCH${RESET}"
exit 1
;;
esac


ASSET="hive-$PLATFORM"


DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION/$ASSET"


echo "⬇️ Downloading Hive..."
echo "$DOWNLOAD_URL"

echo -e "${YELLOW} ⬇️ Downloading Hive...${RESET}"
echo -e "${BLUE} ${DOWNLOAD_URL}${RESET}"

TMP=$(mktemp)

# Download with progress
curl -L --progress-bar "$DOWNLOAD_URL" -o "$TMP"

curl -L "$DOWNLOAD_URL" -o "$TMP"

if [ ! -s "$TMP" ]; then
echo -e "${RED} ❌ Download failed — file is empty${RESET}"
exit 1
fi

chmod +x "$TMP"


echo ""
echo "📦 Installing Hive..."

echo -e "${YELLOW} 📦 Installing Hive...${RESET}"

if [ -w "$INSTALL_DIR" ]; then
mv "$TMP" "$INSTALL_DIR/$BINARY"
else
sudo mv "$TMP" "$INSTALL_DIR/$BINARY"
fi


echo ""
echo "✅ Hive installed successfully"
echo -e "${GREEN}${BOLD} ✅ Hive installed successfully!${RESET}"
echo ""

echo "Version:"
hive --version || true
# Test installation
if command -v hive &> /dev/null; then
echo -e "${CYAN} Version:${RESET}"
hive --version 2>/dev/null || echo -e "${YELLOW} (version info not available)${RESET}"
else
echo -e "${YELLOW} ⚠️ Hive not found in PATH. Try:${RESET}"
echo -e " export PATH=\$PATH:$INSTALL_DIR"
fi

echo ""

echo "Run:"
echo " hive --help"

echo -e "${CYAN}${BOLD} 🚀 Get started:${RESET}"
echo -e " ${BOLD}hive --help${RESET}"
echo ""
Loading