# Dev Box 软件包下载脚本 (Windows PowerShell) # 使用国内镜像源,加速下载 $ErrorActionPreference = "Stop" $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $PackagesDir = Join-Path $ScriptDir "packages" New-Item -ItemType Directory -Force -Path $PackagesDir | Out-Null Set-Location $PackagesDir Write-Host "" Write-Host "========================================" -ForegroundColor Cyan Write-Host " Dev Box 软件包下载(国内镜像)" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # ============ Node.js ============ $NodeVersion = "v24.14.0" $NodeFile = "node-$NodeVersion-linux-x64.tar.xz" Write-Host "[1/5] Node.js $NodeVersion..." -ForegroundColor Yellow if (-not (Test-Path $NodeFile)) { # 淘宝镜像 Invoke-WebRequest -Uri "https://npmmirror.com/mirrors/node/$NodeVersion/$NodeFile" -OutFile $NodeFile Write-Host " ✓ 下载完成" -ForegroundColor Green } else { Write-Host " - 已存在,跳过" -ForegroundColor Gray } # ============ Go ============ $GoVersion = "1.26.1" $GoFile = "go$GoVersion.linux-amd64.tar.gz" Write-Host "[2/5] Go $GoVersion..." -ForegroundColor Yellow if (-not (Test-Path $GoFile)) { # Go 官方中国镜像 Invoke-WebRequest -Uri "https://golang.google.cn/dl/$GoFile" -OutFile $GoFile Write-Host " ✓ 下载完成" -ForegroundColor Green } else { Write-Host " - 已存在,跳过" -ForegroundColor Gray } # ============ Rust ============ $RustVersion = "1.94.0" $RustFile = "rust-$RustVersion-x86_64-unknown-linux-gnu.tar.xz" Write-Host "[3/5] Rust $RustVersion..." -ForegroundColor Yellow if (-not (Test-Path $RustFile)) { # 中科大镜像 Invoke-WebRequest -Uri "https://mirrors.ustc.edu.cn/rust-static/dist/$RustFile" -OutFile $RustFile Write-Host " ✓ 下载完成" -ForegroundColor Green } else { Write-Host " - 已存在,跳过" -ForegroundColor Gray } # ============ Claude Code ============ Write-Host "[4/5] Claude Code..." -ForegroundColor Yellow if (-not (Test-Path "claude-code-2.1.79.tgz")) { # 设置淘宝镜像并下载 npm pack @anthropic-ai/claude-code@2.1.79 --registry=https://registry.npmmirror.com # 重命名 Get-ChildItem "anthropic-ai-claude-code-*.tgz" | ForEach-Object { Rename-Item $_.FullName "claude-code-2.1.79.tgz" -Force } Write-Host " ✓ 下载完成" -ForegroundColor Green } else { Write-Host " - 已存在,跳过" -ForegroundColor Gray } # ============ OpenClaw ============ Write-Host "[5/5] OpenClaw..." -ForegroundColor Yellow if (-not (Test-Path "openclaw-2026.3.13.tgz")) { # 设置淘宝镜像并下载 npm pack openclaw@2026.3.13 --registry=https://registry.npmmirror.com # 重命名 Get-ChildItem "openclaw-*.tgz" | ForEach-Object { Rename-Item $_.FullName "openclaw-2026.3.13.tgz" -Force } Write-Host " ✓ 下载完成" -ForegroundColor Green } else { Write-Host " - 已存在,跳过" -ForegroundColor Gray } Write-Host "" Write-Host "========================================" -ForegroundColor Cyan Write-Host " 下载完成" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" Write-Host "文件列表:" -ForegroundColor White Get-ChildItem $PackagesDir -Filter "*.tar.*" | ForEach-Object { Write-Host " $($_.Name) ($('{0:N0}' -f ($_.Length/1MB)) MB)" } Get-ChildItem $PackagesDir -Filter "*.tgz" | ForEach-Object { Write-Host " $($_.Name) ($('{0:N0}' -f ($_.Length/1MB)) MB)" } $TotalSize = (Get-ChildItem $PackagesDir | Measure-Object -Property Length -Sum).Sum / 1MB Write-Host "" Write-Host "总大小: $('{0:N0}' -f $TotalSize) MB" -ForegroundColor Cyan