diff --git a/auto-setup.ps1 b/auto-setup.ps1 index d591064..0b3acab 100644 --- a/auto-setup.ps1 +++ b/auto-setup.ps1 @@ -16,7 +16,7 @@ param( $ErrorActionPreference = "Stop" # ─── 版本号 (每次更新递增, build.ps1 自动读取) ────── -$BWVersion = "2.2.1" +$BWVersion = "2.2.2" # ─── B4: 单实例保护 (防止双击两次导致竞态) ───────── $mutexCreated = $false @@ -570,11 +570,12 @@ Log-Phase 1 "环境检测 + 依赖自动安装" $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") $deps = @( - @{ Name = "Node.js"; Cmd = "node"; WingetId = "OpenJS.NodeJS.LTS"; NpmPkg = $null; PipPkg = $null } - @{ Name = "Git"; Cmd = "git"; WingetId = "Git.Git"; NpmPkg = $null; PipPkg = $null } - @{ Name = "PowerShell 7"; Cmd = "pwsh"; WingetId = "Microsoft.PowerShell"; NpmPkg = $null; PipPkg = $null } - @{ Name = "Python 3.12"; Cmd = "python"; WingetId = "Python.Python.3.12"; NpmPkg = $null; PipPkg = $null } - @{ Name = "Claude Code"; Cmd = "claude"; WingetId = $null; NpmPkg = "@anthropic-ai/claude-code"; PipPkg = $null } + # 核心依赖 (缺失则尝试自动安装) + @{ Name = "Node.js"; Cmd = "node"; WingetId = "OpenJS.NodeJS.LTS"; NpmPkg = $null; PipPkg = $null; Core = $true } + @{ Name = "Git"; Cmd = "git"; WingetId = "Git.Git"; NpmPkg = $null; PipPkg = $null; Core = $true } + @{ Name = "PowerShell 7"; Cmd = "pwsh"; WingetId = "Microsoft.PowerShell"; NpmPkg = $null; PipPkg = $null; Core = $false } + @{ Name = "Claude Code"; Cmd = "claude"; WingetId = $null; NpmPkg = "@anthropic-ai/claude-code"; PipPkg = $null; Core = $true } + # Python 移到可选依赖 (不在此列表, 由 line 753 单独处理) ) $hasWinget = Test-Cmd "winget" @@ -612,8 +613,12 @@ foreach ($dep in $deps) { } catch { Log-Fail "$($dep.Name) npm 安装失败: $_" } } elseif (-not $hasWinget) { - Log-Fail "$($dep.Name) 需要手动安装 (winget 不可用)" - Show-MsgBox "$($dep.Name) 未安装且 winget 不可用。`n请手动安装后重新运行。`n`nNode.js: https://nodejs.org`nGit: https://git-scm.com" "缺少依赖" "OK" "Error" + if ($dep.Core) { + Log-Fail "$($dep.Name) 需要手动安装 (winget 不可用)" + Show-MsgBox "$($dep.Name) 未安装且 winget 不可用。`n请手动安装后重新运行。`n`nNode.js: https://nodejs.org`nGit: https://git-scm.com" "缺少依赖" "OK" "Error" + } else { + Log-Info "$($dep.Name) 未安装 (可选, 不影响核心功能)" + } } } } @@ -721,16 +726,18 @@ if (Test-Cmd "uv") { $opensslCmd = Find-OpenSSL if ($opensslCmd) { Log-OK "OpenSSL: $opensslCmd" } else { Log-Warn "OpenSSL 未找到 (凭证解密可能失败)" } -# 最终检查 (核心四件套必须) -if (-not (Test-Cmd "node") -or -not (Test-Cmd "git") -or -not (Test-Cmd "claude") -or -not (Test-Cmd "pwsh")) { +# 最终检查 (仅 Node.js + Git + Claude Code 为硬性依赖, PowerShell 7 可选) +if (-not (Test-Cmd "node") -or -not (Test-Cmd "git") -or -not (Test-Cmd "claude")) { $missing = @() if (-not (Test-Cmd "node")) { $missing += "Node.js" } if (-not (Test-Cmd "git")) { $missing += "Git" } - if (-not (Test-Cmd "pwsh")) { $missing += "PowerShell 7" } if (-not (Test-Cmd "claude")) { $missing += "Claude Code" } - Show-MsgBox "以下核心依赖安装失败: $($missing -join ', ')`n`n请手动安装后重新运行。" "安装中断" "OK" "Error" + Show-MsgBox "以下核心依赖安装失败: $($missing -join ', ')`n`n请手动安装后重新运行。`n`nNode.js: https://nodejs.org`nGit: https://git-scm.com" "安装中断" "OK" "Error" exit 1 } +if (-not (Test-Cmd "pwsh")) { + Log-Info "PowerShell 7 未安装 (可选, 用系统 PowerShell 5.1 替代)" +} # 定位 pwsh.exe 完整路径 (供后续 settings.json 配置使用) $PwshPath = (Get-Command pwsh -ErrorAction SilentlyContinue).Source diff --git a/quick-start.html b/quick-start.html index 4c7d043..e9a0f45 100644 --- a/quick-start.html +++ b/quick-start.html @@ -77,6 +77,30 @@
v1.5 | 92 Skills / 18 Agents / 34 Hooks
打印后贴在显示器旁边
+ +
+ 安装前准备 (仅首次) + +
+

⚠ 首次运行 Bookworm-Setup.exe 前,请确认以下两项

+ + + + + + + + + + +
检查项操作
1. PowerShell 执行策略Win+R 输入 powershell 回车,执行:
+ Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
+ 否则 npm/node 脚本会被系统阻止运行
2. 代理已开启启动 Clash / V2Ray / 快柠檬(任选一个),安装器需要下载依赖
+

如果电脑没有 winget(Win10 旧版本),安装器可能无法自动装 Node.js 和 Git。请手动安装:
+ Node.js → https://nodejs.org  |  Git → https://git-scm.com

+
+
+
第零步:打开 PowerShell