fix: v2.2.2 - Python/pwsh 降为可选依赖 + quick-start 安装前准备
- Python 从核心 deps 移除 (只在 uvx MCP 需要) - PowerShell 7 降为可选 (系统 PS 5.1 可替代) - 非核心依赖 winget 不可用时不弹阻断对话框 - quick-start.html 新增"安装前准备"区块 (ExecutionPolicy + 手动装依赖) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
edee7b777e
commit
9d1cef0331
@ -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) {
|
||||
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
|
||||
|
||||
@ -77,6 +77,30 @@
|
||||
<div class="ver">v1.5 | 92 Skills / 18 Agents / 34 Hooks<br>打印后贴在显示器旁边</div>
|
||||
</div>
|
||||
|
||||
<!-- ==================== 安装前准备 ==================== -->
|
||||
<div class="section">
|
||||
<span class="section-title red">安装前准备 (仅首次)</span>
|
||||
|
||||
<div class="card warn">
|
||||
<h3>⚠ 首次运行 Bookworm-Setup.exe 前,请确认以下两项</h3>
|
||||
<table>
|
||||
<tr><th style="width:30%">检查项</th><th>操作</th></tr>
|
||||
<tr>
|
||||
<td><strong>1. PowerShell 执行策略</strong></td>
|
||||
<td>按 <kbd>Win</kbd>+<kbd>R</kbd> 输入 <code>powershell</code> 回车,执行:<br>
|
||||
<code>Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force</code><br>
|
||||
<span style="font-size:8pt;color:#64748b">否则 npm/node 脚本会被系统阻止运行</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>2. 代理已开启</strong></td>
|
||||
<td>启动 Clash / V2Ray / 快柠檬(任选一个),安装器需要下载依赖</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p style="font-size:8pt;color:#64748b;margin-top:4px">如果电脑没有 winget(Win10 旧版本),安装器可能无法自动装 Node.js 和 Git。请手动安装:<br>
|
||||
Node.js → <code>https://nodejs.org</code> | Git → <code>https://git-scm.com</code></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ==================== 打开 PowerShell ==================== -->
|
||||
<div class="section">
|
||||
<span class="section-title">第零步:打开 PowerShell</span>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user