feat: full auto-install chain for all platforms
- Wire ensure_claude_code() into cmd_update() — auto npm install if missing - uclaude_install.sh: auto-install git, python3, curl via apt/dnf/yum/brew - uclaude_update.bat: prereq checks with winget install suggestions - uclaude_update.ps1: auto-install via winget (git, python, node) - install_node(): macOS support via brew, RHEL/Fedora via rpm.nodesource - Increased npm install timeout to 300s for slow connections
This commit is contained in:
@@ -6,10 +6,56 @@ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$RepoRoot = Split-Path -Parent $ScriptDir
|
||||
Set-Location $RepoRoot
|
||||
|
||||
# Pull latest artifacts
|
||||
# ---- Check prerequisites ----
|
||||
|
||||
function Test-Command($cmd) {
|
||||
return [bool](Get-Command $cmd -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
||||
function Install-WithWinget($id, $name) {
|
||||
if (Test-Command "winget") {
|
||||
Write-Host " Installing $name via winget..." -ForegroundColor Yellow
|
||||
winget install --id $id --accept-package-agreements --accept-source-agreements -e
|
||||
# Refresh PATH
|
||||
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||
return $true
|
||||
}
|
||||
return $false
|
||||
}
|
||||
|
||||
# Git
|
||||
if (-not (Test-Command "git")) {
|
||||
Write-Host " git not found." -ForegroundColor Red
|
||||
if (-not (Install-WithWinget "Git.Git" "Git")) {
|
||||
Write-Host " Install manually: https://git-scm.com/download/win" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Python
|
||||
$hasPython = (Test-Command "python3") -or (Test-Command "python")
|
||||
if (-not $hasPython) {
|
||||
Write-Host " Python not found." -ForegroundColor Red
|
||||
if (-not (Install-WithWinget "Python.Python.3.12" "Python 3.12")) {
|
||||
Write-Host " Install manually: https://www.python.org/downloads/" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Node.js
|
||||
if (-not (Test-Command "node")) {
|
||||
Write-Host " Node.js not found." -ForegroundColor Yellow
|
||||
if (-not (Install-WithWinget "OpenJS.NodeJS" "Node.js")) {
|
||||
Write-Host " Install manually: https://nodejs.org/" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# ---- Pull latest artifacts ----
|
||||
|
||||
git pull --quiet 2>$null
|
||||
|
||||
# Check admin
|
||||
# ---- Check admin ----
|
||||
|
||||
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
if (-not $isAdmin) {
|
||||
Write-Host "Re-running as Administrator..." -ForegroundColor Yellow
|
||||
@@ -17,5 +63,7 @@ if (-not $isAdmin) {
|
||||
exit
|
||||
}
|
||||
|
||||
# Run updater
|
||||
& python claude\uclaude_updater.py @args
|
||||
# ---- Run updater ----
|
||||
|
||||
$pythonCmd = if (Test-Command "python3") { "python3" } else { "python" }
|
||||
& $pythonCmd claude\uclaude_updater.py @args
|
||||
|
||||
Reference in New Issue
Block a user