publish cli and add install scripts from the quickstart guide

This commit is contained in:
Dillon DuPont
2025-11-12 13:04:57 -05:00
parent 046b33c3ca
commit d8f91d0830
6 changed files with 262 additions and 10 deletions

65
scripts/install-cli.ps1 Normal file
View File

@@ -0,0 +1,65 @@
# CUA CLI Installation Script for Windows
$ErrorActionPreference = "Stop"
Write-Host "🚀 Installing CUA CLI..." -ForegroundColor Green
# Check if bun is already installed
try {
$bunVersion = bun --version 2>$null
Write-Host "✅ Bun is already installed (version $bunVersion)" -ForegroundColor Green
} catch {
Write-Host "📦 Installing Bun..." -ForegroundColor Yellow
try {
powershell -c "irm bun.sh/install.ps1|iex"
# Refresh environment variables
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
# Add bun to PATH for this session if not already there
$bunPath = "$env:USERPROFILE\.bun\bin"
if ($env:Path -notlike "*$bunPath*") {
$env:Path = "$bunPath;$env:Path"
}
} catch {
Write-Host "❌ Failed to install Bun. Please install manually from https://bun.sh" -ForegroundColor Red
exit 1
}
}
# Verify bun installation
try {
$bunVersion = bun --version 2>$null
Write-Host "✅ Bun verified (version $bunVersion)" -ForegroundColor Green
} catch {
Write-Host "❌ Bun installation failed. Please install manually from https://bun.sh" -ForegroundColor Red
exit 1
}
Write-Host "📦 Installing CUA CLI..." -ForegroundColor Yellow
try {
bun add -g @trycua/cli
} catch {
Write-Host "❌ Failed to install CUA CLI with Bun. Trying with npm..." -ForegroundColor Yellow
try {
npm install -g @trycua/cli
} catch {
Write-Host "❌ Installation failed. Please ensure you have Node.js or Bun installed." -ForegroundColor Red
exit 1
}
}
# Verify installation
try {
$cuaVersion = cua --version 2>$null
Write-Host "✅ CUA CLI installed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "🎉 Get started with:" -ForegroundColor Cyan
Write-Host " cua auth login" -ForegroundColor White
Write-Host " cua vm create --os linux --configuration small --region north-america" -ForegroundColor White
Write-Host ""
Write-Host "📚 For more help, visit: https://docs.cua.ai/libraries/cua-cli" -ForegroundColor Cyan
} catch {
Write-Host "❌ Installation verification failed. Please try installing manually:" -ForegroundColor Red
Write-Host " npm install -g @trycua/cli" -ForegroundColor White
exit 1
}

47
scripts/install-cli.sh Normal file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
set -e
# CUA CLI Installation Script for macOS/Linux
echo "🚀 Installing CUA CLI..."
# Check if bun is already installed
if command -v bun &> /dev/null; then
echo "✅ Bun is already installed"
else
echo "📦 Installing Bun..."
curl -fsSL https://bun.sh/install | bash
# Source the shell profile to make bun available
if [ -f "$HOME/.bashrc" ]; then
source "$HOME/.bashrc"
elif [ -f "$HOME/.zshrc" ]; then
source "$HOME/.zshrc"
fi
# Add bun to PATH for this session
export PATH="$HOME/.bun/bin:$PATH"
fi
# Verify bun installation
if ! command -v bun &> /dev/null; then
echo "❌ Failed to install Bun. Please install manually from https://bun.sh"
exit 1
fi
echo "📦 Installing CUA CLI..."
bun add -g @trycua/cli
# Verify installation
if command -v cua &> /dev/null; then
echo "✅ CUA CLI installed successfully!"
echo ""
echo "🎉 Get started with:"
echo " cua auth login"
echo " cua vm create --os linux --configuration small --region north-america"
echo ""
echo "📚 For more help, visit: https://docs.cua.ai/libraries/cua-cli"
else
echo "❌ Installation failed. Please try installing manually:"
echo " npm install -g @trycua/cli"
exit 1
fi